Network Component  Version 6.6
MDK-Professional Middleware for IP Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rl_net.h File Reference

Data Structures

struct  SOCKADDR
 Generic Socket Address structure. More...
 
struct  IN_ADDR
 Generic IPv4 Address structure. More...
 
struct  SOCKADDR_IN
 IPv4 Socket Address structure. More...
 
struct  HOSTENT
 BSD Host Entry structure. More...
 
struct  SNMP_MIB
 SNMP-MIB Entry info. More...
 
union  IN_ADDR.__unnamed__
 
struct  IN_ADDR.__unnamed__.__unnamed__
 
struct  IN_ADDR.__unnamed__.__unnamed__
 

Macros

#define ntohl(v)   (uint32_t)(__rev(v))
 Network to/from host byte order conversion.
 
#define ntohs(v)   (uint16_t)(__rev(v) >> 16)
 
#define htons(v)   ntohs(v)
 
#define htonl(v)   ntohl(v)
 
#define ETH_ADDR_LEN   6
 General definitions.
 
#define IP4_ADDR_LEN   4
 IPv4 Address Length in bytes.
 
#define IP6_ADDR_LEN   16
 IPv6 Address Length in bytes.
 
#define NETIF_ETH   0
 Network Interfaces.
 
#define NETIF_PPP   1
 Network interface: PPP.
 
#define NETIF_SLIP   2
 Network interface: SLIP.
 
#define NETIF_LOCAL   3
 Network interface: Localhost (loopback)
 
#define NETIF_NULL   4
 Network interface: Null (none)
 
#define UDP_OPT_SEND_CHECKSUM   0x01
 UDP Options.
 
#define UDP_OPT_VERIFY_CHECKSUM   0x02
 Verify Checksum for received UDP frames.
 
#define TCP_TYPE_SERVER   0x01
 TCP Socket Types.
 
#define TCP_TYPE_CLIENT   0x02
 Socket Type: Client (initiate connect)
 
#define TCP_TYPE_CLIENT_SERVER   0x03
 Socket Type: Client and Server.
 
#define TCP_TYPE_DELAY_ACK   0x04
 Socket Type: Delayed Acknowledge.
 
#define TCP_TYPE_FLOW_CTRL   0x08
 Socket Type: Flow Control.
 
#define TCP_TYPE_KEEP_ALIVE   0x10
 Socket Type: Keep Alive.
 
#define AF_UNSPEC   0
 BSD Socket Address Family.
 
#define AF_INET   1
 Internet Address Family (UDP, TCP)
 
#define AF_NETBIOS   2
 NetBios-style addresses.
 
#define PF_UNSPEC   0
 BSD Protocol families (same as address families)
 
#define PF_INET   1
 Internet Address Family (UDP, TCP)
 
#define PF_NETBIOS   2
 NetBios-style addresses.
 
#define SOCK_STREAM   1
 BSD Socket Type.
 
#define SOCK_DGRAM   2
 Datagram Socket (Connectionless)
 
#define IPPROTO_TCP   1
 BSD Socket Protocol.
 
#define IPPROTO_UDP   2
 UDP Protocol.
 
#define INADDR_ANY   0x00000000
 BSD Internet Addresses.
 
#define INADDR_NONE   0xffffffff
 No IP address accepted.
 
#define MSG_DONTWAIT   0x01
 BSD Socket flags parameter.
 
#define MSG_PEEK   0x02
 Peeks at the incoming data.
 
#define FIONBIO   1
 BSD Socket ioctl commands.
 
#define FIO_DELAY_ACK   2
 Set DELAY_ACK mode for stream socket.
 
#define FIO_KEEP_ALIVE   3
 Set KEEP_ALIVE mode for stream socket.
 
#define FIO_FLOW_CTRL   4
 Set FLOW_CTRL mode for stream socket.
 
#define BSD_SUCCESS   0
 BSD Socket Return values.
 
#define BSD_ERROR   (-1)
 General Error.
 
#define BSD_ERROR_SOCKET   (-2)
 Invalid socket descriptor.
 
#define BSD_ERROR_PARAMETER   (-3)
 Invalid parameter.
 
#define BSD_ERROR_WOULDBLOCK   (-4)
 It would have blocked.
 
#define BSD_ERROR_NOMEMORY   (-5)
 Not enough memory in memory pool.
 
