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, 2009,
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 */
83 #define NP_SSL_RAW 21 /* SSL with no Telnet permitted */
84 #define NP_TLS_RAW 22 /* TLS with no Telnet permitted */
89 #define IS_TELNET() (nettype == NET_TCPB && (ttnproto == NP_TELNET \
90 || ttnproto == NP_SSL_TELNET \
91 || ttnproto == NP_TLS_TELNET \
92 || ttnproto == NP_KERMIT))
94 #define IS_TELNET() (nettype == NET_TCPB && (ttnproto == NP_TELNET \
95 || ttnproto == NP_KERMIT))
101 #define IS_RLOGIN() (nettype == NET_TCPB && (ttnproto == NP_RLOGIN \
102 || ttnproto == NP_K5LOGIN \
103 || ttnproto == NP_EK5LOGIN \
104 || ttnproto == NP_K4LOGIN \
105 || ttnproto == NP_EK4LOGIN \
108 #define IS_RLOGIN() (nettype == NET_TCPB && (ttnproto == NP_RLOGIN \
109 || ttnproto == NP_K5LOGIN \
110 || ttnproto == NP_EK5LOGIN \
115 #define IS_RLOGIN() (nettype == NET_TCPB && (ttnproto == NP_RLOGIN \
116 || ttnproto == NP_K4LOGIN \
117 || ttnproto == NP_EK4LOGIN \
120 KERBEROS defined without either KRB4 or KRB5
123 #else /* CK_KERBEROS */
124 #define IS_RLOGIN() (nettype == NET_TCPB && (ttnproto == NP_RLOGIN))
125 #endif /* CK_KERBEROS */
127 #define IS_SSH() (nettype == NET_SSH)
130 #define RL_RAW 0 /* Do Not Process XON/XOFF */
131 #define RL_COOKED 1 /* Do Process XON/XOFF */
133 /* Encryption types */
138 #define CX_AUTO ENCTYPE_ANY
141 #endif /* ENCTYPE_ANY */
143 #ifdef ENCTYPE_DES_CFB64
144 #define CX_DESC64 ENCTYPE_DES_CFB64
147 #endif /* ENCTYPE_DES_CFB64 */
149 #ifdef ENCTYPE_DES_OFB64
150 #define CX_DESO64 ENCTYPE_DES_OFB64
153 #endif /* ENCTYPE_DES_OFB64 */
155 #ifdef ENCTYPE_DES3_CFB64
156 #define CX_DES3C64 ENCTYPE_DES3_CFB64
159 #endif /* ENCTYPE_DES_CFB64 */
161 #ifdef ENCTYPE_DES3_OFB64
162 #define CX_DESO64 ENCTYPE_DES3_OFB64
165 #endif /* ENCTYPE_DES_OFB64 */
167 #ifdef ENCTYPE_CAST5_40_CFB64
168 #define CX_C540C64 ENCTYPE_CAST5_40_CFB64
171 #endif /* ENCTYPE_CAST5_40_CFB64 */
173 #ifdef ENCTYPE_CAST5_40_OFB64
174 #define CX_C540O64 ENCTYPE_CAST5_40_OFB64
177 #endif /* ENCTYPE_CAST5_40_OFB64 */
179 #ifdef ENCTYPE_CAST128_CFB64
180 #define CX_C128C64 ENCTYPE_CAST128_CFB64
182 #define CX_C128C64 10
183 #endif /* ENCTYPE_CAST128_CFB64 */
185 #ifdef ENCTYPE_CAST128_OFB64
186 #define CX_C128O64 ENCTYPE_CAST128_OFB64
188 #define CX_C128O64 11
189 #endif /* ENCTYPE_CAST128_OFB64 */
191 /* Basic network function prototypes, common to all. */
193 _PROTOTYP( int netopen, (char *, int *, int) );
194 _PROTOTYP( int netclos, (void) );
195 _PROTOTYP( int netflui, (void) );
196 _PROTOTYP( int nettchk, (void) );
197 _PROTOTYP( int netxchk, (int) );
198 _PROTOTYP( int netbreak, (void) );
199 _PROTOTYP( int netinc, (int) );
200 _PROTOTYP( int netxin, (int, CHAR *) );
201 _PROTOTYP( int nettol, (CHAR *, int) );
202 _PROTOTYP( int nettoc, (CHAR) );
204 _PROTOTYP( int gettcpport, (void) );
205 _PROTOTYP( int gettcpport, (void) );
206 #endif /* TCPSOCKET */
209 SunLink X.25 support by Marcello Frutig, Catholic University,
210 Rio de Janeiro, Brazil, 1990.
212 Maybe this can be adapted to VAX PSI and other X.25 products too.
214 #ifndef SUNOS4 /* Only valid for SUNOS4 */
224 #define MAX_USER_DATA 128 /* SUN defines this in a header file, I believe. */
225 #endif /* STRATUSX25 */
231 #ifdef IBMX25 /* AIX 4.1 X.25 */
236 #define MAX_USER_DATA NPI_MAX_DATA /* used for buffer sizes */
240 #ifdef HPX25 /* HP-UX 10.* X.25 */
249 #ifndef NETCONN /* ANYX25 implies NETCONN */
253 #define MAXPADPARMS 22 /* Number of PAD parameters */
254 #define MAXCUDATA 12 /* Max length of X.25 call user data */
255 #define X29PID 1 /* X.29 protocol ID */
256 #define X29PIDLEN 4 /* X.29 protocol ID length */
258 #define X29_SET_PARMS 2
259 #define X29_READ_PARMS 4
260 #define X29_SET_AND_READ_PARMS 6
261 #define X29_INVITATION_TO_CLEAR 1
262 #define X29_PARAMETER_INDICATION 0
263 #define X29_INDICATION_OF_BREAK 3
266 #define INVALID_PAD_PARM 1
268 #define PAD_BREAK_CHARACTER 0
272 #define PAD_DATA_FORWARD_CHAR 3
273 #define PAD_DATA_FORWARD_TIMEOUT 4
274 #define PAD_FLOW_CONTROL_BY_PAD 5
275 #define PAD_SUPPRESSION_OF_SIGNALS 6
276 #define PAD_BREAK_ACTION 7
277 #define PAD_SUPPRESSION_OF_DATA 8
278 #define PAD_PADDING_AFTER_CR 9
279 #define PAD_LINE_FOLDING 10
280 #define PAD_LINE_SPEED 11
281 #define PAD_FLOW_CONTROL_BY_USER 12
282 #define PAD_LF_AFTER_CR 13
283 #define PAD_PADDING_AFTER_LF 14
284 #define PAD_EDITING 15
285 #define PAD_CHAR_DELETE_CHAR 16
286 #define PAD_BUFFER_DELETE_CHAR 17
287 #define PAD_BUFFER_DISPLAY_CHAR 18
289 #define MAXIX25 MAX_USER_DATA*7
290 #define MAXOX25 MAX_USER_DATA
294 #ifdef SOLARIS25 /* and presumably SunLink 9.xx */
297 #include <sys/ioccom.h>
298 #include <sys/types.h>
299 #include <sys/socket.h>
300 #include <sys/sockio.h>
301 #include <sundev/syncstat.h>
302 #include <netx25/x25_pk.h>
303 #include <netx25/x25_ctl.h>
304 #include <netx25/x25_ioctl.h>
306 #include <sys/ioctl.h> /* X.25 includes, Sun only */
307 #include <sys/systm.h>
309 #include <sys/mbuf.h>
311 #include <sys/socket.h>
312 #include <sys/protosw.h>
314 #include <sys/sockio.h>
316 #include <sys/domain.h>
318 #include <sys/socketvar.h>
320 #include <sundev/syncstat.h>
321 #include <netx25/x25_pk.h>
322 #include <netx25/x25_ctl.h>
323 #include <netx25/x25_ioctl.h>
324 #endif /* SOLARIS25 */
329 #ifdef IBMX25 /* X.25 includes, AIX only */
331 #include <sys/twtypes.h>
332 #include <sys/twlib.h>
334 #include <sys/stream.h>
337 #define NPI_20 /* required to include the whole NPI */
338 #include <sys/npi_20.h>
339 #include <sys/npiapi.h>
340 #include <sys/pktintf.h>
342 #include <odmi.h> /* required for access to the ODM */
343 #include <sys/cfgodm.h> /* database, needed to find out the */
344 /* local NUA. see x25local_nua() */
347 /* IBM X25 NPI generic primitive type */
348 typedef union N_npi_ctl_t {
349 ulong PRIM_type; /* generic primitive type */
350 char buffer[NPI_MAX_CTL]; /* maximum primitive size */
351 N_bind_ack_t bind_ack;
352 N_bind_req_t bind_req;
353 N_conn_con_t conn_con;
354 N_conn_ind_t conn_ind;
355 N_conn_req_t conn_req;
356 N_conn_res_t conn_res;
357 N_data_req_t data_req;
358 N_data_ind_t data_ind;
359 N_discon_ind_t discon_ind;
360 N_discon_req_t discon_req;
361 N_error_ack_t error_ack;
362 N_exdata_ind_t exdata_ind;
363 N_info_ack_t info_ack;
365 N_reset_con_t reset_con;
366 N_reset_req_t reset_req;
367 N_reset_ind_t reset_ind;
370 /* some extra definitions to help out */
371 typedef char x25addr_t[45]; /* max 40 defined by CCITT */
372 typedef char N_npi_data_t[NPI_MAX_DATA];
374 /* fd or server waiting for connections, used by netclos and netopen */
375 extern int x25serverfd;
379 #ifdef HPX25 /* X.25 includes, HP-UX only */
380 #include <x25/ccittproto.h>
382 #include <x25/x25addrstr.h>
383 #include <x25/x25codes.h>
384 #include <x25/x25hd_ioctl.h>
385 #include <x25/x25ioctls.h>
386 #include <x25/x25str.h>
387 #include <sys/ioctl.h>
390 /* C-Kermit X.3 / X.25 / X.29 / X.121 support functions */
392 /* (riehm: this list of functions isn't quite right for AIX) */
394 _PROTOTYP( int shopad, (int) );
395 _PROTOTYP( int shox25, (int) );
396 _PROTOTYP( VOID initpad, (void) );
397 _PROTOTYP( VOID setpad, (CHAR *, int) );
398 _PROTOTYP( VOID readpad, (CHAR *, int, CHAR *) );
399 _PROTOTYP( int qbitpkt, (CHAR *, int) );
400 _PROTOTYP( VOID setqbit, (void) );
401 _PROTOTYP( VOID resetqbit, (void) );
402 _PROTOTYP( VOID breakact, (void) );
403 _PROTOTYP( int pkx121, (char *, CHAR *) );
404 _PROTOTYP( SIGTYP x25oobh, (int) );
405 _PROTOTYP( int x25diag, (void) );
406 _PROTOTYP( int x25intr, (char) );
407 _PROTOTYP( int x25reset, (char, char) );
408 _PROTOTYP( int x25clear, (void) );
409 _PROTOTYP( int x25stat, (void) );
410 _PROTOTYP( int x25in, (int, CHAR *) );
411 _PROTOTYP( int setpadp, (void) );
412 _PROTOTYP( int setx25, (void) );
413 _PROTOTYP( int x25xin, (int, CHAR *) );
414 _PROTOTYP( int x25inl, (CHAR *, int, int, CHAR) );
418 _PROTOTYP( ulong x25bind, (int, char *, char *, int, int, int, ulong) );
419 _PROTOTYP( int x25call, (int, char *, char *) ); /* connect to remote */
420 _PROTOTYP( int x25unbind, (int) ); /* disconnect */
421 _PROTOTYP( char *x25prim, (int) ); /* display primitives */
422 _PROTOTYP( int x25local_nua, (char *) ); /* find local NUA */
429 #ifdef CMU_TCPIP /* CMU_TCPIP implies TCPSOCKET */
432 #endif /* TCPSOCKET */
435 #endif /* TCPIPLIB */
436 #endif /* CMU_TCPIP */
438 /* DEC TCP/IP for (Open)VMS, previously known as UCX */
440 #ifdef DEC_TCPIP /* DEC_TCPIP implies TCPSOCKET */
443 #endif /* TCPSOCKET */
446 #endif /* TCPIPLIB */
447 #endif /* DEC_TCPIP */
449 /* SRI/TGV/Cisco/Process MultiNet, TCP/IP for VAX/VMS */
451 #ifdef MULTINET /* MULTINET implies TCPSOCKET */
454 #endif /* TCPSOCKET */
457 #endif /* TCPIPLIB */
458 #ifndef TGVORWIN /* MULTINET and WINTCP */
459 #define TGVORWIN /* share a lot of code... */
460 #endif /* TGVORWIN */
461 #endif /* MULTINET */
463 /* Wollongong TCP/IP for VAX/VMS */
465 #ifdef WINTCP /* WINTCP implies TCPSOCKET */
468 #endif /* TCPSOCKET */
471 #endif /* TCPIPLIB */
472 #ifndef TGVORWIN /* WINTCP and MULTINET */
473 #define TGVORWIN /* share a lot of code... */
474 #endif /* TGVORWIN */
477 /* Wollongong TCP/IP for AT&T Sys V */
479 #ifdef WOLLONGONG /* WOLLONGONG implies TCPSOCKET */
480 #ifndef TCPSOCKET /* Don't confuse WOLLONGONG */
481 #define TCPSOCKET /* (which is for UNIX) with */
482 #endif /* TCPSOCKET */ /* WINTCP, which is for VMS! */
483 #endif /* WOLLONGONG */
485 #ifdef EXCELAN /* EXCELAN implies TCPSOCKET */
488 #endif /* TCPSOCKET */
491 #ifdef INTERLAN /* INTERLAN implies TCPSOCKET */
494 #endif /* TCPSOCKET */
495 #endif /* INTERLAN */
500 #endif /* TCPSOCKET */
503 #endif /* TCPIPLIB */
504 #define socket_errno h_errno
505 #define socket_read(x,y,z) recv(x,y,sizeof(char),z)
506 #define socket_write(x,y,z) send(x,y,sizeof(char),z)
507 #define socket_ioctl ioctl
508 #define socket_close(x) closesocket(x)
514 #endif /* FIONREAD */
517 #endif /* SIOCATMARK */
520 #ifdef COMMENT /* no longer used but might come in handy again later... */
522 CK_READ0 can (and should) be defined if and only if:
523 (a) read(fd,&x,0) can be used harmlessly on a TCP/IP socket connection.
524 (b) read(fd,&x,0) returns 0 if the connection is up, -1 if it is down.
528 #ifdef SUNOS41 /* It works in SunOS 4.1 */
531 #ifdef NEXT /* and NeXTSTEP */
535 #endif /* TCPSOCKET */
536 #endif /* CK_READ0 */
539 /* Telnet protocol */
541 #ifdef TCPSOCKET /* TCPSOCKET implies TNCODE */
542 #ifndef TNCODE /* Which means... */
543 #define TNCODE /* Compile in telnet code */
547 Platforms where we must call gethostname(buf,len) and then
548 gethostbyname(buf) to get local IP address, rather than calling
567 #endif /* UNIXWARE */
570 #endif /* datageneral */
571 #endif /* CKGHNLHOST */
573 #ifndef RLOGCODE /* What about Rlogin? */
576 Rlogin can be enabled only for UNIX versions that have both SIGURG
577 (SCO doesn't) and CK_TTGWSIZ (OSF/1 doesn't), so we don't assume that
578 any others have these without verifying first. Not that it really makes
579 much difference since you can only use Rlogin if you are root...
620 #endif /* __linux__ */
624 #endif /* UNIXWARE */
632 #endif /* NORLOGIN */
636 #endif /* RLOGCODE */
637 #endif /* TCPSOCKET */
641 Telnet local-echo buffer, used for saving up user data that can't be
642 properly displayed and/or evaluated until pending Telnet negotiations are
643 complete. TTLEBUF is defined for platforms (like UNIX) where net i/o is
644 done by the same routines that do serial i/o (in which case the relevant
645 code goes into the ck?tio.c module, in the ttinc(), ttchk(), etc, routines);
646 NETLETBUF is defined for platforms (like VMS) that use different APIs for
647 network and serial i/o, and enables the copies of the same routines that
656 #endif /* datageneral */
664 #endif /* NETLEBUF */
667 #ifdef SUNX25 /* SUNX25 implies TCPSOCKET */
668 #ifndef TCPSOCKET /* But doesn't imply TNCODE */
670 #endif /* TCPSOCKET */
676 #endif /* NO_DNS_SRV */
677 #endif /* TCPSOCKET */
679 /* This is another TCPSOCKET section... */
682 #ifndef NETCONN /* TCPSOCKET implies NETCONN */
697 #endif /* NO_DNS_SRV */
706 #endif /* datageneral */
713 #endif /* NO_DNS_SRV */
715 #ifndef CK_DNS_SRV /* Use DNS SRV records to determine */
716 #ifndef NO_DNS_SRV /* host and ports */
718 #endif /* NO_DNS_SRV */
719 #endif /* CK_DNS_SRV */
721 #ifndef NOLISTEN /* select() is required to support */
722 #ifndef SELECT /* incoming connections. */
729 #endif /* NOLISTEN */
731 /* BSD sockets library header files */
735 Because bzero() and bcopy() are not portable among VMS versions,
736 or compilers, or TCP/IP products, etc.
739 #define bzero(s,n) memset(s,0,n)
742 #define bcopy(h,a,l) memcpy(a,h,l)
747 /* These are missing in HP-UX 6.xx */
749 #define bzero(s,n) memset(s,0,n)
752 #define bcopy(h,a,l) memcpy(a,h,l)
756 #ifdef UNIX /* UNIX section */
760 These suggested by Rob Healey, rhealey@kas.helios.mn.org, to avoid
761 bugs in Berkeley compatibility library on Sys V R4 systems, but untested
762 by me (fdc). Remove this bit if it gives you trouble.
763 (Later corrected by Marc Boucher <mboucher@iro.umontreal.ca> because
764 bzero/bcopy are not argument-compatible with memset/memcpy|memmove.)
767 #define bzero(s,n) memset(s,0,n)
773 WOULD YOU BELIEVE... That the Solaris X.25 /opt/SUNWcomm/lib/libsockx25
774 library references bzero, even though the use of bzero is forbidden in
775 Solaris? Look for the function definition in ckcnet.c.
777 _PROTOTYP( void bzero, (char *, int) );
780 #define bcopy(h,a,l) memcpy(a,h,l)
784 #define bcopy(h,a,l) memmove(a,h,l)
788 #ifdef PTX /* Sequent DYNIX PTX 1.3 */
790 #define bzero(s,n) memset(s,0,n)
793 #define bcopy(h,a,l) memcpy(a,h,l)
798 #ifdef INTERLAN /* Racal-Interlan TCP/IP */
799 #include <interlan/socket.h>
800 #include <interlan/il_types.h>
801 #include <interlan/telnet.h>
802 #include <interlan/il_errno.h>
803 #include <interlan/in.h>
804 #include <interlan/telnet.h> /* Why twice ? ? ? */
805 #else /* Not Interlan */
808 #else /* Not BEBOX */ /* Normal BSD TCP/IP library */
811 #include <arpa/telnet.h>
815 #include <sys/errno.tcp.h>
816 #include <sys/types.tcp.h>
818 #include <sys/socket.h>
822 #include <netinet/in.h>
823 #ifndef SV68R3V6 /* (maybe this should be SVR3 in general) */
824 #include <netinet/tcp.h> /* Added June 2001 */
825 #endif /* SV68R3V6 */
826 #endif /* WOLLONGONG */
828 #endif /* INTERLAN */
834 #define minor /* Do not include <sys/macros.h> */
835 #include <sys/inet.h>
840 #include <arpa/inet.h>
844 /* In too many releases of X/OS, <arpa/inet.h> declares inet_addr() as
845 * ``struct in_addr''. This is definitively wrong, and could cause
846 * core dumps. Instead of including that bad file, inet_addr() is
847 * correctly declared here. Of course, all the declarations done there
848 * has been copied here.
850 unsigned long inet_addr();
852 struct in_addr inet_makeaddr();
853 unsigned long inet_network();
855 #endif /* WOLLONGONG */
856 #endif /* INTERLAN */
859 #ifdef EXCELAN /* Excelan TCP/IP */
861 #define bzero(s,n) memset(s,0,n)
864 #define bcopy(h,a,l) memcpy(a,h,l)
866 #include <ex_errno.h>
869 #ifdef I386IX /* Interactive Sys V R3 network. */
870 /* #define TELOPTS */ /* This might need defining. */
871 #define ORG_NLONG ENAMETOOLONG /* Resolve conflicting symbols */
872 #undef ENAMETOOLONG /* in <errno.h> and <net/errno.h> */
873 #define ORG_NEMPTY ENOTEMPTY
875 #include <net/errno.h>
877 #define ENAMETOOLONG ORG_NLONG
879 #define ENOTEMPTY ORG_NEMPTY
880 #include <netinet/tcp.h> /* for inet_addr() */
883 Data type of the inet_addr() function...
884 We define INADDRX if it is of type struct inaddr.
885 If it is undefined, unsigned long is assumed.
886 Look at <arpa/inet.h> to find out. The following known cases are
887 handled here. Other systems that need it can be added here, or else
888 -DINADDRX can be included in the CFLAGS on the cc command line.
891 #ifdef DU2 /* DEC Ultrix 2.0 */
894 #endif /* NOINADDRX */
898 #ifdef VMS /* (Open)VMS section */
900 #ifdef MULTINET /* TGV MultiNet */
902 In C-Kermit 7.0 Beta.08 we started getting scads of compile time warnings
903 in Multinet builds: "blah" is implicitly declared as a function, where blah
904 is socket_read/write/close, ntohs, htons, getpeername, accept, select, etc.
905 I have no idea why -- these routines are declared in the header files below,
906 and the includes haven't changed. The executable still seems to work OK.
907 Messing with the order of the following includes is disastrous.
909 #ifdef MULTINET_NO_PROTOTYPES
910 #undef MULTINET_NO_PROTOTYPES
911 #endif /* MULTINET_NO_PROTOTYPES */
915 #endif /* __cplusplus */
917 #include "multinet_root:[multinet.include]errno.h"
918 #include "multinet_root:[multinet.include.sys]types.h"
919 #include "multinet_root:[multinet.include.sys]socket.h"
920 #include "multinet_root:[multinet.include]netdb.h"
921 #include "multinet_root:[multinet.include.netinet]in.h"
922 #include "multinet_root:[multinet.include.arpa]inet.h"
923 #include "multinet_root:[multinet.include.sys]ioctl.h"
927 No longer needed because now bzero/bcopy are macros defined as
928 memset/memmove in all VMS builds.
931 We should be able to pick these up from <strings.h> but it's
932 not portable between VAXC and DECC. And even with DECC 5.x we have a
933 difference between VAX and Alpha. We get warnings here on the VAX
934 with DECC 5.6-003 but they are not fatal.
938 _PROTOTYP( void bzero, (char *, int) );
941 _PROTOTYP( void bcopy, (char *, char *, int) );
943 #endif /* __DECC_VER */
948 If compiling under DEC C the socket calls must not be prefixed with
949 DECC$. This is done by using the compiler switch /Prefix=Ansi_C89.
950 However, this causes some calls that should be prefixed to not be
951 (which I think is a bug in the compiler - I've been told these calls
952 are present in ANSI compilers). At any rate, such calls are fixed
953 here by explicitly prefixing them.
957 But this causes errors with VMS 6.2 / DEC C 5.3-006 / MultiNet 4.0A on
958 a VAX (but not on an Alpha). So now what happens if we skip doing this?
960 #define close decc$close
961 #define alarm decc$alarm
965 #else /* Not MULTINET */
967 #ifdef WINTCP /* WIN/TCP = PathWay for VMS */
969 #include "twg$tcp:[netdist.include.sys]errno.h"
970 #include "twg$tcp:[netdist.include.sys]types2.h" /* avoid some duplicates */
972 #include "twg$tcp:[netdist.include]socket_aliases.h"
974 #include "twg$tcp:[netdist.include.sys]types.h"
976 #include "twg$tcp:[netdist.include.sys]socket.h"
977 #include "twg$tcp:[netdist.include]netdb.h"
978 #include "twg$tcp:[netdist.include.sys]domain.h"
979 #include "twg$tcp:[netdist.include.sys]protosw.h"
980 #include "twg$tcp:[netdist.include.netinet]in.h"
981 #include "twg$tcp:[netdist.include.arpa]inet.h"
982 #include "twg$tcp:[netdist.include.sys]ioctl.h"
984 #else /* Not WINTCP */
990 #endif /* IF_DOT_H */
994 #include <if.h> /* Needed to put up u_int typedef */
997 typedef unsigned int u_int;
998 #endif /* NEEDUINT */
999 #endif /* IF_DOT_H */
1003 #include <inet.h> /* (SMS 2007/02/15) */
1008 #define socket_errno errno
1012 No longer needed because now bzero/bcopy are macros defined as
1013 memset/memmove in all VMS builds.
1016 Translation: In <strings.h>, which exists only for DECC >= 5.2, bzero()
1017 and bcopy() are declared only for OpenVMS >= 7.0. This still might need
1018 adjustment for DECC 5.0 and higher.
1023 Note: you can't use "#if (__VMS_VER>=70000000)" because that is not
1024 portable and kills non-VMS builds.
1026 #include <strings.h>
1029 #define bzero(s,n) memset(s,0,n)
1032 #define bcopy(h,a,l) memmove(a,h,l)
1037 #define bzero(s,n) memset(s,0,n)
1040 #define bcopy(h,a,l) memmove(a,h,l)
1042 #endif /* __DECC_VER */
1043 #endif /* COMMENT */
1045 #define socket_read read
1046 #define socket_write write
1047 #define socket_ioctl ioctl
1048 #define socket_close close
1051 int ioctl (int d, int request, void *argp);
1053 int ioctl (int d, int request, char *argp);
1056 UCX supports select(), but does not provide the needed symbol and
1057 structure definitions in any header file, so ...
1062 * Copyright (c) 1982, 1986, 1991, 1993
1063 * The Regents of the University of California. All rights reserved.
1065 * Redistribution and use in source and binary forms, with or without
1066 * modification, are permitted provided that the following conditions
1068 * 1. Redistributions of source code must retain the above copyright
1069 * notice, this list of conditions and the following disclaimer.
1070 * 2. Redistributions in binary form must reproduce the above copyright
1071 * notice, this list of conditions and the following disclaimer in the
1072 * documentation and/or other materials provided with the distribution.
1073 * 3. All advertising materials mentioning features or use of this software
1074 * must display the following acknowledgement:
1075 * This product includes software developed by the University of
1076 * California, Berkeley and its contributors.
1077 * 4. Neither the name of the University nor the names of its contributors
1078 * may be used to endorse or promote products derived from this software
1079 * without specific prior written permission.
1081 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1082 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1083 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1084 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1085 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1086 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1087 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1088 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1089 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1090 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1093 * @(#)types.h 8.1 (Berkeley) 6/2/93
1096 #define NBBY 8 /* number of bits in a byte */
1099 * Select uses bit masks of file descriptors in longs. These macros
1100 * manipulate such bit fields (the filesystem macros use chars).
1101 * FD_SETSIZE may be defined by the user, but the default here should
1102 * be enough for most uses.
1105 #define FD_SETSIZE 256
1108 typedef long fd_mask;
1109 #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
1112 #define howmany(x, y) (((x)+((y)-1))/(y))
1115 typedef struct fd_set {
1116 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
1119 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
1120 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
1121 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
1122 #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
1123 #define FD_ZERO(p) bzero(p, sizeof(*(p)))
1126 #else /* Not DEC_TCPIP */
1136 #define socket_errno errno
1139 * Routines supplied in LIBCMU.OLB
1141 #define socket_ioctl ioctl
1142 #define socket_read cmu_read
1143 #define socket_write cmu_write
1144 #define socket_close cmu_close
1146 #endif /* CMU_TCPIP */
1147 #endif /* DEC_TCPIP */
1149 #endif /* MULTINET */
1160 #ifdef STRATUS /* Stratus VOS using OS TCP/IP products S235, S236, S237 */
1161 #include <tcp_socket.h>
1162 /* This gets used some places when TCPSOCKET is defined. */
1163 /* OS TCP provides bzero(), but not bcopy()... go figure. */
1164 #define bcopy(s,d,z) memcpy(d,s,z)
1165 #endif /* STRATUS */
1169 #include <inet/in.h>
1170 #include <inet/netdb.h>
1171 #include <inet/socket.h>
1173 #include <INET/in.h>
1174 #include <INET/netdb.h>
1175 #include <INET/socket.h>
1178 #define bzero(s,n) memset(s,0,n)
1181 #define bcopy(h,a,l) memcpy(a,h,l)
1183 typedef char * caddr_t; /* core address type */
1188 #endif /* TCPSOCKET */
1195 #endif /* SUNOS41 */
1198 #endif /* SOLARIS */
1214 #endif /* HADDRLIST */
1215 /* A system that defines h_addr as h_addr_list[0] should be HADDRLIST */
1220 #endif /* HADDRLIST */
1221 #endif /* NOHADDRLIST */
1222 #endif /* TCPSOCKET */
1224 #ifdef TNCODE /* If we're compiling telnet code... */
1228 #endif /* STRATUS */
1229 #endif /* IKS_OPTION */
1232 extern int sstelnet;
1241 #endif /* IKS_OPTION */
1246 Automatically define NOTCPOPTS for configurations where they can't be
1247 used at runtime or cause too much trouble at compile time.
1249 #ifdef CMU_TCPIP /* CMU/Tek */
1251 #endif /* CMU_TCPIP */
1252 #ifdef MULTINET /* Multinet on Alpha */
1255 #endif /* __alpha */
1256 #endif /* MULTINET */
1257 #endif /* NOTCPOPTS */
1262 #endif /* TCP_NODELAY */
1265 #endif /* SO_LINGER */
1268 #endif /* SO_KEEPALIVE */
1271 #endif /* SO_SNDBUF */
1274 #endif /* SO_RCVBUF */
1275 #endif /* NOTCPOPTS */
1277 /* This function is declared even when TCPSOCKET is not available */
1278 _PROTOTYP( char * ckgetpeer, (VOID));
1283 _PROTOTYP( int no_delay, (int, int) );
1284 #endif /* TCP_NODELAY */
1286 _PROTOTYP( int keepalive, (int, int) ) ;
1287 #endif /* SO_KEEPALIVE */
1289 _PROTOTYP( int ck_linger, (int, int, int) ) ;
1290 #endif /* SO_LINGER */
1292 _PROTOTYP( int sendbuf,(int, int) ) ;
1293 #endif /* SO_SNDBUF */
1295 _PROTOTYP( int recvbuf, (int, int) ) ;
1296 #endif /* SO_RCVBUF */
1298 _PROTOTYP(int dontroute, (int, int));
1299 #endif /* SO_DONTROUTE */
1300 #endif /* SOL_SOCKET */
1301 _PROTOTYP( int getlocalipaddr, (VOID));
1302 _PROTOTYP( int getlocalipaddrs, (char *,int,int));
1303 _PROTOTYP( char * ckgetfqhostname,(char *));
1304 _PROTOTYP( struct hostent * ck_copyhostent,(struct hostent *));
1305 _PROTOTYP( char * ckname2addr, (char *));
1306 _PROTOTYP( char * ckaddr2name, (char *));
1312 #define TCP_NODELAY 0x1
1313 #endif /* TCP_NODELAY */
1315 #define TCP_MAXSEG 0x2
1316 #endif /* TCP_MAXSEG */
1317 #ifndef TCP_KEEPALIVE
1318 #define TCP_KEEPALIVE 0x8
1319 #endif /* TCP_KEEPALIVE */
1321 #endif /* TCPSOCKET */
1325 SORRY_RLOGIN_REQUIRES_TTGWSIZ_see_ckcplm.doc
1326 #endif /* CK_TTGWSIZ */
1327 #endif /* RLOGCODE */
1331 SORRY_CK_NAWS_REQUIRES_TTGWSIZ_see_ckcplm.doc
1332 #endif /* CK_TTGWSIZ */
1333 #endif /* CK_NAWS */
1337 #define PF_INET AF_INET
1338 #endif /* AF_INET */
1339 #endif /* PF_INET */
1342 #define IPPORT_ECHO 7
1343 #endif /* IPPORT_ECHO */
1347 _PROTOTYP(int ck_krb_rlogin,(CHAR *, int, CHAR *, CHAR *, CHAR *,
1348 struct sockaddr_in *,
1349 struct sockaddr_in *, int, int));
1350 #endif /* RLOGCODE */
1351 #endif /* CK_KERBEROS */
1353 _PROTOTYP( VOID ini_kerb, ( void ) ); /* Kerberos initialization routine */
1354 _PROTOTYP( int doauth, (int) ); /* AUTHENTICATE action routine */
1357 _PROTOTYP(int locate_srv_dns,(char *host, char *service,
1358 char *protocol, struct sockaddr **addr_pp,
1360 #endif /* CK_DNS_SRV */
1363 _PROTOTYP(int http_open, (char *, char *, int, char *, int, char *));
1364 _PROTOTYP(int http_reopen, (VOID));
1365 _PROTOTYP(int http_close, (VOID));
1366 _PROTOTYP(int http_get, (char *,char **,char *,char *,char,char *,char *,
1368 _PROTOTYP(int http_head, (char *,char **,char *,char *,char,char *,char *,
1370 _PROTOTYP(int http_put, (char *,char **,char *,char *,char *,char,char *,
1371 char *, char *, int));
1372 _PROTOTYP(int http_delete, (char *,char **,char *,char *,char,char *));
1373 _PROTOTYP(int http_connect, (int, char *,char **,char *,char *,char,char *));
1374 _PROTOTYP(int http_post, (char *,char **,char *,char *,char *,char,char *,
1375 char *,char *, int));
1376 _PROTOTYP(int http_index, (char *,char **,char *,char *,char,char *,char *,
1378 _PROTOTYP(int http_inc, (int));
1379 _PROTOTYP(int http_isconnected, (void));
1381 extern char * tcp_http_proxy; /* Name[:port] of http proxy server */
1382 extern int tcp_http_proxy_errno; /* Return value from server */
1383 extern char * tcp_http_proxy_user; /* Name of user for authentication */
1384 extern char * tcp_http_proxy_pwd; /* Password of user */
1389 /* Type needed as 5th argument (length) to get/setsockopt() */
1392 /* They say it themselves - this does not conform to standards */
1393 #define socklen_t int
1396 #define socklen_t int
1402 #define SOCKOPT_T socklen_t
1403 #endif /* CK_64BIT */
1404 #endif /* SOCKOPT_T */
1407 #define SOCKOPT_T int
1410 #define SOCKOPT_T unsigned int
1414 #define SOCKOPT_T unsigned long
1418 #define SOCKOPT_T size_t
1422 #define SOCKOPT_T int
1426 #define SOCKOPT_T size_t
1427 #else /* UNIXWARE */
1432 #define SOCKOPT_T size_t
1433 #endif /* __DECC_VER */
1434 #endif /* DEC_TCPIP */
1436 #endif /* UNIXWARE */
1440 #endif /* MACOSX10 */
1441 #endif /* SOCKOPT_T */
1443 /* Ditto for getsockname() */
1447 #define GSOCKNAME_T socklen_t
1448 #endif /* CK_64BIT */
1449 #endif /* GSOCKNAME_T */
1452 #define GSOCKNAME_T int
1455 #define GSOCKNAME_T unsigned int
1459 #define GSOCKNAME_T size_t
1461 #ifdef AIX42 /* size_t in 4.2++, int in 4.1-- */
1463 #define GSOCKNAME_T size_t
1467 #define GSOCKNAME_T size_t
1473 #define GSOCKNAME_T size_t
1474 #endif /* __DECC_VER */
1475 #endif /* DEC_TCPIP */
1477 #endif /* UNIXWARE */
1480 #endif /* MACOSX10 */
1481 #endif /* GSOCKNAME_T */
1483 #endif /* TCPSOCKET */
1492 #endif /* MACOSX10 */
1494 #endif /* CKCNET_H */