Network Component  Version 7.15.0
MDK Middleware for IPv4 and IPv6 Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rl_net_ds.h
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------
2  * MDK Middleware - Component ::Network
3  * Copyright (c) 2004-2021 Arm Limited (or its affiliates). All rights reserved.
4  *------------------------------------------------------------------------------
5  * Name: rl_net_ds.h
6  * Purpose: Network API (Dual-stack IPv4/IPv6)
7  * Rev.: V7.15.0
8  *----------------------------------------------------------------------------*/
9 
10 #ifndef __RL_NET_DS_H
11 #define __RL_NET_DS_H
12 
13 #include <stdint.h>
14 #include <stdbool.h>
15 #include <stddef.h>
16 #include "RTE_Components.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #ifdef __clang__
23  #define __weak __attribute__((weak))
24 #endif
25 
26 /// Network to host byte order conversion.
27 #if defined(__BIG_ENDIAN) || defined(__ARM_BIG_ENDIAN)
28  #define ntohl(v) (uint32_t)(v)
29  #define ntohs(v) (uint16_t)(v)
30 #elif defined (__CC_ARM)
31  /* ARM Compiler 4/5 */
32  #define ntohl(v) (uint32_t)(__rev(v))
33  #define ntohs(v) (uint16_t)(__rev(v) >> 16)
34 #else
35  /* ARM Compiler 6 */
36  #define ntohl(v) __builtin_bswap32((uint32_t)(v))
37  #define ntohs(v) __builtin_bswap16((uint16_t)(v))
38 #endif
39 
40 /// Host to network byte order conversion.
41 #define htons(v) ntohs(v)
42 #define htonl(v) ntohl(v)
43 
44 /// General definitions.
45 #define NET_ADDR_ETH_LEN 6 ///< Ethernet MAC Address Length in bytes
46 #define NET_ADDR_IP4_LEN 4 ///< IPv4 Address Length in bytes
47 #define NET_ADDR_IP6_LEN 16 ///< IPv6 Address Length in bytes
48 #define NET_HOSTNAME_LEN 16 ///< Hostname Buffer Length in bytes
49 #define NET_ROOT_DIR_LEN 80 ///< Service Root Folder Length in bytes
50 
51 /// Network Address types.
52 #define NET_ADDR_ANY (-1) ///< IP address any
53 #define NET_ADDR_IP4 0 ///< IPv4 Address
54 #define NET_ADDR_IP6 1 ///< IPv6 Address
55 
56 /// Network Address IPv4/IPv6 capable.
57 typedef struct net_addr {
58  int16_t addr_type; ///< IP address type: \ref NET_ADDR_IP4 or \ref NET_ADDR_IP6
59  uint16_t port; ///< Internet socket port number
60  uint8_t addr[NET_ADDR_IP6_LEN]; ///< IPv4 or IPv6 address (array 16 bytes, MSB first)
61 } NET_ADDR;
62 
63 /// Network Address IPv4 only.
64 typedef struct net_addr4 {
65  int16_t addr_type; ///< IP address type: \ref NET_ADDR_IP4
66  uint16_t port; ///< Internet socket port number
67  uint8_t addr[NET_ADDR_IP4_LEN]; ///< IPv4 address (array 4 bytes, MSB first)
68 } NET_ADDR4;
69 
70 /// Service Authentication definitions.
71 #define NET_USERNAME_LEN 16 ///< Username Buffer Length in bytes
72 #define NET_PASSWORD_LEN 16 ///< Password Buffer Length in bytes
73 
74 /// Network Access definitions.
75 #define NET_ACCESS_FILE_READ 0x01 ///< File Read is allowed
76 #define NET_ACCESS_FILE_WRITE 0x02 ///< File Write is allowed
77 #define NET_ACCESS_DIRECTORY_CREATE 0x04 ///< Directory Create is allowed
78 #define NET_ACCESS_DIRECTORY_REMOVE 0x08 ///< Directory Remove is allowed
79 #define NET_ACCESS_DIRECTORY_LIST 0x10 ///< Directory List is allowed
80 
81 /// Status code values returned by Network library functions.
82 typedef enum {
83  netOK = 0, ///< Operation succeeded
84  netBusy, ///< Process is busy
85  netError, ///< Unspecified error
86  netInvalidParameter, ///< Invalid parameter specified
87  netWrongState, ///< Wrong state error
88  netDriverError, ///< Driver error
89  netServerError, ///< Server error
90  netAuthenticationFailed, ///< User authentication failed
91  netDnsResolverError, ///< DNS host resolver failed
92  netFileError, ///< File not found or file r/w error
93  netTimeout ///< Operation timeout
94 } netStatus;
95 
96 /// UDP Checksum Options.
97 #define NET_UDP_CHECKSUM_SEND 0x01 ///< Calculate Checksum for UDP send frames (default)
98 #define NET_UDP_CHECKSUM_VERIFY 0x02 ///< Verify Checksum for received UDP frames (default)
99 
100 /// UDP Socket Options.
101 typedef enum {
102  netUDP_OptionTOS = 0, ///< IPv4 Type of Service; val=TOS
103  netUDP_OptionTTL, ///< IPv4 Multi-cast Time to Live; val=TTL
104  netUDP_OptionTrafficClass, ///< IPv6 Traffic Class; val=TrafficClass
105  netUDP_OptionHopLimit, ///< IPv6 Multi-cast Hop Limit; val=HopLimit
106  netUDP_OptionInterface, ///< IPv4 Broadcast Interface; val=if_id (class and number)
107  netUDP_OptionChecksum ///< UDP Checksum Options
108 } netUDP_Option;
109 
110 /// UDP Event callback function.
111 typedef uint32_t (*netUDP_cb_t)(int32_t socket, const NET_ADDR *addr, const uint8_t *buf, uint32_t len);
112 
113 /// TCP Socket Events.
114 typedef enum {
115  netTCP_EventConnect = 0, ///< Connect request received event
116  netTCP_EventEstablished, ///< Connection established event
117  netTCP_EventClosed, ///< Connection was properly closed
118  netTCP_EventAborted, ///< Connection is for some reason aborted
119  netTCP_EventACK, ///< Previously send data acknowledged
120  netTCP_EventData ///< Data received event
121 } netTCP_Event;
122 
123 /// TCP Socket States.
124 typedef enum {
125  netTCP_StateINVALID =-1, ///< Invalid Socket
126  netTCP_StateUNUSED = 0, ///< Entry is free and unused
127  netTCP_StateCLOSED, ///< Entry allocated, socket still closed
128  netTCP_StateLISTEN, ///< Socket waiting for incoming connection
129  netTCP_StateSYN_RECEIVED, ///< SYN frame received
130  netTCP_StateSYN_SENT, ///< SYN packet sent to establish a connection
131  netTCP_StateFIN_WAIT_1, ///< Close started FIN packet was sent
132  netTCP_StateFIN_WAIT_2, ///< Our FIN ACK-ed, waiting for remote FIN
133  netTCP_StateCLOSING, ///< Received FIN independently of our FIN
134  netTCP_StateLAST_ACK, ///< Waiting for last ACK for our FIN
135  netTCP_StateTIME_WAIT, ///< Timed waiting for 2MSL
136  netTCP_StateESTABLISHED ///< TCP Connection established
137 } netTCP_State;
138 
139 /// TCP Socket Options.
140 typedef enum {
141  netTCP_OptionTOS = 0, ///< IPv4 Type of Service; val=TOS
142  netTCP_OptionTrafficClass, ///< IPv6 Traffic Class; val=TrafficClass
143  netTCP_OptionTimeout, ///< TCP Idle Timeout; val=timeout (in seconds)
144  netTCP_OptionKeepAlive, ///< TCP Keep Alive; val: 0=disabled (default), 1=enabled
145  netTCP_OptionFlowControl, ///< TCP Flow Control; val: 0=disabled (default), 1=enabled
146  netTCP_OptionDelayedACK ///< TCP Delayed Acknowledgment; val: 0=disabled (default), 1=enabled
147 } netTCP_Option;
148 
149 /// TCP Event callback function.
150 typedef uint32_t (*netTCP_cb_t)(int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len);
151 
152 #ifdef RTE_Network_Socket_BSD
153 
154 // ==== BSD Socket definitions ====
155 
156 /// BSD Socket Address Family.
157 #define AF_UNSPEC 0 ///< Unspecified
158 #define AF_INET 1 ///< Internet Address Family
159 #define AF_NETBIOS 2 ///< NetBios-style addresses
160 #define AF_INET6 3 ///< Internet Address Family version 6
161 
162 /// BSD Protocol families (same as address families).
163 #define PF_UNSPEC 0 ///< Unspecified
164 #define PF_INET 1 ///< Internet Address Family
165 #define PF_NETBIOS 2 ///< NetBios-style addresses
166 #define PF_INET6 3 ///< Internet Address Family version 6
167 
168 /// BSD Socket Type.
169 #define SOCK_STREAM 1 ///< Stream Socket (Connection oriented)
170 #define SOCK_DGRAM 2 ///< Datagram Socket (Connectionless)
171 
172 /// BSD Socket Protocol.
173 #define IPPROTO_TCP 1 ///< TCP Protocol
174 #define IPPROTO_UDP 2 ///< UDP Protocol
175 
176 /// BSD Internet Addresses IPv4.
177 #define INADDR_ANY 0x00000000 ///< All IP addresses accepted
178 #define INADDR_NONE 0xffffffff ///< No IP address accepted
179 #define INADDR_LOOPBACK 0x7f000001 ///< Localhost IP address
180 
181 /// BSD Socket flags parameter.
182 #define MSG_DONTWAIT 0x01 ///< Enables non-blocking operation
183 #define MSG_PEEK 0x02 ///< Peeks at the incoming data
184 #define MSG_TRUNC 0x04 ///< Normal data was truncated
185 #define MSG_CTRUNC 0x08 ///< Control data was truncated
186 
187 /// BSD Socket ioctl commands.
188 #define FIONBIO 1 ///< Set mode (blocking/non-blocking)
189 
190 /// BSD Socket level.
191 #define SOL_SOCKET 1 ///< Socket Level
192 #define IPPROTO_IP 2 ///< IPv4 Level
193 #define IPPROTO_IPV6 3 ///< IPv6 Level
194 
195 /// BSD Socket options.
196 #define SO_KEEPALIVE 1 ///< Keep Alive
197 #define SO_RCVTIMEO 2 ///< Timeout for blocking receive (in milliseconds)
198 #define SO_SNDTIMEO 3 ///< Timeout for blocking send (in milliseconds)
199 #define SO_TYPE 4 ///< Socket type (read only)
200 
201 /// BSD Socket IPv4 options.
202 #define IP_TOS 1 ///< Type of Service (TOS)
203 #define IP_TTL 2 ///< Time to Live (TTL)
204 #define IP_RECVDSTADDR 3 ///< Receive destination IPv4 address
205 
206 /// BSD Socket IPv6 options.
207 #define IPV6_TCLASS 1 ///< Traffic Class
208 #define IPV6_MULTICAST_HOPS 2 ///< Multi-cast Hop Limit
209 #define IPV6_RECVDSTADDR 3 ///< Receive destination IPv6 address
210 
211 /// BSD Socket Error codes.
212 #define BSD_ERROR (-1) ///< Unspecified error
213 #define BSD_ESOCK (-2) ///< Invalid socket descriptor
214 #define BSD_EINVAL (-3) ///< Invalid parameter
215 #define BSD_ENOTSUP (-11) ///< Operation or feature not supported
216 #define BSD_ENOMEM (-5) ///< Not enough memory
217 #define BSD_ELOCKED (-7) ///< Socket locked by another thread
218 #define BSD_EWOULDBLOCK (-4) ///< Operation would block
219 #define BSD_ETIMEDOUT (-8) ///< Operation timed out
220 #define BSD_EINPROGRESS (-9) ///< Operation in progress
221 #define BSD_ENOTCONN (-6) ///< Socket not connected
222 #define BSD_EISCONN (-12) ///< Socket is connected
223 #define BSD_ECONNREFUSED (-13) ///< Connection rejected by the peer
224 #define BSD_ECONNRESET (-14) ///< Connection reset by the peer
225 #define BSD_ECONNABORTED (-15) ///< Connection aborted locally
226 #define BSD_EALREADY (-16) ///< Connection already in progress
227 #define BSD_EADDRINUSE (-17) ///< Address already in use
228 #define BSD_EDESTADDRREQ (-18) ///< Destination address required
229 #define BSD_EHOSTNOTFOUND (-10) ///< Host not found
230 
231 /// BSD Socket legacy Error codes.
232 #define BSD_SUCCESS 0 ///< Success
233 #define BSD_ERROR_SOCKET BSD_ESOCK
234 #define BSD_ERROR_PARAMETER BSD_EINVAL
235 #define BSD_ERROR_WOULDBLOCK BSD_EWOULDBLOCK
236 #define BSD_ERROR_NOMEMORY BSD_ENOMEM
237 #define BSD_ERROR_CLOSED BSD_ENOTCONN
238 #define BSD_ERROR_LOCKED BSD_ELOCKED
239 #define BSD_ERROR_TIMEOUT BSD_ETIMEDOUT
240 #define BSD_ERROR_INPROGRESS BSD_EINPROGRESS
241 #define BSD_ERROR_NONAME BSD_EHOSTNOTFOUND
242 
243 // ==== BSD Socket structures ====
244 
245 /// Generic Socket Address structure.
246 typedef struct sockaddr {
247  uint16_t sa_family; ///< Address family
248  int8_t sa_data[14]; ///< Direct address (up to 14 bytes)
249 } SOCKADDR;
250 
251 #if defined(__CC_ARM)
252  #pragma push
253  #pragma anon_unions
254 #elif defined(__clang__)
255  #pragma clang diagnostic push
256  #pragma clang diagnostic ignored "-Wc11-extensions"
257 #endif
258 
259 /// Generic IPv4 Address structure.
260 typedef struct in_addr {
261  union {
262  struct {
263  uint8_t s_b1,s_b2,s_b3,s_b4; ///< IP address, byte access
264  };
265  struct {
266  uint16_t s_w1,s_w2; ///< IP address, short int access
267  };
268  uint32_t s_addr; ///< IP address in network byte order
269  };
270 } IN_ADDR;
271 
272 /// Generic IPv6 Address structure.
273 typedef struct in6_addr {
274  union {
275  uint8_t s6_b[16]; ///< IP6 address, byte access
276  uint16_t s6_w[8]; ///< IP6 address, short int access
277  };
278 } IN6_ADDR;
279 #define s6_addr s6_b
280 
281 #if defined(__CC_ARM)
282  #pragma pop
283 #elif defined(__clang__)
284  #pragma clang diagnostic pop
285 #endif
286 
287 /// IPv4 Socket Address structure.
288 typedef struct sockaddr_in {
289  int16_t sin_family; ///< Socket domain
290  uint16_t sin_port; ///< Port
291  IN_ADDR sin_addr; ///< IP address
292  int8_t sin_zero[8]; ///< reserved
293 } SOCKADDR_IN;
294 
295 /// IPv6 Socket Address structure.
296 typedef struct sockaddr_in6 {
297  int16_t sin6_family; ///< Socket domain
298  uint16_t sin6_port; ///< Port
299  uint32_t sin6_flowinfo; ///< IP6 flow information
300  IN6_ADDR sin6_addr; ///< IP6 address
301 } SOCKADDR_IN6;
302 
303 /// Socket Address storage structure.
304 typedef struct sockaddr_storage {
305  int16_t ss_family; ///< Address family
306  int8_t __ss_pad1[2]; ///< reserved
307  int32_t __ss_align; ///< reserved, structure alignment
308  int8_t __ss_pad2[16]; ///< reserved
310 
311 /// BSD Host Entry structure.
312 typedef struct hostent {
313  char *h_name; ///< Official name of host
314  char **h_aliases; ///< Pointer to an array of alias names
315  int16_t h_addrtype; ///< Address Type: AF_INET, AF_NETBIOS
316  int16_t h_length; ///< Length of address in bytes
317  char **h_addr_list; ///< Pointer to an array of IPv4 addresses
318 } HOSTENT;
319 
320 /// BSD address string length.
321 #define INET_ADDRSTRLEN 16 ///< IP address string length
322 #define INET6_ADDRSTRLEN 46 ///< IP6 address string length
323 
324 /// BSD fd_set size.
325 #define FD_SETSIZE 64 ///< Maximum number of sockets in fd_set structure
326 
327 /// BSD fd_set structure.
328 typedef struct fd_set {
329  uint32_t fd_bits[(FD_SETSIZE+31)>>5]; ///< Set of sockets bit-mask
330 } fd_set;
331 
332 /// BSD timeval structure.
333 typedef struct timeval {
334  uint32_t tv_sec; ///< Time interval: seconds
335  uint32_t tv_usec; ///< Time interval: microseconds
336 } timeval;
337 
338 /// BSD safe read/write fd_set macros.
339 #define FD_WR(fd,code) if ((fd > 0) && (fd <= FD_SETSIZE)) { code; }
340 #define FD_RD(fd,code) (((fd > 0) && (fd <= FD_SETSIZE)) ? (code) : 0)
341 
342 /// BSD initialize and test fd_set macros.
343 #define FD_SET(fd,set) FD_WR(fd, (set)->fd_bits[(fd-1)>>5] |= (1U << ((fd-1)&0x1F)))
344 #define FD_CLR(fd,set) FD_WR(fd, (set)->fd_bits[(fd-1)>>5] &= ~(1U << ((fd-1)&0x1F)))
345 #define FD_ISSET(fd,set) FD_RD(fd, (set)->fd_bits[(fd-1)>>5] & (1U << ((fd-1)&0x1F)))
346 #define FD_ZERO(set) memset(set, 0, sizeof(*set))
347 
348 /// BSD scatter/gather array of items.
349 typedef struct iovec {
350  void *iov_base; ///< Starting address
351  uint32_t iov_len; ///< Number of bytes to transfer
352 } IOVEC;
353 
354 /// BSD message header structure.
355 typedef struct msghdr {
356  void *msg_name; ///< Optional pointer to source address
357  uint32_t msg_namelen; ///< Size of address buffer
358  IOVEC *msg_iov; ///< An array of iovec buffers for the message
359  int32_t msg_iovlen; ///< Number of elements in msg_iov
360  void *msg_control; ///< Ancillary data
361  uint32_t msg_controllen; ///< Ancillary data buffer length
362  int32_t msg_flags; ///< Flags on received message
363 } MSGHDR;
364 
365 /// BSD cmsg header structure.
366 typedef struct cmsghdr {
367  uint32_t cmsg_len; ///< Data byte count, including the cmsghdr
368  int32_t cmsg_level; ///< Originating protocol
369  int32_t cmsg_type; ///< Protocol-specific type
370 } CMSGHDR;
371 
372 /// BSD access ancillary data macros (RFC 2292).
373 #define CMSG_FIRSTHDR(mhdr) ((mhdr)->msg_controllen >= sizeof(CMSGHDR)) ? \
374  (CMSGHDR *)(mhdr)->msg_control : \
375  (CMSGHDR *)NULL
376 #define CMSG_NXTHDR(mhdr,cmsg) (CMSG_ALIGN((uint32_t)(cmsg) + (cmsg)->cmsg_len) + sizeof(CMSGHDR) > \
377  (uint32_t)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
378  (CMSGHDR *)NULL : \
379  (CMSGHDR *)CMSG_ALIGN((uint32_t)(cmsg) + (cmsg)->cmsg_len)
380 #define CMSG_DATA(cmsg) ((uint8_t *)(cmsg) + sizeof(CMSGHDR))
381 #define CMSG_ALIGN(len) (((len) + 3) & ~3U)
382 #define CMSG_LEN(len) ((len) + sizeof(CMSGHDR))
383 #define CMSG_SPACE(len) CMSG_ALIGN((len) + sizeof(CMSGHDR))
384 
385 #endif /* RTE_Network_Socket_BSD */
386 
387 /// Interface Class
388 #define NET_IF_CLASS_ETH (1U << 8) ///< Ethernet interface
389 #define NET_IF_CLASS_WIFI (2U << 8) ///< WiFi interface
390 #define NET_IF_CLASS_PPP (3U << 8) ///< PPP interface
391 #define NET_IF_CLASS_SLIP (4U << 8) ///< SLIP interface
392 
393 /// Interface Option codes.
394 typedef enum {
395  netIF_OptionMAC_Address, ///< Ethernet MAC Address (6 bytes)
396  netIF_OptionVLAN_Identifier, ///< Ethernet VLAN Identifier (2 bytes)
397  netIF_OptionIP4_MTU, ///< IPv4 Maximum Transmission Unit (2 bytes)
398  netIF_OptionIP4_Address, ///< IPv4 Address (4 bytes)
399  netIF_OptionIP4_SubnetMask, ///< IPv4 Subnet mask (4 bytes)
400  netIF_OptionIP4_DefaultGateway, ///< IPv4 Default Gateway (4 bytes)
401  netIF_OptionIP4_PrimaryDNS, ///< IPv4 Primary DNS (4 bytes)
402  netIF_OptionIP4_SecondaryDNS, ///< IPv4 Secondary DNS (4 bytes)
403  netIF_OptionIP6_MTU, ///< IPv6 Maximum Transmission Unit (2 bytes)
404  netIF_OptionIP6_LinkLocalAddress, ///< IPv6 Link-local Address (16 bytes)
405  netIF_OptionIP6_StaticAddress, ///< IPv6 Static Address (16 bytes)
406  netIF_OptionIP6_DynamicAddress, ///< IPv6 Dynamic Address (16 bytes)
407  netIF_OptionIP6_SubnetPrefixLength, ///< IPv6 Subnet Prefix-length (1 byte)
408  netIF_OptionIP6_DefaultGateway, ///< IPv6 Default Gateway (16 bytes)
409  netIF_OptionIP6_PrimaryDNS, ///< IPv6 Primary DNS (16 bytes)
410  netIF_OptionIP6_SecondaryDNS ///< IPv6 Secondary DNS (16 bytes)
411 } netIF_Option;
412 
413 /// Interface IP Versions.
414 typedef enum {
415  netIF_VersionIP4, ///< IP version 4
416  netIF_VersionIP6 ///< IP version 6
417 } netIF_Version;
418 
419 /// Ethernet link speed.
420 #define NET_ETH_SPEED_10M 0 ///< 10 Mbps link speed
421 #define NET_ETH_SPEED_100M 1 ///< 100 Mbps link speed
422 #define NET_ETH_SPEED_1G 2 ///< 1 Gpbs link speed
423 
424 /// Ethernet duplex mode.
425 #define NET_ETH_DUPLEX_HALF 0 ///< Half duplex link
426 #define NET_ETH_DUPLEX_FULL 1 ///< Full duplex link
427 
428 /// Ethernet link information.
429 typedef struct net_eth_link_info {
430  uint32_t speed : 2; ///< Link speed: 0= 10 MBit, 1= 100 MBit, 2= 1 GBit
431  uint32_t duplex : 1; ///< Duplex mode: 0= Half, 1= Full
433 
434 /// Ethernet Callback Events.
435 typedef enum {
436  netETH_LinkDown = 0, ///< Link down
437  netETH_LinkUp, ///< Link up; val=link_info
438  netETH_Wakeup, ///< Wake-up (on Magic Packet)
439  netETH_TimerAlarm ///< Timer Alarm (PTP)
440 } netETH_Event;
441 
442 /// WiFi Security Types.
443 typedef enum {
444  netWiFi_SecurityOpen = 0, ///< Open
445  netWiFi_SecurityWEP, ///< Wired Equivalent Privacy
446  netWiFi_SecurityWPA, ///< WiFi Protected Access
447  netWiFi_SecurityWPA2, ///< WiFi Protected Access 2
448  netWiFi_SecurityUnknown = 255 ///< Unknown security
450 
451 /// WiFi Driver Options.
452 typedef enum {
453  netWiFi_OptionBSSID = 1, ///< BSSID of AP
454  netWiFi_OptionTxPower, ///< Transmit Power
455  netWiFi_OptionLpTimer, ///< Low Power deep-sleep timer
456  netWiFi_OptionDTIM, ///< DTIM interval
457  netWiFi_OptionBeacon ///< Beacon interval
459 
460 /// WiFi WPS Methods.
461 typedef enum {
462  netWiFi_WPS_None = 0, ///< Not used
463  netWiFi_WPS_PBC, ///< With Push Button Configuration
464  netWiFi_WPS_PIN ///< With PIN
465 } netWiFi_WPS;
466 
467 /// WiFi Configuration.
468 typedef struct net_wifi_config {
469  const char *ssid; ///< Network name, a null-terminated string
470  const char *password; ///< Password, a null-terminated string
471  netWiFi_Security security; ///< Security type
472  uint8_t channel; ///< WiFi Channel (0=auto)
473  uint8_t reserved; ///< Reserved
474  netWiFi_WPS wps_method; ///< WiFi Protected Setup method
475  const char *wps_pin; ///< WPS PIN, a null-terminated string
477 
478 /// WiFi Network information.
479 typedef struct net_wifi_net_info {
480  char ssid[32+1]; ///< Network name, a null-terminated string
481  char password[64+1]; ///< Password, a null-terminated string
482  netWiFi_Security security; ///< Security type
483  uint8_t channel; ///< WiFi Channel
484  uint8_t rssi; ///< Received Signal Strength Indicator
486 
487 /// WiFi Scan information.
488 typedef struct net_wifi_scan_info {
489  char ssid[32+1]; ///< Service Set Identifier (null-terminated)
490  uint8_t bssid[6]; ///< Basic Service Set Identifier
491  netWiFi_Security security; ///< Security type
492  uint8_t channel; ///< WiFi Channel
493  uint8_t rssi; ///< Received Signal Strength Indicator
495 
496 /// ARP Cache Entry types.
497 typedef enum {
498  netARP_CacheFixedIP, ///< Fixed IP address is refreshed after timeout
499  netARP_CacheTemporaryIP ///< Temporary IP address is removed after timeout
501 
502 /// DHCP Option Codes.
503 #define NET_DHCP_OPTION_IP_ADDRESS 0 ///< IP address change event
504 #define NET_DHCP_OPTION_NTP_SERVERS 42 ///< NTP Servers option
505 #define NET_DHCP_OPTION_CLIENT_ID 61 ///< Client-identifier option
506 #define NET_DHCP_OPTION_BOOTFILE_NAME 67 ///< Bootfile name option
507 
508 /// DHCPv6 Option Codes.
509 #define NET_DHCP6_OPTION_IP_ADDRESS 0 ///< IPv6 address change event
510 
511 /// DHCP Option Item.
512 typedef struct net_dhcp_option_item {
513  uint8_t code; ///< Option type code
514  uint8_t length; ///< Length of Option value
515  uint8_t *value; ///< Pointer to Option value
517 
518 /// DHCP Private Options.
519 extern NET_DHCP_OPTION_ITEM netDHCP_PrivateOptionsTableN[]; ///< DHCP Private Options Table
520 extern uint8_t netDHCP_PrivateOptionsCountN; ///< Number of DHCP Private Options
521 
522 /// DHCPv6 Modes.
523 typedef enum {
524  netDHCP6_ModeStateless = 0, ///< Stateless DHCPv6 mode
525  netDHCP6_ModeStateful ///< Stateful DHCPv6 mode
526 } netDHCP6_Mode;
527 
528 /// Ping Callback Events.
529 typedef enum {
530  netPing_EventSuccess = 0, ///< Pinged Host responded
531  netPing_EventTimeout ///< Timeout, no ping response received
532 } netPing_Event;
533 
534 /// Ping Control Flags.
535 #define NET_PING_IP4_ONLY 0x01 ///< Force using IPv4 only
536 #define NET_PING_IP6_ONLY 0x02 ///< Force using IPv6 only
537 
538 /// ARP Probe Callback Events.
539 typedef enum {
540  netARP_EventSuccess = 0, ///< Probed Host responded
541  netARP_EventTimeout ///< Timeout, no response to ARP probe
542 } netARP_Event;
543 
544 /// NDP Probe Callback Events.
545 typedef enum {
546  netNDP_EventSuccess = 0, ///< Probed Host responded
547  netNDP_EventTimeout ///< Timeout, no response to NDP probe
548 } netNDP_Event;
549 
550 /// DNS Client Callback Events.
551 typedef enum {
552  netDNSc_EventSuccess = 0, ///< Host name successfully resolved
553  netDNSc_EventTimeout, ///< Timeout resolving host
554  netDNSc_EventNotResolved, ///< DNS Error, no such name
555  netDNSc_EventError ///< Erroneous response packet
556 } netDNSc_Event;
557 
558 /// FTP Commands.
559 typedef enum {
560  netFTP_CommandPUT, ///< Puts a file on FTP server
561  netFTP_CommandGET, ///< Retrieves a file from FTP server
562  netFTP_CommandAPPEND, ///< Append file on FTP server (with create)
563  netFTP_CommandDELETE, ///< Deletes a file on FTP server
564  netFTP_CommandLIST, ///< Lists files stored on FTP server
565  netFTP_CommandRENAME, ///< Renames a file on FTP server
566  netFTP_CommandMKDIR, ///< Makes a directory on FTP server
567  netFTP_CommandRMDIR, ///< Removes an empty directory on FTP server
568  netFTP_CommandNLIST ///< Lists file names only (short format)
570 
571 /// FTP Server Events.
572 typedef enum {
573  netFTPs_EventLogin, ///< User logged in, session is busy
574  netFTPs_EventLogout, ///< User logged out, session is idle
575  netFTPs_EventLoginFailed, ///< User login failed (invalid credentials)
576  netFTPs_EventDownload, ///< File download ended
577  netFTPs_EventUpload, ///< File upload ended
578  netFTPs_EventDelete, ///< File deleted
579  netFTPs_EventRename, ///< File or directory renamed
580  netFTPs_EventMakeDirectory, ///< Directory created
581  netFTPs_EventRemoveDirectory, ///< Directory removed
582  netFTPs_EventOperationDenied, ///< Requested file operation denied
583  netFTPs_EventLocalFileError, ///< Local file operation error
584  netFTPs_EventFileError, ///< Generic file operation error
585  netFTPs_EventError ///< Generic FTP server error
586 } netFTPs_Event;
587 
588 /// FTP Client Requests.
589 typedef enum {
590  netFTPc_RequestUsername, ///< Username to login to FTP server
591  netFTPc_RequestPassword, ///< Password to login to FTP server
592  netFTPc_RequestDirectory, ///< Working directory path on server for all commands
593  netFTPc_RequestName, ///< File or Directory name for FTP commands
594  netFTPc_RequestNewName, ///< New File or Directory name for RENAME command
595  netFTPc_RequestListMask, ///< File filter/mask for LIST command (wildcards allowed)
596  netFTPc_RequestList, ///< Received data if LIST command is given
597  netFTPc_RequestLocalFilename ///< Local filename (including path)
599 
600 /// FTP Client Events.
601 typedef enum {
602  netFTPc_EventSuccess = 0, ///< File operation successful
603  netFTPc_EventTimeout, ///< Timeout on file operation
604  netFTPc_EventLoginFailed, ///< Login error, username/password invalid
605  netFTPc_EventAccessDenied, ///< File access not allowed
606  netFTPc_EventFileNotFound, ///< File not found
607  netFTPc_EventInvalidDirectory, ///< Working directory path not found
608  netFTPc_EventLocalFileError, ///< Local file read/write error
609  netFTPc_EventError ///< Generic FTP client error
610 } netFTPc_Event;
611 
612 /// TFTP Client Events.
613 typedef enum {
614  netTFTPc_EventSuccess = 0, ///< File operation successful
615  netTFTPc_EventTimeout, ///< Timeout on file operation
616  netTFTPc_EventAccessDenied, ///< File access not allowed
617  netTFTPc_EventFileNotFound, ///< File not found
618  netTFTPc_EventDiskFull, ///< Disk full
619  netTFTPc_EventLocalFileError, ///< Local file read/write error
620  netTFTPc_EventError ///< Generic TFTP client error
621 } netTFTPc_Event;
622 
623 /// Telnet Server Messages.
624 typedef enum {
625  netTELNETs_MessageWelcome, ///< Initial welcome message
626  netTELNETs_MessageLogin, ///< Login message, if authentication is enabled
627  netTELNETs_MessageUsername, ///< Username request login message
628  netTELNETs_MessagePassword, ///< Password request login message
629  netTELNETs_MessageLoginFailed, ///< Incorrect login error message
630  netTELNETs_MessageLoginTimeout, ///< Login timeout error message
631  netTELNETs_MessagePrompt, ///< Prompt message
632  netTELNETs_MessageUnsolicited ///< Unsolicited message (triggered by netTELNETs_RequestMessage)
634 
635 /// SMTP Client Request.
636 typedef enum {
637  netSMTPc_RequestUsername, ///< Username to login to SMTP server
638  netSMTPc_RequestPassword, ///< Password to login to SMTP server
639  netSMTPc_RequestSender, ///< Email address of the sender
640  netSMTPc_RequestRecipient, ///< Email address of the recipient
641  netSMTPc_RequestSubject, ///< Subject of email
642  netSMTPc_RequestBody ///< Email body in plain ASCII format
644 
645 /// SMTP Client Events.
646 typedef enum {
647  netSMTPc_EventSuccess = 0, ///< Email successfully sent
648  netSMTPc_EventTimeout, ///< Timeout sending email
649  netSMTPc_EventAuthenticationFailed, ///< Authentication failed, username/password invalid
650  netSMTPc_EventError ///< Error when sending email
652 
653 /// SMTP Mail Transfer Agent Flags.
654 #define NET_SMTP_MTA_USETLS 0x01 ///< Use secure TLS mode (Implicit TLS)
655 
656 /// SMTP Email Descriptor.
657 typedef struct net_smtp_mail {
658  const char *From; ///< Sender address, can be NULL
659  const char *To; ///< Recipient(s), can be NULL
660  const char *Cc; ///< Carbon copy recipient(s), can be NULL
661  const char *Bcc; ///< Blind carbon copy recipient(s), can be NULL
662  const char *Subject; ///< Subject of email, can be NULL
663  const char *Message; ///< Email message body, can be NULL
664  const char *Attachment; ///< Email attachment(s), can be NULL
665  const char *Encoding; ///< Default encoding type, can be NULL
666 } NET_SMTP_MAIL;
667 
668 /// SMTP Mail Transfer Agent Descriptor.
669 typedef struct net_smtp_mta {
670  const char *Address; ///< Server address (FQDN or IP address)
671  uint16_t Port; ///< Server port number, can be 0
672  uint16_t Flags; ///< Service control flags
673  const char *Username; ///< Account user name, can be NULL
674  const char *Password; ///< Account password, can be NULL
675 } NET_SMTP_MTA;
676 
677 /// SNTP Client Mode.
678 typedef enum {
679  netSNTPc_ModeUnicast = 0, ///< Unicast mode to access public NTP server
680  netSNTPc_ModeBroadcast ///< Broadcast mode for local LAN
681 } netSNTPc_Mode;
682 
683 /// Ping Event callback function.
684 typedef void (*netPing_cb_t)(netPing_Event event);
685 
686 /// ARP Probe Event callback function.
687 typedef void (*netARP_cb_t)(netARP_Event event);
688 
689 /// NDP Probe Event callback function.
690 typedef void (*netNDP_cb_t)(netNDP_Event event);
691 
692 /// DNS Client Event callback function.
693 typedef void (*netDNSc_cb_t)(netDNSc_Event event, const NET_ADDR *addr);
694 
695 /// SNTP Client callback function.
696 typedef void (*netSNTPc_cb_t)(uint32_t seconds, uint32_t seconds_fraction);
697 
698 /// SNMP-MIB definitions.
699 #define NET_SNMP_MIB_INTEGER 0x02 ///< MIB entry type INTEGER
700 #define NET_SNMP_MIB_OCTET_STR 0x04 ///< MIB entry type OCTET_STRING
701 #define NET_SNMP_MIB_OBJECT_ID 0x06 ///< MIB entry type OBJECT_IDENTIFIER
702 #define NET_SNMP_MIB_IP_ADDR 0x40 ///< MIB entry type IP ADDRESS (uint8_t[4])
703 #define NET_SNMP_MIB_COUNTER 0x41 ///< MIB entry type COUNTER (uint32_t)
704 #define NET_SNMP_MIB_GAUGE 0x42 ///< MIB entry type GAUGE (uint32_t)
705 #define NET_SNMP_MIB_TIME_TICKS 0x43 ///< MIB entry type TIME_TICKS
706 #define NET_SNMP_MIB_ATR_RO 0x80 ///< MIB entry attribute READ_ONLY
707 #define NET_SNMP_MIB_OID_SIZE 17 ///< Max.size of Object ID value
708 #define NET_SNMP_MIB_STR_SIZE 110 ///< Max.size of Octet String variable
709 #define NET_SNMP_MIB_READ 0 ///< MIB entry Read access
710 #define NET_SNMP_MIB_WRITE 1 ///< MIB entry Write access
711 
712 /// SNMP-MIB macros.
713 #define NET_SNMP_MIB_STR(s) sizeof(s)-1, s
714 #define NET_SNMP_MIB_INT(o) sizeof(o), (void *)&o
715 #define NET_SNMP_MIB_IP(ip) 4, (void *)&ip
716 #define NET_SNMP_MIB_OID0(f,s) (f*40 + s)
717 
718 /// SNMP-MIB Entry information.
719 typedef struct net_snmp_mib_info {
720  uint8_t type; ///< Object Type
721  uint8_t oid_len; ///< Object ID length
722  uint8_t oid[NET_SNMP_MIB_OID_SIZE]; ///< Object ID value
723  uint8_t var_size; ///< Size of a variable
724  void *var; ///< Pointer to a variable
725  void (*cb_func)(int32_t mode); ///< Write/Read event callback function
726 } const NET_SNMP_MIB_INFO;
727 
728 /// FS Interface Time info
729 typedef struct net_fs_time {
730  uint8_t hr; ///< Hours [0..23]
731  uint8_t min; ///< Minutes [0..59]
732  uint8_t sec; ///< Seconds [0..59]
733  uint8_t day; ///< Day [1..31]
734  uint8_t mon; ///< Month [1..12]
735  uint16_t year; ///< Year [1980..2107]
736 } NET_FS_TIME;
737 
738 /// FS Interface Attributes
739 #define NET_FS_ATTR_FILE 1 ///< File entry
740 #define NET_FS_ATTR_DIRECTORY 2 ///< Directory entry
741 
742 
743 // ==== Network System API ====
744 
745 /// \brief Initialize Network Component and interfaces. [\ref not_thread-safe]
746 /// \return status code that indicates the execution status of the function.
747 extern netStatus netInitialize (void);
748 
749 /// \brief De-initialize Network Component and interfaces. [\ref not_thread-safe]
750 /// \return status code that indicates the execution status of the function.
751 extern netStatus netUninitialize (void);
752 
753 /// \brief Retrieve localhost name. [\ref thread-safe]
754 /// \return pointer to localhost name, a null-terminated string.
755 extern const char *netSYS_GetHostName (void);
756 
757 /// \brief Set localhost name. [\ref thread-safe]
758 /// \param[in] hostname new localhost name, a null-terminated string.
759 /// \return status code that indicates the execution status of the function.
760 extern netStatus netSYS_SetHostName (const char *hostname);
761 
762 // ==== UDP Socket API ====
763 
764 /// \brief Allocate a free UDP socket. [\ref thread-safe]
765 /// \param[in] cb_func event listening callback function.
766 /// \return socket handle number or execution status:
767 /// - value >= 0: socket handle number.
768 /// - value < 0: error occurred, -value is execution status as defined with \ref netStatus.
769 extern int32_t netUDP_GetSocket (netUDP_cb_t cb_func);
770 
771 /// \brief Release UDP socket and free resources. [\ref thread-safe]
772 /// \param[in] socket socket handle obtained with \ref netUDP_GetSocket.
773 /// \return status code that indicates the execution status of the function.
774 extern netStatus netUDP_ReleaseSocket (int32_t socket);
775 
776 /// \brief Open UDP socket for communication. [\ref thread-safe]
777 /// \param[in] socket socket handle obtained with \ref netUDP_GetSocket.
778 /// \param[in] port local port number.
779 /// - 0 = system assigned local port.
780 /// \return status code that indicates the execution status of the function.
781 extern netStatus netUDP_Open (int32_t socket, uint16_t port);
782 
783 /// \brief Stop UDP communication and close socket. [\ref thread-safe]
784 /// \param[in] socket socket handle obtained with \ref netUDP_GetSocket.
785 /// \return status code that indicates the execution status of the function.
786 extern netStatus netUDP_Close (int32_t socket);
787 
788 /// \brief Allocate memory for UDP send buffer. [\ref thread-safe]
789 /// \param[in] size number of bytes to allocate.
790 /// \return pointer to the allocated memory.
791 /// - NULL = out of memory.
792 extern uint8_t *netUDP_GetBuffer (uint32_t size);
793 
794 /// \brief Send data to a remote node. [\ref thread-safe]
795 /// \param[in] socket socket handle obtained with \ref netUDP_GetSocket.
796 /// \param[in] addr structure containing remote IP address and port.
797 /// \param[in] buf buffer containing the data.
798 /// \param[in] len length of data in bytes.
799 /// \return status code that indicates the execution status of the function.
800 extern netStatus netUDP_Send (int32_t socket, const NET_ADDR *addr, uint8_t *buf, uint32_t len);
801 
802 /// \brief Set UDP socket IP option. [\ref thread-safe]
803 /// \param[in] socket socket handle obtained with \ref netUDP_GetSocket.
804 /// \param[in] option option name as defined with \ref netUDP_Option.
805 /// \param[in] val option value.
806 /// \return status code that indicates the execution status of the function.
807 extern netStatus netUDP_SetOption (int32_t socket, netUDP_Option option, uint32_t val);
808 
809 /// \brief Retrieve local port number of UDP socket. [\ref thread-safe]
810 /// \param[in] socket socket handle obtained with \ref netUDP_GetSocket.
811 /// \return local port number.
812 /// - 0 = socket invalid or in invalid state.
813 extern uint16_t netUDP_GetLocalPort (int32_t socket);
814 
815 // ==== TCP Socket API ====
816 
817 /// \brief Allocate a free TCP socket. [\ref thread-safe]
818 /// \param[in] cb_func event listening callback function.
819 /// \return socket handle number or execution status:
820 /// - value >= 0: socket handle number.
821 /// - value < 0: error occurred, -value is execution status as defined with \ref netStatus.
822 extern int32_t netTCP_GetSocket (netTCP_cb_t cb_func);
823 
824 /// \brief Release TCP socket and free resources. [\ref thread-safe]
825 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
826 /// \return status code that indicates the execution status of the function.
827 extern netStatus netTCP_ReleaseSocket (int32_t socket);
828 
829 /// \brief Open TCP socket for incoming connection. [\ref thread-safe]
830 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
831 /// \param[in] port local port number.
832 /// \return status code that indicates the execution status of the function.
833 extern netStatus netTCP_Listen (int32_t socket, uint16_t port);
834 
835 /// \brief Initiate a TCP connection to a remote node. [\ref thread-safe]
836 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
837 /// \param[in] addr structure containing remote IP address and port.
838 /// \param[in] local_port local port number.
839 /// - 0 = system assigned local port.
840 /// \return status code that indicates the execution status of the function.
841 extern netStatus netTCP_Connect (int32_t socket, const NET_ADDR *addr, uint16_t local_port);
842 
843 /// \brief Stop TCP communication and start closing procedure. [\ref thread-safe]
844 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
845 /// \return status code that indicates the execution status of the function.
846 extern netStatus netTCP_Close (int32_t socket);
847 
848 /// \brief Instantly stop TCP communication. [\ref thread-safe]
849 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
850 /// \return status code that indicates the execution status of the function.
851 extern netStatus netTCP_Abort (int32_t socket);
852 
853 /// \brief Determine maximum number of data bytes that can be sent in TCP packet. [\ref thread-safe]
854 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
855 /// \return maximum segment size in bytes.
856 extern uint32_t netTCP_GetMaxSegmentSize (int32_t socket);
857 
858 /// \brief Allocate memory for TCP send buffer. [\ref thread-safe]
859 /// \param[in] size number of bytes to allocate.
860 /// \return pointer to the allocated memory.
861 /// - NULL = out of memory.
862 extern uint8_t *netTCP_GetBuffer (uint32_t size);
863 
864 /// \brief Check if TCP socket can send data. [\ref thread-safe]
865 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
866 /// \return send status:
867 /// - true = Ready to send data.
868 /// - false = Not ready.
869 extern bool netTCP_SendReady (int32_t socket);
870 
871 /// \brief Send a data packet to remote node. [\ref thread-safe]
872 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
873 /// \param[in] buf buffer containing the data.
874 /// \param[in] len length of data in bytes.
875 /// \return status code that indicates the execution status of the function.
876 extern netStatus netTCP_Send (int32_t socket, uint8_t *buf, uint32_t len);
877 
878 /// \brief Determine current state of a TCP socket. [\ref thread-safe]
879 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
880 /// \return state information as defined with \ref netTCP_State.
881 extern netTCP_State netTCP_GetState (int32_t socket);
882 
883 /// \brief Reset TCP window size to a default value from the configuration. [\ref thread-safe]
884 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
885 /// \return status code that indicates the execution status of the function.
886 extern netStatus netTCP_ResetReceiveWindow (int32_t socket);
887 
888 /// \brief Set TCP socket IP option. [\ref thread-safe]
889 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
890 /// \param[in] option option name as defined with \ref netTCP_Option.
891 /// \param[in] val option value.
892 /// \return status code that indicates the execution status of the function.
893 extern netStatus netTCP_SetOption (int32_t socket, netTCP_Option option, uint32_t val);
894 
895 /// \brief Retrieve local port number of TCP socket. [\ref thread-safe]
896 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
897 /// \return local port number.
898 /// - 0 = socket invalid or in invalid state.
899 extern uint16_t netTCP_GetLocalPort (int32_t socket);
900 
901 /// \brief Retrieve IP address and port number of remote peer. [\ref thread-safe]
902 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
903 /// \param[out] addr structure that will receive IP address and port number.
904 /// \param[in] addr_len size of NET_ADDR structure for remote peer.
905 /// \return status code that indicates the execution status of the function.
906 extern netStatus netTCP_GetPeer (int32_t socket, NET_ADDR *addr, uint32_t addr_len);
907 
908 /// \brief Determine TCP socket connection timeout. [\ref thread-safe]
909 /// \param[in] socket socket handle obtained with \ref netTCP_GetSocket.
910 /// \return connection timeout timer in seconds.
911 /// - 0 = socket invalid or in invalid state.
912 extern uint32_t netTCP_GetTimer (int32_t socket);
913 
914 // ==== BSD Socket API ====
915 
916 #ifdef RTE_Network_Socket_BSD
917 /// \brief Create a communication endpoint called socket. [\ref thread-safe]
918 /// \param[in] family address family:
919 /// - AF_INET = address family IPv4.
920 /// - AF_INET6 = address family IPv6.
921 /// \param[in] type connection type of a socket:
922 /// - SOCK_STREAM = connection based type.
923 /// - SOCK_DGRAM = datagram connectionless type.
924 /// \param[in] protocol protocol type:
925 /// - IPPROTO_TCP = must be used with SOCK_STREAM type.
926 /// - IPPROTO_UDP = must be used with SOCK_DGRAM TYPE.
927 /// - 0 = for system auto-select.
928 /// \return status information:
929 /// - Socket descriptor (>0).
930 /// - BSD_EINVAL = Invalid parameter.
931 /// - BSD_ENOMEM = No free sockets available.
932 extern int socket (int family, int type, int protocol);
933 
934 /// \brief Assign a local address and port to a socket. [\ref thread-safe]
935 /// \param[in] sock socket descriptor obtained with \ref socket.
936 /// \param[in] addr structure containing local IP address and port.
937 /// \param[in] addrlen length of \ref SOCKADDR structure.
938 /// \return status information:
939 /// - 0 = Operation successful.
940 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
941 /// - BSD_EINVAL = Invalid parameter or already bound.
942 /// - BSD_EADDRINUSE = Address or port already in use.
943 /// - BSD_EISCONN = Socket already connected.
944 extern int bind (int sock, const SOCKADDR *addr, int addrlen);
945 
946 /// \brief Set a socket in a listening mode. [\ref thread-safe]
947 /// \param[in] sock socket descriptor obtained with \ref socket.
948 /// \param[in] backlog number of connection requests that can be accepted.
949 /// \return status information:
950 /// - 0 = Operation successful.
951 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
952 /// - BSD_EINVAL = Invalid parameter, socket not bound or already listening.
953 /// - BSD_ENOTSUP = Operation not supported for this socket type.
954 /// - BSD_ERROR = Failed to create socket backlog.
955 extern int listen (int sock, int backlog);
956 
957 /// \brief Accept connect request for a listening socket. [\ref thread-safe]
958 /// \param[in] sock socket descriptor obtained with \ref socket.
959 /// \param[out] addr structure that will receive IP address and port number.
960 /// - NULL for none.
961 /// \param[in,out] addrlen length of \ref SOCKADDR structure.
962 /// \return status information:
963 /// - New socket descriptor (>0).
964 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
965 /// - BSD_EINVAL = Socket not in listen mode.
966 /// - BSD_ENOTSUP = Operation not supported for this socket type.
967 /// - BSD_ELOCKED = Socket locked by another thread.
968 /// - BSD_EWOULDBLOCK = Operation would block.
969 /// - BSD_ECONNRESET = Connection reset by the peer.
970 /// - BSD_ECONNABORTED = Connection aborted locally.
971 /// - BSD_ERROR = Unspecified error.
972 extern int accept (int sock, SOCKADDR *addr, int *addrlen);
973 
974 /// \brief Connect a socket to a remote host. [\ref thread-safe]
975 /// \param[in] sock socket descriptor obtained with \ref socket.
976 /// \param[in] addr structure containing remote IP address and port.
977 /// \param[in] addrlen length of \ref SOCKADDR structure.
978 /// \return status information:
979 /// - 0 = Operation successful.
980 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
981 /// - BSD_EINVAL = Invalid parameter or socket in wrong state.
982 /// - BSD_ELOCKED = Socket locked by another thread.
983 /// - BSD_EALREADY = Connection already in progress.
984 /// - BSD_EINPROGRESS = Operation in progress.
985 /// - BSD_EISCONN = Socket is connected.
986 /// - BSD_ECONNREFUSED = Connection rejected by the peer.
987 /// - BSD_ETIMEDOUT = Operation timed out.
988 /// - BSD_ECONNABORTED = Connection aborted locally.
989 /// - BSD_ERROR = Unspecified error.
990 extern int connect (int sock, const SOCKADDR *addr, int addrlen);
991 
992 /// \brief Send data on already connected socket. [\ref thread-safe]
993 /// \param[in] sock socket descriptor obtained with \ref socket.
994 /// \param[in] buf pointer to application data buffer to transmit.
995 /// \param[in] len length of data (in bytes).
996 /// \param[in] flags message flags:
997 /// - MSG_DONTWAIT = don't wait to send data.
998 /// - 0 = for none.
999 /// \return status information:
1000 /// - Number of bytes sent (>0).
1001 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1002 /// - BSD_EINVAL = Invalid parameter.
1003 /// - BSD_ELOCKED = Socket locked by another thread.
1004 /// - BSD_ENOTCONN = Socket not connected.
1005 /// - BSD_ECONNRESET = Connection reset by the peer.
1006 /// - BSD_EWOULDBLOCK = Operation would block.
1007 /// - BSD_ETIMEDOUT = Operation timed out.
1008 /// - BSD_EDESTADDRREQ = Destination address required.
1009 /// - BSD_ECONNABORTED = Connection aborted locally.
1010 /// - BSD_ENOMEM = Not enough memory.
1011 /// - BSD_ERROR = Unspecified error.
1012 extern int send (int sock, const char *buf, int len, int flags);
1013 
1014 /// \brief Send data to endpoint node. [\ref thread-safe]
1015 /// \param[in] sock socket descriptor obtained with \ref socket.
1016 /// \param[in] buf pointer to application data buffer to transmit.
1017 /// \param[in] len length of data (in bytes).
1018 /// \param[in] flags message flags:
1019 /// - MSG_DONTWAIT = don't wait to send data.
1020 /// - 0 = for none.
1021 /// \param[in] to structure containing remote IP address and port.
1022 /// \param[in] tolen length of \ref SOCKADDR structure.
1023 /// \return status information:
1024 /// - Number of bytes sent (>0).
1025 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1026 /// - BSD_EINVAL = Invalid parameter.
1027 /// - BSD_ELOCKED = Socket locked by another thread.
1028 /// - BSD_ENOTCONN = Socket not connected.
1029 /// - BSD_ECONNRESET = Connection reset by the peer.
1030 /// - BSD_EWOULDBLOCK = Operation would block.
1031 /// - BSD_ETIMEDOUT = Operation timed out.
1032 /// - BSD_EDESTADDRREQ = Destination address required.
1033 /// - BSD_ECONNABORTED = Connection aborted locally.
1034 /// - BSD_ENOMEM = Not enough memory.
1035 /// - BSD_ERROR = Unspecified error.
1036 extern int sendto (int sock, const char *buf, int len, int flags, const SOCKADDR *to, int tolen);
1037 
1038 /// \brief Send a message to endpoint node. [\ref thread-safe]
1039 /// \param[in] sock socket descriptor obtained with \ref socket.
1040 /// \param[in] msg pointer to \ref MSGHDR structure containing:
1041 /// - pointer to target address (NULL for none).
1042 /// - array of application buffer(s) containing the message.
1043 /// - pointer to the ancillary data (NULL for none).
1044 /// \param[in] flags message flags:
1045 /// - 0 = for none.
1046 /// \return status information:
1047 /// - Number of bytes sent (>0).
1048 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1049 /// - BSD_EINVAL = Invalid parameter.
1050 /// - BSD_ELOCKED = Socket locked by another thread.
1051 /// - BSD_ENOTSUP = Operation not supported.
1052 /// - BSD_EDESTADDRREQ = Destination address required.
1053 /// - BSD_EWOULDBLOCK = Operation would block.
1054 /// - BSD_ECONNABORTED = Connection aborted locally.
1055 /// - BSD_ENOMEM = Not enough memory.
1056 /// - BSD_ERROR = Unspecified error.
1057 extern int sendmsg (int sock, const MSGHDR *msg, int flags);
1058 
1059 /// \brief Receive data on already connected socket. [\ref thread-safe]
1060 /// \param[in] sock socket descriptor obtained with \ref socket.
1061 /// \param[out] buf pointer to application data buffer to store the data to.
1062 /// \param[in] len size of application data buffer (in bytes).
1063 /// \param[in] flags message flags:
1064 /// - MSG_DONTWAIT = don't wait for data.
1065 /// - MSG_PEEK = peek at incoming data.
1066 /// - 0 = for none.
1067 /// \return status information:
1068 /// - Number of bytes received (>0).
1069 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1070 /// - BSD_EINVAL = Invalid parameter.
1071 /// - BSD_ELOCKED = Socket locked by another thread.
1072 /// - BSD_ENOTCONN = Socket not connected.
1073 /// - BSD_ECONNRESET = Connection reset by the peer.
1074 /// - BSD_EWOULDBLOCK = Operation would block.
1075 /// - BSD_ETIMEDOUT = Operation timed out.
1076 /// - BSD_ECONNABORTED = Connection aborted locally.
1077 /// - BSD_ERROR = Unspecified error.
1078 extern int recv (int sock, char *buf, int len, int flags);
1079 
1080 /// \brief Receive data from endpoint node. [\ref thread-safe]
1081 /// \param[in] sock socket descriptor obtained with \ref socket.
1082 /// \param[out] buf pointer to application data buffer to store the data to.
1083 /// \param[in] len size of application data buffer (in bytes).
1084 /// \param[in] flags message flags:
1085 /// - MSG_DONTWAIT = don't wait for data.
1086 /// - MSG_PEEK = peek at incoming data.
1087 /// - 0 = for none.
1088 /// \param[out] from structure that will receive IP address and port number.
1089 /// - NULL for none.
1090 /// \param[in,out] fromlen length of \ref SOCKADDR structure.
1091 /// \return status information:
1092 /// - Number of bytes received (>0).
1093 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1094 /// - BSD_EINVAL = Invalid parameter.
1095 /// - BSD_ELOCKED = Socket locked by another thread.
1096 /// - BSD_ENOTCONN = Socket not connected.
1097 /// - BSD_ECONNRESET = Connection reset by the peer.
1098 /// - BSD_EWOULDBLOCK = Operation would block.
1099 /// - BSD_ETIMEDOUT = Operation timed out.
1100 /// - BSD_ECONNABORTED = Connection aborted locally.
1101 /// - BSD_ERROR = Unspecified error.
1102 extern int recvfrom (int sock, char *buf, int len, int flags, SOCKADDR *from, int *fromlen);
1103 
1104 /// \brief Receive a message from a socket. [\ref thread-safe]
1105 /// \param[in] sock socket descriptor obtained with \ref socket.
1106 /// \param[in,out] msg pointer to \ref MSGHDR structure containing:
1107 /// - pointer to buffer to store the source address to (NULL for none).
1108 /// - array of application buffer(s) for the incomming message.
1109 /// - pointer to buffer for the ancillary data (NULL for none).
1110 /// \param[in] flags message flags:
1111 /// - MSG_DONTWAIT = don't wait for data.
1112 /// - MSG_PEEK = peek at incoming data.
1113 /// - 0 = for none.
1114 /// \return status information:
1115 /// - Number of bytes received (>0).
1116 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1117 /// - BSD_EINVAL = Invalid parameter.
1118 /// - BSD_ELOCKED = Socket locked by another thread.
1119 /// - BSD_ENOTSUP = Operation not supported.
1120 /// - BSD_ENOTCONN = Socket not connected.
1121 /// - BSD_EWOULDBLOCK = Operation would block.
1122 /// - BSD_ETIMEDOUT = Operation timed out.
1123 /// - BSD_ECONNABORTED = Connection aborted locally.
1124 /// - BSD_ERROR = Unspecified error.
1125 extern int recvmsg (int sock, MSGHDR *msg, int flags);
1126 
1127 /// \brief Close socket and release socket descriptor. [\ref thread-safe]
1128 /// \param[in] sock socket descriptor obtained with \ref socket.
1129 /// \return status information:
1130 /// - 0 = Operation successful.
1131 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1132 /// - BSD_EWOULDBLOCK = Operation would block.
1133 /// - BSD_ERROR = Unspecified error.
1134 extern int closesocket (int sock);
1135 
1136 /// \brief Retrieve IP address and port number of the endpoint node. [\ref thread-safe]
1137 /// \param[in] sock socket descriptor obtained with \ref socket.
1138 /// \param[out] name structure that will receive IP address and port number.
1139 /// \param[in,out] namelen length of \ref SOCKADDR structure.
1140 /// \return status information:
1141 /// - 0 = Operation successful.
1142 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1143 /// - BSD_EINVAL = Invalid parameter.
1144 /// - BSD_ENOTCONN = Socket not connected.
1145 extern int getpeername (int sock, SOCKADDR *name, int *namelen);
1146 
1147 /// \brief Retrieve local IP address and port number. [\ref thread-safe]
1148 /// \param[in] sock socket descriptor obtained with \ref socket.
1149 /// \param[out] name structure that will receive IP address and port number.
1150 /// \param[in,out] namelen length of \ref SOCKADDR structure.
1151 /// \return status information:
1152 /// - 0 = Operation successful.
1153 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1154 /// - BSD_EINVAL = Invalid parameter or socket not bound.
1155 extern int getsockname (int sock, SOCKADDR *name, int *namelen);
1156 
1157 /// \brief Retrieve options for the socket. [\ref thread-safe]
1158 /// \param[in] sock socket descriptor obtained with \ref socket.
1159 /// \param[in] level level at which the option is defined:
1160 /// - SOL_SOCKET = Socket level.
1161 /// - IPPROTO_IP = IPv4 protocol level.
1162 /// - IPPROTO_IPV6 = IPv6 protocol level.
1163 /// \param[in] optname socket option for which the value is to be retrieved:
1164 /// - SO_TYPE = Type of a socket.
1165 /// - SO_KEEPALIVE = Keep Alive.
1166 /// - SO_RCVTIMEO = Timeout for blocking receive (in ms).
1167 /// - SO_SNDTIMEO = Timeout for blocking send (in ms).
1168 /// - IP_RECVDSTADDR = Receive Destination IP Address.
1169 /// - IP_TOS = Type of Service (TOS).
1170 /// - IP_TTL = Time to Live (TTL).
1171 /// - IPV6_TCLASS = Traffic Class.
1172 /// - IPV6_MULTICAST_HOPS = Multi-cast Hop Limit.
1173 /// - IPV6_RECVDSTADDR = Receive Destination IPv6 Address.
1174 /// \param[out] optval pointer to the buffer that will receive the option value.
1175 /// \param[in,out] optlen input length of buffer, return length of the data.
1176 /// \return status information:
1177 /// - 0 = Operation successful.
1178 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1179 /// - BSD_EINVAL = Invalid parameter.
1180 /// - BSD_ENOTSUP = Option not supported for this socket type.
1181 extern int getsockopt (int sock, int level, int optname, char *optval, int *optlen);
1182 
1183 /// \brief Manipulate options for the socket. [\ref thread-safe]
1184 /// \param[in] sock socket descriptor obtained with \ref socket.
1185 /// \param[in] level level at which the option is defined:
1186 /// - SOL_SOCKET = Socket level.
1187 /// - IPPROTO_IP = IPv4 protocol level.
1188 /// - IPPROTO_IPV6 = IPv6 protocol level.
1189 /// \param[in] optname socket option for which the value is to be set:
1190 /// - SO_KEEPALIVE = Keep Alive.
1191 /// - SO_RCVTIMEO = Timeout for blocking receive (in ms).
1192 /// - SO_SNDTIMEO = Timeout for blocking send (in ms).
1193 /// - IP_TOS = Type of Service (TOS).
1194 /// - IP_TTL = Time to Live (TTL).
1195 /// - IP_RECVDSTADDR = Receive Destination IP Address.
1196 /// - IPV6_TCLASS = Traffic Class.
1197 /// - IPV6_MULTICAST_HOPS = Multi-cast Hop Limit.
1198 /// - IPV6_RECVDSTADDR = Receive Destination IPv6 Address.
1199 /// \param[in] optval pointer to the buffer containing the option value.
1200 /// \param[in] optlen size of the buffer containing the option value.
1201 /// \return status information:
1202 /// - 0 = Operation successful.
1203 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1204 /// - BSD_EINVAL = Invalid parameter.
1205 /// - BSD_ENOTSUP = Option not supported for this socket type.
1206 extern int setsockopt (int sock, int level, int optname, const char *optval, int optlen);
1207 
1208 /// \brief Control IO mode of a socket. [\ref thread-safe]
1209 /// \param[in] sock socket descriptor obtained with \ref socket.
1210 /// \param[in] cmd command to perform:
1211 /// - FIONBIO = enable non-blocking mode.
1212 /// \param[in] argp command's parameter.
1213 /// \return status information:
1214 /// - 0 = Operation successful.
1215 /// - BSD_ESOCK = Invalid socket descriptor or socket not created.
1216 /// - BSD_EINVAL = Invalid parameter.
1217 /// - BSD_ENOTSUP = Option not supported for this socket type.
1218 extern int ioctlsocket (int sock, long cmd, unsigned long *argp);
1219 
1220 /// \brief Check the status of one or more sockets. [\ref thread-safe]
1221 /// \param[in] nfds range of sockets to be checked.
1222 /// \param[in,out] readfds pointer to the set of sockets to check for read.
1223 /// - NULL for none.
1224 /// \param[in,out] writefds pointer to the set of sockets to check for write.
1225 /// - NULL for none.
1226 /// \param[in,out] errorfds pointer to the set of sockets to check for error.
1227 /// - NULL for none.
1228 /// \param[in] timeout pointer to maximum time for select to wait.
1229 /// - NULL for blocking wait for event.
1230 /// \return status information:
1231 /// - number of ready sockets (>0)
1232 /// - 0 = Operation timed out.
1233 /// - BSD_EINVAL = Invalid parameter.
1234 /// - BSD_ERROR = Suspend operation failed.
1235 extern int select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
1236 
1237 /// \brief Retrieve host IP address from host name. [\ref thread-safe]
1238 /// \param[in] name host name.
1239 /// \param[out] err pointer to where to return error code (NULL for none):
1240 /// - 0 = Operation successful.
1241 /// - BSD_EINVAL = Invalid parameter.
1242 /// - BSD_ELOCKED = Resolver locked by another thread.
1243 /// - BSD_ETIMEDOUT = Operation timed out.
1244 /// - BSD_EHOSTNOTFOUND = Host not found.
1245 /// - BSD_ERROR = Unspecified error.
1246 /// \return status information:
1247 /// - \ref HOSTENT result structure.
1248 /// - NULL in case of error.
1249 extern HOSTENT *gethostbyname (const char *name, int *err);
1250 
1251 /// \brief Convert from text address to a network address. [\ref thread-safe]
1252 /// \param[in] cp text address in standard dotted-decimal notation.
1253 /// \return status information:
1254 /// - Internet address on success.
1255 /// - INADDR_NONE = on error.
1256 extern IN_ADDR inet_addr (const char *cp);
1257 
1258 /// \brief Convert from text address to a network address. [\ref thread-safe]
1259 /// \param[in] cp text address in standard dotted-decimal notation.
1260 /// \param[out] addr buffer where the converted IPv4 address is to be stored.
1261 /// \return status information:
1262 /// - 1 = Conversion successful.
1263 /// - 0 = Conversion failed.
1264 extern int inet_aton (const char *cp, IN_ADDR *addr);
1265 
1266 /// \brief Convert from network address to a text string. [\ref not_thread-safe]
1267 /// \param[in] in Internet IPv4 host address to convert.
1268 /// \return pointer to the formatted string.
1269 extern const char *inet_ntoa (IN_ADDR in);
1270 
1271 /// \brief Convert from text address to a binary network address. [\ref thread-safe]
1272 /// \param[in] af address family:
1273 /// - AF_INET = Internet Address Family (IPv4).
1274 /// - AF_INET6 = Internet Address Family version 6 (IPv6).
1275 /// \param[in] src text address to be converted.
1276 /// \param[out] dst buffer where the converted address is to be stored.
1277 /// \return status information:
1278 /// - 1 = Conversion successful.
1279 /// - 0 = Conversion failed.
1280 extern int inet_pton (int af, const char *src, void *dst);
1281 
1282 /// \brief Convert from binary network address to a text string. [\ref thread-safe]
1283 /// \param[in] af address family:
1284 /// - AF_INET = Internet Address Family (IPv4).
1285 /// - AF_INET6 = Internet Address Family version 6 (IPv6).
1286 /// \param[in] src binary address in network byte order to be converted.
1287 /// \param[out] dst buffer where the converted text address is to be stored.
1288 /// \param[in] size size of the buffer, at least:
1289 /// - INET_ADDRSTRLEN for AF_INET.
1290 /// - INET6_ADDRSTRLEN for AF_INET6.
1291 /// \return pointer to the formatted string.
1292 /// - NULL in case of error.
1293 extern const char *inet_ntop (int af, const void *src, char *dst, int size);
1294 #endif /* RTE_Network_Socket_BSD */
1295 
1296 // ==== Interface User API ====
1297 
1298 /// \brief Get the current value of an Interface option. [\ref thread-safe]
1299 /// \param[in] if_id Interface identification (class and number).
1300 /// \param[in] option Interface option as specified by \ref netIF_Option.
1301 /// \param[out] buf buffer to store the option value to.
1302 /// \param[in] buf_len length of buffer.
1303 /// \return status code that indicates the execution status of the function.
1304 extern netStatus netIF_GetOption (uint32_t if_id, netIF_Option option, uint8_t *buf, uint32_t buf_len);
1305 
1306 /// \brief Set the value of an Interface option. [\ref thread-safe]
1307 /// \param[in] if_id Interface identification (class and number).
1308 /// \param[in] option Interface option as specified by \ref netIF_Option.
1309 /// \param[in] buf buffer containing the option value.
1310 /// \param[in] buf_len length of buffer.
1311 /// \return status code that indicates the execution status of the function.
1312 extern netStatus netIF_SetOption (uint32_t if_id, netIF_Option option, const uint8_t *buf, uint32_t buf_len);
1313 
1314 /// \brief Set default network interface for Internet access. [\ref thread-safe]
1315 /// \param[in] if_id Interface identification (class and number).
1316 /// \param[in] ip_version IP version as specified by \ref netIF_Version.
1317 /// \return status code that indicates the execution status of the function.
1318 extern netStatus netIF_SetDefault (uint32_t if_id, netIF_Version ip_version);
1319 
1320 /// \brief Enable or disable ICMP Echo response. [\ref thread-safe]
1321 /// \param[in] if_id Interface identification (class and number).
1322 /// \param[in] no_echo new state of NoEcho attribute:
1323 /// - true= disable ICMP echo response,
1324 /// - false= enable ICMP echo response.
1325 /// \return status code that indicates the execution status of the function.
1326 extern netStatus netICMP_SetNoEcho (uint32_t if_id, bool no_echo);
1327 
1328 /// \brief Enable or disable ICMPv6 Echo response. [\ref thread-safe]
1329 /// \param[in] if_id Interface identification (class and number).
1330 /// \param[in] no_echo new state of NoEcho attribute:
1331 /// - true= disable ICMPv6 echo response,
1332 /// - false= enable ICMPv6 echo response.
1333 /// \return status code that indicates the execution status of the function.
1334 extern netStatus netICMP6_SetNoEcho (uint32_t if_id, bool no_echo);
1335 
1336 // ==== Ethernet Interface User API ====
1337 
1338 /// \brief Send raw Ethernet data. [\ref thread-safe]
1339 /// \param[in] if_num Ethernet interface number.
1340 /// \param[in] buf buffer containing the data.
1341 /// \param[in] len length of data in bytes.
1342 /// \return status code that indicates the execution status of the function.
1343 extern netStatus netETH_SendRaw (uint32_t if_num, const uint8_t *buf, uint32_t len);
1344 
1345 /// \brief Determine whether the ARP table has MAC address resolved for requested IP address. [\ref thread-safe]
1346 /// \param[in] if_id Interface identification (class and number).
1347 /// \param[in] ip4_addr requested IPv4 address.
1348 /// \param[in] type address cache type.
1349 /// \return status code that indicates the execution status of the function.
1350 extern netStatus netARP_CacheIP (uint32_t if_id, const uint8_t *ip4_addr, netARP_CacheType type);
1351 
1352 /// \brief Determine whether the ARP table has IP address resolved for requested MAC address. [\ref thread-safe]
1353 /// \param[in] if_id Interface identification (class and number).
1354 /// \param[in] mac_addr requested MAC address.
1355 /// \return status code that indicates the execution status of the function.
1356 extern netStatus netARP_CacheMAC (uint32_t if_id, const uint8_t *mac_addr);
1357 
1358 /// \brief Get IP address from the ARP cache. [\ref thread-safe]
1359 /// \param[in] if_id Interface identification (class and number).
1360 /// \param[in] mac_addr requested MAC address.
1361 /// \param[out] ip4_addr resolved IPv4 address.
1362 /// \return status code that indicates the execution status of the function.
1363 extern netStatus netARP_GetIP (uint32_t if_id, const uint8_t *mac_addr, uint8_t *ip4_addr);
1364 
1365 /// \brief Get MAC address from the ARP cache. [\ref thread-safe]
1366 /// \param[in] if_id Interface identification (class and number).
1367 /// \param[in] ip4_addr requested IPv4 address.
1368 /// \param[out] mac_addr resolved MAC address.
1369 /// \return status code that indicates the execution status of the function.
1370 extern netStatus netARP_GetMAC (uint32_t if_id, const uint8_t *ip4_addr, uint8_t *mac_addr);
1371 
1372 /// \brief Determine whether the IP address is already in use. [\ref thread-safe]
1373 /// \param[in] if_id Interface identification (class and number).
1374 /// \param[in] ip4_addr requested IPv4 address.
1375 /// \param[in] cb_func callback function to call, when probe session ends.
1376 /// \return status code that indicates the execution status of the function.
1377 extern netStatus netARP_Probe (uint32_t if_id, const uint8_t *ip4_addr, netARP_cb_t cb_func);
1378 
1379 /// \brief Determine whether the IP address is already in use in blocking mode. [\ref thread-safe]
1380 /// \param[in] if_id Interface identification (class and number).
1381 /// \param[in] ip4_addr requested IPv4 address.
1382 /// \return status code that indicates the execution status of the function.
1383 extern netStatus netARP_ProbeX (uint32_t if_id, const uint8_t *ip4_addr);
1384 
1385 /// \brief Flush or clear the local ARP cache. [\ref thread-safe]
1386 /// \param[in] if_id Interface identification (class and number).
1387 /// \return status code that indicates the execution status of the function.
1388 extern netStatus netARP_ClearCache (uint32_t if_id);
1389 
1390 /// \brief Determine whether neighbor cache has MAC address resolved for requested IP address. [\ref thread-safe]
1391 /// \param[in] if_id Interface identification (class and number).
1392 /// \param[in] ip6_addr requested IPv6 address.
1393 /// \return status code that indicates the execution status of the function.
1394 extern netStatus netNDP_CacheIP (uint32_t if_id, const uint8_t *ip6_addr);
1395 
1396 /// \brief Get IP address from neighbor discovery cache. [\ref thread-safe]
1397 /// \param[in] if_id Interface identification (class and number).
1398 /// \param[in] mac_addr requested MAC address.
1399 /// \param[out] ip6_addr resolved IPv6 address.
1400 /// \return status code that indicates the execution status of the function.
1401 extern netStatus netNDP_GetIP (uint32_t if_id, const uint8_t *mac_addr, uint8_t *ip6_addr);
1402 
1403 /// \brief Get MAC address from neighbor discovery cache. [\ref thread-safe]
1404 /// \param[in] if_id Interface identification (class and number).
1405 /// \param[in] ip6_addr requested IPv6 address.
1406 /// \param[out] mac_addr resolved MAC address.
1407 /// \return status code that indicates the execution status of the function.
1408 extern netStatus netNDP_GetMAC (uint32_t if_id, const uint8_t *ip6_addr, uint8_t *mac_addr);
1409 
1410 /// \brief Determine whether the IP address is already in use. [\ref thread-safe]
1411 /// \param[in] if_id Interface identification (class and number).
1412 /// \param[in] ip6_addr requested IPv6 address.
1413 /// \param[in] cb_func callback function to call, when probe session ends.
1414 /// \return status code that indicates the execution status of the function.
1415 extern netStatus netNDP_Probe (uint32_t if_id, const uint8_t *ip6_addr, netNDP_cb_t cb_func);
1416 
1417 /// \brief Determine whether the IP address is already in use in blocking mode. [\ref thread-safe]
1418 /// \param[in] if_id Interface identification (class and number).
1419 /// \param[in] ip6_addr requested IPv6 address.
1420 /// \return status code that indicates the execution status of the function.
1421 extern netStatus netNDP_ProbeX (uint32_t if_id, const uint8_t *ip6_addr);
1422 
1423 /// \brief Flush or clear the local NDP cache. [\ref thread-safe]
1424 /// \param[in] if_id Interface identification (class and number).
1425 /// \return status code that indicates the execution status of the function.
1426 extern netStatus netNDP_ClearCache (uint32_t if_id);
1427 
1428 /// \brief Join this host to a host group specified with IP address. [\ref thread-safe]
1429 /// \param[in] if_id Interface identification (class and number).
1430 /// \param[in] ip4_addr group IPv4 address.
1431 /// \return status code that indicates the execution status of the function.
1432 extern netStatus netIGMP_Join (uint32_t if_id, const uint8_t *ip4_addr);
1433 
1434 /// \brief Leave a host group specified with IP address. [\ref thread-safe]
1435 /// \param[in] if_id Interface identification (class and number).
1436 /// \param[in] ip4_addr group IPv4 address.
1437 /// \return status code that indicates the execution status of the function.
1438 extern netStatus netIGMP_Leave (uint32_t if_id, const uint8_t *ip4_addr);
1439 
1440 /// \brief Enable Dynamic Host Configuration at runtime. [\ref thread-safe]
1441 /// \param[in] if_id Interface identification (class and number).
1442 /// \return status code that indicates the execution status of the function.
1443 extern netStatus netDHCP_Enable (uint32_t if_id);
1444 
1445 /// \brief Disable Dynamic Host Configuration at runtime. [\ref thread-safe]
1446 /// \param[in] if_id Interface identification (class and number).
1447 /// \return status code that indicates the execution status of the function.
1448 extern netStatus netDHCP_Disable (uint32_t if_id);
1449 
1450 /// \brief Set DHCP Option value at runtime. [\ref thread-safe]
1451 /// \param[in] if_id Interface identification (class and number).
1452 /// \param[in] option DHCP option code.
1453 /// \param[in] val pointer to option value.
1454 /// \param[in] len length of option value in bytes.
1455 /// \return status code that indicates the execution status of the function.
1456 extern netStatus netDHCP_SetOption (uint32_t if_id, uint8_t option, const uint8_t *val, uint32_t len);
1457 
1458 /// \brief Enable Dynamic Host Configuration version 6 at runtime. [\ref thread-safe]
1459 /// \param[in] if_id Interface identification (class and number).
1460 /// \param[in] mode DHCPv6 operation mode.
1461 /// \return status code that indicates the execution status of the function.
1462 extern netStatus netDHCP6_Enable (uint32_t if_id, netDHCP6_Mode mode);
1463 
1464 /// \brief Disable Dynamic Host Configuration version 6 at runtime. [\ref thread-safe]
1465 /// \param[in] if_id Interface identification (class and number).
1466 /// \return status code that indicates the execution status of the function.
1467 extern netStatus netDHCP6_Disable (uint32_t if_id);
1468 
1469 // ==== Ethernet Interface Callbacks ====
1470 
1471 /// \brief Notify the user of Ethernet link state change event. [\ref user-provided]
1472 /// \param[in] if_num Ethernet interface number.
1473 /// \param[in] event Ethernet link state event as defined in \ref netETH_Event.
1474 /// \param[in] val pointer to the event value.
1475 /// \return none.
1476 extern void netETH_Notify (uint32_t if_num, netETH_Event event, uint32_t val);
1477 
1478 /// \brief Receive raw Ethernet data. [\ref user-provided]
1479 /// \param[in] if_num Ethernet interface number.
1480 /// \param[in] buf buffer containing the received data.
1481 /// \param[in] len length of received data in bytes.
1482 /// \return none.
1483 extern void netETH_ReceiveRaw (uint32_t if_num, const uint8_t *buf, uint32_t len);
1484 
1485 /// \brief Notify the user of DHCP event or extended DHCP option. [\ref user-provided]
1486 /// \param[in] if_id Interface identification (class and number).
1487 /// \param[in] option DHCP option code.
1488 /// \param[in] val pointer to option value.
1489 /// \param[in] len length of option value in bytes.
1490 /// \return none.
1491 extern void netDHCP_Notify (uint32_t if_id, uint8_t option, const uint8_t *val, uint32_t len);
1492 
1493 /// \brief Notify the user of DHCPv6 event or extended DHCPv6 option. [\ref user-provided]
1494 /// \param[in] if_id Interface identification (class and number).
1495 /// \param[in] option DHCPv6 option code.
1496 /// \param[in] val pointer to option value.
1497 /// \param[in] len length of option value in bytes.
1498 /// \return none.
1499 extern void netDHCP6_Notify (uint32_t if_id, uint8_t option, const uint8_t *val, uint32_t len);
1500 
1501 // ==== WiFi Interface User API ====
1502 
1503 /// \brief Search for available WiFi networks. [\ref thread-safe]
1504 /// \param[in] if_num WiFi interface number.
1505 /// \param[out] scan_info array of structures for storing the scan information.
1506 /// \param[in,out] scan_num input maximum number, return number of WiFi networks found.
1507 /// \return status code that indicates the execution status of the function.
1508 extern netStatus netWiFi_Scan (uint32_t if_num, NET_WIFI_SCAN_INFO scan_info[], uint32_t *scan_num);
1509 
1510 /// \brief Get the value of the WiFi driver option. [\ref thread-safe]
1511 /// \param[in] if_num WiFi interface number.
1512 /// \param[in] option driver option as specified by \ref netWiFi_Option.
1513 /// \param[out] buf buffer to store the option value to.
1514 /// \param[in] buf_len length of buffer.
1515 /// \return status code that indicates the execution status of the function.
1516 extern netStatus netWiFi_GetOption (uint32_t if_num, netWiFi_Option option, void *buf, uint32_t buf_len);
1517 
1518 /// \brief Set the value of the WiFi driver option. [\ref thread-safe]
1519 /// \param[in] if_num WiFi interface number.
1520 /// \param[in] option driver option as specified by \ref netWiFi_Option.
1521 /// \param[in] buf buffer containing the option value.
1522 /// \param[in] buf_len length of buffer.
1523 /// \return status code that indicates the execution status of the function.
1524 extern netStatus netWiFi_SetOption (uint32_t if_num, netWiFi_Option option, const void *buf, uint32_t buf_len);
1525 
1526 /// \brief Activate the WiFi interface. [\ref thread-safe]
1527 /// \param[in] if_num WiFi interface number.
1528 /// \param[in] config pointer to the structure with configuration parameters.
1529 /// \return status code that indicates the execution status of the function.
1530 extern netStatus netWiFi_Activate (uint32_t if_num, const NET_WIFI_CONFIG *config);
1531 
1532 /// \brief Deactivate the WiFi interface. [\ref thread-safe]
1533 /// \param[in] if_num WiFi interface number.
1534 /// \return status code that indicates the execution status of the function.
1535 extern netStatus netWiFi_Deactivate (uint32_t if_num);
1536 
1537 /// \brief Get the connection state of the WiFi interface. [\ref thread-safe]
1538 /// \param[in] if_num WiFi interface number.
1539 /// \return connection state:
1540 /// - true = Station connected to access point.
1541 /// - false = Station not connected.
1542 extern bool netWiFi_IsConnected (uint32_t if_num);
1543 
1544 /// \brief Get the network information of the WiFi interface. [\ref thread-safe]
1545 /// \param[in] if_num WiFi interface number.
1546 /// \param[out] net_info structure for storing the network information.
1547 /// \return status code that indicates the execution status of the function.
1548 extern netStatus netWiFi_GetNetInfo (uint32_t if_num, NET_WIFI_NET_INFO *net_info);
1549 
1550 // ==== PPP Interface User API ====
1551 
1552 /// \brief Start PPP interface to accept incoming PPP connection. [\ref thread-safe]
1553 /// \param[in] username remote username for authentication.
1554 /// \param[in] password remote password for authentication.
1555 /// \return status code that indicates the execution status of the function.
1556 extern netStatus netPPP_Listen (const char *username, const char *password);
1557 
1558 /// \brief Start a dial-up connection to remote PPP server. [\ref thread-safe]
1559 /// \param[in] dial_num phone number of remote PPP server.
1560 /// \param[in] username username for authentication.
1561 /// \param[in] password password for authentication.
1562 /// \return status code that indicates the execution status of the function.
1563 extern netStatus netPPP_Connect (const char *dial_num, const char *username, const char *password);
1564 
1565 /// \brief Disconnect PPP link between two modems. [\ref thread-safe]
1566 /// \return status code that indicates the execution status of the function.
1567 extern netStatus netPPP_Close (void);
1568 
1569 /// \brief Determine the state of PPP link. [\ref thread-safe]
1570 /// \return link state:
1571 /// - true = Link is up, IP frames can be exchanged.
1572 /// - false = Link is down.
1573 extern bool netPPP_LinkUp (void);
1574 
1575 // ==== SLIP Interface User API ====
1576 
1577 /// \brief Start SLIP interface to accept incoming SLIP connections. [\ref thread-safe]
1578 /// \return status code that indicates the execution status of the function.
1579 extern netStatus netSLIP_Listen (void);
1580 
1581 /// \brief Start a dial-up connection to remote SLIP server. [\ref thread-safe]
1582 /// \param[in] dial_num phone number of remote SLIP server.
1583 /// \return status code that indicates the execution status of the function.
1584 extern netStatus netSLIP_Connect (const char *dial_num);
1585 
1586 /// \brief Disconnect SLIP link between two modems. [\ref thread-safe]
1587 /// \return status code that indicates the execution status of the function.
1588 extern netStatus netSLIP_Close (void);
1589 
1590 /// \brief Determine the state of SLIP link. [\ref thread-safe]
1591 /// \return link state:
1592 /// - true = Link is up, IP frames can be exchanged.
1593 /// - false = Link is down.
1594 extern bool netSLIP_LinkUp (void);
1595 
1596 // ==== Ping User API ====
1597 
1598 /// \brief Start ICMP ping process. [\ref thread-safe]
1599 /// \param[in] addr structure containing IP address of remote host.
1600 /// \param[in] cb_func callback function to call, when ping session ends.
1601 /// \return status code that indicates the execution status of the function.
1602 extern netStatus netPing_Echo (const NET_ADDR *addr, netPing_cb_t cb_func);
1603 
1604 /// \brief Start ICMP ping process in blocking mode. [\ref thread-safe]
1605 /// \param[in] target remote hostname or absolute IP address.
1606 /// \param[in] flags ping process control flags.
1607 /// \return status code that indicates the execution status of the function.
1608 extern netStatus netPing_EchoX (const char *target, uint32_t flags);
1609 
1610 // ==== DNS Client User API ====
1611 
1612 /// \brief Resolve IP address of a host from a hostname. [\ref thread-safe]
1613 /// \param[in] name hostname, a null-terminated string.
1614 /// \param[in] addr_type network address type to resolve:
1615 /// - NET_ADDR_IP4 = IPv4 address.
1616 /// - NET_ADDR_IP6 = IPv6 address.
1617 /// \param[in] cb_func callback function to call, when DNS session ends.
1618 /// \return status code that indicates the execution status of the function.
1619 extern netStatus netDNSc_GetHostByName (const char *name, int16_t addr_type, netDNSc_cb_t cb_func);
1620 
1621 /// \brief Resolve IP address of a host from a hostname in blocking mode. [\ref thread-safe]
1622 /// \param[in] name hostname, a null-terminated string.
1623 /// \param[in] addr_type network address type to resolve:
1624 /// - NET_ADDR_IP4 = IPv4 address.
1625 /// - NET_ADDR_IP6 = IPv6 address.
1626 /// \param[out] addr structure that will receive resolved IP address of the hostname.
1627 /// \return status code that indicates the execution status of the function.
1628 extern netStatus netDNSc_GetHostByNameX (const char *name, int16_t addr_type, NET_ADDR *addr);
1629 
1630 /// \brief Flush or clear the local DNS cache. [\ref thread-safe]
1631 /// \return status code that indicates the execution status of the function.
1632 extern netStatus netDNSc_ClearCache (void);
1633 
1634 // ==== FTP Server User API ====
1635 
1636 /// \brief Start FTP server. [\ref thread-safe]
1637 /// \return status code that indicates the execution status of the function.
1638 extern netStatus netFTPs_Start (void);
1639 
1640 /// \brief Stop FTP server. [\ref thread-safe]
1641 /// \return status code that indicates the execution status of the function.
1642 extern netStatus netFTPs_Stop (void);
1643 
1644 /// \brief Check if FTP server is running. [\ref thread-safe]
1645 /// \return
1646 /// - true = Server is running.
1647 /// - false = Server is not running.
1648 extern bool netFTPs_Running (void);
1649 
1650 /// \brief Get port number of FTP server. [\ref thread-safe]
1651 /// \return port number.
1652 extern uint16_t netFTPs_GetPort (void);
1653 
1654 /// \brief Set port number of FTP server. [\ref thread-safe]
1655 /// \param[in] port port number.
1656 /// \return status code that indicates the execution status of the function.
1657 extern netStatus netFTPs_SetPort (uint16_t port);
1658 
1659 /// \brief Retrieve path to the root directory of FTP server. [\ref thread-safe]
1660 /// \return pointer to root path, a null-terminated string.
1661 /// - NULL if root folder is disabled in the configuration.
1662 extern const char *netFTPs_GetRootPath (void);
1663 
1664 /// \brief Set path to the root directory of FTP server. [\ref thread-safe]
1665 /// \param[in] path new root path, a null-terminated string.
1666 /// \return status code that indicates the execution status of the function.
1667 extern netStatus netFTPs_SetRootPath (const char *path);
1668 
1669 /// \brief Retrieve username of the built-in user account. [\ref thread-safe]
1670 /// \return pointer to username, a null-terminated string.
1671 /// - NULL if authentication is disabled in the configuration.
1672 extern const char *netFTPs_GetUsername (void);
1673 
1674 /// \brief Set username of the built-in user account. [\ref thread-safe]
1675 /// \param[in] username new username, a null-terminated string.
1676 /// \return status code that indicates the execution status of the function.
1677 extern netStatus netFTPs_SetUsername (const char *username);
1678 
1679 /// \brief Retrieve password of the built-in user account. [\ref thread-safe]
1680 /// \return pointer to password, a null-terminated string.
1681 /// - NULL if authentication is disabled in the configuration.
1682 extern const char *netFTPs_GetPassword (void);
1683 
1684 /// \brief Reset password of the built-in user account. [\ref thread-safe]
1685 /// \param[in] password new password, a null-terminated string.
1686 /// \return status code that indicates the execution status of the function.
1687 extern netStatus netFTPs_SetPassword (const char *password);
1688 
1689 /// \brief Determine if FTP server authentication is enabled. [\ref thread-safe]
1690 /// \return
1691 /// - true = Authentication enabled in the configuration.
1692 /// - false = Authentication is not enabled.
1693 extern bool netFTPs_LoginActive (void);
1694 
1695 /// \brief Enable or disable FTP server authentication. [\ref thread-safe]
1696 /// \param[in] login new authentication state:
1697 /// - true = Enable authentication.
1698 /// - false = Disable authentication.
1699 /// \return status code that indicates the execution status of the function.
1700 extern netStatus netFTPs_LoginOnOff (bool login);
1701 
1702 // ==== FTP Server Access Interface ====
1703 
1704 /// \brief Accept or deny connection from remote FTP client. [\ref user-provided]
1705 /// \param[in] addr structure containing IP address and port of remote FTP client.
1706 /// \return
1707 /// - true = Connection from the remote client is allowed.
1708 /// - false = Connection is denied.
1709 extern bool netFTPs_AcceptClient (const NET_ADDR *addr);
1710 
1711 // ==== FTP Server Multi-User Interface ====
1712 
1713 /// \brief Check if an user account exists in the user database. [\ref user-provided]
1714 /// \param[in] username pointer to username.
1715 /// \return status information:
1716 /// - User identification number.
1717 /// - 0 if the user is not existing.
1718 extern uint8_t netFTPs_CheckUsername (const char *username);
1719 
1720 /// \brief Check user account password in the user database. [\ref user-provided]
1721 /// \param[in] user_id user identification number.
1722 /// \param[in] password pointer to password.
1723 /// \return
1724 /// - true = password accepted.
1725 /// - false = invalid password.
1726 extern bool netFTPs_CheckPassword (uint8_t user_id, const char *password);
1727 
1728 /// \brief Check if remote user is allowed to access a file on FTP server. [\ref user-provided]
1729 /// \param[in] user_id user identification number.
1730 /// \param[in] fname full path of a file to access.
1731 /// \param[in] access access mode as defined with Network Access definitions.
1732 /// \return
1733 /// - true = File access is allowed.
1734 /// - false = File access is denied.
1735 extern bool netFTPs_FileAccess (uint8_t user_id, const char *fname, uint32_t access);
1736 
1737 /// \brief Retrieve the user identification number. [\ref thread-safe]
1738 /// \return user identification number (0 = system administrator).
1739 extern uint8_t netFTPs_GetUserId (void);
1740 
1741 // ==== FTP Server User Callbacks ====
1742 
1743 /// \brief Notify the user application about events in FTP server service. [\ref user-provided]
1744 /// \param[in] event FTP Server notification event as specified in \ref netFTPs_Event.
1745 /// \return none.
1746 /// \note Network library calls this function to inform the user about events.
1747 extern void netFTPs_Notify (netFTPs_Event event);
1748 
1749 // ==== FTP Server File System Interface ====
1750 
1751 /// \brief Open a file for reading or writing in FTP server. [\ref interface]
1752 /// \param[in] fname name of the file to open.
1753 /// \param[in] mode type of access:
1754 /// - "rb" = opens a file for reading.
1755 /// - "wb" = opens a file for writing.
1756 /// \return status information:
1757 /// - Pointer to an open file.
1758 /// - NULL in case of an error.
1759 extern void *netFTPs_fopen (const char *fname, const char *mode);
1760 
1761 /// \brief Close a file previously open in FTP server. [\ref interface]
1762 /// \param[in] file pointer to the file to close.
1763 /// \return none.
1764 extern void netFTPs_fclose (void *file);
1765 
1766 /// \brief Read block of data from a file in FTP server. [\ref interface]
1767 /// \param[in] file pointer to the file to read from.
1768 /// \param[out] buf block of memory to write data to.
1769 /// \param[in] len length of data to read in bytes.
1770 /// \return number of bytes successfully read.
1771 extern uint32_t netFTPs_fread (void *file, uint8_t *buf, uint32_t len);
1772 
1773 /// \brief Write block of data to a file in FTP server. [\ref interface]
1774 /// \param[in] file pointer to the file to write to.
1775 /// \param[in] buf block of memory to be written.
1776 /// \param[in] len length of data to write in bytes.
1777 /// \return number of bytes successfully written.
1778 extern uint32_t netFTPs_fwrite (void *file, const uint8_t *buf, uint32_t len);
1779 
1780 /// \brief Delete a file in FTP server. [\ref interface]
1781 /// \param[in] fname name of the file to delete.
1782 /// \return
1783 /// - true = File successfully deleted.
1784 /// - false = Failed to delete a file.
1785 extern bool netFTPs_fdelete (const char *fname);
1786 
1787 /// \brief Rename a file or directory in FTP server. [\ref interface]
1788 /// \param[in] fname old name to rename from.
1789 /// \param[in] newname new name to rename to.
1790 /// \return
1791 /// - true = File or directory successfully renamed.
1792 /// - false = Failed to rename a file or directory.
1793 extern bool netFTPs_frename (const char *fname, const char *newname);
1794 
1795 /// \brief Make a new directory in FTP server. [\ref interface]
1796 /// \param[in] path directory path to create.
1797 /// \return
1798 /// - true = Directory successfully created.
1799 /// - false = Failed to create a directory.
1800 extern bool netFTPs_mkdir (const char *path);
1801 
1802 /// \brief Remove an empty directory in FTP server. [\ref interface]
1803 /// \param[in] path directory path to remove.
1804 /// \return
1805 /// - true = Directory successfully removed.
1806 /// - false = Failed to remove a directory.
1807 extern bool netFTPs_rmdir (const char *path);
1808 
1809 /// \brief Search the file system directory for matching files. [\ref interface]
1810 /// \param[in] mask file mask filter.
1811 /// \param[out] fname buffer to write filename to.
1812 /// - NULL for none.
1813 /// \param[out] fsize pointer to where to return the file size.
1814 /// - NULL for none.
1815 /// \param[out] ftime pointer to where to return the created or last modified time.
1816 /// - NULL for none.
1817 /// \param[in] first find first file.
1818 /// \return status information:
1819 /// - NET_FS_ATTR_FILE = File found.
1820 /// - NET_FS_ATTR_DIRECTORY = Directory found.
1821 /// - 0 = No entry found.
1822 extern int32_t netFTPs_ffind (const char *mask, char *fname, uint32_t *fsize, NET_FS_TIME *ftime, bool first);
1823 
1824 // ==== FTP Client User API ====
1825 
1826 /// \brief Start FTP client file operation session. [\ref thread-safe]
1827 /// \param[in] addr structure containing IP address and port of remote FTP server.
1828 /// \param[in] command FTP command to perform.
1829 /// \return status code that indicates the execution status of the function.
1830 extern netStatus netFTPc_Connect (const NET_ADDR *addr, netFTP_Command command);
1831 
1832 // ==== FTP Client User Callbacks ====
1833 
1834 /// \brief Request parameters for FTP client session. [\ref user-provided]
1835 /// \param[in] request request code.
1836 /// \param[out] buf output buffer to write the data to.
1837 /// \param[in] buf_len length of the output buffer in bytes.
1838 /// \return number of bytes written to output buffer.
1839 extern uint32_t netFTPc_Process (netFTPc_Request request, char *buf, uint32_t buf_len);
1840 
1841 /// \brief Notify the user application when FTP client operation ends. [\ref user-provided]
1842 /// \param[in] event FTP client notification event as specified in \ref netFTPc_Event.
1843 /// \return none.
1844 /// \note Network library calls this function to inform the user about events.
1845 extern void netFTPc_Notify (netFTPc_Event event);
1846 
1847 // ==== FTP Client File System Interface ====
1848 
1849 /// \brief Open local file for reading or writing in FTP client. [\ref interface]
1850 /// \param[in] fname name of the file to open.
1851 /// \param[in] mode type of access:
1852 /// - "rb" = opens a file for reading.
1853 /// - "wb" = opens a file for writing.
1854 /// \return status information:
1855 /// - Pointer to an open file.
1856 /// - NULL in case of an error.
1857 extern void *netFTPc_fopen (const char *fname, const char *mode);
1858 
1859 /// \brief Close local file previously open in FTP client. [\ref interface]
1860 /// \param[in] file pointer to the file to close.
1861 /// \return none.
1862 extern void netFTPc_fclose (void *file);
1863 
1864 /// \brief Read block of data from local file in FTP client. [\ref interface]
1865 /// \param[in] file pointer to the file to read from.
1866 /// \param[out] buf block of memory to write data to.
1867 /// \param[in] len length of data to read in bytes.
1868 /// \return number of bytes successfully read.
1869 extern uint32_t netFTPc_fread (void *file, uint8_t *buf, uint32_t len);
1870 
1871 /// \brief Write block of data to local file in FTP client. [\ref interface]
1872 /// \param[in] file pointer to the file to write to.
1873 /// \param[in] buf block of memory to be written.
1874 /// \param[in] len length of data to write in bytes.
1875 /// \return number of bytes successfully written.
1876 extern uint32_t netFTPc_fwrite (void *file, const uint8_t *buf, uint32_t len);
1877 
1878 // ==== TFTP Server User API ====
1879 
1880 /// \brief Start the TFTP server. [\ref thread-safe]
1881 /// \return status code that indicates the execution status of the function.
1882 extern netStatus netTFTPs_Start (void);
1883 
1884 /// \brief Stop the TFTP server. [\ref thread-safe]
1885 /// \return status code that indicates the execution status of the function.
1886 extern netStatus netTFTPs_Stop (void);
1887 
1888 /// \brief Check if the TFTP server is running. [\ref thread-safe]
1889 /// \return
1890 /// - true = Server is running.
1891 /// - false = Server is not running.
1892 extern bool netTFTPs_Running (void);
1893 
1894 /// \brief Get port number of the TFTP server. [\ref thread-safe]
1895 /// \return port number.
1896 extern uint16_t netTFTPs_GetPort (void);
1897 
1898 /// \brief Set port number of the TFTP server. [\ref thread-safe]
1899 /// \param[in] port port number.
1900 /// \return status code that indicates the execution status of the function.
1901 extern netStatus netTFTPs_SetPort (uint16_t port);
1902 
1903 /// \brief Retrieve path to the root directory of TFTP server. [\ref thread-safe]
1904 /// \return pointer to root path, a null-terminated string.
1905 /// - NULL if root folder is disabled in the configuration.
1906 extern const char *netTFTPs_GetRootPath (void);
1907 
1908 /// \brief Set path to the root directory of TFTP server. [\ref thread-safe]
1909 /// \param[in] path new root path, a null-terminated string.
1910 /// \return status code that indicates the execution status of the function.
1911 extern netStatus netTFTPs_SetRootPath (const char *path);
1912 
1913 // ==== TFTP Server Access Interface ====
1914 
1915 /// \brief Accept or deny connection from a remote TFTP client. [\ref user-provided]
1916 /// \param[in] addr structure containing IP address and port of remote TFTP client.
1917 /// \return
1918 /// - true = Connection from the remote client is allowed.
1919 /// - false = Connection is denied.
1920 extern bool netTFTPs_AcceptClient (const NET_ADDR *addr);
1921 
1922 // ==== TFTP Server File System Interface ====
1923 
1924 /// \brief Open a file for reading or writing in the TFTP server. [\ref interface]
1925 /// \param[in] fname name of the file to open.
1926 /// \param[in] mode type of access:
1927 /// - "rb" = opens a file for reading.
1928 /// - "wb" = opens a file for writing.
1929 /// \return status information:
1930 /// - Pointer to an open file.
1931 /// - NULL in case of an error.
1932 extern void *netTFTPs_fopen (const char *fname, const char *mode);
1933 
1934 /// \brief Close a file previously open in the TFTP server. [\ref interface]
1935 /// \param[in] file pointer to the file to close.
1936 /// \return none.
1937 extern void netTFTPs_fclose (void *file);
1938 
1939 /// \brief Read block of data from a file in the TFTP server. [\ref interface]
1940 /// \param[in] file pointer to the file to read from.
1941 /// \param[out] buf block of memory to write data to.
1942 /// \param[in] len length of data to read in bytes.
1943 /// \return number of bytes successfully read.
1944 extern uint32_t netTFTPs_fread (void *file, uint8_t *buf, uint32_t len);
1945 
1946 /// \brief Write block of data to a file in the TFTP server. [\ref interface]
1947 /// \param[in] file pointer to the file to write to.
1948 /// \param[in] buf block of memory to be written.
1949 /// \param[in] len length of data to write in bytes.
1950 /// \return number of bytes successfully written.
1951 extern uint32_t netTFTPs_fwrite (void *file, const uint8_t *buf, uint32_t len);
1952 
1953 // ==== TFTP Client User API ====
1954 
1955 /// \brief Put a file to a remote TFTP server. [\ref thread-safe]
1956 /// \param[in] addr structure containing IP address and port of remote TFTP server.
1957 /// \param[in] fname pointer to the remote file name, a null-terminated string.
1958 /// \param[in] local_fname pointer to the local file name, a null-terminated string.
1959 /// \return status code that indicates the execution status of the function.
1960 extern netStatus netTFTPc_Put (const NET_ADDR *addr, const char *fname, const char *local_fname);
1961 
1962 /// \brief Retrieve a file from a remote TFTP server. [\ref thread-safe]
1963 /// \param[in] addr structure containing IP address and port of remote TFTP server.
1964 /// \param[in] fname pointer to the remote file name, a null-terminated string.
1965 /// \param[in] local_fname pointer to the local file name, a null-terminated string.
1966 /// \return status code that indicates the execution status of the function.
1967 extern netStatus netTFTPc_Get (const NET_ADDR *addr, const char *fname, const char *local_fname);
1968 
1969 // ==== TFTP Client User Callbacks ====
1970 
1971 /// \brief Notify the user application when TFTP client operation ends. [\ref user-provided]
1972 /// \param[in] event TFTP client notification event as specified in \ref netTFTPc_Event.
1973 /// \return none.
1974 /// \note Network library calls this function to inform the user about events.
1975 extern void netTFTPc_Notify (netTFTPc_Event event);
1976 
1977 // ==== TFTP Client File System Interface ====
1978 
1979 /// \brief Open local file for reading or writing in the TFTP client. [\ref interface]
1980 /// \param[in] fname name of the file to open.
1981 /// \param[in] mode type of access:
1982 /// - "rb" = opens a file for reading.
1983 /// - "wb" = opens a file for writing.
1984 /// \return status information:
1985 /// - Pointer to an open file.
1986 /// - NULL in case of an error.
1987 extern void *netTFTPc_fopen (const char *fname, const char *mode);
1988 
1989 /// \brief Close local file previously open in the TFTP client. [\ref interface]
1990 /// \param[in] file pointer to the file to close.
1991 /// \return none.
1992 extern void netTFTPc_fclose (void *file);
1993 
1994 /// \brief Read block of data from local file in the TFTP client. [\ref interface]
1995 /// \param[in] file pointer to the file to read from.
1996 /// \param[out] buf block of memory to write data to.
1997 /// \param[in] len length of data to read in bytes.
1998 /// \return number of bytes successfully read.
1999 extern uint32_t netTFTPc_fread (void *file, uint8_t *buf, uint32_t len);
2000 
2001 /// \brief Write block of data to local file in the TFTP client. [\ref interface]
2002 /// \param[in] file pointer to the file to write to.
2003 /// \param[in] buf block of memory to be written.
2004 /// \param[in] len length of data to write in bytes.
2005 /// \return number of bytes successfully written.
2006 extern uint32_t netTFTPc_fwrite (void *file, const uint8_t *buf, uint32_t len);
2007 
2008 // ==== Telnet Server User API ====
2009 
2010 /// \brief Start the Telnet server. [\ref thread-safe]
2011 /// \return status code that indicates the execution status of the function.
2012 extern netStatus netTELNETs_Start (void);
2013 
2014 /// \brief Stop the Telnet server. [\ref thread-safe]
2015 /// \return status code that indicates the execution status of the function.
2016 extern netStatus netTELNETs_Stop (void);
2017 
2018 /// \brief Check if the Telnet server is running. [\ref thread-safe]
2019 /// \return
2020 /// - true = Server is running.
2021 /// - false = Server is not running.
2022 extern bool netTELNETs_Running (void);
2023 
2024 /// \brief Get port number of the Telnet server. [\ref thread-safe]
2025 /// \return port number.
2026 extern uint16_t netTELNETs_GetPort (void);
2027 
2028 /// \brief Set port number of the Telnet server. [\ref thread-safe]
2029 /// \param[in] port port number.
2030 /// \return status code that indicates the execution status of the function.
2031 extern netStatus netTELNETs_SetPort (uint16_t port);
2032 
2033 /// \brief Retrieve username of the built-in user account. [\ref thread-safe]
2034 /// \return pointer to username, a null-terminated string.
2035 /// - NULL if authentication is disabled in the configuration.
2036 extern const char *netTELNETs_GetUsername (void);
2037 
2038 /// \brief Set username of the built-in user account. [\ref thread-safe]
2039 /// \param[in] username new username, a null-terminated string.
2040 /// \return status code that indicates the execution status of the function.
2041 extern netStatus netTELNETs_SetUsername (const char *username);
2042 
2043 /// \brief Retrieve password of the built-in user account. [\ref thread-safe]
2044 /// \return pointer to password, a null-terminated string.
2045 /// - NULL if authentication is disabled in the configuration.
2046 extern const char *netTELNETs_GetPassword (void);
2047 
2048 /// \brief Reset password of the built-in user account. [\ref thread-safe]
2049 /// \param[in] password new password, a null-terminated string.
2050 /// \return status code that indicates the execution status of the function.
2051 extern netStatus netTELNETs_SetPassword (const char *password);
2052 
2053 /// \brief Determine if Telnet server authentication is enabled. [\ref thread-safe]
2054 /// \return
2055 /// - true = Authentication enabled in the configuration.
2056 /// - false = Authentication is not enabled.
2057 extern bool netTELNETs_LoginActive (void);
2058 
2059 /// \brief Enable or disable Telnet server authentication. [\ref thread-safe]
2060 /// \param[in] login new authentication state:
2061 /// - true = Enable authentication.
2062 /// - false = Disable authentication.
2063 /// \return status code that indicates the execution status of the function.
2064 extern netStatus netTELNETs_LoginOnOff (bool login);
2065 
2066 /// \brief Get IP address and port number of a connected Telnet client. [\ref thread-safe]
2067 /// \param[out] addr structure that will receive IP address and port number.
2068 /// \param[in] addr_len size of NET_ADDR structure for the client.
2069 /// \return status code that indicates the execution status of the function.
2070 extern netStatus netTELNETs_GetClient (NET_ADDR *addr, uint32_t addr_len);
2071 
2072 /// \brief Get current session number of the Telnet server. [\ref thread-safe]
2073 /// \return current session number.
2074 extern int32_t netTELNETs_GetSession (void);
2075 
2076 /// \brief Check command string for a command. [\ref thread-safe]
2077 /// \param[in] cmd pointer to command string from Telnet client.
2078 /// \param[in] user_cmd user command to check for (in upper case).
2079 /// \return
2080 /// - true = Command found in command string.
2081 /// - false = Command not found.
2082 extern bool netTELNETs_CheckCommand (const char *cmd, const char *user_cmd);
2083 
2084 /// \brief Request a repeated call to netTELNETs_ProcessCommand function. [\ref thread-safe]
2085 /// \param[in] delay time period to wait in number of 100ms ticks.
2086 /// \return status code that indicates the execution status of the function.
2087 extern netStatus netTELNETs_RepeatCommand (uint32_t delay);
2088 
2089 /// \brief Request unsolicited message processing in netTELNETs_ProcessMessage function. [\ref thread-safe]
2090 /// \param[in] session session identification, when multiple connections are active.
2091 /// \return status code that indicates the execution status of the function.
2092 extern netStatus netTELNETs_RequestMessage (int32_t session);
2093 
2094 // ==== Telnet Server User Callbacks ====
2095 
2096 /// \brief Process and execute a command requested by the Telnet client. [\ref user-provided]
2097 /// \param[in] cmd pointer to command string from Telnet client.
2098 /// \param[out] buf output buffer to write the return message to.
2099 /// \param[in] buf_len length of the output buffer in bytes.
2100 /// \param[in,out] pvar pointer to a session's local buffer of 4 bytes.
2101 /// - 1st call = cleared to 0.
2102 /// - 2nd call = not altered by the system.
2103 /// - 3rd call = not altered by the system, etc.
2104 /// \return number of bytes written to output buffer.
2105 /// - return len | (1u<<31) = repeat flag, the system calls this function
2106 /// again for the same command.
2107 /// - return len | (1u<<30) = disconnect flag, the system disconnects
2108 /// the Telnet client.
2109 extern uint32_t netTELNETs_ProcessCommand (const char *cmd, char *buf, uint32_t buf_len, uint32_t *pvar);
2110 
2111 /// \brief Request a message for a Telnet server session. [\ref user-provided]
2112 /// \param[in] msg code of requested message.
2113 /// \param[out] buf output buffer to write the message to.
2114 /// \param[in] buf_len length of the output buffer in bytes.
2115 /// \return number of bytes written to output buffer.
2116 extern uint32_t netTELNETs_ProcessMessage (netTELNETs_Message msg, char *buf, uint32_t buf_len);
2117 
2118 // ==== Telnet Server Access Interface ====
2119 
2120 /// \brief Accept or deny a connection from a remote Telnet client. [\ref user-provided]
2121 /// \param[in] addr structure containing IP address and port of remote Telnet client.
2122 /// \return
2123 /// - true = Connection from the remote client is allowed.
2124 /// - false = Connection is denied.
2125 extern bool netTELNETs_AcceptClient (const NET_ADDR *addr);
2126 
2127 // ==== Telnet Server Multi-User Interface ====
2128 
2129 /// \brief Check if an user account exist in the user database. [\ref user-provided]
2130 /// \param[in] username pointer to username.
2131 /// \return status information:
2132 /// - User identification number.
2133 /// - 0 if the user is not existing.
2134 extern uint8_t netTELNETs_CheckUsername (const char *username);
2135 
2136 /// \brief Check user account password in the user database. [\ref user-provided]
2137 /// \param[in] user_id user identification number.
2138 /// \param[in] password pointer to password.
2139 /// \return
2140 /// - true = password accepted.
2141 /// - false = invalid password.
2142 extern bool netTELNETs_CheckPassword (uint8_t user_id, const char *password);
2143 
2144 /// \brief Retrieve the user identification number. [\ref thread-safe]
2145 /// \return user identification number (0 = system administrator).
2146 extern uint8_t netTELNETs_GetUserId (void);
2147 
2148 // ==== HTTP Server User API ====
2149 
2150 /// \brief Start the HTTP server. [\ref thread-safe]
2151 /// \return status code that indicates the execution status of the function.
2152 extern netStatus netHTTPs_Start (void);
2153 
2154 /// \brief Stop the HTTP server. [\ref thread-safe]
2155 /// \return status code that indicates the execution status of the function.
2156 extern netStatus netHTTPs_Stop (void);
2157 
2158 /// \brief Check if the HTTP server is running. [\ref thread-safe]
2159 /// \return
2160 /// - true = Server is running.
2161 /// - false = Server is not running.
2162 extern bool netHTTPs_Running (void);
2163 
2164 /// \brief Get port number of the HTTP server. [\ref thread-safe]
2165 /// \return port number.
2166 extern uint16_t netHTTPs_GetPort (void);
2167 
2168 /// \brief Set port number of the HTTP server. [\ref thread-safe]
2169 /// \param[in] port port number.
2170 /// \return status code that indicates the execution status of the function.
2171 extern netStatus netHTTPs_SetPort (uint16_t port);
2172 
2173 /// \brief Retrieve path to the root directory of HTTP server. [\ref thread-safe]
2174 /// \return pointer to root path, a null-terminated string.
2175 /// - NULL if root folder is disabled in the configuration.
2176 extern const char *netHTTPs_GetRootPath (void);
2177 
2178 /// \brief Set path to the root directory of HTTP server. [\ref thread-safe]
2179 /// \param[in] path new root path, a null-terminated string.
2180 /// \return status code that indicates the execution status of the function.
2181 extern netStatus netHTTPs_SetRootPath (const char *path);
2182 
2183 /// \brief Retrieve username of the built-in user account. [\ref thread-safe]
2184 /// \return pointer to username, a null-terminated string.
2185 /// - NULL if authentication is disabled in the configuration.
2186 extern const char *netHTTPs_GetUsername (void);
2187 
2188 /// \brief Set username of the built-in user account. [\ref thread-safe]
2189 /// \param[in] username new username, a null-terminated string.
2190 /// \return status code that indicates the execution status of the function.
2191 extern netStatus netHTTPs_SetUsername (const char *username);
2192 
2193 /// \brief Retrieve password of the built-in user account. [\ref thread-safe]
2194 /// \return pointer to password, a null-terminated string.
2195 /// - NULL if authentication is disabled in the configuration.
2196 extern const char *netHTTPs_GetPassword (void);
2197 
2198 /// \brief Reset password of the built-in user account. [\ref thread-safe]
2199 /// \param[in] password new password, a null-terminated string.
2200 /// \return status code that indicates the execution status of the function.
2201 extern netStatus netHTTPs_SetPassword (const char *password);
2202 
2203 /// \brief Determine if the HTTP server authentication is enabled. [\ref thread-safe]
2204 /// \return
2205 /// - true = Authentication enabled in the configuration.
2206 /// - false = Authentication is not enabled.
2207 extern bool netHTTPs_LoginActive (void);
2208 
2209 /// \brief Enable or disable HTTP server authentication. [\ref thread-safe]
2210 /// \param[in] login new authentication state:
2211 /// - true = Enable authentication.
2212 /// - false = Disable authentication.
2213 /// \return status code that indicates the execution status of the function.
2214 extern netStatus netHTTPs_LoginOnOff (bool login);
2215 
2216 /// \brief Get IP address and port number of a connected remote HTTP client. [\ref thread-safe]
2217 /// \param[out] addr structure that will receive IP address and port number.
2218 /// \param[in] addr_len size of NET_ADDR structure for the client.
2219 /// \return status code that indicates the execution status of the function.
2220 extern netStatus netHTTPs_GetClient (NET_ADDR *addr, uint32_t addr_len);
2221 
2222 /// \brief Get current session number of the HTTP server. [\ref thread-safe]
2223 /// \return current session number.
2224 extern int32_t netHTTPs_GetSession (void);
2225 
2226 /// \brief Retrieve the preferred language setting from the browser. [\ref thread-safe]
2227 /// \return pointer to the language code, a null-terminated string.
2228 extern const char *netHTTPs_GetLanguage (void);
2229 
2230 /// \brief Get Content-Type HTML header, received in XML post request. [\ref thread-safe]
2231 /// \return pointer to content type header, a null-terminated string.
2232 extern const char *netHTTPs_GetContentType (void);
2233 
2234 // ==== HTTP Server Access Interface ====
2235 
2236 /// \brief Accept or deny a connection from a remote HTTP client. [\ref user-provided]
2237 /// \param[in] addr structure containing IP address and port of remote HTTP client.
2238 /// \return
2239 /// - true = Connection from the remote client is allowed.
2240 /// - false = Connection is denied.
2241 extern bool netHTTPs_AcceptClient (const NET_ADDR *addr);
2242 
2243 // ==== HTTP Server Multi-User Interface ====
2244 
2245 /// \brief Check if an user account exist in the user database. [\ref user-provided]
2246 /// \param[in] username pointer to username.
2247 /// \param[in] password pointer to password.
2248 /// \return status information:
2249 /// - User identification number.
2250 /// - 0 if the user is not existing.
2251 extern uint8_t netHTTPs_CheckAccount (const char *username, const char *password);
2252 
2253 /// \brief Retrieve the secret word for the selected user. [\ref user-provided]
2254 /// \param[in] user_id user identification number.
2255 /// \param[out] buf buffer to store the secret word to.
2256 /// \param[in] buf_len length of buffer.
2257 /// \return none.
2258 extern void netHTTPs_GetUserSecret (uint8_t user_id, char *buf, uint32_t buf_len);
2259 
2260 /// \brief Check if remote user is allowed to access a file on HTTP server. [\ref user-provided]
2261 /// \param[in] user_id user identification number.
2262 /// \param[in] fname name of a file to access.
2263 /// \return
2264 /// - true = File access is allowed.
2265 /// - false = File access is denied.
2266 extern bool netHTTPs_FileAccess (uint8_t user_id, const char *fname);
2267 
2268 /// \brief Retrieve the user identification. [\ref thread-safe]
2269 /// \return user identification number (0 = system administrator).
2270 extern uint8_t netHTTPs_GetUserId (void);
2271 
2272 /// \brief Calculate HA1 hash value for the given credentials. [\ref thread-safe]
2273 /// \param[in] username username, a null-terminated string.
2274 /// \param[in] password password, a null-terminated string.
2275 /// \param[out] buf buffer to store the hash value to.
2276 /// \param[in] buf_len length of buffer.
2277 /// \return status code that indicates the execution status of the function.
2278 extern netStatus netHTTPs_CalcHashHA1 (const char *username, const char *password, char *buf, uint32_t buf_len);
2279 
2280 // ==== HTTP Server File System Interface ====
2281 
2282 /// \brief Open a file for reading in HTTP server. [\ref interface]
2283 /// \param[in] fname name of the file to open.
2284 /// \return status information:
2285 /// - Pointer to an open file.
2286 /// - NULL in case of an error.
2287 extern void *netHTTPs_fopen (const char *fname);
2288 
2289 /// \brief Close a file previously open in HTTP server. [\ref interface]
2290 /// \param[in] file pointer to the file to close.
2291 /// \return none.
2292 extern void netHTTPs_fclose (void *file);
2293 
2294 /// \brief Read block of data from a file in HTTP server. [\ref interface]
2295 /// \param[in] file pointer to the file to read from.
2296 /// \param[out] buf block of memory to write data to.
2297 /// \param[in] len length of data to read in bytes.
2298 /// \return number of bytes successfully read.
2299 extern uint32_t netHTTPs_fread (void *file, uint8_t *buf, uint32_t len);
2300 
2301 /// \brief Read a string from a file in HTTP server. [\ref interface]
2302 /// \param[in] file pointer to the file to read from.
2303 /// \param[out] buf output buffer to write data to.
2304 /// \param[in] size size of output buffer.
2305 /// \return status information:
2306 /// - Pointer to string on success.
2307 /// - NULL in case of an error.
2308 extern char *netHTTPs_fgets (void *file, char *buf, uint32_t size);
2309 
2310 /// \brief Retrieve file size and last modification time. [\ref interface]
2311 /// \param[in] fname name of the file.
2312 /// \param[out] fsize file size in bytes.
2313 /// \param[out] ftime created or last modified time.
2314 /// \return none.
2315 extern void netHTTPs_fstat (const char *fname, uint32_t *fsize, uint32_t *ftime);
2316 
2317 // ==== HTTP Server CGI ====
2318 
2319 /// \brief Process query string received by GET request. [\ref user-provided]
2320 /// \param[in] qstr pointer to the query string.
2321 /// \return none.
2322 extern void netCGI_ProcessQuery (const char *qstr);
2323 
2324 /// \brief Process data received by POST request. [\ref user-provided]
2325 /// \param[in] code callback context:
2326 /// - 0 = www-url-encoded form data.
2327 /// - 1 = filename for file upload (null-terminated string).
2328 /// - 2 = file upload raw data.
2329 /// - 3 = end of file upload (file close requested).
2330 /// - 4 = any other type of POST data (single or last stream).
2331 /// - 5 = the same as 4, but with more data to follow.
2332 /// \param[in] data pointer to POST data.
2333 /// \param[in] len length of POST data.
2334 /// \return none.
2335 extern void netCGI_ProcessData (uint8_t code, const char *data, uint32_t len);
2336 
2337 /// \brief Generate dynamic web data based on a CGI script. [\ref user-provided]
2338 /// \param[in] env environment string.
2339 /// \param[out] buf output data buffer.
2340 /// \param[in] buf_len size of output buffer (from 536 to 1440 bytes).
2341 /// \param[in,out] pcgi pointer to a session's local buffer of 4 bytes.
2342 /// - 1st call = cleared to 0.
2343 /// - 2nd call = not altered by the system.
2344 /// - 3rd call = not altered by the system, etc.
2345 /// \return number of bytes written to output buffer.
2346 /// - return len | (1U<<31) = repeat flag, the system calls this function
2347 /// again for the same script line.
2348 /// - return len | (1U<<30) = force transmit flag, the system transmits
2349 /// current packet immediately.
2350 extern uint32_t netCGI_Script (const char *env, char *buf, uint32_t buf_len, uint32_t *pcgi);
2351 
2352 /// \brief Process environment variables and convert to ANSI format. [\ref thread-safe]
2353 /// \param[in] env pointer to environment variables.
2354 /// \param[out] ansi output buffer to write converted variable to.
2355 /// \param[in] max_len maximum length of environment variable.
2356 /// \return status information:
2357 /// - pointer to the remaining environment variables to process.
2358 /// - NULL if there are no more environment variables to process.
2359 extern const char *netCGI_GetEnvVar (const char *env, char *ansi, uint32_t max_len);
2360 
2361 /// \brief Override default character encoding in HTML documents. [\ref user-provided]
2362 /// \return pointer to user defined character set type.
2363 extern const char *netCGI_Charset (void);
2364 
2365 /// \brief Add custom MIME type for unsupported file types. [\ref user-provided]
2366 /// \param[in] file_ext filename extension, a null-terminated string.
2367 /// \return MIME type information:
2368 /// - pointer to user defined Content-Type.
2369 /// - NULL for unknown type.
2370 extern const char *netCGI_ContentType (const char *file_ext);
2371 
2372 /// \brief Redirect resource URL address to a new location. [\ref user-provided]
2373 /// \param[in] file_name resource filename, a null-terminated string.
2374 /// \return URL redirection information:
2375 /// - pointer to user defined Location.
2376 /// - NULL for no URL address redirection.
2377 extern const char *netCGI_Redirect (const char *file_name);
2378 
2379 /// \brief Override default Content-Type for CGX script files. [\ref user-provided]
2380 /// \return pointer to user defined Content-Type.
2381 extern const char *netCGX_ContentType (void);
2382 
2383 /// \brief Add custom HTTP response header. [\ref user-provided]
2384 /// \return pointer to user defined HTTP header.
2385 extern const char *netCGI_CustomHeader (void);
2386 
2387 // ==== SMTP Client User API ====
2388 
2389 /// \brief Start SMTP client to send an email in legacy mode. [\ref thread-safe]
2390 /// \param[in] addr structure containing IP address and port of SMTP server.
2391 /// \return status code that indicates the execution status of the function.
2392 extern netStatus netSMTPc_Connect (const NET_ADDR *addr);
2393 
2394 /// \brief Send an email in blocking mode. [\ref thread-safe]
2395 /// \param[in] mail pointer to email content descriptor.
2396 /// \param[in] mta pointer to mail transfer agent descriptor.
2397 /// \return status code that indicates the execution status of the function.
2398 extern netStatus netSMTPc_SendMail (const NET_SMTP_MAIL *mail, const NET_SMTP_MTA *mta);
2399 
2400 // ==== SMTP Client User Callbacks ====
2401 
2402 /// \brief Request parameters for SMTP client session. [\ref user-provided]
2403 /// \param[in] request request code.
2404 /// \param[out] buf output buffer to write the data to.
2405 /// \param[in] buf_len length of the output buffer in bytes.
2406 /// \param[in,out] pvar pointer to a session's local buffer of 4 bytes.
2407 /// - 1st call = cleared to 0.
2408 /// - 2nd call = not altered by the system.
2409 /// - 3rd call = not altered by the system, etc.
2410 /// \return number of bytes written to output buffer.
2411 /// - return len | (1u<<31) = repeat flag, the system calls this function
2412 /// again when \a request is \ref netSMTPc_RequestBody.
2413 extern uint32_t netSMTPc_Process (netSMTPc_Request request, char *buf, uint32_t buf_len, uint32_t *pvar);
2414 
2415 /// \brief Notify the user application when SMTP client operation ends. [\ref user-provided]
2416 /// \param[in] event SMTP client notification event as specified in \ref netSMTPc_Event.
2417 /// \return none.
2418 /// \note Network library calls this function to inform the user about events.
2419 extern void netSMTPc_Notify (netSMTPc_Event event);
2420 
2421 /// \brief Accept or deny authentication requested by SMTP server. [\ref user-provided]
2422 /// \param[in] addr structure containing IP address and port of SMTP server.
2423 /// \return
2424 /// - true = Authentication is accepted.
2425 /// - false = Authentication is denied.
2426 extern bool netSMTPc_AcceptAuthentication (const NET_ADDR *addr);
2427 
2428 // ==== SMTP Client File System Interface ====
2429 
2430 /// \brief Open a file for reading in SMTP client. [\ref interface]
2431 /// \param[in] fname name of the file to open.
2432 /// \return status information:
2433 /// - Pointer to an open file.
2434 /// - NULL in case of an error.
2435 extern void *netSMTPc_fopen (const char *fname);
2436 
2437 /// \brief Close a file previously open in SMTP client. [\ref interface]
2438 /// \param[in] file pointer to the file to close.
2439 /// \return none.
2440 extern void netSMTPc_fclose (void *file);
2441 
2442 /// \brief Read block of data from a file in SMTP client. [\ref interface]
2443 /// \param[in] file pointer to the file to read from.
2444 /// \param[out] buf block of memory to write data to.
2445 /// \param[in] len length of data to read in bytes.
2446 /// \return number of bytes successfully read.
2447 extern uint32_t netSMTPc_fread (void *file, uint8_t *buf, uint32_t len);
2448 
2449 // ==== SNTP Client User API ====
2450 
2451 /// \brief Set mode of operation for SNTP client. [\ref thread-safe]
2452 /// \param[in] mode SNTP client operation mode.
2453 /// \return status code that indicates the execution status of the function.
2455 
2456 /// \brief Determine current time from NTP or SNTP time server. [\ref thread-safe]
2457 /// \param[in] addr structure containing IP address of NTP or SNTP server.
2458 /// - NULL to use NTP server IP address from system configuration.
2459 /// \param[in] cb_func callback function to call, when the session ends.
2460 /// \return status code that indicates the execution status of the function.
2461 extern netStatus netSNTPc_GetTime (const NET_ADDR *addr, netSNTPc_cb_t cb_func);
2462 
2463 /// \brief Determine current time from NTP or SNTP time server in blocking mode. [\ref thread-safe]
2464 /// \param[in] server server name or absolute IP address (FQDN or IP address).
2465 /// - NULL to use NTP server IP address from system configuration.
2466 /// \param[out] seconds pointer to the variable to return time in seconds.
2467 /// \param[out] seconds_fraction
2468 /// pointer to the variable to return fraction of seconds.
2469 /// - NULL for none.
2470 /// \return status code that indicates the execution status of the function.
2471 extern netStatus netSNTPc_GetTimeX (const char *server, uint32_t *seconds, uint32_t *seconds_fraction);
2472 
2473 // ==== SNMP Agent User API ====
2474 
2475 /// \brief Send a trap message to the Trap Manager. [\ref thread-safe]
2476 /// \param[in] addr structure containing IP address of the Trap server.
2477 /// - NULL to use Trap server IP address from system configuration.
2478 /// \param[in] generic generic trap type:
2479 /// - 0 = ColdStart trap.
2480 /// - 1 = WarmStart trap.
2481 /// - 2 = LinkDown trap.
2482 /// - 3 = LinkUp trap.
2483 /// - 4 = AuthenticationFailure trap.
2484 /// - 5 = EgpNeighborLoss trap.
2485 /// - 6 = EnterpriseSpecific trap.
2486 /// \param[in] specific specific trap type for generic enterpriseSpecific trap:
2487 /// - must be set to 0 for generic traps 0 ... 5
2488 /// \param[in] obj_list object list included in trap message.
2489 /// \return status code that indicates the execution status of the function.
2490 extern netStatus netSNMP_Trap (const NET_ADDR *addr, uint8_t generic, uint8_t specific, const uint16_t *obj_list);
2491 
2492 /// \brief Change SNMP community to a new community. [\ref thread-safe]
2493 /// \param[in] community new community, a null-terminated string.
2494 /// \return status code that indicates the execution status of the function.
2495 extern netStatus netSNMP_SetCommunity (const char *community);
2496 
2497 /// \brief Register MIB table to SNMP Agent. [\ref thread-safe]
2498 /// \param[in] info pointer to MIB table.
2499 /// \param[in] size size of MIB table in bytes.
2500 /// \return status code that indicates the execution status of the function.
2501 extern netStatus netSNMP_SetMIB_Table (const NET_SNMP_MIB_INFO *info, uint32_t size);
2502 
2503 // ==== Network Address Conversion ====
2504 
2505 /// \brief Convert IP address from binary to text form. [\ref thread-safe]
2506 /// \param[in] addr_type network address type:
2507 /// - NET_ADDR_IP4 = IPv4 address.
2508 /// - NET_ADDR_IP6 = IPv6 address.
2509 /// \param[in] ip_addr IPv4 or IPv6 address in binary form.
2510 /// \param[out] string_buf buffer to store converted IP address to.
2511 /// \param[in] buf_len length of a string buffer, at least:
2512 /// - 16 characters for IPv4 address.
2513 /// - 40 characters for IPv6 address.
2514 /// \return pointer to \a string_buf with null-terminated IP address string.
2515 /// - NULL in case of parameter error.
2516 extern const char *netIP_ntoa (int16_t addr_type, const uint8_t *ip_addr, char *string_buf, uint32_t buf_len);
2517 
2518 /// \brief Convert IP address from text to binary form. [\ref thread-safe]
2519 /// \param[in] addr_string network address string:
2520 /// - in dotted-decimal IPv4 notation.
2521 /// - in compressed colon-hexadecimal IPv6 notation.
2522 /// \param[in] addr_type network address type:
2523 /// - NET_ADDR_IP4 = IPv4 address.
2524 /// - NET_ADDR_IP6 = IPv6 address.
2525 /// \param[out] ip_addr IPv6 or IPv6 address in binary form.
2526 /// \return
2527 /// - true = Conversion successful.
2528 /// - false = Conversion failed.
2529 extern bool netIP_aton (const char *addr_string, int16_t addr_type, uint8_t *ip_addr);
2530 
2531 /// \brief Convert MAC address from binary to text form. [\ref thread-safe]
2532 /// \param[in] mac_addr MAC address in binary form.
2533 /// \param[out] string_buf buffer to store converted MAC address to.
2534 /// \param[in] buf_len length of a string buffer, at least 18 characters.
2535 /// \return pointer to \a string_buf with null-terminated MAC address string.
2536 /// - NULL in case of parameter error.
2537 extern const char *netMAC_ntoa (const uint8_t *mac_addr, char *string_buf, uint32_t buf_len);
2538 
2539 /// \brief Convert MAC address from text to binary form. [\ref thread-safe]
2540 /// \param[in] mac_string address string in hyphen MAC-address notation.
2541 /// \param[out] mac_addr MAC address in binary form.
2542 /// \return
2543 /// - true = Conversion successful.
2544 /// - false = Conversion failed.
2545 extern bool netMAC_aton (const char *mac_string, uint8_t *mac_addr);
2546 
2547 #ifdef __cplusplus
2548 }
2549 #endif
2550 
2551 #endif /* __RL_NET_DS_H */
Incorrect login error message.
Definition: rl_net_ds.h:629
Username to login to SMTP server.
Definition: rl_net_ds.h:637
netWiFi_Security
WiFi Security Types.
Definition: rl_net_ds.h:443
netUDP_Option
UDP Socket Options.
Definition: rl_net_ds.h:101
Username request login message.
Definition: rl_net_ds.h:627
void * netFTPs_fopen(const char *fname, const char *mode)
Open a file for reading or writing in FTP server. [interface].
File or Directory name for FTP commands.
Definition: rl_net_ds.h:593
Makes a directory on FTP server.
Definition: rl_net_ds.h:566
netWiFi_Security security
Security type.
Definition: rl_net_ds.h:471
Generic IPv6 Address structure.
Definition: rl_net_ds.h:273
Erroneous response packet.
Definition: rl_net_ds.h:555
netStatus netUDP_Send(int32_t socket, const NET_ADDR *addr, uint8_t *buf, uint32_t len)
Send data to a remote node. [thread-safe].
int sendto(int sock, const char *buf, int len, int flags, const SOCKADDR *to, int tolen)
Send data to endpoint node. [thread-safe].
void * netSMTPc_fopen(const char *fname)
Open a file for reading in SMTP client. [interface].
Probed Host responded.
Definition: rl_net_ds.h:546
netStatus netFTPs_Start(void)
Start FTP server. [thread-safe].
uint32_t(* netUDP_cb_t)(int32_t socket, const NET_ADDR *addr, const uint8_t *buf, uint32_t len)
UDP Event callback function.
Definition: rl_net_ds.h:111
netStatus netDHCP_Disable(uint32_t if_id)
Disable Dynamic Host Configuration at runtime. [thread-safe].
netFTPc_Request
FTP Client Requests.
Definition: rl_net_ds.h:589
Wrong state error.
Definition: rl_net_ds.h:87
Host name successfully resolved.
Definition: rl_net_ds.h:552
BSSID of AP.
Definition: rl_net_ds.h:453
uint16_t Flags
Service control flags.
Definition: rl_net_ds.h:672
netStatus netTCP_ReleaseSocket(int32_t socket)
Release TCP socket and free resources. [thread-safe].
IN6_ADDR sin6_addr
IP6 address.
Definition: rl_net_ds.h:300
netStatus netSYS_SetHostName(const char *hostname)
Set localhost name. [thread-safe].
netStatus netTCP_SetOption(int32_t socket, netTCP_Option option, uint32_t val)
Set TCP socket IP option. [thread-safe].
With Push Button Configuration.
Definition: rl_net_ds.h:463
netStatus netTELNETs_SetUsername(const char *username)
Set username of the built-in user account. [thread-safe].
uint8_t netHTTPs_GetUserId(void)
Retrieve the user identification. [thread-safe].
uint8_t min
Minutes [0..59].
Definition: rl_net_ds.h:731
bool netFTPs_Running(void)
Check if FTP server is running. [thread-safe].
void netHTTPs_GetUserSecret(uint8_t user_id, char *buf, uint32_t buf_len)
Retrieve the secret word for the selected user. [user-provided].
uint32_t sin6_flowinfo
IP6 flow information.
Definition: rl_net_ds.h:299
Generic IPv4 Address structure.
Definition: rl_net_ds.h:260
uint32_t cmsg_len
Data byte count, including the cmsghdr.
Definition: rl_net_ds.h:367
netWiFi_WPS wps_method
WiFi Protected Setup method.
Definition: rl_net_ds.h:474
uint8_t code
Option type code.
Definition: rl_net_ds.h:513
netStatus netHTTPs_SetUsername(const char *username)
Set username of the built-in user account. [thread-safe].
netStatus netNDP_ProbeX(uint32_t if_id, const uint8_t *ip6_addr)
Determine whether the IP address is already in use in blocking mode. [thread-safe].
netStatus netFTPs_SetUsername(const char *username)
Set username of the built-in user account. [thread-safe].
netStatus netIF_GetOption(uint32_t if_id, netIF_Option option, uint8_t *buf, uint32_t buf_len)
Get the current value of an Interface option. [thread-safe].
netStatus netTFTPs_SetRootPath(const char *path)
Set path to the root directory of TFTP server. [thread-safe].
Waiting for last ACK for our FIN.
Definition: rl_net_ds.h:134
uint32_t netCGI_Script(const char *env, char *buf, uint32_t buf_len, uint32_t *pcgi)
Generate dynamic web data based on a CGI script. [user-provided].
netStatus netWiFi_Activate(uint32_t if_num, const NET_WIFI_CONFIG *config)
Activate the WiFi interface. [thread-safe].
bool netTELNETs_Running(void)
Check if the Telnet server is running. [thread-safe].
void netETH_ReceiveRaw(uint32_t if_num, const uint8_t *buf, uint32_t len)
Receive raw Ethernet data. [user-provided].
Operation timeout.
Definition: rl_net_ds.h:93
void * netFTPc_fopen(const char *fname, const char *mode)
Open local file for reading or writing in FTP client. [interface].
BSD scatter/gather array of items.
Definition: rl_net_ds.h:349
uint8_t netTELNETs_GetUserId(void)
Retrieve the user identification number. [thread-safe].
void netFTPs_fclose(void *file)
Close a file previously open in FTP server. [interface].
Not used.
Definition: rl_net_ds.h:462
uint8_t * value
Pointer to Option value.
Definition: rl_net_ds.h:515
DNS host resolver failed.
Definition: rl_net_ds.h:91
netFTP_Command
FTP Commands.
Definition: rl_net_ds.h:559
int closesocket(int sock)
Close socket and release socket descriptor. [thread-safe].
bool netHTTPs_LoginActive(void)
Determine if the HTTP server authentication is enabled. [thread-safe].
netStatus netPPP_Listen(const char *username, const char *password)
Start PPP interface to accept incoming PPP connection. [thread-safe].
uint8_t sec
Seconds [0..59].
Definition: rl_net_ds.h:732
netStatus netICMP_SetNoEcho(uint32_t if_id, bool no_echo)
Enable or disable ICMP Echo response. [thread-safe].
int32_t cmsg_type
Protocol-specific type.
Definition: rl_net_ds.h:369
netStatus netUDP_Open(int32_t socket, uint16_t port)
Open UDP socket for communication. [thread-safe].
netTCP_Event
TCP Socket Events.
Definition: rl_net_ds.h:114
BSD Host Entry structure.
Definition: rl_net_ds.h:312
Requested file operation denied.
Definition: rl_net_ds.h:582
IN_ADDR sin_addr
IP address.
Definition: rl_net_ds.h:291
IP version 6.
Definition: rl_net_ds.h:416
IPv6 Static Address (16 bytes)
Definition: rl_net_ds.h:405
#define NET_ADDR_IP4_LEN
IPv4 Address Length in bytes.
Definition: rl_net_ds.h:46
uint32_t netHTTPs_fread(void *file, uint8_t *buf, uint32_t len)
Read block of data from a file in HTTP server. [interface].
netStatus netTFTPs_Start(void)
Start the TFTP server. [thread-safe].
const char * Address
Server address (FQDN or IP address)
Definition: rl_net_ds.h:670
netStatus netSLIP_Close(void)
Disconnect SLIP link between two modems. [thread-safe].
const char * netCGX_ContentType(void)
Override default Content-Type for CGX script files. [user-provided].
Previously send data acknowledged.
Definition: rl_net_ds.h:119
TCP Delayed Acknowledgment; val: 0=disabled (default), 1=enabled.
Definition: rl_net_ds.h:146
Stateless DHCPv6 mode.
Definition: rl_net_ds.h:524
void netHTTPs_fclose(void *file)
Close a file previously open in HTTP server. [interface].
netDNSc_Event
DNS Client Callback Events.
Definition: rl_net_ds.h:551
netStatus netETH_SendRaw(uint32_t if_num, const uint8_t *buf, uint32_t len)
Send raw Ethernet data. [thread-safe].
void netCGI_ProcessData(uint8_t code, const char *data, uint32_t len)
Process data received by POST request. [user-provided].
netStatus netDHCP6_Enable(uint32_t if_id, netDHCP6_Mode mode)
Enable Dynamic Host Configuration version 6 at runtime. [thread-safe].
netStatus netNDP_ClearCache(uint32_t if_id)
Flush or clear the local NDP cache. [thread-safe].
netSNTPc_Mode
SNTP Client Mode.
Definition: rl_net_ds.h:678
netWiFi_WPS
WiFi WPS Methods.
Definition: rl_net_ds.h:461
netStatus netICMP6_SetNoEcho(uint32_t if_id, bool no_echo)
Enable or disable ICMPv6 Echo response. [thread-safe].
netStatus netTELNETs_RequestMessage(int32_t session)
Request unsolicited message processing in netTELNETs_ProcessMessage function. [thread-safe].
uint16_t year
Year [1980..2107].
Definition: rl_net_ds.h:735
DHCP Option Item.
Definition: rl_net_ds.h:512
netStatus netSMTPc_SendMail(const NET_SMTP_MAIL *mail, const NET_SMTP_MTA *mta)
Send an email in blocking mode. [thread-safe].
uint8_t type
Object Type.
Definition: rl_net_ds.h:720
const char * netHTTPs_GetRootPath(void)
Retrieve path to the root directory of HTTP server. [thread-safe].
netStatus netUDP_Close(int32_t socket)
Stop UDP communication and close socket. [thread-safe].
netStatus netPing_Echo(const NET_ADDR *addr, netPing_cb_t cb_func)
Start ICMP ping process. [thread-safe].
bool netFTPs_FileAccess(uint8_t user_id, const char *fname, uint32_t access)
Check if remote user is allowed to access a file on FTP server. [user-provided].
Stateful DHCPv6 mode.
Definition: rl_net_ds.h:525
File operation successful.
Definition: rl_net_ds.h:614
int inet_aton(const char *cp, IN_ADDR *addr)
Convert from text address to a network address. [thread-safe].
uint8_t reserved
Reserved.
Definition: rl_net_ds.h:473
#define FD_SETSIZE
BSD fd_set size.
Definition: rl_net_ds.h:325
IPv4 Socket Address structure.
Definition: rl_net_ds.h:288
const char * Cc
Carbon copy recipient(s), can be NULL.
Definition: rl_net_ds.h:660
File not found.
Definition: rl_net_ds.h:606
const char * netHTTPs_GetLanguage(void)
Retrieve the preferred language setting from the browser. [thread-safe].
Beacon interval.
Definition: rl_net_ds.h:457
Connection is for some reason aborted.
Definition: rl_net_ds.h:118
Unspecified error.
Definition: rl_net_ds.h:85
bool netMAC_aton(const char *mac_string, uint8_t *mac_addr)
Convert MAC address from text to binary form. [thread-safe].
netStatus netFTPs_Stop(void)
Stop FTP server. [thread-safe].
Operation succeeded.
Definition: rl_net_ds.h:83
int recvmsg(int sock, MSGHDR *msg, int flags)
Receive a message from a socket. [thread-safe].
netStatus netSNMP_Trap(const NET_ADDR *addr, uint8_t generic, uint8_t specific, const uint16_t *obj_list)
Send a trap message to the Trap Manager. [thread-safe].
Unicast mode to access public NTP server.
Definition: rl_net_ds.h:679
BSD message header structure.
Definition: rl_net_ds.h:355
Ethernet link information.
Definition: rl_net_ds.h:429
DTIM interval.
Definition: rl_net_ds.h:456
void(* netPing_cb_t)(netPing_Event event)
Ping Event callback function.
Definition: rl_net_ds.h:684
void netTFTPs_fclose(void *file)
Close a file previously open in the TFTP server. [interface].
const char * ssid
Network name, a null-terminated string.
Definition: rl_net_ds.h:469
int inet_pton(int af, const char *src, void *dst)
Convert from text address to a binary network address. [thread-safe].
void(* netNDP_cb_t)(netNDP_Event event)
NDP Probe Event callback function.
Definition: rl_net_ds.h:690
uint16_t netFTPs_GetPort(void)
Get port number of FTP server. [thread-safe].
Email address of the recipient.
Definition: rl_net_ds.h:640
netStatus netNDP_GetIP(uint32_t if_id, const uint8_t *mac_addr, uint8_t *ip6_addr)
Get IP address from neighbor discovery cache. [thread-safe].
int getpeername(int sock, SOCKADDR *name, int *namelen)
Retrieve IP address and port number of the endpoint node. [thread-safe].
Password to login to SMTP server.
Definition: rl_net_ds.h:638
uint8_t oid_len
Object ID length.
Definition: rl_net_ds.h:721
FS Interface Time info.
Definition: rl_net_ds.h:729
Timeout, no response to NDP probe.
Definition: rl_net_ds.h:547
const char * netHTTPs_GetPassword(void)
Retrieve password of the built-in user account. [thread-safe].
uint8_t * netUDP_GetBuffer(uint32_t size)
Allocate memory for UDP send buffer. [thread-safe].
void netTFTPc_Notify(netTFTPc_Event event)
Notify the user application when TFTP client operation ends. [user-provided].
int32_t netFTPs_ffind(const char *mask, char *fname, uint32_t *fsize, NET_FS_TIME *ftime, bool first)
Search the file system directory for matching files. [interface].
uint32_t(* netTCP_cb_t)(int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len)
TCP Event callback function.
Definition: rl_net_ds.h:150
File download ended.
Definition: rl_net_ds.h:576
TCP Keep Alive; val: 0=disabled (default), 1=enabled.
Definition: rl_net_ds.h:144
uint32_t iov_len
Number of bytes to transfer.
Definition: rl_net_ds.h:351
netStatus netHTTPs_CalcHashHA1(const char *username, const char *password, char *buf, uint32_t buf_len)
Calculate HA1 hash value for the given credentials. [thread-safe].
netStatus netARP_GetIP(uint32_t if_id, const uint8_t *mac_addr, uint8_t *ip4_addr)
Get IP address from the ARP cache. [thread-safe].
uint8_t netFTPs_CheckUsername(const char *username)
Check if an user account exists in the user database. [user-provided].
netStatus netHTTPs_Stop(void)
Stop the HTTP server. [thread-safe].
const char * netSYS_GetHostName(void)
Retrieve localhost name. [thread-safe].
netStatus netHTTPs_SetPort(uint16_t port)
Set port number of the HTTP server. [thread-safe].
File not found.
Definition: rl_net_ds.h:617
netFTPc_Event
FTP Client Events.
Definition: rl_net_ds.h:601
netPing_Event
Ping Callback Events.
Definition: rl_net_ds.h:529
Received data if LIST command is given.
Definition: rl_net_ds.h:596
Transmit Power.
Definition: rl_net_ds.h:454
void netFTPs_Notify(netFTPs_Event event)
Notify the user application about events in FTP server service. [user-provided].
netStatus netHTTPs_SetRootPath(const char *path)
Set path to the root directory of HTTP server. [thread-safe].
netStatus netSNTPc_GetTime(const NET_ADDR *addr, netSNTPc_cb_t cb_func)
Determine current time from NTP or SNTP time server. [thread-safe].
int connect(int sock, const SOCKADDR *addr, int addrlen)
Connect a socket to a remote host. [thread-safe].
uint16_t Port
Server port number, can be 0.
Definition: rl_net_ds.h:671
netStatus netUDP_SetOption(int32_t socket, netUDP_Option option, uint32_t val)
Set UDP socket IP option. [thread-safe].
IPv4 Type of Service; val=TOS.
Definition: rl_net_ds.h:102
uint32_t tv_usec
Time interval: microseconds.
Definition: rl_net_ds.h:335
User login failed (invalid credentials)
Definition: rl_net_ds.h:575
TCP Connection established.
Definition: rl_net_ds.h:136
Local file operation error.
Definition: rl_net_ds.h:583
bool netIP_aton(const char *addr_string, int16_t addr_type, uint8_t *ip_addr)
Convert IP address from text to binary form. [thread-safe].
SMTP Email Descriptor.
Definition: rl_net_ds.h:657
NET_DHCP_OPTION_ITEM netDHCP_PrivateOptionsTableN[]
DHCP Private Options.
Authentication failed, username/password invalid.
Definition: rl_net_ds.h:649
void * msg_control
Ancillary data.
Definition: rl_net_ds.h:360
uint32_t netTFTPc_fread(void *file, uint8_t *buf, uint32_t len)
Read block of data from local file in the TFTP client. [interface].
bool netFTPs_mkdir(const char *path)
Make a new directory in FTP server. [interface].
uint32_t msg_controllen
Ancillary data buffer length.
Definition: rl_net_ds.h:361
Local file read/write error.
Definition: rl_net_ds.h:608
void netDHCP6_Notify(uint32_t if_id, uint8_t option, const uint8_t *val, uint32_t len)
Notify the user of DHCPv6 event or extended DHCPv6 option. [user-provided].
Generic file operation error.
Definition: rl_net_ds.h:584
Socket waiting for incoming connection.
Definition: rl_net_ds.h:128
netTCP_State netTCP_GetState(int32_t socket)
Determine current state of a TCP socket. [thread-safe].
netStatus netIGMP_Leave(uint32_t if_id, const uint8_t *ip4_addr)
Leave a host group specified with IP address. [thread-safe].
const char * netMAC_ntoa(const uint8_t *mac_addr, char *string_buf, uint32_t buf_len)
Convert MAC address from binary to text form. [thread-safe].
int accept(int sock, SOCKADDR *addr, int *addrlen)
Accept connect request for a listening socket. [thread-safe].
Unknown security.
Definition: rl_net_ds.h:448
void(* netSNTPc_cb_t)(uint32_t seconds, uint32_t seconds_fraction)
SNTP Client callback function.
Definition: rl_net_ds.h:696
Renames a file on FTP server.
Definition: rl_net_ds.h:565
Login timeout error message.
Definition: rl_net_ds.h:630
Wired Equivalent Privacy.
Definition: rl_net_ds.h:445
netWiFi_Option
WiFi Driver Options.
Definition: rl_net_ds.h:452
netStatus netWiFi_GetOption(uint32_t if_num, netWiFi_Option option, void *buf, uint32_t buf_len)
Get the value of the WiFi driver option. [thread-safe].
Temporary IP address is removed after timeout.
Definition: rl_net_ds.h:499
uint32_t netFTPs_fwrite(void *file, const uint8_t *buf, uint32_t len)
Write block of data to a file in FTP server. [interface].
Our FIN ACK-ed, waiting for remote FIN.
Definition: rl_net_ds.h:132
uint32_t msg_namelen
Size of address buffer.
Definition: rl_net_ds.h:357
const char * inet_ntoa(IN_ADDR in)
Convert from network address to a text string. [not_thread-safe].
WiFi Scan information.
Definition: rl_net_ds.h:488
User logged out, session is idle.
Definition: rl_net_ds.h:574
uint32_t netTFTPs_fread(void *file, uint8_t *buf, uint32_t len)
Read block of data from a file in the TFTP server. [interface].
int16_t addr_type
IP address type: NET_ADDR_IP4 or NET_ADDR_IP6.
Definition: rl_net_ds.h:58
Connection established event.
Definition: rl_net_ds.h:116
bool netSMTPc_AcceptAuthentication(const NET_ADDR *addr)
Accept or deny authentication requested by SMTP server. [user-provided].
Probed Host responded.
Definition: rl_net_ds.h:540
Connect request received event.
Definition: rl_net_ds.h:115
uint8_t netFTPs_GetUserId(void)
Retrieve the user identification number. [thread-safe].
bool netPPP_LinkUp(void)
Determine the state of PPP link. [thread-safe].
void * netHTTPs_fopen(const char *fname)
Open a file for reading in HTTP server. [interface].
const char * netFTPs_GetUsername(void)
Retrieve username of the built-in user account. [thread-safe].
netStatus netTCP_Abort(int32_t socket)
Instantly stop TCP communication. [thread-safe].
netStatus netTCP_Connect(int32_t socket, const NET_ADDR *addr, uint16_t local_port)
Initiate a TCP connection to a remote node. [thread-safe].
netStatus netDNSc_GetHostByNameX(const char *name, int16_t addr_type, NET_ADDR *addr)
Resolve IP address of a host from a hostname in blocking mode. [thread-safe].
netStatus netTELNETs_GetClient(NET_ADDR *addr, uint32_t addr_len)
Get IP address and port number of a connected Telnet client. [thread-safe].
File operation successful.
Definition: rl_net_ds.h:602
const char * Subject
Subject of email, can be NULL.
Definition: rl_net_ds.h:662
Network Address IPv4 only.
Definition: rl_net_ds.h:64
netETH_Event
Ethernet Callback Events.
Definition: rl_net_ds.h:435
BSD timeval structure.
Definition: rl_net_ds.h:333
void netDHCP_Notify(uint32_t if_id, uint8_t option, const uint8_t *val, uint32_t len)
Notify the user of DHCP event or extended DHCP option. [user-provided].
Timer Alarm (PTP)
Definition: rl_net_ds.h:439
const char * Encoding
Default encoding type, can be NULL.
Definition: rl_net_ds.h:665
netStatus netDHCP_SetOption(uint32_t if_id, uint8_t option, const uint8_t *val, uint32_t len)
Set DHCP Option value at runtime. [thread-safe].
netARP_CacheType
ARP Cache Entry types.
Definition: rl_net_ds.h:497
bool netSLIP_LinkUp(void)
Determine the state of SLIP link. [thread-safe].
int listen(int sock, int backlog)
Set a socket in a listening mode. [thread-safe].
uint8_t netTELNETs_CheckUsername(const char *username)
Check if an user account exist in the user database. [user-provided].
void * netTFTPc_fopen(const char *fname, const char *mode)
Open local file for reading or writing in the TFTP client. [interface].
uint8_t day
Day [1..31].
Definition: rl_net_ds.h:733
netIF_Version
Interface IP Versions.
Definition: rl_net_ds.h:414
#define NET_ADDR_IP6_LEN
IPv6 Address Length in bytes.
Definition: rl_net_ds.h:47
IPv4 Type of Service; val=TOS.
Definition: rl_net_ds.h:141
const char * netTFTPs_GetRootPath(void)
Retrieve path to the root directory of TFTP server. [thread-safe].
const char * netCGI_Charset(void)
Override default character encoding in HTML documents. [user-provided].
netStatus netTELNETs_Stop(void)
Stop the Telnet server. [thread-safe].
IPv6 Maximum Transmission Unit (2 bytes)
Definition: rl_net_ds.h:403
netStatus netSLIP_Listen(void)
Start SLIP interface to accept incoming SLIP connections. [thread-safe].
int16_t sin6_family
Socket domain.
Definition: rl_net_ds.h:297
netDHCP6_Mode
DHCPv6 Modes.
Definition: rl_net_ds.h:523
uint32_t netTFTPc_fwrite(void *file, const uint8_t *buf, uint32_t len)
Write block of data to local file in the TFTP client. [interface].
WiFi Protected Access 2.
Definition: rl_net_ds.h:447
WiFi Configuration.
Definition: rl_net_ds.h:468
Username to login to FTP server.
Definition: rl_net_ds.h:590
Received FIN independently of our FIN.
Definition: rl_net_ds.h:133
int getsockname(int sock, SOCKADDR *name, int *namelen)
Retrieve local IP address and port number. [thread-safe].
bool netHTTPs_FileAccess(uint8_t user_id, const char *fname)
Check if remote user is allowed to access a file on HTTP server. [user-provided]. ...
netStatus netWiFi_GetNetInfo(uint32_t if_num, NET_WIFI_NET_INFO *net_info)
Get the network information of the WiFi interface. [thread-safe].
Login error, username/password invalid.
Definition: rl_net_ds.h:604
SNMP-MIB Entry information.
Definition: rl_net_ds.h:719
Generic FTP client error.
Definition: rl_net_ds.h:609
netARP_Event
ARP Probe Callback Events.
Definition: rl_net_ds.h:539
netStatus netTELNETs_LoginOnOff(bool login)
Enable or disable Telnet server authentication. [thread-safe].
int32_t msg_flags
Flags on received message.
Definition: rl_net_ds.h:362
IPv6 Traffic Class; val=TrafficClass.
Definition: rl_net_ds.h:104
bool netFTPs_frename(const char *fname, const char *newname)
Rename a file or directory in FTP server. [interface].
netStatus netDNSc_ClearCache(void)
Flush or clear the local DNS cache. [thread-safe].
netStatus netSNTPc_SetMode(netSNTPc_Mode mode)
Set mode of operation for SNTP client. [thread-safe].
Local file read/write error.
Definition: rl_net_ds.h:619
Subject of email.
Definition: rl_net_ds.h:641
netStatus netFTPs_SetPassword(const char *password)
Reset password of the built-in user account. [thread-safe].
netStatus netPPP_Connect(const char *dial_num, const char *username, const char *password)
Start a dial-up connection to remote PPP server. [thread-safe].
Driver error.
Definition: rl_net_ds.h:88
Timeout resolving host.
Definition: rl_net_ds.h:553
void netFTPc_Notify(netFTPc_Event event)
Notify the user application when FTP client operation ends. [user-provided].
Invalid parameter specified.
Definition: rl_net_ds.h:86
Working directory path on server for all commands.
Definition: rl_net_ds.h:592
uint8_t * netTCP_GetBuffer(uint32_t size)
Allocate memory for TCP send buffer. [thread-safe].
netStatus netTFTPs_Stop(void)
Stop the TFTP server. [thread-safe].
uint8_t netHTTPs_CheckAccount(const char *username, const char *password)
Check if an user account exist in the user database. [user-provided].
const char * Attachment
Email attachment(s), can be NULL.
Definition: rl_net_ds.h:664
User authentication failed.
Definition: rl_net_ds.h:90
uint16_t sin_port
Port.
Definition: rl_net_ds.h:290
File access not allowed.
Definition: rl_net_ds.h:605
bool netWiFi_IsConnected(uint32_t if_num)
Get the connection state of the WiFi interface. [thread-safe].
bool netFTPs_AcceptClient(const NET_ADDR *addr)
Accept or deny connection from remote FTP client. [user-provided].
Generic FTP server error.
Definition: rl_net_ds.h:585
netStatus netARP_CacheIP(uint32_t if_id, const uint8_t *ip4_addr, netARP_CacheType type)
Determine whether the ARP table has MAC address resolved for requested IP address. [thread-safe].
Fixed IP address is refreshed after timeout.
Definition: rl_net_ds.h:498
New File or Directory name for RENAME command.
Definition: rl_net_ds.h:594
Generic TFTP client error.
Definition: rl_net_ds.h:620
bool netTELNETs_CheckCommand(const char *cmd, const char *user_cmd)
Check command string for a command. [thread-safe].
uint8_t length
Length of Option value.
Definition: rl_net_ds.h:514
IPv4 Secondary DNS (4 bytes)
Definition: rl_net_ds.h:402
uint16_t netTFTPs_GetPort(void)
Get port number of the TFTP server. [thread-safe].
netSMTPc_Request
SMTP Client Request.
Definition: rl_net_ds.h:636
Prompt message.
Definition: rl_net_ds.h:631
Local filename (including path)
Definition: rl_net_ds.h:597
IPv4 Maximum Transmission Unit (2 bytes)
Definition: rl_net_ds.h:397
netStatus
Status code values returned by Network library functions.
Definition: rl_net_ds.h:82
Open.
Definition: rl_net_ds.h:444
With PIN.
Definition: rl_net_ds.h:464
IPv6 Socket Address structure.
Definition: rl_net_ds.h:296
netStatus netDHCP_Enable(uint32_t if_id)
Enable Dynamic Host Configuration at runtime. [thread-safe].
const char * netTELNETs_GetPassword(void)
Retrieve password of the built-in user account. [thread-safe].
netTELNETs_Message
Telnet Server Messages.
Definition: rl_net_ds.h:624
int16_t ss_family
Address family.
Definition: rl_net_ds.h:305
File deleted.
Definition: rl_net_ds.h:578
Timed waiting for 2MSL.
Definition: rl_net_ds.h:135
netStatus netNDP_GetMAC(uint32_t if_id, const uint8_t *ip6_addr, uint8_t *mac_addr)
Get MAC address from neighbor discovery cache. [thread-safe].
bool netFTPs_CheckPassword(uint8_t user_id, const char *password)
Check user account password in the user database. [user-provided].
const char * Message
Email message body, can be NULL.
Definition: rl_net_ds.h:663
bool netTELNETs_CheckPassword(uint8_t user_id, const char *password)
Check user account password in the user database. [user-provided].
Network Address IPv4/IPv6 capable.
Definition: rl_net_ds.h:57
IPv6 Multi-cast Hop Limit; val=HopLimit.
Definition: rl_net_ds.h:105
netStatus netDHCP6_Disable(uint32_t if_id)
Disable Dynamic Host Configuration version 6 at runtime. [thread-safe].
netStatus netWiFi_Deactivate(uint32_t if_num)
Deactivate the WiFi interface. [thread-safe].
uint32_t netTCP_GetTimer(int32_t socket)
Determine TCP socket connection timeout. [thread-safe].
int16_t sin_family
Socket domain.
Definition: rl_net_ds.h:289
const char * To
Recipient(s), can be NULL.
Definition: rl_net_ds.h:659
char * h_name
Official name of host.
Definition: rl_net_ds.h:313
Socket Address storage structure.
Definition: rl_net_ds.h:304
void netFTPc_fclose(void *file)
Close local file previously open in FTP client. [interface].
Unsolicited message (triggered by netTELNETs_RequestMessage)
Definition: rl_net_ds.h:632
void * msg_name
Optional pointer to source address.
Definition: rl_net_ds.h:356
void netSMTPc_fclose(void *file)
Close a file previously open in SMTP client. [interface].
netStatus netNDP_CacheIP(uint32_t if_id, const uint8_t *ip6_addr)
Determine whether neighbor cache has MAC address resolved for requested IP address. [thread-safe].
int send(int sock, const char *buf, int len, int flags)
Send data on already connected socket. [thread-safe].
BSD fd_set structure.
Definition: rl_net_ds.h:328
netStatus netTELNETs_RepeatCommand(uint32_t delay)
Request a repeated call to netTELNETs_ProcessCommand function. [thread-safe].
netSMTPc_Event
SMTP Client Events.
Definition: rl_net_ds.h:646
netStatus netFTPc_Connect(const NET_ADDR *addr, netFTP_Command command)
Start FTP client file operation session. [thread-safe].
int32_t __ss_align
reserved, structure alignment
Definition: rl_net_ds.h:307
Invalid Socket.
Definition: rl_net_ds.h:125
int sendmsg(int sock, const MSGHDR *msg, int flags)
Send a message to endpoint node. [thread-safe].
int ioctlsocket(int sock, long cmd, unsigned long *argp)
Control IO mode of a socket. [thread-safe].
IPv6 Default Gateway (16 bytes)
Definition: rl_net_ds.h:408
const char * netIP_ntoa(int16_t addr_type, const uint8_t *ip_addr, char *string_buf, uint32_t buf_len)
Convert IP address from binary to text form. [thread-safe].
int16_t h_addrtype
Address Type: AF_INET, AF_NETBIOS.
Definition: rl_net_ds.h:315
Append file on FTP server (with create)
Definition: rl_net_ds.h:562
netStatus netInitialize(void)
Initialize Network Component and interfaces. [not_thread-safe].
uint8_t var_size
Size of a variable.
Definition: rl_net_ds.h:723
Close started FIN packet was sent.
Definition: rl_net_ds.h:131
netStatus netARP_Probe(uint32_t if_id, const uint8_t *ip4_addr, netARP_cb_t cb_func)
Determine whether the IP address is already in use. [thread-safe].
const char * netCGI_ContentType(const char *file_ext)
Add custom MIME type for unsupported file types. [user-provided].
netFTPs_Event
FTP Server Events.
Definition: rl_net_ds.h:572
netNDP_Event
NDP Probe Callback Events.
Definition: rl_net_ds.h:545
netStatus netHTTPs_SetPassword(const char *password)
Reset password of the built-in user account. [thread-safe].
File access not allowed.
Definition: rl_net_ds.h:616
void netETH_Notify(uint32_t if_num, netETH_Event event, uint32_t val)
Notify the user of Ethernet link state change event. [user-provided].
uint32_t netSMTPc_Process(netSMTPc_Request request, char *buf, uint32_t buf_len, uint32_t *pvar)
Request parameters for SMTP client session. [user-provided].
Ethernet MAC Address (6 bytes)
Definition: rl_net_ds.h:395
const char * password
Password, a null-terminated string.
Definition: rl_net_ds.h:470
bool netTFTPs_AcceptClient(const NET_ADDR *addr)
Accept or deny connection from a remote TFTP client. [user-provided].
netStatus netWiFi_SetOption(uint32_t if_num, netWiFi_Option option, const void *buf, uint32_t buf_len)
Set the value of the WiFi driver option. [thread-safe].
uint16_t netTCP_GetLocalPort(int32_t socket)
Retrieve local port number of TCP socket. [thread-safe].
File or directory renamed.
Definition: rl_net_ds.h:579
uint16_t port
Internet socket port number.
Definition: rl_net_ds.h:59
char ** h_addr_list
Pointer to an array of IPv4 addresses.
Definition: rl_net_ds.h:317
const char * netFTPs_GetRootPath(void)
Retrieve path to the root directory of FTP server. [thread-safe].
netStatus netPPP_Close(void)
Disconnect PPP link between two modems. [thread-safe].
void * var
Pointer to a variable.
Definition: rl_net_ds.h:724
IPv4 Subnet mask (4 bytes)
Definition: rl_net_ds.h:399
const char * netCGI_CustomHeader(void)
Add custom HTTP response header. [user-provided].
Initial welcome message.
Definition: rl_net_ds.h:625
netStatus netTCP_Listen(int32_t socket, uint16_t port)
Open TCP socket for incoming connection. [thread-safe].
netStatus netSMTPc_Connect(const NET_ADDR *addr)
Start SMTP client to send an email in legacy mode. [thread-safe].
Ethernet VLAN Identifier (2 bytes)
Definition: rl_net_ds.h:396
uint32_t fd_bits[(FD_SETSIZE+31)>>5]
Set of sockets bit-mask.
Definition: rl_net_ds.h:329
IPv6 Primary DNS (16 bytes)
Definition: rl_net_ds.h:409
Broadcast mode for local LAN.
Definition: rl_net_ds.h:680
uint32_t netTELNETs_ProcessMessage(netTELNETs_Message msg, char *buf, uint32_t buf_len)
Request a message for a Telnet server session. [user-provided].
netStatus netTELNETs_Start(void)
Start the Telnet server. [thread-safe].
void * netTFTPs_fopen(const char *fname, const char *mode)
Open a file for reading or writing in the TFTP server. [interface].
uint32_t netFTPc_fwrite(void *file, const uint8_t *buf, uint32_t len)
Write block of data to local file in FTP client. [interface].
IPv6 Secondary DNS (16 bytes)
Definition: rl_net_ds.h:410
void netHTTPs_fstat(const char *fname, uint32_t *fsize, uint32_t *ftime)
Retrieve file size and last modification time. [interface].
Pinged Host responded.
Definition: rl_net_ds.h:530
netStatus netPing_EchoX(const char *target, uint32_t flags)
Start ICMP ping process in blocking mode. [thread-safe].
void netSMTPc_Notify(netSMTPc_Event event)
Notify the user application when SMTP client operation ends. [user-provided].
Process is busy.
Definition: rl_net_ds.h:84
Entry allocated, socket still closed.
Definition: rl_net_ds.h:127
uint32_t netFTPs_fread(void *file, uint8_t *buf, uint32_t len)
Read block of data from a file in FTP server. [interface].
Email address of the sender.
Definition: rl_net_ds.h:639
Link up; val=link_info.
Definition: rl_net_ds.h:437
netStatus netTCP_Send(int32_t socket, uint8_t *buf, uint32_t len)
Send a data packet to remote node. [thread-safe].
const char * From
Sender address, can be NULL.
Definition: rl_net_ds.h:658
UDP Checksum Options.
Definition: rl_net_ds.h:107
Deletes a file on FTP server.
Definition: rl_net_ds.h:563
uint16_t sa_family
Address family.
Definition: rl_net_ds.h:247
SMTP Mail Transfer Agent Descriptor.
Definition: rl_net_ds.h:669
int recv(int sock, char *buf, int len, int flags)
Receive data on already connected socket. [thread-safe].
IPv4 Broadcast Interface; val=if_id (class and number)
Definition: rl_net_ds.h:106
bool netFTPs_fdelete(const char *fname)
Delete a file in FTP server. [interface].
bool netHTTPs_AcceptClient(const NET_ADDR *addr)
Accept or deny a connection from a remote HTTP client. [user-provided].
const char * netCGI_GetEnvVar(const char *env, char *ansi, uint32_t max_len)
Process environment variables and convert to ANSI format. [thread-safe].
uint32_t tv_sec
Time interval: seconds.
Definition: rl_net_ds.h:334
File filter/mask for LIST command (wildcards allowed)
Definition: rl_net_ds.h:595
uint8_t netDHCP_PrivateOptionsCountN
Number of DHCP Private Options.
SYN frame received.
Definition: rl_net_ds.h:129
bool netFTPs_rmdir(const char *path)
Remove an empty directory in FTP server. [interface].
User logged in, session is busy.
Definition: rl_net_ds.h:573
Directory created.
Definition: rl_net_ds.h:580
netStatus netTFTPc_Get(const NET_ADDR *addr, const char *fname, const char *local_fname)
Retrieve a file from a remote TFTP server. [thread-safe].
const char * Bcc
Blind carbon copy recipient(s), can be NULL.
Definition: rl_net_ds.h:661
IP version 4.
Definition: rl_net_ds.h:415
File not found or file r/w error.
Definition: rl_net_ds.h:92
Email successfully sent.
Definition: rl_net_ds.h:647
uint32_t netTFTPs_fwrite(void *file, const uint8_t *buf, uint32_t len)
Write block of data to a file in the TFTP server. [interface].
int32_t netUDP_GetSocket(netUDP_cb_t cb_func)
Allocate a free UDP socket. [thread-safe].
bool netFTPs_LoginActive(void)
Determine if FTP server authentication is enabled. [thread-safe].
uint16_t netHTTPs_GetPort(void)
Get port number of the HTTP server. [thread-safe].
uint32_t netFTPc_Process(netFTPc_Request request, char *buf, uint32_t buf_len)
Request parameters for FTP client session. [user-provided].
uint8_t mon
Month [1..12].
Definition: rl_net_ds.h:734
const char * wps_pin
WPS PIN, a null-terminated string.
Definition: rl_net_ds.h:475
const char * netHTTPs_GetContentType(void)
Get Content-Type HTML header, received in XML post request. [thread-safe].
Password request login message.
Definition: rl_net_ds.h:628
netStatus netIGMP_Join(uint32_t if_id, const uint8_t *ip4_addr)
Join this host to a host group specified with IP address. [thread-safe].
IPv4 Primary DNS (4 bytes)
Definition: rl_net_ds.h:401
IPv4 Address (4 bytes)
Definition: rl_net_ds.h:398
Login message, if authentication is enabled.
Definition: rl_net_ds.h:626
netTCP_Option
TCP Socket Options.
Definition: rl_net_ds.h:140
netStatus netSNMP_SetMIB_Table(const NET_SNMP_MIB_INFO *info, uint32_t size)
Register MIB table to SNMP Agent. [thread-safe].
int setsockopt(int sock, int level, int optname, const char *optval, int optlen)
Manipulate options for the socket. [thread-safe].
netStatus netTCP_ResetReceiveWindow(int32_t socket)
Reset TCP window size to a default value from the configuration. [thread-safe].
void(* netDNSc_cb_t)(netDNSc_Event event, const NET_ADDR *addr)
DNS Client Event callback function.
Definition: rl_net_ds.h:693
uint8_t rssi
Received Signal Strength Indicator.
Definition: rl_net_ds.h:484
uint32_t netTCP_GetMaxSegmentSize(int32_t socket)
Determine maximum number of data bytes that can be sent in TCP packet. [thread-safe].
netStatus netIF_SetOption(uint32_t if_id, netIF_Option option, const uint8_t *buf, uint32_t buf_len)
Set the value of an Interface option. [thread-safe].
SYN packet sent to establish a connection.
Definition: rl_net_ds.h:130
Server error.
Definition: rl_net_ds.h:89
Connection was properly closed.
Definition: rl_net_ds.h:117
uint8_t hr
Hours [0..23].
Definition: rl_net_ds.h:730
int socket(int family, int type, int protocol)
Create a communication endpoint called socket. [thread-safe].
void netCGI_ProcessQuery(const char *qstr)
Process query string received by GET request. [user-provided].
Timeout, no response to ARP probe.
Definition: rl_net_ds.h:541
netStatus netTFTPs_SetPort(uint16_t port)
Set port number of the TFTP server. [thread-safe].
void netTFTPc_fclose(void *file)
Close local file previously open in the TFTP client. [interface].
uint32_t netSMTPc_fread(void *file, uint8_t *buf, uint32_t len)
Read block of data from a file in SMTP client. [interface].
IPv4 Multi-cast Time to Live; val=TTL.
Definition: rl_net_ds.h:103
const char * Username
Account user name, can be NULL.
Definition: rl_net_ds.h:673
Disk full.
Definition: rl_net_ds.h:618
Generic Socket Address structure.
Definition: rl_net_ds.h:246
Low Power deep-sleep timer.
Definition: rl_net_ds.h:455
const char * inet_ntop(int af, const void *src, char *dst, int size)
Convert from binary network address to a text string. [thread-safe].
Link down.
Definition: rl_net_ds.h:436
netStatus netHTTPs_GetClient(NET_ADDR *addr, uint32_t addr_len)
Get IP address and port number of a connected remote HTTP client. [thread-safe].
IPv6 Subnet Prefix-length (1 byte)
Definition: rl_net_ds.h:407
const char * netTELNETs_GetUsername(void)
Retrieve username of the built-in user account. [thread-safe].
netStatus netSNTPc_GetTimeX(const char *server, uint32_t *seconds, uint32_t *seconds_fraction)
Determine current time from NTP or SNTP time server in blocking mode. [thread-safe].
BSD cmsg header structure.
Definition: rl_net_ds.h:366
IPv6 Link-local Address (16 bytes)
Definition: rl_net_ds.h:404
netStatus netNDP_Probe(uint32_t if_id, const uint8_t *ip6_addr, netNDP_cb_t cb_func)
Determine whether the IP address is already in use. [thread-safe].
void * iov_base
Starting address.
Definition: rl_net_ds.h:350
char * netHTTPs_fgets(void *file, char *buf, uint32_t size)
Read a string from a file in HTTP server. [interface].
Timeout on file operation.
Definition: rl_net_ds.h:615
Password to login to FTP server.
Definition: rl_net_ds.h:591
netStatus netHTTPs_Start(void)
Start the HTTP server. [thread-safe].
int getsockopt(int sock, int level, int optname, char *optval, int *optlen)
Retrieve options for the socket. [thread-safe].
netTFTPc_Event
TFTP Client Events.
Definition: rl_net_ds.h:613
HOSTENT * gethostbyname(const char *name, int *err)
Retrieve host IP address from host name. [thread-safe].
WiFi Network information.
Definition: rl_net_ds.h:479
netIF_Option
Interface Option codes.
Definition: rl_net_ds.h:394
Wake-up (on Magic Packet)
Definition: rl_net_ds.h:438
uint32_t netFTPc_fread(void *file, uint8_t *buf, uint32_t len)
Read block of data from local file in FTP client. [interface].
netStatus netTELNETs_SetPort(uint16_t port)
Set port number of the Telnet server. [thread-safe].
const char * Password
Account password, can be NULL.
Definition: rl_net_ds.h:674
uint32_t netTELNETs_ProcessCommand(const char *cmd, char *buf, uint32_t buf_len, uint32_t *pvar)
Process and execute a command requested by the Telnet client. [user-provided].
Lists file names only (short format)
Definition: rl_net_ds.h:568
int32_t netHTTPs_GetSession(void)
Get current session number of the HTTP server. [thread-safe].
netTCP_State
TCP Socket States.
Definition: rl_net_ds.h:124
const char * netFTPs_GetPassword(void)
Retrieve password of the built-in user account. [thread-safe].
int bind(int sock, const SOCKADDR *addr, int addrlen)
Assign a local address and port to a socket. [thread-safe].
uint8_t channel
WiFi Channel (0=auto)
Definition: rl_net_ds.h:472
Puts a file on FTP server.
Definition: rl_net_ds.h:560
bool netTCP_SendReady(int32_t socket)
Check if TCP socket can send data. [thread-safe].
netStatus netUDP_ReleaseSocket(int32_t socket)
Release UDP socket and free resources. [thread-safe].
bool netHTTPs_Running(void)
Check if the HTTP server is running. [thread-safe].
netStatus netIF_SetDefault(uint32_t if_id, netIF_Version ip_version)
Set default network interface for Internet access. [thread-safe].
Timeout sending email.
Definition: rl_net_ds.h:648
IPv6 Dynamic Address (16 bytes)
Definition: rl_net_ds.h:406
netStatus netSNMP_SetCommunity(const char *community)
Change SNMP community to a new community. [thread-safe].
netStatus netUninitialize(void)
De-initialize Network Component and interfaces. [not_thread-safe].
char ** h_aliases
Pointer to an array of alias names.
Definition: rl_net_ds.h:314
Timeout, no ping response received.
Definition: rl_net_ds.h:531
File upload ended.
Definition: rl_net_ds.h:577
Working directory path not found.
Definition: rl_net_ds.h:607
int recvfrom(int sock, char *buf, int len, int flags, SOCKADDR *from, int *fromlen)
Receive data from endpoint node. [thread-safe].
netStatus netHTTPs_LoginOnOff(bool login)
Enable or disable HTTP server authentication. [thread-safe].
uint16_t netTELNETs_GetPort(void)
Get port number of the Telnet server. [thread-safe].
int32_t netTCP_GetSocket(netTCP_cb_t cb_func)
Allocate a free TCP socket. [thread-safe].
netStatus netFTPs_LoginOnOff(bool login)
Enable or disable FTP server authentication. [thread-safe].
netStatus netARP_ProbeX(uint32_t if_id, const uint8_t *ip4_addr)
Determine whether the IP address is already in use in blocking mode. [thread-safe].
Retrieves a file from FTP server.
Definition: rl_net_ds.h:561
netStatus netTELNETs_SetPassword(const char *password)
Reset password of the built-in user account. [thread-safe].
netStatus netARP_CacheMAC(uint32_t if_id, const uint8_t *mac_addr)
Determine whether the ARP table has IP address resolved for requested MAC address. [thread-safe].
netStatus netSLIP_Connect(const char *dial_num)
Start a dial-up connection to remote SLIP server. [thread-safe].
Entry is free and unused.
Definition: rl_net_ds.h:126
#define NET_SNMP_MIB_OID_SIZE
Max.size of Object ID value.
Definition: rl_net_ds.h:707
netStatus netTCP_Close(int32_t socket)
Stop TCP communication and start closing procedure. [thread-safe].
int32_t cmsg_level
Originating protocol.
Definition: rl_net_ds.h:368
WiFi Protected Access.
Definition: rl_net_ds.h:446
IOVEC * msg_iov
An array of iovec buffers for the message.
Definition: rl_net_ds.h:358
TCP Flow Control; val: 0=disabled (default), 1=enabled.
Definition: rl_net_ds.h:145
uint16_t sin6_port
Port.
Definition: rl_net_ds.h:298
Error when sending email.
Definition: rl_net_ds.h:650
netStatus netTCP_GetPeer(int32_t socket, NET_ADDR *addr, uint32_t addr_len)
Retrieve IP address and port number of remote peer. [thread-safe].
TCP Idle Timeout; val=timeout (in seconds)
Definition: rl_net_ds.h:143
Removes an empty directory on FTP server.
Definition: rl_net_ds.h:567
netStatus netTFTPc_Put(const NET_ADDR *addr, const char *fname, const char *local_fname)
Put a file to a remote TFTP server. [thread-safe].
int16_t h_length
Length of address in bytes.
Definition: rl_net_ds.h:316
Timeout on file operation.
Definition: rl_net_ds.h:603
IPv4 Default Gateway (4 bytes)
Definition: rl_net_ds.h:400
const char * netCGI_Redirect(const char *file_name)
Redirect resource URL address to a new location. [user-provided].
netStatus netDNSc_GetHostByName(const char *name, int16_t addr_type, netDNSc_cb_t cb_func)
Resolve IP address of a host from a hostname. [thread-safe].
IPv6 Traffic Class; val=TrafficClass.
Definition: rl_net_ds.h:142
void(* netARP_cb_t)(netARP_Event event)
ARP Probe Event callback function.
Definition: rl_net_ds.h:687
int32_t netTELNETs_GetSession(void)
Get current session number of the Telnet server. [thread-safe].
bool netTELNETs_AcceptClient(const NET_ADDR *addr)
Accept or deny a connection from a remote Telnet client. [user-provided].
const char * netHTTPs_GetUsername(void)
Retrieve username of the built-in user account. [thread-safe].
int32_t msg_iovlen
Number of elements in msg_iov.
Definition: rl_net_ds.h:359
netStatus netARP_ClearCache(uint32_t if_id)
Flush or clear the local ARP cache. [thread-safe].
DNS Error, no such name.
Definition: rl_net_ds.h:554
netStatus netWiFi_Scan(uint32_t if_num, NET_WIFI_SCAN_INFO scan_info[], uint32_t *scan_num)
Search for available WiFi networks. [thread-safe].
IN_ADDR inet_addr(const char *cp)
Convert from text address to a network address. [thread-safe].
Directory removed.
Definition: rl_net_ds.h:581
uint16_t netUDP_GetLocalPort(int32_t socket)
Retrieve local port number of UDP socket. [thread-safe].
bool netTFTPs_Running(void)
Check if the TFTP server is running. [thread-safe].
Email body in plain ASCII format.
Definition: rl_net_ds.h:642
netStatus netFTPs_SetPort(uint16_t port)
Set port number of FTP server. [thread-safe].
Lists files stored on FTP server.
Definition: rl_net_ds.h:564
Data received event.
Definition: rl_net_ds.h:120
netStatus netFTPs_SetRootPath(const char *path)
Set path to the root directory of FTP server. [thread-safe].
bool netTELNETs_LoginActive(void)
Determine if Telnet server authentication is enabled. [thread-safe].
netStatus netARP_GetMAC(uint32_t if_id, const uint8_t *ip4_addr, uint8_t *mac_addr)
Get MAC address from the ARP cache. [thread-safe].
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout)
Check the status of one or more sockets. [thread-safe].