EZ800000100STS Zilog, EZ800000100STS Datasheet

no-image

EZ800000100STS

Manufacturer Part Number
EZ800000100STS
Description
SOFTWARE TCP/IP SOURCE CODE
Manufacturer
Zilog
Type
Protocol Stackr
Datasheets

Specifications of EZ800000100STS

Tool Type
Programming Software
Core Architecture
Z8
For Use With/related Products
eZ80 Acclaim! MCU
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
®
eZ80
CPU
Zilog TCP/IP Stack API
Reference Manual
RM004012-0707
®
Copyright ©2007 by Zilog
, Inc. All rights reserved.
www.zilog.com

Related parts for EZ800000100STS

EZ800000100STS Summary of contents

Page 1

... CPU Zilog TCP/IP Stack API Reference Manual RM004012-0707 ® Copyright ©2007 by Zilog , Inc. All rights reserved. www.zilog.com ...

Page 2

... DEVICES, OR TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE. The information contained within this document has been verified according to the general principles of electrical and mechanical engineering. eZ80, and eZ80Acclaim! are trademarks or registered trademarks of Zilog, Inc. All other product or service names are the property of their respective owners. RM004012-0707 ...

Page 3

... RM004012-0707 Zilog TCP/IP Stack API Description Globally updated ZiLOG as Zilog. Globally updated for ZTP v2.1.0 release. Updated document as per Zilog Style Guide. Updated ioctlsocket, ftp_connect, do_programatic_login, do_a_ftp_command, Http_Request Structure, accept, listen, hgleave, name2ip, xc_ascdate, Table 16. Removed Kernel API’s, Process ...

Page 4

... DNS Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 RARP Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 IGMP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 TFTP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 FTP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Ping Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 ICMP Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 SNTP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Appendix A—Definitions and Codes Data Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 ZTP Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Telnet Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 SNMP Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 RM004012-0707 Zilog TCP/IP Stack API Reference Manual Table of Contents iv ...

Page 5

... Zilog TCP/IP Stack API ® eZ80 CPU v ZTP Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 ZTP Core Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Telnet Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 SNTP Client Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 ZTP Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 ZTP Core Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 ioctlsocket Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 SNMP Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 ZTP Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 ZTP Core Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 HTTP Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 SNMP Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 ZTP C Run-Time Library Functions ...

Page 6

... We have designed this manual to be used as a reference guide for ZTP APIs. Intended Audience This document is written for Zilog customers who are familiar with real- time operating systems and are experienced at working with microprocessors, in writing assembly code writing higher level languages such as C ...

Page 7

... Zilog TCP/IP Stack API ® eZ80 CPU vii • • • • • • • • • • • • Appendix A—Definitions and Codes This appendix lists the enumerations and different data type definitions used in ZTP. Related Documents Table 1 ZTP efficiently. ...

Page 8

... Courier typeface. For example, #include <socket.h> Safeguards When you use ZTP along with one of Zilog’s development platforms, always use a grounding strap to prevent damage resulting from electro- static discharge (ESD) to avoid permanent damage to the development platform. ...

Page 9

... ZTP API Reference Zilog TCP/IP Stack consists of a rich-set of APIs for accessing the TCP/IP protocol stack. This section provides a description of each ZTP API including inputs and outputs. Each API is classified according to the protocol or command that it is associated with. Table 2 provides a quick reference to ZTP APIs based on its protocol. ...

Page 10

... Zilog TCP/IP Stack API ® eZ80 CPU 2 ZTP Networking APIs This section describes the user interfaces to the ZTP stack. All the APIs listed in this section return a negative value if an error occurs. Positive values are considered to be the expected output. Table 3 Table 3. ZTP Networking APIs Quick Reference ...

Page 11

... Uses UDP for the Internet address family. Socket type definitions appear in the socket.h header file. with sockets that are specific to an indicated address family. As this parameter is not used, the value passed must be zero across all versions of ZTP. Zilog TCP/IP Stack API Reference Manual ZTP API Reference 3 ...

Page 12

... Zilog TCP/IP Stack API ® eZ80 CPU 4 The socket to be allocated and bound to a specific transport service provider. Return Value(s) If successful, the of which must be greater than or equal the returned value is less than 0, one of the following errors is returned. EPROTONOSUPPORT ENOBUFS ZTP API Reference ...

Page 13

... A descriptor identifying an unbound socket. The address to assigned to the socket from the sockaddr structure. and connect listen function to establish a local association bind function returns bind Address family not supported. Zilog TCP/IP Stack API Reference Manual functions used to . ZTP_SOCK_OK ZTP API Reference 5 ...

Page 14

... Zilog TCP/IP Stack API ® eZ80 CPU 6 EINVAL EBADF See Also sockaddr Structure ZTP API Reference Invalid socket descriptor (descriptor already in use). Invalid socket descriptor (not allocated). RM004012-0707 ...

Page 15

... The exact format of the peername parameter is determined by the address family established when the socket connection was created. of the peernamelen. function extracts the first connection on the queue then creates a new socket and s Zilog TCP/IP Stack API Reference Manual function can accept ZTP API Reference 7 ...

