MDK 5.0的RL Tcp/ip库和MDK 4.0的RL-TCPNet的区别


from: http://www.keil.com/pack/doc/mw/Network/html/network_diffs.html


Differences to RL-TCPnet

The following sections describe the changes to the API functions of the Network Component compared to RL-TCPnet, the Real-Time Library provided with MDK Version 4. Previously, there have been two files carrying the header files: rtl.h and net_config.h. This has been unified in MDK-ARM Version 5 to one header file called rl_net.h. The MDK-ARM Version 5 Network Component requires CMSIS-RTOS functionality. Events are no longer called by interrupt service routines which makes the timing of the overall system more predictable. 
The API functions along with the differences are shown in the order:

RL-TCPnet: MDK-ARM Version 4 with links to the RL-ARM online manual.
Network Component: MDK-ARM Version 5.

Description of the difference.

Note
  • Some API function names are changed to unify the name space of the Software Components.

Changes from rtl.h

rtl.h         // Network API for RL-ARM middleware components (MDK-ARM Version 4)
rl_net.h      // Complete API for Network Component (MDK-ARM Version 5)

MDK Middleware now uses a single header file for the Network Component.

void      init_TcpNet    (void)
netStatus net_initialize (void)

Return code changed to netStatus.

BOOL  main_TcpNet (void)
int   net_main    (void)

Return code changed to int.

void  timer_tick (void)
removed 

The function is now replaced by CMSIS-RTOS functionality and therefore no longer required.

U8      udp_get_socket (U8      tos, U8      opt, U16 (*listener)(U8 socket, U8 *remip, U16 port, U8 *buf, U16 len))
int32_t udp_get_socket (uint8_t tos, uint8_t opt, net_udp_cb_t cb_func)
  • Returns socket handle number or execution status as defined with netStatus.
  • Event listening callback function added (must be provided by the user). Refer to net_udp_cb_t.
BOOL      udp_release_socket (U8      socket)
netStatus udp_release_socket (int32_t socket)

Return code changed to netStatus.

BOOL      udp_open (U8      socket, U16   locport)
netStatus udp_open (int32_t socket, uint16_t port)

Return code changed to netStatus.

BOOL      udp_close (U8      socket)
netStatus udp_close (int32_t socket)

Return code changed to netStatus.

BOOL      udp_mcast_ttl     (U8      socket, U8      ttl)
netStatus udp_multicast_ttl (int32_t socket, uint8_t ttl)

Return code changed to netStatus.

U8      udp_get_buf (U16     size)
uint8_t udp_get_buf (uint32_t size)

Identical functionality.

BOOL      udp_send (U8      socket, U8            *remip,   U16   remport, U8      *buf, U16     dlen)
netStatus udp_send (int32_t socket, const uint8_t *ip_addr, uint16_t port, uint8_t *buf, uint32_t len)

Return code changed to netStatus.

U8      tcp_get_socket (U8      type, U8      tos, U16      tout, U16 (*listener)(U8 socket, U8 event, U8 *buf, U16 len))
int32_t tcp_get_socket (uint8_t type, uint8_t tos, uint32_t tout, net_tcp_cb_t cb_func)

Identical functionality.

BOOL      tcp_release_socket (U8      socket)
netStatus tcp_release_socket (int32_t socket)

Return code changed to netStatus.

BOOL      tcp_listen (U8      socket, U16   locport)
netStatus tcp_listen (int32_t socket, uint16_t port)

Return code changed to netStatus.

BOOL      tcp_connect (U8      socket, U8             *remip,  U16   remport, U16      locport)
netStatus tcp_connect (int32_t socket, const uint8_t *ip_addr, uint16_t port, uint16_t local_port)

Return code changed to netStatus.

U8      tcp_get_buf (U16      size)
uint8_t tcp_get_buf (uint32_t size)

Identical functionality.

U16      tcp_max_dsize     (U8      socket)
uint32_t tcp_max_data_size (int32_t socket)

Return value changed to 32-bit unsigned integer.

BOOL  tcp_check_send (U8      socket)
bool  tcp_check_send (int32_t socket)

Identical functionality.

