|
@@ -3,31 +3,91 @@
|
3
|
3
|
|
4
|
4
|
#include <stdint.h>
|
5
|
5
|
|
|
6
|
+/* Protocol numbers */
|
|
7
|
+
|
6
|
8
|
#define IP_ICMP 1
|
7
|
9
|
#define IP_IGMP 2
|
8
|
10
|
#define IP_TCP 6
|
9
|
11
|
#define IP_UDP 17
|
10
|
12
|
|
|
13
|
+/* Network address family numbers */
|
|
14
|
+
|
|
15
|
+#define AF_INET 1
|
|
16
|
+#define AF_INET6 2
|
|
17
|
+#define AF_802 6
|
|
18
|
+#define AF_IPX 11
|
|
19
|
+
|
|
20
|
+typedef uint16_t sa_family_t;
|
|
21
|
+
|
|
22
|
+/* IP address constants */
|
|
23
|
+
|
11
|
24
|
#define INADDR_NONE 0xffffffff
|
12
|
25
|
|
13
|
26
|
#define INADDR_BROADCAST 0xffffffff
|
14
|
27
|
|
15
|
28
|
#define IN_MULTICAST(addr) ( ( (addr) & 0xf0000000 ) == 0xe0000000 )
|
16
|
29
|
|
|
30
|
+/**
|
|
31
|
+ * IP address structure
|
|
32
|
+ */
|
17
|
33
|
struct in_addr {
|
18
|
34
|
uint32_t s_addr;
|
19
|
35
|
};
|
20
|
36
|
|
21
|
37
|
typedef struct in_addr in_addr;
|
22
|
38
|
|
|
39
|
+/**
|
|
40
|
+ * IP6 address structure
|
|
41
|
+ */
|
|
42
|
+struct in6_addr {
|
|
43
|
+ union {
|
|
44
|
+ uint8_t u6_addr8[16];
|
|
45
|
+ uint16_t u6_addr16[8];
|
|
46
|
+ uint32_t u6_addr32[4];
|
|
47
|
+ } in16_u;
|
|
48
|
+#define s6_addr in6_u.u6_addr8
|
|
49
|
+#define s6_addr16 in6_u.u6_addr16
|
|
50
|
+#define s6_addr32 in6_u.u6_addr32
|
|
51
|
+};
|
|
52
|
+
|
23
|
53
|
typedef uint16_t in_port_t;
|
24
|
54
|
|
|
55
|
+/**
|
|
56
|
+ * IP socket address
|
|
57
|
+ */
|
25
|
58
|
struct sockaddr_in {
|
26
|
59
|
struct in_addr sin_addr;
|
27
|
60
|
in_port_t sin_port;
|
28
|
61
|
};
|
29
|
62
|
|
|
63
|
+/**
|
|
64
|
+ * IPv6 socket address
|
|
65
|
+ */
|
|
66
|
+struct sockaddr_in6 {
|
|
67
|
+ in_port_t sin6_port; /* Destination port */
|
|
68
|
+ uint32_t sin6_flowinfo; /* Flow number */
|
|
69
|
+ struct in6_addr sin6_addr; /* 128-bit destination address */
|
|
70
|
+ uint32_t sin6_scope_id; /* Scope ID */
|
|
71
|
+};
|
|
72
|
+
|
|
73
|
+/**
|
|
74
|
+ * Generalized socket address structure
|
|
75
|
+ */
|
|
76
|
+struct sockaddr {
|
|
77
|
+ sa_family_t sa_family; /* Socket address family */
|
|
78
|
+ struct sockaddr_in sin; /* IP4 socket address */
|
|
79
|
+ struct sockaddr_in6 sin6; /* IP6 socket address */
|
|
80
|
+};
|
|
81
|
+
|
30
|
82
|
extern int inet_aton ( const char *cp, struct in_addr *inp );
|
31
|
83
|
extern char * inet_ntoa ( struct in_addr in );
|
32
|
84
|
|
|
85
|
+/* Adding the following for IP6 support
|
|
86
|
+ *
|
|
87
|
+
|
|
88
|
+extern int inet6_aton ( const char *cp, struct in6_addr *inp );
|
|
89
|
+extern char * inet6_ntoa ( struct in_addr in );
|
|
90
|
+
|
|
91
|
+ */
|
|
92
|
+
|
33
|
93
|
#endif /* _GPXE_IN_H */
|