Network Component  Version 6.7.7
MDK-Professional Middleware for IP Networking
rl_net_lib.h File Reference
#include "Driver_USART.h"
#include "Driver_ETH_MAC.h"
#include "Driver_ETH_PHY.h"
#include "net_modem.h"
#include "rl_net.h"

Data Structures

struct  LOCALM
 Local Machine info. More...
 
struct  NET_FRAME
 System frame buffer structure. More...
 
struct  ARP_INFO
 ARP Cache Entry info. More...
 
struct  IGMP_INFO
 IGMP Group info. More...
 
struct  UDP_INFO
 UDP Socket info. More...
 
struct  TCP_INFO
 TCP Socket info. More...
 
struct  BSD_INFO
 BSD Socket info. More...
 
struct  DNS_CACHE
 DNS Cache Entry info. More...
 
struct  TFTP_INFO
 TFTP Server Session info. More...
 
struct  TNET_INFO
 Telnet Session info. More...
 
struct  FTP_INFO
 FTP Session info. More...
 
struct  HTTP_INFO
 HTTP Session info. More...
 
struct  HTTP_ERROR
 HTTP Error page info. More...
 
struct  SYS_CFG
 SYS Configuration info. More...
 
struct  ARP_CFG
 ARP Configuration info. More...
 
struct  IGMP_CFG
 IGMP Configuration info. More...
 
struct  DHCP_CFG
 DHCP Client Configuration info. More...
 
struct  ETH_CFG
 Ethernet Interface Configuration info. More...
 
struct  COM_DEV
 Serial Device Configuration info. More...
 
struct  PPP_CFG
 PPP Interface Configuration info. More...
 
struct  SLIP_CFG
 SLIP Interface Configuration info. More...
 
struct  UDP_CFG
 UDP Socket Configuration info. More...
 
struct  TCP_CFG
 TCP Socket Configuration info. More...
 
struct  BSD_CFG
 BSD Socket Configuration info. More...
 
struct  DNS_CFG
 DNS Client Configuration info. More...
 
struct  SNMP_CFG
 SNMP Agent Configuration info. More...
 
struct  SNTP_CFG
 SNTP Client Configuration info. More...
 
struct  TFTP_CFG
 TFTP Server Configuration info. More...
 
struct  TFTPC_CFG
 TFTP Client Configuration info. More...
 
struct  TNET_CFG
 Telnet Server Configuration info. More...
 
struct  FTP_CFG
 FTP Server Configuration info. More...
 
struct  FTPC_CFG
 FTP Client Configuration info. More...
 
struct  HTTP_CFG
 HTTP Server Configuration info. More...
 

Macros

#define NET_HEADER_LEN   4
 General definitions. More...
 
#define PHY_HEADER_LEN   14
 Physical/ethernet header length. More...
 
#define ETH_FRAME_MTU   1514
 Ethernet frame max. transfer unit. More...
 
#define NET_PASSWORD_SIZE   20
 Authentication password buffer size. More...
 
#define TNET_LBUFSZ   96
 Debug process definitions. More...
 
#define TNET_HISTSZ   128
 Command History buffer size in bytes. More...
 
#define TNET_FIFOSZ   128
 Input character Fifo buffer in bytes. More...
 

Enumerations

enum  ERROR_CODE {
  ERR_MEM_ALLOC ,
  ERR_MEM_FREE ,
  ERR_MEM_CORRUPT ,
  ERR_MEM_LOCK ,
  ERR_UDP_ALLOC ,
  ERR_TCP_ALLOC ,
  ERR_TCP_STATE
}
 System Error codes. More...
 

Functions

void net_sys_init (void)
 Initialize Network Component, resources and interfaces. More...
 
void net_sys_run (void)
 Run Network Component main function. More...
 
void net_sys_error (ERROR_CODE error)
 Signal Network Component error. More...
 
NET_FRAMEmem_alloc (uint32_t byte_size)
 Allocate memory for the network frame. More...
 
void mem_free (NET_FRAME *mem_ptr)
 Release allocated memory. More...
 
void eth_init_link (void)
 Initialize Ethernet interface. More...
 
void eth_run_link (void)
 Run ethernet interface main function. More...
 