Page 16

... Zilog TCP/IP Stack API ® eZ80 CPU 8 tions are present in the queue, and the socket is marked as blocking. If the socket is marked nonblocking and no pending connections are present in the queue, below. After successful completion, handle. The original socket remains open and listens for new connec- tion requests ...

Page 17

... A descriptor identifying a bound, unconnected socket. this value is MAXSOCKS, then the underlying service provider responsible for socket s sets the backlog to a reasonable maximum value. is placed into passive mode in which incoming connec- s function. listen Zilog TCP/IP Stack API Reference Manual ZTP API Reference 9 ...

Page 18

... Zilog TCP/IP Stack API ® eZ80 CPU 10 Failure ZTP API Reference One of the following values is returned. EINVAL—Invalid socket descriptor. EBADF—Invalid socket descriptor (not allocated). EOPNOTSUPP—Socket type not supported. EFAULT—backlog exceeding MAXSOCKS. RM004012-0707 ...

Page 19

... A descriptor identifying an unconnected socket. A pointer to the socket structure specifying the host to connect to. function is used to create a connection to a specified is unbound, unique values are assigned blocking call and is not returned unless con- connect Zilog TCP/IP Stack API Reference Manual ZTP API Reference 11 ...

Page 20

... Zilog TCP/IP Stack API ® eZ80 CPU 12 ReturnValue(s) Success If no error occurs, connect returns ZTP_SOCK_OK. Failure See Also sockaddr Structure ZTP API Reference One of the following errors is returned. EAFNOSUPPORT—Address family not supported. EINVAL—Invalid descriptor. ECONNREFUSED—Connection refused by peer. RM004012-0707 ...

Page 21

... RM004012-0707 recv s, * buf, nbyte, flags function receives data from a connected socket. recv function reads incoming data on connection-oriented sock- function restricts the addresses from which recv Zilog TCP/IP Stack API Reference Manual . For a con- recv for example), SOCK_STREAM ZTP API Reference 13 ...

Page 22

... Zilog TCP/IP Stack API ® eZ80 CPU 14 3. Zilog recommends not using ReturnValue(s) Success If no error occurs, recv() returns the number of bytes Failure ZTP API Reference recv() received. If the connection has been gracefully closed, the return value is EFAULT. One of the following error codes is returned: EDEADSOCK— ...

Page 23

... RM004012-0707 function sends data on a connected socket. send function is used to write outgoing data on a connected blocks unless the socket is placed in send Zilog TCP/IP Stack API Reference Manual TCP does not indicate that the send ZTP API Reference 15 ...

Page 24

... Zilog TCP/IP Stack API ® eZ80 CPU non-blocking stream-oriented sockets, the number of bytes written Return Value(s) Success If no error occurs, send returns the total number of bytes Failure See Also ZTP Core Macros ZTP API Reference is between one and the requested length, depending on buffer avail- ability on both client and server ...

Page 25

... EBADF—Invalid socket descriptor (not allocated). RM004012-0707 function closes an existing socket. close_s function closes an active socket. This function is used so that further references to s close_s is issued on a master socket (a socket used in TCP server Zilog TCP/IP Stack API Reference Manual fail. s for each successful call to ZTP API Reference 17 ...

Page 26

... Zilog TCP/IP Stack API ® eZ80 CPU 18 recvfrom Include #include <socket.h> Prototype INT16 recvfrom ( INT16 s, INT8 *buf, INT16 len, INT16 flags, struct sockaddr * from, INT16 * fromlen ); Description The sockets’ source address. Argument(s) s buf len flags from fromlen An optional pointer to the size of the from buffer. ...

Page 27

... If an error occurs, one of the following error codes is returned: EBADF—Invalid descriptor. EPIPE—Invalid socket type. ENOCON—Connection refused. EFAULT—Other thread already blocked on socket. Zilog TCP/IP Stack API Reference Manual bind ZTP API Reference 19 ...

Page 28

... Zilog TCP/IP Stack API ® eZ80 CPU 20 sendto Include #include <socket.h> Prototype INT16 sendto ( INT16 INT8 INT16 INT16 struct INT16 ); Description The sockets’ Argument(s) s buf len flags to tolen Notes: 1. The ZTP API Reference s, *buf, len, flags, sockaddr *to, tolen, function sends data to a specific destination. ...

Page 29

... If an error occurs, one of the following error codes is returned: EBADF—Invalid descriptor. EPIPE—Invalid socket type. ENOCON—Connection refused. Zilog TCP/IP Stack API Reference Manual does not indicate that the must be used only with con- ZTP API Reference ...

Page 30

... Zilog TCP/IP Stack API ® eZ80 CPU 22 ioctlsocket Include #include <socket.h> Prototype INT16 ioctlsocket ( INT16 INT32 UINT32 ); Description The sockets’ Argument(s) s cmd ZTP API Reference s, cmd, *argp function controls the I/O mode of a socket. ioctlsocket A descriptor identifying a socket. One of the following supported commands to perform on socket s. ...

Page 31

... Argument(s) associated with the socket. 2. Compatibility–This functions on a socket when compared to the Berkeley sockets. RM004012-0707 Zilog TCP/IP Stack API Reference Manual function can be used on any socket in any state. It function performs only a subset of ioctlsocket ioctl 23 function found in ...

Page 32

... Zilog TCP/IP Stack API ® eZ80 CPU 24 Return Value(s) Success Returns 0 if successful. Failure ZTP API Reference If cmd is FIONREAD then number of bytes of data present in the socket buffer to be read is returned. If cmd is FIONWRITE then number of bytes of data present in the socket buffer to be sent is returned. ...

Page 33

... It is used on the bound or connected socket s getsockname function always does not return information ADDR_ANY Zilog TCP/IP Stack API Reference Manual for the socket name function determines the ). ZTP API Reference 25 ...