U8       tcp_get_state (U8      socket)
tcpState tcp_get_state (int32_t socket)

Return code changed to tcpState.

BOOL      tcp_send (U8      socket, U8      *buf, U16     dlen)
netStatus tcp_send (int32_t socket, uint8_t *buf, uint32_t len)

Return code changed to netStatus.

BOOL      tcp_close (U8      socket)
netStatus tcp_close (int32_t socket)

Return code changed to netStatus.

BOOL      tcp_abort (U8      socket)
netStatus tcp_abort (int32_t socket)

Return code changed to netStatus.

void      tcp_reset_window (U8      socket)
netStatus tcp_reset_window (int32_t socket)

Return code changed to netStatus.

BOOL      arp_cache_ip (                       U8       *ipadr,  U8           type)
netStatus arp_cache_ip (uint32_t if_num, const uint8_t *ip_addr, arpCacheType type)
  • Return code changed to netStatus.
  • Added if_num specifying the network interface number, using arpCacheType enum now.
BOOL      arp_cache_mac (                       U8      *hwadr)
netStatus arp_cache_mac (uint32_t if_num, const uint8_t *mac_addr)
  • Return code changed to netStatus.
  • Added if_num specifying the network interface number.
did not exist
netStatus arp_get_ip (const uint8_t *mac_addr, uint8_t *ip_addr)

Get an IP address from the ARP cache.

did not exist
netStatus arp_get_mac (const uint8_t *ip_addr, uint8_t *mac_addr)

Get a MAC address from the ARP cache.

void      ppp_listen (const char *user,     const char *passw)
netStatus ppp_listen (const char *username, const char *password)

Return code changed to netStatus.

void      ppp_connect (const char *dialnum,  const char *user,     const char *passw)
netStatus ppp_connect (const char *dial_num, const char *username, const char *password)

Return code changed to netStatus.

void      ppp_close (void)
netStatus ppp_close (void)

Return code changed to netStatus.

void      slip_listen (void)
netStatus slip_listen (void)

Return code changed to netStatus.

void      slip_connect (const char *dialnum)
netStatus slip_connect (const char *dial_num)

Return code changed to netStatus.

void      slip_close (void)
netStatus slip_close (void)

Return code changed to netStatus.

U8        get_host_by_name (U8         *hostn, void (*cbfunc)(U8 event, U8 *host_ip))
netStatus get_host_by_name (const char *name,  net_dns_client_cb_t cb_func)
  • Return code changed to netStatus.
  • Event definitions changed to dnsClientEvent (see net_dns_client_cb_t).
  • Refer to DNS Client for more information.
BOOL      smtp_connect        (      U8      *ipadr,   U16      port, void (*cbfunc)(U8 event))
netStatus smtp_client_connect (const uint8_t *ip_addr, uint16_t port)
  • Return code changed to netStatus.
  • Function callback parameter removed.
  • New function smtp_client_notify added for that purpose.
void      dhcp_disable (void)
netStatus dhcp_disable (uint32_t if_num)
  • Return code changed to netStatus.
  • The argument if_num specifies the network interface number.
BOOL      igmp_join (                       U8      *group_ip)
netStatus igmp_join (uint32_t if_num, const uint8_t *ip_addr)
  • Return code changed to netStatus.
  • The argument if_num specifies the network interface number.
BOOL      igmp_leave (                       U8      *group_ip)
netStatus igmp_leave (uint32_t if_num, const uint8_t *ip_addr)
  • Return code changed to netStatus.
  • The argument if_num specifies the network interface number.
BOOL      snmp_trap (      U8      *manager_ip, U8      gen_trap, U8      spec_trap,      U16      *obj_list)
netStatus snmp_trap (const uint8_t *ip_addr,    uint8_t generic,  uint8_t specific, const uint16_t *obj_list)

Return code changed to netStatus.

BOOL      snmp_set_community (const char *community)
netStatus snmp_set_community (const char *community)

Return code changed to netStatus.

BOOL      icmp_ping (      U8      *remip,   void (*cbfunc)(U8 event))
netStatus icmp_ping (const uint8_t *ip_addr, net_icmp_cb_t cb_func)
  • Return code changed to netStatus.
  • Event definitions changed to icmpEvent (refer to net_icmp_cb_t).