bool eth_send_frame (NET_FRAME *frame)
 Construct ethernet header for the frame and send it. More...
 
bool eth_chk_addr (NET_FRAME *frame)
 Check if ethernet destination MAC address is local MAC address. More...
 
const uint8_t * eth_get_addr (const uint8_t *ip_addr)
 Get MAC address for the given IP address. More...
 
void arp_notify (void)
 Send a notification of local IP address change (gratuitous ARP). More...
 
void igmp_host_init (void)
 Initialize IGMP group management. More...
 
void igmp_host_run (void)
 Run IGMP group management main function. More...
 
void igmp_process (NET_FRAME *frame)
 Process IGMP group management frame. More...
 
bool igmp_is_member (const uint8_t *ipadr)
 Check if local host is a member of provided group. More...
 
void nbns_client_init (void)
 Initialize NBNS client. More...
 
void dhcp_client_init (void)
 Initialize DHCP client. More...
 
void dhcp_client_run (void)
 Run DHCP client main function. More...
 
void ppp_init_link (void)
 Initialize PPP interface. More...
 
void ppp_run_link (void)
 Run PPP interface main function. More...
 
bool ppp_send_frame (NET_FRAME *frame, uint16_t prot)
 Construct PPP header for the frame and send it. More...
 
void pap_init (void)
 Initialize PAP authentication. More...
 
void pap_run (void)
 Run PAP authentication main function. More...
 
void pap_process (NET_FRAME *frame)
 Process PAP authentication frame. More...
 
void chap_init (void)
 Initialize CHAP authentication. More...
 
void chap_run (void)
 Run CHAP authentication main function. More...
 
void chap_process (NET_FRAME *frame)
 Process CHAP authentication frame. More...
 
void slip_init_link (void)
 Initialize SLIP interface. More...
 
void slip_run_link (void)
 Run SLIP interface main function. More...
 
bool slip_send_frame (NET_FRAME *frame)
 Send a SLIP frame. More...
 
void ip_localhost_init (void)
 Initialize IP localhost. More...
 
void ip_localhost_run (void)
 Run IP localhost main function. More...
 
void icmp_service_init (void)
 Initialize ICMP service. More...
 
void icmp_service_run (void)
 Run ICMP service main function. More...
 
void udp_socket_init (void)
 Initialize UDP sockets. More...
 
void udp_process (NET_FRAME *frame)
 Process UDP frame. More...
 
void tcp_socket_init (void)
 Initialize TCP sockets. More...
 
void tcp_socket_poll (void)
 Run TCP socket main function. More...
 
void tcp_process (NET_FRAME *frame)
 Process TCP frame. More...
 
void dns_client_init (void)
 Initialize DNS client. More...
 
void dns_client_run (void)
 Run DNS client main function. More...
 
void bsd_socket_init (void)
 Initialize BSD sockets. More...
 
void bsd_socket_poll (void)
 Run BSD socket main function. More...
 
void bsd_lock (void)
 Lock BSD socket functions (acquire mutex). More...
 
void bsd_unlock (void)
 Unlock BSD socket functions (release mutex). More...
 
void bsd_host_init (void)
 Initialize BSD host resolver. More...
 
void ftp_server_init (void)
 Initialize FTP server. More...
 
void ftp_server_run (void)
 Run FTP server main function. More...
 
void ftp_client_init (void)
 Initialize FTP client. More...
 
void ftp_client_run (void)
 Run FTP client main function. More...
 
void tftp_server_init (void)
 Initialize TFTP server. More...
 
void tftp_server_run (void)
 Run TFTP server main function. More...
 
void tftp_client_init (void)
 Initialize TFTP client. More...
 
void tftp_client_run (void)
 Run TFTP client main function. More...
 
void smtp_client_init (void)
 Initialize SMTP client. More...
 
void smtp_client_run (void)
 Run SMTP client main function. More...
 
void snmp_agent_init (void)
 Initialize SNMP agent. More...
 
void snmp_agent_run (void)
 Run SNMP agent main function. More...
 
void sntp_client_init (void)
 Initialize SNTP client. More...
 
void sntp_client_run (void)
 Run SNTP client main function. More...
 
void telnet_server_init (void)
 Initialize Telnet server. More...
 
