1 /* ckcnet.h -- Symbol and macro definitions for C-Kermit network support */
2 
3 /*
4   Author: Frank da Cruz <fdc@columbia.edu>
5   Columbia University Academic Information Systems, New York City.
6 
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.
11 */
12 #ifndef CKCNET_H
13 #define CKCNET_H
14 
15 /* Network types */
16 
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 */
34 
35 #ifdef OS2                              /* In OS/2, only the 32-bit */
36 #ifndef __32BIT__                       /* version gets NETBIOS */
37 #ifdef CK_NETBIOS
38 #undef CK_NETBIOS
39 #endif /* CK_NETBIOS */
40 #endif /* __32BIT__ */
41 #endif /* OS2 */
42 
43 #ifdef _M_PPC
44 #ifdef SUPERLAT
45 #undef SUPERLAT
46 #endif /* SUPERLAT */
47 #endif /* _M_PPC */
48 
49 #ifdef NPIPE                            /* For items in common to */
50 #define NPIPEORBIOS                     /* Named Pipes and NETBIOS */
51 #endif /* NPIPE */
52 #ifdef CK_NETBIOS
53 #ifndef NPIPEORBIOS
54 #define NPIPEORBIOS
55 #endif /* NPIPEORBIOS */
56 #endif /* CK_NETBIOS */
57 
58 /* Network virtual terminal protocols (for SET HOST connections) */
59 /* FTP, HTTP and SSH have their own stacks                       */
60 
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 */
85 
86 /* others here... */
87 
88 #ifdef CK_SSL
89 #define IS_TELNET()      (nettype == NET_TCPB && (ttnproto == NP_TELNET \
90                          || ttnproto == NP_SSL_TELNET \
91                          || ttnproto == NP_TLS_TELNET \
92                          || ttnproto == NP_KERMIT))
93 #else /* CK_SSL */
94 #define IS_TELNET()      (nettype == NET_TCPB && (ttnproto == NP_TELNET \
95                          || ttnproto == NP_KERMIT))
96 #endif /* CK_SSL */
97 
98 #ifdef CK_KERBEROS
99 #ifdef KRB5
100 #ifdef KRB4
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 \
106                          ))
107 #else /* KRB4 */
108 #define IS_RLOGIN()      (nettype == NET_TCPB && (ttnproto == NP_RLOGIN \
109                          || ttnproto == NP_K5LOGIN \
110                          || ttnproto == NP_EK5LOGIN \
111                          ))
112 #endif /* KRB4 */
113 #else /* KRB5 */
114 #ifdef KRB4
115 #define IS_RLOGIN()      (nettype == NET_TCPB && (ttnproto == NP_RLOGIN \
116                          || ttnproto == NP_K4LOGIN \
117                          || ttnproto == NP_EK4LOGIN \
118                          ))
119 #else /* KRB4 */
120 KERBEROS defined without either KRB4 or KRB5
121 #endif /* KRB4 */
122 #endif /* KRB5 */
123 #else /* CK_KERBEROS */
124 #define IS_RLOGIN()      (nettype == NET_TCPB && (ttnproto == NP_RLOGIN))
125 #endif /* CK_KERBEROS */
126 
127 #define IS_SSH()         (nettype == NET_SSH)
128 
129 /* RLOGIN Modes */
130 #define    RL_RAW     0                 /*  Do Not Process XON/XOFF */
131 #define    RL_COOKED  1                 /*  Do Process XON/XOFF */
132 
133 /* Encryption types */
134 
135 #define CX_NONE    999
136 
137 #ifdef ENCTYPE_ANY
138 #define CX_AUTO ENCTYPE_ANY
139 #else
140 #define CX_AUTO 0
141 #endif /* ENCTYPE_ANY */
142 
143 #ifdef ENCTYPE_DES_CFB64
144 #define CX_DESC64 ENCTYPE_DES_CFB64
145 #else
146 #define CX_DESC64 1
147 #endif /* ENCTYPE_DES_CFB64 */
148 
149 #ifdef ENCTYPE_DES_OFB64
150 #define CX_DESO64 ENCTYPE_DES_OFB64
151 #else
152 #define CX_DESO64 2
153 #endif /* ENCTYPE_DES_OFB64 */
154 
155 #ifdef ENCTYPE_DES3_CFB64
156 #define CX_DES3C64 ENCTYPE_DES3_CFB64
157 #else
158 #define CX_DES3C64 3
159 #endif /* ENCTYPE_DES_CFB64 */
160 
161 #ifdef ENCTYPE_DES3_OFB64
162 #define CX_DESO64 ENCTYPE_DES3_OFB64
163 #else
164 #define CX_DES3O64 4
165 #endif /* ENCTYPE_DES_OFB64 */
166 
167 #ifdef ENCTYPE_CAST5_40_CFB64
168 #define CX_C540C64 ENCTYPE_CAST5_40_CFB64
169 #else
170 #define CX_C540C64 8
171 #endif /* ENCTYPE_CAST5_40_CFB64 */
172 
173 #ifdef ENCTYPE_CAST5_40_OFB64
174 #define CX_C540O64 ENCTYPE_CAST5_40_OFB64
175 #else
176 #define CX_C540O64 9
177 #endif /* ENCTYPE_CAST5_40_OFB64 */
178 
179 #ifdef ENCTYPE_CAST128_CFB64
180 #define CX_C128C64 ENCTYPE_CAST128_CFB64
181 #else
182 #define CX_C128C64 10
183 #endif /* ENCTYPE_CAST128_CFB64 */
184 
185 #ifdef ENCTYPE_CAST128_OFB64
186 #define CX_C128O64 ENCTYPE_CAST128_OFB64
187 #else
188 #define CX_C128O64 11
189 #endif /* ENCTYPE_CAST128_OFB64 */
190 
191 /* Basic network function prototypes, common to all. */
192 
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) );
203 #ifdef TCPSOCKET
204 _PROTOTYP( int gettcpport, (void) );
205 _PROTOTYP( int gettcpport, (void) );
206 #endif	/* TCPSOCKET */
207 
208 /*
209   SunLink X.25 support by Marcello Frutig, Catholic University,
210   Rio de Janeiro, Brazil, 1990.
211 
212   Maybe this can be adapted to VAX PSI and other X.25 products too.
213 */
214 #ifndef SUNOS4                          /* Only valid for SUNOS4 */
215 #ifndef SOLARIS
216 #ifdef SUNX25
217 #undef SUNX25
218 #endif /* SUNX25 */
219 #endif /* SOLARIS */
220 #endif /* SUNOS4 */
221 
222 #ifdef STRATUSX25
223 #define ANYX25
224 #define MAX_USER_DATA 128 /* SUN defines this in a header file, I believe. */
225 #endif /* STRATUSX25 */
226 
227 #ifdef SUNX25
228 #define ANYX25
229 #endif /* SUNX25 */
230 
231 #ifdef IBMX25                           /* AIX 4.1 X.25 */
232 #ifndef AIX41
233 #undef IBMX25
234 #else /* AIX41 */
235 #define ANYX25
236 #define MAX_USER_DATA NPI_MAX_DATA      /* used for buffer sizes */
237 #endif /* AIX41 */
238 #endif /* IBMX25 */
239 
240 #ifdef HPX25                            /* HP-UX 10.* X.25 */
241 #ifndef HPUX10
242 #undef HPX25
243 #else /* HPUX10 */
244 #define ANYX25
245 #endif /* HPUX10 */
246 #endif /* HPX25 */
247 
248 #ifdef ANYX25
249 #ifndef NETCONN                         /* ANYX25 implies NETCONN */
250 #define NETCONN
251 #endif /* NETCONN */
252 
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 */
257 
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
264 #define X29_ERROR                   5
265 
266 #define INVALID_PAD_PARM            1
267 
268 #define PAD_BREAK_CHARACTER         0
269 
270 #define PAD_ESCAPE                  1
271 #define PAD_ECHO                    2
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
288 
289 #define MAXIX25 MAX_USER_DATA*7
290 #define MAXOX25 MAX_USER_DATA
291 #endif /* ANYX25 */
292 
293 #ifdef SUNX25
294 #ifdef SOLARIS25                        /* and presumably SunLink 9.xx */
295 #include <fcntl.h>
296 #include <errno.h>
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>
305 #else
306 #include <sys/ioctl.h>                  /* X.25 includes, Sun only */
307 #include <sys/systm.h>
308 #ifndef SOLARIS
309 #include <sys/mbuf.h>
310 #endif /* SOLARIS */
311 #include <sys/socket.h>
312 #include <sys/protosw.h>
313 #ifdef SOLARIS
314 #include <sys/sockio.h>
315 #else
316 #include <sys/domain.h>
317 #endif /* SOLARIS */
318 #include <sys/socketvar.h>
319 #include <net/if.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 */
325 #endif /* SUNX25 */
326 
327 #ifdef ANYX25
328 
329 #ifdef IBMX25                           /* X.25 includes, AIX only */
330 #include <fcntl.h>
331 #include <sys/twtypes.h>
332 #include <sys/twlib.h>
333 
334 #include <sys/stream.h>
335 #include <stropts.h>
336 
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>
341 
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()    */
345 
346 
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;
364     N_ok_ack_t          ok_ack;
365     N_reset_con_t       reset_con;
366     N_reset_req_t       reset_req;
367     N_reset_ind_t       reset_ind;
368 } N_npi_ctl_t;
369 
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];
373 
374 /* fd or server waiting for connections, used by netclos and netopen */
375 extern int x25serverfd;
376 
377 #endif /* IBMX25 */
378 
379 #ifdef HPX25                            /* X.25 includes, HP-UX only */
380 #include <x25/ccittproto.h>
381 #include <x25/x25.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>
388 #endif /* HPX25 */
389 
390 /* C-Kermit X.3 / X.25 / X.29 / X.121 support functions */
391 
392 /* (riehm: this list of functions isn't quite right for AIX) */
393 
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) );
415 
416 #ifdef IBMX25
417                                         /* setup x25 */
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 */
423 #endif /* IBMX25 */
424 
425 #endif /* ANYX25 */
426 
427 /* CMU-OpenVMS/IP */
428 
429 #ifdef CMU_TCPIP                        /* CMU_TCPIP implies TCPSOCKET */
430 #ifndef TCPSOCKET
431 #define TCPSOCKET
432 #endif /* TCPSOCKET */
433 #ifndef TCPIPLIB
434 #define TCPIPLIB
435 #endif /* TCPIPLIB */
436 #endif /* CMU_TCPIP */
437 
438 /* DEC TCP/IP for (Open)VMS, previously known as UCX */
439 
440 #ifdef DEC_TCPIP                        /* DEC_TCPIP implies TCPSOCKET */
441 #ifndef TCPSOCKET
442 #define TCPSOCKET
443 #endif /* TCPSOCKET */
444 #ifndef TCPIPLIB
445 #define TCPIPLIB
446 #endif /* TCPIPLIB */
447 #endif /* DEC_TCPIP */
448 
449 /* SRI/TGV/Cisco/Process MultiNet, TCP/IP for VAX/VMS */
450 
451 #ifdef MULTINET                         /* MULTINET implies TCPSOCKET */
452 #ifndef TCPSOCKET
453 #define TCPSOCKET
454 #endif /* TCPSOCKET */
455 #ifndef TCPIPLIB
456 #define TCPIPLIB
457 #endif /* TCPIPLIB */
458 #ifndef TGVORWIN                        /* MULTINET and WINTCP */
459 #define TGVORWIN                        /* share a lot of code... */
460 #endif /* TGVORWIN */
461 #endif /* MULTINET */
462 
463 /* Wollongong TCP/IP for VAX/VMS */
464 
465 #ifdef WINTCP                           /* WINTCP implies TCPSOCKET */
466 #ifndef TCPSOCKET
467 #define TCPSOCKET
468 #endif /* TCPSOCKET */
469 #ifndef TCPIPLIB
470 #define TCPIPLIB
471 #endif /* TCPIPLIB */
472 #ifndef TGVORWIN                        /* WINTCP and MULTINET */
473 #define TGVORWIN                        /* share a lot of code... */
474 #endif /* TGVORWIN */
475 #endif /* WINTCP */
476 
477 /* Wollongong TCP/IP for AT&T Sys V */
478 
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 */
484 
485 #ifdef EXCELAN                          /* EXCELAN implies TCPSOCKET */
486 #ifndef TCPSOCKET
487 #define TCPSOCKET
488 #endif /* TCPSOCKET */
489 #endif /* EXCELAN */
490 
491 #ifdef INTERLAN                         /* INTERLAN implies TCPSOCKET */
492 #ifndef TCPSOCKET
493 #define TCPSOCKET
494 #endif /* TCPSOCKET */
495 #endif /* INTERLAN */
496 
497 #ifdef BEBOX
498 #ifndef TCPSOCKET
499 #define TCPSOCKET
500 #endif /* TCPSOCKET */
501 #ifndef TCPIPLIB
502 #define TCPIPLIB
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)
509 #ifndef FIONBIO
510 #define FIONBIO 2
511 #endif /* FIONBIO */
512 #ifndef FIONREAD
513 #define FIONREAD       1
514 #endif /* FIONREAD */
515 #ifndef SIOCATMARK
516 #define SIOCATMARK     3
517 #endif /* SIOCATMARK */
518 #endif /* BEBOX */
519 
520 #ifdef COMMENT /* no longer used but might come in handy again later... */
521 /*
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.
525 */
526 #ifndef CK_READ0
527 #ifdef TCPSOCKET
528 #ifdef SUNOS41                          /* It works in SunOS 4.1 */
529 #define CK_READ0
530 #else
531 #ifdef NEXT                             /* and NeXTSTEP */
532 #define CK_READ0
533 #endif /* NEXT */
534 #endif /* SUNOS41 */
535 #endif /* TCPSOCKET */
536 #endif /* CK_READ0 */
537 #endif /* COMMENT */
538 
539 /* Telnet protocol */
540 
541 #ifdef TCPSOCKET                        /* TCPSOCKET implies TNCODE */
542 #ifndef TNCODE                          /* Which means... */
543 #define TNCODE                          /* Compile in telnet code */
544 #endif /* TNCODE */
545 
546 /*
547    Platforms where we must call gethostname(buf,len) and then
548    gethostbyname(buf) to get local IP address, rather than calling
549    gethostbyname("").
550 */
551 #ifndef CKGHNLHOST
552 #ifdef datageneral
553 #define CKGHNLHOST
554 #else
555 #ifdef SOLARIS
556 #define CKGHNLHOST
557 #else
558 #ifdef SUNOS4
559 #define CKGHNLHOST
560 #else
561 #ifdef UNIXWARE
562 #define CKGHNLHOST
563 #else
564 #ifdef SINIX
565 #define CKGHNLHOST
566 #endif /* SINIX */
567 #endif /* UNIXWARE */
568 #endif /* SUNOS4 */
569 #endif /* SOLARIS */
570 #endif /* datageneral */
571 #endif /* CKGHNLHOST */
572 
573 #ifndef RLOGCODE                        /* What about Rlogin? */
574 #ifndef NORLOGIN
575 /*
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...
580 */
581 #ifdef SUNOS41
582 #define RLOGCODE
583 #else
584 #ifdef SOLARIS
585 #define RLOGCODE
586 #else
587 #ifdef HPUX9
588 #define RLOGCODE
589 #else
590 #ifdef HPUX10
591 #define RLOGCODE
592 #else
593 #ifdef OSF40
594 #define RLOGCODE
595 #else
596 #ifdef NEXT
597 #define RLOGCODE
598 #else
599 #ifdef AIX41
600 #define RLOGCODE
601 #else
602 #ifdef UNIXWARE
603 #define RLOGCODE
604 #else
605 #ifdef IRIX51
606 #define RLOGCODE
607 #else
608 #ifdef IRIX60
609 #define RLOGCODE
610 #else
611 #ifdef QNX
612 #define RLOGCODE
613 #else
614 #ifdef __linux__
615 #define RLOGCODE
616 #else
617 #ifdef BSD44
618 #define RLOGCODE
619 #endif /* BSD44 */
620 #endif /* __linux__ */
621 #endif /* QNX */
622 #endif /* IRIX60 */
623 #endif /* IRIX51 */
624 #endif /* UNIXWARE */
625 #endif /* AIX41 */
626 #endif /* NEXT */
627 #endif /* OSF40 */
628 #endif /* HPUX10 */
629 #endif /* HPUX9 */
630 #endif /* SOLARIS */
631 #endif /* SUNOS41 */
632 #endif /* NORLOGIN */
633 #ifdef VMS                              /* VMS */
634 #define RLOGCODE
635 #endif /* VMS */
636 #endif /* RLOGCODE */
637 #endif /* TCPSOCKET */
638 
639 #ifdef TNCODE
640 /*
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
648   are in ckcnet.c.
649 */
650 #ifndef TTLEBUF
651 #ifdef UNIX
652 #define TTLEBUF
653 #else
654 #ifdef datageneral
655 #define TTLEBUF
656 #endif /* datageneral */
657 #endif /* UNIX */
658 #endif /* TTLEBUF */
659 
660 #ifndef NETLEBUF
661 #ifdef VMS
662 #define NETLEBUF
663 #endif /* VMS */
664 #endif /* NETLEBUF */
665 #endif /* TNCODE */
666 
667 #ifdef SUNX25                           /* SUNX25 implies TCPSOCKET */
668 #ifndef TCPSOCKET                       /* But doesn't imply TNCODE */
669 #define TCPSOCKET
670 #endif /* TCPSOCKET */
671 #endif /* SUNX25 */
672 
673 #ifndef TCPSOCKET
674 #ifndef NO_DNS_SRV
675 #define NO_DNS_SRV
676 #endif /* NO_DNS_SRV */
677 #endif /* TCPSOCKET */
678 
679 /* This is another TCPSOCKET section... */
680 
681 #ifdef TCPSOCKET
682 #ifndef NETCONN                         /* TCPSOCKET implies NETCONN */
683 #define NETCONN
684 #endif /* NETCONN */
685 
686 #ifndef NO_DNS_SRV
687 #ifdef NOLOCAL
688 #define NO_DNS_SRV
689 #endif /* NOLOCAL */
690 #ifdef OS2ONLY
691 #define NO_DNS_SRV
692 #endif /* OS2ONLY */
693 #ifdef NT
694 #ifdef _M_PPC
695 #define NO_DNS_SRV
696 #endif /* _M_DNS */
697 #endif /* NO_DNS_SRV */
698 #ifdef VMS
699 #define NO_DNS_SRV
700 #endif /* VMS */
701 #ifdef STRATUS
702 #define NO_DNS_SRV
703 #endif /* STRATUS */
704 #ifdef datageneral
705 #define NO_DNS_SRV
706 #endif /* datageneral */
707 #ifdef ultrix
708 #define NO_DNS_SRV
709 #endif /* ultrix */
710 #ifdef NEXT
711 #define NO_DNS_SRV
712 #endif /* NEXT */
713 #endif /* NO_DNS_SRV */
714 
715 #ifndef CK_DNS_SRV                      /* Use DNS SRV records to determine */
716 #ifndef NO_DNS_SRV                      /* host and ports */
717 #define CK_DNS_SRV
718 #endif /* NO_DNS_SRV */
719 #endif /* CK_DNS_SRV */
720 
721 #ifndef NOLISTEN                        /* select() is required to support */
722 #ifndef SELECT                          /* incoming connections. */
723 #ifndef VMS
724 #ifndef OS2
725 #define NOLISTEN
726 #endif /* OS2 */
727 #endif /* VMS */
728 #endif /* SELECT */
729 #endif /* NOLISTEN */
730 
731 /* BSD sockets library header files */
732 
733 #ifdef VMS
734 /*
735   Because bzero() and bcopy() are not portable among VMS versions,
736   or compilers, or TCP/IP products, etc.
737 */
738 #ifndef bzero
739 #define bzero(s,n) memset(s,0,n)
740 #endif /* bzero */
741 #ifndef bcopy
742 #define bcopy(h,a,l) memcpy(a,h,l)
743 #endif /* bcopy */
744 #endif /* VMS */
745 
746 #ifdef HPUX6
747 /* These are missing in HP-UX 6.xx */
748 #ifndef bzero
749 #define bzero(s,n) memset(s,0,n)
750 #endif /* bzero */
751 #ifndef bcopy
752 #define bcopy(h,a,l) memcpy(a,h,l)
753 #endif /* bcopy */
754 #endif /* HPUX6 */
755 
756 #ifdef UNIX                             /* UNIX section */
757 
758 #ifdef SVR4
759 /*
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.)
765 */
766 #ifndef bzero
767 #define bzero(s,n) memset(s,0,n)
768 #endif
769 #ifdef SOLARIS
770 #ifdef SUNX25
771 #undef bzero
772 /*
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.
776 */
777 _PROTOTYP( void bzero, (char *, int) );
778 #endif /* SUNX25 */
779 #ifndef bcopy
780 #define bcopy(h,a,l) memcpy(a,h,l)
781 #endif
782 #else
783 #ifndef bcopy
784 #define bcopy(h,a,l) memmove(a,h,l)
785 #endif
786 #endif /* SOLARIS */
787 #else /* !SVR4 */
788 #ifdef PTX                              /* Sequent DYNIX PTX 1.3 */
789 #ifndef bzero
790 #define bzero(s,n) memset(s,0,n)
791 #endif
792 #ifndef bcopy
793 #define bcopy(h,a,l) memcpy(a,h,l)
794 #endif
795 #endif /* PTX */
796 #endif /* SVR4 */
797 
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 */
806 #ifdef BEBOX
807 #include <socket.h>
808 #else /* Not BEBOX */                   /* Normal BSD TCP/IP library */
809 #ifdef COMMENT
810 #ifndef HPUX
811 #include <arpa/telnet.h>
812 #endif /* HPUX */
813 #endif /* COMMENT */
814 #ifdef SCO234
815 #include <sys/errno.tcp.h>
816 #include <sys/types.tcp.h>
817 #endif /* SCO234 */
818 #include <sys/socket.h>
819 #ifdef WOLLONGONG
820 #include <sys/in.h>
821 #else
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 */
827 #endif /* BEBOX */
828 #endif /* INTERLAN */
829 
830 #ifndef EXCELAN
831 #include <netdb.h>
832 #ifndef INTERLAN
833 #ifdef WOLLONGONG
834 #define minor                           /* Do not include <sys/macros.h> */
835 #include <sys/inet.h>
836 #else
837 #ifndef OXOS
838 #ifndef HPUX
839 #ifndef BEBOX
840 #include <arpa/inet.h>
841 #endif /* BEBOX */
842 #endif /* HPUX */
843 #else /* OXOS */
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.
849  */
850 unsigned long inet_addr();
851 char    *inet_ntoa();
852 struct  in_addr inet_makeaddr();
853 unsigned long inet_network();
854 #endif /* OXOS */
855 #endif /* WOLLONGONG */
856 #endif /* INTERLAN */
857 #endif /* EXCELAN */
858 
859 #ifdef EXCELAN                          /* Excelan TCP/IP */
860 #ifndef bzero
861 #define bzero(s,n) memset(s,0,n)
862 #endif /* bzero */
863 #ifndef bcopy
864 #define bcopy(h,a,l) memcpy(a,h,l)
865 #endif /* bcopy */
866 #include <ex_errno.h>
867 #endif /* EXCELAN */
868 
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
874 #undef ENOTEMPTY
875 #include <net/errno.h>
876 #undef ENAMETOOLONG
877 #define ENAMETOOLONG ORG_NLONG
878 #undef ENOTEMPTY
879 #define ENOTEMPTY ORG_NEMPTY
880 #include <netinet/tcp.h>                /* for inet_addr() */
881 #endif /* I386IX */
882 /*
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.
889 */
890 #ifndef NOINADDRX
891 #ifdef DU2                              /* DEC Ultrix 2.0 */
892 #define INADDRX
893 #endif /* DU2 */
894 #endif /* NOINADDRX */
895 
896 #else /* Not UNIX */
897 
898 #ifdef VMS                              /* (Open)VMS section */
899 
900 #ifdef MULTINET                         /* TGV MultiNet */
901 /*
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.
908 */
909 #ifdef MULTINET_NO_PROTOTYPES
910 #undef MULTINET_NO_PROTOTYPES
911 #endif /* MULTINET_NO_PROTOTYPES */
912 
913 #ifdef  __cplusplus
914 #undef  __cplusplus
915 #endif /*  __cplusplus */
916 
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"
924 
925 #ifdef COMMENT
926 /*
927   No longer needed because now bzero/bcopy are macros defined as
928   memset/memmove in all VMS builds.
929 */
930 /*
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.
935 */
936 #ifndef __DECC_VER
937 #ifndef bzero
938 _PROTOTYP( void bzero, (char *, int) );
939 #endif /* bzero */
940 #ifndef bcopy
941 _PROTOTYP( void bcopy, (char *, char *, int) );
942 #endif /* bcopy */
943 #endif /* __DECC_VER */
944 #endif /* COMMENT */
945 
946 #ifdef __DECC
947 /*
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.
954 */
955 #ifdef COMMENT
956 /*
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?
959 */
960 #define close decc$close
961 #define alarm decc$alarm
962 #endif /* COMMENT */
963 #endif /* __DECC */
964 
965 #else /* Not MULTINET */
966 
967 #ifdef WINTCP                           /* WIN/TCP = PathWay for VMS */
968 #ifdef OLD_TWG
969 #include "twg$tcp:[netdist.include.sys]errno.h"
970 #include "twg$tcp:[netdist.include.sys]types2.h" /* avoid some duplicates */
971 #else
972 #include "twg$tcp:[netdist.include]socket_aliases.h"
973 #include <errno.h>
974 #include "twg$tcp:[netdist.include.sys]types.h"
975 #endif /* OLD_TWG */
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"
983 
984 #else /* Not WINTCP */
985 
986 #ifdef DEC_TCPIP
987 #ifdef UCX50
988 #ifndef IF_DOT_H
989 #define IF_DOT_H
990 #endif /*  IF_DOT_H */
991 #endif /* UCX50 */
992 
993 #ifdef IF_DOT_H
994 #include <if.h>                         /* Needed to put up u_int typedef */
995 #else
996 #ifdef NEEDUINT
997 typedef unsigned int u_int;
998 #endif /* NEEDUINT */
999 #endif /* IF_DOT_H */
1000 
1001 #include <in.h>
1002 #ifdef VMS
1003 #include <inet.h>			/* (SMS 2007/02/15) */
1004 #endif	/* VMS */
1005 #include <netdb.h>
1006 #include <socket.h>
1007 #include "ckvioc.h"
1008 #define socket_errno errno
1009 
1010 #ifdef COMMENT
1011 /*
1012   No longer needed because now bzero/bcopy are macros defined as
1013   memset/memmove in all VMS builds.
1014 */
1015 /*
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.
1019 */
1020 #ifdef __DECC_VER
1021 #ifdef VMSV70
1022 /*
1023   Note: you can't use "#if (__VMS_VER>=70000000)" because that is not
1024   portable and kills non-VMS builds.
1025 */
1026 #include <strings.h>
1027 #else
1028 #ifndef bzero
1029 #define bzero(s,n) memset(s,0,n)
1030 #endif
1031 #ifndef bcopy
1032 #define bcopy(h,a,l) memmove(a,h,l)
1033 #endif
1034 #endif /* VMSV70 */
1035 #else
1036 #ifndef bzero
1037 #define bzero(s,n) memset(s,0,n)
1038 #endif
1039 #ifndef bcopy
1040 #define bcopy(h,a,l) memmove(a,h,l)
1041 #endif
1042 #endif /* __DECC_VER */
1043 #endif /* COMMENT */
1044 
1045 #define socket_read     read
1046 #define socket_write    write
1047 #define socket_ioctl    ioctl
1048 #define socket_close    close
1049 
1050 #ifdef __DECC
1051 int ioctl (int d, int request, void *argp);
1052 #else
1053 int ioctl (int d, int request, char *argp);
1054 #endif /* DECC */
1055 /*
1056   UCX supports select(), but does not provide the needed symbol and
1057   structure definitions in any header file, so ...
1058 */
1059 #include <types.h>
1060 #ifndef NBBY
1061 /*-
1062  * Copyright (c) 1982, 1986, 1991, 1993
1063  *      The Regents of the University of California.  All rights reserved.
1064  *
1065  * Redistribution and use in source and binary forms, with or without
1066  * modification, are permitted provided that the following conditions
1067  * are met:
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.
1080  *
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
1091  * SUCH DAMAGE.
1092  *
1093  *      @(#)types.h     8.1 (Berkeley) 6/2/93
1094  */
1095 
1096 #define NBBY    8               /* number of bits in a byte */
1097 
1098 /*
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.
1103  */
1104 #ifndef FD_SETSIZE
1105 #define FD_SETSIZE      256
1106 #endif
1107 
1108 typedef long    fd_mask;
1109 #define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */
1110 
1111 #ifndef howmany
1112 #define howmany(x, y)   (((x)+((y)-1))/(y))
1113 #endif
1114 
1115 typedef struct fd_set {
1116         fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
1117 } fd_set;
1118 
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)))
1124 #endif /* !NBBY */
1125 
1126 #else  /* Not DEC_TCPIP */
1127 
1128 #ifdef CMU_TCPIP
1129 #include <types.h>
1130 #include <in.h>
1131 #include <netdb.h>
1132 #include <socket.h>
1133 #include <inet.h>
1134 #include <ioctl.h>
1135 #include "ckvioc.h"
1136 #define socket_errno errno
1137 
1138 /*
1139  * Routines supplied in LIBCMU.OLB
1140  */
1141 #define socket_ioctl    ioctl
1142 #define socket_read     cmu_read
1143 #define socket_write    cmu_write
1144 #define socket_close    cmu_close
1145 
1146 #endif /* CMU_TCPIP */
1147 #endif /* DEC_TCPIP */
1148 #endif /* WINTCP */
1149 #endif /* MULTINET */
1150 
1151 #else /* Not VMS */
1152 
1153 #ifdef OS2
1154 #include "ckonet.h"
1155 #ifndef NT
1156 #include <nerrno.h>
1157 #endif
1158 #endif /* OS2 */
1159 
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 */
1166 
1167 #ifdef OSK
1168 #ifndef OSKXXC
1169 #include <inet/in.h>
1170 #include <inet/netdb.h>
1171 #include <inet/socket.h>
1172 #else
1173 #include <INET/in.h>
1174 #include <INET/netdb.h>
1175 #include <INET/socket.h>
1176 #endif /* OSKXXC */
1177 #ifndef bzero
1178 #define bzero(s,n) memset(s,0,n)
1179 #endif
1180 #ifndef bcopy
1181 #define bcopy(h,a,l) memcpy(a,h,l)
1182 #endif
1183 typedef char * caddr_t; /* core address type */
1184 #endif /* OSK */
1185 
1186 #endif /* VMS */
1187 #endif /* UNIX */
1188 #endif /* TCPSOCKET */
1189 
1190 #ifndef NOINADDRX		      /* 301 - Needed for Solaris 10 and 11 */
1191 #ifdef SOLARIS
1192 #define NOINADDRX
1193 #ifdef INADDR_NONE
1194 #undef INADDR_NONE
1195 #endif	/* INADDR_NONE */
1196 #endif	/* SOLARIS */
1197 #endif	/* NOINADDRX */
1198 
1199 #ifdef NOINADDRX
1200 #ifdef INADDRX
1201 #undef INADDRX
1202 #endif	/* INADDRX */
1203 #endif	/* NOINADDRX */
1204 
1205 #ifdef TCPSOCKET
1206 #ifndef NOHADDRLIST
1207 #ifndef HADDRLIST
1208 #ifdef SUNOS41
1209 #define HADDRLIST
1210 #endif /* SUNOS41 */
1211 #ifdef SOLARIS
1212 #define HADDRLIST
1213 #endif /* SOLARIS */
1214 #ifdef LINUX
1215 #define HADDRLIST
1216 #endif /* LINUX */
1217 #ifdef AIXRS
1218 #define HADDRLIST
1219 #endif /* AIXRS */
1220 #ifdef HPUX
1221 #define HADDRLIST
1222 #endif /* HPUX */
1223 #ifdef IRIX
1224 #define HADDRLIST
1225 #endif /* IRIX */
1226 #ifdef I386IX
1227 #define HADDRLIST
1228 #endif /* I386IX */
1229 #endif /* HADDRLIST */
1230 /* A system that defines h_addr as h_addr_list[0] should be HADDRLIST */
1231 #ifndef HADDRLIST
1232 #ifdef h_addr
1233 #define HADDRLIST
1234 #endif /* h_addr */
1235 #endif /* HADDRLIST */
1236 #endif /* NOHADDRLIST */
1237 #endif /* TCPSOCKET */
1238 
1239 #ifdef TNCODE                           /* If we're compiling telnet code... */
1240 #ifndef IKS_OPTION
1241 #ifndef STRATUS
1242 #ifndef NOIKSD
1243 #define IKS_OPTION
1244 #endif /* NOIKSD */
1245 #endif /* STRATUS */
1246 #endif /* IKS_OPTION */
1247 #include "ckctel.h"
1248 #else
1249 extern int sstelnet;
1250 #ifdef IKSD
1251 #undef IKSD
1252 #endif /* IKSD */
1253 #ifndef NOIKSD
1254 #define NOIKSD
1255 #endif /* NOIKSD */
1256 #ifdef IKS_OPTION
1257 #undef IKS_OPTION
1258 #endif /* IKS_OPTION */
1259 #endif /* TNCODE */
1260 
1261 #ifndef NOTCPOPTS
1262 /*
1263   Automatically define NOTCPOPTS for configurations where they can't be
1264   used at runtime or cause too much trouble at compile time.
1265 */
1266 #ifdef CMU_TCPIP                        /* CMU/Tek */
1267 #define NOTCPOPTS
1268 #endif /* CMU_TCPIP */
1269 #ifdef MULTINET                         /* Multinet on Alpha */
1270 #ifdef __alpha
1271 #define NOTCPOPTS
1272 #endif /* __alpha */
1273 #endif /* MULTINET */
1274 #endif /* NOTCPOPTS */
1275 
1276 #ifdef NOTCPOPTS
1277 #ifdef TCP_NODELAY
1278 #undef TCP_NODELAY
1279 #endif /* TCP_NODELAY */
1280 #ifdef SO_LINGER
1281 #undef SO_LINGER
1282 #endif /* SO_LINGER */
1283 #ifdef SO_KEEPALIVE
1284 #undef SO_KEEPALIVE
1285 #endif /* SO_KEEPALIVE */
1286 #ifdef SO_SNDBUF
1287 #undef SO_SNDBUF
1288 #endif /* SO_SNDBUF */
1289 #ifdef SO_RCVBUF
1290 #undef SO_RCVBUF
1291 #endif /* SO_RCVBUF */
1292 #endif /* NOTCPOPTS */
1293 
1294 /* This function is declared even when TCPSOCKET is not available */
1295 _PROTOTYP( char * ckgetpeer, (VOID));
1296 
1297 #ifdef TCPSOCKET
1298 #ifdef SOL_SOCKET
1299 #ifdef TCP_NODELAY
1300 _PROTOTYP( int no_delay, (int, int) );
1301 #endif /* TCP_NODELAY */
1302 #ifdef SO_KEEPALIVE
1303 _PROTOTYP( int keepalive, (int, int) ) ;
1304 #endif /* SO_KEEPALIVE */
1305 #ifdef SO_LINGER
1306 _PROTOTYP( int ck_linger, (int, int, int) ) ;
1307 #endif /* SO_LINGER */
1308 #ifdef SO_SNDBUF
1309 _PROTOTYP( int sendbuf,(int, int) ) ;
1310 #endif /* SO_SNDBUF */
1311 #ifdef SO_RCVBUF
1312 _PROTOTYP( int recvbuf, (int, int) ) ;
1313 #endif /* SO_RCVBUF */
1314 #ifdef SO_DONTROUTE
1315 _PROTOTYP(int dontroute, (int, int));
1316 #endif /* SO_DONTROUTE */
1317 #endif /* SOL_SOCKET */
1318 _PROTOTYP( int getlocalipaddr, (VOID));
1319 _PROTOTYP( int getlocalipaddrs, (char *,int,int));
1320 _PROTOTYP( char * ckgetfqhostname,(char *));
1321 _PROTOTYP( struct hostent * ck_copyhostent,(struct hostent *));
1322 _PROTOTYP( char * ckname2addr, (char *));
1323 _PROTOTYP( char * ckaddr2name, (char *));
1324 
1325 /* AIX */
1326 
1327 #ifdef AIXRS
1328 #ifndef TCP_NODELAY
1329 #define TCP_NODELAY 0x1
1330 #endif /* TCP_NODELAY */
1331 #ifndef TCP_MAXSEG
1332 #define TCP_MAXSEG 0x2
1333 #endif /* TCP_MAXSEG */
1334 #ifndef TCP_KEEPALIVE
1335 #define TCP_KEEPALIVE 0x8
1336 #endif /* TCP_KEEPALIVE */
1337 #endif /* AIXRS */
1338 #endif /* TCPSOCKET */
1339 
1340 #ifdef RLOGCODE
1341 #ifndef CK_TTGWSIZ
1342 SORRY_RLOGIN_REQUIRES_TTGWSIZ_see_ckcplm.doc
1343 #endif /* CK_TTGWSIZ */
1344 #endif /* RLOGCODE */
1345 
1346 #ifdef CK_NAWS
1347 #ifndef CK_TTGWSIZ
1348 SORRY_CK_NAWS_REQUIRES_TTGWSIZ_see_ckcplm.doc
1349 #endif /* CK_TTGWSIZ */
1350 #endif /* CK_NAWS */
1351 
1352 #ifndef PF_INET
1353 #ifdef  AF_INET
1354 #define PF_INET AF_INET
1355 #endif /* AF_INET */
1356 #endif /* PF_INET */
1357 
1358 #ifndef IPPORT_ECHO
1359 #define IPPORT_ECHO 7
1360 #endif /* IPPORT_ECHO */
1361 
1362 #ifdef CK_KERBEROS
1363 #ifdef RLOGCODE
1364 _PROTOTYP(int ck_krb_rlogin,(CHAR *, int, CHAR *, CHAR *, CHAR *,
1365                               struct sockaddr_in *,
1366                               struct sockaddr_in *, int, int));
1367 #endif /* RLOGCODE */
1368 #endif /* CK_KERBEROS */
1369 
1370 _PROTOTYP( VOID ini_kerb, ( void ) );   /* Kerberos initialization routine */
1371 _PROTOTYP( int doauth, (int) );         /* AUTHENTICATE action routine */
1372 
1373 #ifdef CK_DNS_SRV
1374 _PROTOTYP(int locate_srv_dns,(char *host, char *service,
1375                               char *protocol, struct sockaddr **addr_pp,
1376                               int *naddrs));
1377 #endif /* CK_DNS_SRV */
1378 
1379 #ifndef NOHTTP
1380 _PROTOTYP(int http_open, (char *, char *, int, char *, int, char *));
1381 _PROTOTYP(int http_reopen, (VOID));
1382 _PROTOTYP(int http_close, (VOID));
1383 _PROTOTYP(int http_get, (char *,char **,char *,char *,char,char *,char *,
1384                          int));
1385 _PROTOTYP(int http_head, (char *,char **,char *,char *,char,char *,char *,
1386                           int));
1387 _PROTOTYP(int http_put, (char *,char **,char *,char *,char *,char,char *,
1388                          char *, char *, int));
1389 _PROTOTYP(int http_delete, (char *,char **,char *,char *,char,char *));
1390 _PROTOTYP(int http_connect, (int, char *,char **,char *,char *,char,char *));
1391 _PROTOTYP(int http_post, (char *,char **,char *,char *,char *,char,char *,
1392                   char *,char *, int));
1393 _PROTOTYP(int http_index, (char *,char **,char *,char *,char,char *,char *,
1394                            int));
1395 _PROTOTYP(int http_inc, (int));
1396 _PROTOTYP(int http_isconnected, (void));
1397 
1398 extern char * tcp_http_proxy;           /* Name[:port] of http proxy server */
1399 extern int    tcp_http_proxy_errno;     /* Return value from server */
1400 extern char * tcp_http_proxy_user;      /* Name of user for authentication */
1401 extern char * tcp_http_proxy_pwd;       /* Password of user */
1402 #endif /* NOHTTP */
1403 
1404 #ifdef TCPSOCKET
1405 
1406 /* Type needed as 5th argument (length) to get/setsockopt() */
1407 
1408 #ifdef TRU64
1409 /* They say it themselves - this does not conform to standards */
1410 #define socklen_t int
1411 #else
1412 #ifdef HPUX
1413 #define socklen_t int
1414 #endif	/* HPUX */
1415 #endif	/* TRU64 */
1416 
1417 #ifndef SOCKOPT_T
1418 #ifdef CK_64BIT
1419 #define SOCKOPT_T socklen_t
1420 #endif	/* CK_64BIT */
1421 #endif	/* SOCKOPT_T */
1422 
1423 #ifndef SOCKOPT_T
1424 #define SOCKOPT_T int
1425 #ifdef MACOSX10
1426 #undef SOCKOPT_T
1427 #define SOCKOPT_T unsigned int
1428 #else
1429 #ifdef AIX42
1430 #undef SOCKOPT_T
1431 #define SOCKOPT_T unsigned long
1432 #else
1433 #ifdef PTX
1434 #undef SOCKOPT_T
1435 #define SOCKOPT_T size_t
1436 #else
1437 #ifdef NT
1438 #undef SOCKOPT_T
1439 #define SOCKOPT_T int
1440 #else /* NT */
1441 #ifdef UNIXWARE
1442 #undef SOCKOPT_T
1443 #define SOCKOPT_T size_t
1444 #else /* UNIXWARE */
1445 #ifdef VMS
1446 #ifdef DEC_TCPIP
1447 #ifdef __DECC_VER
1448 #undef SOCKOPT_T
1449 #define SOCKOPT_T size_t
1450 #endif /* __DECC_VER */
1451 #endif /* DEC_TCPIP */
1452 #endif /* VMS */
1453 #endif /* UNIXWARE */
1454 #endif /* NT */
1455 #endif /* PTX */
1456 #endif /* AIX42 */
1457 #endif /* MACOSX10 */
1458 #endif /* SOCKOPT_T */
1459 
1460 /* Ditto for getsockname() */
1461 
1462 #ifndef GSOCKNAME_T
1463 #ifdef CK_64BIT
1464 #define GSOCKNAME_T socklen_t
1465 #endif	/* CK_64BIT */
1466 #endif	/* GSOCKNAME_T */
1467 
1468 #ifndef GSOCKNAME_T
1469 #define GSOCKNAME_T int
1470 #ifdef MACOSX10
1471 #undef GSOCKNAME_T
1472 #define GSOCKNAME_T unsigned int
1473 #else
1474 #ifdef PTX
1475 #undef GSOCKNAME_T
1476 #define GSOCKNAME_T size_t
1477 #else
1478 #ifdef AIX42                            /* size_t in 4.2++, int in 4.1-- */
1479 #undef GSOCKNAME_T
1480 #define GSOCKNAME_T size_t
1481 #else
1482 #ifdef UNIXWARE
1483 #undef GSOCKNAME_T
1484 #define GSOCKNAME_T size_t
1485 #else
1486 #ifdef VMS
1487 #ifdef DEC_TCPIP
1488 #ifdef __DECC_VER
1489 #undef GSOCKNAME_T
1490 #define GSOCKNAME_T size_t
1491 #endif /* __DECC_VER */
1492 #endif /* DEC_TCPIP */
1493 #endif /* VMS */
1494 #endif /* UNIXWARE */
1495 #endif /* AIX41 */
1496 #endif /* PTX */
1497 #endif /* MACOSX10 */
1498 #endif /* GSOCKNAME_T */
1499 
1500 #endif /* TCPSOCKET */
1501 
1502 #ifdef MACOSX10
1503 #ifdef bcopy
1504 #undef bcopy
1505 #endif
1506 #ifdef bzero
1507 #undef bzero
1508 #endif
1509 #endif /* MACOSX10 */
1510 
1511 #endif /* CKCNET_H */
1512