README.udp 874 B

1234567891011121314151617181920212223242526272829303132333435
  1. Udp framework
  2. The udp framework is build on top of network framework and is designed
  3. to define new protocol or new command based on udp without modifying
  4. the network framework.
  5. The udp framework define a function udp_loop that take as argument
  6. a structure udp_ops (defined in include/net/udp.h) :
  7. struct udp_ops {
  8. int (*prereq)(void *data);
  9. int (*start)(void *data);
  10. void *data;
  11. };
  12. The callback prereq define if all the requirements are
  13. valid before running the network/udp loop.
  14. The callback start define the first step in the network/udp loop,
  15. and it may also be used to configure a timemout and udp handler.
  16. The pointer data is used to store private data that
  17. could be used by both callback.
  18. A simple example to use this framework:
  19. static struct udp_ops udp_ops = {
  20. .prereq = wmp_prereq,
  21. .start = wmp_start,
  22. .data = NULL,
  23. };
  24. ...
  25. err = udp_loop(&udp_ops);