#define BSD_ERROR_CLOSED   (-6)
 Connection is closed or aborted.
 
#define BSD_ERROR_LOCKED   (-7)
 Socket is locked by another thread.
 
#define BSD_ERROR_TIMEOUT   (-8)
 Socket, Host Resolver timeout.
 
#define BSD_ERROR_INPROGRESS   (-9)
 Host Name resolving in progress.
 
#define BSD_ERROR_NONAME   (-10)
 Host Name not existing.
 
#define MIB_INTEGER   0x02
 SNMP-MIB definitions.
 
#define MIB_OCTET_STR   0x04
 MIB entry type OCTET_STRING.
 
#define MIB_OBJECT_ID   0x06
 MIB entry type OBJECT_IDENTIFIER.
 
#define MIB_IP_ADDR   0x40
 MIB entry type IP ADDRESS (uint8_t[4])
 
#define MIB_COUNTER   0x41
 MIB entry type COUNTER (uint32_t)
 
#define MIB_GAUGE   0x42
 MIB entry type GAUGE (uint32_t)
 
#define MIB_TIME_TICKS   0x43
 MIB entry type TIME_TICKS.
 
#define MIB_ATR_RO   0x80
 MIB entry attribute READ_ONLY.
 
#define MIB_OID_SIZE   17
 Max.size of Object ID value.
 
#define MIB_STR_SIZE   110
 Max.size of Octet String variable.
 
#define MIB_READ   0
 MIB entry Read access.
 
#define MIB_WRITE   1
 MIB entry Write access.
 
#define MIB_STR(s)   sizeof(s)-1, s
 SNMP-MIB macros.
 
#define MIB_INT(o)   sizeof(o), (void *)&o
 
#define MIB_IP(ip)   4, (void *)&ip
 
#define MIB_OID0(f, s)   (f*40 + s)
 
#define SNMP_MIB_SIZE(mib)   (sizeof(mib) / sizeof(SNMP_MIB))
 

Typedefs

typedef void(* net_icmp_cb_t )(icmpEvent event)
 ICMP Event callback function.
 
typedef uint32_t(* net_udp_cb_t )(int32_t socket, const uint8_t *ip_addr, uint16_t port, const uint8_t *buf, uint32_t len)
 UDP Event callback function.
 
typedef void(* net_sntp_client_cb_t )(uint32_t utc_time)
 SNTP Client callback function.
 

Enumerations

enum  ethLinkEvent {
  ethLinkDown = 0,
  ethLinkUp_10MHalfDuplex,
  ethLinkUp_10MFullDuplex,
  ethLinkUp_100MHalfDuplex,
  ethLinkUp_100MFullDuplex,
  ethLinkUp_1GHalfDuplex,
  ethLinkUp_1GFullDuplex
}
 Ethernet Link Callback Events. More...
 
enum  arpCacheType {
  arpCacheFixedIP,
  arpCacheTemporaryIP
}
 ARP Cache Entry types. More...
 
enum  icmpEvent {
  icmpEventSuccess = 0,
  icmpEventTimeout
}
 ICMP (ping) Callback Events. More...
 
enum  dhcpClientOption {
  dhcpClientIPaddress = 0,
  dhcpClientNTPservers = 42,
  dhcpClientBootfileName = 67
}
 DHCP Client Callback Events. More...
 
enum  netStatus {
  netOK = 0,
  netBusy,
  netError,
  netInvalidParameter,
  netWrongState,
  netDriverError,
  netServerError
}
 Network return codes. More...
 
enum  ftpCommand {
  ftpPUT,
  ftpGET,
  ftpAPPEND,
  ftpDELETE,
  ftpLIST,
  ftpRENAME,
  ftpMKDIR,
  ftpRMDIR,
  ftpNLIST
}
 FTP Commands. More...
 
enum  ftpServerEvent {
  ftpServerLogin,
  ftpServerLogout,
  ftpServerLoginFailed,
  ftpServerDownload,
  ftpServerUpload,
  ftpServerDelete,
  ftpServerRename,
  ftpServerMakeDirectory,
  ftpServerRemoveDirectory,
  ftpServerOperationDenied,
  ftpServerLocalFileError,
  ftpServerFileError,
  ftpServerError
}
 FTP Server Events. More...
 
