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 * Recommended memory model for applications: LARGE 00017 * 00018 * 00019 * Author : Bartat 00020 * Date : 05.10.99 00021 * --------------------------------------------------------------------------- 00022 * History : 00023 00024 00025 $Header: TCPIPAPI.H, 26, 07.05.2002 14:50:52, Markus Bartat$ 00026 00027 $Log: 00028 26 IPC@CHIP 1.25 07.05.2002 14:50:52 Markus Bartat added 00029 C-function for TCPAPI call 0x22 Get_tcp-socket_state 00030 25 IPC@CHIP 1.24 05.04.2002 15:00:06 Christoph Stoidner Add 00031 SetSockOpt options (MAX_RT->connect/send timeout; MAX_REXMIT->maximal send 00032 retries). 00033 24 IPC@CHIP 1.23 01.03.2002 18:49:26 Markus Bartat added functions 00034 for API calls 0x45,0x44,0x55 00035 23 IPC@CHIP 1.22 26.02.2002 18:45:52 Christoph Stoidner Add 00036 PPPSetPPPOption 00037 22 IPC@CHIP 1.21 30.01.2002 12:52:07 Markus Bartat added extendend 00038 dhcp_stat function 0x73 00039 21 IPC@CHIP 1.20 16.01.2002 11:45:07 Christoph Stoidner add starteam 00040 directives 00041 20 IPC@CHIP 1.19 14.01.2002 13:33:37 Christoph Stoidner add new 00042 functions (Set/get Idle timeout: 0x79) 00043 19 IPC@CHIP 1.18 14.01.2002 13:19:06 Christoph Stoidner add new 00044 functions 00045 18 IPC@CHIP 1.17 14.12.2001 11:55:08 Markus Bartat Added C 00046 functions and define for TCPIP API calls 0x90-0x92 00047 17 IPC@CHIP 1.16 20.11.2001 13:03:31 Markus Bartat added comments 00048 to the ppp client init struct 00049 16 IPC@CHIP 1.15 15.11.2001 12:02:43 Markus Bartat added comment 00050 header 00051 15 IPC@CHIP 1.14 15.11.2001 12:02:42 Markus Bartat added comment 00052 header 00053 14 IPC@CHIP 1.13 15.11.2001 12:02:42 Markus Bartat added comment 00054 header 00055 13 IPC@CHIP 1.12 08.11.2001 18:54:18 Markus Bartat modified 00056 documentation 00057 12 IPC@CHIP 1.11 08.11.2001 18:49:03 Markus Bartat added comments 00058 to the PPPclient_Init structure 00059 11 IPC@CHIP 1.10 17.09.2001 12:40:23 Markus Bartat added tcpip api 00060 call 0x67 00061 10 IPC@CHIP 1.9 21.06.2001 13:53:32 Markus Bartat added tcpip api 00062 call 0x19 00063 9 IPC@CHIP 1.8 08.06.2001 15:42:38 Christoph Stoidner Add SockOpt 00064 #define NODELAY 00065 8 IPC@CHIP 1.7 01.06.2001 12:20:29 Markus Bartat added new 00066 functions 00067 7 IPC@CHIP 1.6 31.05.2001 16:19:04 Christoph Stoidner 00068 6 IPC@CHIP 1.5 31.05.2001 14:27:48 Christoph Stoidner 00069 5 IPC@CHIP 1.4 29.05.2001 16:04:20 Markus Bartat added aPI call 00070 0x60 Get access to internal snmp variables 00071 4 IPC@CHIP 1.3 15.05.2001 11:20:49 Markus Bartat überarbeitet 00072 von Ali Senol 00073 3 IPC@CHIP 1.2 14.05.2001 12:54:28 Markus Bartat added constant 00074 TCP_NODELAY 00075 2 IPC@CHIP 1.1 12.04.2001 14:03:09 Markus Bartat bugfix at 00076 pingclient structure (dummy counter) 00077 1 IPC@CHIP 1.0 14.02.2001 16:09:59 Christoph Stoidner 00078 $ 00079 00080 00081 * 00082 * Vx.yy Author Changes 00083 * 00084 * mb Create 00085 * mb added tcpinterface 00086 * mb add ppp client API calls 00087 * mb add ppp server API calls 00088 * mb SC12 TCPIP system calls (ip config, DHCP, statistics, IP_TOS) 00089 * mb changed API constants from dec. to hex. (value is the same) 00090 * mb modify struct packet count 00091 * mb add get and set sockopt calls 00092 * mb add ping api calls 00093 * mb add memory information call 00094 * mb modified(rename) members of ppp structures for using PAP and CHAP auth method 00095 * mb add routing calls 00096 * mb add blocking mode call for a sockets 00097 * mb !! important: modified PPPclient_Init structure: set max length of user and password string 00098 * to 50 character 00099 * mb add typedefs snmp mib structures 00100 * mb add telnet and ftp login functions 00101 mb add register callback function and socket eventflags 00102 mb add get telnet state function 00103 mb add comments to the PPPclient_init structure, because of changes at BIOS 1.02B 00104 mb add igmp functions numbers 0x90 - 0x92 00105 mb added typedef struct UserEthDhcp_entry 00106 mb added new function PPP_GET_DNSIP 0x44 and pppsetoptions 0x45,0x55 00107 mb added TCP API function 0x22, get state of tcp socket 00108 *****************************************************************************************************/ 00109 #ifndef _TCPIP_API_H__ 00110 #define _TCPIP_API_H__ 00111 /*****************************************************************************/ 00112 /*****************************************************************************/ 00113 /* 00114 * BSD Structure Definitions 00115 */ 00116 /*****************************************************************************/ 00117 struct sockaddr 00118 { 00119 unsigned char sa_len; /* Total Length */ 00120 unsigned char sa_family; /* Address Family AF_xxx */ 00121 char sa_data[14]; /* up to 14 bytes of protocol specific address */ 00122 }; 00123 00124 00125 struct in_addr 00126 { 00127 unsigned long s_addr; /* 32bit netis/hostid address in network byte order */ 00128 }; 00129 00130 struct sockaddr_in 00131 { 00132 short sin_family; /* AF_INET */ 00133 unsigned int sin_port; /* 16bit Port Number in network byte order */ 00134 struct in_addr sin_addr; /* 32bit netid/hostid in network byte order */ 00135 char sin_zero[8];/* unused */ 00136 }; 00137 00138 /*****************************************************************************/ 00139 struct recv_params 00140 { 00141 char * bufferPtr; 00142 int bufferLength; 00143 int flags; /*Blocking or dontwait*/ 00144 struct sockaddr * fromPtr; /* only needed for UDP */ 00145 int * fromlengthPtr; /* only needed for UDP */ 00146 unsigned long timeout; /*timeout milliseconds*/ 00147 }; 00148 00149 struct send_params 00150 { 00151 00152 char * bufferPtr; 00153 int bufferLength; 00154 int flags; /*Blocking or dontwait*/ 00155 struct sockaddr * toPtr; /* only needed for UDP */ 00156 int * tolengthPtr; /* only needed for UDP */ 00157 00158 }; 00159 00160 /*****************************************************************************/ 00161 //Set and get socket options structure 00162 /*****************************************************************************/ 00163 00164 00165 typedef struct tag_setsockopt{ 00166 00167 int protocol_level; /*protocol level ip level,tcp level or socket level*/ 00168 int optionName; /*options name*/ 00169 const char * optionValue; /* pointer to the option value*/ 00170 int optionLength; /* length of option value*/ 00171 00172 }SetSocketOption; 00173 00174 00175 typedef struct tag_getsockopt{ 00176 00177 int protocol_level; /*protocol level ip level,tcp level or socket level*/ 00178 int optionName; /*options name*/ 00179 char * optionValue; /* pointer to the option value buffer, where Value can befilled in by the API call */ 00180 int * optionLength; /* length of option value buffer*/ 00181 00182 }GetSocketOption; 00183 00184 /*****************************************************************************/ 00185 //PPP server config information structure 00186 /*****************************************************************************/ 00187 typedef struct tag_pppipcfg_data 00188 { 00189 char IP[16]; 00190 char RemIP[16]; 00191 char Netmask[16]; 00192 char Gateway[16]; 00193 unsigned int comport; /* 0==EXT, 1==COM of the SC12*/ 00194 unsigned int auth; /* 0==No auth, 1==PAP authentication, 2:CHAP*/ 00195 unsigned int modem; /* 0==Nullmodem, 1==usage of modem*/ 00196 unsigned int flow; 00197 long baud; 00198 }PPP_IPCfg_Data; 00199 00200 00201 00202 /*****************************************************************************/ 00203 //PPP client structures 00204 /*****************************************************************************/ 00205 00206 #define PPP_MAX_DIAL 7 00207 00208 00209 typedef struct tag_pppdial 00210 { 00211 char * modemcmd; //modem command string 00212 char * modemans; //modem answer string 00213 int timeout; //seconds 00214 int retries; 00215 char expect_send; 00216 /*flag: 00217 expect = 0: pppclient sends modemcmd and expects modemanswer 00218 expect = 1: pppclient expects modemanswer and sends modemcmd 00219 */ 00220 }PPPDial; 00221 00222 00223 typedef struct tag_pppclie_hangup 00224 { 00225 char *modemcmdmode; //switch modem into command mode e.g. +++ 00226 int delay; //delay time after switching in seconds 00227 PPPDial pppdial[PPP_MAX_DIAL]; //modem commands and answer for hangups 00228 }PPP_ModemHangup; 00229 00230 00231 00232 00233 typedef struct tag_ppp_client 00234 { 00235 /************************************************************************************/ 00236 //user PPP config data 00237 /************************************************************************************/ 00238 00239 int port; //serial port (0:EXT 1:COM) 00240 00241 int auth; // 0: no authentication 00242 // 1:PAP Client must send username and password for PAP authentication to the peer 00243 // 2:CHAP Client must send username and password for CHAP authentication to the peer 00244 // 3:PAP Client expects PAP username and password from the peer 00245 // 4:CHAP Client expects CHAP username and password from the peer 00246 00247 int modem; //modem usage (0:nullmodem 1:analogue modem) 00248 int flow; //serial flow control (0: none, 1:XON/XOFF, 2:RTS/CTS) 00249 long baud; //serial baudrate 00250 unsigned long idletimeout; //closing ppp after idle time seconds (0: no closing after idle time) 00251 00252 char username[50]; //username, if auth <=4 and !=0 00253 char password[50]; //password, if auth <=4 and !=0 00254 00255 void * dptr; //dummy ptr 00256 00257 /************************************************************************************/ 00258 //filled in after successful API call: IP cfg data given from server 00259 /************************************************************************************/ 00260 char PPPClieipAddrStr[16]; //If this IP is set to "0.0.0.0" client expect IP form the peer, IP is filled in after sucessful connection 00261 //If this IP is set to a string != "0.0.0.0" client wants to use this IP during the ppp session 00262 char PPPClieRemipAddrStr[16]; //If RemoteIP is set to "0.0.0.0" client allow the peer to use its own IP during the PPP session 00263 //the RemoteIP is filled in after sucessful connection 00264 //If RemoteIP is set to a string != "0.0.0.0" client wants to configure the remote peer with this IP 00265 00266 00267 00268 char PPPClienetMaskStr[16]; 00269 char PPPClieipGatewayStr[16]; 00270 00271 00272 00273 /************************************************************************************/ 00274 //modem parameters 00275 /************************************************************************************/ 00276 PPPDial pppdial[PPP_MAX_DIAL]; // modem/dial entries 00277 PPP_ModemHangup modem_hangup; //modem hangup commands 00278 00279 00280 00281 00282 unsigned int break_modem; /* 00283 flag for breaking SC12 <-> modem control communication, dialing, waiting for connect,.. 00284 setting break_modem to 1, interrupts current modem communication between 00285 SC12 and the modem at a pppclient open or close call, 00286 The pppclient read this flag and breaks the modem dialing, or waiting. 00287 This flag could be set from another task, to interrupt the dialing. 00288 If a ppp link is established, it doesn't break the session. 00289 Don't forget to set this flag to zero after breaking 00290 */ 00291 00292 }PPPClient_Init; 00293 00294 /*****************************************************************************/ 00295 //PPP Option 00296 /*****************************************************************************/ 00297 typedef struct tag_ppp_option 00298 { 00299 int protocolLevel; 00300 int remoteLocalFlag; 00301 int optionName; 00302 const char *optionValuePtr; 00303 int optionLength; 00304 } PPP_Option; 00305 00306 /*****************************************************************************/ 00307 //TCPIP statistics structure (needed by function TCPIP_STATISTISTICS 0x74) 00308 /*****************************************************************************/ 00309 typedef struct tag_cnt_packet{ 00310 /*recv counter*/ 00311 unsigned int * cnt_all_packets; //count all incoming ethernet packets 00312 unsigned int * cnt_ip_packets; //count incoming IP packets 00313 unsigned int * cnt_arp_packets; //count incoming ARP packets 00314 unsigned int * cnt_tcp_packets; //count incoming TCP packets 00315 unsigned int * cnt_udp_packets; //count incoming UDP packets 00316 unsigned int * cnt_icmp_packets; //count incoming ICMP packets 00317 /*send counter*/ 00318 unsigned int * cnt_all_sended_packets; //count all sended ethernet packets 00319 unsigned int * cnt_ip_sended_packets;//count all sended ip packets 00320 unsigned int * cnt_arp_sended_packets; //count all sended arp packets 00321 unsigned int * cnt_tcp_sended_packets; //count all sended tcp packets 00322 unsigned int * cnt_udp_sended_packets; //count all sended udp packets 00323 unsigned int * cnt_icmp_sended_packets;//count all sended icmp packets 00324 /*chksum error counter on incoming packets*/ 00325 unsigned int * cnt_ip_chksum_errs;//count all chksum errors on incoming ip packets 00326 unsigned int * cnt_udp_chksum_errs;//count all chksum errors on incoming udp packets 00327 unsigned int * cnt_tcp_chksum_errs;//count all chksum errors on incoming tcp packets 00328 unsigned int * cnt_eth_errs;//count all ethernet error, CRC, FAE and FIFO overrun 00329 }Packet_Count; 00330 00331 00332 /*****************************************************************************/ 00333 //Ping API 00334 /*****************************************************************************/ 00335 00336 typedef struct tag_ping_command 00337 { 00338 int sd; //socket descriptor, filled by PING_OPEN 00339 char * remoteHostNamePtr; //remote ip 00340 int pingInterval; //seconds 00341 int pingDataLength; //max. 1024 Bytes 00342 unsigned long count; //number of pings to send 00343 unsigned char pingstate; //pin socket state, 1: open 0: closed 00344 00345 //statistics, filled by ping command 00346 unsigned long transmitted; //sended ping requests 00347 unsigned long received; //received replies 00348 unsigned int lastsenderr; //last send error 00349 unsigned int lastrcverr; //last receive error 00350 unsigned long maxRtt; //Max round trip time, rounded off to 100ms steps 00351 unsigned long minRtt; //Minimum round trip time in milliseconds, (100 ms steps) 00352 unsigned long lastRtt; //round trip time (100 ms steps) of the last ping request/reply 00353 }Ping; 00354 00355 00356 00357 /*****************************************************************************/ 00358 //Routing 00359 /*****************************************************************************/ 00360 typedef struct tag_route_entry 00361 { 00362 unsigned long destIPAddress; //The IP address to add the route for 00363 unsigned long destNetmask; //The netmask for the route 00364 unsigned long gateway; //IP address of the gateway of the route 00365 int hops; //Number or routers between this host and route 00366 }Route_Entry; 00367 /*********************************************************************************/ 00368 /* 00369 SNMP MIB structures: Only available at BIOS version which contains SNMP MIB variables. 00370 Note: We don't have a SNMP agent inside of the BIOS but 00371 if an user is able to implement an own snmp agent at the IPC@Chip based at the 00372 TCPIP API, he needs access to TCPIP internal variables of these defined structures 00373 */ 00374 /********************************************************************************/ 00375 typedef struct tagIfMib /*interface, only ethernet is supported*/ 00376 { 00377 long ifIndex; /* index of this interface 1 for ethernet, currently only ethernet*/ 00378 char ifDescr[32]; /* description of interface */ 00379 long ifType; /* network device type */ 00380 long ifMtu; /* maximum transfer unit */ 00381 unsigned long ifSpeed; /* bandwidth in bits/sec */ 00382 unsigned char ifPhysAddress[11]; /* interface's address */ 00383 unsigned char PhysAddrLen; /* length of physAddr: 6 */ 00384 long ifAdminStatus; /* desired state of interface, not supported */ 00385 long ifOperStatus; /* current operational status, not supported */ 00386 //counters 00387 unsigned long devLastChange; /* value of sysUpTime when current state entered */ 00388 unsigned long devInOctets; /* number of octets received on interface */ 00389 unsigned long devInUcastPkts; /* number of unicast packets delivered */ 00390 unsigned long devInMulticastPkts; /* number of multicast packets delivered, not supported */ 00391 unsigned long devInBroadcastPkts; /*broadcasts delivered */ 00392 unsigned long devInDiscards; /* number of broadcasts */ 00393 unsigned long devInErrors; /* number of packets containing errors */ 00394 unsigned long devInUnknownProtos; /* number of packets with unknown protocol */ 00395 unsigned long devOutOctets; /* number of octets transmitted */ 00396 unsigned long devOutUcastPkts; /* number of unicast packets sent */ 00397 unsigned long devOutMulticastPkts; /* number of multicast packets sent */ 00398 unsigned long devOutBroadcastPkts; /*broadcasts sent */ 00399 unsigned long devOutDiscards; /* number of packets discarded with no error */ 00400 unsigned long devOutErrors; /* number of pkts discarded with an error */ 00401 unsigned long devOutQLen; /* number of packets in output queue */ 00402 }IfMib; 00403 00404 00405 typedef struct tagIpMib 00406 { 00407 long ipForwarding; /* 1: enabled */ 00408 long ipDefaultTTL; /* default TTL for pkts originating here */ 00409 unsigned long ipInReceives; /* IP packets received from interfaces */ 00410 unsigned long ipInHdrErrors; /* Pkts discarded due to header errors */ 00411 unsigned long ipInAddrErrors; /* Pkts discarded due to bad address */ 00412 unsigned long ipForwDatagrams; /* Pkts forwarded through this entity */ 00413 unsigned long ipInUnknownProtos; /* Local-addressed pkts w/unknown proto */ 00414 unsigned long ipInDiscards; /* Error-free packets discarded */ 00415 unsigned long ipInDelivers; /* Datagrams delivered to upper level */ 00416 unsigned long ipOutRequests; /* IP datagrams originating locally */ 00417 unsigned long ipOutDiscards; /* Error-free output IP pkts discarded */ 00418 unsigned long ipOutNoRoutes; /* IP pkts discarded due to no route */ 00419 long ipReasmTimeout; /* Seconds fragment is held awaiting reassembly */ 00420 unsigned long ipReasmReqds; /* Fragments needing reassembly (here) */ 00421 unsigned long ipReasmOKs; /* Number of fragments reassembled */ 00422 unsigned long ipReasmFails; /* Number of failures in IP reassembly */ 00423 unsigned long ipFragOKs; /* Number of datagrams fragmented here */ 00424 unsigned long ipFragFails; /* Pkts unable to be fragmented here */ 00425 unsigned long ipFragCreates; /* Number of IP fragments created here */ 00426 unsigned long ipRoutingDiscards; 00427 } IpMib; 00428 00429 00430 typedef struct tagIcmpMib 00431 { 00432 unsigned long icmpInMsgs; /* Total of ICMP msgs received */ 00433 unsigned long icmpInErrors; /* Total of ICMP msgs received with errors */ 00434 unsigned long icmpInDestUnreachs; 00435 unsigned long icmpInTimeExcds; 00436 unsigned long icmpInParmProbs; 00437 unsigned long icmpInSrcQuenchs; 00438 unsigned long icmpInRedirects; 00439 unsigned long icmpInEchos; 00440 unsigned long icmpInEchoReps; 00441 unsigned long icmpInTimestamps; 00442 unsigned long icmpInTimestampReps; 00443 unsigned long icmpInAddrMasks; 00444 unsigned long icmpInAddrMaskReps; 00445 unsigned long icmpOutMsgs; 00446 unsigned long icmpOutErrors; 00447 unsigned long icmpOutDestUnreachs; 00448 unsigned long icmpOutTimeExcds; 00449 unsigned long icmpOutParmProbs; 00450 unsigned long icmpOutSrcQuenchs; 00451 unsigned long icmpOutRedirects; 00452 unsigned long icmpOutEchos; 00453 unsigned long icmpOutEchoReps; 00454 unsigned long icmpOutTimestamps; 00455 unsigned long icmpOutTimestampReps; 00456 unsigned long icmpOutAddrMasks; 00457 unsigned long icmpOutAddrMaskReps; 00458 } IcmpMib; 00459 00460 00461 typedef struct tagTcpMib 00462 { 00463 long tcpRtoAlgorithm; /* retransmission timeout algorithm */ 00464 long tcpRtoMin; /* minimum retransmission timeout (mS) */ 00465 long tcpRtoMax; /* maximum retransmission timeout (mS) */ 00466 long tcpMaxConn; /* maximum tcp connections possible */ 00467 unsigned long tcpActiveOpens; /* number of SYN-SENT -> CLOSED transitions */ 00468 unsigned long tcpPassiveOpens; /* number of SYN-RCVD -> LISTEN transitions */ 00469 unsigned long tcpAttemptFails; /*(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN*/ 00470 unsigned long tcpEstabResets; /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */ 00471 unsigned long tcpCurrEstab; /* number in ESTABLISHED or CLOSE-WAIT state */ 00472 unsigned long tcpInSegs; /* number of segments received */ 00473 unsigned long tcpOutSegs; /* number of segments sent */ 00474 unsigned long tcpRetransSegs; /* number of retransmitted segments */ 00475 unsigned long tcpInErrs; /* number of received errors */ 00476 unsigned long tcpOutRsts; /* number of transmitted resets */ 00477 } TcpMib; 00478 00479 00480 typedef struct tagUdpMib 00481 { 00482 unsigned long udpInDatagrams; /* UDP datagrams delivered to users */ 00483 unsigned long udpNoPorts; /* UDP datagrams to port with no listener */ 00484 unsigned long udpInErrors; /* UDP datagrams unable to be delivered */ 00485 unsigned long udpOutDatagrams;/* UDP datagrams sent from this entity */ 00486 }UdpMib; 00487 00488 typedef struct tag_atEntry 00489 { 00490 long IfIndex; /* interface on which this entry maps */ 00491 unsigned char PhysAddress[11]; /* physical address of destination */ 00492 unsigned char PhysAddressLen; /* length of atPhysAddress */ 00493 unsigned long NetAddress; /* IP address of physical address */ 00494 }atEntry; 00495 00496 00497 00498 typedef struct tag_UserDhcpEthEntry 00499 { 00500 unsigned long BootSIpAddress; //BOOT Server (TFTP server), not supported 00501 unsigned long Dns1ServerIpAddress; // Domain name server 00502 unsigned long Dns2ServerIpAddress; // Second domain name server 00503 unsigned long Yiaddr; // Our (leased) IP address 00504 unsigned long NetMask; // Our subnet mask 00505 unsigned long DefRouter; // Default router 00506 unsigned long DhcpServerId; // DHCP selected server IP address 00507 unsigned long internal1; // Internal use only 00508 unsigned long internal2; // Internal use only 00509 unsigned long DhcpLeaseTime; // DHCP Address lease time in milliseconds 00510 unsigned long internal3; // internal use only 00511 unsigned long internal4; // internal use only 00512 unsigned char DomainName[64]; // Domain name 00513 unsigned char BootSname[64]; // TFTP server name, not used 00514 unsigned char BootFileName[128]; // Boot file name (for TFTP download), not supported 00515 unsigned short BootFileSize; // Boot file size in 512 Bytes blocks (for TFTP download), not supported 00516 unsigned short internal5; // internal use only 00517 }UserEthDhcp_Entry; 00518 00519 00520 /*****************************************************************************/ 00521 //BSD Socket defines 00522 /*****************************************************************************/ 00523 00524 #define AF_INET 2 00525 #define PF_INET AF_INET 00526 00527 #define SOCK_STREAM 1 /* stream socket , TCP*/ 00528 #define SOCK_DGRAM 2 /* datagram socket , UDP*/ 00529 00530 /*****************************************************************************/ 00531 #define MSG_BLOCKING 0x0000 /*this message should be blocking */ 00532 #define MSG_TIMEOUT 0x0001 /*wake up from recv after we have timed out*/ 00533 #define MSG_DONTWAIT 0x0080 /* this message should be nonblocking */ 00534 00535 /*****************************************************************************/ 00536 //API defines 00537 /*****************************************************************************/ 00538 00539 #define API_OPENSOCKET 0x01 00540 #define API_CLOSESOCKET 0x02 00541 #define API_BIND 0x03 /*assign an address to an unnamed socket,port*/ 00542 #define API_CONNECT 0x04 /* TCP client only, connect */ 00543 #define API_RECVFROM 0x05 /* UDP recvfrom */ 00544 #define API_SENDTO 0x06 /* UDP sendto*/ 00545 #define API_HTONS 0x07 00546 #define API_INETADDR 0x08 00547 #define API_SLEEP 0x09 00548 #define API_MALLOC 0x0A 00549 #define API_FREE 0x0B 00550 #define API_GETRCV_BYTES 0x0C 00551 #define API_ACCEPT 0x0D /* TCP server only */ 00552 #define API_LISTEN 0x0E /* TCP server only */ 00553 #define API_SEND 0x0F /* TCP only */ 00554 #define API_RECV 0x10 /* TCP only */ 00555 #define API_INETTOASCII 0x11 00556 #define API_RESETCONNECTION 0x12 /* TCP only */ 00557 #define API_SETLINGER 0x13 /* TCP only */ 00558 #define API_SETREUSE 0x14 /* TCP server only */ 00559 #define API_SETIPTOS 0x15 /* set Type Of Service for a socket */ 00560 #define API_SETSOCKOPT 0x16 /* set socket options*/ 00561 #define API_GETSOCKOPT 0x17 /* get socket options*/ 00562 #define API_SETBLOCKINGMODE 0x18 /* set a socket in blocking or non blocking mode*/ 00563 #define API_REGISTERCALLBACK 0x19 /* register call back function on socket events*/ 00564 #define API_GET_SOCKETERROR 0x21 /* Get the last socket error */ 00565 #define API_GET_TCP_STATE 0x22 /* Only at @Chip-RTOS versions with SNMP support, get tcp state socket state*/ 00566 00567 #define PPPCLIENT_INSTALLED 0x40 00568 #define PPPCLIENT_OPEN 0x41 00569 #define PPPCLIENT_CLOSE 0x42 00570 #define PPPCLIENT_GET_STATUS 0x43 00571 #define PPPCLIE_GET_DNSIP 0x44 /*Get DNS ip negotiated by the remote PPP server */ 00572 #define PPPCLIENT_SET_OPTIONS 0x45 00573 00574 00575 //PPP server API calls 00576 #define PPPSERVER_INSTALLED 0x50 00577 #define PPPSERVER_SUSPEND 0x51 00578 #define PPPSERVER_ACTIVATE 0x52 00579 #define PPPSERVER_GET_STATUS 0x53 00580 #define PPPSERVER_GET_CFG 0x54 00581 #define PPPSERVER_SET_OPTIONS 0x55 00582 00583 00584 00585 00586 00587 00588 //snmp 00589 /* Only available a BIOS versions, which includes SNMP access: 00590 Accesssing the tcpip internal snmp mibs 00591 Note: The IPC@Chip BIOS doesn't have a SNMP agent inside, but 00592 if an user is able to implement an own agent based at the TCPIP API, 00593 he needs access to the TCPIP internal snmp mib structures (defined above) 00594 */ 00595 #define API_SNMP_GET 0x60 00596 00597 00598 00599 #define API_FTP_GET_LOGIN 0x65 /*get addresses of FTP server login counters*/ 00600 #define API_TELNET_GET_LOGIN 0x66 /*get addresses of Telnet server login counters*/ 00601 #define API_GET_TELNET_STATE 0x67 /*get state of Telnet server 1:active, 0:closed*/ 00602 00603 00604 00605 00606 00607 //Get list of installed servers and devices 00608 #define GET_INSTALLED_SERVERS 0x70 00609 00610 //Reconfigure ethernet interface 00611 #define REINIT_ETHERNET 0x71 00612 00613 //DHCP usage 00614 #define DHCP_USE 0x72 00615 #define DHCP_STAT 0x73 00616 #define TCPIP_STATISTICS 0x74 00617 00618 //Ping API 00619 #define PING_OPEN 0x75 00620 #define PING_CLOSE 0x76 00621 #define PING_STATISTICS 0x77 00622 00623 //memory 00624 #define GET_MEMORY_INFO 0x78 00625 00626 #define SET_SERVER_IDLE_TIMEOUT 0x79 00627 00628 00629 00630 00631 //Routing 00632 #define ADD_DEFAULT_GATEWAY 0x80 00633 #define DEL_DEFAULT_GATEWAY 0x81 00634 #define GET_DEFAULT_GATEWAY 0x82 00635 #define ADD_STATIC_ROUTE 0x83 00636 #define DEL_STATIC_ROUTE 0x84 00637 00638 00639 //IGMP 00640 #define ADD_IGMP_MEMBERSHIP 0x90 00641 #define DROP_IGMP_MEMBERSHIP 0x91 00642 #define MCASTIP_TO_MACADDR 0x92 00643 00644 00645 00646 /*****************************************************************************/ 00647 //Socket options 00648 /*****************************************************************************/ 00649 //protocol levels 00650 #define IP_PROTOIP_LEVEL 0 /* ip level */ 00651 #define IP_PROTOTCP_LEVEL 6 /* tcp level */ 00652 #define SOCKET_LEVEL 0x7fff /* socket level */ 00653 00654 //ip level options 00655 #define IPO_TTL 0x0001 /* IP Time to live, default 64 seconds*/ 00656 #define IPO_TOS 0x0002 /*IP type of service , default 0*/ 00657 00658 //tcp level options 00659 #define TCP_NODELAY 0x0001 /* Disable/enable the nagle algorithm*/ 00660 #define TCP_NOPUSH 0x0004 /* Delay sending until a full segment is buffered*/ 00661 #define TCP_SLOW_START 0x0200 /* Disable/enable TCP slow start algorithm*/ 00662 00663 00664 #define TCP_KEEPALIVE 0x4001 /* Set idle time,before sending keepalive probes, default 7200 seconds*/ 00665 #define TCP_DELAY_ACK 0x4002 /* Set the TCP delay ack time in millseconds*/ 00666 #define TCP_KEEPALIVE_INTV 0x4004 /* Set keep alive interval probes (default 75 seconds) */ 00667 #define TCP_KEEPALIVE_CNT 0x4005 /* Set max. number of keep alive probes, before tcp gives up, default 12*/ 00668 #define TCP_FINWT2TIME 0x4006 /* Set the max. amount of time TCP will wait for the remote side to close, after it initiate a close*/ 00669 #define TCP_2MSLTIME 0x4007 /* Set the max. amount of time TCP will wait in the TIME WAIT state, once it has initiated a close*/ 00670 #define TCP_MAXRT 0x0010 /* Set the TCP/IP Timeout, OptionLength: 2 Bytes (INT) */ 00671 #define TCP_MAXREXMIT 0x4003 /* Set the Maximal TCP/IP Send retries, OptionLength: 2 Bytes (INT) */ 00672 00673 00674 //socket level options 00675 #define SO_REUSEADDR 0x0004 /* allow local address reuse ,default 0 disable*/ 00676 #define SO_KEEPALIVE 0x0008 /* keep connections alive, default 0 disable*/ 00677 #define SO_SNDBUF 0x1001 /* send buffer size, default TCP 4096, UDP 2048 bytes */ 00678 #define SO_RCVBUF 0x1002 /* receive buffer size,default TCP 4096, UDP 2048 bytes */ 00679 00680 00681 00682 00683 /*****************************************************************************/ 00685 /*****************************************************************************/ 00686 00687 #define CB_CONNECT_COMPLT 0x0001 /*connection complete*/ 00688 #define CB_ACCEPT 0x0002 /*remote has establ. a connection to our listening server*/ 00689 #define CB_RECV 0x0004 /*incoming data arrived*/ 00690 #define CB_SEND_COMPLT 0x0010 /*sending of data has been acked by the peer*/ 00691 #define CB_REMOTE_CLOSE 0x0020 /*peer has shutdown the connection*/ 00692 #define CB_SOCKET_ERROR 0x0040 /*an error occured on the connection*/ 00693 #define CB_RESET 0x0080 /*peer has sent a rest on the connection*/ 00694 #define CB_CLOSE_COMPLT 0x0100 /*close has been completed*/ 00695 00696 00697 /*****************************************************************************/ 00698 //PPP options 00699 /*****************************************************************************/ 00700 00701 //PPP Protocol levels 00702 #define PPP_LCP_PROTOCOL 0x21c0 00703 #define PPP_IPCP_PROTOCOL 0x2180 00704 00705 #define PPP_OPTION_WANT 0 00706 #define PPP_OPTION_ALLOW 1 00707 00708 00709 //PPP Protocol options 00710 00711 //LCP 00712 #define PPP_LCP_ACCM 2 00713 #define PPP_LCP_PROTO_COMP 7 00714 #define PPP_LCP_ADDRCTRL_COMP 8 00715 00716 //IPCP 00717 #define PPP_IPCP_COMP_PROTOCOL 2 /*VJ TCPIP Header compression*/ 00718 #define PPP_IPCP_DNS_PRI 29 /*Primary DNS server IP*/ 00719 #define PPP_IPCP_DNS_SEC 31 /*Secondary DNS server IP*/ 00720 00721 00722 00723 00724 /*****************************************************************************/ 00725 //Errorcodes 00726 /*****************************************************************************/ 00727 #define API_NOT_SUPPORTED -2 00728 #define API_ERROR -1 00729 #define API_ENOERROR 0 00730 00731 //PPP server states 00732 #define PPPS_UNDEFINED -1 /* Undefined, should not happen*/ 00733 #define PPPS_NOT_STARTED 0 /* PPP server was not started*/ 00734 #define PPPS_DISABLED 1 /* Server started, but disabled */ 00735 #define PPPS_ENABLED 2 /* Server enabled, not connected*/ 00736 #define PPPS_LNKUP 3 /* Connection established*/ 00737 #define PPPS_MODEMCLOSING 4 /* Server hangs up modem*/ 00738 #define PPPS_MODEMINIT 5 /* Server tries init modem*/ 00739 00740 00741 00742 //PPP client states 00743 #define PPP_NOTAVAIL -1 /*Client is not running*/ 00744 #define PPP_LNKDOWN 0 /*Link is down*/ 00745 #define PPP_LNKWILLOPEN 1 /*open link in progress*/ 00746 #define PPP_LNKUP 2 /*Link is established*/ 00747 00748 00749 00750 //PPP client errorcodes 00751 #define PPP_INV_COMPORT -1 /* invalid comport specified, 00752 this errorCode also occurs, if 00753 the pppclient is interrupted while dialing 00754 (e.g. user break with setting the flag modem_break 00755 at the struct pppclient_init 00756 or another modem error 00757 */ 00758 #define PPP_INUSE -2 /* ppp client already in use */ 00759 #define PPP_INV_USER -3 /* invalid user or password */ 00760 #define PPP_OPEN_FAIL -4 /* connection failed */ 00761 #define PPP_INV_DEV -5 /* pppclient interface not found */ 00762 #define PPP_IPCFG_FAIL -6 00763 #define PPP_CONNECT_FAIL -7 00764 00765 00766 /*****************************************************************************/ 00767 #endif _TCPIP_API_H__ 00768 /*****************************************************************************/ 00769 //end tcpipapi.h 00770 /***************************************************************************/