home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
old
/
ckermit5a190
/
ckotcp.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-31
|
3KB
|
144 lines
/* ckotcp.c
*
* TCP/IP interface for OS/2 C-Kermit
*
* Author: Kai-Uwe Rommel <rommel@ars.muc.de>
* Created: Wed May 25 1994
*/
/* macro functions */
#ifndef CK_DLL
#define byteswap(x) ((((x) & 0xFF) << 8) | (((x) >> 8) & 0xFF))
#define htons(x) (byteswap(x))
#define ntohs(x) (byteswap(x))
#define bzero(x, y) memset((x), 0, (y))
#define bcopy(x, y, z) memcpy((y), (x), (z))
#endif
/* defines */
#ifndef CK_DLL
#define AF_INET CK_AF_INET
#define SOCK_STREAM CK_SOCK_STREAM
#define FIONREAD CK_FIONREAD
#define FIONBIO CK_FIONBIO
#define SOL_SOCKET CK_SOL_SOCKET
#define SO_OOBINLINE CK_SO_OOBINLINE
#endif
#define CK_AF_INET 2
#define CK_SOCK_STREAM 1
#define CK_FIONREAD 1
#define CK_FIONBIO 2
#define CK_SOL_SOCKET 1
#define CK_SO_OOBINLINE 1
/* type definitions */
#ifndef CK_DLL
typedef char *caddr_t;
#define in_addr ck_in_addr
#define ck_sockaddr_in sockaddr_in
#define ck_sockaddr sockaddr
#define ck_hostent hostent
#define ck_servent servent
#endif
struct ck_in_addr
{
unsigned long s_addr;
};
struct ck_sockaddr_in
{
short sin_family;
unsigned short sin_port;
struct ck_in_addr sin_addr;
char sin_zero[8];
};
struct ck_sockaddr
{
unsigned short sa_family;
char sa_data[14];
};
struct ck_hostent
{
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char *h_address;
#ifndef CK_DLL
#define h_addr h_address
#endif
};
struct ck_servent
{
char *s_name;
char **s_aliases;
int s_port;
char *s_proto;
};
/* prototypes */
#ifdef CK_DLL
#ifdef __32BIT__
#define ENTRY _System _Export
#else
#define ENTRY _export _loadds
#endif
#else
#ifdef __32BIT__
#define SYSTEM _System
#else
#define SYSTEM
#endif
#define ck_sockinit (* SYSTEM sockinit)
#define ck_connect (* SYSTEM connect)
#define ck_ioctl (* SYSTEM ioctl)
#define ck_recv (* SYSTEM recv)
#define ck_select (* SYSTEM select)
#define ck_send (* SYSTEM send)
#define ck_setsockopt (* SYSTEM setsockopt)
#define ck_socket (* SYSTEM socket)
#define ck_soclose (* SYSTEM soclose)
#define ck_gethostbyname (* SYSTEM gethostbyname)
#define ck_getservbyname (* SYSTEM getservbyname)
#define ck_inet_addr (* SYSTEM inet_addr)
#define ck_inet_ntoa (* SYSTEM inet_ntoa)
#endif
#ifndef ENTRY
#define ENTRY
#endif
#ifndef EXTERN
#define EXTERN extern
#endif
EXTERN int ENTRY ck_sockinit(void);
EXTERN int ENTRY ck_connect(int socket, struct ck_sockaddr *name, int namelen);
EXTERN int ENTRY ck_ioctl(int socket, int cmd, char *data, int length);
EXTERN int ENTRY ck_recv(int socket, char *buffer, int length, int flags);
EXTERN int ENTRY ck_select(int *fds, int nread, int write, int except, long timeout);
EXTERN int ENTRY ck_send(int socket, char *buffer, int length, int flags);
EXTERN int ENTRY ck_setsockopt(int socket, int level, int optname,
char *optvalue, int optlength);
EXTERN int ENTRY ck_socket(int domain, int type, int protocol);
EXTERN int ENTRY ck_soclose(int socket);
EXTERN struct ck_hostent * ENTRY ck_gethostbyname(char *name);
EXTERN struct ck_servent * ENTRY ck_getservbyname(char *name, char *protocol);
EXTERN unsigned long ENTRY ck_inet_addr(char *cp);
EXTERN char * ENTRY ck_inet_ntoa(struct ck_in_addr in);
/* end of ckotcp.h */