BOOL      ftpc_connect       (      U8      *ipadr,   U16      port, U8         command, void (*cbfunc)(U8 event))
netStatus ftp_client_connect (const uint8_t *ip_addr, uint16_t port, ftpCommand command)
  • Return code changed to netStatus.
  • Command definitions changed enum ftpCommand.
  • Function callback parameter removed. New function ftp_client_notify added for that purpose.
did not exist
uint8_t ftp_check_username (const char *username)

Check if an user account exist in the user database.

did not exist
bool ftp_check_password (uint8_t user_id, const char *password)

Check user account password in the user database.

did not exist
void ftp_client_notify (ftpClientEvent event)

Notify the user application when FTP client operation ends.

BOOL      tftpc_put       (      U8      *ipadr,   U16      port, const char *src, const char *dst, void (*cbfunc)(U8 event))
netStatus tftp_client_put (const uint8_t *ip_addr, uint16_t port, const char *src, const char *dst)
  • Return code changed to netStatus.
  • Event definitions changed to enum tftpClientEvent.
  • Function callback parameter removed. New function tftp_client_notify added for that purpose.
BOOL      tftpc_get       (      U8      *ipadr,   U16      port, const char *src, const char *dst, void (*cbfunc)(U8 event))
netStatus tftp_client_get (const uint8_t *ip_addr, uint16_t port, const char *src, const char *dst)
  • Return code changed to netStatus.
  • Event definitions changed to enum tftpClientEvent.
  • Function callback parameter removed. New function tftp_client_notify added for that purpose.
did not exist
void tftp_client_notify (tftpClientEvent event)

Notify the user application when TFTP client operation ends.

BOOL      sntp_get_time (      U8      *ipadr,   void               (*cbfunc)(U32 utc_time))
netStatus sntp_get_time (const uint8_t *ip_addr, net_sntp_client_cb_t cb_func)

Return code changed to netStatus.

void  ftp_evt_notify    (U8             evt)
void  ftp_server_notify (ftpServerEvent event)

Event definitions changed to enum ftpServerEvent.

did not exist
uint8_t telnet_check_username (const char *username)

Check if an user account exist in the user database.

did not exist
bool telnet_check_password (uint8_t user_id, const char *password)

Check user account password in the user database.

did not exist
void smtp_client_notify (smtpClientEvent event)
  • Provides notification to user application about the end of the SMTP client operation.
  • Replaces user provided callback function.
did not exist
const char http_encoding (void)

Override default character encoding of HTML documents in a web browser.

BSD socket functions

 
    

Return code changed from SCK_Exxx to BSD_ERROR_xxx.

Changes from net_config.h

net_config.h  // Common TCPnet definitions (MDK-ARM Version 4)
rl_net.h      // Complete API for Network Component (MDK-ARM Version 5)

MDK Middleware now uses a single header file for the Network Component.

void  dhcp_cbfunc        (                 U8               opt,       U8      *val, U16      len)
void  dhcp_client_notify (uint32_t if_num, dhcpClientOption opt, const uint8_t *val, uint32_t len)
  • Added if_num specifying the network interface number.
  • Option definitions changed to enum dhcpClientOption.
void  http_fopen        (      U8   *name)
void  http_server_fopen (const char *fname)

Identical functionality.

void  http_fclose        (void *file)
void  http_server_fclose (void *file)

Identical functionality.

U16      http_fread        (void *file, U8      *buf, U16      len)
uint32_t http_server_fread (void *file, uint8_t *buf, uint32_t len)

Identical functionality.

BOOL  http_fgets        (void *file, U8   *buf, U16      size)
char  http_server_fgets (void *file, char *buf, uint16_t size)

Return code changed to char.

U32      http_finfo        (      U8   *name)
uint32_t http_server_ftime (const char *fname)

Identical functionality.

void  cgi_process_var   (      U8   *qstr)
void  cgi_process_query (const char *qstr)

Identical functionality.

