01.06.2013 Views

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TCP/IP Application Programmer's Interface - <strong>SC12</strong> <strong>@CHIP</strong>-<strong>RTOS</strong> <strong>V1.10</strong><br />

<strong>IPC<strong>@CHIP</strong></strong> <strong>Documentation</strong> Index TCP/IP API News<br />

TCP/IP API<br />

This interface provides access to the <strong>IPC<strong>@CHIP</strong></strong> TCP/IP stack's socket interface for programming TCP/IP<br />

applications. The TCP/IP API are all reached though software interrupt 0xAC. The desired service is selected with<br />

the high order byte of the AX register (AH).<br />

Please note, that we cannot explain the entire functionality of the TCP/IP protocol and the working of the socket<br />

interface in this document. Good books for understanding TCP/IP and the socket interface are:<br />

1. Internetworking with TCP/IP, Volume 1-3 from Douglas E.Comer<br />

2. TCP/IP Illustrated, Volume 1 from W. Richard Stevens<br />

For some useful comments see Programming notes.<br />

All needed constants (e.g. API_OPENSOCKET) and data structures are defined in the header file tcpipapi.h.<br />

TCP/IP API News<br />

TCP/IP API Error Codes Listing<br />

TCP/IP API Developer Notes<br />

TCP/IP API Data Structures<br />

TCP/IP API Client/Server applications<br />

Notes :<br />

● "Network byte order" is big endian (like Motorola machines, unlike Intel), where most significant byte appears at<br />

the lowest address byte of a multibyte integer.<br />

● At return of most API the DX-Register is used for error checking:<br />

DX: = 0 =API_ENOERROR ==>success<br />

DX: = -1 =API_ERROR ==>error, AX contains error code<br />

API Functions :<br />

● Interrupt_0xAC_function_0x01:_API_OPENSOCKET, open a socket<br />

● Interrupt_0xAC_function_0x02:_API_CLOSESOCKET, close a socket<br />

● Interrupt_0xAC_function_0x03:_API_BIND, bind TCP or UDP server socket<br />

● Interrupt_0xAC_function_0x04:_API_CONNECT, Connect to another socket<br />

● Interrupt_0xAC_function_0x05:_API_RECVFROM, Receive UDP message<br />

● Interrupt_0xAC_function_0x06:_API_SENDTO, Transmit a UDP datagram<br />

● Interrupt_0xAC_function_0x07:_API_HTONS, Convert byte order<br />

● Interrupt_0xAC_function_0x08:_API_INETADDR, Convert an IP-String to binary<br />

● Interrupt_0xAC_function_0x09:_API_SLEEP, Sleep<br />

● Interrupt_0xAC_function_0x0A:_API_MALLOC, Allocate memory<br />

Page 104 / 400

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!