enum  ftpClientRequest {
  ftpClientUsername,
  ftpClientPassword,
  ftpClientPath,
  ftpClientFilename,
  ftpClientNewName,
  ftpClientDirectory,
  ftpClientFilterMask,
  ftpClientList,
  ftpClientLocalFile
}
 FTP Client Requests. More...
 
enum  ftpClientEvent {
  ftpClientSuccess = 0,
  ftpClientTimeout,
  ftpClientLoginFailed,
  ftpClientAccessDenied,
  ftpClientFileNotFound,
  ftpClientInvalidPath,
  ftpClientLocalFileError,
  ftpClientError
}
 FTP Client Events. More...
 
enum  tftpClientEvent {
  tftpClientSuccess = 0,
  tftpClientTimeout,
  tftpClientAccessDenied,
  tftpClientFileNotFound,
  tftpClientDiskFull,
  tftpClientError
}
 TFTP Client Events. More...
 
enum  telnetServerMessage {
  telnetServerWelcome,
  telnetServerPrompt,
  telnetServerLogin,
  telnetServerUsername,
  telnetServerPassword,
  telnetServerLoginFailed,
  telnetServerLoginTimeout,
  telnetServerUnsolicitedMessage
}
 Telnet Server Messages. More...
 
enum  smtpClientRequest {
  smtpClientUsername,
  smtpClientPassword,
  smtpClientSender,
  smtpClientRecipient,
  smtpClientSubject,
  smtpClientBody
}
 SMTP Client Request. More...
 
enum  smtpClientEvent {
  smtpClientSuccess = 0,
  smtpClientTimeout,
  smtpClientError
}
 SMTP Client Events. More...
 

Functions

netStatus net_initialize (void)
 Initialize Network Component, resources and interfaces.
 
int net_main (void)
 Run Network Component main function.
 
int32_t udp_get_socket (uint8_t tos, uint8_t opt, net_udp_cb_t cb_func)
 Allocate a free UDP socket.
 
netStatus udp_release_socket (int32_t socket)
 Release UDP socket and free resources.
 
netStatus udp_open (int32_t socket, uint16_t port)
 Open UDP socket for communication.
 
netStatus udp_close (int32_t socket)
 Stop UDP communication and close socket.
 
netStatus udp_multicast_ttl (int32_t socket, uint8_t ttl)
 Set Time To Live value for multicast packets.
 
uint8_t * udp_get_buf (uint32_t size)
 Allocate memory for UDP send buffer.
 
netStatus udp_send (int32_t socket, const uint8_t *ip_addr, uint16_t port, uint8_t *buf, uint32_t len)
 Send data to a remote node.
 
const char * tcp_ntoa (tcpState state)
 Convert TCP socket state into an ASCII string.
 
int socket (int family, int type, int protocol)
 Create a communication endpoint called socket.
 
int bind (int sock, const SOCKADDR *addr, int addrlen)
 Assign a local address and port to a socket.
 
int listen (int sock, int backlog)
 Set a socket in a listening mode.
 
int accept (int sock, SOCKADDR *addr, int *addrlen)
 Accept connect request for a listening socket.
 
int connect (int sock, SOCKADDR *addr, int addrlen)
 Connect a socket to a remote host.
 
int send (int sock, const char *buf, int len, int flags)
 Send data on already connected socket.
 
int sendto (int sock, const char *buf, int len, int flags, SOCKADDR *to, int tolen)
 Send data to endpoint node.
 
int recv (int sock, char *buf, int len, int flags)
 Receive data on already connected socket.
 
int recvfrom (int sock, char *buf, int len, int flags, SOCKADDR *from, int *fromlen)
 Receive data from endpoint node.
 
int closesocket (int sock)
 Close socket and release socket descriptor.
 
int getpeername (int sock, SOCKADDR *name, int *namelen)
 Retrieve IP address and port number of the endpoint node.
 
int getsockname (int sock, SOCKADDR *name, int *namelen)
 Retrieve local IP address and port number.
 
int ioctlsocket (int sock, long cmd, unsigned long *argp)
 Control IO mode of a socket.
 
HOSTENTgethostbyname (const char *name, int *err)
 Retrieve host IP address from host name.
 
netStatus arp_cache_ip (uint32_t if_num, const uint8_t *ip_addr, arpCacheType type)
 Determine whether the ARP table has MAC address resolved for requested IP address.
 
