|
@@ -0,0 +1,49 @@
|
|
1
|
+#ifndef _GPXE_UDP_H
|
|
2
|
+#define _GPXE_UDP_H
|
|
3
|
+
|
|
4
|
+/** @file
|
|
5
|
+ *
|
|
6
|
+ * UDP protocol
|
|
7
|
+ *
|
|
8
|
+ * This file defines the gPXE UDP API.
|
|
9
|
+ *
|
|
10
|
+ */
|
|
11
|
+
|
|
12
|
+#include <stddef.h>
|
|
13
|
+#include <gpxe/in.h>
|
|
14
|
+
|
|
15
|
+struct udp_connection;
|
|
16
|
+
|
|
17
|
+/**
|
|
18
|
+ * UDP operations
|
|
19
|
+ *
|
|
20
|
+ */
|
|
21
|
+struct udp_operations {
|
|
22
|
+ /**
|
|
23
|
+ * New data received
|
|
24
|
+ *
|
|
25
|
+ * @v conn UDP connection
|
|
26
|
+ * @v data Data
|
|
27
|
+ * @v len Length of data
|
|
28
|
+ */
|
|
29
|
+ void ( * newdata ) ( struct udp_connection *conn,
|
|
30
|
+ void *data, size_t len );
|
|
31
|
+};
|
|
32
|
+
|
|
33
|
+/**
|
|
34
|
+ * A UDP connection
|
|
35
|
+ *
|
|
36
|
+ */
|
|
37
|
+struct udp_connection {
|
|
38
|
+ /** Address of the remote end of the connection */
|
|
39
|
+ struct sockaddr_in sin;
|
|
40
|
+ /** Operations table for this connection */
|
|
41
|
+ struct udp_operations *udp_op;
|
|
42
|
+};
|
|
43
|
+
|
|
44
|
+extern void udp_connect ( struct udp_connection *conn );
|
|
45
|
+extern void udp_send ( struct udp_connection *conn, const void *data,
|
|
46
|
+ size_t len );
|
|
47
|
+extern void udp_close ( struct udp_connection *conn );
|
|
48
|
+
|
|
49
|
+#endif /* _GPXE_UDP_H */
|