summaryrefslogtreecommitdiff
path: root/toxcore/network.h
diff options
context:
space:
mode:
authorDiadlo <polsha3@gmail.com>2017-03-18 22:22:28 +0300
committerDiadlo <polsha3@gmail.com>2017-08-24 21:09:40 +0300
commitf084f2c621b75a146ccefecbffa9be5f514297e3 (patch)
tree5613f5a66c3c37f3c5982c08b54ed45cfa9d209a /toxcore/network.h
parent491d03c229d5fe684a38bac2abc4ef2617da2bba (diff)
Add loopback and broadcast constants
Diffstat (limited to 'toxcore/network.h')
-rw-r--r--toxcore/network.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/toxcore/network.h b/toxcore/network.h
index d2899c38..f57c6897 100644
--- a/toxcore/network.h
+++ b/toxcore/network.h
@@ -130,12 +130,15 @@ typedef enum NET_PACKET_TYPE {
130#define TCP_FAMILY (TOX_AF_INET6 + 4) 130#define TCP_FAMILY (TOX_AF_INET6 + 4)
131 131
132typedef union { 132typedef union {
133 uint8_t uint8[4];
134 uint16_t uint16[2];
135 uint32_t uint32; 133 uint32_t uint32;
134 uint16_t uint16[2];
135 uint8_t uint8[4];
136} 136}
137IP4; 137IP4;
138 138
139extern const IP4 IP4_LOOPBACK;
140extern const IP4 IP4_BROADCAST;
141
139typedef union { 142typedef union {
140 uint8_t uint8[16]; 143 uint8_t uint8[16];
141 uint16_t uint16[8]; 144 uint16_t uint16[8];
@@ -144,6 +147,9 @@ typedef union {
144} 147}
145IP6; 148IP6;
146 149
150extern const IP6 IP6_LOOPBACK;
151extern const IP6 IP6_BROADCAST;
152
147typedef struct { 153typedef struct {
148 uint8_t family; 154 uint8_t family;
149 GNU_EXTENSION union { 155 GNU_EXTENSION union {
@@ -212,8 +218,8 @@ const char *ip_ntoa(const IP *ip, char *ip_str, size_t length);
212 * input 218 * input
213 * ip: ip of TOX_AF_INET or TOX_AF_INET6 families 219 * ip: ip of TOX_AF_INET or TOX_AF_INET6 families
214 * length: length of the address buffer 220 * length: length of the address buffer
215 * Must be at least INET_ADDRSTRLEN for TOX_AF_INET 221 * Must be at least TOX_INET_ADDRSTRLEN for TOX_AF_INET
216 * and INET6_ADDRSTRLEN for TOX_AF_INET6 222 * and TOX_INET6_ADDRSTRLEN for TOX_AF_INET6
217 * 223 *
218 * output 224 * output
219 * address: dotted notation (IPv4: quad, IPv6: 16) or colon notation (IPv6) 225 * address: dotted notation (IPv4: quad, IPv6: 16) or colon notation (IPv6)