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