net.h
Go to the documentation of this file.
1 /**
2  * @file net.h
3  * @brief TCP/IP stack core
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.4
29  **/
30 
31 #ifndef _NET_H
32 #define _NET_H
33 
34 //Forward declaration of NetInterface structure
35 struct _NetInterface;
36 #define NetInterface struct _NetInterface
37 
38 //Dependencies
39 #include "os_port.h"
40 #include "net_config.h"
41 #include "core/net_legacy.h"
42 #include "core/net_mem.h"
43 #include "core/net_misc.h"
44 #include "core/nic.h"
45 #include "core/ethernet.h"
46 #include "ipv4/ipv4.h"
47 #include "ipv4/ipv4_frag.h"
48 #include "ipv4/auto_ip.h"
49 #include "ipv6/ipv6.h"
50 #include "ipv4/arp.h"
51 #include "igmp/igmp_host.h"
52 #include "igmp/igmp_router.h"
53 #include "igmp/igmp_snooping.h"
54 #include "ipv6/ndp.h"
55 #include "ipv6/ndp_router_adv.h"
56 #include "ipv6/slaac.h"
57 #include "mld/mld_node.h"
58 #include "ppp/ppp.h"
59 #include "dhcp/dhcp_client.h"
60 #include "dhcp/dhcp_server.h"
61 #include "dhcpv6/dhcpv6_client.h"
62 #include "dns/dns_client.h"
63 #include "mdns/mdns_responder.h"
64 #include "mdns/mdns_common.h"
66 #include "cpu_endian.h"
67 #include "error.h"
68 
69 
70 /*
71  * CycloneTCP Open is licensed under GPL version 2. In particular:
72  *
73  * - If you link your program to CycloneTCP Open, the result is a derivative
74  * work that can only be distributed under the same GPL license terms.
75  *
76  * - If additions or changes to CycloneTCP Open are made, the result is a
77  * derivative work that can only be distributed under the same license terms.
78  *
79  * - The GPL license requires that you make the source code available to
80  * whoever you make the binary available to.
81  *
82  * - If you sell or distribute a hardware product that runs CycloneTCP Open,
83  * the GPL license requires you to provide public and full access to all
84  * source code on a nondiscriminatory basis.
85  *
86  * If you fully understand and accept the terms of the GPL license, then edit
87  * the os_port_config.h header and add the following directive:
88  *
89  * #define GPL_LICENSE_TERMS_ACCEPTED
90  */
91 
92 #ifndef GPL_LICENSE_TERMS_ACCEPTED
93  #error Before compiling CycloneTCP Open, you must accept the terms of the GPL license
94 #endif
95 
96 //Version string
97 #define CYCLONE_TCP_VERSION_STRING "2.4.4"
98 //Major version
99 #define CYCLONE_TCP_MAJOR_VERSION 2
100 //Minor version
101 #define CYCLONE_TCP_MINOR_VERSION 4
102 //Revision number
103 #define CYCLONE_TCP_REV_NUMBER 4
104 
105 //RTOS support
106 #ifndef NET_RTOS_SUPPORT
107  #define NET_RTOS_SUPPORT ENABLED
108 #elif (NET_RTOS_SUPPORT != ENABLED && NET_RTOS_SUPPORT != DISABLED)
109  #error NET_RTOS_SUPPORT parameter is not valid
110 #endif
111 
112 //Number of network adapters
113 #ifndef NET_INTERFACE_COUNT
114  #define NET_INTERFACE_COUNT 1
115 #elif (NET_INTERFACE_COUNT < 1)
116  #error NET_INTERFACE_COUNT parameter is not valid
117 #endif
118 
119 //Loopback interface support
120 #ifndef NET_LOOPBACK_IF_SUPPORT
121  #define NET_LOOPBACK_IF_SUPPORT DISABLED
122 #elif (NET_LOOPBACK_IF_SUPPORT != ENABLED && NET_LOOPBACK_IF_SUPPORT != DISABLED)
123  #error NET_LOOPBACK_IF_SUPPORT parameter is not valid
124 #endif
125 
126 //Maximum number of link change callback functions that can be registered
127 #ifndef NET_MAX_LINK_CHANGE_CALLBACKS
128  #define NET_MAX_LINK_CHANGE_CALLBACKS (6 * NET_INTERFACE_COUNT)
129 #elif (NET_MAX_LINK_CHANGE_CALLBACKS < 1)
130  #error NET_MAX_LINK_CHANGE_CALLBACKS parameter is not valid
131 #endif
132 
133 //Maximum number of timer callback functions that can be registered
134 #ifndef NET_MAX_TIMER_CALLBACKS
135  #define NET_MAX_TIMER_CALLBACKS (6 * NET_INTERFACE_COUNT)
136 #elif (NET_MAX_TIMER_CALLBACKS < 1)
137  #error NET_MAX_TIMER_CALLBACKS parameter is not valid
138 #endif
139 
140 //Maximum length of interface name
141 #ifndef NET_MAX_IF_NAME_LEN
142  #define NET_MAX_IF_NAME_LEN 8
143 #elif (NET_MAX_IF_NAME_LEN < 1)
144  #error NET_MAX_IF_NAME_LEN parameter is not valid
145 #endif
146 
147 //Maximum length of host name
148 #ifndef NET_MAX_HOSTNAME_LEN
149  #define NET_MAX_HOSTNAME_LEN 24
150 #elif (NET_MAX_HOSTNAME_LEN < 1)
151  #error NET_MAX_HOSTNAME_LEN parameter is not valid
152 #endif
153 
154 //Size of the seed
155 #ifndef NET_RAND_SEED_SIZE
156  #define NET_RAND_SEED_SIZE 16
157 #elif (NET_RAND_SEED_SIZE < 10)
158  #error NET_RAND_SEED_SIZE parameter is not valid
159 #endif
160 
161 //Stack size required to run the TCP/IP task
162 #ifndef NET_TASK_STACK_SIZE
163  #define NET_TASK_STACK_SIZE 650
164 #elif (NET_TASK_STACK_SIZE < 1)
165  #error NET_TASK_STACK_SIZE parameter is not valid
166 #endif
167 
168 //Priority at which the TCP/IP task should run
169 #ifndef NET_TASK_PRIORITY
170  #define NET_TASK_PRIORITY OS_TASK_PRIORITY_HIGH
171 #endif
172 
173 //TCP/IP stack tick interval
174 #ifndef NET_TICK_INTERVAL
175  #define NET_TICK_INTERVAL 100
176 #elif (NET_TICK_INTERVAL < 10)
177  #error NET_TICK_INTERVAL parameter is not valid
178 #endif
179 
180 //Get system tick count
181 #ifndef netGetSystemTickCount
182  #define netGetSystemTickCount() osGetSystemTime()
183 #endif
184 
185 //C++ guard
186 #ifdef __cplusplus
187 extern "C" {
188 #endif
189 
190 
191 /**
192  * @brief Structure describing a network interface
193  **/
194 
196 {
197  uint_t index; ///<Zero-based index
198  uint32_t id; ///<A unique number identifying the interface
199  Eui64 eui64; ///<EUI-64 interface identifier
200  char_t name[NET_MAX_IF_NAME_LEN + 1]; ///<A unique name identifying the interface
202  const NicDriver *nicDriver; ///<NIC driver
203  const SpiDriver *spiDriver; ///<Underlying SPI driver
204  const UartDriver *uartDriver; ///<Underlying UART driver
205  const ExtIntDriver *extIntDriver; ///<External interrupt line driver
206  uint8_t nicContext[NIC_CONTEXT_SIZE]; ///<Driver specific context
207  OsEvent nicTxEvent; ///<Network controller TX event
208  bool_t nicEvent; ///<A NIC event is pending
209  NicLinkState adminLinkState; ///<Administrative link state
210  bool_t linkState; ///<Link state
211  uint32_t linkSpeed; ///<Link speed
212  NicDuplexMode duplexMode; ///<Duplex mode
213  bool_t configured; ///<Configuration done
214  systime_t initialRto; ///<TCP initial retransmission timeout
215 
216 #if (ETH_SUPPORT == ENABLED)
217  const PhyDriver *phyDriver; ///<Ethernet PHY driver
218  uint8_t phyAddr; ///<PHY address
219  bool_t phyEvent; ///<A PHY event is pending
220  const SwitchDriver *switchDriver; ///<Ethernet switch driver
221  const SmiDriver *smiDriver; ///<SMI driver
222  MacAddr macAddr; ///<Link-layer address
224  bool_t promiscuous; ///<Promiscuous mode
225  bool_t acceptAllMulticast; ///<Accept all frames with a multicast destination address
226 #endif
227 #if (ETH_VLAN_SUPPORT == ENABLED)
228  uint16_t vlanId; ///<VLAN identifier (802.1Q)
229 #endif
230 #if (ETH_VMAN_SUPPORT == ENABLED)
231  uint16_t vmanId; ///<VMAN identifier (802.1ad)
232 #endif
233 #if (ETH_LLC_SUPPORT == ENABLED)
234  LlcRxCallback llcRxCallback; ///<LLC frame received callback (802.2)
235  void *llcRxParam; ///<Callback parameter
236 #endif
237 #if (ETH_PORT_TAGGING_SUPPORT == ENABLED)
238  uint8_t port; ///<Switch port identifier
239 #endif
240 #if (ETH_VIRTUAL_IF_SUPPORT == ENABLED || ETH_VLAN_SUPPORT == ENABLED || \
241  ETH_PORT_TAGGING_SUPPORT == ENABLED)
242  NetInterface *parent; ///<Interface on top of which the virtual interface runs
243 #endif
244 
245 #if (IPV4_SUPPORT == ENABLED)
246  Ipv4Context ipv4Context; ///<IPv4 context
247 #if (ETH_SUPPORT == ENABLED)
248  bool_t enableArp; ///<Enable address resolution using ARP
250 #endif
251 #if (IGMP_HOST_SUPPORT == ENABLED)
252  IgmpHostContext igmpHostContext; ///<IGMP host context
253 #endif
254 #if (IGMP_ROUTER_SUPPORT == ENABLED)
255  IgmpRouterContext *igmpRouterContext; ///<IGMP router context
256 #endif
257 #if (IGMP_SNOOPING_SUPPORT == ENABLED)
258  IgmpSnoopingContext *igmpSnoopingContext; ///<IGMP snooping switch context
259 #endif
260 #if (AUTO_IP_SUPPORT == ENABLED)
261  AutoIpContext *autoIpContext; ///<Auto-IP context
262 #endif
263 #if (DHCP_CLIENT_SUPPORT == ENABLED)
264  DhcpClientContext *dhcpClientContext; ///<DHCP client context
265 #endif
266 #if (DHCP_SERVER_SUPPORT == ENABLED)
267  DhcpServerContext *dhcpServerContext; ///<DHCP server context
268 #endif
269 #endif
270 
271 #if (IPV6_SUPPORT == ENABLED)
272  Ipv6Context ipv6Context; ///<IPv6 context
273 #if (NDP_SUPPORT == ENABLED)
274  NdpContext ndpContext; ///<NDP context
275 #endif
276 #if (NDP_ROUTER_ADV_SUPPORT == ENABLED)
277  NdpRouterAdvContext *ndpRouterAdvContext; ///<RA service context
278 #endif
279 #if (MLD_NODE_SUPPORT == ENABLED)
280  MldNodeContext mldNodeContext; ///<MLD node context
281 #endif
282 #if (SLAAC_SUPPORT == ENABLED)
283  SlaacContext *slaacContext; ///<SLAAC context
284 #endif
285 #if (DHCPV6_CLIENT_SUPPORT == ENABLED)
286  Dhcpv6ClientContext *dhcpv6ClientContext; ///<DHCPv6 client context
287 #endif
288 #endif
289 
290 #if (MDNS_RESPONDER_SUPPORT == ENABLED)
291  MdnsResponderContext *mdnsResponderContext; ///<mDNS responder context
292 #endif
293 
294 #if (DNS_SD_RESPONDER_SUPPORT == ENABLED)
295  DnsSdResponderContext *dnsSdResponderContext; ///<DNS-SD responder context
296 #endif
297 
298 #if (PPP_SUPPORT == ENABLED)
299  PppContext *pppContext; ///<PPP context
300 #endif
301 };
302 
303 
304 /**
305  * @brief TCP/IP stack settings
306  **/
307 
308 typedef struct
309 {
310  OsTaskParameters task; ///<Task parameters
311 } NetSettings;
312 
313 
314 /**
315  * @brief TCP/IP stack context
316  **/
317 
318 typedef struct
319 {
320  OsMutex mutex; ///<Mutex preventing simultaneous access to the TCP/IP stack
321  OsEvent event; ///<Event object to receive notifications from drivers
322  bool_t running; ///<The TCP/IP stack is currently running
323  OsTaskParameters taskParams; ///<Task parameters
324  OsTaskId taskId; ///<Task identifier
325  uint32_t entropy;
327  uint8_t randSeed[NET_RAND_SEED_SIZE]; ///<Random seed
328  NetRandState randState; ///<Pseudo-random number generator state
329  NetInterface interfaces[NET_INTERFACE_COUNT]; ///<Network interfaces
332 #if (IPV4_IPSEC_SUPPORT == ENABLED)
333  void *ipsecContext; ///<IPsec context
334  void *ikeContext; ///<IKE context
335 #endif
336 } NetContext;
337 
338 
339 //Global variables
340 extern NetContext netContext;
341 
342 //TCP/IP stack related functions
343 void netGetDefaultSettings(NetSettings *settings);
344 error_t netInit(void);
345 error_t netInitEx(NetContext *context, const NetSettings *settings);
346 
347 error_t netStart(NetContext *context);
348 
349 error_t netSeedRand(const uint8_t *seed, size_t length);
350 uint32_t netGetRand(void);
351 uint32_t netGetRandRange(uint32_t min, uint32_t max);
352 void netGetRandData(uint8_t *data, size_t length);
353 
355 
356 error_t netSetMacAddr(NetInterface *interface, const MacAddr *macAddr);
357 error_t netGetMacAddr(NetInterface *interface, MacAddr *macAddr);
358 
359 error_t netSetEui64(NetInterface *interface, const Eui64 *eui64);
360 error_t netGetEui64(NetInterface *interface, Eui64 *eui64);
361 
362 error_t netSetInterfaceId(NetInterface *interface, uint32_t id);
364 error_t netSetHostname(NetInterface *interface, const char_t *name);
365 
366 error_t netSetVlanId(NetInterface *interface, uint16_t vlanId);
367 error_t netSetVmanId(NetInterface *interface, uint16_t vmanId);
368 
370  NetInterface *physicalInterface);
371 
372 error_t netSetDriver(NetInterface *interface, const NicDriver *driver);
373 
374 error_t netSetPhyDriver(NetInterface *interface, const PhyDriver *driver);
375 error_t netSetPhyAddr(NetInterface *interface, uint8_t phyAddr);
376 
377 error_t netSetSwitchDriver(NetInterface *interface, const SwitchDriver *driver);
378 error_t netSetSwitchPort(NetInterface *interface, uint8_t port);
379 
380 error_t netSetSmiDriver(NetInterface *interface, const SmiDriver *driver);
381 error_t netSetSpiDriver(NetInterface *interface, const SpiDriver *driver);
382 error_t netSetUartDriver(NetInterface *interface, const UartDriver *driver);
383 error_t netSetExtIntDriver(NetInterface *interface, const ExtIntDriver *driver);
384 
385 error_t netSetLinkState(NetInterface *interface, bool_t linkState);
387 
390 
392 
396 
397 void netTask(void);
398 void netTaskEx(NetContext *context);
399 
400 //C++ guard
401 #ifdef __cplusplus
402 }
403 #endif
404 
405 #endif
#define MdnsResponderContext
IPv6 (Internet Protocol Version 6)
const NicDriver * nicDriver
NIC driver.
Definition: net.h:202
error_t netSetEui64(NetInterface *interface, const Eui64 *eui64)
Set EUI-64 interface identifier.
Definition: net.c:553
uint32_t netGetRandRange(uint32_t min, uint32_t max)
Generate a random value in the specified range.
Definition: net.c:413
error_t netStartInterface(NetInterface *interface)
Start network interface.
Definition: net.c:1382
error_t netSetExtIntDriver(NetInterface *interface, const ExtIntDriver *driver)
Set external interrupt line driver.
Definition: net.c:1023
MacAddr macAddr
Link-layer address.
Definition: net.h:222
error_t netSetInterfaceName(NetInterface *interface, const char_t *name)
Set interface name.
Definition: net.c:635
int bool_t
Definition: compiler_port.h:53
error_t netSetUartDriver(NetInterface *interface, const UartDriver *driver)
Set UART driver.
Definition: net.c:998
DhcpServerContext * dhcpServerContext
DHCP server context.
Definition: net.h:267
uint_t netGetLinkSpeed(NetInterface *interface)
Get link speed.
Definition: net.c:1111
void netGetDefaultSettings(NetSettings *settings)
Initialize settings with default values.
Definition: net.c:82
DHCP client (Dynamic Host Configuration Protocol)
error_t netGetEui64(NetInterface *interface, Eui64 *eui64)
Retrieve EUI-64 interface identifier.
Definition: net.c:578
NdpContext ndpContext
NDP context.
Definition: net.h:274
MldNodeContext mldNodeContext
MLD node context.
Definition: net.h:280
Eui64 eui64
EUI-64 interface identifier.
Definition: net.h:199
bool_t running
The TCP/IP stack is currently running.
Definition: net.h:322
error_t netGetMacAddr(NetInterface *interface, MacAddr *macAddr)
Retrieve MAC address.
Definition: net.c:516
MdnsResponderContext * mdnsResponderContext
mDNS responder context
Definition: net.h:291
Eui64
Definition: ethernet.h:210
systime_t timestamp
Definition: net.h:326
error_t netSetParentInterface(NetInterface *interface, NetInterface *physicalInterface)
Attach a virtual interface to a given physical interface.
Definition: net.c:762
error_t netSetSpiDriver(NetInterface *interface, const SpiDriver *driver)
Set SPI driver.
Definition: net.c:973
Memory management.
uint16_t vlanId
VLAN identifier (802.1Q)
Definition: net.h:228
const UartDriver * uartDriver
Underlying UART driver.
Definition: net.h:204
uint8_t nicContext[NIC_CONTEXT_SIZE]
Driver specific context.
Definition: net.h:206
#define MAC_ADDR_FILTER_SIZE
Definition: ethernet.h:95
Ethernet PHY driver.
Definition: nic.h:311
UART driver.
Definition: nic.h:385
uint8_t data[]
Definition: ethernet.h:222
void netGetRandData(uint8_t *data, size_t length)
Get a string of random data.
Definition: net.c:443
Event object.
uint32_t entropy
Definition: net.h:325
OsMutex mutex
Mutex preventing simultaneous access to the TCP/IP stack.
Definition: net.h:320
External interrupt line driver.
Definition: nic.h:398
#define AutoIpContext
Definition: auto_ip.h:139
error_t netSetSwitchDriver(NetInterface *interface, const SwitchDriver *driver)
Set Ethernet switch driver.
Definition: net.c:883
char_t name[NET_MAX_IF_NAME_LEN+1]
A unique name identifying the interface.
Definition: net.h:200
SMI driver.
Definition: nic.h:357
error_t netStopInterface(NetInterface *interface)
Stop network interface.
Definition: net.c:1462
#define NET_INTERFACE_COUNT
Definition: net.h:114
Legacy definitions.
MLD node context.
Definition: mld_node.h:114
IGMP snooping switch.
char_t name[]
DhcpClientContext * dhcpClientContext
DHCP client context.
Definition: net.h:264
SPI driver.
Definition: nic.h:369
SlaacContext * slaacContext
SLAAC context.
Definition: net.h:283
error_t netSetInterfaceId(NetInterface *interface, uint32_t id)
Set interface identifier.
Definition: net.c:610
NetContext netContext
Definition: net.c:74
error_t netSetMacAddr(NetInterface *interface, const MacAddr *macAddr)
Set MAC address.
Definition: net.c:481
Pseudo-random number generator state.
Definition: net_misc.h:187
#define PppContext
Definition: ppp.h:38
IPv6 Stateless Address Autoconfiguration.
IPv6 context.
Definition: ipv6.h:496
IPv4 context.
Definition: ipv4.h:426
Ethernet.
#define NET_MAX_LINK_CHANGE_CALLBACKS
Definition: net.h:128
#define DhcpClientContext
Definition: dhcp_client.h:145
Router advertisement service.
Definitions common to mDNS client and mDNS responder.
IGMP router.
bool_t phyEvent
A PHY event is pending.
Definition: net.h:219
ArpCacheEntry arpCache[ARP_CACHE_SIZE]
ARP cache.
Definition: net.h:249
error_t netSetVmanId(NetInterface *interface, uint16_t vmanId)
Specify VMAN identifier (802.1ad)
Definition: net.c:727
IgmpRouterContext * igmpRouterContext
IGMP router context.
Definition: net.h:255
IGMP host context.
Definition: igmp_host.h:114
bool_t netGetLinkState(NetInterface *interface)
Get link state.
Definition: net.c:1080
OsTaskParameters taskParams
Task parameters.
Definition: net.h:323
#define NdpRouterAdvContext
#define ARP_CACHE_SIZE
Definition: arp.h:46
error_t netSetPhyAddr(NetInterface *interface, uint8_t phyAddr)
Specify Ethernet PHY address.
Definition: net.c:849
error_t netSetHostname(NetInterface *interface, const char_t *name)
Set host name.
Definition: net.c:664
void(* LlcRxCallback)(NetInterface *interface, EthHeader *header, const uint8_t *data, size_t length, NetRxAncillary *ancillary, void *param)
LLC frame received callback.
Definition: ethernet.h:274
#define SlaacContext
Definition: slaac.h:50
error_t
Error codes.
Definition: error.h:43
bool_t promiscuous
Promiscuous mode.
Definition: net.h:224
bool_t enableArp
Enable address resolution using ARP.
Definition: net.h:248
error_t netStart(NetContext *context)
Start TCP/IP stack.
Definition: net.c:308
DNS-SD responder (DNS-Based Service Discovery)
NDP context.
Definition: ndp.h:580
Timer callback entry.
Definition: net_misc.h:92
DHCPv6 client (Dynamic Host Configuration Protocol for IPv6)
error_t netInit(void)
Initialize TCP/IP stack (deprecated)
Definition: net.c:96
NicLinkState
Link state.
Definition: nic.h:97
NetInterface * netGetDefaultInterface(void)
Get default network interface.
Definition: net.c:467
char_t hostname[NET_MAX_HOSTNAME_LEN+1]
Host name.
Definition: net.h:201
IgmpHostContext igmpHostContext
IGMP host context.
Definition: net.h:252
#define NetInterface
Definition: net.h:36
Ipv6Context ipv6Context
IPv6 context.
Definition: net.h:272
OsTaskId taskId
Task identifier.
Definition: net.h:324
#define DnsSdResponderContext
uint8_t port
Switch port identifier.
Definition: net.h:238
#define Dhcpv6ClientContext
uint16_t vmanId
VMAN identifier (802.1ad)
Definition: net.h:231
TCP/IP stack context.
Definition: net.h:319
LlcRxCallback llcRxCallback
LLC frame received callback (802.2)
Definition: net.h:234
Error codes description.
uint_t index
Zero-based index.
Definition: net.h:197
const SwitchDriver * switchDriver
Ethernet switch driver.
Definition: net.h:220
Task parameters.
IGMP host.
uint8_t length
Definition: tcp.h:368
Byte order conversion.
NicLinkState adminLinkState
Administrative link state.
Definition: net.h:209
void * ipsecContext
IPsec context.
Definition: net.h:333
MacAddr
Definition: ethernet.h:195
#define NIC_CONTEXT_SIZE
Definition: nic.h:53
NDP (Neighbor Discovery Protocol)
DNS client (Domain Name System)
Mutex object.
error_t netSetSmiDriver(NetInterface *interface, const SmiDriver *driver)
Set SMI driver.
Definition: net.c:943
uint32_t systime_t
System time.
uint16_t port
Definition: dns_common.h:267
NdpRouterAdvContext * ndpRouterAdvContext
RA service context.
Definition: net.h:277
#define NET_MAX_TIMER_CALLBACKS
Definition: net.h:135
error_t netSetVlanId(NetInterface *interface, uint16_t vlanId)
Specify VLAN identifier (802.1Q)
Definition: net.c:693
MLD node (Multicast Listener Discovery for IPv6)
error_t netSetPhyDriver(NetInterface *interface, const PhyDriver *driver)
Set Ethernet PHY driver.
Definition: net.c:819
uint32_t netGetRand(void)
Generate a random 32-bit value.
Definition: net.c:382
char char_t
Definition: compiler_port.h:48
AutoIpContext * autoIpContext
Auto-IP context.
Definition: net.h:261
error_t netSetDriver(NetInterface *interface, const NicDriver *driver)
Set Ethernet MAC driver.
Definition: net.c:794
error_t netInitEx(NetContext *context, const NetSettings *settings)
Initialize TCP/IP stack.
Definition: net.c:126
const ExtIntDriver * extIntDriver
External interrupt line driver.
Definition: net.h:205
systime_t initialRto
TCP initial retransmission timeout.
Definition: net.h:214
bool_t linkState
Link state.
Definition: net.h:210
uint32_t linkSpeed
Link speed.
Definition: net.h:211
IPv4 fragmentation and reassembly.
Ethernet switch driver.
Definition: nic.h:325
#define NET_MAX_IF_NAME_LEN
Definition: net.h:142
MAC filter table entry.
Definition: ethernet.h:262
PppContext * pppContext
PPP context.
Definition: net.h:299
Link change callback entry.
Definition: net_misc.h:73
NicDuplexMode
Duplex mode.
Definition: nic.h:122
void netTaskEx(NetContext *context)
TCP/IP events handling.
Definition: net.c:1529
Network interface controller abstraction layer.
const SpiDriver * spiDriver
Underlying SPI driver.
Definition: net.h:203
uint8_t phyAddr
PHY address.
Definition: net.h:218
OsEvent nicTxEvent
Network controller TX event.
Definition: net.h:207
ARP cache entry.
Definition: arp.h:189
void netTask(void)
TCP/IP events handling (deprecated)
Definition: net.c:1518
PPP (Point-to-Point Protocol)
bool_t acceptAllMulticast
Accept all frames with a multicast destination address.
Definition: net.h:225
#define IgmpRouterContext
Definition: igmp_router.h:47
IgmpSnoopingContext * igmpSnoopingContext
IGMP snooping switch context.
Definition: net.h:258
void * llcRxParam
Callback parameter.
Definition: net.h:235
DnsSdResponderContext * dnsSdResponderContext
DNS-SD responder context.
Definition: net.h:295
NetRandState randState
Pseudo-random number generator state.
Definition: net.h:328
error_t netSetSwitchPort(NetInterface *interface, uint8_t port)
Specify switch port.
Definition: net.c:913
Dhcpv6ClientContext * dhcpv6ClientContext
DHCPv6 client context.
Definition: net.h:286
#define NET_RAND_SEED_SIZE
Definition: net.h:156
Ipv4Context ipv4Context
IPv4 context.
Definition: net.h:246
error_t netEnablePromiscuousMode(NetInterface *interface, bool_t enable)
Enable promiscuous mode.
Definition: net.c:1174
const PhyDriver * phyDriver
Ethernet PHY driver.
Definition: net.h:217
error_t netConfigInterface(NetInterface *interface)
Configure network interface.
Definition: net.c:1200
IPv4 (Internet Protocol Version 4)
OsTaskParameters task
Task parameters.
Definition: net.h:310
thread_t * OsTaskId
Task identifier.
NicDuplexMode duplexMode
Duplex mode.
Definition: net.h:212
const SmiDriver * smiDriver
SMI driver.
Definition: net.h:221
IGMP snooping switch context.
TCP/IP stack settings.
Definition: net.h:309
unsigned int uint_t
Definition: compiler_port.h:50
uint32_t id
A unique number identifying the interface.
Definition: net.h:198
bool_t nicEvent
A NIC event is pending.
Definition: net.h:208
NicDuplexMode netGetDuplexMode(NetInterface *interface)
Get duplex mode.
Definition: net.c:1142
bool_t configured
Configuration done.
Definition: net.h:213
NIC driver.
Definition: nic.h:286
OsEvent event
Event object to receive notifications from drivers.
Definition: net.h:321
void * ikeContext
IKE context.
Definition: net.h:334
RTOS abstraction layer.
DHCP server (Dynamic Host Configuration Protocol)
ARP (Address Resolution Protocol)
#define DhcpServerContext
Definition: dhcp_server.h:79
error_t netSetLinkState(NetInterface *interface, bool_t linkState)
Set administrative link state.
Definition: net.c:1048
Helper functions for TCP/IP stack.
NetInterface * parent
Interface on top of which the virtual interface runs.
Definition: net.h:242
#define NET_MAX_HOSTNAME_LEN
Definition: net.h:149
Structure describing a network interface.
Definition: net.h:196
mDNS responder (Multicast DNS)
error_t netSeedRand(const uint8_t *seed, size_t length)
Seed the pseudo-random number generator.
Definition: net.c:335
Auto-IP (Dynamic Configuration of IPv4 Link-Local Addresses)
MacFilterEntry macAddrFilter[MAC_ADDR_FILTER_SIZE]
MAC filter table.
Definition: net.h:223