1 /* ckcnet.h -- Symbol and macro definitions for C-Kermit network support */
4 Author: Frank da Cruz <fdc@columbia.edu>
5 Columbia University Academic Information Systems, New York City.
7 Copyright (C) 1985, 2004,
8 Trustees of Columbia University in the City of New York.
9 All rights reserved. See the C-Kermit COPYING.TXT file or the
10 copyright text in the ckcmai.c module for disclaimer and permissions.
17 #define NET_NONE 0 /* None */
18 #define NET_TCPB 1 /* TCP/IP Berkeley (socket) */
19 #define NET_TCPA 2 /* TCP/IP AT&T (streams) */
20 #define NET_SX25 3 /* SUNOS SunLink X.25 */
21 #define NET_DEC 4 /* DECnet */
22 #define NET_VPSI 5 /* VAX PSI */
23 #define NET_PIPE 6 /* LAN Manager Named Pipe */
24 #define NET_VX25 7 /* Stratus VOS X.25 */
25 #define NET_BIOS 8 /* IBM NetBios */
26 #define NET_SLAT 9 /* Meridian Technologies' SuperLAT */
27 #define NET_FILE 10 /* Read from a file */
28 #define NET_CMD 11 /* Read from a sub-process */
29 #define NET_DLL 12 /* Load a DLL for use as comm channel*/
30 #define NET_IX25 13 /* IBM AIX 4.1 X.25 */
31 #define NET_HX25 14 /* HP-UX 10 X.25 */
32 #define NET_PTY 15 /* Pseudoterminal */
33 #define NET_SSH 16 /* SSH */
35 #ifdef OS2 /* In OS/2, only the 32-bit */
36 #ifndef __32BIT__ /* version gets NETBIOS */
39 #endif /* CK_NETBIOS */
40 #endif /* __32BIT__ */
49 #ifdef NPIPE /* For items in common to */
50 #define NPIPEORBIOS /* Named Pipes and NETBIOS */
55 #endif /* NPIPEORBIOS */
56 #endif /* CK_NETBIOS */
58 /* Network virtual terminal protocols (for SET HOST connections) */
59 /* FTP, HTTP and SSH have their own stacks */
61 #define NP_DEFAULT 255
62 #define NP_NONE 0 /* None (async) */
63 #define NP_TELNET 1 /* TCP/IP telnet */
64 #define NP_VTP 2 /* ISO Virtual Terminal Protocol */
65 #define NP_X3 3 /* CCITT X.3 */
66 #define NP_X28 4 /* CCITT X.28 */
67 #define NP_X29 5 /* CCITT X.29 */
68 #define NP_RLOGIN 6 /* TCP/IP Remote login */
69 #define NP_KERMIT 7 /* TCP/IP Kermit */
70 #define NP_TCPRAW 8 /* TCP/IP Raw socket */
71 #define NP_TCPUNK 9 /* TCP/IP Unknown */
72 #define NP_SSL 10 /* TCP/IP SSLv23 */
73 #define NP_TLS 11 /* TCP/IP TLSv1 */
74 #define NP_SSL_TELNET 12 /* TCP/IP Telnet over SSLv23 */
75 #define NP_TLS_TELNET 13 /* TCP/IP Telnet over TLSv1 */
76 #define NP_K4LOGIN 14 /* TCP/IP Kerberized remote login */
77 #define NP_EK4LOGIN 15 /* TCP/IP Encrypted Kerberized ... */
78 #define NP_K5LOGIN 16 /* TCP/IP Kerberized remote login */
79 #define NP_EK5LOGIN 17 /* TCP/IP Encrypted Kerberized ... */
80 #define NP_K5U2U 18 /* TCP/IP Kerberos 5 User to User */
81 #define NP_CTERM 19 /* DEC CTERM */
82 #define NP_LAT 20 /* DEC LAT */
86 #define IS_TELNET() (nettype == NET_TCPB && (ttnproto == NP_TELNET \
87 || ttnproto == NP_SSL_TELNET \
88 || ttnproto == NP_TLS_TELNET \
89 || ttnproto == NP_KERMIT))
91 #define IS_TELNET() (nettype == NET_TCPB && (ttnproto == NP_TELNET \
92 || ttnproto == NP_KERMIT))
98 #define IS_RLOGIN() (nettype == NET_TCPB && (ttnproto == NP_RLOGIN \
99 || ttnproto == NP_K5LOGIN \
100 || ttnproto == NP_EK5LOGIN \
101 || ttnproto == NP_K4LOGIN \
102 || ttnproto == NP_EK4LOGIN \
105 #define IS_RLOGIN() (nettype == NET_TCPB && (ttnproto == NP_RLOGIN \
106 || ttnproto == NP_K5LOGIN \
107 || ttnproto == NP_EK5LOGIN \
112 #define IS_RLOGIN() (nettype == NET_TCPB && (ttnproto == NP_RLOGIN \
113 || ttnproto == NP_K4LOGIN \
114 || ttnproto == NP_EK4LOGIN \
117 KERBEROS defined without either KRB4 or KRB5
120 #else /* CK_KERBEROS */
121 #define IS_RLOGIN() (nettype == NET_TCPB && (ttnproto == NP_RLOGIN))
122 #endif /* CK_KERBEROS */
124 #define IS_SSH() (nettype == NET_SSH)
127 #define RL_RAW 0 /* Do Not Process XON/XOFF */
128 #define RL_COOKED 1 /* Do Process XON/XOFF */
130 /* Encryption types */
135 #define CX_AUTO ENCTYPE_ANY
138 #endif /* ENCTYPE_ANY */
140 #ifdef ENCTYPE_DES_CFB64
141 #define CX_DESC64 ENCTYPE_DES_CFB64
144 #endif /* ENCTYPE_DES_CFB64 */
146 #ifdef ENCTYPE_DES_OFB64
147 #define CX_DESO64 ENCTYPE_DES_OFB64
150 #endif /* ENCTYPE_DES_OFB64 */
152 #ifdef ENCTYPE_DES3_CFB64
153 #define CX_DES3C64 ENCTYPE_DES3_CFB64
156 #endif /* ENCTYPE_DES_CFB64 */
158 #ifdef ENCTYPE_DES3_OFB64
159 #define CX_DESO64 ENCTYPE_DES3_OFB64
162 #endif /* ENCTYPE_DES_OFB64 */
164 #ifdef ENCTYPE_CAST5_40_CFB64
165 #define CX_C540C64 ENCTYPE_CAST5_40_CFB64
168 #endif /* ENCTYPE_CAST5_40_CFB64 */
170 #ifdef ENCTYPE_CAST5_40_OFB64
171 #define CX_C540O64 ENCTYPE_CAST5_40_OFB64
174 #endif /* ENCTYPE_CAST5_40_OFB64 */
176 #ifdef ENCTYPE_CAST128_CFB64
177 #define CX_C128C64 ENCTYPE_CAST128_CFB64
179 #define CX_C128C64 10
180 #endif /* ENCTYPE_CAST128_CFB64 */
182 #ifdef ENCTYPE_CAST128_OFB64
183 #define CX_C128O64 ENCTYPE_CAST128_OFB64
185 #define CX_C128O64 11
186 #endif /* ENCTYPE_CAST128_OFB64 */
188 /* Basic network function prototypes, common to all. */
190 _PROTOTYP( int netopen, (char *, int *, int) );
191 _PROTOTYP( int netclos, (void) );
192 _PROTOTYP( int netflui, (void) );
193 _PROTOTYP( int nettchk, (void) );
194 _PROTOTYP( int netbreak, (void) );
195 _PROTOTYP( int netinc, (int) );
196 _PROTOTYP( int netxin, (int, CHAR *) );
197 _PROTOTYP( int nettol, (CHAR *, int) );
198 _PROTOTYP( int nettoc, (CHAR) );
200 SunLink X.25 support by Marcello Frutig, Catholic University,
201 Rio de Janeiro, Brazil, 1990.
203 Maybe this can be adapted to VAX PSI and other X.25 products too.
205 #ifndef SUNOS4 /* Only valid for SUNOS4 */
215 #define MAX_USER_DATA 128 /* SUN defines this in a header file, I believe. */
216 #endif /* STRATUSX25 */
222 #ifdef IBMX25 /* AIX 4.1 X.25 */
227 #define MAX_USER_DATA NPI_MAX_DATA /* used for buffer sizes */
231 #ifdef HPX25 /* HP-UX 10.* X.25 */
240 #ifndef NETCONN /* ANYX25 implies NETCONN */
244 #define MAXPADPARMS 22 /* Number of PAD parameters */
245 #define MAXCUDATA 12 /* Max length of X.25 call user data */
246 #define X29PID 1 /* X.29 protocol ID */
247 #define X29PIDLEN 4 /* X.29 protocol ID length */
249 #define X29_SET_PARMS 2
250 #define X29_READ_PARMS 4
251 #define X29_SET_AND_READ_PARMS 6
252 #define X29_INVITATION_TO_CLEAR 1
253 #define X29_PARAMETER_INDICATION 0
254 #define X29_INDICATION_OF_BREAK 3
257 #define INVALID_PAD_PARM 1
259 #define PAD_BREAK_CHARACTER 0
263 #define PAD_DATA_FORWARD_CHAR 3
264 #define PAD_DATA_FORWARD_TIMEOUT 4
265 #define PAD_FLOW_CONTROL_BY_PAD 5
266 #define PAD_SUPPRESSION_OF_SIGNALS 6
267 #define PAD_BREAK_ACTION 7
268 #define PAD_SUPPRESSION_OF_DATA 8
269 #define PAD_PADDING_AFTER_CR 9
270 #define PAD_LINE_FOLDING 10
271 #define PAD_LINE_SPEED 11
272 #define PAD_FLOW_CONTROL_BY_USER 12
273 #define PAD_LF_AFTER_CR 13
274 #define PAD_PADDING_AFTER_LF 14
275 #define PAD_EDITING 15
276 #define PAD_CHAR_DELETE_CHAR 16
277 #define PAD_BUFFER_DELETE_CHAR 17
278 #define PAD_BUFFER_DISPLAY_CHAR 18
280 #define MAXIX25 MAX_USER_DATA*7
281 #define MAXOX25 MAX_USER_DATA
285 #ifdef SOLARIS25 /* and presumably SunLink 9.xx */
288 #include <sys/ioccom.h>
289 #include <sys/types.h>
290 #include <sys/socket.h>
291 #include <sys/sockio.h>
292 #include <sundev/syncstat.h>
293 #include <netx25/x25_pk.h>
294 #include <netx25/x25_ctl.h>
295 #include <netx25/x25_ioctl.h>
297 #include <sys/ioctl.h> /* X.25 includes, Sun only */
298 #include <sys/systm.h>
300 #include <sys/mbuf.h>
302 #include <sys/socket.h>
303 #include <sys/protosw.h>
305 #include <sys/sockio.h>
307 #include <sys/domain.h>
309 #include <sys/socketvar.h>
311 #include <sundev/syncstat.h>
312 #include <netx25/x25_pk.h>
313 #include <netx25/x25_ctl.h>
314 #include <netx25/x25_ioctl.h>
315 #endif /* SOLARIS25 */
320 #ifdef IBMX25 /* X.25 includes, AIX only */
322 #include <sys/twtypes.h>
323 #include <sys/twlib.h>
325 #include <sys/stream.h>
328 #define NPI_20 /* required to include the whole NPI */
329 #include <sys/npi_20.h>
330 #include <sys/npiapi.h>
331 #include <sys/pktintf.h>
333 #include <odmi.h> /* required for access to the ODM */
334 #include <sys/cfgodm.h> /* database, needed to find out the */
335 /* local NUA. see x25local_nua() */
338 /* IBM X25 NPI generic primitive type */
339 typedef union N_npi_ctl_t {
340 ulong PRIM_type; /* generic primitive type */
341 char buffer[NPI_MAX_CTL]; /* maximum primitive size */
342 N_bind_ack_t bind_ack;
343 N_bind_req_t bind_req;
344 N_conn_con_t conn_con;
345 N_conn_ind_t conn_ind;
346 N_conn_req_t conn_req;
347 N_conn_res_t conn_res;
348 N_data_req_t data_req;
349 N_data_ind_t data_ind;
350 N_discon_ind_t discon_ind;
351 N_discon_req_t discon_req;
352 N_error_ack_t error_ack;
353 N_exdata_ind_t exdata_ind;
354 N_info_ack_t info_ack;
356 N_reset_con_t reset_con;
357 N_reset_req_t reset_req;
358 N_reset_ind_t reset_ind;
361 /* some extra definitions to help out */
362 typedef char x25addr_t[45]; /* max 40 defined by CCITT */
363 typedef char N_npi_data_t[NPI_MAX_DATA];
365 /* fd or server waiting for connections, used by netclos and netopen */
366 extern int x25serverfd;
370 #ifdef HPX25 /* X.25 includes, HP-UX only */
371 #include <x25/ccittproto.h>
373 #include <x25/x25addrstr.h>
374 #include <x25/x25codes.h>
375 #include <x25/x25hd_ioctl.h>
376 #include <x25/x25ioctls.h>
377 #include <x25/x25str.h>
378 #include <sys/ioctl.h>
381 /* C-Kermit X.3 / X.25 / X.29 / X.121 support functions */
383 /* (riehm: this list of functions isn't quite right for AIX) */
385 _PROTOTYP( int shopad, (int) );
386 _PROTOTYP( int shox25, (int) );
387 _PROTOTYP( VOID initpad, (void) );
388 _PROTOTYP( VOID setpad, (CHAR *, int) );
389 _PROTOTYP( VOID readpad, (CHAR *, int, CHAR *) );
390 _PROTOTYP( int qbitpkt, (CHAR *, int) );
391 _PROTOTYP( VOID setqbit, (void) );
392 _PROTOTYP( VOID resetqbit, (void) );
393 _PROTOTYP( VOID breakact, (void) );
394 _PROTOTYP( int pkx121, (char *, CHAR *) );
395 _PROTOTYP( SIGTYP x25oobh, (int) );
396 _PROTOTYP( int x25diag, (void) );
397 _PROTOTYP( int x25intr, (char) );
398 _PROTOTYP( int x25reset, (char, char) );
399 _PROTOTYP( int x25clear, (void) );
400 _PROTOTYP( int x25stat, (void) );
401 _PROTOTYP( int x25in, (int, CHAR *) );
402 _PROTOTYP( int setpadp, (void) );
403 _PROTOTYP( int setx25, (void) );
404 _PROTOTYP( int x25xin, (int, CHAR *) );
405 _PROTOTYP( int x25inl, (CHAR *, int, int, CHAR) );
409 _PROTOTYP( ulong x25bind, (int, char *, char *, int, int, int, ulong) );
410 _PROTOTYP( int x25call, (int, char *, char *) ); /* connect to remote */
411 _PROTOTYP( int x25unbind, (int) ); /* disconnect */
412 _PROTOTYP( char *x25prim, (int) ); /* display primitives */
413 _PROTOTYP( int x25local_nua, (char *) ); /* find local NUA */
420 #ifdef CMU_TCPIP /* CMU_TCPIP implies TCPSOCKET */
423 #endif /* TCPSOCKET */
426 #endif /* TCPIPLIB */
427 #endif /* CMU_TCPIP */
429 /* DEC TCP/IP for (Open)VMS, previously known as UCX */
431 #ifdef DEC_TCPIP /* DEC_TCPIP implies TCPSOCKET */
434 #endif /* TCPSOCKET */
437 #endif /* TCPIPLIB */
438 #endif /* DEC_TCPIP */
440 /* SRI/TGV/Cisco/Process MultiNet, TCP/IP for VAX/VMS */
442 #ifdef MULTINET /* MULTINET implies TCPSOCKET */
445 #endif /* TCPSOCKET */
448 #endif /* TCPIPLIB */
449 #ifndef TGVORWIN /* MULTINET and WINTCP */
450 #define TGVORWIN /* share a lot of code... */
451 #endif /* TGVORWIN */
452 #endif /* MULTINET */
454 /* Wollongong TCP/IP for VAX/VMS */
456 #ifdef WINTCP /* WINTCP implies TCPSOCKET */
459 #endif /* TCPSOCKET */
462 #endif /* TCPIPLIB */
463 #ifndef TGVORWIN /* WINTCP and MULTINET */
464 #define TGVORWIN /* share a lot of code... */
465 #endif /* TGVORWIN */
468 /* Wollongong TCP/IP for AT&T Sys V */
470 #ifdef WOLLONGONG /* WOLLONGONG implies TCPSOCKET */
471 #ifndef TCPSOCKET /* Don't confuse WOLLONGONG */
472 #define TCPSOCKET /* (which is for UNIX) with */
473 #endif /* TCPSOCKET */ /* WINTCP, which is for VMS! */
474 #endif /* WOLLONGONG */
476 #ifdef EXCELAN /* EXCELAN implies TCPSOCKET */
479 #endif /* TCPSOCKET */
482 #ifdef INTERLAN /* INTERLAN implies TCPSOCKET */
485 #endif /* TCPSOCKET */
486 #endif /* INTERLAN */
491 #endif /* TCPSOCKET */
494 #endif /* TCPIPLIB */
495 #define socket_errno h_errno
496 #define socket_read(x,y,z) recv(x,y,sizeof(char),z)
497 #define socket_write(x,y,z) send(x,y,sizeof(char),z)
498 #define socket_ioctl ioctl
499 #define socket_close(x) closesocket(x)
505 #endif /* FIONREAD */
508 #endif /* SIOCATMARK */
511 #ifdef COMMENT /* no longer used but might come in handy again later... */
513 CK_READ0 can (and should) be defined if and only if:
514 (a) read(fd,&x,0) can be used harmlessly on a TCP/IP socket connection.
515 (b) read(fd,&x,0) returns 0 if the connection is up, -1 if it is down.
519 #ifdef SUNOS41 /* It works in SunOS 4.1 */
522 #ifdef NEXT /* and NeXTSTEP */
526 #endif /* TCPSOCKET */
527 #endif /* CK_READ0 */
530 /* Telnet protocol */
532 #ifdef TCPSOCKET /* TCPSOCKET implies TNCODE */
533 #ifndef TNCODE /* Which means... */
534 #define TNCODE /* Compile in telnet code */
538 Platforms where we must call gethostname(buf,len) and then
539 gethostbyname(buf) to get local IP address, rather than calling
558 #endif /* UNIXWARE */
561 #endif /* datageneral */
562 #endif /* CKGHNLHOST */
564 #ifndef RLOGCODE /* What about Rlogin? */
567 Rlogin can be enabled only for UNIX versions that have both SIGURG
568 (SCO doesn't) and CK_TTGWSIZ (OSF/1 doesn't), so we don't assume that
569 any others have these without verifying first. Not that it really makes
570 much difference since you can only use Rlogin if you are root...
611 #endif /* __linux__ */
615 #endif /* UNIXWARE */
623 #endif /* NORLOGIN */
627 #endif /* RLOGCODE */
628 #endif /* TCPSOCKET */
632 Telnet local-echo buffer, used for saving up user data that can't be
633 properly displayed and/or evaluated until pending Telnet negotiations are
634 complete. TTLEBUF is defined for platforms (like UNIX) where net i/o is
635 done by the same routines that do serial i/o (in which case the relevant
636 code goes into the ck?tio.c module, in the ttinc(), ttchk(), etc, routines);
637 NETLETBUF is defined for platforms (like VMS) that use different APIs for
638 network and serial i/o, and enables the copies of the same routines that
647 #endif /* datageneral */
655 #endif /* NETLEBUF */
658 #ifdef SUNX25 /* SUNX25 implies TCPSOCKET */
659 #ifndef TCPSOCKET /* But doesn't imply TNCODE */
661 #endif /* TCPSOCKET */
667 #endif /* NO_DNS_SRV */
668 #endif /* TCPSOCKET */
670 /* This is another TCPSOCKET section... */
673 #ifndef NETCONN /* TCPSOCKET implies NETCONN */
688 #endif /* NO_DNS_SRV */
697 #endif /* datageneral */
704 #endif /* NO_DNS_SRV */
706 #ifndef CK_DNS_SRV /* Use DNS SRV records to determine */
707 #ifndef NO_DNS_SRV /* host and ports */
709 #endif /* NO_DNS_SRV */
710 #endif /* CK_DNS_SRV */
712 #ifndef NOLISTEN /* select() is required to support */
713 #ifndef SELECT /* incoming connections. */
720 #endif /* NOLISTEN */
722 /* BSD sockets library header files */
726 Because bzero() and bcopy() are not portable among VMS versions,
727 or compilers, or TCP/IP products, etc.
730 #define bzero(s,n) memset(s,0,n)
733 #define bcopy(h,a,l) memcpy(a,h,l)
737 #ifdef UNIX /* UNIX section */
741 These suggested by Rob Healey, rhealey@kas.helios.mn.org, to avoid
742 bugs in Berkeley compatibility library on Sys V R4 systems, but untested
743 by me (fdc). Remove this bit if it gives you trouble.
744 (Later corrected by Marc Boucher <mboucher@iro.umontreal.ca> because
745 bzero/bcopy are not argument-compatible with memset/memcpy|memmove.)
748 #define bzero(s,n) memset(s,0,n)
754 WOULD YOU BELIEVE... That the Solaris X.25 /opt/SUNWcomm/lib/libsockx25
755 library references bzero, even though the use of bzero is forbidden in
756 Solaris? Look for the function definition in ckcnet.c.
758 _PROTOTYP( void bzero, (char *, int) );
761 #define bcopy(h,a,l) memcpy(a,h,l)
765 #define bcopy(h,a,l) memmove(a,h,l)
769 #ifdef PTX /* Sequent DYNIX PTX 1.3 */
771 #define bzero(s,n) memset(s,0,n)
774 #define bcopy(h,a,l) memcpy(a,h,l)
779 #ifdef INTERLAN /* Racal-Interlan TCP/IP */
780 #include <interlan/socket.h>
781 #include <interlan/il_types.h>
782 #include <interlan/telnet.h>
783 #include <interlan/il_errno.h>
784 #include <interlan/in.h>
785 #include <interlan/telnet.h> /* Why twice ? ? ? */
786 #else /* Not Interlan */
789 #else /* Not BEBOX */ /* Normal BSD TCP/IP library */
792 #include <arpa/telnet.h>
796 #include <sys/errno.tcp.h>
797 #include <sys/types.tcp.h>
799 #include <sys/socket.h>
803 #include <netinet/in.h>
804 #ifndef SV68R3V6 /* (maybe this should be SVR3 in general) */
805 #include <netinet/tcp.h> /* Added June 2001 */
806 #endif /* SV68R3V6 */
807 #endif /* WOLLONGONG */
809 #endif /* INTERLAN */
815 #define minor /* Do not include <sys/macros.h> */
816 #include <sys/inet.h>
821 #include <arpa/inet.h>
825 /* In too many releases of X/OS, <arpa/inet.h> declares inet_addr() as
826 * ``struct in_addr''. This is definitively wrong, and could cause
827 * core dumps. Instead of including that bad file, inet_addr() is
828 * correctly declared here. Of course, all the declarations done there
829 * has been copied here.
831 unsigned long inet_addr();
833 struct in_addr inet_makeaddr();
834 unsigned long inet_network();
836 #endif /* WOLLONGONG */
837 #endif /* INTERLAN */
840 #ifdef EXCELAN /* Excelan TCP/IP */
842 #define bzero(s,n) memset(s,0,n)
845 #define bcopy(h,a,l) memcpy(a,h,l)
847 #include <ex_errno.h>
850 #ifdef I386IX /* Interactive Sys V R3 network. */
851 /* #define TELOPTS */ /* This might need defining. */
852 #define ORG_NLONG ENAMETOOLONG /* Resolve conflicting symbols */
853 #undef ENAMETOOLONG /* in <errno.h> and <net/errno.h> */
854 #define ORG_NEMPTY ENOTEMPTY
856 #include <net/errno.h>
858 #define ENAMETOOLONG ORG_NLONG
860 #define ENOTEMPTY ORG_NEMPTY
861 #include <netinet/tcp.h> /* for inet_addr() */
864 Data type of the inet_addr() function...
865 We define INADDRX if it is of type struct inaddr.
866 If it is undefined, unsigned long is assumed.
867 Look at <arpa/inet.h> to find out. The following known cases are
868 handled here. Other systems that need it can be added here, or else
869 -DINADDRX can be included in the CFLAGS on the cc command line.
872 #ifdef DU2 /* DEC Ultrix 2.0 */
875 #endif /* NOINADDRX */
879 #ifdef VMS /* (Open)VMS section */
881 #ifdef MULTINET /* TGV MultiNet */
883 In C-Kermit 7.0 Beta.08 we started getting scads of compile time warnings
884 in Multinet builds: "blah" is implicitly declared as a function, where blah
885 is socket_read/write/close, ntohs, htons, getpeername, accept, select, etc.
886 I have no idea why -- these routines are declared in the header files below,
887 and the includes haven't changed. The executable still seems to work OK.
888 Messing with the order of the following includes is disastrous.
890 #ifdef MULTINET_NO_PROTOTYPES
891 #undef MULTINET_NO_PROTOTYPES
892 #endif /* MULTINET_NO_PROTOTYPES */
896 #endif /* __cplusplus */
898 #include "multinet_root:[multinet.include]errno.h"
899 #include "multinet_root:[multinet.include.sys]types.h"
900 #include "multinet_root:[multinet.include.sys]socket.h"
901 #include "multinet_root:[multinet.include]netdb.h"
902 #include "multinet_root:[multinet.include.netinet]in.h"
903 #include "multinet_root:[multinet.include.arpa]inet.h"
904 #include "multinet_root:[multinet.include.sys]ioctl.h"
908 No longer needed because now bzero/bcopy are macros defined as
909 memset/memmove in all VMS builds.
912 We should be able to pick these up from <strings.h> but it's
913 not portable between VAXC and DECC. And even with DECC 5.x we have a
914 difference between VAX and Alpha. We get warnings here on the VAX
915 with DECC 5.6-003 but they are not fatal.
919 _PROTOTYP( void bzero, (char *, int) );
922 _PROTOTYP( void bcopy, (char *, char *, int) );
924 #endif /* __DECC_VER */
929 If compiling under DEC C the socket calls must not be prefixed with
930 DECC$. This is done by using the compiler switch /Prefix=Ansi_C89.
931 However, this causes some calls that should be prefixed to not be
932 (which I think is a bug in the compiler - I've been told these calls
933 are present in ANSI compilers). At any rate, such calls are fixed
934 here by explicitly prefixing them.
938 But this causes errors with VMS 6.2 / DEC C 5.3-006 / MultiNet 4.0A on
939 a VAX (but not on an Alpha). So now what happens if we skip doing this?
941 #define close decc$close
942 #define alarm decc$alarm
946 #else /* Not MULTINET */
948 #ifdef WINTCP /* WIN/TCP = PathWay for VMS */
950 #include "twg$tcp:[netdist.include.sys]errno.h"
951 #include "twg$tcp:[netdist.include.sys]types2.h" /* avoid some duplicates */
953 #include "twg$tcp:[netdist.include]socket_aliases.h"
955 #include "twg$tcp:[netdist.include.sys]types.h"
957 #include "twg$tcp:[netdist.include.sys]socket.h"
958 #include "twg$tcp:[netdist.include]netdb.h"
959 #include "twg$tcp:[netdist.include.sys]domain.h"
960 #include "twg$tcp:[netdist.include.sys]protosw.h"
961 #include "twg$tcp:[netdist.include.netinet]in.h"
962 #include "twg$tcp:[netdist.include.arpa]inet.h"
963 #include "twg$tcp:[netdist.include.sys]ioctl.h"
965 #else /* Not WINTCP */
971 #endif /* IF_DOT_H */
975 #include <if.h> /* Needed to put up u_int typedef */
978 typedef unsigned int u_int;
979 #endif /* NEEDUINT */
980 #endif /* IF_DOT_H */
986 #define socket_errno errno
990 No longer needed because now bzero/bcopy are macros defined as
991 memset/memmove in all VMS builds.
994 Translation: In <strings.h>, which exists only for DECC >= 5.2, bzero()
995 and bcopy() are declared only for OpenVMS >= 7.0. This still might need
996 adjustment for DECC 5.0 and higher.
1001 Note: you can't use "#if (__VMS_VER>=70000000)" because that is not
1002 portable and kills non-VMS builds.
1004 #include <strings.h>
1007 #define bzero(s,n) memset(s,0,n)
1010 #define bcopy(h,a,l) memmove(a,h,l)
1015 #define bzero(s,n) memset(s,0,n)
1018 #define bcopy(h,a,l) memmove(a,h,l)
1020 #endif /* __DECC_VER */
1021 #endif /* COMMENT */
1023 #define socket_read read
1024 #define socket_write write
1025 #define socket_ioctl ioctl
1026 #define socket_close close
1029 int ioctl (int d, int request, void *argp);
1031 int ioctl (int d, int request, char *argp);
1034 UCX supports select(), but does not provide the needed symbol and
1035 structure definitions in any header file, so ...
1040 * Copyright (c) 1982, 1986, 1991, 1993
1041 * The Regents of the University of California. All rights reserved.
1043 * Redistribution and use in source and binary forms, with or without
1044 * modification, are permitted provided that the following conditions
1046 * 1. Redistributions of source code must retain the above copyright
1047 * notice, this list of conditions and the following disclaimer.
1048 * 2. Redistributions in binary form must reproduce the above copyright
1049 * notice, this list of conditions and the following disclaimer in the
1050 * documentation and/or other materials provided with the distribution.
1051 * 3. All advertising materials mentioning features or use of this software
1052 * must display the following acknowledgement:
1053 * This product includes software developed by the University of
1054 * California, Berkeley and its contributors.
1055 * 4. Neither the name of the University nor the names of its contributors
1056 * may be used to endorse or promote products derived from this software
1057 * without specific prior written permission.
1059 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1060 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1061 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1062 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1063 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1064 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1065 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1066 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1067 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1068 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1071 * @(#)types.h 8.1 (Berkeley) 6/2/93
1074 #define NBBY 8 /* number of bits in a byte */
1077 * Select uses bit masks of file descriptors in longs. These macros
1078 * manipulate such bit fields (the filesystem macros use chars).
1079 * FD_SETSIZE may be defined by the user, but the default here should
1080 * be enough for most uses.
1083 #define FD_SETSIZE 256
1086 typedef long fd_mask;
1087 #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
1090 #define howmany(x, y) (((x)+((y)-1))/(y))
1093 typedef struct fd_set {
1094 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
1097 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
1098 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
1099 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
1100 #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
1101 #define FD_ZERO(p) bzero(p, sizeof(*(p)))
1104 #else /* Not DEC_TCPIP */
1114 #define socket_errno errno
1117 * Routines supplied in LIBCMU.OLB
1119 #define socket_ioctl ioctl
1120 #define socket_read cmu_read
1121 #define socket_write cmu_write
1122 #define socket_close cmu_close
1124 #endif /* CMU_TCPIP */
1125 #endif /* DEC_TCPIP */
1127 #endif /* MULTINET */
1138 #ifdef STRATUS /* Stratus VOS using OS TCP/IP products S235, S236, S237 */
1139 #include <tcp_socket.h>
1140 /* This gets used some places when TCPSOCKET is defined. */
1141 /* OS TCP provides bzero(), but not bcopy()... go figure. */
1142 #define bcopy(s,d,z) memcpy(d,s,z)
1143 #endif /* STRATUS */
1147 #include <inet/in.h>
1148 #include <inet/netdb.h>
1149 #include <inet/socket.h>
1151 #include <INET/in.h>
1152 #include <INET/netdb.h>
1153 #include <INET/socket.h>
1156 #define bzero(s,n) memset(s,0,n)
1159 #define bcopy(h,a,l) memcpy(a,h,l)
1161 typedef char * caddr_t; /* core address type */
1166 #endif /* TCPSOCKET */
1173 #endif /* SUNOS41 */
1176 #endif /* SOLARIS */
1192 #endif /* HADDRLIST */
1193 /* A system that defines h_addr as h_addr_list[0] should be HADDRLIST */
1198 #endif /* HADDRLIST */
1199 #endif /* NOHADDRLIST */
1200 #endif /* TCPSOCKET */
1202 #ifdef TNCODE /* If we're compiling telnet code... */
1206 #endif /* STRATUS */
1207 #endif /* IKS_OPTION */
1210 extern int sstelnet;
1219 #endif /* IKS_OPTION */
1224 Automatically define NOTCPOPTS for configurations where they can't be
1225 used at runtime or cause too much trouble at compile time.
1227 #ifdef CMU_TCPIP /* CMU/Tek */
1229 #endif /* CMU_TCPIP */
1230 #ifdef MULTINET /* Multinet on Alpha */
1233 #endif /* __alpha */
1234 #endif /* MULTINET */
1235 #endif /* NOTCPOPTS */
1240 #endif /* TCP_NODELAY */
1243 #endif /* SO_LINGER */
1246 #endif /* SO_KEEPALIVE */
1249 #endif /* SO_SNDBUF */
1252 #endif /* SO_RCVBUF */
1253 #endif /* NOTCPOPTS */
1255 /* This function is declared even when TCPSOCKET is not available */
1256 _PROTOTYP( char * ckgetpeer, (VOID));
1261 _PROTOTYP( int no_delay, (int, int) );
1262 #endif /* TCP_NODELAY */
1264 _PROTOTYP( int keepalive, (int, int) ) ;
1265 #endif /* SO_KEEPALIVE */
1267 _PROTOTYP( int ck_linger, (int, int, int) ) ;
1268 #endif /* SO_LINGER */
1270 _PROTOTYP( int sendbuf,(int, int) ) ;
1271 #endif /* SO_SNDBUF */
1273 _PROTOTYP( int recvbuf, (int, int) ) ;
1274 #endif /* SO_RCVBUF */
1276 _PROTOTYP(int dontroute, (int, int));
1277 #endif /* SO_DONTROUTE */
1278 #endif /* SOL_SOCKET */
1279 _PROTOTYP( int getlocalipaddr, (VOID));
1280 _PROTOTYP( int getlocalipaddrs, (char *,int,int));
1281 _PROTOTYP( char * ckgetfqhostname,(char *));
1282 _PROTOTYP( struct hostent * ck_copyhostent,(struct hostent *));
1283 _PROTOTYP( char * ckname2addr, (char *));
1284 _PROTOTYP( char * ckaddr2name, (char *));
1290 #define TCP_NODELAY 0x1
1291 #endif /* TCP_NODELAY */
1293 #define TCP_MAXSEG 0x2
1294 #endif /* TCP_MAXSEG */
1295 #ifndef TCP_KEEPALIVE
1296 #define TCP_KEEPALIVE 0x8
1297 #endif /* TCP_KEEPALIVE */
1299 #endif /* TCPSOCKET */
1303 SORRY_RLOGIN_REQUIRES_TTGWSIZ_see_ckcplm.doc
1304 #endif /* CK_TTGWSIZ */
1305 #endif /* RLOGCODE */
1309 SORRY_CK_NAWS_REQUIRES_TTGWSIZ_see_ckcplm.doc
1310 #endif /* CK_TTGWSIZ */
1311 #endif /* CK_NAWS */
1315 #define PF_INET AF_INET
1316 #endif /* AF_INET */
1317 #endif /* PF_INET */
1320 #define IPPORT_ECHO 7
1321 #endif /* IPPORT_ECHO */
1325 _PROTOTYP(int ck_krb_rlogin,(CHAR *, int, CHAR *, CHAR *, CHAR *,
1326 struct sockaddr_in *,
1327 struct sockaddr_in *, int, int));
1328 #endif /* RLOGCODE */
1329 #endif /* CK_KERBEROS */
1331 _PROTOTYP( VOID ini_kerb, ( void ) ); /* Kerberos initialization routine */
1332 _PROTOTYP( int doauth, (int) ); /* AUTHENTICATE action routine */
1335 _PROTOTYP(int locate_srv_dns,(char *host, char *service,
1336 char *protocol, struct sockaddr **addr_pp,
1338 #endif /* CK_DNS_SRV */
1341 _PROTOTYP(int http_open, (char *, char *, int, char *, int, char *));
1342 _PROTOTYP(int http_reopen, (VOID));
1343 _PROTOTYP(int http_close, (VOID));
1344 _PROTOTYP(int http_get, (char *,char **,char *,char *,char,char *,char *,
1346 _PROTOTYP(int http_head, (char *,char **,char *,char *,char,char *,char *,
1348 _PROTOTYP(int http_put, (char *,char **,char *,char *,char *,char,char *,
1349 char *, char *, int));
1350 _PROTOTYP(int http_delete, (char *,char **,char *,char *,char,char *));
1351 _PROTOTYP(int http_connect, (int, char *,char **,char *,char *,char,char *));
1352 _PROTOTYP(int http_post, (char *,char **,char *,char *,char *,char,char *,
1353 char *,char *, int));
1354 _PROTOTYP(int http_index, (char *,char **,char *,char *,char,char *,char *,
1356 _PROTOTYP(int http_inc, (int));
1357 _PROTOTYP(int http_isconnected, (void));
1359 extern char * tcp_http_proxy; /* Name[:port] of http proxy server */
1360 extern int tcp_http_proxy_errno; /* Return value from server */
1361 extern char * tcp_http_proxy_user; /* Name of user for authentication */
1362 extern char * tcp_http_proxy_pwd; /* Password of user */
1367 /* Type needed as 5th argument (length) to get/setsockopt() */
1370 #define SOCKOPT_T int
1373 #define SOCKOPT_T unsigned long
1377 #define SOCKOPT_T size_t
1381 #define SOCKOPT_T int
1385 #define SOCKOPT_T size_t
1386 #else /* UNIXWARE */
1391 #define SOCKOPT_T size_t
1392 #endif /* __DECC_VER */
1393 #endif /* DEC_TCPIP */
1395 #endif /* UNIXWARE */
1399 #endif /* SOCKOPT_T */
1401 /* Ditto for getsockname() */
1404 #define GSOCKNAME_T int
1407 #define GSOCKNAME_T size_t
1409 #ifdef AIX42 /* size_t in 4.2++, int in 4.1-- */
1411 #define GSOCKNAME_T size_t
1415 #define GSOCKNAME_T size_t
1421 #define GSOCKNAME_T size_t
1422 #endif /* __DECC_VER */
1423 #endif /* DEC_TCPIP */
1425 #endif /* UNIXWARE */
1428 #endif /* GSOCKNAME_T */
1430 #endif /* TCPSOCKET */
1439 #endif /* MACOSX10 */
1441 #endif /* CKCNET_H */