void  cgi_process_data (U8      code,       U8   *dat,  U16      len)
void  cgi_process_data (uint8_t code, const char *data, uint32_t len)

Identical functionality.

U16      cgi_func   (      U8   *env, U8   *buf, U16      buflen, U32      *pcgi)
uint32_t cgi_script (const char *env, char *buf, uint32_t buflen, uint32_t *pcgi)

Identical functionality.

      U8   cgx_content_type (void)
const char cgx_content_type (void)

Return code changed to const char.

BOOL  http_accept_host   (      U8      *rem_ip,  U16  rem_port)
bool  http_accept_client (const uint8_t *ip_addr, uint16_t port)

Identical functionality.

BOOL  http_file_access (U8 *fname, U8 user_id)
bool  http_file_access (uint8_t user_id, const char *fname)

Identical functionality.

U8      http_check_account (      U8   *user,           U8   *passw)
uint8_t http_check_account (const char *username, const char *password)

Identical functionality.

      U8   http_get_var     (      U8   *env, void *ansi, U16      maxlen)
const char http_get_env_var (const char *env, char *ansi, uint32_t maxlen)

Return code changed to const char.

      U8   http_get_lang        (void)
const char http_server_get_lang (void)

Return code changed to const char.

void      http_get_info          (REMOTEM *info)
netStatus http_server_get_client (uint8_t *ip_addr, uint8_t *mac_addr)

Return code changed to netStatus.

U8      http_get_session        (void)
int32_t http_server_get_session (void)

Identical functionality.

U8      http_get_user_id (void)
uint8_t http_get_user_id (void)

Identical functionality.

      U8   http_get_content_type        (void)
const char http_server_get_content_type (void)

Return code changed to const char.

U32   http_date (RL_TIME *time)
removed 
U16      tnet_cbfunc           (U8                  code, U8   *buf, U16   buflen)
uint32_t telnet_server_message (telnetServerMessage msg,  char *buf, uint32_t len)

Identical functionality.

U16      tnet_process_cmd      (      U8   *cmd, U8   *buf, U16      buflen, U32      *pvar)
uint32_t telnet_server_process (const char *cmd, char *buf, uint32_t buflen, uint32_t *pvar)

Identical functionality.

BOOL  tnet_ccmp            (      U8   *buf,       U8   *cmd)
bool  telnet_check_command (const char *cmd, const char *user_cmd);

Identical functionality.

void      tnet_set_delay          (U16      cnt)
netStatus telnet_server_set_delay (uint32_t delay)

Return code changed to netStatus.

void      tnet_get_info            (REMOTEM *info)
netStatus telnet_server_get_client (uint8_t *ip_addr, uint8_t *mac_addr)

Return code changed to netStatus.

U8      tnet_get_session          (void)
int32_t telnet_server_get_session (void)

Identical functionality.

U8      tnet_get_user_id   (void)
uint8_t telnet_get_user_id (void)

Identical functionality.

BOOL  tnet_msg_poll              (U8      session)
bool  telnet_server_message_poll (int32_t session)

Identical functionality.

BOOL  tnet_accept_host     (      U8      *rem_ip,  U16  rem_port)
bool  telnet_accept_client (const uint8_t *ip_addr, uint16_t port)

Identical functionality.

U8    tnet_check_account (U8 code, U8 *id)
replaced by telnet_check_username and telnet_check_password
void  tftp_fopen        (      U8   *fname,       U8   *mode)
void  tftp_server_fopen (const char *fname, const char *mode)

Identical functionality.

void  tftp_fclose        (void *file)
void  tftp_server_fclose (void *file)

Identical functionality.

U16      tftp_fread        (void *file, U8      *buf, U16      len)
uint32_t tftp_server_fread (void *file, uint8_t *buf, uint32_t len)

Identical functionality.

U16      tftp_fwrite        (void *file,       U8      *buf, U16      len)
uint32_t tftp_server_fwrite (void *file, const uint8_t *buf, uint32_t len)

Identical functionality.

BOOL  tftp_accept_host   (      U8      *rem_ip,  U16  rem_port)
bool  tftp_accept_client (const uint8_t *ip_addr, uint16_t port)

