Webserver+3d print
cyclone_tcp/core/net.h@0:8918a71cdbe9, 2017-02-04 (annotated)
- Committer:
- Sergunb
- Date:
- Sat Feb 04 18:15:49 2017 +0000
- Revision:
- 0:8918a71cdbe9
nothing else
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sergunb | 0:8918a71cdbe9 | 1 | /** |
Sergunb | 0:8918a71cdbe9 | 2 | * @file net.h |
Sergunb | 0:8918a71cdbe9 | 3 | * @brief TCP/IP stack core |
Sergunb | 0:8918a71cdbe9 | 4 | * |
Sergunb | 0:8918a71cdbe9 | 5 | * @section License |
Sergunb | 0:8918a71cdbe9 | 6 | * |
Sergunb | 0:8918a71cdbe9 | 7 | * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. |
Sergunb | 0:8918a71cdbe9 | 8 | * |
Sergunb | 0:8918a71cdbe9 | 9 | * This file is part of CycloneTCP Open. |
Sergunb | 0:8918a71cdbe9 | 10 | * |
Sergunb | 0:8918a71cdbe9 | 11 | * This program is free software; you can redistribute it and/or |
Sergunb | 0:8918a71cdbe9 | 12 | * modify it under the terms of the GNU General Public License |
Sergunb | 0:8918a71cdbe9 | 13 | * as published by the Free Software Foundation; either version 2 |
Sergunb | 0:8918a71cdbe9 | 14 | * of the License, or (at your option) any later version. |
Sergunb | 0:8918a71cdbe9 | 15 | * |
Sergunb | 0:8918a71cdbe9 | 16 | * This program is distributed in the hope that it will be useful, |
Sergunb | 0:8918a71cdbe9 | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Sergunb | 0:8918a71cdbe9 | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Sergunb | 0:8918a71cdbe9 | 19 | * GNU General Public License for more details. |
Sergunb | 0:8918a71cdbe9 | 20 | * |
Sergunb | 0:8918a71cdbe9 | 21 | * You should have received a copy of the GNU General Public License |
Sergunb | 0:8918a71cdbe9 | 22 | * along with this program; if not, write to the Free Software Foundation, |
Sergunb | 0:8918a71cdbe9 | 23 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
Sergunb | 0:8918a71cdbe9 | 24 | * |
Sergunb | 0:8918a71cdbe9 | 25 | * @author Oryx Embedded SARL (www.oryx-embedded.com) |
Sergunb | 0:8918a71cdbe9 | 26 | * @version 1.7.6 |
Sergunb | 0:8918a71cdbe9 | 27 | **/ |
Sergunb | 0:8918a71cdbe9 | 28 | |
Sergunb | 0:8918a71cdbe9 | 29 | #ifndef _NET_H |
Sergunb | 0:8918a71cdbe9 | 30 | #define _NET_H |
Sergunb | 0:8918a71cdbe9 | 31 | |
Sergunb | 0:8918a71cdbe9 | 32 | //Forward declaration of NetInterface structure |
Sergunb | 0:8918a71cdbe9 | 33 | struct _NetInterface; |
Sergunb | 0:8918a71cdbe9 | 34 | #define NetInterface struct _NetInterface |
Sergunb | 0:8918a71cdbe9 | 35 | |
Sergunb | 0:8918a71cdbe9 | 36 | //Dependencies |
Sergunb | 0:8918a71cdbe9 | 37 | #include "os_port.h" |
Sergunb | 0:8918a71cdbe9 | 38 | #include "net_config.h" |
Sergunb | 0:8918a71cdbe9 | 39 | #include "core/net_legacy.h" |
Sergunb | 0:8918a71cdbe9 | 40 | #include "core/net_mem.h" |
Sergunb | 0:8918a71cdbe9 | 41 | #include "core/nic.h" |
Sergunb | 0:8918a71cdbe9 | 42 | #include "core/ethernet.h" |
Sergunb | 0:8918a71cdbe9 | 43 | #include "ipv4/ipv4.h" |
Sergunb | 0:8918a71cdbe9 | 44 | #include "ipv4/ipv4_frag.h" |
Sergunb | 0:8918a71cdbe9 | 45 | #include "ipv4/auto_ip.h" |
Sergunb | 0:8918a71cdbe9 | 46 | #include "ipv6/ipv6.h" |
Sergunb | 0:8918a71cdbe9 | 47 | #include "ipv4/arp.h" |
Sergunb | 0:8918a71cdbe9 | 48 | #include "ipv6/ndp.h" |
Sergunb | 0:8918a71cdbe9 | 49 | #include "ipv6/ndp_router_adv.h" |
Sergunb | 0:8918a71cdbe9 | 50 | #include "ipv6/slaac.h" |
Sergunb | 0:8918a71cdbe9 | 51 | #include "ppp/ppp.h" |
Sergunb | 0:8918a71cdbe9 | 52 | #include "dhcp/dhcp_client.h" |
Sergunb | 0:8918a71cdbe9 | 53 | #include "dhcp/dhcp_server.h" |
Sergunb | 0:8918a71cdbe9 | 54 | #include "dhcpv6/dhcpv6_client.h" |
Sergunb | 0:8918a71cdbe9 | 55 | #include "dns/dns_client.h" |
Sergunb | 0:8918a71cdbe9 | 56 | #include "mdns/mdns_responder.h" |
Sergunb | 0:8918a71cdbe9 | 57 | #include "mdns/mdns_common.h" |
Sergunb | 0:8918a71cdbe9 | 58 | #include "dns_sd/dns_sd.h" |
Sergunb | 0:8918a71cdbe9 | 59 | #include "mibs/mib2_module.h" |
Sergunb | 0:8918a71cdbe9 | 60 | #include "cpu_endian.h" |
Sergunb | 0:8918a71cdbe9 | 61 | #include "error.h" |
Sergunb | 0:8918a71cdbe9 | 62 | |
Sergunb | 0:8918a71cdbe9 | 63 | //Version string |
Sergunb | 0:8918a71cdbe9 | 64 | #define NET_VERSION_STRING "1.7.6" |
Sergunb | 0:8918a71cdbe9 | 65 | //Major version |
Sergunb | 0:8918a71cdbe9 | 66 | #define NET_MAJOR_VERSION 1 |
Sergunb | 0:8918a71cdbe9 | 67 | //Minor version |
Sergunb | 0:8918a71cdbe9 | 68 | #define NET_MINOR_VERSION 7 |
Sergunb | 0:8918a71cdbe9 | 69 | //Revision number |
Sergunb | 0:8918a71cdbe9 | 70 | #define NET_REV_NUMBER 6 |
Sergunb | 0:8918a71cdbe9 | 71 | |
Sergunb | 0:8918a71cdbe9 | 72 | //RTOS support |
Sergunb | 0:8918a71cdbe9 | 73 | #ifndef NET_RTOS_SUPPORT |
Sergunb | 0:8918a71cdbe9 | 74 | #define NET_RTOS_SUPPORT ENABLED |
Sergunb | 0:8918a71cdbe9 | 75 | #elif (NET_RTOS_SUPPORT != ENABLED && NET_RTOS_SUPPORT != DISABLED) |
Sergunb | 0:8918a71cdbe9 | 76 | #error NET_RTOS_SUPPORT parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 77 | #endif |
Sergunb | 0:8918a71cdbe9 | 78 | |
Sergunb | 0:8918a71cdbe9 | 79 | //Number of network adapters |
Sergunb | 0:8918a71cdbe9 | 80 | #ifndef NET_INTERFACE_COUNT |
Sergunb | 0:8918a71cdbe9 | 81 | #define NET_INTERFACE_COUNT 1 |
Sergunb | 0:8918a71cdbe9 | 82 | #elif (NET_INTERFACE_COUNT < 1) |
Sergunb | 0:8918a71cdbe9 | 83 | #error NET_INTERFACE_COUNT parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 84 | #endif |
Sergunb | 0:8918a71cdbe9 | 85 | |
Sergunb | 0:8918a71cdbe9 | 86 | //Maximum number of callback functions that can be registered |
Sergunb | 0:8918a71cdbe9 | 87 | //to monitor link changes |
Sergunb | 0:8918a71cdbe9 | 88 | #ifndef NET_CALLBACK_TABLE_SIZE |
Sergunb | 0:8918a71cdbe9 | 89 | #define NET_CALLBACK_TABLE_SIZE 6 |
Sergunb | 0:8918a71cdbe9 | 90 | #elif (NET_CALLBACK_TABLE_SIZE < 1) |
Sergunb | 0:8918a71cdbe9 | 91 | #error NET_CALLBACK_TABLE_SIZE parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 92 | #endif |
Sergunb | 0:8918a71cdbe9 | 93 | |
Sergunb | 0:8918a71cdbe9 | 94 | //Maximum length of interface name |
Sergunb | 0:8918a71cdbe9 | 95 | #ifndef NET_MAX_IF_NAME_LEN |
Sergunb | 0:8918a71cdbe9 | 96 | #define NET_MAX_IF_NAME_LEN 8 |
Sergunb | 0:8918a71cdbe9 | 97 | #elif (NET_MAX_IF_NAME_LEN < 1) |
Sergunb | 0:8918a71cdbe9 | 98 | #error NET_MAX_IF_NAME_LEN parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 99 | #endif |
Sergunb | 0:8918a71cdbe9 | 100 | |
Sergunb | 0:8918a71cdbe9 | 101 | //Maximum length of host name |
Sergunb | 0:8918a71cdbe9 | 102 | #ifndef NET_MAX_HOSTNAME_LEN |
Sergunb | 0:8918a71cdbe9 | 103 | #define NET_MAX_HOSTNAME_LEN 16 |
Sergunb | 0:8918a71cdbe9 | 104 | #elif (NET_MAX_HOSTNAME_LEN < 1) |
Sergunb | 0:8918a71cdbe9 | 105 | #error NET_MAX_HOSTNAME_LEN parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 106 | #endif |
Sergunb | 0:8918a71cdbe9 | 107 | |
Sergunb | 0:8918a71cdbe9 | 108 | //Maximum length of proxy server name |
Sergunb | 0:8918a71cdbe9 | 109 | #ifndef NET_MAX_PROXY_NAME_LEN |
Sergunb | 0:8918a71cdbe9 | 110 | #define NET_MAX_PROXY_NAME_LEN 16 |
Sergunb | 0:8918a71cdbe9 | 111 | #elif (NET_MAX_PROXY_NAME_LEN < 1) |
Sergunb | 0:8918a71cdbe9 | 112 | #error NET_MAX_PROXY_NAME_LEN parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 113 | #endif |
Sergunb | 0:8918a71cdbe9 | 114 | |
Sergunb | 0:8918a71cdbe9 | 115 | //OS resources are statically allocated at compile time |
Sergunb | 0:8918a71cdbe9 | 116 | #ifndef NET_STATIC_OS_RESOURCES |
Sergunb | 0:8918a71cdbe9 | 117 | #define NET_STATIC_OS_RESOURCES DISABLED |
Sergunb | 0:8918a71cdbe9 | 118 | #elif (NET_STATIC_OS_RESOURCES != ENABLED && NET_STATIC_OS_RESOURCES != DISABLED) |
Sergunb | 0:8918a71cdbe9 | 119 | #error NET_STATIC_OS_RESOURCES parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 120 | #endif |
Sergunb | 0:8918a71cdbe9 | 121 | |
Sergunb | 0:8918a71cdbe9 | 122 | //Stack size required to run the TCP/IP task |
Sergunb | 0:8918a71cdbe9 | 123 | #ifndef NET_TASK_STACK_SIZE |
Sergunb | 0:8918a71cdbe9 | 124 | #define NET_TASK_STACK_SIZE 650 |
Sergunb | 0:8918a71cdbe9 | 125 | #elif (NET_TASK_STACK_SIZE < 1) |
Sergunb | 0:8918a71cdbe9 | 126 | #error NET_TASK_STACK_SIZE parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 127 | #endif |
Sergunb | 0:8918a71cdbe9 | 128 | |
Sergunb | 0:8918a71cdbe9 | 129 | //Priority at which the TCP/IP task should run |
Sergunb | 0:8918a71cdbe9 | 130 | #ifndef NET_TASK_PRIORITY |
Sergunb | 0:8918a71cdbe9 | 131 | #define NET_TASK_PRIORITY OS_TASK_PRIORITY_HIGH |
Sergunb | 0:8918a71cdbe9 | 132 | #endif |
Sergunb | 0:8918a71cdbe9 | 133 | |
Sergunb | 0:8918a71cdbe9 | 134 | //TCP/IP stack tick interval |
Sergunb | 0:8918a71cdbe9 | 135 | #ifndef NET_TICK_INTERVAL |
Sergunb | 0:8918a71cdbe9 | 136 | #define NET_TICK_INTERVAL 100 |
Sergunb | 0:8918a71cdbe9 | 137 | #elif (NET_TICK_INTERVAL < 10) |
Sergunb | 0:8918a71cdbe9 | 138 | #error NET_TICK_INTERVAL parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 139 | #endif |
Sergunb | 0:8918a71cdbe9 | 140 | |
Sergunb | 0:8918a71cdbe9 | 141 | |
Sergunb | 0:8918a71cdbe9 | 142 | /** |
Sergunb | 0:8918a71cdbe9 | 143 | * @brief Structure describing a network interface |
Sergunb | 0:8918a71cdbe9 | 144 | **/ |
Sergunb | 0:8918a71cdbe9 | 145 | |
Sergunb | 0:8918a71cdbe9 | 146 | struct _NetInterface |
Sergunb | 0:8918a71cdbe9 | 147 | { |
Sergunb | 0:8918a71cdbe9 | 148 | uint32_t id; ///<A unique number identifying the interface |
Sergunb | 0:8918a71cdbe9 | 149 | Eui64 eui64; ///<EUI-64 interface identifier |
Sergunb | 0:8918a71cdbe9 | 150 | char_t name[NET_MAX_IF_NAME_LEN + 1]; ///<A unique name identifying the interface |
Sergunb | 0:8918a71cdbe9 | 151 | char_t hostname[NET_MAX_HOSTNAME_LEN + 1]; ///<Host name |
Sergunb | 0:8918a71cdbe9 | 152 | char_t proxyName[NET_MAX_PROXY_NAME_LEN + 1]; ///<Proxy server name |
Sergunb | 0:8918a71cdbe9 | 153 | uint16_t proxyPort; ///<Proxy server port |
Sergunb | 0:8918a71cdbe9 | 154 | const NicDriver *nicDriver; ///<NIC driver |
Sergunb | 0:8918a71cdbe9 | 155 | const PhyDriver *phyDriver; ///<PHY driver |
Sergunb | 0:8918a71cdbe9 | 156 | uint8_t phyAddr; ///<PHY address |
Sergunb | 0:8918a71cdbe9 | 157 | const SpiDriver *spiDriver; ///<Underlying SPI driver |
Sergunb | 0:8918a71cdbe9 | 158 | const UartDriver *uartDriver; ///<Underlying UART driver |
Sergunb | 0:8918a71cdbe9 | 159 | const ExtIntDriver *extIntDriver; ///<External interrupt line driver |
Sergunb | 0:8918a71cdbe9 | 160 | uint8_t nicContext[NIC_CONTEXT_SIZE]; ///<Driver specific context |
Sergunb | 0:8918a71cdbe9 | 161 | OsEvent nicTxEvent; ///<Network controller TX event |
Sergunb | 0:8918a71cdbe9 | 162 | bool_t nicEvent; ///<A NIC event is pending |
Sergunb | 0:8918a71cdbe9 | 163 | bool_t phyEvent; ///<A PHY event is pending |
Sergunb | 0:8918a71cdbe9 | 164 | bool_t linkState; ///<Link state |
Sergunb | 0:8918a71cdbe9 | 165 | uint32_t linkSpeed; ///<Link speed |
Sergunb | 0:8918a71cdbe9 | 166 | NicDuplexMode duplexMode; ///<Duplex mode |
Sergunb | 0:8918a71cdbe9 | 167 | bool_t configured; ///<Configuration done |
Sergunb | 0:8918a71cdbe9 | 168 | |
Sergunb | 0:8918a71cdbe9 | 169 | #if (ETH_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 170 | MacAddr macAddr; ///<Link-layer address |
Sergunb | 0:8918a71cdbe9 | 171 | MacFilterEntry macMulticastFilter[MAC_MULTICAST_FILTER_SIZE]; ///<Multicast MAC filter |
Sergunb | 0:8918a71cdbe9 | 172 | #endif |
Sergunb | 0:8918a71cdbe9 | 173 | |
Sergunb | 0:8918a71cdbe9 | 174 | #if (IPV4_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 175 | Ipv4Context ipv4Context; ///<IPv4 context |
Sergunb | 0:8918a71cdbe9 | 176 | ArpCacheEntry arpCache[ARP_CACHE_SIZE]; ///<ARP cache |
Sergunb | 0:8918a71cdbe9 | 177 | #if (IGMP_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 178 | systime_t igmpv1RouterPresentTimer; ///<IGMPv1 router present timer |
Sergunb | 0:8918a71cdbe9 | 179 | bool_t igmpv1RouterPresent; ///<An IGMPv1 query has been recently heard |
Sergunb | 0:8918a71cdbe9 | 180 | #endif |
Sergunb | 0:8918a71cdbe9 | 181 | #if (AUTO_IP_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 182 | AutoIpContext *autoIpContext; ///<Auto-IP context |
Sergunb | 0:8918a71cdbe9 | 183 | #endif |
Sergunb | 0:8918a71cdbe9 | 184 | #if (DHCP_CLIENT_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 185 | DhcpClientContext *dhcpClientContext; ///<DHCP client context |
Sergunb | 0:8918a71cdbe9 | 186 | #endif |
Sergunb | 0:8918a71cdbe9 | 187 | #if (DHCP_SERVER_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 188 | DhcpServerContext *dhcpServerContext; ///<DHCP server context |
Sergunb | 0:8918a71cdbe9 | 189 | #endif |
Sergunb | 0:8918a71cdbe9 | 190 | #endif |
Sergunb | 0:8918a71cdbe9 | 191 | |
Sergunb | 0:8918a71cdbe9 | 192 | #if (IPV6_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 193 | Ipv6Context ipv6Context; ///<IPv6 context |
Sergunb | 0:8918a71cdbe9 | 194 | #if (NDP_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 195 | NdpContext ndpContext; ///<NDP context |
Sergunb | 0:8918a71cdbe9 | 196 | #endif |
Sergunb | 0:8918a71cdbe9 | 197 | #if (NDP_ROUTER_ADV_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 198 | NdpRouterAdvContext *ndpRouterAdvContext; ///<RA service context |
Sergunb | 0:8918a71cdbe9 | 199 | #endif |
Sergunb | 0:8918a71cdbe9 | 200 | #if (SLAAC_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 201 | SlaacContext *slaacContext; ///<SLAAC context |
Sergunb | 0:8918a71cdbe9 | 202 | #endif |
Sergunb | 0:8918a71cdbe9 | 203 | #if (DHCPV6_CLIENT_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 204 | Dhcpv6ClientContext *dhcpv6ClientContext; ///<DHCPv6 client context |
Sergunb | 0:8918a71cdbe9 | 205 | #endif |
Sergunb | 0:8918a71cdbe9 | 206 | #endif |
Sergunb | 0:8918a71cdbe9 | 207 | |
Sergunb | 0:8918a71cdbe9 | 208 | #if (MDNS_RESPONDER_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 209 | MdnsResponderContext *mdnsResponderContext; ///<mDNS responder context |
Sergunb | 0:8918a71cdbe9 | 210 | #endif |
Sergunb | 0:8918a71cdbe9 | 211 | |
Sergunb | 0:8918a71cdbe9 | 212 | #if (DNS_SD_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 213 | DnsSdContext *dnsSdContext; ///DNS-SD context |
Sergunb | 0:8918a71cdbe9 | 214 | #endif |
Sergunb | 0:8918a71cdbe9 | 215 | |
Sergunb | 0:8918a71cdbe9 | 216 | #if (PPP_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 217 | PppContext *pppContext; ///<PPP context |
Sergunb | 0:8918a71cdbe9 | 218 | #endif |
Sergunb | 0:8918a71cdbe9 | 219 | |
Sergunb | 0:8918a71cdbe9 | 220 | #if (MIB2_SUPPORT == ENABLED) |
Sergunb | 0:8918a71cdbe9 | 221 | Mib2IfEntry *mibIfEntry; |
Sergunb | 0:8918a71cdbe9 | 222 | #endif |
Sergunb | 0:8918a71cdbe9 | 223 | }; |
Sergunb | 0:8918a71cdbe9 | 224 | |
Sergunb | 0:8918a71cdbe9 | 225 | |
Sergunb | 0:8918a71cdbe9 | 226 | /** |
Sergunb | 0:8918a71cdbe9 | 227 | * @brief Link change callback |
Sergunb | 0:8918a71cdbe9 | 228 | **/ |
Sergunb | 0:8918a71cdbe9 | 229 | |
Sergunb | 0:8918a71cdbe9 | 230 | typedef void (*LinkChangeCallback)(NetInterface *interface, bool_t linkState, void *params); |
Sergunb | 0:8918a71cdbe9 | 231 | |
Sergunb | 0:8918a71cdbe9 | 232 | |
Sergunb | 0:8918a71cdbe9 | 233 | /** |
Sergunb | 0:8918a71cdbe9 | 234 | * @brief Entry describing a user callback |
Sergunb | 0:8918a71cdbe9 | 235 | **/ |
Sergunb | 0:8918a71cdbe9 | 236 | |
Sergunb | 0:8918a71cdbe9 | 237 | typedef struct |
Sergunb | 0:8918a71cdbe9 | 238 | { |
Sergunb | 0:8918a71cdbe9 | 239 | NetInterface *interface; |
Sergunb | 0:8918a71cdbe9 | 240 | LinkChangeCallback callback; |
Sergunb | 0:8918a71cdbe9 | 241 | void *params; |
Sergunb | 0:8918a71cdbe9 | 242 | } LinkChangeCallbackDesc; |
Sergunb | 0:8918a71cdbe9 | 243 | |
Sergunb | 0:8918a71cdbe9 | 244 | |
Sergunb | 0:8918a71cdbe9 | 245 | //Global variables |
Sergunb | 0:8918a71cdbe9 | 246 | extern OsTask *netTaskHandle; |
Sergunb | 0:8918a71cdbe9 | 247 | extern OsMutex netMutex; |
Sergunb | 0:8918a71cdbe9 | 248 | extern OsEvent netEvent; |
Sergunb | 0:8918a71cdbe9 | 249 | extern NetInterface netInterface[NET_INTERFACE_COUNT]; |
Sergunb | 0:8918a71cdbe9 | 250 | |
Sergunb | 0:8918a71cdbe9 | 251 | //TCP/IP stack related functions |
Sergunb | 0:8918a71cdbe9 | 252 | error_t netInit(void); |
Sergunb | 0:8918a71cdbe9 | 253 | |
Sergunb | 0:8918a71cdbe9 | 254 | error_t netSetMacAddr(NetInterface *interface, const MacAddr *macAddr); |
Sergunb | 0:8918a71cdbe9 | 255 | error_t netGetMacAddr(NetInterface *interface, MacAddr *macAddr); |
Sergunb | 0:8918a71cdbe9 | 256 | |
Sergunb | 0:8918a71cdbe9 | 257 | error_t netSetEui64(NetInterface *interface, const Eui64 *eui64); |
Sergunb | 0:8918a71cdbe9 | 258 | error_t netGetEui64(NetInterface *interface, Eui64 *eui64); |
Sergunb | 0:8918a71cdbe9 | 259 | |
Sergunb | 0:8918a71cdbe9 | 260 | error_t netSetInterfaceId(NetInterface *interface, uint32_t id); |
Sergunb | 0:8918a71cdbe9 | 261 | error_t netSetInterfaceName(NetInterface *interface, const char_t *name); |
Sergunb | 0:8918a71cdbe9 | 262 | error_t netSetHostname(NetInterface *interface, const char_t *name); |
Sergunb | 0:8918a71cdbe9 | 263 | error_t netSetProxy(NetInterface *interface, const char_t *name, uint16_t port); |
Sergunb | 0:8918a71cdbe9 | 264 | |
Sergunb | 0:8918a71cdbe9 | 265 | error_t netSetDriver(NetInterface *interface, const NicDriver *driver); |
Sergunb | 0:8918a71cdbe9 | 266 | |
Sergunb | 0:8918a71cdbe9 | 267 | error_t netSetPhyDriver(NetInterface *interface, const PhyDriver *driver); |
Sergunb | 0:8918a71cdbe9 | 268 | error_t netSetPhyAddr(NetInterface *interface, uint8_t phyAddr); |
Sergunb | 0:8918a71cdbe9 | 269 | |
Sergunb | 0:8918a71cdbe9 | 270 | error_t netSetSpiDriver(NetInterface *interface, const SpiDriver *driver); |
Sergunb | 0:8918a71cdbe9 | 271 | error_t netSetUartDriver(NetInterface *interface, const UartDriver *driver); |
Sergunb | 0:8918a71cdbe9 | 272 | error_t netSetExtIntDriver(NetInterface *interface, const ExtIntDriver *driver); |
Sergunb | 0:8918a71cdbe9 | 273 | |
Sergunb | 0:8918a71cdbe9 | 274 | error_t netSetLinkState(NetInterface *interface, NicLinkState linkState); |
Sergunb | 0:8918a71cdbe9 | 275 | bool_t netGetLinkState(NetInterface *interface); |
Sergunb | 0:8918a71cdbe9 | 276 | |
Sergunb | 0:8918a71cdbe9 | 277 | error_t netConfigInterface(NetInterface *interface); |
Sergunb | 0:8918a71cdbe9 | 278 | |
Sergunb | 0:8918a71cdbe9 | 279 | void netTask(void); |
Sergunb | 0:8918a71cdbe9 | 280 | void netTick(void); |
Sergunb | 0:8918a71cdbe9 | 281 | |
Sergunb | 0:8918a71cdbe9 | 282 | NetInterface *netGetDefaultInterface(void); |
Sergunb | 0:8918a71cdbe9 | 283 | |
Sergunb | 0:8918a71cdbe9 | 284 | error_t netInitRand(uint32_t seed); |
Sergunb | 0:8918a71cdbe9 | 285 | uint32_t netGetRand(void); |
Sergunb | 0:8918a71cdbe9 | 286 | int32_t netGetRandRange(int32_t min, int32_t max); |
Sergunb | 0:8918a71cdbe9 | 287 | |
Sergunb | 0:8918a71cdbe9 | 288 | error_t netAttachLinkChangeCallback(NetInterface *interface, |
Sergunb | 0:8918a71cdbe9 | 289 | LinkChangeCallback callback, void *params, uint_t *cookie); |
Sergunb | 0:8918a71cdbe9 | 290 | |
Sergunb | 0:8918a71cdbe9 | 291 | error_t netDetachLinkChangeCallback(uint_t cookie); |
Sergunb | 0:8918a71cdbe9 | 292 | |
Sergunb | 0:8918a71cdbe9 | 293 | void netInvokeLinkChangeCallback(NetInterface *interface, bool_t linkState); |
Sergunb | 0:8918a71cdbe9 | 294 | |
Sergunb | 0:8918a71cdbe9 | 295 | #endif |
Sergunb | 0:8918a71cdbe9 | 296 |