00001 /****************************************************************************
00002 *
00003 * (C) 1999 by BECK IPC GmbH
00004 *
00005 * BECK IPC GmbH
00006 * Garbenheimerstr. 38
00007 * D-35578 Wetzlar
00008 *
00009 * Phone : (49)-6441-905-240
00010 * Fax : (49)-6441-905-245
00011 *
00012 * ---------------------------------------------------------------------------
00013 * Module : TCPIPAPI.H
00014 * Function : Constants and datastructures for access to
00015 * the Socketinterface
00016 *
00017 *
00018 * Author : Bartat
00019 * Date : 05.10.99
00020 * Version : V1.00
00021 * ---------------------------------------------------------------------------
00022 * History :
00023 *
00024 * Vx.yy Author Changes
00025 *
00026 * V1.00 mb Create
00027 * V1.01 mb added tcpinterface
00028 *****************************************************************************/
00029 #ifndef _TCPIP_API_H__
00030 #define _TCPIP_API_H__
00031 /*****************************************************************************/
00032 /*****************************************************************************/
00033 /*
00034 * BSD Structure Definitions
00035 */
00036 /*****************************************************************************/
00037 struct sockaddr
00038 {
00039 unsigned char sa_len; /* Total Length */
00040 unsigned char sa_family; /* Address Family AF_xxx */
00041 char sa_data[14]; /* up to 14 bytes of protocol specific address */
00042 };
00043
00044
00045 struct in_addr
00046 {
00047 unsigned long s_addr; /* 32bit netis/hostid address in network byte order */
00048 };
00049
00050 struct sockaddr_in
00051 {
00052 short sin_family; /* AF_INET */
00053 unsigned int sin_port; /* 16bit Port Number in network byte order */
00054 struct in_addr sin_addr; /* 32bit netid/hostid in network byte order */
00055 char sin_zero[8];/* unused */
00056 };
00057
00058 /*****************************************************************************/
00059 struct recv_params
00060 {
00061 char * bufferPtr;
00062 int bufferLength;
00063 int flags; /*Blocking or dontwait*/
00064 struct sockaddr * fromPtr; /* only needed for UDP */
00065 int * fromlengthPtr; /* only needed for UDP */
00066 unsigned long timeout; /*timeout milliseconds*/
00067 };
00068
00069 struct send_params
00070 {
00071
00072 char * bufferPtr;
00073 int bufferLength;
00074 int flags; /*Blocking or dontwait*/
00075 struct sockaddr * toPtr; /* only needed for UDP */
00076 int * tolengthPtr; /* only needed for UDP */
00077
00078 };
00079
00080 /*****************************************************************************/
00081 //BSD Socket defines
00082 /*****************************************************************************/
00083 /*****************************************************************************/
00084 #define AF_INET 2
00085 #define PF_INET AF_INET
00086
00087 #define SOCK_STREAM 1 /* stream socket , TCP*/
00088 #define SOCK_DGRAM 2 /* datagram socket , UDP*/
00089
00090 /*****************************************************************************/
00091 #define MSG_BLOCKING 0x0000 /*this message should be blocking */
00092 #define MSG_TIMEOUT 0x0001 /*wake up from recv after we have timed out*/
00093 #define MSG_DONTWAIT 0x0080 /* this message should be nonblocking */
00094
00095 /*****************************************************************************/
00096 //API defines
00097 /*****************************************************************************/
00098
00099 #define API_OPENSOCKET 1
00100 #define API_CLOSESOCKET 2
00101 #define API_BIND 3 /*assign an address to an unnamed socket,port*/
00102 #define API_CONNECT 4 /* TCP client only, connect */
00103 #define API_RECVFROM 5 /* UDP recvfrom with blocking mode*/
00104 #define API_SENDTO 6 /* UDP recvfrom with blocking mode*/
00105 #define API_HTONS 7
00106 #define API_INETADDR 8
00107 #define API_SLEEP 9
00108 #define API_MALLOC 10
00109 #define API_FREE 11
00110 #define API_GETRCV_BYTES 12
00111 #define API_ACCEPT 13 /* TCP server only */
00112 #define API_LISTEN 14 /* TCP server only */
00113 #define API_SEND 15 /* TCP only */
00114 #define API_RECV 16 /* TCP only */
00115 #define API_INETTOASCII 17
00116 #define API_RESETCONNECTION 18 /* TCP only */
00117
00118
00119 /*****************************************************************************/
00120 //Errorcodes
00121 /*****************************************************************************/
00122 #define API_NOT_SUPPORTED -2
00123 #define API_ERROR -1
00124 #define API_ENOERROR 0
00125
00126
00127 /*****************************************************************************/
00128 #endif _TCPIP_API_H__
00129 /*****************************************************************************/
00130 //end tcpipapi.h
00131 /***************************************************************************/