diff options
author | Diadlo <polsha3@gmail.com> | 2017-03-18 22:22:28 +0300 |
---|---|---|
committer | Diadlo <polsha3@gmail.com> | 2017-08-24 21:09:40 +0300 |
commit | f084f2c621b75a146ccefecbffa9be5f514297e3 (patch) | |
tree | 5613f5a66c3c37f3c5982c08b54ed45cfa9d209a /toxcore/network.h | |
parent | 491d03c229d5fe684a38bac2abc4ef2617da2bba (diff) |
Add loopback and broadcast constants
Diffstat (limited to 'toxcore/network.h')
-rw-r--r-- | toxcore/network.h | 14 |
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 | ||
132 | typedef union { | 132 | typedef 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 | } |
137 | IP4; | 137 | IP4; |
138 | 138 | ||
139 | extern const IP4 IP4_LOOPBACK; | ||
140 | extern const IP4 IP4_BROADCAST; | ||
141 | |||
139 | typedef union { | 142 | typedef 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 | } |
145 | IP6; | 148 | IP6; |
146 | 149 | ||
150 | extern const IP6 IP6_LOOPBACK; | ||
151 | extern const IP6 IP6_BROADCAST; | ||
152 | |||
147 | typedef struct { | 153 | typedef 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) |