ipv4.h
Go to the documentation of this file.
1 /**
2  * @file ipv4.h
3  * @brief IPv4 (Internet Protocol Version 4)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _IPV4_H
32 #define _IPV4_H
33 
34 //Forward declaration of structures
35 struct _Ipv4Header;
36 #define Ipv4Header struct _Ipv4Header
37 
38 struct _Ipv4PseudoHeader;
39 #define Ipv4PseudoHeader struct _Ipv4PseudoHeader
40 
41 //Dependencies
42 #include "core/net.h"
43 #include "core/ethernet.h"
44 #include "ipv4/ipv4_frag.h"
45 
46 //IPv4 support
47 #ifndef IPV4_SUPPORT
48  #define IPV4_SUPPORT ENABLED
49 #elif (IPV4_SUPPORT != ENABLED && IPV4_SUPPORT != DISABLED)
50  #error IPV4_SUPPORT parameter is not valid
51 #endif
52 
53 //IPsec support
54 #ifndef IPV4_IPSEC_SUPPORT
55  #define IPV4_IPSEC_SUPPORT DISABLED
56 #elif (IPV4_IPSEC_SUPPORT != ENABLED && IPV4_IPSEC_SUPPORT != DISABLED)
57  #error IPV4_IPSEC_SUPPORT parameter is not valid
58 #endif
59 
60 //Default IPv4 time-to-live value
61 #ifndef IPV4_DEFAULT_TTL
62  #define IPV4_DEFAULT_TTL 64
63 #elif (IPV4_DEFAULT_TTL < 1)
64  #error IPV4_DEFAULT_TTL parameter is not valid
65 #endif
66 
67 //Maximum number of IPv4 addresses
68 #ifndef IPV4_ADDR_LIST_SIZE
69  #define IPV4_ADDR_LIST_SIZE 1
70 #elif (IPV4_ADDR_LIST_SIZE < 1)
71  #error IPV4_ADDR_LIST_SIZE parameter is not valid
72 #endif
73 
74 //Maximum number of DNS servers
75 #ifndef IPV4_DNS_SERVER_LIST_SIZE
76  #define IPV4_DNS_SERVER_LIST_SIZE 2
77 #elif (IPV4_DNS_SERVER_LIST_SIZE < 1)
78  #error IPV4_DNS_SERVER_LIST_SIZE parameter is not valid
79 #endif
80 
81 //Size of the IPv4 multicast filter
82 #ifndef IPV4_MULTICAST_FILTER_SIZE
83  #define IPV4_MULTICAST_FILTER_SIZE 4
84 #elif (IPV4_MULTICAST_FILTER_SIZE < 1)
85  #error IPV4_MULTICAST_FILTER_SIZE parameter is not valid
86 #endif
87 
88 //Version number for IPv4
89 #define IPV4_VERSION 4
90 //Minimum MTU
91 #define IPV4_MINIMUM_MTU 68
92 //Default MTU
93 #define IPV4_DEFAULT_MTU 576
94 //Minimum header length
95 #define IPV4_MIN_HEADER_LENGTH 20
96 //Maximum header length
97 #define IPV4_MAX_HEADER_LENGTH 60
98 
99 //Shortcut to data field
100 #define IPV4_DATA(packet) ((uint8_t *) packet + packet->headerLength * 4)
101 
102 //Macro used for defining an IPv4 address
103 #ifdef _CPU_BIG_ENDIAN
104  #define IPV4_ADDR(a, b, c, d) (((uint32_t) (a) << 24) | ((b) << 16) | ((c) << 8) | (d))
105 #else
106  #define IPV4_ADDR(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((uint32_t) (d) << 24))
107 #endif
108 
109 //Unspecified IPv4 address
110 #define IPV4_UNSPECIFIED_ADDR IPV4_ADDR(0, 0, 0, 0)
111 //Broadcast IPV4 address
112 #define IPV4_BROADCAST_ADDR IPV4_ADDR(255, 255, 255, 255)
113 
114 //Loopback IPv4 address
115 #define IPV4_LOOPBACK_ADDR IPV4_ADDR(127, 0, 0, 1)
116 #define IPV4_LOOPBACK_PREFIX IPV4_ADDR(127, 0, 0, 0)
117 #define IPV4_LOOPBACK_MASK IPV4_ADDR(255, 0, 0, 0)
118 
119 //Link-local addresses
120 #define IPV4_LINK_LOCAL_PREFIX IPV4_ADDR(169, 254, 0, 0)
121 #define IPV4_LINK_LOCAL_MASK IPV4_ADDR(255, 255, 0, 0)
122 
123 //Multicast addresses
124 #define IPV4_MULTICAST_PREFIX IPV4_ADDR(224, 0, 0, 0)
125 #define IPV4_MULTICAST_MASK IPV4_ADDR(240, 0, 0, 0)
126 
127 //Local Network Control Block (RFC 5771)
128 #define IPV4_MULTICAST_LNCB_PREFIX IPV4_ADDR(224, 0, 0, 0)
129 #define IPV4_MULTICAST_LNCB_MASK IPV4_ADDR(255, 255, 255, 0)
130 
131 //Internetwork Control Block (RFC 5771)
132 #define IPV4_MULTICAST_INCB_PREFIX IPV4_ADDR(224, 0, 1, 0)
133 #define IPV4_MULTICAST_INCB_MASK IPV4_ADDR(255, 255, 255, 0)
134 
135 //IPv4 address classes
136 #define IPV4_CLASS_A_ADDR IPV4_ADDR(0, 0, 0, 0)
137 #define IPV4_CLASS_A_MASK IPV4_ADDR(128, 0, 0, 0)
138 #define IPV4_CLASS_B_ADDR IPV4_ADDR(128, 0, 0, 0)
139 #define IPV4_CLASS_B_MASK IPV4_ADDR(192, 0, 0, 0)
140 #define IPV4_CLASS_C_ADDR IPV4_ADDR(192, 0, 0, 0)
141 #define IPV4_CLASS_C_MASK IPV4_ADDR(224, 0, 0, 0)
142 #define IPV4_CLASS_D_ADDR IPV4_ADDR(224, 0, 0, 0)
143 #define IPV4_CLASS_D_MASK IPV4_ADDR(240, 0, 0, 0)
144 #define IPV4_CLASS_E_ADDR IPV4_ADDR(240, 0, 0, 0)
145 #define IPV4_CLASS_E_MASK IPV4_ADDR(240, 0, 0, 0)
146 
147 //Copy IPv4 address
148 #define ipv4CopyAddr(destIpAddr, srcIpAddr) \
149  osMemcpy(destIpAddr, srcIpAddr, sizeof(Ipv4Addr))
150 
151 //Compare IPv4 addresses
152 #define ipv4CompAddr(ipAddr1, ipAddr2) \
153  (!osMemcmp(ipAddr1, ipAddr2, sizeof(Ipv4Addr)))
154 
155 //Determine whether an IPv4 address belongs to the subnet
156 #define ipv4IsOnSubnet(entry, ipAddr) \
157  (((ipAddr) & (entry)->subnetMask) == ((entry)->addr & (entry)->subnetMask))
158 
159 //Determine whether an IPv4 address is a loopback address
160 #define ipv4IsLoopbackAddr(ipAddr) \
161  (((ipAddr) & IPV4_LOOPBACK_MASK) == IPV4_LOOPBACK_PREFIX)
162 
163 //Determine whether an IPv4 address is a link-local address
164 #define ipv4IsLinkLocalAddr(ipAddr) \
165  (((ipAddr) & IPV4_LINK_LOCAL_MASK) == IPV4_LINK_LOCAL_PREFIX)
166 
167 //Determine whether an IPv4 address is a multicast address
168 #define ipv4IsMulticastAddr(ipAddr) \
169  (((ipAddr) & IPV4_MULTICAST_MASK) == IPV4_MULTICAST_PREFIX)
170 
171 //C++ guard
172 #ifdef __cplusplus
173 extern "C" {
174 #endif
175 
176 
177 /**
178  * @brief IPv4 address scopes
179  **/
180 
181 typedef enum
182 {
187 
188 
189 /**
190  * @brief IPv4 address state
191  **/
192 
193 typedef enum
194 {
195  IPV4_ADDR_STATE_INVALID = 0, ///<An address that is not assigned to any interface
196  IPV4_ADDR_STATE_TENTATIVE = 1, ///<An address whose uniqueness on a link is being verified
197  IPV4_ADDR_STATE_VALID = 2 ///<An address assigned to an interface whose use is unrestricted
199 
200 
201 /**
202  * @brief IPv4 fragment offset field
203  **/
204 
205 typedef enum
206 {
207  IPV4_FLAG_RES = 0x8000,
208  IPV4_FLAG_DF = 0x4000,
209  IPV4_FLAG_MF = 0x2000,
210  IPV4_OFFSET_MASK = 0x1FFF
212 
213 
214 /**
215  * @brief IPv4 protocol field
216  **/
217 
218 typedef enum
219 {
225  IPV4_PROTOCOL_AH = 51
227 
228 
229 /**
230  * @brief IPv4 option types
231  **/
232 
233 typedef enum
234 {
235  IPV4_OPTION_EEOL = 0, ///<End of Options List
236  IPV4_OPTION_NOP = 1, ///<No Operation
237  IPV4_OPTION_RR = 7, ///<Record Route
238  IPV4_OPTION_ZSU = 10, ///<Experimental Measurement
239  IPV4_OPTION_MTUP = 11, ///<MTU Probe
240  IPV4_OPTION_MTUR = 12, ///<MTU Reply
241  IPV4_OPTION_ENCODE = 15, ///<Experimental IP encryption
242  IPV4_OPTION_QS = 25, ///<Quick-Start
243  IPV4_OPTION_TS = 68, ///<Time Stamp
244  IPV4_OPTION_TR = 82, ///<Traceroute
245  IPV4_OPTION_SEC = 130, ///<Security
246  IPV4_OPTION_LSR = 131, ///<Loose Source Route
247  IPV4_OPTION_ESEC = 133, ///<Extended Security
248  IPV4_OPTION_CIPSO = 134, ///<Commercial Security
249  IPV4_OPTION_SID = 136, ///<Stream ID
250  IPV4_OPTION_SSR = 137, ///<Strict Source Route
251  IPV4_OPTION_VISA = 142, ///<Experimental Access Control
252  IPV4_OPTION_IMITD = 144, ///<IMI Traffic Descriptor
253  IPV4_OPTION_EIP = 145, ///<Extended Internet Protocol
254  IPV4_OPTION_ADDEXT = 147, ///<Address Extension
255  IPV4_OPTION_RTRALT = 148, ///<Router Alert
256  IPV4_OPTION_SDB = 149, ///<Selective Directed Broadcast
257  IPV4_OPTION_DPS = 151, ///<Dynamic Packet State
258  IPV4_OPTION_UMP = 152, ///<Upstream Multicast Packet
259  IPV4_OPTION_FINN = 205 ///<Experimental Flow Control
261 
262 
263 /**
264  * @brief IPv4 network address
265  **/
266 
267 typedef uint32_t Ipv4Addr;
268 
269 
270 //CC-RX, CodeWarrior or Win32 compiler?
271 #if defined(__CCRX__)
272  #pragma pack
273 #elif defined(__CWCC__) || defined(_WIN32)
274  #pragma pack(push, 1)
275 #endif
276 
277 
278 /**
279  * @brief IPv4 header
280  **/
281 
283 {
284 #if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
285  uint8_t version : 4; //0
286  uint8_t headerLength : 4;
287 #else
288  uint8_t headerLength : 4; //0
289  uint8_t version : 4;
290 #endif
291  uint8_t typeOfService; //1
292  uint16_t totalLength; //2-3
293  uint16_t identification; //4-5
294  uint16_t fragmentOffset; //6-7
295  uint8_t timeToLive; //8
296  uint8_t protocol; //9
297  uint16_t headerChecksum; //10-11
298  Ipv4Addr srcAddr; //12-15
300  uint8_t options[]; //20
301 };
302 
303 
304 /**
305  * @brief IPv4 pseudo header
306  **/
307 
309 {
310  Ipv4Addr srcAddr; //0-3
311  Ipv4Addr destAddr; //4-7
312  uint8_t reserved; //8
313  uint8_t protocol; //9
314  uint16_t length; //10-11
315 };
316 
317 
318 /**
319  * @brief IPv4 option
320  **/
321 
323 {
324  uint8_t type; //0
325  uint8_t length; //1
326  uint8_t value[]; //2
328 
329 
330 //CC-RX, CodeWarrior or Win32 compiler?
331 #if defined(__CCRX__)
332  #pragma unpack
333 #elif defined(__CWCC__) || defined(_WIN32)
334  #pragma pack(pop)
335 #endif
336 
337 
338 /**
339  * @brief IPv4 address entry
340  **/
341 
342 typedef struct
343 {
344  Ipv4Addr addr; ///<IPv4 address
345  Ipv4AddrState state; ///<IPv4 address state
346  bool_t conflict; ///<Address conflict detected
347  Ipv4Addr subnetMask; ///<Subnet mask
348  Ipv4Addr defaultGateway; ///<Default gateway
349 } Ipv4AddrEntry;
350 
351 
352 /**
353  * @brief IPv4 multicast filter entry
354  **/
355 
356 typedef struct
357 {
358  Ipv4Addr addr; ///<Multicast address
359  uint_t refCount; ///<Reference count for the current entry
360  uint_t state; ///<IGMP host state
361  bool_t flag; ///<IGMP flag
362  systime_t timer; ///<Delay timer
364 
365 
366 /**
367  * @brief IPv4 context
368  **/
369 
370 typedef struct
371 {
372  size_t linkMtu; ///<Maximum transmission unit
373  bool_t isRouter; ///<A flag indicating whether routing is enabled on this interface
374  uint8_t defaultTtl; ///<Default time-to-live value
375  bool_t enableEchoReq; ///<Support for ICMP Echo Request messages
376  bool_t enableBroadcastEchoReq; ///<Support for broadcast ICMP Echo Request messages
377  uint16_t identification; ///<IPv4 fragment identification field
378  Ipv4AddrEntry addrList[IPV4_ADDR_LIST_SIZE]; ///<IPv4 address list
379  Ipv4Addr dnsServerList[IPV4_DNS_SERVER_LIST_SIZE]; ///<DNS servers
380  Ipv4FilterEntry multicastFilter[IPV4_MULTICAST_FILTER_SIZE]; ///<Multicast filter table
381 #if (IPV4_FRAG_SUPPORT == ENABLED)
382  Ipv4FragDesc fragQueue[IPV4_MAX_FRAG_DATAGRAMS]; ///<IPv4 fragment reassembly queue
383 #endif
384 } Ipv4Context;
385 
386 
387 //IPv4 related functions
388 error_t ipv4Init(NetInterface *interface);
389 
390 error_t ipv4SetDefaultTtl(NetInterface *interface, uint8_t ttl);
391 
396 
401 
403 
405  Ipv4Addr addr);
406 
408 
410  Ipv4Addr *addr);
411 
414 
415 void ipv4LinkChangeEvent(NetInterface *interface);
416 
417 void ipv4ProcessPacket(NetInterface *interface, Ipv4Header *packet,
418  size_t length, NetRxAncillary *ancillary);
419 
420 void ipv4ProcessDatagram(NetInterface *interface, const NetBuffer *buffer,
421  size_t offset, NetRxAncillary *ancillary);
422 
424  const Ipv4PseudoHeader *pseudoHeader, NetBuffer *buffer, size_t offset,
425  NetTxAncillary *ancillary);
426 
428  const Ipv4PseudoHeader *pseudoHeader, uint16_t fragId, size_t fragOffset,
429  NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary);
430 
433 
436 
437 void ipv4DumpHeader(const Ipv4Header *ipHeader);
438 
439 //C++ guard
440 #ifdef __cplusplus
441 }
442 #endif
443 
444 #endif
uint8_t type
Definition: coap_common.h:176
unsigned int uint_t
Definition: compiler_port.h:50
char char_t
Definition: compiler_port.h:48
int bool_t
Definition: compiler_port.h:53
uint32_t ttl
Definition: dns_common.h:221
uint8_t fragOffset[3]
Definition: dtls_misc.h:192
error_t
Error codes.
Definition: error.h:43
Ethernet.
Ipv4Addr groupAddr
Definition: igmp_common.h:171
Ipv4Addr ipAddr
Definition: ipcp.h:105
error_t ipv4GetDefaultGateway(NetInterface *interface, Ipv4Addr *addr)
Retrieve default gateway.
Definition: ipv4.c:434
error_t ipv4GetDefaultGatewayEx(NetInterface *interface, uint_t index, Ipv4Addr *addr)
Retrieve default gateway.
Definition: ipv4.c:449
void ipv4LinkChangeEvent(NetInterface *interface)
Callback function for link change event.
Definition: ipv4.c:551
#define Ipv4PseudoHeader
Definition: ipv4.h:39
Ipv4Protocol
IPv4 protocol field.
Definition: ipv4.h:219
@ IPV4_PROTOCOL_IGMP
Definition: ipv4.h:221
@ IPV4_PROTOCOL_AH
Definition: ipv4.h:225
@ IPV4_PROTOCOL_ESP
Definition: ipv4.h:224
@ IPV4_PROTOCOL_UDP
Definition: ipv4.h:223
@ IPV4_PROTOCOL_ICMP
Definition: ipv4.h:220
@ IPV4_PROTOCOL_TCP
Definition: ipv4.h:222
__packed_struct _Ipv4PseudoHeader
IPv4 pseudo header.
Definition: ipv4.h:309
uint8_t timeToLive
Definition: ipv4.h:295
error_t ipv4SetDefaultGateway(NetInterface *interface, Ipv4Addr addr)
Configure default gateway.
Definition: ipv4.c:385
uint16_t identification
Definition: ipv4.h:293
#define Ipv4Header
Definition: ipv4.h:36
Ipv4Option
Definition: ipv4.h:327
error_t ipv4SetSubnetMaskEx(NetInterface *interface, uint_t index, Ipv4Addr mask)
Configure subnet mask.
Definition: ipv4.c:307
Ipv4Addr srcAddr
Definition: ipv4.h:298
#define IPV4_ADDR_LIST_SIZE
Definition: ipv4.h:69
error_t ipv4SetSubnetMask(NetInterface *interface, Ipv4Addr mask)
Configure subnet mask.
Definition: ipv4.c:292
uint32_t Ipv4Addr
IPv4 network address.
Definition: ipv4.h:267
error_t ipv4SendDatagram(NetInterface *interface, const Ipv4PseudoHeader *pseudoHeader, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send an IPv4 datagram.
Definition: ipv4.c:1004
Ipv4AddrScope
IPv4 address scopes.
Definition: ipv4.h:182
@ IPV4_ADDR_SCOPE_LINK_LOCAL
Definition: ipv4.h:184
@ IPV4_ADDR_SCOPE_INTERFACE_LOCAL
Definition: ipv4.h:183
@ IPV4_ADDR_SCOPE_GLOBAL
Definition: ipv4.h:185
error_t ipv4SetDnsServer(NetInterface *interface, uint_t index, Ipv4Addr addr)
Configure DNS server.
Definition: ipv4.c:485
uint16_t totalLength
Definition: ipv4.h:292
error_t ipv4Init(NetInterface *interface)
IPv4 related initialization.
Definition: ipv4.c:79
char_t * ipv4AddrToString(Ipv4Addr ipAddr, char_t *str)
Convert a binary IPv4 address to dot-decimal notation.
Definition: ipv4.c:1636
error_t ipv4SetHostAddr(NetInterface *interface, Ipv4Addr addr)
Assign host address.
Definition: ipv4.c:153
uint8_t options[]
Definition: ipv4.h:300
Ipv4AddrState
IPv4 address state.
Definition: ipv4.h:194
@ IPV4_ADDR_STATE_INVALID
An address that is not assigned to any interface.
Definition: ipv4.h:195
@ IPV4_ADDR_STATE_VALID
An address assigned to an interface whose use is unrestricted.
Definition: ipv4.h:197
@ IPV4_ADDR_STATE_TENTATIVE
An address whose uniqueness on a link is being verified.
Definition: ipv4.h:196
Ipv4FragmentOffset
IPv4 fragment offset field.
Definition: ipv4.h:206
@ IPV4_FLAG_RES
Definition: ipv4.h:207
@ IPV4_FLAG_MF
Definition: ipv4.h:209
@ IPV4_OFFSET_MASK
Definition: ipv4.h:210
@ IPV4_FLAG_DF
Definition: ipv4.h:208
error_t ipv4SetDefaultTtl(NetInterface *interface, uint8_t ttl)
Set default TTL value for outgoing IPv4 packets.
Definition: ipv4.c:128
error_t ipv4GetHostAddrEx(NetInterface *interface, uint_t index, Ipv4Addr *addr)
Retrieve host address.
Definition: ipv4.c:242
error_t ipv4StringToAddr(const char_t *str, Ipv4Addr *ipAddr)
Convert a dot-decimal string to a binary IPv4 address.
Definition: ipv4.c:1547
void ipv4DumpHeader(const Ipv4Header *ipHeader)
Dump IPv4 header for debugging purpose.
Definition: ipv4.c:1660
error_t ipv4GetSubnetMask(NetInterface *interface, Ipv4Addr *mask)
Retrieve subnet mask.
Definition: ipv4.c:336
error_t ipv4LeaveMulticastGroup(NetInterface *interface, Ipv4Addr groupAddr)
Leave the specified host group.
Definition: ipv4.c:1471
__packed_struct _Ipv4Header
IPv4 header.
Definition: ipv4.h:283
error_t ipv4SetHostAddrEx(NetInterface *interface, uint_t index, Ipv4Addr addr)
Assign host address.
Definition: ipv4.c:168
void ipv4ProcessPacket(NetInterface *interface, Ipv4Header *packet, size_t length, NetRxAncillary *ancillary)
Incoming IPv4 packet processing.
Definition: ipv4.c:602
uint8_t typeOfService
Definition: ipv4.h:291
Ipv4Addr destAddr
Definition: ipv4.h:299
uint8_t version
Definition: ipv4.h:289
error_t ipv4JoinMulticastGroup(NetInterface *interface, Ipv4Addr groupAddr)
Join the specified host group.
Definition: ipv4.c:1362
uint16_t length
Definition: ipv4.h:314
error_t ipv4GetHostAddr(NetInterface *interface, Ipv4Addr *addr)
Retrieve host address.
Definition: ipv4.c:227
uint8_t protocol
Definition: ipv4.h:296
uint16_t headerChecksum
Definition: ipv4.h:297
#define IPV4_MULTICAST_FILTER_SIZE
Definition: ipv4.h:83
#define IPV4_DNS_SERVER_LIST_SIZE
Definition: ipv4.h:76
typedef __packed_struct
IPv4 option.
Definition: ipv4.h:323
error_t ipv4SendPacket(NetInterface *interface, const Ipv4PseudoHeader *pseudoHeader, uint16_t fragId, size_t fragOffset, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send an IPv4 packet.
Definition: ipv4.c:1090
uint8_t reserved
Definition: ipv4.h:312
void ipv4ProcessDatagram(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetRxAncillary *ancillary)
Incoming IPv4 datagram processing.
Definition: ipv4.c:819
Ipv4OptionType
IPv4 option types.
Definition: ipv4.h:234
@ IPV4_OPTION_MTUP
MTU Probe.
Definition: ipv4.h:239
@ IPV4_OPTION_QS
Quick-Start.
Definition: ipv4.h:242
@ IPV4_OPTION_NOP
No Operation.
Definition: ipv4.h:236
@ IPV4_OPTION_DPS
Dynamic Packet State.
Definition: ipv4.h:257
@ IPV4_OPTION_EIP
Extended Internet Protocol.
Definition: ipv4.h:253
@ IPV4_OPTION_ENCODE
Experimental IP encryption.
Definition: ipv4.h:241
@ IPV4_OPTION_SDB
Selective Directed Broadcast.
Definition: ipv4.h:256
@ IPV4_OPTION_TS
Time Stamp.
Definition: ipv4.h:243
@ IPV4_OPTION_CIPSO
Commercial Security.
Definition: ipv4.h:248
@ IPV4_OPTION_LSR
Loose Source Route.
Definition: ipv4.h:246
@ IPV4_OPTION_RTRALT
Router Alert.
Definition: ipv4.h:255
@ IPV4_OPTION_ADDEXT
Address Extension.
Definition: ipv4.h:254
@ IPV4_OPTION_SEC
Security.
Definition: ipv4.h:245
@ IPV4_OPTION_UMP
Upstream Multicast Packet.
Definition: ipv4.h:258
@ IPV4_OPTION_IMITD
IMI Traffic Descriptor.
Definition: ipv4.h:252
@ IPV4_OPTION_ESEC
Extended Security.
Definition: ipv4.h:247
@ IPV4_OPTION_VISA
Experimental Access Control.
Definition: ipv4.h:251
@ IPV4_OPTION_ZSU
Experimental Measurement.
Definition: ipv4.h:238
@ IPV4_OPTION_FINN
Experimental Flow Control.
Definition: ipv4.h:259
@ IPV4_OPTION_EEOL
End of Options List.
Definition: ipv4.h:235
@ IPV4_OPTION_SSR
Strict Source Route.
Definition: ipv4.h:250
@ IPV4_OPTION_TR
Traceroute.
Definition: ipv4.h:244
@ IPV4_OPTION_SID
Stream ID.
Definition: ipv4.h:249
@ IPV4_OPTION_MTUR
MTU Reply.
Definition: ipv4.h:240
@ IPV4_OPTION_RR
Record Route.
Definition: ipv4.h:237
error_t ipv4GetDnsServer(NetInterface *interface, uint_t index, Ipv4Addr *addr)
Retrieve DNS server.
Definition: ipv4.c:519
error_t ipv4GetSubnetMaskEx(NetInterface *interface, uint_t index, Ipv4Addr *mask)
Retrieve subnet mask.
Definition: ipv4.c:351
uint8_t value[]
Definition: ipv4.h:326
uint16_t fragmentOffset
Definition: ipv4.h:294
error_t ipv4SetDefaultGatewayEx(NetInterface *interface, uint_t index, Ipv4Addr addr)
Configure default gateway.
Definition: ipv4.c:400
IPv4 fragmentation and reassembly.
#define IPV4_MAX_FRAG_DATAGRAMS
Definition: ipv4_frag.h:62
Ipv4Addr addr
Definition: nbns_common.h:123
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
#define NetRxAncillary
Definition: net_misc.h:40
#define NetTxAncillary
Definition: net_misc.h:36
uint32_t systime_t
System time.
IPv4 address entry.
Definition: ipv4.h:343
Ipv4Addr subnetMask
Subnet mask.
Definition: ipv4.h:347
Ipv4AddrState state
IPv4 address state.
Definition: ipv4.h:345
Ipv4Addr defaultGateway
Default gateway.
Definition: ipv4.h:348
bool_t conflict
Address conflict detected.
Definition: ipv4.h:346
Ipv4Addr addr
IPv4 address.
Definition: ipv4.h:344
IPv4 context.
Definition: ipv4.h:371
uint16_t identification
IPv4 fragment identification field.
Definition: ipv4.h:377
bool_t isRouter
A flag indicating whether routing is enabled on this interface.
Definition: ipv4.h:373
bool_t enableEchoReq
Support for ICMP Echo Request messages.
Definition: ipv4.h:375
uint8_t defaultTtl
Default time-to-live value.
Definition: ipv4.h:374
bool_t enableBroadcastEchoReq
Support for broadcast ICMP Echo Request messages.
Definition: ipv4.h:376
size_t linkMtu
Maximum transmission unit.
Definition: ipv4.h:372
IPv4 multicast filter entry.
Definition: ipv4.h:357
uint_t state
IGMP host state.
Definition: ipv4.h:360
bool_t flag
IGMP flag.
Definition: ipv4.h:361
systime_t timer
Delay timer.
Definition: ipv4.h:362
Ipv4Addr addr
Multicast address.
Definition: ipv4.h:358
uint_t refCount
Reference count for the current entry.
Definition: ipv4.h:359
Fragmented packet descriptor.
Definition: ipv4_frag.h:135
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
uint8_t mask
Definition: web_socket.h:319