net_misc.c
Go to the documentation of this file.
1 /**
2  * @file net_misc.c
3  * @brief Helper functions for TCP/IP stack
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2020 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 1.9.8
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "core/net_misc.h"
37 #include "core/socket.h"
38 #include "core/raw_socket.h"
39 #include "core/tcp_timer.h"
40 #include "core/tcp_misc.h"
41 #include "core/ethernet.h"
42 #include "ipv4/arp.h"
43 #include "ipv4/ipv4.h"
44 #include "ipv4/ipv4_routing.h"
45 #include "ipv4/igmp.h"
46 #include "ipv6/ipv6.h"
47 #include "ipv6/ipv6_routing.h"
48 #include "ipv6/mld.h"
49 #include "ipv6/ndp.h"
50 #include "ipv6/ndp_router_adv.h"
51 #include "dhcp/dhcp_client.h"
52 #include "dhcp/dhcp_server.h"
53 #include "dns/dns_cache.h"
54 #include "dns/dns_client.h"
55 #include "mdns/mdns_client.h"
56 #include "mdns/mdns_responder.h"
57 #include "mdns/mdns_common.h"
58 #include "dns_sd/dns_sd.h"
59 #include "netbios/nbns_client.h"
60 #include "netbios/nbns_responder.h"
61 #include "netbios/nbns_common.h"
62 #include "llmnr/llmnr_responder.h"
63 #include "mibs/mib2_module.h"
64 #include "mibs/if_mib_module.h"
65 #include "debug.h"
66 
67 //Default options passed to the stack (TX path)
69 {
70  0, //Time-to-live value
71  FALSE, //Do not send the packet via a router
72 #if (IP_DIFF_SERV_SUPPORT == ENABLED)
73  0, //Differentiated services codepoint
74 #endif
75 #if (ETH_SUPPORT == ENABLED)
76  {0}, //Source MAC address
77  {0}, //Destination MAC address
78 #endif
79 #if (ETH_VLAN_SUPPORT == ENABLED)
80  -1, //VLAN priority (802.1Q)
81  -1, //Drop eligible indicator
82 #endif
83 #if (ETH_VMAN_SUPPORT == ENABLED)
84  -1, //VMAN priority (802.1ad)
85  -1, //Drop eligible indicator
86 #endif
87 #if (ETH_PORT_TAGGING_SUPPORT == ENABLED)
88  0, //Switch port identifier
89 #endif
90 #if (ETH_TIMESTAMP_SUPPORT == ENABLED)
91  -1, //Unique identifier for hardware time stamping
92 #endif
93 };
94 
95 //Default options passed to the stack (RX path)
97 {
98  0, //Time-to-live value
99 #if (ETH_SUPPORT == ENABLED)
100  {0}, ///<Source MAC address
101  {0}, ///<Destination MAC address
102 #endif
103 #if (ETH_PORT_TAGGING_SUPPORT == ENABLED)
104  0, //Switch port identifier
105 #endif
106 #if (ETH_TIMESTAMP_SUPPORT == ENABLED)
107  {0}, //Captured time stamp
108 #endif
109 };
110 
111 
112 /**
113  * @brief Register link change callback
114  * @param[in] interface Underlying network interface
115  * @param[in] callback Callback function to be called when the link state changed
116  * @param[in] param Callback function parameter
117  * @return Error code
118  **/
119 
121  NetLinkChangeCallback callback, void *param)
122 {
123  uint_t i;
125 
126  //Loop through the table
127  for(i = 0; i < NET_MAX_LINK_CHANGE_CALLBACKS; i++)
128  {
129  //Point to the current entry
130  entry = &netContext.linkChangeCallbacks[i];
131 
132  //Check whether the entry is currently in available
133  if(entry->callback == NULL)
134  {
135  //Create a new entry
136  entry->interface = interface;
137  entry->callback = callback;
138  entry->param = param;
139 
140  //Successful processing
141  return NO_ERROR;
142  }
143  }
144 
145  //The table runs out of space
146  return ERROR_OUT_OF_RESOURCES;
147 }
148 
149 
150 /**
151  * @brief Unregister link change callback
152  * @param[in] interface Underlying network interface
153  * @param[in] callback Callback function to be unregistered
154  * @param[in] param Callback function parameter
155  * @return Error code
156  **/
157 
159  NetLinkChangeCallback callback, void *param)
160 {
161  uint_t i;
163 
164  //Loop through the table
165  for(i = 0; i < NET_MAX_LINK_CHANGE_CALLBACKS; i++)
166  {
167  //Point to the current entry
168  entry = &netContext.linkChangeCallbacks[i];
169 
170  //Check whether the current entry matches the specified callback function
171  if(entry->interface == interface && entry->callback == callback &&
172  entry->param == param)
173  {
174  //Unregister callback function
175  entry->interface = NULL;
176  entry->callback = NULL;
177  entry->param = NULL;
178  }
179  }
180 
181  //Successful processing
182  return NO_ERROR;
183 }
184 
185 
186 /**
187  * @brief Process link state change event
188  * @param[in] interface Underlying network interface
189  **/
190 
192 {
193  uint_t i;
194  Socket *socket;
195 
196  //Check link state
197  if(interface->linkState)
198  {
199  //Display link state
200  TRACE_INFO("Link is up (%s)...\r\n", interface->name);
201 
202  //Display link speed
203  if(interface->linkSpeed == NIC_LINK_SPEED_1GBPS)
204  {
205  //1000BASE-T
206  TRACE_INFO(" Link speed = 1000 Mbps\r\n");
207  }
208  else if(interface->linkSpeed == NIC_LINK_SPEED_100MBPS)
209  {
210  //100BASE-TX
211  TRACE_INFO(" Link speed = 100 Mbps\r\n");
212  }
213  else if(interface->linkSpeed == NIC_LINK_SPEED_10MBPS)
214  {
215  //10BASE-T
216  TRACE_INFO(" Link speed = 10 Mbps\r\n");
217  }
218  else if(interface->linkSpeed != NIC_LINK_SPEED_UNKNOWN)
219  {
220  //10BASE-T
221  TRACE_INFO(" Link speed = %" PRIu32 " bps\r\n",
222  interface->linkSpeed);
223  }
224 
225  //Display duplex mode
226  if(interface->duplexMode == NIC_FULL_DUPLEX_MODE)
227  {
228  //1000BASE-T
229  TRACE_INFO(" Duplex mode = Full-Duplex\r\n");
230  }
231  else if(interface->duplexMode == NIC_HALF_DUPLEX_MODE)
232  {
233  //100BASE-TX
234  TRACE_INFO(" Duplex mode = Half-Duplex\r\n");
235  }
236  }
237  else
238  {
239  //Display link state
240  TRACE_INFO("Link is down (%s)...\r\n", interface->name);
241  }
242 
243  //The time at which the interface entered its current operational state
244  MIB2_SET_TIME_TICKS(ifGroup.ifTable[interface->index].ifLastChange,
245  osGetSystemTime() / 10);
246  IF_MIB_SET_TIME_TICKS(ifTable[interface->index].ifLastChange,
247  osGetSystemTime() / 10);
248 
249 #if (IPV4_SUPPORT == ENABLED)
250  //Notify IPv4 of link state changes
251  ipv4LinkChangeEvent(interface);
252 #endif
253 
254 #if (IPV6_SUPPORT == ENABLED)
255  //Notify IPv6 of link state changes
256  ipv6LinkChangeEvent(interface);
257 #endif
258 
259 #if (DNS_CLIENT_SUPPORT == ENABLED || MDNS_CLIENT_SUPPORT == ENABLED || \
260  NBNS_CLIENT_SUPPORT == ENABLED)
261  //Flush DNS cache
262  dnsFlushCache(interface);
263 #endif
264 
265 #if (MDNS_RESPONDER_SUPPORT == ENABLED)
266  //Perform probing and announcing
267  mdnsResponderLinkChangeEvent(interface->mdnsResponderContext);
268 #endif
269 
270 #if (DNS_SD_SUPPORT == ENABLED)
271  //Perform probing and announcing
272  dnsSdLinkChangeEvent(interface->dnsSdContext);
273 #endif
274 
275  //Loop through the link change callback table
276  for(i = 0; i < NET_MAX_LINK_CHANGE_CALLBACKS; i++)
277  {
279 
280  //Point to the current entry
281  entry = &netContext.linkChangeCallbacks[i];
282 
283  //Any registered callback?
284  if(entry->callback != NULL)
285  {
286  //Check whether the network interface matches the current entry
287  if(entry->interface == NULL || entry->interface == interface)
288  {
289  //Invoke user callback function
290  entry->callback(interface, interface->linkState, entry->param);
291  }
292  }
293  }
294 
295  //Loop through opened sockets
296  for(i = 0; i < SOCKET_MAX_COUNT; i++)
297  {
298  //Point to the current socket
299  socket = socketTable + i;
300 
301 #if (TCP_SUPPORT == ENABLED)
302  //Connection-oriented socket?
303  if(socket->type == SOCKET_TYPE_STREAM)
304  {
306  }
307 #endif
308 
309 #if (UDP_SUPPORT == ENABLED)
310  //Connectionless socket?
311  if(socket->type == SOCKET_TYPE_DGRAM)
312  {
314  }
315 #endif
316 
317 #if (RAW_SOCKET_SUPPORT == ENABLED)
318  //Raw socket?
319  if(socket->type == SOCKET_TYPE_RAW_IP ||
320  socket->type == SOCKET_TYPE_RAW_ETH)
321  {
323  }
324 #endif
325  }
326 }
327 
328 
329 /**
330  * @brief Register timer callback
331  * @param[in] period Timer reload value, in milliseconds
332  * @param[in] callback Callback function to be called when the timer expires
333  * @param[in] param Callback function parameter
334  * @return Error code
335  **/
336 
338  void *param)
339 {
340  uint_t i;
341  NetTimerCallbackEntry *entry;
342 
343  //Loop through the table
344  for(i = 0; i < NET_MAX_TIMER_CALLBACKS; i++)
345  {
346  //Point to the current entry
347  entry = &netContext.timerCallbacks[i];
348 
349  //Check whether the entry is currently in available
350  if(entry->callback == NULL)
351  {
352  //Create a new entry
353  entry->timerValue = 0;
354  entry->timerPeriod = period;
355  entry->callback = callback;
356  entry->param = param;
357 
358  //Successful processing
359  return NO_ERROR;
360  }
361  }
362 
363  //The table runs out of space
364  return ERROR_OUT_OF_RESOURCES;
365 }
366 
367 
368 /**
369  * @brief Unregister timer callback
370  * @param[in] callback Callback function to be unregistered
371  * @param[in] param Callback function parameter
372  * @return Error code
373  **/
374 
376 {
377  uint_t i;
378  NetTimerCallbackEntry *entry;
379 
380  //Loop through the table
381  for(i = 0; i < NET_MAX_TIMER_CALLBACKS; i++)
382  {
383  //Point to the current entry
384  entry = &netContext.timerCallbacks[i];
385 
386  //Check whether the current entry matches the specified callback function
387  if(entry->callback == callback && entry->param == param)
388  {
389  //Unregister callback function
390  entry->timerValue = 0;
391  entry->timerPeriod = 0;
392  entry->callback = NULL;
393  entry->param = NULL;
394  }
395  }
396 
397  //Successful processing
398  return NO_ERROR;
399 }
400 
401 
402 /**
403  * @brief Manage TCP/IP timers
404  **/
405 
406 void netTick(void)
407 {
408  uint_t i;
409  NetTimerCallbackEntry *entry;
410 
411  //Increment tick counter
413 
414  //Handle periodic operations such as polling the link state
416  {
417  //Loop through network interfaces
418  for(i = 0; i < NET_INTERFACE_COUNT; i++)
419  {
420  //Make sure the interface has been properly configured
421  if(netInterface[i].configured)
422  nicTick(&netInterface[i]);
423  }
424 
425  //Reset tick counter
426  nicTickCounter = 0;
427  }
428 
429 #if (PPP_SUPPORT == ENABLED)
430  //Increment tick counter
432 
433  //Manage PPP related timers
435  {
436  //Loop through network interfaces
437  for(i = 0; i < NET_INTERFACE_COUNT; i++)
438  {
439  //Make sure the interface has been properly configured
440  if(netInterface[i].configured)
441  pppTick(&netInterface[i]);
442  }
443 
444  //Reset tick counter
445  pppTickCounter = 0;
446  }
447 #endif
448 
449 #if (IPV4_SUPPORT == ENABLED && ETH_SUPPORT == ENABLED)
450  //Increment tick counter
452 
453  //Manage ARP cache
455  {
456  //Loop through network interfaces
457  for(i = 0; i < NET_INTERFACE_COUNT; i++)
458  {
459  //Make sure the interface has been properly configured
460  if(netInterface[i].configured)
461  arpTick(&netInterface[i]);
462  }
463 
464  //Reset tick counter
465  arpTickCounter = 0;
466  }
467 #endif
468 
469 #if (IPV4_SUPPORT == ENABLED && IPV4_FRAG_SUPPORT == ENABLED)
470  //Increment tick counter
472 
473  //Handle IPv4 fragment reassembly timeout
475  {
476  //Loop through network interfaces
477  for(i = 0; i < NET_INTERFACE_COUNT; i++)
478  {
479  //Make sure the interface has been properly configured
480  if(netInterface[i].configured)
482  }
483 
484  //Reset tick counter
486  }
487 #endif
488 
489 #if (IPV4_SUPPORT == ENABLED && IGMP_SUPPORT == ENABLED)
490  //Increment tick counter
492 
493  //Handle IGMP related timers
495  {
496  //Loop through network interfaces
497  for(i = 0; i < NET_INTERFACE_COUNT; i++)
498  {
499  //Make sure the interface has been properly configured
500  if(netInterface[i].configured)
501  igmpTick(&netInterface[i]);
502  }
503 
504  //Reset tick counter
505  igmpTickCounter = 0;
506  }
507 #endif
508 
509 #if (IPV4_SUPPORT == ENABLED && AUTO_IP_SUPPORT == ENABLED)
510  //Increment tick counter
512 
513  //Handle Auto-IP related timers
515  {
516  //Loop through network interfaces
517  for(i = 0; i < NET_INTERFACE_COUNT; i++)
518  autoIpTick(netInterface[i].autoIpContext);
519 
520  //Reset tick counter
521  autoIpTickCounter = 0;
522  }
523 #endif
524 
525 #if (IPV4_SUPPORT == ENABLED && DHCP_CLIENT_SUPPORT == ENABLED)
526  //Increment tick counter
528 
529  //Handle DHCP client related timers
531  {
532  //Loop through network interfaces
533  for(i = 0; i < NET_INTERFACE_COUNT; i++)
534  dhcpClientTick(netInterface[i].dhcpClientContext);
535 
536  //Reset tick counter
538  }
539 #endif
540 
541 #if (IPV4_SUPPORT == ENABLED && DHCP_SERVER_SUPPORT == ENABLED)
542  //Increment tick counter
544 
545  //Handle DHCP server related timers
547  {
548  //Loop through network interfaces
549  for(i = 0; i < NET_INTERFACE_COUNT; i++)
550  dhcpServerTick(netInterface[i].dhcpServerContext);
551 
552  //Reset tick counter
554  }
555 #endif
556 
557 #if (IPV6_SUPPORT == ENABLED && IPV6_FRAG_SUPPORT == ENABLED)
558  //Increment tick counter
560 
561  //Handle IPv6 fragment reassembly timeout
563  {
564  //Loop through network interfaces
565  for(i = 0; i < NET_INTERFACE_COUNT; i++)
566  {
567  //Make sure the interface has been properly configured
568  if(netInterface[i].configured)
570  }
571 
572  //Reset tick counter
574  }
575 #endif
576 
577 #if (IPV6_SUPPORT == ENABLED && MLD_SUPPORT == ENABLED)
578  //Increment tick counter
580 
581  //Handle MLD related timers
583  {
584  //Loop through network interfaces
585  for(i = 0; i < NET_INTERFACE_COUNT; i++)
586  {
587  //Make sure the interface has been properly configured
588  if(netInterface[i].configured)
589  mldTick(&netInterface[i]);
590  }
591 
592  //Reset tick counter
593  mldTickCounter = 0;
594  }
595 #endif
596 
597 #if (IPV6_SUPPORT == ENABLED && NDP_SUPPORT == ENABLED)
598  //Increment tick counter
600 
601  //Handle NDP related timers
603  {
604  //Loop through network interfaces
605  for(i = 0; i < NET_INTERFACE_COUNT; i++)
606  {
607  //Make sure the interface has been properly configured
608  if(netInterface[i].configured)
609  ndpTick(&netInterface[i]);
610  }
611 
612  //Reset tick counter
613  ndpTickCounter = 0;
614  }
615 #endif
616 
617 #if (IPV6_SUPPORT == ENABLED && NDP_ROUTER_ADV_SUPPORT == ENABLED)
618  //Increment tick counter
620 
621  //Handle RA service related timers
623  {
624  //Loop through network interfaces
625  for(i = 0; i < NET_INTERFACE_COUNT; i++)
626  ndpRouterAdvTick(netInterface[i].ndpRouterAdvContext);
627 
628  //Reset tick counter
630  }
631 #endif
632 
633 #if (IPV6_SUPPORT == ENABLED && DHCPV6_CLIENT_SUPPORT == ENABLED)
634  //Increment tick counter
636 
637  //Handle DHCPv6 client related timers
639  {
640  //Loop through network interfaces
641  for(i = 0; i < NET_INTERFACE_COUNT; i++)
642  dhcpv6ClientTick(netInterface[i].dhcpv6ClientContext);
643 
644  //Reset tick counter
646  }
647 #endif
648 
649 #if (TCP_SUPPORT == ENABLED)
650  //Increment tick counter
652 
653  //Manage TCP related timers
655  {
656  //TCP timer handler
657  tcpTick();
658  //Reset tick counter
659  tcpTickCounter = 0;
660  }
661 #endif
662 
663 #if (DNS_CLIENT_SUPPORT == ENABLED || MDNS_CLIENT_SUPPORT == ENABLED || \
664  NBNS_CLIENT_SUPPORT == ENABLED)
665  //Increment tick counter
667 
668  //Manage DNS cache
670  {
671  //DNS timer handler
672  dnsTick();
673  //Reset tick counter
674  dnsTickCounter = 0;
675  }
676 #endif
677 
678 #if (MDNS_RESPONDER_SUPPORT == ENABLED)
679  //Increment tick counter
681 
682  //Manage mDNS probing and announcing
684  {
685  //Loop through network interfaces
686  for(i = 0; i < NET_INTERFACE_COUNT; i++)
687  mdnsResponderTick(netInterface[i].mdnsResponderContext);
688 
689  //Reset tick counter
691  }
692 #endif
693 
694 #if (DNS_SD_SUPPORT == ENABLED)
695  //Increment tick counter
697 
698  //Manage DNS-SD probing and announcing
700  {
701  //Loop through network interfaces
702  for(i = 0; i < NET_INTERFACE_COUNT; i++)
703  dnsSdTick(netInterface[i].dnsSdContext);
704 
705  //Reset tick counter
706  dnsSdTickCounter = 0;
707  }
708 #endif
709 
710  //Loop through the timer callback table
711  for(i = 0; i < NET_MAX_TIMER_CALLBACKS; i++)
712  {
713  //Point to the current entry
714  entry = &netContext.timerCallbacks[i];
715 
716  //Any registered callback?
717  if(entry->callback != NULL)
718  {
719  //Increment timer value
720  entry->timerValue += NET_TICK_INTERVAL;
721 
722  //Timer period elapsed?
723  if(entry->timerValue >= entry->timerPeriod)
724  {
725  //Invoke user callback function
726  entry->callback(entry->param);
727  //Reload timer
728  entry->timerValue = 0;
729  }
730  }
731  }
732 }
IPv6 (Internet Protocol Version 6)
NetTimerCallback callback
Definition: net_misc.h:88
MIB-II module.
systime_t ipv4FragTickCounter
Definition: ipv4_frag.c:57
void ipv6FragTick(NetInterface *interface)
Fragment reassembly timeout handler.
Definition: ipv6_frag.c:532
#define IF_MIB_SET_TIME_TICKS(name, value)
Definition: if_mib_module.h:46
void ipv4FragTick(NetInterface *interface)
Fragment reassembly timeout handler.
Definition: ipv4_frag.c:456
void dhcpv6ClientTick(Dhcpv6ClientContext *context)
DHCPv6 client timer handler.
DHCP client (Dynamic Host Configuration Protocol)
const NetTxAncillary NET_DEFAULT_TX_ANCILLARY
Definition: net_misc.c:68
systime_t timerPeriod
Definition: net_misc.h:87
void udpUpdateEvents(Socket *socket)
Update UDP related events.
Definition: udp.c:796
systime_t arpTickCounter
Definition: arp.c:51
systime_t igmpTickCounter
Definition: igmp.c:53
systime_t timerValue
Definition: net_misc.h:86
void ndpTick(NetInterface *interface)
NDP timer handler.
Definition: ndp.c:284
error_t netAttachLinkChangeCallback(NetInterface *interface, NetLinkChangeCallback callback, void *param)
Register link change callback.
Definition: net_misc.c:120
#define DNS_TICK_INTERVAL
Definition: dns_cache.h:40
#define IPV4_FRAG_TICK_INTERVAL
Definition: ipv4_frag.h:47
error_t netAttachTimerCallback(systime_t period, NetTimerCallback callback, void *param)
Register timer callback.
Definition: net_misc.c:337
IGMP (Internet Group Management Protocol)
NetTimerCallbackEntry timerCallbacks[NET_MAX_TIMER_CALLBACKS]
Definition: net.h:300
void ipv4LinkChangeEvent(NetInterface *interface)
Callback function for link change event.
Definition: ipv4.c:517
#define ARP_TICK_INTERVAL
Definition: arp.h:39
#define NET_INTERFACE_COUNT
Definition: net.h:110
systime_t nicTickCounter
Definition: nic.c:43
IPv6 routing.
void * param
Definition: net_misc.h:89
NetContext netContext
Definition: net.c:71
#define NET_TICK_INTERVAL
Definition: net.h:171
void pppTick(NetInterface *interface)
PPP timer handler.
Definition: ppp.c:846
void * param
Definition: net_misc.h:69
void dnsFlushCache(NetInterface *interface)
Flush DNS cache.
Definition: dns_cache.c:74
void arpTick(NetInterface *interface)
ARP timer handler.
Definition: arp.c:432
systime_t ipv6FragTickCounter
Definition: ipv6_frag.c:47
systime_t dhcpClientTickCounter
Definition: dhcp_client.c:55
Ethernet.
#define NET_MAX_LINK_CHANGE_CALLBACKS
Definition: net.h:124
void dhcpServerTick(DhcpServerContext *context)
DHCP server timer handler.
Definition: dhcp_server.c:251
error_t netDetachTimerCallback(NetTimerCallback callback, void *param)
Unregister timer callback.
Definition: net_misc.c:375
Router advertisement service.
systime_t pppTickCounter
Definition: ppp.c:51
Definitions common to mDNS client and mDNS responder.
DNS-SD (DNS-Based Service Discovery)
void mldTick(NetInterface *interface)
MLD timer handler.
Definition: mld.c:155
void ndpRouterAdvTick(NdpRouterAdvContext *context)
RA service timer handler.
systime_t ndpTickCounter
Definition: ndp.c:59
void(* NetLinkChangeCallback)(NetInterface *interface, bool_t linkState, void *param)
Link change callback.
Definition: net_misc.h:57
#define FALSE
Definition: os_port.h:46
Helper functions for TCP.
systime_t ndpRouterAdvTickCounter
void autoIpTick(AutoIpContext *context)
Auto-IP timer handler.
Definition: auto_ip.c:238
#define IPV6_FRAG_TICK_INTERVAL
Definition: ipv6_frag.h:54
error_t
Error codes.
Definition: error.h:42
#define netInterface
Definition: net_legacy.h:273
Definitions common to NBNS client and NBNS responder.
Timer callback entry.
Definition: net_misc.h:84
NetLinkChangeCallbackEntry linkChangeCallbacks[NET_MAX_LINK_CHANGE_CALLBACKS]
Definition: net.h:299
int_t socket(int_t family, int_t type, int_t protocol)
Create a socket that is bound to a specific transport service provider.
Definition: bsd_socket.c:108
NBNS client (NetBIOS Name Service)
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
Definition: net_misc.c:96
void dnsSdTick(DnsSdContext *context)
DNS-SD responder timer handler.
Definition: dns_sd.c:508
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:36
#define DHCP_SERVER_TICK_INTERVAL
Definition: dhcp_server.h:46
NetInterface * interface
Definition: net_misc.h:67
#define NetTxAncillary
Definition: net_misc.h:36
mDNS client (Multicast DNS)
void tcpUpdateEvents(Socket *socket)
Update TCP related events.
Definition: tcp_misc.c:1799
#define NDP_TICK_INTERVAL
Definition: ndp.h:46
error_t netDetachLinkChangeCallback(NetInterface *interface, NetLinkChangeCallback callback, void *param)
Unregister link change callback.
Definition: net_misc.c:158
#define TRACE_INFO(...)
Definition: debug.h:95
Interfaces Group MIB module.
void netProcessLinkChange(NetInterface *interface)
Process link state change event.
Definition: net_misc.c:191
#define TCP_TICK_INTERVAL
Definition: tcp.h:47
Socket socketTable[SOCKET_MAX_COUNT]
Definition: socket.c:49
void igmpTick(NetInterface *interface)
IGMP timer handler.
Definition: igmp.c:160
void rawSocketUpdateEvents(Socket *socket)
Update event state for raw sockets.
Definition: raw_socket.c:920
void mdnsResponderTick(MdnsResponderContext *context)
mDNS responder timer handler
void dnsTick(void)
DNS timer handler.
Definition: dns_cache.c:225
NDP (Neighbor Discovery Protocol)
DNS client (Domain Name System)
TCP/IP raw sockets.
systime_t tcpTickCounter
Definition: tcp.c:49
#define NET_MAX_TIMER_CALLBACKS
Definition: net.h:131
systime_t mldTickCounter
Definition: mld.c:56
#define MDNS_RESPONDER_TICK_INTERVAL
#define DNS_SD_TICK_INTERVAL
Definition: dns_sd.h:48
systime_t dnsSdTickCounter
Definition: dns_sd.c:57
NetLinkChangeCallback callback
Definition: net_misc.h:68
DNS cache management.
#define NIC_TICK_INTERVAL
Definition: nic.h:39
void mdnsResponderLinkChangeEvent(MdnsResponderContext *context)
Callback function for link change event.
#define NDP_ROUTER_ADV_TICK_INTERVAL
#define AUTO_IP_TICK_INTERVAL
Definition: auto_ip.h:53
systime_t autoIpTickCounter
Definition: auto_ip.c:56
void netTick(void)
Manage TCP/IP timers.
Definition: net_misc.c:406
Link change callback entry.
Definition: net_misc.h:65
systime_t dhcpv6ClientTickCounter
Definition: dhcpv6_client.c:59
#define Socket
Definition: socket.h:36
#define DHCP_CLIENT_TICK_INTERVAL
Definition: dhcp_client.h:49
#define DHCPV6_CLIENT_TICK_INTERVAL
Definition: dhcpv6_client.h:47
IPv4 routing.
#define PPP_TICK_INTERVAL
Definition: ppp.h:82
#define IGMP_TICK_INTERVAL
Definition: igmp.h:46
Socket API.
systime_t dhcpServerTickCounter
Definition: dhcp_server.c:54
void tcpTick(void)
TCP timer handler.
Definition: tcp_timer.c:58
LLMNR responder (Link-Local Multicast Name Resolution)
void dnsSdLinkChangeEvent(DnsSdContext *context)
Callback function for link change event.
Definition: dns_sd.c:669
#define MIB2_SET_TIME_TICKS(name, value)
Definition: mib2_module.h:155
#define MLD_TICK_INTERVAL
Definition: mld.h:46
IPv4 (Internet Protocol Version 4)
TCP timer management.
void ipv6LinkChangeEvent(NetInterface *interface)
Callback function for link change event.
Definition: ipv6.c:797
unsigned int uint_t
Definition: compiler_port.h:45
void nicTick(NetInterface *interface)
Network controller timer handler.
Definition: nic.c:250
TCP/IP stack core.
#define SOCKET_MAX_COUNT
Definition: socket.h:46
systime_t mdnsResponderTickCounter
DHCP server (Dynamic Host Configuration Protocol)
ARP (Address Resolution Protocol)
void dhcpClientTick(DhcpClientContext *context)
DHCP client timer handler.
Definition: dhcp_client.c:284
uint32_t systime_t
Definition: compiler_port.h:46
Helper functions for TCP/IP stack.
Success.
Definition: error.h:44
Debugging facilities.
void(* NetTimerCallback)(void *param)
Timer callback.
Definition: net_misc.h:77
NBNS responder (NetBIOS Name Service)
mDNS responder (Multicast DNS)
MLD (Multicast Listener Discovery for IPv6)
systime_t osGetSystemTime(void)
Retrieve system time.
systime_t dnsTickCounter
Definition: dns_cache.c:49