📄 ckcnet.h
字号:
#ifdef INTERLAN /* INTERLAN implies TCPSOCKET */#ifndef TCPSOCKET#define TCPSOCKET#endif /* TCPSOCKET */#endif /* INTERLAN */#ifdef BEBOX#ifndef TCPSOCKET#define TCPSOCKET#endif /* TCPSOCKET */#ifndef TCPIPLIB#define TCPIPLIB#endif /* TCPIPLIB */#define socket_errno h_errno#define socket_read(x,y,z) recv(x,y,sizeof(char),z)#define socket_write(x,y,z) send(x,y,sizeof(char),z)#define socket_ioctl ioctl#define socket_close(x) closesocket(x)#ifndef FIONBIO#define FIONBIO 2#endif /* FIONBIO */#ifndef FIONREAD#define FIONREAD 1#endif /* FIONREAD */#ifndef SIOCATMARK#define SIOCATMARK 3#endif /* SIOCATMARK */#endif /* BEBOX */#ifdef COMMENT /* no longer used but might come in handy again later... *//* CK_READ0 can (and should) be defined if and only if: (a) read(fd,&x,0) can be used harmlessly on a TCP/IP socket connection. (b) read(fd,&x,0) returns 0 if the connection is up, -1 if it is down.*/#ifndef CK_READ0#ifdef TCPSOCKET#ifdef SUNOS41 /* It works in SunOS 4.1 */#define CK_READ0#else#ifdef NEXT /* and NeXTSTEP */#define CK_READ0#endif /* NEXT */#endif /* SUNOS41 */#endif /* TCPSOCKET */#endif /* CK_READ0 */#endif /* COMMENT *//* Telnet protocol */#ifdef TCPSOCKET /* TCPSOCKET implies TNCODE */#ifndef TNCODE /* Which means... */#define TNCODE /* Compile in telnet code */#endif /* TNCODE *//* Platforms where we must call gethostname(buf,len) and then gethostbyname(buf) to get local IP address, rather than calling gethostbyname("").*/#ifndef CKGHNLHOST#ifdef datageneral#define CKGHNLHOST#else#ifdef SOLARIS#define CKGHNLHOST#else#ifdef SUNOS4#define CKGHNLHOST#else#ifdef UNIXWARE#define CKGHNLHOST#else#ifdef SINIX#define CKGHNLHOST#endif /* SINIX */#endif /* UNIXWARE */#endif /* SUNOS4 */#endif /* SOLARIS */#endif /* datageneral */#endif /* CKGHNLHOST */#ifndef RLOGCODE /* What about Rlogin? */#ifndef NORLOGIN/* Rlogin can be enabled only for UNIX versions that have both SIGURG (SCO doesn't) and CK_TTGWSIZ (OSF/1 doesn't), so we don't assume that any others have these without verifying first. Not that it really makes much difference since you can only use Rlogin if you are root...*/#ifdef SUNOS41#define RLOGCODE#else#ifdef SOLARIS#define RLOGCODE#else#ifdef HPUX9#define RLOGCODE#else#ifdef HPUX10#define RLOGCODE#else#ifdef OSF40#define RLOGCODE#else#ifdef NEXT#define RLOGCODE#else#ifdef AIX41#define RLOGCODE#else#ifdef UNIXWARE#define RLOGCODE#else#ifdef IRIX51#define RLOGCODE#else#ifdef IRIX60#define RLOGCODE#else#ifdef QNX#define RLOGCODE#else#ifdef __linux__#define RLOGCODE#else#ifdef BSD44#define RLOGCODE#endif /* BSD44 */#endif /* __linux__ */#endif /* QNX */#endif /* IRIX60 */#endif /* IRIX51 */#endif /* UNIXWARE */#endif /* AIX41 */#endif /* NEXT */#endif /* OSF40 */#endif /* HPUX10 */#endif /* HPUX9 */#endif /* SOLARIS */#endif /* SUNOS41 */#endif /* NORLOGIN */#ifdef VMS /* VMS */#define RLOGCODE#endif /* VMS */#endif /* RLOGCODE */#endif /* TCPSOCKET */#ifdef TNCODE/* Telnet local-echo buffer, used for saving up user data that can't be properly displayed and/or evaluated until pending Telnet negotiations are complete. TTLEBUF is defined for platforms (like UNIX) where net i/o is done by the same routines that do serial i/o (in which case the relevant code goes into the ck?tio.c module, in the ttinc(), ttchk(), etc, routines); NETLETBUF is defined for platforms (like VMS) that use different APIs for network and serial i/o, and enables the copies of the same routines that are in ckcnet.c.*/#ifndef TTLEBUF#ifdef UNIX#define TTLEBUF#else#ifdef datageneral#define TTLEBUF#endif /* datageneral */#endif /* UNIX */#endif /* TTLEBUF */#ifndef NETLEBUF#ifdef VMS#define NETLEBUF#endif /* VMS */#endif /* NETLEBUF */#endif /* TNCODE */#ifdef SUNX25 /* SUNX25 implies TCPSOCKET */#ifndef TCPSOCKET /* But doesn't imply TNCODE */#define TCPSOCKET#endif /* TCPSOCKET */#endif /* SUNX25 */#ifndef TCPSOCKET#ifndef NO_DNS_SRV#define NO_DNS_SRV#endif /* NO_DNS_SRV */#endif /* TCPSOCKET *//* This is another TCPSOCKET section... */#ifdef TCPSOCKET#ifndef NETCONN /* TCPSOCKET implies NETCONN */#define NETCONN#endif /* NETCONN */#ifndef NO_DNS_SRV#ifdef NOLOCAL#define NO_DNS_SRV#endif /* NOLOCAL */#ifdef OS2ONLY#define NO_DNS_SRV#endif /* OS2ONLY */#ifdef NT#ifdef _M_PPC#define NO_DNS_SRV#endif /* _M_DNS */#endif /* NO_DNS_SRV */#ifdef VMS#define NO_DNS_SRV#endif /* VMS */#ifdef STRATUS#define NO_DNS_SRV#endif /* STRATUS */#ifdef datageneral#define NO_DNS_SRV#endif /* datageneral */#ifdef ultrix#define NO_DNS_SRV#endif /* ultrix */#ifdef NEXT#define NO_DNS_SRV#endif /* NEXT */#endif /* NO_DNS_SRV */#ifndef CK_DNS_SRV /* Use DNS SRV records to determine */#ifndef NO_DNS_SRV /* host and ports */#define CK_DNS_SRV#endif /* NO_DNS_SRV */#endif /* CK_DNS_SRV */#ifndef NOLISTEN /* select() is required to support */#ifndef SELECT /* incoming connections. */#ifndef VMS#ifndef OS2#define NOLISTEN#endif /* OS2 */#endif /* VMS */#endif /* SELECT */#endif /* NOLISTEN *//* BSD sockets library header files */#ifdef VMS/* Because bzero() and bcopy() are not portable among VMS versions, or compilers, or TCP/IP products, etc.*/#ifndef bzero#define bzero(s,n) memset(s,0,n)#endif /* bzero */#ifndef bcopy#define bcopy(h,a,l) memcpy(a,h,l)#endif /* bcopy */#endif /* VMS */#ifdef UNIX /* UNIX section */#ifdef SVR4/* These suggested by Rob Healey, rhealey@kas.helios.mn.org, to avoid bugs in Berkeley compatibility library on Sys V R4 systems, but untested by me (fdc). Remove this bit if it gives you trouble. (Later corrected by Marc Boucher <mboucher@iro.umontreal.ca> because bzero/bcopy are not argument-compatible with memset/memcpy|memmove.)*/#ifndef bzero#define bzero(s,n) memset(s,0,n)#endif#ifdef SOLARIS#ifdef SUNX25#undef bzero/* WOULD YOU BELIEVE... That the Solaris X.25 /opt/SUNWcomm/lib/libsockx25 library references bzero, even though the use of bzero is forbidden in Solaris? Look for the function definition in ckcnet.c.*/_PROTOTYP( void bzero, (char *, int) );#endif /* SUNX25 */#ifndef bcopy#define bcopy(h,a,l) memcpy(a,h,l)#endif#else#ifndef bcopy#define bcopy(h,a,l) memmove(a,h,l)#endif#endif /* SOLARIS */#else /* !SVR4 */#ifdef PTX /* Sequent DYNIX PTX 1.3 */#ifndef bzero#define bzero(s,n) memset(s,0,n)#endif#ifndef bcopy#define bcopy(h,a,l) memcpy(a,h,l)#endif#endif /* PTX */#endif /* SVR4 */#ifdef INTERLAN /* Racal-Interlan TCP/IP */#include <interlan/socket.h>#include <interlan/il_types.h>#include <interlan/telnet.h>#include <interlan/il_errno.h>#include <interlan/in.h>#include <interlan/telnet.h> /* Why twice ? ? ? */#else /* Not Interlan */#ifdef BEBOX#include <socket.h>#else /* Not BEBOX */ /* Normal BSD TCP/IP library */#ifdef COMMENT#ifndef HPUX#include <arpa/telnet.h>#endif /* HPUX */#endif /* COMMENT */#ifdef SCO234#include <sys/errno.tcp.h>#include <sys/types.tcp.h>#endif /* SCO234 */#include <sys/socket.h>#ifdef WOLLONGONG#include <sys/in.h>#else#include <netinet/in.h>#ifndef SV68R3V6 /* (maybe this should be SVR3 in general) */#include <netinet/tcp.h> /* Added June 2001 */#endif /* SV68R3V6 */#endif /* WOLLONGONG */#endif /* BEBOX */#endif /* INTERLAN */#ifndef EXCELAN#include <netdb.h>#ifndef INTERLAN#ifdef WOLLONGONG#define minor /* Do not include <sys/macros.h> */#include <sys/inet.h>#else#ifndef OXOS#ifndef HPUX#ifndef BEBOX#include <arpa/inet.h>#endif /* BEBOX */#endif /* HPUX */#else /* OXOS *//* In too many releases of X/OS, <arpa/inet.h> declares inet_addr() as * ``struct in_addr''. This is definitively wrong, and could cause * core dumps. Instead of including that bad file, inet_addr() is * correctly declared here. Of course, all the declarations done there * has been copied here. */unsigned long inet_addr();char *inet_ntoa();struct in_addr inet_makeaddr();unsigned long inet_network();#endif /* OXOS */#endif /* WOLLONGONG */#endif /* INTERLAN */#endif /* EXCELAN */#ifdef EXCELAN /* Excelan TCP/IP */#ifndef bzero#define bzero(s,n) memset(s,0,n)#endif /* bzero */#ifndef bcopy#define bcopy(h,a,l) memcpy(a,h,l)#endif /* bcopy */#include <ex_errno.h>#endif /* EXCELAN */#ifdef I386IX /* Interactive Sys V R3 network. *//* #define TELOPTS */ /* This might need defining. */#define ORG_NLONG ENAMETOOLONG /* Resolve conflicting symbols */#undef ENAMETOOLONG /* in <errno.h> and <net/errno.h> */#define ORG_NEMPTY ENOTEMPTY#undef ENOTEMPTY#include <net/errno.h>#undef ENAMETOOLONG#define ENAMETOOLONG ORG_NLONG#undef ENOTEMPTY#define ENOTEMPTY ORG_NEMPTY#include <netinet/tcp.h> /* for inet_addr() */#endif /* I386IX *//* Data type of the inet_addr() function... We define INADDRX if it is of type struct inaddr. If it is undefined, unsigned long is assumed. Look at <arpa/inet.h> to find out. The following known cases are handled here. Other systems that need it can be added here, or else -DINADDRX can be included in the CFLAGS on the cc command line.*/#ifndef NOINADDRX#ifdef DU2 /* DEC Ultrix 2.0 */#define INADDRX#endif /* DU2 */#endif /* NOINADDRX */#else /* Not UNIX */#ifdef VMS /* (Open)VMS section */#ifdef MULTINET /* TGV MultiNet *//* In C-Kermit 7.0 Beta.08 we started getting scads of compile time warnings in Multinet builds: "blah" is implicitly declared as a function, where blah is socket_read/write/close, ntohs, htons, getpeername, accept, select, etc. I have no idea why -- these routines are declared in the header files below, and the includes haven't changed. The executable still seems to work OK. Messing with the order of the following includes is disastrous.*/#ifdef MULTINET_NO_PROTOTYPES#undef MULTINET_NO_PROTOTYPES#endif /* MULTINET_NO_PROTOTYPES */#ifdef __cplusplus#undef __cplusplus#endif /* __cplusplus */#include "multinet_root:[multinet.include]errno.h"#include "multinet_root:[multinet.include.sys]types.h"#include "multinet_root:[multinet.include.sys]socket.h"#include "multinet_root:[multinet.include]netdb.h"#include "multinet_root:[multinet.include.netinet]in.h"#include "multinet_root:[multinet.include.arpa]inet.h"#include "multinet_root:[multinet.include.sys]ioctl.h"#ifdef COMMENT/* No longer needed because now bzero/bcopy are macros defined as memset/memmove in all VMS builds.*//* We should be able to pick these up from <strings.h> but it's not portable between VAXC and DECC. And even with DECC 5.x we have a difference between VAX and Alpha. We get warnings here on the VAX with DECC 5.6-003 but they are not fatal.*/#ifndef __DECC_VER#ifndef bzero_PROTOTYP( void bzero, (char *, int) );#endif /* bzero */#ifndef bcopy_PROTOTYP( void bcopy, (char *, char *, int) );#endif /* bcopy */#endif /* __DECC_VER */#endif /* COMMENT */#ifdef __DECC/* If compiling under DEC C the socket calls must not be prefixed with DECC$. This is done by using the compiler switch /Prefix=Ansi_C89. However, this causes some calls that should be prefixed to not be (which I think is a bug in the compiler - I've been told these calls are present in ANSI compilers). At any rate, such calls are fixed here by explicitly prefixing them.*/#ifdef COMMENT/* But this causes errors with VMS 6.2 / DEC C 5.3-006 / MultiNet 4.0A on a VAX (but not on an Alpha). So now what happens if we skip doing this?*/#define close decc$close#define alarm decc$alarm#endif /* COMMENT */#endif /* __DECC */#else /* Not MULTINET */#ifdef WINTCP /* WIN/TCP = PathWay for VMS */#ifdef OLD_TWG#include "twg$tcp:[netdist.include.sys]errno.h"#include "twg$tcp:[netdist.include.sys]types2.h" /* avoid some duplicates */#else#include "twg$tcp:[netdist.include]socket_aliases.h"#include <errno.h>#include "twg$tcp:[netdist.include.sys]types.h"#endif /* OLD_TWG */#include "twg$tcp:[netdist.include.sys]socket.h"#include "twg$tcp:[netdist.include]netdb.h"#include "twg$tcp:[netdist.include.sys]domain.h"#include "twg$tcp:[netdist.include.sys]protosw.h"#include "twg$tcp:[netdist.include.netinet]in.h"#include "twg$tcp:[netdist.include.arpa]inet.h"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -