36#define NetInterface struct _NetInterface
91#ifndef GPL_LICENSE_TERMS_ACCEPTED
92 #error Before compiling CycloneTCP Open, you must accept the terms of the GPL license
96#define CYCLONE_TCP_VERSION_STRING "2.3.0"
98#define CYCLONE_TCP_MAJOR_VERSION 2
100#define CYCLONE_TCP_MINOR_VERSION 3
102#define CYCLONE_TCP_REV_NUMBER 0
105#ifndef NET_RTOS_SUPPORT
106 #define NET_RTOS_SUPPORT ENABLED
107#elif (NET_RTOS_SUPPORT != ENABLED && NET_RTOS_SUPPORT != DISABLED)
108 #error NET_RTOS_SUPPORT parameter is not valid
112#ifndef NET_INTERFACE_COUNT
113 #define NET_INTERFACE_COUNT 1
114#elif (NET_INTERFACE_COUNT < 1)
115 #error NET_INTERFACE_COUNT parameter is not valid
119#ifndef NET_LOOPBACK_IF_SUPPORT
120 #define NET_LOOPBACK_IF_SUPPORT DISABLED
121#elif (NET_LOOPBACK_IF_SUPPORT != ENABLED && NET_LOOPBACK_IF_SUPPORT != DISABLED)
122 #error NET_LOOPBACK_IF_SUPPORT parameter is not valid
126#ifndef NET_MAX_LINK_CHANGE_CALLBACKS
127 #define NET_MAX_LINK_CHANGE_CALLBACKS (6 * NET_INTERFACE_COUNT)
128#elif (NET_MAX_LINK_CHANGE_CALLBACKS < 1)
129 #error NET_MAX_LINK_CHANGE_CALLBACKS parameter is not valid
133#ifndef NET_MAX_TIMER_CALLBACKS
134 #define NET_MAX_TIMER_CALLBACKS (6 * NET_INTERFACE_COUNT)
135#elif (NET_MAX_TIMER_CALLBACKS < 1)
136 #error NET_MAX_TIMER_CALLBACKS parameter is not valid
140#ifndef NET_MAX_IF_NAME_LEN
141 #define NET_MAX_IF_NAME_LEN 8
142#elif (NET_MAX_IF_NAME_LEN < 1)
143 #error NET_MAX_IF_NAME_LEN parameter is not valid
147#ifndef NET_MAX_HOSTNAME_LEN
148 #define NET_MAX_HOSTNAME_LEN 24
149#elif (NET_MAX_HOSTNAME_LEN < 1)
150 #error NET_MAX_HOSTNAME_LEN parameter is not valid
154#ifndef NET_RAND_SEED_SIZE
155 #define NET_RAND_SEED_SIZE 16
156#elif (NET_RAND_SEED_SIZE < 10)
157 #error NET_RAND_SEED_SIZE parameter is not valid
161#ifndef NET_TASK_STACK_SIZE
162 #define NET_TASK_STACK_SIZE 650
163#elif (NET_TASK_STACK_SIZE < 1)
164 #error NET_TASK_STACK_SIZE parameter is not valid
168#ifndef NET_TASK_PRIORITY
169 #define NET_TASK_PRIORITY OS_TASK_PRIORITY_HIGH
173#ifndef NET_TICK_INTERVAL
174 #define NET_TICK_INTERVAL 100
175#elif (NET_TICK_INTERVAL < 10)
176 #error NET_TICK_INTERVAL parameter is not valid
180#ifndef netGetSystemTickCount
181 #define netGetSystemTickCount() osGetSystemTime()
199 char_t
name[NET_MAX_IF_NAME_LEN + 1];
215#if (ETH_SUPPORT == ENABLED)
226#if (ETH_VLAN_SUPPORT == ENABLED)
229#if (ETH_VMAN_SUPPORT == ENABLED)
232#if (ETH_LLC_SUPPORT == ENABLED)
236#if (ETH_PORT_TAGGING_SUPPORT == ENABLED)
239#if (ETH_VIRTUAL_IF_SUPPORT == ENABLED || ETH_VLAN_SUPPORT == ENABLED || \
240 ETH_PORT_TAGGING_SUPPORT == ENABLED)
244#if (IPV4_SUPPORT == ENABLED)
246#if (ETH_SUPPORT == ENABLED)
250#if (IGMP_HOST_SUPPORT == ENABLED)
253#if (IGMP_ROUTER_SUPPORT == ENABLED)
256#if (IGMP_SNOOPING_SUPPORT == ENABLED)
259#if (AUTO_IP_SUPPORT == ENABLED)
262#if (DHCP_CLIENT_SUPPORT == ENABLED)
265#if (DHCP_SERVER_SUPPORT == ENABLED)
270#if (IPV6_SUPPORT == ENABLED)
272#if (NDP_SUPPORT == ENABLED)
275#if (NDP_ROUTER_ADV_SUPPORT == ENABLED)
278#if (SLAAC_SUPPORT == ENABLED)
281#if (DHCPV6_CLIENT_SUPPORT == ENABLED)
286#if (MDNS_RESPONDER_SUPPORT == ENABLED)
290#if (DNS_SD_SUPPORT == ENABLED)
291 DnsSdContext *dnsSdContext;
294#if (PPP_SUPPORT == ENABLED)
310#if (OS_STATIC_TASK_SUPPORT == ENABLED)
312 OsStackType taskStack[NET_TASK_STACK_SIZE];
316 uint8_t randSeed[NET_RAND_SEED_SIZE];
318 NetInterface interfaces[NET_INTERFACE_COUNT];
321#if (IPV4_IPSEC_SUPPORT == ENABLED)
334error_t netSeedRand(
const uint8_t *seed,
size_t length);
335uint32_t netGetRand(
void);
336uint32_t netGetRandRange(uint32_t min, uint32_t max);
337void netGetRandData(uint8_t *data,
size_t length);
339NetInterface *netGetDefaultInterface(
void);
341error_t netSetMacAddr(NetInterface *interface,
const MacAddr *macAddr);
342error_t netGetMacAddr(NetInterface *interface, MacAddr *macAddr);
344error_t netSetEui64(NetInterface *interface,
const Eui64 *eui64);
345error_t netGetEui64(NetInterface *interface, Eui64 *eui64);
347error_t netSetInterfaceId(NetInterface *interface, uint32_t
id);
348error_t netSetInterfaceName(NetInterface *interface,
const char_t *name);
349error_t netSetHostname(NetInterface *interface,
const char_t *name);
351error_t netSetVlanId(NetInterface *interface, uint16_t vlanId);
352error_t netSetVmanId(NetInterface *interface, uint16_t vmanId);
354error_t netSetParentInterface(NetInterface *interface,
355 NetInterface *physicalInterface);
360error_t netSetPhyAddr(NetInterface *interface, uint8_t phyAddr);
363error_t netSetSwitchPort(NetInterface *interface, uint8_t port);
371bool_t netGetLinkState(NetInterface *interface);
373uint_t netGetLinkSpeed(NetInterface *interface);
376error_t netEnablePromiscuousMode(NetInterface *interface, bool_t enable);
378error_t netConfigInterface(NetInterface *interface);
379error_t netStartInterface(NetInterface *interface);
380error_t netStopInterface(NetInterface *interface);
ARP (Address Resolution Protocol)
Auto-IP (Dynamic Configuration of IPv4 Link-Local Addresses)
DHCP client (Dynamic Host Configuration Protocol)
DHCP server (Dynamic Host Configuration Protocol)
DHCPv6 client (Dynamic Host Configuration Protocol for IPv6)
DNS client (Domain Name System)
DNS-SD (DNS-Based Service Discovery)
error_t
Error codes.
Definition error.h:43
void(* LlcRxCallback)(NetInterface *interface, EthHeader *header, const uint8_t *data, size_t length, NetRxAncillary *ancillary, void *param)
LLC frame received callback.
Definition ethernet.h:270
IPv4 (Internet Protocol Version 4)
IPv4 fragmentation and reassembly.
IPv6 (Internet Protocol Version 6)
Definitions common to mDNS client and mDNS responder.
mDNS responder (Multicast DNS)
NDP (Neighbor Discovery Protocol)
Router advertisement service.
CycloneTCP configuration file.
Helper functions for TCP/IP stack.
Network interface controller abstraction layer.
NicLinkState
Link state.
Definition nic.h:97
NicDuplexMode
Duplex mode.
Definition nic.h:122
uint_t OsMutex
Mutex object.
Definition os_port_none.h:118
uint_t OsEvent
Event object.
Definition os_port_none.h:104
uint_t OsTaskId
Task identifier.
Definition os_port_none.h:97
uint32_t systime_t
System time.
Definition os_port_none.h:90
PPP (Point-to-Point Protocol)
IPv6 Stateless Address Autoconfiguration.
ARP cache entry.
Definition arp.h:185
External interrupt line driver.
Definition nic.h:394
IGMP host context.
Definition igmp_host.h:68
IGMP snooping switch context.
Definition igmp_snooping.h:109
IPv4 context.
Definition ipv4.h:367
IPv6 context.
Definition ipv6.h:458
MAC filter table entry.
Definition ethernet.h:258
NDP context.
Definition ndp.h:576
TCP/IP stack context.
Definition net.h:305
bool_t running
The TCP/IP stack is currently running.
Definition net.h:308
NetRandState randState
Pseudo-random number generator state.
Definition net.h:317
OsTaskTcb taskTcb
Task control block.
Definition net.h:311
OsEvent event
Event object to receive notifications from drivers.
Definition net.h:307
void * ipsecContext
IPsec context.
Definition net.h:322
OsTaskId taskId
Task identifier.
Definition net.h:309
OsMutex mutex
Mutex preventing simultaneous access to the TCP/IP stack.
Definition net.h:306
void * ikeContext
IKE context.
Definition net.h:323
Link change callback entry.
Definition net_misc.h:73
Pseudo-random number generator state.
Definition net_misc.h:183
Timer callback entry.
Definition net_misc.h:92
NIC driver.
Definition nic.h:283
Ethernet PHY driver.
Definition nic.h:308
SMI driver.
Definition nic.h:354
SPI driver.
Definition nic.h:366
Ethernet switch driver.
Definition nic.h:322
UART driver.
Definition nic.h:381
Structure describing a network interface.
Definition net.h:195
void * llcRxParam
Callback parameter.
Definition net.h:234
LlcRxCallback llcRxCallback
LLC frame received callback (802.2)
Definition net.h:233
uint8_t nicContext[NIC_CONTEXT_SIZE]
Driver specific context.
Definition net.h:205
uint8_t port
Switch port identifier.
Definition net.h:237
systime_t initialRto
TCP initial retransmission timeout.
Definition net.h:213
SlaacContext * slaacContext
SLAAC context.
Definition net.h:279
PppContext * pppContext
DNS-SD context.
Definition net.h:295
MacAddr macAddr
Link-layer address.
Definition net.h:221
Eui64 eui64
EUI-64 interface identifier.
Definition net.h:198
bool_t linkState
Link state.
Definition net.h:209
bool_t enableArp
Enable address resolution using ARP.
Definition net.h:247
bool_t phyEvent
A PHY event is pending.
Definition net.h:218
bool_t nicEvent
A NIC event is pending.
Definition net.h:207
bool_t promiscuous
Promiscuous mode.
Definition net.h:223
MdnsResponderContext * mdnsResponderContext
mDNS responder context
Definition net.h:287
IgmpRouterContext * igmpRouterContext
IGMP router context.
Definition net.h:254
const SpiDriver * spiDriver
Underlying SPI driver.
Definition net.h:202
AutoIpContext * autoIpContext
Auto-IP context.
Definition net.h:260
ArpCacheEntry arpCache[ARP_CACHE_SIZE]
ARP cache.
Definition net.h:248
DhcpClientContext * dhcpClientContext
DHCP client context.
Definition net.h:263
NdpContext ndpContext
NDP context.
Definition net.h:273
IgmpHostContext igmpHostContext
IGMP host context.
Definition net.h:251
uint32_t linkSpeed
Link speed.
Definition net.h:210
const UartDriver * uartDriver
Underlying UART driver.
Definition net.h:203
const ExtIntDriver * extIntDriver
External interrupt line driver.
Definition net.h:204
NicDuplexMode duplexMode
Duplex mode.
Definition net.h:211
bool_t acceptAllMulticast
Accept all frames with a multicast destination address.
Definition net.h:224
uint_t index
Zero-based index.
Definition net.h:196
const PhyDriver * phyDriver
Ethernet PHY driver.
Definition net.h:216
OsEvent nicTxEvent
Network controller TX event.
Definition net.h:206
uint16_t vlanId
VLAN identifier (802.1Q)
Definition net.h:227
const SwitchDriver * switchDriver
Ethernet switch driver.
Definition net.h:219
bool_t configured
Configuration done.
Definition net.h:212
char_t name[NET_MAX_IF_NAME_LEN+1]
A unique name identifying the interface.
Definition net.h:199
const NicDriver * nicDriver
NIC driver.
Definition net.h:201
uint16_t vmanId
VMAN identifier (802.1ad)
Definition net.h:230
Ipv4Context ipv4Context
IPv4 context.
Definition net.h:245
NetInterface * parent
Interface on top of which the virtual interface runs.
Definition net.h:241
NicLinkState adminLinkState
Administrative link state.
Definition net.h:208
Dhcpv6ClientContext * dhcpv6ClientContext
DHCPv6 client context.
Definition net.h:282
IgmpSnoopingContext * igmpSnoopingContext
IGMP snooping switch context.
Definition net.h:257
Ipv6Context ipv6Context
IPv6 context.
Definition net.h:271
const SmiDriver * smiDriver
SMI driver.
Definition net.h:220
NdpRouterAdvContext * ndpRouterAdvContext
RA service context.
Definition net.h:276
uint8_t phyAddr
PHY address.
Definition net.h:217
uint32_t id
A unique number identifying the interface.
Definition net.h:197
DhcpServerContext * dhcpServerContext
DHCP server context.
Definition net.h:266
char_t hostname[NET_MAX_HOSTNAME_LEN+1]
Host name.
Definition net.h:200
MacFilterEntry macAddrFilter[MAC_ADDR_FILTER_SIZE]
MAC filter table.
Definition net.h:222