netStatus arp_cache_mac (uint32_t if_num, const uint8_t *mac_addr)
 Determine whether the ARP table has IP address resolved for requested MAC address.
 
netStatus arp_get_ip (const uint8_t *mac_addr, uint8_t *ip_addr)
 Get IP address from the ARP cache.
 
netStatus arp_get_mac (const uint8_t *ip_addr, uint8_t *mac_addr)
 Get MAC address from the ARP cache.
 
netStatus dhcp_disable (uint32_t if_num)
 Disable Dynamic Host Configuration at runtime.
 
netStatus igmp_join (uint32_t if_num, const uint8_t *ip_addr)
 Join this host to a host group specified with IP address.
 
netStatus igmp_leave (uint32_t if_num, const uint8_t *ip_addr)
 Leave a host group specified with IP address.
 
void eth_link_notify (uint32_t if_num, ethLinkEvent event)
 Notify the user of Ethernet link state change event.
 
void dhcp_client_notify (uint32_t if_num, dhcpClientOption opt, const uint8_t *val, uint32_t len)
 Notify the user of DHCP event or extended DHCP option.
 
netStatus ppp_listen (const char *username, const char *password)
 Start PPP interface to accept incoming PPP connection.
 
netStatus ppp_connect (const char *dial_num, const char *username, const char *password)
 Start a dial-up connection to remote PPP server.
 
netStatus ppp_close (void)
 Disconnect PPP link between two modems.
 
bool ppp_is_up (void)
 Determine the state of PPP link.
 
netStatus slip_listen (void)
 Start SLIP interface to accept incoming SLIP connections.
 
netStatus slip_connect (const char *dial_num)
 Start a dial-up connection to remote SLIP server.
 
netStatus slip_close (void)
 Disconnect SLIP link between two modems.
 
bool slip_is_up (void)
 Determine the state of SLIP link.
 
netStatus icmp_ping (const uint8_t *ip_addr, net_icmp_cb_t cb_func)
 Start ICMP ping process.
 
netStatus get_host_by_name (const char *name, net_dns_client_cb_t cb_func)
 Resolve IP address of a host from a hostname.
 
bool ftp_accept_client (const uint8_t *ip_addr, uint16_t port)
 Accept or deny connection from remote FTP client.
 
uint8_t ftp_check_username (const char *username)
 Check if an user account exist in the user database.
 
bool ftp_check_password (uint8_t user_id, const char *password)
 Check user account password in the user database.
 
bool ftp_file_access (uint8_t user_id, const char *fname, uint8_t mode)
 Check if remote user is allowed to access a file on FTP server.
 
uint8_t ftp_get_user_id (void)
 Retrieve the user identification.
 
void ftp_server_notify (ftpServerEvent event)
 Notify the user application about events in FTP server service.
 
void * ftp_server_fopen (const char *fname, const char *mode)
 Open a file for reading or writing in FTP server.
 
void ftp_server_fclose (void *file)
 Close a file previously open in FTP server.
 
uint32_t ftp_server_fread (void *file, uint8_t *buf, uint32_t len)
 Read block of data from a file in FTP server.
 
uint32_t ftp_server_fwrite (void *file, const uint8_t *buf, uint32_t len)
 Write block of data to a file in FTP server.
 
bool ftp_server_fdelete (const char *fname)
 Delete a file in FTP server.
 
bool ftp_server_frename (const char *fname, const char *newname)
 Rename a file or directory in FTP server.
 
bool ftp_server_mkdir (const char *path)
 Make a new directory in FTP server.
 
bool ftp_server_rmdir (const char *path)
 Remove an empty directory in FTP server.
 
uint32_t ftp_server_ffind (uint8_t code, char *buf, uint32_t buflen, const char *mask)
 Search the file system directory for matching files.
 
netStatus ftp_client_connect (const uint8_t *ip_addr, uint16_t port, ftpCommand command)
 Start FTP client file operation session.
 
uint32_t ftp_client_request (ftpClientRequest request, char *buf, uint32_t len)
 Request parameters for FTP client session.
 
void ftp_client_notify (ftpClientEvent event)
 Notify the user application when FTP client operation ends.
 
void * ftp_client_fopen (const char *fname, const char *mode)
 Open local file for reading or writing in FTP client.
 
