Helper functions for TCP/IP stack. More...
#include "core/net.h"#include "core/net_misc.h"#include "core/socket.h"#include "core/raw_socket.h"#include "core/tcp_timer.h"#include "core/tcp_misc.h"#include "core/ethernet.h"#include "ipv4/arp.h"#include "ipv4/ipv4.h"#include "ipv4/ipv4_routing.h"#include "ipv4/auto_ip_misc.h"#include "igmp/igmp_host.h"#include "dhcp/dhcp_client_misc.h"#include "dhcp/dhcp_server_misc.h"#include "nat/nat_misc.h"#include "ipv6/ipv6.h"#include "ipv6/ipv6_routing.h"#include "ipv6/ndp.h"#include "ipv6/ndp_router_adv_misc.h"#include "mld/mld_node.h"#include "dhcpv6/dhcpv6_client_misc.h"#include "dns/dns_cache.h"#include "dns/dns_client.h"#include "mdns/mdns_client.h"#include "mdns/mdns_responder.h"#include "mdns/mdns_common.h"#include "dns_sd/dns_sd_responder.h"#include "netbios/nbns_client.h"#include "netbios/nbns_responder.h"#include "netbios/nbns_common.h"#include "llmnr/llmnr_client.h"#include "llmnr/llmnr_responder.h"#include "mibs/mib2_module.h"#include "mibs/if_mib_module.h"#include "debug.h"Go to the source code of this file.
Macros | |
| #define | TRACE_LEVEL NIC_TRACE_LEVEL |
Functions | |
| error_t | netAttachLinkChangeCallback (NetInterface *interface, NetLinkChangeCallback callback, void *param) |
| Register link change callback. More... | |
| error_t | netDetachLinkChangeCallback (NetInterface *interface, NetLinkChangeCallback callback, void *param) |
| Unregister link change callback. More... | |
| void | netProcessLinkChange (NetInterface *interface) |
| Process link state change event. More... | |
| error_t | netAttachTimerCallback (systime_t period, NetTimerCallback callback, void *param) |
| Register timer callback. More... | |
| error_t | netDetachTimerCallback (NetTimerCallback callback, void *param) |
| Unregister timer callback. More... | |
| void | netTick (void) |
| Manage TCP/IP timers. More... | |
| void | netStartTimer (NetTimer *timer, systime_t interval) |
| Start timer. More... | |
| void | netStopTimer (NetTimer *timer) |
| Stop timer. More... | |
| bool_t | netTimerRunning (NetTimer *timer) |
| Check whether the timer is running. More... | |
| bool_t | netTimerExpired (NetTimer *timer) |
| Check whether the timer has expired. More... | |
| systime_t | netGetRemainingTime (NetTimer *timer) |
| Get the remaining value of the running timer. More... | |
| void | netInitRand (void) |
| Initialize random number generator. More... | |
| uint32_t | netGenerateRand (void) |
| Generate a random 32-bit value. More... | |
| uint32_t | netGenerateRandRange (uint32_t min, uint32_t max) |
| Generate a random value in the specified range. More... | |
| void | netGenerateRandData (uint8_t *data, size_t length) |
| Get a string of random data. More... | |
| uint32_t | netGenerateRandBit (NetRandState *state) |
| Generate one random bit. More... | |
Variables | |
| const NetTxAncillary | NET_DEFAULT_TX_ANCILLARY |
| const NetRxAncillary | NET_DEFAULT_RX_ANCILLARY |
Detailed Description
Helper functions for TCP/IP stack.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.5.4
Definition in file net_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
| #define TRACE_LEVEL NIC_TRACE_LEVEL |
Definition at line 32 of file net_misc.c.
Function Documentation
◆ netAttachLinkChangeCallback()
| error_t netAttachLinkChangeCallback | ( | NetInterface * | interface, |
| NetLinkChangeCallback | callback, | ||
| void * | param | ||
| ) |
Register link change callback.
- Parameters
-
[in] interface Underlying network interface [in] callback Callback function to be called when the link state changed [in] param Callback function parameter
- Returns
- Error code
Definition at line 131 of file net_misc.c.
◆ netAttachTimerCallback()
| error_t netAttachTimerCallback | ( | systime_t | period, |
| NetTimerCallback | callback, | ||
| void * | param | ||
| ) |
Register timer callback.
- Parameters
-
[in] period Timer reload value, in milliseconds [in] callback Callback function to be called when the timer expires [in] param Callback function parameter
- Returns
- Error code
Definition at line 348 of file net_misc.c.
◆ netDetachLinkChangeCallback()
| error_t netDetachLinkChangeCallback | ( | NetInterface * | interface, |
| NetLinkChangeCallback | callback, | ||
| void * | param | ||
| ) |
Unregister link change callback.
- Parameters
-
[in] interface Underlying network interface [in] callback Callback function to be unregistered [in] param Callback function parameter
- Returns
- Error code
Definition at line 169 of file net_misc.c.
◆ netDetachTimerCallback()
| error_t netDetachTimerCallback | ( | NetTimerCallback | callback, |
| void * | param | ||
| ) |
Unregister timer callback.
- Parameters
-
[in] callback Callback function to be unregistered [in] param Callback function parameter
- Returns
- Error code
Definition at line 386 of file net_misc.c.
◆ netGenerateRand()
| uint32_t netGenerateRand | ( | void | ) |
◆ netGenerateRandBit()
| uint32_t netGenerateRandBit | ( | NetRandState * | state | ) |
Generate one random bit.
- Parameters
-
[in] state Pointer to the PRNG state
- Returns
- Key stream bit
Definition at line 1018 of file net_misc.c.
◆ netGenerateRandData()
| void netGenerateRandData | ( | uint8_t * | data, |
| size_t | length | ||
| ) |
Get a string of random data.
- Parameters
-
[out] data Buffer where to store random data [in] length Number of random bytes to generate
Definition at line 990 of file net_misc.c.
◆ netGenerateRandRange()
| uint32_t netGenerateRandRange | ( | uint32_t | min, |
| uint32_t | max | ||
| ) |
Generate a random value in the specified range.
- Parameters
-
[in] min Lower bound [in] max Upper bound
- Returns
- Random value in the specified range
Definition at line 963 of file net_misc.c.
◆ netGetRemainingTime()
Get the remaining value of the running timer.
- Parameters
-
[in] timer Pointer to the timer structure
- Returns
- Remaining time
Definition at line 852 of file net_misc.c.
◆ netInitRand()
| void netInitRand | ( | void | ) |
Initialize random number generator.
Definition at line 881 of file net_misc.c.
◆ netProcessLinkChange()
| void netProcessLinkChange | ( | NetInterface * | interface | ) |
Process link state change event.
- Parameters
-
[in] interface Underlying network interface
Definition at line 202 of file net_misc.c.
◆ netStartTimer()
Start timer.
- Parameters
-
[in] timer Pointer to the timer structure [in] interval Time interval
Definition at line 781 of file net_misc.c.
◆ netStopTimer()
| void netStopTimer | ( | NetTimer * | timer | ) |
Stop timer.
- Parameters
-
[in] timer Pointer to the timer structure
Definition at line 795 of file net_misc.c.
◆ netTick()
| void netTick | ( | void | ) |
Manage TCP/IP timers.
Definition at line 417 of file net_misc.c.
◆ netTimerExpired()
Check whether the timer has expired.
- Parameters
-
[in] timer Pointer to the timer structure
- Returns
- TRUE if the timer has expired, else FALSE
Definition at line 821 of file net_misc.c.
◆ netTimerRunning()
Check whether the timer is running.
- Parameters
-
[in] timer Pointer to the timer structure
- Returns
- TRUE if the timer is running, else FALSE
Definition at line 808 of file net_misc.c.
Variable Documentation
◆ NET_DEFAULT_RX_ANCILLARY
| const NetRxAncillary NET_DEFAULT_RX_ANCILLARY |
Definition at line 105 of file net_misc.c.
◆ NET_DEFAULT_TX_ANCILLARY
| const NetTxAncillary NET_DEFAULT_TX_ANCILLARY |
Definition at line 72 of file net_misc.c.
