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