Go to the documentation of this file.
36 #define NetInterface struct _NetInterface
40 #include "net_config.h"
92 #ifndef GPL_LICENSE_TERMS_ACCEPTED
93 #error Before compiling CycloneTCP Open, you must accept the terms of the GPL license
97 #define CYCLONE_TCP_VERSION_STRING "2.4.4"
99 #define CYCLONE_TCP_MAJOR_VERSION 2
101 #define CYCLONE_TCP_MINOR_VERSION 4
103 #define CYCLONE_TCP_REV_NUMBER 4
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
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
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
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
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
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
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
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
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
169 #ifndef NET_TASK_PRIORITY
170 #define NET_TASK_PRIORITY OS_TASK_PRIORITY_HIGH
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
181 #ifndef netGetSystemTickCount
182 #define netGetSystemTickCount() osGetSystemTime()
216 #if (ETH_SUPPORT == ENABLED)
227 #if (ETH_VLAN_SUPPORT == ENABLED)
230 #if (ETH_VMAN_SUPPORT == ENABLED)
233 #if (ETH_LLC_SUPPORT == ENABLED)
237 #if (ETH_PORT_TAGGING_SUPPORT == ENABLED)
240 #if (ETH_VIRTUAL_IF_SUPPORT == ENABLED || ETH_VLAN_SUPPORT == ENABLED || \
241 ETH_PORT_TAGGING_SUPPORT == ENABLED)
245 #if (IPV4_SUPPORT == ENABLED)
247 #if (ETH_SUPPORT == ENABLED)
251 #if (IGMP_HOST_SUPPORT == ENABLED)
254 #if (IGMP_ROUTER_SUPPORT == ENABLED)
257 #if (IGMP_SNOOPING_SUPPORT == ENABLED)
260 #if (AUTO_IP_SUPPORT == ENABLED)
263 #if (DHCP_CLIENT_SUPPORT == ENABLED)
266 #if (DHCP_SERVER_SUPPORT == ENABLED)
271 #if (IPV6_SUPPORT == ENABLED)
273 #if (NDP_SUPPORT == ENABLED)
276 #if (NDP_ROUTER_ADV_SUPPORT == ENABLED)
279 #if (MLD_NODE_SUPPORT == ENABLED)
282 #if (SLAAC_SUPPORT == ENABLED)
285 #if (DHCPV6_CLIENT_SUPPORT == ENABLED)
290 #if (MDNS_RESPONDER_SUPPORT == ENABLED)
294 #if (DNS_SD_RESPONDER_SUPPORT == ENABLED)
298 #if (PPP_SUPPORT == ENABLED)
332 #if (IPV4_IPSEC_SUPPORT == ENABLED)
#define MdnsResponderContext
IPv6 (Internet Protocol Version 6)
const NicDriver * nicDriver
NIC driver.
error_t netSetEui64(NetInterface *interface, const Eui64 *eui64)
Set EUI-64 interface identifier.
uint32_t netGetRandRange(uint32_t min, uint32_t max)
Generate a random value in the specified range.
error_t netStartInterface(NetInterface *interface)
Start network interface.
error_t netSetExtIntDriver(NetInterface *interface, const ExtIntDriver *driver)
Set external interrupt line driver.
MacAddr macAddr
Link-layer address.
error_t netSetInterfaceName(NetInterface *interface, const char_t *name)
Set interface name.
error_t netSetUartDriver(NetInterface *interface, const UartDriver *driver)
Set UART driver.
DhcpServerContext * dhcpServerContext
DHCP server context.
uint_t netGetLinkSpeed(NetInterface *interface)
Get link speed.
void netGetDefaultSettings(NetSettings *settings)
Initialize settings with default values.
DHCP client (Dynamic Host Configuration Protocol)
error_t netGetEui64(NetInterface *interface, Eui64 *eui64)
Retrieve EUI-64 interface identifier.
NdpContext ndpContext
NDP context.
MldNodeContext mldNodeContext
MLD node context.
Eui64 eui64
EUI-64 interface identifier.
bool_t running
The TCP/IP stack is currently running.
error_t netGetMacAddr(NetInterface *interface, MacAddr *macAddr)
Retrieve MAC address.
MdnsResponderContext * mdnsResponderContext
mDNS responder context
error_t netSetParentInterface(NetInterface *interface, NetInterface *physicalInterface)
Attach a virtual interface to a given physical interface.
error_t netSetSpiDriver(NetInterface *interface, const SpiDriver *driver)
Set SPI driver.
uint16_t vlanId
VLAN identifier (802.1Q)
const UartDriver * uartDriver
Underlying UART driver.
uint8_t nicContext[NIC_CONTEXT_SIZE]
Driver specific context.
#define MAC_ADDR_FILTER_SIZE
void netGetRandData(uint8_t *data, size_t length)
Get a string of random data.
OsMutex mutex
Mutex preventing simultaneous access to the TCP/IP stack.
External interrupt line driver.
error_t netSetSwitchDriver(NetInterface *interface, const SwitchDriver *driver)
Set Ethernet switch driver.
char_t name[NET_MAX_IF_NAME_LEN+1]
A unique name identifying the interface.
error_t netStopInterface(NetInterface *interface)
Stop network interface.
#define NET_INTERFACE_COUNT
DhcpClientContext * dhcpClientContext
DHCP client context.
SlaacContext * slaacContext
SLAAC context.
error_t netSetInterfaceId(NetInterface *interface, uint32_t id)
Set interface identifier.
error_t netSetMacAddr(NetInterface *interface, const MacAddr *macAddr)
Set MAC address.
Pseudo-random number generator state.
IPv6 Stateless Address Autoconfiguration.
#define NET_MAX_LINK_CHANGE_CALLBACKS
#define DhcpClientContext
Router advertisement service.
Definitions common to mDNS client and mDNS responder.
bool_t phyEvent
A PHY event is pending.
ArpCacheEntry arpCache[ARP_CACHE_SIZE]
ARP cache.
error_t netSetVmanId(NetInterface *interface, uint16_t vmanId)
Specify VMAN identifier (802.1ad)
IgmpRouterContext * igmpRouterContext
IGMP router context.
bool_t netGetLinkState(NetInterface *interface)
Get link state.
OsTaskParameters taskParams
Task parameters.
#define NdpRouterAdvContext
error_t netSetPhyAddr(NetInterface *interface, uint8_t phyAddr)
Specify Ethernet PHY address.
error_t netSetHostname(NetInterface *interface, const char_t *name)
Set host name.
void(* LlcRxCallback)(NetInterface *interface, EthHeader *header, const uint8_t *data, size_t length, NetRxAncillary *ancillary, void *param)
LLC frame received callback.
bool_t promiscuous
Promiscuous mode.
bool_t enableArp
Enable address resolution using ARP.
error_t netStart(NetContext *context)
Start TCP/IP stack.
DNS-SD responder (DNS-Based Service Discovery)
DHCPv6 client (Dynamic Host Configuration Protocol for IPv6)
error_t netInit(void)
Initialize TCP/IP stack (deprecated)
NetInterface * netGetDefaultInterface(void)
Get default network interface.
char_t hostname[NET_MAX_HOSTNAME_LEN+1]
Host name.
IgmpHostContext igmpHostContext
IGMP host context.
Ipv6Context ipv6Context
IPv6 context.
OsTaskId taskId
Task identifier.
#define DnsSdResponderContext
uint8_t port
Switch port identifier.
#define Dhcpv6ClientContext
uint16_t vmanId
VMAN identifier (802.1ad)
LlcRxCallback llcRxCallback
LLC frame received callback (802.2)
uint_t index
Zero-based index.
const SwitchDriver * switchDriver
Ethernet switch driver.
NicLinkState adminLinkState
Administrative link state.
void * ipsecContext
IPsec context.
NDP (Neighbor Discovery Protocol)
DNS client (Domain Name System)
error_t netSetSmiDriver(NetInterface *interface, const SmiDriver *driver)
Set SMI driver.
uint32_t systime_t
System time.
NdpRouterAdvContext * ndpRouterAdvContext
RA service context.
#define NET_MAX_TIMER_CALLBACKS
error_t netSetVlanId(NetInterface *interface, uint16_t vlanId)
Specify VLAN identifier (802.1Q)
MLD node (Multicast Listener Discovery for IPv6)
error_t netSetPhyDriver(NetInterface *interface, const PhyDriver *driver)
Set Ethernet PHY driver.
uint32_t netGetRand(void)
Generate a random 32-bit value.
AutoIpContext * autoIpContext
Auto-IP context.
error_t netSetDriver(NetInterface *interface, const NicDriver *driver)
Set Ethernet MAC driver.
error_t netInitEx(NetContext *context, const NetSettings *settings)
Initialize TCP/IP stack.
const ExtIntDriver * extIntDriver
External interrupt line driver.
systime_t initialRto
TCP initial retransmission timeout.
bool_t linkState
Link state.
uint32_t linkSpeed
Link speed.
IPv4 fragmentation and reassembly.
#define NET_MAX_IF_NAME_LEN
PppContext * pppContext
PPP context.
Link change callback entry.
NicDuplexMode
Duplex mode.
void netTaskEx(NetContext *context)
TCP/IP events handling.
Network interface controller abstraction layer.
const SpiDriver * spiDriver
Underlying SPI driver.
uint8_t phyAddr
PHY address.
OsEvent nicTxEvent
Network controller TX event.
void netTask(void)
TCP/IP events handling (deprecated)
PPP (Point-to-Point Protocol)
bool_t acceptAllMulticast
Accept all frames with a multicast destination address.
#define IgmpRouterContext
IgmpSnoopingContext * igmpSnoopingContext
IGMP snooping switch context.
void * llcRxParam
Callback parameter.
DnsSdResponderContext * dnsSdResponderContext
DNS-SD responder context.
NetRandState randState
Pseudo-random number generator state.
error_t netSetSwitchPort(NetInterface *interface, uint8_t port)
Specify switch port.
Dhcpv6ClientContext * dhcpv6ClientContext
DHCPv6 client context.
#define NET_RAND_SEED_SIZE
Ipv4Context ipv4Context
IPv4 context.
error_t netEnablePromiscuousMode(NetInterface *interface, bool_t enable)
Enable promiscuous mode.
const PhyDriver * phyDriver
Ethernet PHY driver.
error_t netConfigInterface(NetInterface *interface)
Configure network interface.
IPv4 (Internet Protocol Version 4)
OsTaskParameters task
Task parameters.
thread_t * OsTaskId
Task identifier.
NicDuplexMode duplexMode
Duplex mode.
const SmiDriver * smiDriver
SMI driver.
IGMP snooping switch context.
uint32_t id
A unique number identifying the interface.
bool_t nicEvent
A NIC event is pending.
NicDuplexMode netGetDuplexMode(NetInterface *interface)
Get duplex mode.
bool_t configured
Configuration done.
OsEvent event
Event object to receive notifications from drivers.
void * ikeContext
IKE context.
DHCP server (Dynamic Host Configuration Protocol)
ARP (Address Resolution Protocol)
#define DhcpServerContext
error_t netSetLinkState(NetInterface *interface, bool_t linkState)
Set administrative link state.
Helper functions for TCP/IP stack.
NetInterface * parent
Interface on top of which the virtual interface runs.
#define NET_MAX_HOSTNAME_LEN
Structure describing a network interface.
mDNS responder (Multicast DNS)
error_t netSeedRand(const uint8_t *seed, size_t length)
Seed the pseudo-random number generator.
Auto-IP (Dynamic Configuration of IPv4 Link-Local Addresses)
MacFilterEntry macAddrFilter[MAC_ADDR_FILTER_SIZE]
MAC filter table.