void telnet_server_run (void)
 Run Telnet server main function. More...
 
void http_server_init (void)
 Initialize HTTP server. More...
 
void http_server_run (void)
 Run HTTP server main function. More...
 
void net_debug_init (void)
 Initialize debug interface. More...
 
void dbg_info (int32_t proc, const char *fmt,...)
 Debug print information message. More...
 
void dbg_error (int32_t proc, const char *fmt,...)
 Debug print error message. More...
 
const char * dbg_proc (int32_t proc)
 Convert process id into a string. More...
 
const char * dbg_time (void)
 Get current network time for debug. More...
 

Data Structure Documentation

◆ ETH_CFG

struct ETH_CFG

Ethernet Interface Configuration info.

Data Fields
ARP_CFG ArpCfg ARP configuration.
DHCP_CFG DhcpCfg DHCP configuraton.
ARM_DRIVER_ETH_MAC * DrvMac Registered MAC driver.
ARM_DRIVER_ETH_PHY * DrvPhy Registered PHY driver.
IGMP_CFG IgmpCfg IGMP configuration.
uint8_t * MacAddr MAC address.

◆ COM_DEV

struct COM_DEV

Serial Device Configuration info.

Data Fields
DRIVER_MODEM * DrvModem Registered MODEM driver.
ARM_DRIVER_USART * DrvUsart Registered USART driver.
uint8_t FlowCtrl Flow control.
const char * InitString Modem initialization string.
uint32_t Speed Connection Speed.

◆ SLIP_CFG

struct SLIP_CFG

SLIP Interface Configuration info.

Data Fields
COM_DEV Dev Serial Device configuration.
uint16_t SerTout Serial Frame Receive Timeout.

Macro Definition Documentation

◆ ETH_FRAME_MTU

#define ETH_FRAME_MTU   1514

Ethernet frame max. transfer unit.

◆ NET_HEADER_LEN

#define NET_HEADER_LEN   4

General definitions.

Network frame header length

◆ NET_PASSWORD_SIZE

#define NET_PASSWORD_SIZE   20

Authentication password buffer size.

◆ PHY_HEADER_LEN

#define PHY_HEADER_LEN   14

Physical/ethernet header length.

◆ TNET_FIFOSZ

#define TNET_FIFOSZ   128

Input character Fifo buffer in bytes.

◆ TNET_HISTSZ

#define TNET_HISTSZ   128

Command History buffer size in bytes.

◆ TNET_LBUFSZ

#define TNET_LBUFSZ   96

Debug process definitions.

Telnet definitions Command Line buffer size in bytes

Function Documentation

◆ dbg_error()

void dbg_error ( int32_t  proc,
const char *  fmt,
  ... 
)

Debug print error message.

Parameters
[in]procnetwork process id.
[in]fmtprintf format string.
Returns
None.

◆ dbg_info()

void dbg_info ( int32_t  proc,
const char *  fmt,
  ... 
)

Debug print information message.

Parameters
[in]procnetwork process id.
[in]fmtprintf format string.
Returns
None

◆ dbg_proc()

const char * dbg_proc ( int32_t  proc)

Convert process id into a string.

Parameters
[in]procnetwork process id.
Returns
pointer to process id string.

◆ dbg_time()

const char * dbg_time ( void  )

Get current network time for debug.

Returns
pointer to current time string.

◆ eth_get_addr()

const uint8_t * eth_get_addr ( const uint8_t *  ip_addr)

Get MAC address for the given IP address.

Parameters
[in]ip_addrIP address of a host.
Returns
Pointer to the MAC address in ARP cache.

◆ igmp_is_member()

bool igmp_is_member ( const uint8_t *  ipadr)

Check if local host is a member of provided group.

Parameters
[in]ipadrmulticast IP address to be checked.
Returns
  • true = Local host is member of IGMP group ipadr.
  • false = Local host is not member.

◆ net_debug_init()

void net_debug_init ( void  )

Initialize debug interface.

Returns
None

◆ sntp_client_init()

void sntp_client_init ( void  )

Initialize SNTP client.

Returns
None

◆ sntp_client_run()

void sntp_client_run ( void  )

Run SNTP client main function.

Returns
None