summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPhilippe Reynes <philippe.reynes@softathome.com>2020-09-18 15:13:00 +0300
committerTom Rini <trini@konsulko.com>2020-09-30 23:55:03 +0300
commitb43ea1bf18bf4ba5eeec7131c1a19d864399e422 (patch)
tree5ae63ab33c462f8c016a61f31eea62c8240dd6e5 /doc
parentcafaa301c98aa8f1b81cf61a91d22d5d68b4b1d3 (diff)
downloadu-boot-b43ea1bf18bf4ba5eeec7131c1a19d864399e422.tar.xz
net: add a generic udp protocol
This commit adds a generic udp protocol framework in the network loop. So protocol based on udp may be implemented without modifying the network loop (for example custom wait magic packet). Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/README.udp35
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/README.udp b/doc/README.udp
new file mode 100644
index 0000000000..da0725719d
--- /dev/null
+++ b/doc/README.udp
@@ -0,0 +1,35 @@
+Udp framework
+
+The udp framework is build on top of network framework and is designed
+to define new protocol or new command based on udp without modifying
+the network framework.
+
+The udp framework define a function udp_loop that take as argument
+a structure udp_ops (defined in include/net/udp.h) :
+
+struct udp_ops {
+ int (*prereq)(void *data);
+ int (*start)(void *data);
+ void *data;
+};
+
+The callback prereq define if all the requirements are
+valid before running the network/udp loop.
+
+The callback start define the first step in the network/udp loop,
+and it may also be used to configure a timemout and udp handler.
+
+The pointer data is used to store private data that
+could be used by both callback.
+
+A simple example to use this framework:
+
+static struct udp_ops udp_ops = {
+ .prereq = wmp_prereq,
+ .start = wmp_start,
+ .data = NULL,
+};
+
+...
+
+err = udp_loop(&udp_ops);