Page 34

... Zilog TCP/IP Stack API ® eZ80 CPU 26 Return Value( error occurs, When called, the in bytes. Upon return, the bytes) of the See Also sockaddr Structure ZTP API Reference returns 0; otherwise, it returns -1. getsockname argument contains the size of the namelen parameter contains the actual size (in namelen parameter ...

Page 35

... Zilog TCP/IP Stack API Reference Manual structure . getpeername ZTP API Reference 27 ...

Page 36

... Zilog TCP/IP Stack API ® eZ80 CPU 28 When called, the in bytes. Upon return, the bytes of the See Also sockaddr Structure ZTP API Reference argument contains the size of the namelen parameter contains the actual size in namelen returned. name buffer, name RM004012-0707 ...

Page 37

... A null-terminated character string representing a number expressed in the Internet standard ".'' (dotted) notation. function interprets the character string specified parameter. This string represents a numeric Internet ® devices). returns an inet_addr Zilog TCP/IP Stack API Reference Manual value containing a suit- UINT32 ZTP API Reference 29 ...

Page 38

... Zilog TCP/IP Stack API ® eZ80 CPU 30 inet_ntoa Include #include <ZTPtcp.h> Prototype INT8 *inet_ntoa(INT8 *s, UITN32 x) Description The in Internet standard dotted format. Argument( Note: The address and returns an ASCII string representing the address in dotted (".'') notation as in "a.b.c.d''. Return Value( error occurs, containing the text address in standard dotted (" ...

Page 39

... HTTP Function The Zilog TCP/IP Stack supports the following three HTTP functions: • http_init • httpBasicAuth_init • httpDigestAuth_init RM004012-0707 Zilog TCP/IP Stack API Reference Manual ZTP API Reference 31 ...

Page 40

... Zilog TCP/IP Stack API ® eZ80 CPU 32 http_init Include #include <http.h> Prototype INT16 http_init (const Http_Method* http_defmethods,const struct header_rec * httpdefheaders, Webpage *website, UINT16 portnum); Description The TCP connection on a specified port, and waits for a client request. Upon receiving a request from the client, the webserver provides a response according to the webserver configuration ...

Page 41

... RM004012-0707 function initializes a webserver (or website) A pointer to the supported methods structure. A pointer to the suppoted header structures. A pointer to the website for which the server processes requests. Port number on which the HTTP server listens. Zilog TCP/IP Stack API Reference Manual . Otherwise, ZTP API Reference 33 ...

Page 42

... Zilog TCP/IP Stack API ® eZ80 CPU 34 httpDigestAuth_init Include #include <http.h> Prototype INT16 httpDigestAuth _init (const Http_Method* httpAuth_defmethods,const struct header_rec * httpdefheaders, Webpage *website, UINT16 portnum); Description The website) with MD5 Digest Authentication support, opens a TCP connection on a specified port, and waits for a client request. Upon ...

Page 43

... RM004012-0707 "GET",http_get }, "HEAD",http_get }, "POST",http_post }, "SUBSCRIBE",http_post }, NULL, "GET",httpAuth_get }, "HEAD",httpAuth_get }, "POST",http_post }, "SUBSCRIBE",http_post }, NULL, array is extensible. Additional methods can structure. These methods can be optional . My_Method Zilog TCP/IP Stack API Reference Manual NULL }, NULL }, ZTP API Reference 35 ...

Page 44

... Zilog TCP/IP Stack API ® eZ80 CPU 36 4. All method handlers follow the same function prototype, as defined in Example void method_handler( Http_Request * ) { //Program coded by you } ZTP API Reference . The method handler simply parses the http.h performs the appropriate action(s), as shown in the example below. ...

Page 45

... HTTP_HDR_SEND_CLIENT_AUTH }, structure, and passes this structure as a http_request http_request on page 83. structure for known headers from the structure, you must provide the httpdefheaders structure before calling Zilog TCP/IP Stack API Reference Manual structure is listed in field of the rqstheaders httpdefheaders . http_init ZTP API Reference ...

Page 46

... Zilog TCP/IP Stack API ® eZ80 CPU 38 website A pointer to the website site parameter can contain both static web pages and dynamic web pages. Each element of the website array corresponds to a single static or dynamic web page. Two sample web page declarations for a Static ...

