/****************************************************************************
*
* (C) 1999 by BECK IPC GmbH
*
* BECK IPC GmbH
* Garbenheimerstr. 38
* D-35578 Wetzlar
*
* Phone : (49)-6441-905-240
* Fax : (49)-6441-905-245
*
* ---------------------------------------------------------------------------
* Module : TCPIPAPI.H
* Function : Constants and datastructures for access to
* the Socketinterface
*
*
* Author : Bartat
* Date : 05.10.99
* Version : V1.00
* ---------------------------------------------------------------------------
* History :
*
* Vx.yy Author Changes
*
* V1.00 mb Create
* V1.01 mb added tcpinterface
*****************************************************************************/
#ifndef _TCPIP_API_H__
#define _TCPIP_API_H__
/*****************************************************************************/
/*****************************************************************************/
/*
* BSD Structure Definitions
*/
/*****************************************************************************/
struct sockaddr
{
unsigned char sa_len; /* Total Length */
unsigned char sa_family; /* Address Family AF_xxx */
char sa_data[14]; /* up to 14 bytes of protocol specific address */
};
struct in_addr
{
unsigned long s_addr; /* 32bit netis/hostid address in network byte order */
};
struct sockaddr_in
{
short sin_family; /* AF_INET */
unsigned int sin_port; /* 16bit Port Number in network byte order */
struct in_addr sin_addr; /* 32bit netid/hostid in network byte order */
char sin_zero[8];/* unused */
};
/*****************************************************************************/
struct recv_params
{
char * bufferPtr;
int bufferLength;
int flags; /*Blocking or dontwait*/
struct sockaddr * fromPtr; /* only needed for UDP */
int * fromlengthPtr; /* only needed for UDP */
unsigned long timeout; /*timeout milliseconds*/
};
struct send_params
{
char * bufferPtr;
int bufferLength;
int flags; /*Blocking or dontwait*/
struct sockaddr * toPtr; /* only needed for UDP */
int * tolengthPtr; /* only needed for UDP */
};
/*****************************************************************************/
//BSD Socket defines
/*****************************************************************************/
/*****************************************************************************/
#define AF_INET 2
#define PF_INET AF_INET
#define SOCK_STREAM 1 /* stream socket , TCP*/
#define SOCK_DGRAM 2 /* datagram socket , UDP*/
/*****************************************************************************/
#define MSG_BLOCKING 0x0000 /*this message should be blocking */
#define MSG_TIMEOUT 0x0001 /*wake up from recv after we have timed out*/
#define MSG_DONTWAIT 0x0080 /* this message should be nonblocking */
/*****************************************************************************/
//API defines
/*****************************************************************************/
#define API_OPENSOCKET 1
#define API_CLOSESOCKET 2
#define API_BIND 3 /*assign an address to an unnamed socket,port*/
#define API_CONNECT 4 /* TCP client only, connect */
#define API_RECVFROM 5 /* UDP recvfrom with blocking mode*/
#define API_SENDTO 6 /* UDP recvfrom with blocking mode*/
#define API_HTONS 7
#define API_INETADDR 8
#define API_SLEEP 9
#define API_MALLOC 10
#define API_FREE 11
#define API_GETRCV_BYTES 12
#define API_ACCEPT 13 /* TCP server only */
#define API_LISTEN 14 /* TCP server only */
#define API_SEND 15 /* TCP only */
#define API_RECV 16 /* TCP only */
#define API_INETTOASCII 17
#define API_RESETCONNECTION 18 /* TCP only */
/*****************************************************************************/
//Errorcodes
/*****************************************************************************/
#define API_NOT_SUPPORTED -2
#define API_ERROR -1
#define API_ENOERROR 0
/*****************************************************************************/
#endif _TCPIP_API_H__
/*****************************************************************************/
//end tcpipapi.h
/***************************************************************************/