void ftp_client_fclose (void *file)
 Close local file previously open in FTP client.
 
uint32_t ftp_client_fread (void *file, uint8_t *buf, uint32_t len)
 Read block of data from local file in FTP client.
 
uint32_t ftp_client_fwrite (void *file, const uint8_t *buf, uint32_t len)
 Write block of data to local file in FTP client.
 
bool tftp_accept_client (const uint8_t *ip_addr, uint16_t port)
 Accept or deny connection from remote TFTP client.
 
void * tftp_server_fopen (const char *fname, const char *mode)
 Open a file for reading or writing in TFTP server.
 
void tftp_server_fclose (void *file)
 Close a file previously open in TFTP server.
 
uint32_t tftp_server_fread (void *file, uint8_t *buf, uint32_t len)
 Read block of data from a file in TFTP server.
 
uint32_t tftp_server_fwrite (void *file, const uint8_t *buf, uint32_t len)
 Write block of data to a file in TFTP server.
 
netStatus tftp_client_put (const uint8_t *ip_addr, uint16_t port, const char *src, const char *dst)
 Put a file to remote TFTP server.
 
netStatus tftp_client_get (const uint8_t *ip_addr, uint16_t port, const char *src, const char *dst)
 Retrieve a file from remote TFTP server.
 
void tftp_client_notify (tftpClientEvent event)
 Notify the user application when TFTP client operation ends.
 
void * tftp_client_fopen (const char *fname, const char *mode)
 Open local file for reading or writing in TFTP client.
 
void tftp_client_fclose (void *file)
 Close local file previously open in TFTP client.
 
uint32_t tftp_client_fread (void *file, uint8_t *buf, uint32_t len)
 Read block of data from local file in TFTP client.
 
uint32_t tftp_client_fwrite (void *file, const uint8_t *buf, uint32_t len)
 Write block of data to local file in TFTP client.
 
netStatus telnet_server_set_delay (uint32_t delay)
 Set a delay between two consecutive calls to telnet_server_process function.
 
netStatus telnet_server_get_client (uint8_t *ip_addr, uint8_t *mac_addr)
 Get IP and MAC address of connected remote machine.
 
int32_t telnet_server_get_session (void)
 Get current session number of Telnet server.
 
bool telnet_check_command (const char *cmd, const char *user_cmd)
 Check command string for a command.
 
uint32_t telnet_server_message (telnetServerMessage msg, char *buf, uint32_t len)
 Request message for Telnet server session.
 
uint32_t telnet_server_process (const char *cmd, char *buf, uint32_t buflen, uint32_t *pvar)
 Process and execute a command requested by the Telnet client.
 
bool telnet_server_message_poll (int32_t session)
 Poll the upper-layer user application for unsolicited messages.
 
bool telnet_accept_client (const uint8_t *ip_addr, uint16_t port)
 Accept or deny connection from remote Telnet client.
 
uint8_t telnet_check_username (const char *username)
 Check if an user account exist in the user database.
 
bool telnet_check_password (uint8_t user_id, const char *password)
 Check user account password in the user database.
 
uint8_t telnet_get_user_id (void)
 Retrieve the user identification.
 
const char * http_get_env_var (const char *env, char *ansi, uint32_t maxlen)
 Process environment variables and convert to ANSI format.
 
uint32_t http_utc_time (uint8_t hr, uint8_t min, uint8_t sec, uint8_t day, uint8_t mon, uint16_t year)
 Convert generic time to UTC time format.
 
netStatus http_server_get_client (uint8_t *ip_addr, uint8_t *mac_addr)
 Get IP and MAC address of connected remote machine.
 
int32_t http_server_get_session (void)
 Get current session number of HTTP server.
 
const char * http_server_get_lang (void)
 Retrieve the preferred language setting from the browser.
 
const char * http_server_get_content_type (void)
 Get Content-Type HTML header, received in XML post request.
 
void cgi_process_query (const char *qstr)
 Process query string received by GET request.
 
void cgi_process_data (uint8_t code, const char *data, uint32_t len)
 Process data received by POST request.
 
uint32_t cgi_script (const char *env, char *buf, uint32_t buflen, uint32_t *pcgi)
 Generate dynamic web data from a script line.
 