Identical functionality.

void  tftpc_fopen       (      U8   *fname,       U8   *mode)
void  tftp_client_fopen (const char *fname, const char *mode)

Identical functionality.

void  tftpc_fclose       (void *file)
void  tftp_client_fclose (void *file)

Identical functionality.

U16      tftpc_fread       (void *file, U8      *buf, U16      len)
uint32_t tftp_client_fread (void *file, uint8_t *buf, uint32_t len)

Identical functionality.

U16      tftpc_fwrite       (void *file,       U8      *buf, U16      len)
uint32_t tftp_client_fwrite (void *file, const uint8_t *buf, uint32_t len)

Identical functionality.

void  ftp_fopen        (      U8   *fname,       U8   *mode)
void  ftp_server_fopen (const char *fname, const char *mode)

Identical functionality.

void  ftp_fclose        (void *file)
void  ftp_server_fclose (void *file)

Identical functionality.

U16      ftp_fread        (void *file, U8      *buf, U16      len)
uint32_t ftp_server_fread (void *file, uint8_t *buf, uint32_t len)

Identical functionality.

U16      ftp_fwrite        (void *file,       U8      *buf, U16      len)
uint32_t ftp_server_fwrite (void *file, const uint8_t *buf, uint32_t len)

Identical functionality.

BOOL  ftp_fdelete        (      U8   *fname)
bool  ftp_server_fdelete (const char *fname)

Identical functionality.

BOOL  ftp_frename        (      U8   *fname,       U8   *newn)
bool  ftp_server_frename (const char *fname, const char *newname)

Identical functionality.

U16      ftp_ffind        (U8      code, U8   *buf, U8 *mask, U16 len)
uint32_t ftp_server_ffind (uint8_t code, char *buf, uint32_t buflen, const char *mask)

Identical functionality.

BOOL  ftp_accept_host   (      U8      *rem_ip,  U16  rem_port)
bool  ftp_accept_client (const uint8_t *ip_addr, uint16_t port)

Identical functionality.

U8    ftp_check_account (U8 code, U8 *id)
replaced by ftp_check_username and ftp_check_password
U8      ftp_get_user_id (void)
uint8_t ftp_get_user_id (void)

Identical functionality.

BOOL  ftp_file_access (U8 *fname, U8 mode, U8 user_id)
bool  ftp_file_access (uint8_t user_id, const char *fname, uint8_t mode)

Identical functionality.

void  ftp_evt_notify    (U8             evt)
void  ftp_server_notify (ftpServerEvent event)

Identical functionality.

void  ftpc_fopen       (                         U8   *mode)
void  ftp_client_fopen (const char *fname, const char *mode)

Identical functionality.

void  ftpc_fclose       (void *file)
void  ftp_client_fclose (void *file)

Identical functionality.

U16      ftpc_fread       (void *file, U8      *buf, U16      len)
uint32_t ftp_client_fread (void *file, uint8_t *buf, uint32_t len)

Identical functionality.

U16      ftpc_fwrite       (void *file,       U8      *buf, U16      len)
uint32_t ftp_client_fwrite (void *file, const uint8_t *buf, uint32_t len)

Identical functionality.

U16      ftpc_cbfunc        (U8 code,                  U8   *buf, U16   buflen)
uint32_t ftp_client_request (ftpClientRequest request, char *buf, uint32_t len)

Identical functionality.

U8        get_host_by_name (      U8   *hostn, void} (*cbfunc)  (U8, U8 *))
netStatus get_host_by_name (const char *name,  net_dns_client_cb_t cb_func)

Return code changed to netStatus.

U16      smtp_cbfunc         (U8 code,                   U8   *buf, U16      buflen, U32      *pvar)
uint32_t smtp_client_request (smtpClientRequest request, char *buf, uint32_t buflen, uint32_t *pvar)

Identical functionality.

BOOL  smtp_accept_auth                  (      U8      *srv_ip)
bool  smtp_client_accept_authentication (const uint8_t *ip_addr)

Identical functionality.


你可能感兴趣的:(MDK 5.0的RL Tcp/ip库和MDK 4.0的RL-TCPNet的区别)