Page 47

... This routine parses the given HTTP parameter structure for a parameter, the name of which matches the specified key. If such a parameter is found RM004012-0707 {header, value} rqstheaders structure for a header, the name of which matches the Zilog TCP/IP Stack API Reference Manual pair to the list of in the ZTP API Reference 39 ...

Page 48

... Zilog TCP/IP Stack API ® eZ80 CPU 40 within the passed list, the function returns a pointer to the parameter’s value. void http_output_headers (Http_Request *request); This routine outputs the text representation of all of the instances of httpdefheader corresponding values. For more information refer to website demo provided with the standard projects available at: < ...

Page 49

... Structure Http_Method Structure header_rec Structure RM004012-0707 in the variable. The order of the search is determined by the vari- then first static web page array is searched, if not found then Zilog TCP/IP Stack API Reference Manual file. HTTP ZTPConfig.c INT8 http this variable is then it is ...

Page 50

... Zilog TCP/IP Stack API ® eZ80 CPU 42 HTTPS Function Zilog TCP/IP Stack supports one secure HTTP function https_init. https_init Include #include “ssl2_server.h” Prototype int https_init ( const Http_Method *methods, const struct header_rec *headers, Webpage *webpages, int port ); Description The Secure WebServer is initialized by calling the This API takes the same number and type of Argument(s) as the standard HTTP server API ...

Page 51

... Return Value(s) The function returns the port number on which SSL is listening https_init upon successfully opening the SSL device. See Also Http_Request Structure webpage Structure Http_Method Structure header_rec Structure RM004012-0707 Zilog TCP/IP Stack API Reference Manual ZTP API Reference 43 ...

Page 52

... Zilog TCP/IP Stack API ® eZ80 CPU 44 SNMP Functions Zilog TCP/IP Stack supports four SNMP functions. quick reference to each of these functions. Table 4. SNMP Functions Quick Reference snmp_init snmpv2_init snmpv3_init TrapGen ZTP API Reference Table 4 provides a RM004012-0707 ...

Page 53

... Return Value(s) None. RM004012-0707 API is called from the is used to inform the application whenever a trap is generated SNMP agent which is used to inform the application whenever a trap is generated by SNMP agent. Zilog TCP/IP Stack API Reference Manual routine to enable the main() snTrapNo- ZTP API Reference 45 ...

Page 54

... Zilog TCP/IP Stack API ® eZ80 CPU 46 snmpv2_init Include #include "snmp.h" Prototype void snmpv2_init(SN_TRAP_NOTIFY snTrapNotifyFunc); Description The SNMPv2 agent. This protocol can be used to read or write values in the MIB by using the Get, GetNext, or Set operations which are supported in SNMPv1. SNMPv2 also defines GetBulk which is used to efficiently retrieve large blocks of data ...

Page 55

... SNMPv3 performs the same function as SNMPv2 with added functionality of authentication and encryp- tion (if enabled). RM004012-0707 performs the same functions as SNMP agent which is used to inform the application whenever a trap is generated by SNMP agent. Zilog TCP/IP Stack API Reference Manual with the snmpv2_init ZTP API Reference 47 ...

Page 56

... Zilog TCP/IP Stack API ® eZ80 CPU 48 TrapGen Include #include "snmp.h" Prototype INT16 TrapGen( UINT8 Type, DWORD Code, UINT16 NumObjects, SN_Object_s *pObjectList ); Description The ager that an event has occurred on the agent. The SNMP library in ZTP is capable of generating the following SNMP v1 traps: • ...

Page 57

... SN_Object_s structures that identify the SNMP objects to be included in the body of the trap message. If the application-specific trap does not require any objects to be included in the trap message, set this parameter to NULL. Zilog TCP/IP Stack API Reference Manual Flag is set to TRUE, ZTP API Reference 49 ...

Page 58

... Zilog TCP/IP Stack API ® eZ80 CPU 50 Return Value(s) The SN_TRAP_ENTERPRISE_SPECIFIC and if Generate_Enterprise_Traps is FALSE. It returns OK upon successful generation of a Trap. See Also SN_TRAP_ENTERPRISE_SPECIFIC SN_Object_s Structure ZTP API Reference function returns SYSERR if the argument TrapGen is not Type RM004012-0707 ...

Page 59

... SMTP Function Zilog TCP/IP Stack supports one simple mail transport protocol (SMTP) function mail, which is described below. mail Include #include "smtp.h" Prototype INT16 mail(INT8 *Addr, UINT16 port, INT8 *subject, INT8 *to, INT8 *from, INT8 *usrname , INT8 *passwd, INT8 *data, INT8 *error, UINT16 errorlen) ...

Page 60