const char * cgi_content_type (const char *file_ext)
 Add custom MIME type for unsupported file types.
 
const char * cgx_content_type (void)
 Override default Content-Type for CGX script files.
 
const char * http_encoding (void)
 Override default character encoding in html documents.
 
bool http_accept_client (const uint8_t *ip_addr, uint16_t port)
 Accept or deny connection from remote HTTP client.
 
uint8_t http_check_account (const char *username, const char *password)
 Check if an user account exist in the user database.
 
bool http_file_access (uint8_t user_id, const char *fname)
 Check if remote user is allowed to access a file on HTTP server.
 
uint8_t http_get_user_id (void)
 Retrieve the user identification.
 
void * http_server_fopen (const char *fname)
 Open a file for reading in HTTP server.
 
void http_server_fclose (void *file)
 Close a file previously open in HTTP server.
 
uint32_t http_server_fread (void *file, uint8_t *buf, uint32_t len)
 Read block of data from a file in HTTP server.
 
char * http_server_fgets (void *file, char *buf, uint32_t size)
 Read a string from a file in HTTP server.
 
uint32_t http_server_ftime (const char *fname)
 Retrieve last modification time of a file.
 
netStatus smtp_client_connect (const uint8_t *ip_addr, uint16_t port)
 Start SMTP client to send an email.
 
uint32_t smtp_client_request (smtpClientRequest request, char *buf, uint32_t buflen, uint32_t *pvar)
 Request parameters for SMTP client session.
 
void smtp_client_notify (smtpClientEvent event)
 Notify the user application when SMTP client operation ends.
 
bool smtp_client_accept_authentication (const uint8_t *ip_addr)
 Accept or deny authentication requested by SMTP server.
 
netStatus sntp_get_time (const uint8_t *ip_addr, net_sntp_client_cb_t cb_func)
 Determine current time from NTP or SNTP time server.
 
netStatus snmp_trap (const uint8_t *ip_addr, uint8_t generic, uint8_t specific, const uint16_t *obj_list)
 Send a trap message to the Trap Manager.
 
netStatus snmp_set_community (const char *community)
 Change SNMP community to a new community.
 
const char * ip4_ntoa (const uint8_t *ip4_addr)
 Convert an IPv4 Network address into an ASCII string.
 
bool ip4_aton (const char *cp, uint8_t *ip4_addr)
 Convert a string containing an IPv4 address into a Network address.
 
const char * mac_ntoa (const uint8_t *mac_addr)
 Convert a MAC address into an ASCII string.
 
bool mac_aton (const char *cp, uint8_t *mac_addr)
 Convert a string containing a MAC address into a binary MAC address.
 
int32_t tcp_get_socket (uint8_t type, uint8_t tos, uint32_t tout, net_tcp_cb_t cb_func)
 Allocate a free TCP socket.
 
netStatus tcp_release_socket (int32_t socket)
 Release TCP socket and free resources.
 
netStatus tcp_listen (int32_t socket, uint16_t port)
 Open TCP socket for incoming connection.
 
netStatus tcp_connect (int32_t socket, const uint8_t *ip_addr, uint16_t port, uint16_t local_port)
 Initiate a TCP connection to a remote node.
 
uint8_t * tcp_get_buf (uint32_t size)
 Allocate memory for TCP send buffer.
 
uint32_t tcp_max_data_size (int32_t socket)
 Determine maximum number of data bytes that can be sent in TCP packet.
 
bool tcp_check_send (int32_t socket)
 Check if TCP socket can send data.
 
tcpState tcp_get_state (int32_t socket)
 Determine current state of a TCP socket.
 
netStatus tcp_send (int32_t socket, uint8_t *buf, uint32_t len)
 Send a data packet to remote node.
 
netStatus tcp_close (int32_t socket)
 Stop TCP communication and start closing procedure.
 
netStatus tcp_abort (int32_t socket)
 Instantly stop TCP communication.
 
netStatus tcp_reset_window (int32_t socket)
 Reset TCP window size to a default value from the configuration.
 
enum  tcpEvent {
  tcpEventConnect = 0,
  tcpEventEstablished,
  tcpEventClosed,
  tcpEventAbort,
  tcpEventACK,
  tcpEventData
}
 TCP Callback Events. More...
 
