Main Page Data Structures File List Data Fields Globals Related Pages

# clib/TCPIP.H

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 *
    00003 * (C) 2000 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         : IPC@Chip SC12 API: tcpip.h
    00014 *
    00015 * Function       : prototypes, constants for TCPIP API functions
    00016 *                  Functions must be used with program memory model large!
    00017 *
    00018 * Author        : bartat
    00019 * Date          : 22.01.00
    00020 * ---------------------------------------------------------------------------
    00021
    00022 $Header: TCPIP.H, 23, 07.05.2002 14:50:51, Markus Bartat$
    00023
    00024
    00025   $Log:
    00026    23   IPC@CHIP  1.22        07.05.2002 14:50:51  Markus Bartat   added
    00027         C-function for TCPAPI call 0x22 Get_tcp-socket_state
    00028    22   IPC@CHIP  1.21        01.03.2002 18:49:25  Markus Bartat   added functions
    00029         for API calls 0x45,0x44,0x55
    00030    21   IPC@CHIP  1.20        26.02.2002 18:45:52  Christoph Stoidner Add
    00031         PPPSetPPPOption
    00032    20   IPC@CHIP  1.19        30.01.2002 12:52:07  Markus Bartat   added extendend
    00033         dhcp_stat function 0x73
    00034    19   IPC@CHIP  1.18        23.01.2002 16:40:46  Christoph Stoidner delete
    00035         unused timeout variable
    00036    18   IPC@CHIP  1.17        16.01.2002 11:45:07  Christoph Stoidner add starteam
    00037         directives
    00038    17   IPC@CHIP  1.16        14.01.2002 13:33:37  Christoph Stoidner add new
    00039         functions (Set/get Idle timeout: 0x79)
    00040    16   IPC@CHIP  1.15        14.01.2002 13:19:05  Christoph Stoidner add new
    00041         functions
    00042    15   IPC@CHIP  1.14        14.12.2001 11:55:08  Markus Bartat   Added C
    00043         functions and define for TCPIP API calls 0x90-0x92
    00044    14   IPC@CHIP  1.13        17.09.2001 12:40:22  Markus Bartat   added tcpip api
    00045         call 0x67
    00046    13   IPC@CHIP  1.12        21.06.2001 13:53:31  Markus Bartat   added tcpip api
    00047         call 0x19
    00048    12   IPC@CHIP  1.11        19.06.2001 13:35:09  Markus Bartat   start: Added
    00049         comments to the c functions
    00050    11   IPC@CHIP  1.10        01.06.2001 12:20:28  Markus Bartat   added new
    00051         functions
    00052    10   IPC@CHIP  1.9         31.05.2001 16:19:04  Christoph Stoidner
    00053    9    IPC@CHIP  1.8         31.05.2001 14:27:47  Christoph Stoidner
    00054    8    IPC@CHIP  1.7         29.05.2001 16:04:20  Markus Bartat   added aPI call
    00055         0x60 Get access to internal snmp variables
    00056    7    IPC@CHIP  1.6         15.05.2001 11:20:48  Markus Bartat   überarbeitet
    00057         von Ali Senol
    00058    6    IPC@CHIP  1.5         14.03.2001 16:56:22  Christoph Stoidner
    00059    5    IPC@CHIP  1.4         14.03.2001 16:55:10  Christoph Stoidner convert
    00060         datatypes to prevent compiler warnings
    00061    4    IPC@CHIP  1.3         14.03.2001 16:52:43  Christoph Stoidner
    00062    3    IPC@CHIP  1.2         08.03.2001 11:33:19  Ernest Schlösser Added a
    00063         tcp_connect function to create a socket and connect to a server
    00064    2    IPC@CHIP  1.1         15.02.2001 15:09:10  Christoph Stoidner
    00065    1    IPC@CHIP  1.0         14.02.2001 16:09:59  Christoph Stoidner
    00066   $
    00067
    00068 * History       :
    00069 *
    00070 *  Vx.yy                   Author  Changes
    00071 *
    00072 *             22.01.00      mb    Create
    00073 *             28.01.00      mb     add tcp API calls
    00074 *             26.06.00      mb     add ppp server API calls
    00075 *             14.07.00      mb     add reconfig, dhcp  and ip setting API calls
    00076 *             18.07.00      mb     add TCPIP statistics
    00077 *             24.08.00      mb     add PPP client API calls
    00078 *             06.09.00      mb     add set and getsockopt calls
    00079               15.09.00      mb     add ping api calls
    00080               07.11.00      mb     add memory information call
    00081               08.12.00      mb     add routing calls
    00082               22.12.00      mb     add blocking mode call for sockets
    00083               30.05.01      mb     add API_SNMP_GET function
    00084               01.06.01      mb     add telnet and ftp login functions
    00085               20.06.01      mb     add register callback function
    00086               10.12.01      mb     add IGMP functions calls for API calls 0x90-0x92
    00087               30.01.02      mb     add dhcp_stat_ext function (requires BIOS 1.03B or higher)
    00088               25.02.02      mb/cs  added new function PPP_GET_DNSIP 0x44 and pppsetoptions 0x45,0x55
    00089               07.05.02      mb     added TCP API function 0x22, get state of tcp socket
    00090 ************************************************************************************/
    00091 #ifndef __TCPIP_H__
    00092 #define __TCPIP_H__
    00093 /*************************************************************************/
    00094 #include "CLIB/TCPIPAPI.H"
    00095
    00096 /*************************************************************************/
    00097 #define TCPIPVECT  0xAC
    00098
    00099 #ifdef _MSC_VER /* If Microsoft C Compiler is used, define new FP_SEG and FP_OFF Macro */
    00100   #ifdef FP_SEG
    00101       #undef FP_SEG
    00102   #endif
    00103   #define FP_SEG(ptr)    ((unsigned int)(((unsigned long)ptr)>>16))
    00104
    00105   #ifdef FP_OFF
    00106       #undef FP_OFF
    00107   #endif
    00108   #define FP_OFF(ptr)    ((unsigned int)(((unsigned long)ptr)&0xFFFF))
    00109 #endif
    00110
    00111 /*************************************************************************/
    00112 //prototypes
    00113 /*************************************************************************/
    00114
    00115
    00116 /*****************************************************************************
    00117 *
    00118 * open a tcp connection
    00119 *
    00120 * DestIPStr: destionation IP address format xxx.xxx.xxx.xxx
    00121 * ClientPort: local port (0=random port)
    00122 * HostPort: remote port
    00123 * error: TCP/IP error
    00124 *
    00125 * return: socket descriptor (-1 = error)
    00126 *  close connection using closesocket()
    00127 ******************************************************************************/
    00128 int tcp_connect(char *DestIPStr, unsigned int ClientPort, unsigned int HostPort, int *error);
    00129
    00130
    00131 int accept(int sd, struct sockaddr * addressPtr, int *error);
    00132
    00133 void api_sleep(unsigned int howlong);
    00134
    00135 int bind(int sd, struct sockaddr * addressPtr, int *error);
    00136
    00137 int connect(int sd, struct sockaddr * addressPtr, int *error);
    00138
    00139 int closesocket(int sd, int *error);
    00140
    00141 int GetWaitingBytes(int sd, int *error);
    00142
    00143 unsigned int htons(unsigned int value);
    00144
    00145 int listen(int sd,int backlog, int *error);
    00146
    00147 int inet_addr(char * IPAddressStringPtr, unsigned long * IPAddress);
    00148
    00149 int InetToAscii(unsigned long * IPAddress, char * IPAddressStringPtr);
    00150
    00151 int recvfrom(int sd, char * bufptr, int bufLen, int flags,
    00152          unsigned long timeout,struct sockaddr * fromPtr, int *error);
    00153
    00154 int recv(int sd, char * bufptr, int bufLen, int flags, unsigned long timeout,
    00155       int *error);
    00156
    00157 int ResetConnection(int sd, int *error);
    00158
    00159 int sendto(int sd, char * bufptr, int bufLen, int flags,
    00160         const struct sockaddr * toPtr, int *error);
    00161
    00162 int send(int sd, char * bufptr, int bufLen, int flags, int *error);
    00163
    00164 int setlinger(int sd, int seconds, int *error);
    00165
    00166 int setreuse(int sd,int *error);
    00167
    00168 int Set_IP_Type_Of_Service(int sd, unsigned char TOS, int *error);
    00169
    00170 int opensocket(unsigned char type, int *error);
    00171
    00172 int setsockopt(int sd, SetSocketOption *sockoptptr, int *error);
    00173
    00174 int getsockopt(int sd, GetSocketOption *sockoptptr, int *error);
    00175
    00176 int Set_Blocking_Mode(int sd, unsigned char mode, int *error);
    00177
    00178 int RegisterCallbackFunction(int sd, void * funcptr, int eventflagmask ,int *error);
    00179
    00180 int GetRegisterCallbackFunction(int sd, void * funcptr, int eventflagmask ,int *error);
    00181
    00182 int get_socketerror(int sd);
    00183
    00184 unsigned char Get_TCP_Socket_State(unsigned int localPort, unsigned long * remoteIP, unsigned int * remotePort);
    00185
    00186
    00187
    00188 //ppp client prototypes
    00189 int PPP_Client_Installed(void);
    00190 int PPP_Client_Open(PPPClient_Init * ptr, int *error);
    00191 int PPP_Client_Close(int *error);
    00192 int PPP_Client_GetStatus(int *error);
    00193 int PPP_Client_SetOptions(PPP_Option *ptr);
    00194 int PPP_Client_Get_DNSIP(unsigned long * IPaddress, int primary_sec, int *error);
    00195
    00196
    00197
    00198 //ppp server prototypes
    00199 int PPP_Server_Installed(void);
    00200 int PPP_Server_Suspend(int timeoutsecs, int *error);
    00201 int PPP_Server_Activate(int timeoutsecs,int *error);
    00202 int PPP_Server_GetStatus(void);
    00203 int PPP_Server_Get_Cfg(PPP_IPCfg_Data *ptr , int *error);
    00204 int PPP_Server_SetOptions(PPP_Option *ptr);
    00205
    00206 //Get pointer to internal TCIP SNMP mib structures
    00207 int Get_SNMP_Data(unsigned char which , void * * snmp_mib_ptr);
    00208
    00209 //Login counter
    00210 int Get_FTP_Login_Counters(unsigned long * * FTP_Login_Count,unsigned long * * FTP_Login_failCount);
    00211 int Get_Telnet_Login_Counters(unsigned long * * Telnet_Login_Count,unsigned long * * Telnet_Login_failCount);
    00212
    00213 //telnet state
    00214 int Get_Telnet_State(int *error);
    00215
    00216 //system
    00217 void Get_Installed_Servers(unsigned int * AX, unsigned int *DX);
    00218 int  Reconfigure_ethernet(void);
    00219 int  DHCP_use(unsigned char dhcp_use);
    00220 void Get_DHCP_Status(unsigned int * dhcp_use, unsigned int *dhcp_stat);
    00221 void Get_DHCP_Status_Ext(unsigned int * dhcp_use, unsigned int *dhcp_stat, UserEthDhcp_Entry * * dhcpptr);
    00222
    00223 void Get_IPConfig(char *IP, char * Mask, char *Gateway);
    00224 void Set_IPConfig(char *IP, char * Mask, char *Gateway);
    00225 void Get_TCPIP_Statistics(Packet_Count * * Packet_Count_Pointer);
    00226 int  Set_FTPServer_Idle_Timeout( unsigned timeout );
    00227 int  Set_TelnetServer_Idle_Timeout( unsigned timeout );
    00228 unsigned Get_FTPServer_Idle_Timeout(void);
    00229 unsigned Get_TelnetServer_Idle_Timeout(void);
    00230
    00231 //ping api
    00232 int Ping_Open(Ping * pingptr, int * errorcode);
    00233 int Ping_Close(int sd);
    00234 int Ping_Statistics(Ping * pingptr);
    00235
    00236 //memory
    00237 void Get_TCPIP_Memory_Status(unsigned long * total, unsigned long * used);
    00238
    00239 //route
    00240 int  AddDefaultGateway( int interface , unsigned long * Gateway, int * errorcode);
    00241 int  DelDefaultGateway(unsigned long * Gateway, int * errorcode);
    00242 int  GetDefaultGateway(unsigned long * Gateway, int * errorcode);
    00243 int  AddStaticRoute(int interface, Route_Entry * route, int * errorcode);
    00244 int  DelStaticRoute(int interface, Route_Entry * route, int * errorcode);
    00245
    00246 //IGMP
    00247 int  Add_IGMP_Membership(unsigned long * MulticastIP, unsigned char * MacAddress, int * errorcode);
    00248 int  Drop_IGMP_Membership(unsigned long * MulticastIP, int * errorcode);
    00249 int  IPMulticast_to_MacAddr(unsigned long * MulticastIP, unsigned char * MacAddress, int * errorcode);
    00250
    00251 /*************************************************************************/
    00252 #endif /* __TCPIP_H__*/
    00253 /*************************************************************************/
    00254 //end tcpip.h
    00255 /*************************************************************************/