... Zilog TCP/IP Stack API ® eZ80 CPU 52 to from usrname passwd data error errorlen The maximum size (in bytes) of the buffer referenced by the Return Value( error occurs, ZTP API Reference A pointer to a character string containing the email address of the recipient. A pointer to a character string containing the email address of the sender ...

Page 61

... Telnet Functions Table 5 provides quick reference to Telnet function supported by Zilog TCP/IP Stack. For more information on Telnet definitions and Enumera- tions, see Appendix A Table 5. Telnet Functions Quick Reference telnet_init TelnetOpenConnection TelnetCloseConnection TelnetSendData RM004012-0707 Zilog TCP/IP Stack API Reference Manual on page 83. 53 ZTP API Reference ...

Page 62

... Zilog TCP/IP Stack API ® eZ80 CPU 54 telnet_init Include #include "telnet_api.h" Prototype void telnet_init (void) Description The thread, created as a result of this function, is used to handle requests from Telnet clients. Argument(s) None. Return Value(s) None. ZTP API Reference function initializes a Telnet server. The Telnet server ...

Page 63

... This function also sends the ECHO and SUPPRESSGOAHEAD options to the server. Argument(s) ipAddr telnetAppHandle telnetReadCallback RM004012-0707 Zilog TCP/IP Stack API TelnetOpenConnection A uint32 value which contains the IP address (in decimal/dotted notation) of the Telnet server. A pointer to a handle given by the Telnet client to the application after a connection is established successfully ...

Page 64

... Zilog TCP/IP Stack API ® eZ80 CPU 56 Return Value(s) It returns the following when it is executed: TELNET_ALREADY_CONNECTED Indicates that the Telnet connection TELNET_INVALID_ARG TELNET_LOWER_LAYER_FAILU RE TELNET_CONNECT_FAILURE TELNET_SUCCESS See Also Telnet Data Type Definitions Telnet Enumerations ZTP API Reference already exists. Indicates that one or more arguments are invalid ...

Page 65

... TELNET_FAILURE TELNET_SUCCESS See Also Telnet Enumerations Telnet Data Type Definitions RM004012-0707 Zilog TCP/IP Stack API function. It terminates the TCP connection with the Handle furnished by the Telnet client during the establishment of a successful connection. yet established. Indicates that one or more arguments are invalid ...

Page 66

... Zilog TCP/IP Stack API ® eZ80 CPU 58 TelnetSendData Include #include "telnet_api.h" Prototype TELNET_RET TelnetSendData ( TELNET_HANDLE telnetAppHandle, TELNET_DATA *telnetData, TELNET_DATA_SIZE telnetDataSize ) Description To send required data to the server (executing server-side commands), ZTP provides the ter entered to the server. The character is displayed on the console when the server echoes back the character ...

Page 67

... TELNET_LOWER_LAYER_FAILURE Indicates failure at lower layers. TELNET_SUCCESS See Also Telnet Data Type Definitions Telnet Enumerations RM004012-0707 Zilog TCP/IP Stack API Reference Manual Data has been sent successfully. ZTP API Reference 59 ...

Page 68

... Zilog TCP/IP Stack API ® eZ80 CPU 60 TimeP Protocol Function Zilog TCP/IP Stack supports one TimeP protocol function time_rqest, which is described below. time_rqest Include #include "date.h" Prototype INT16 time_rqest(void); Description The the IP address of which is specified in the csTbl[ ] request is received from the sever, the time is updated to the real-time clock (RTC) ...

Page 69

... DNS Functions Zilog TCP/IP Stack supports two DNS functions. quick reference to the DNS functions. Table 6. DNS Functions Quick Reference name2ip ip2name RM004012-0707 Zilog TCP/IP Stack API Reference Manual Table 6 provides a ZTP API Reference 61 ...

Page 70

... Zilog TCP/IP Stack API ® eZ80 CPU 62 name2ip include “domain.h” Prototype UINT32 name2ip(INT8 *nam) Description The tion sends a DNS formatted in UDP datagram with the DNS IP acquired from the Argument(s) nam Return Value(s) The successful. If this function fails, it returns SYSERR. ZTP API Reference function resolves a host name to IP addresses ...

Page 71

... The ip2name the resolved name when successful. If this function fails, it returns SYSERR. RM004012-0707 function returns the DNS name for a host when furnished cstbl function returns the pointer to the character buffer holding Zilog TCP/IP Stack API Reference Manual structure. ZTP API Reference 63 ...

Page 72

... Zilog TCP/IP Stack API ® eZ80 CPU 64 RARP Function Zilog TCP/IP Stack supports one reverse address resolution protocol (RARP) function rarpsend, which is described below. rarpsend Include #include "rarp.h" Prototype INT16 rarpsend(UINT8 ifn) Description The Reverse Address Resolution Protocol provides a mechanism for a host to obtain an IP address at startup ...

Page 73

... IGMP Functions Zilog TCP/IP Stack supports two IGMP functions. quick reference to the IGMP functions. Table 7. IGMP Functions Quick Reference hgjoin hgleave RM004012-0707 Zilog TCP/IP Stack API Reference Manual Table 7 provides a ZTP API Reference 65 ...

Page 74

... Zilog TCP/IP Stack API ® eZ80 CPU 66 hgjoin Include #include "igmp.h" Prototype INT16 hgjoin ( UINT8 ifnum, UINT32 ipa, UINT8 ttl ); Description The and sends a membership report for that particular group. If the eZ80 CPU is already a member of the group, the membership report for the group will not be sent ...

Page 75

... Interface number that should be set to the interface number of the primary Ethernet interface. IP addresses of the multicast group to leave. function returns OK when successful and SYSERR upon Zilog TCP/IP Stack API Reference Manual CPU from the membership of ZTP API Reference 67 ...

Page 76

... Zilog TCP/IP Stack API ® eZ80 CPU 68 TFTP Functions Zilog TCP/IP Stack supports two TFTP functions. quick reference to the TFTP functions. Table 8. TFTP Functions Quick Reference tftp_get tftp_put ZTP API Reference Table 8 provides a RM004012-0707 ...

Page 77

... RM004012-0707 function is used to download files from the TFTP server. Pointer to a character string containing the IP address of TFTP server. Pointer to the name of the file to be downloaded. function returns the number of bytes that tftp_get Zilog TCP/IP Stack API Reference Manual ZTP API Reference 69 ...

Page 78

... Zilog TCP/IP Stack API ® eZ80 CPU 70 tftp_put Include #include "tftp.h" Prototype INT16 tftp_put(INT8 *Addr, INT8 *filename) Description The the TFTP server. The file to be uploaded must be present in the thread’s current working directory (CWD). Argument(s) Addr filename Return Value(s) The function returns the number of bytes sent when successful and 0 upon failure ...

Page 79

... FTP Functions Zilog TCP/IP Stack supports four FTP functions. reference to the FTP functions. Table 9. FTP Functions Quick Reference ftpdinit ftp_connect do_programatic_login do_a_ftp_command RM004012-0707 Zilog TCP/IP Stack API Reference Manual Table 9 provides a quick ZTP API Reference 71 ...

Page 80

... Zilog TCP/IP Stack API ® eZ80 CPU 72 ftpdinit Include No header files needed. Declare function as Prototype void ftpdinit(void); Description The Argument(s) None. Return Value(s) None. ZTP API Reference API starts an FTP service on the ZTP Stack. ftpdinit before calling it. extern RM004012-0707 ...

Page 81

... Pointer to the IP address of the FTP server running on the remote machine (in dotted notation). A number that identifies the TCP/IP port to use on the server. Pointer to an integer value specifying the device to write to. function returns 0 (zero) when successful and a nega- Zilog TCP/IP Stack API Reference Manual ZTP API Reference 73 ...

Page 82

... Zilog TCP/IP Stack API ® eZ80 CPU 74 do_programatic_login Include #include Prototype int do_programatic_login ( RZK_DEVICE_CB_t * stdin, RZK_DEVICE_CB_t * stdout, INT8 *username, INT8 *passwd ); Description The log into the FTP server with the specified user name and the password. Argument(s) stdin stdout username passwd ...

Page 83

... Pointer to a command name and the args arguments. Return Value(s) Depends on the issued command. Note: Zilog TCP/IP Stack supports a number of commands. The third parameter of this API, and the respective arguments listed in RM004012-0707 “ ” ftpclient_api.h function to issue FTP commands. ...

Page 84

... Zilog TCP/IP Stack API ® eZ80 CPU 76 Table 10. do_a_ftp_command Command Name Arguments None ascii None bin None bye None cd None close remote-file delete [remote-directory ] dir remote-file [local-file ] Retrieve the remote-file and store it on the local get None hash [command ] help ZTP API Reference ...

Page 85

... RM004012-0707 Zilog TCP/IP Stack API Commands and Arguments (Continued) Description Change the working directory on the local machine directory is specified, the user's home directory is used. Print a listing of the contents of a directory on the remote machine. The listing includes any system- dependent information that the server chooses to include ...

Page 86

... Zilog TCP/IP Stack API ® eZ80 CPU 78 Return Value(s) The negative value otherwise. ZTP API Reference function returns 0 (zero) when successful and do_a_ftp_command RM004012-0707 ...

Page 87

... Ping Function Zilog TCP/IP Stack supports the ping Include #include <ztptcp.h> Prototype UINT8 ping(UINT32 dst, UINT32 count); Description An application can use the using a specific IP address. The the device to which an ICMP Echo Request packet is sent. The packets is sent Argument(s) dst count Return Value(s) The API waits for a response from the target device ...

Page 88

... Zilog TCP/IP Stack API ® eZ80 CPU 80 ICMP Functionality ZTP supports the following ICMP error returns: • • Port Unreachable One rule of UDP is that if it receives a UDP datagram and the destination port does not correspond to a port that is in use, UDP responds with an ICMP port unreachable ...

Page 89

... SNTP Functions Zilog TCP/IP Stack supports the SNTP Client protocol function which is described below. ztpSNTPClient() Include #include <SNTPClient.h> Prototype INT16 ztpSNTPClient ( INT8 *targetIPAddress, INT16 portNum ); Description To update the system time, ZTP provides the The function sends the time request message to the specified ...

Page 90

... Zilog TCP/IP Stack API ® eZ80 CPU 82 Return Value(s) SNTP_SOCKET_ERROR SNTP_IOCTLSOCKET_FAIL SNTP_RZK_DEV_OPEN_ERROR Indicates that the RZK device could not SNTP_SEND_TO_ERROR SNTP_RECIEVE_FROM_ERROR Indicates that an error occurred due to SNTP_VERSION_NUMBER_ERR OR SNTP_MODE_ERROR SNTP_MEM_ALLOC_FAILURE See Also SNTP Client Enumerations ZTP API Reference Indicates that the socket connection could not be established ...

Page 91

... Appendix A—Definitions and Codes This appendix describes the Zilog TCP/IP Stack data types, structures, enumerators, constants, macros, and error codes. Data Type Definitions This section defines a number of data types used with ZTP, including enu- merators for ZTP and data types for Telnet, SSL, and SNMP. ...

Page 92

... Zilog TCP/IP Stack API ® eZ80 CPU 84 Table 11. ZTP Data Types (Continued) Data Type WORD DWORD Telnet Data Types Table 12 Table 12. Telnet Data Type Definitions Data Type TELNET_HANDLE TELNET_DATA_SIZE TELNET_DATA IP_ADDRESS TELNETREAD SNMP Data Types Table 13 definition. Table 13. SNMP Data Types ...

Page 93

... EINVAL #define EBADF #define ENOCON #define EMFILE #define EINVALBKLOG #define EPIPE #define EFETNOSUPPORT #define EDEADSOCK #define EIOBINPRGRSS RM004012-0707 Zilog TCP/IP Stack API Reference Manual Code (INT16)0 (INT16)–1 (INT16)–2 (INT16)–3 (INT16)–4 (INT16)–5 (INT16)–6 (INT16)–7 (INT16)– ...

Page 94

... Zilog TCP/IP Stack API ® eZ80 CPU 86 Table 14. ZTP Core Error Codes (Continued) Error #define OK #define SYSERR Telnet Enumerations The following enumerator governs Telnet Errors. TELNET_RET typedef enum{ TELNET_SUCCESS, TELNET_BEGIN_ERROR_CODE = 0x400, TELNET_INVALID_ARG = TELNET_BEGIN_ERROR_CODE, TELNET_CONNECT_FAILURE, TELNET_CLOSE_FAILURE, TELNET_NO_CONNECTION, TELNET_ALREADY_CONNECTED, TELNET_OVER_SIZED_DATA, TELNET_ALREADY_INITIALIZED, TELNET_LOWER_LAYER_FAILURE, TELNET_FAILURE }TELNET_RET ...

Page 95

... Table 15. ZTP Core Macros Macro #define SOCK_STREAM 0 #define SOCK_DGRAM #define AF_INET tcp_FlagPUSH ioctlsocket Macros Table 16 lists the macro codes Table 16. ioctlsocket Macros Macro #define FIONBIO #define FIONREAD RM004012-0707 Zilog TCP/IP Stack API API. ioctlsocket Code 1 1 0x0008 ioctlsocket used by the Code 1 2 Reference Manual 87 ...

Page 96

... Zilog TCP/IP Stack API ® eZ80 CPU 88 Table 16. ioctlsocket Macros (Continued) Macro #define SIOCATMARK #define FCNCLBIO #define FUDPCKSUM #define UDPTIMEOUT #define FDISNAGLE #define FENANAGLE #define FIONWRITE TCPKEEPALIVE_ON TCPKEEPALIVE_OFF SNMP Macros Table 17 Table 17. SNMP Macros Macro #define SN_TRAP_COLD_START #define SN_TRAP_WARM_START #define SN_TRAP_LINK_DOWN ...

Page 97

... INT8 VOID UINT8 UINT8 UINT16 UINT32 dataHandler_t eth_address UINT32 UINT16 UINT32 UINT16 UINT16 INT UINT8 RM004012-0707 Zilog TCP/IP Stack API Reference Manual API, and the Secure Sock- ioctlsocket ip_type; *err_msg; *usr_name; (*usr_yield)( VOID ); rigid; stress; sock_mode; usertimer; dataHandler; hisethaddr; hisaddr; hisport; ...

Page 98

... Zilog TCP/IP Stack API ® eZ80 CPU 90 #ifdef MULTIHOMING #endif } udp_Socket; tcp_Socket structure This structure maintains the TCP socket connection related information. typedef struct _tcp_socket { Definitions and Codes INT UINT16 UINT8 UINT8 UINT32 VOID UINT8 UINT8 UINT8 struct _tcp_socket UINT16 INT8 ...

Page 99

... UINT32 UINT16 UINT8 UINT8 UINT32 UINT32 UINT32 UINT32 UINT16 UINT32 INT UINT8 UINT32 UINT32 INT16 UINT8 } tcp_Socket; RM004012-0707 Zilog TCP/IP Stack API Reference Manual * AppThread; err_code; block; iface; state; acknum; seqnum; timeout; unhappy; recent; flags; window; datalen; unacked; cwindow; wwindow; vj_sa; ...