enum  tcpState {
  tcpStateUNUSED = 0,
  tcpStateCLOSED,
  tcpStateLISTEN,
  tcpStateSYN_RECEIVED,
  tcpStateSYN_SENT,
  tcpStateFIN_WAIT_1,
  tcpStateFIN_WAIT_2,
  tcpStateCLOSING,
  tcpStateLAST_ACK,
  tcpStateTIME_WAIT,
  tcpStateESTABLISHED
}
 TCP States. More...
 
typedef uint32_t(* net_tcp_cb_t )(int32_t socket, tcpEvent event, const uint8_t *buf, uint32_t len)
 TCP Event callback function.
 
enum  dnsClientEvent {
  dnsClientSuccess = 0,
  dnsClientTimeout,
  dnsClientNotResolved,
  dnsClientError
}
 DNS Client Callback Events. More...
 
typedef void(* net_dns_client_cb_t )(dnsClientEvent event, const uint8_t *ip_addr)
 DNS Client Event callback function.
 

Macro Definition Documentation

#define AF_INET   1

Internet Address Family (UDP, TCP)

#define AF_NETBIOS   2

NetBios-style addresses.

#define AF_UNSPEC   0

BSD Socket Address Family.

Unspecified

#define BSD_ERROR   (-1)

General Error.

#define BSD_ERROR_CLOSED   (-6)

Connection is closed or aborted.

#define BSD_ERROR_INPROGRESS   (-9)

Host Name resolving in progress.

#define BSD_ERROR_LOCKED   (-7)

Socket is locked by another thread.

#define BSD_ERROR_NOMEMORY   (-5)

Not enough memory in memory pool.

#define BSD_ERROR_NONAME   (-10)

Host Name not existing.

#define BSD_ERROR_PARAMETER   (-3)

Invalid parameter.

#define BSD_ERROR_SOCKET   (-2)

Invalid socket descriptor.

#define BSD_ERROR_TIMEOUT   (-8)

Socket, Host Resolver timeout.

#define BSD_ERROR_WOULDBLOCK   (-4)

It would have blocked.

#define BSD_SUCCESS   0

BSD Socket Return values.

Success

#define ETH_ADDR_LEN   6

General definitions.

Ethernet Address Length in bytes

#define FIO_DELAY_ACK   2

Set DELAY_ACK mode for stream socket.

#define FIO_FLOW_CTRL   4

Set FLOW_CTRL mode for stream socket.

#define FIO_KEEP_ALIVE   3

Set KEEP_ALIVE mode for stream socket.

#define FIONBIO   1

BSD Socket ioctl commands.

Set mode (blocking/non-blocking)

#define htonl (   v)    ntohl(v)
#define htons (   v)    ntohs(v)
#define INADDR_ANY   0x00000000

BSD Internet Addresses.

All IP addresses accepted

#define INADDR_NONE   0xffffffff

No IP address accepted.

#define IP4_ADDR_LEN   4

IPv4 Address Length in bytes.

#define IP6_ADDR_LEN   16

IPv6 Address Length in bytes.

#define IPPROTO_TCP   1

BSD Socket Protocol.

TCP Protocol

#define IPPROTO_UDP   2

UDP Protocol.

#define MIB_ATR_RO   0x80

MIB entry attribute READ_ONLY.

#define MIB_COUNTER   0x41

MIB entry type COUNTER (uint32_t)

#define MIB_GAUGE   0x42

MIB entry type GAUGE (uint32_t)

#define MIB_INT (   o)    sizeof(o), (void *)&o
#define MIB_INTEGER   0x02

SNMP-MIB definitions.

MIB entry type INTEGER

#define MIB_IP (   ip)    4, (void *)&ip
#define MIB_IP_ADDR   0x40

MIB entry type IP ADDRESS (uint8_t[4])

#define MIB_OBJECT_ID   0x06

MIB entry type OBJECT_IDENTIFIER.

#define MIB_OCTET_STR   0x04

MIB entry type OCTET_STRING.

#define MIB_OID0 (   f,
 
)    (f*40 + s)
#define MIB_OID_SIZE   17

Max.size of Object ID value.

#define MIB_READ   0

MIB entry Read access.

#define MIB_STR (   s)    sizeof(s)-1, s

SNMP-MIB macros.

#define MIB_STR_SIZE   110

Max.size of Octet String variable.

#define MIB_TIME_TICKS   0x43

MIB entry type TIME_TICKS.

#define MIB_WRITE   1

MIB entry Write access.

#define MSG_DONTWAIT   0x01

BSD Socket flags parameter.

Enables non-blocking operation

#define MSG_PEEK   0x02

Peeks at the incoming data.

#define NETIF_ETH   0

Network Interfaces.

Network interface: Ethernet

#define NETIF_LOCAL   3

Network interface: Localhost (loopback)

#define NETIF_NULL   4

Network interface: Null (none)

#define NETIF_PPP   1

Network interface: PPP.

#define NETIF_SLIP   2

Network interface: SLIP.

#define ntohl (   v)    (uint32_t)(__rev(v))

Network to/from host byte order conversion.

#define ntohs (   v)    (uint16_t)(__rev(v) >> 16)
#define PF_INET   1

Internet Address Family (UDP, TCP)

#define PF_NETBIOS   2

NetBios-style addresses.

#define PF_UNSPEC   0

BSD Protocol families (same as address families)

Unspecified

#define SNMP_MIB_SIZE (   mib)    (sizeof(mib) / sizeof(SNMP_MIB))
#define SOCK_DGRAM   2

Datagram Socket (Connectionless)

#define SOCK_STREAM   1

BSD Socket Type.

Stream Socket (Connection oriented)

#define TCP_TYPE_CLIENT   0x02

Socket Type: Client (initiate connect)

#define TCP_TYPE_CLIENT_SERVER   0x03

Socket Type: Client and Server.

#define TCP_TYPE_DELAY_ACK   0x04

Socket Type: Delayed Acknowledge.

#define TCP_TYPE_FLOW_CTRL   0x08

Socket Type: Flow Control.

#define TCP_TYPE_KEEP_ALIVE   0x10

Socket Type: Keep Alive.

#define TCP_TYPE_SERVER   0x01

TCP Socket Types.

Socket Type: Server (open for listening)

#define UDP_OPT_SEND_CHECKSUM   0x01

UDP Options.

Calculate Checksum for UDP send frames

#define UDP_OPT_VERIFY_CHECKSUM   0x02

Verify Checksum for received UDP frames.

Enumeration Type Documentation

enum netStatus

Network return codes.

Enumerator:
netOK 

Operation succeeded.

netBusy 

Process is busy.

netError 

Unspecified error.

netInvalidParameter 

Invalid parameter specified.

netWrongState 

Wrong state error.

netDriverError 

Driver error.

netServerError 

DNS/SNTP server error.

Function Documentation

bool ftp_server_mkdir ( const char *  path)

Make a new directory in FTP server.

Parameters
[in]pathdirectory path to create.
Returns
  • true = Directory successfully created.
  • false = Failed to create a directory.
bool ftp_server_rmdir ( const char *  path)

Remove an empty directory in FTP server.

Parameters
[in]pathdirectory path to remove.
Returns
  • true = Directory successfully removed.
  • false = Failed to remove a directory.
bool ip4_aton ( const char *  cp,
uint8_t *  ip4_addr 
)

Convert a string containing an IPv4 address into a Network address.

Parameters
[in]cpaddress string in dotted-decimal notation.
[out]ip4_addrIPv4 address.
Returns
  • true = Conversion successful.
  • false = Conversion failed.
const char* ip4_ntoa ( const uint8_t *  ip4_addr)

Convert an IPv4 Network address into an ASCII string.

Parameters
[in]ip4_addrIPv4 address.
Returns
pointer to a static buffer containing address string in dotted-decimal notation.
bool mac_aton ( const char *  cp,
uint8_t *  mac_addr 
)

Convert a string containing a MAC address into a binary MAC address.

Parameters
[in]cpaddress string in hyphen MAC-address notation.
[out]mac_addrMAC address.
Returns
  • true = Conversion successful.
  • false = Conversion failed.
const char* mac_ntoa ( const uint8_t *  mac_addr)

Convert a MAC address into an ASCII string.

Parameters
[in]mac_addrMAC address.
Returns
pointer to a static buffer containing address string in hyphen MAC-address notation.
const char* tcp_ntoa ( tcpState  state)

Convert TCP socket state into an ASCII string.

Parameters
[in]statesocket state as defined with tcpState
Returns
pointer to a buffer containing the text representation of a socket state.