Page 100

... Zilog TCP/IP Stack API ® eZ80 CPU 92 HTTP Data Structures The following data structures are used in the HTTP APIs. Http_Hdr Structure typedef struct http_hdr { UINT8 INT8* } Http_Hdr; http_params Structure struct http_params { /** The key, typically an http header. */ UINT8 *key; /** The value associated with that key. */ INT8 *value ...

Page 101

... UINT8 type; INT8 *path; INT8 *mimetype; /* Either a structure defining the static page, or the /* 'cgi' function which will generate this page. **/ union { const struct staticpage *spage; INT16 (*cgi)(struct http_request *); } content; }; RM004012-0707 size; Zilog TCP/IP Stack API Reference Manual Definitions and Codes 93 ...

Page 102

... Zilog TCP/IP Stack API ® eZ80 CPU 94 SNMP Data Structures The following data structures are used in SNMP APIs. header_rec Structure struct header_rec { INT8 *name; UINT16 val; }; SN_Oid_s Structure typedef struct oid { OBJSUBIDTYPE sub_id[SMAXOBJID]; /** array of sub- UINT16 len; }SN_Oid_s; SN_PhysAddress_s Structure typedef struct sn_phys_address { UINT8 Data[SN_MAX_PHYS_ADDR_SIZE] ...

Page 103

... SN_Object_s Structure typedef struct sn_object_s { SN_Oid_s UINT8 SN_Value_s } SN_Object_s; RM004012-0707 // Integer, Display String // Octet String) *pInt8; *pInt16; *pInt24; *pInt32; *pUint8; *pUint16; *pUint24; *pUint32; // Counter, Gauge, TimeTicks // as an Octet string) *pIP; Oid; Type; Value; Zilog TCP/IP Stack API Reference Manual Definitions and Codes 95 ...

Page 104

... ZDS II C Compiler’s run-time library. ZTP’s C run- time routines are named differently differentiate with the ZDS II C Compiler’s run-time library routines. For more information on ZDS II C Compiler’s run-time library, refer to Zilog Developer Studio II–eZ80Acclaim! Table 18 Table 18. Library Routines Library Routine ...

Page 105

... NULL). Argument(s) time str Return Value(s) This function always returns RM004012-0707 The xc_ascdate Time in seconds since midnight January 1st, 1970. A pointer to a user-supplied buffer to contain output string Zilog TCP/IP Stack API Reference Manual function takes its first argu- Definitions and Codes 97 ...

Page 106

... Zilog TCP/IP Stack API ® eZ80 CPU 98 xc_fprintf Include #include "xc_lib.h" Prototype INT16 xc_fprintf (RZK_DEVICE_CB_t * descriptor, INT8 *format,...) Description Print formatted text to the device specified in the The format to use in printing its remaining arguments to a device identified by first argument. The format contains simple text and special format codes that are identified by a preceding percent (%) character ...

Page 107

... A pointer to an integer value specifying the device to print format … Return Value(s) When successful, the RM004012-0707 uses the same conversion specifiers as to. A pointer to a string defining what to print. Arguments corresponding to the format codes, if any. function returns xc_fprintf Zilog TCP/IP Stack API Reference Manual . kprintf . OK Definitions and Codes 99 ...

Page 108

... Zilog TCP/IP Stack API ® eZ80 CPU 100 xc_printf Include #include "xc_lib.h" Prototype INT16 xc_printf (INT8 *format,...) Description Print formatted text— onto a console equivalent to calling ment of Argument(s) format … Return Value(s) When successful, this function returns See Also xc_fprintf Definitions and Codes ...

Page 109

... Except for the output medium identical to the xc_fprintf Argument(s) See the xc_fprintf Return Value(s) When successful, the See Also xc_fprintf RM004012-0707 he function prints formatted text xc_sprintf function. function. function returns xc_sprintf Zilog TCP/IP Stack API Reference Manual . OK Definitions and Codes 101 ...

Page 110

... Zilog TCP/IP Stack API ® eZ80 CPU 102 xc_strcasecmp Include #include "xc_lib.h" Prototype INT16 xc_strcasecmp (INT8 *str1, INT8 *str2) Description Case-insensitive string comparison— performs a byte-by-byte comparison of two strings, in which it looks for the first character that differs other than by case. If the first character in ...

Page 111

... Return Value(s) If the character is found, a pointer to its location in the string is returned match is found, a RM004012-0707 The xc_index Pointer to the string to be searched The character to search for pointer is returned. NULL Zilog TCP/IP Stack API Reference Manual function searches a string Definitions and Codes 103 ...

Page 112

... Customer Support For answers to technical questions about the product, documentation, or any other issues with Zilog’s offerings, please visit Zilog’s Knowledge Base at http://www.zilog.com/kb. For any comments, detail technical questions, or reporting problems, please visit Zilog’s Technical Support at http://support.zilog.com. ...

Related keywords