home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / cku200.tar / ckcnet.h < prev    next >
C/C++ Source or Header  |  2001-12-01  |  37KB  |  1,373 lines

  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, 2001,
  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. /* others here... */
  84.  
  85. /* RLOGIN Modes */
  86. #define    RL_RAW     0            /*  Do Not Process XON/XOFF */
  87. #define    RL_COOKED  1            /*  Do Process XON/XOFF */
  88.  
  89. /* Encryption types */
  90.  
  91. #define CX_NONE    999
  92.  
  93. #ifdef ENCTYPE_ANY
  94. #define CX_AUTO ENCTYPE_ANY
  95. #else
  96. #define CX_AUTO 0
  97. #endif /* ENCTYPE_ANY */
  98.  
  99. #ifdef ENCTYPE_DES_CFB64
  100. #define CX_DESC64 ENCTYPE_DES_CFB64
  101. #else
  102. #define CX_DESC64 1
  103. #endif /* ENCTYPE_DES_CFB64 */
  104.  
  105. #ifdef ENCTYPE_DES_OFB64
  106. #define CX_DESO64 ENCTYPE_DES_OFB64
  107. #else
  108. #define CX_DESO64 2
  109. #endif /* ENCTYPE_DES_OFB64 */
  110.  
  111. #ifdef ENCTYPE_DES3_CFB64
  112. #define CX_DES3C64 ENCTYPE_DES3_CFB64
  113. #else
  114. #define CX_DES3C64 3
  115. #endif /* ENCTYPE_DES_CFB64 */
  116.  
  117. #ifdef ENCTYPE_DES3_OFB64
  118. #define CX_DESO64 ENCTYPE_DES3_OFB64
  119. #else
  120. #define CX_DES3O64 4
  121. #endif /* ENCTYPE_DES_OFB64 */
  122.  
  123. #ifdef ENCTYPE_CAST5_40_CFB64
  124. #define CX_C540C64 ENCTYPE_CAST5_40_CFB64
  125. #else
  126. #define CX_C540C64 8
  127. #endif /* ENCTYPE_CAST5_40_CFB64 */
  128.  
  129. #ifdef ENCTYPE_CAST5_40_OFB64
  130. #define CX_C540O64 ENCTYPE_CAST5_40_OFB64
  131. #else
  132. #define CX_C540O64 9
  133. #endif /* ENCTYPE_CAST5_40_OFB64 */
  134.  
  135. #ifdef ENCTYPE_CAST128_CFB64
  136. #define CX_C128C64 ENCTYPE_CAST128_CFB64
  137. #else
  138. #define CX_C128C64 10
  139. #endif /* ENCTYPE_CAST128_CFB64 */
  140.  
  141. #ifdef ENCTYPE_CAST128_OFB64
  142. #define CX_C128O64 ENCTYPE_CAST128_OFB64
  143. #else
  144. #define CX_C128O64 11
  145. #endif /* ENCTYPE_CAST128_OFB64 */
  146.  
  147. /* Basic network function prototypes, common to all. */
  148.  
  149. _PROTOTYP( int netopen, (char *, int *, int) );
  150. _PROTOTYP( int netclos, (void) );
  151. _PROTOTYP( int netflui, (void) );
  152. _PROTOTYP( int nettchk, (void) );
  153. _PROTOTYP( int netbreak, (void) );
  154. _PROTOTYP( int netinc, (int) );
  155. _PROTOTYP( int netxin, (int, CHAR *) );
  156. _PROTOTYP( int nettol, (CHAR *, int) );
  157. _PROTOTYP( int nettoc, (CHAR) );
  158. /*
  159.   SunLink X.25 support by Marcello Frutig, Catholic University,
  160.   Rio de Janeiro, Brazil, 1990.
  161.  
  162.   Maybe this can be adapted to VAX PSI and other X.25 products too.
  163. */
  164. #ifndef SUNOS4                /* Only valid for SUNOS4 */
  165. #ifndef SOLARIS
  166. #ifdef SUNX25
  167. #undef SUNX25
  168. #endif /* SUNX25 */
  169. #endif /* SOLARIS */
  170. #endif /* SUNOS4 */
  171.  
  172. #ifdef STRATUSX25
  173. #define ANYX25
  174. #define MAX_USER_DATA 128 /* SUN defines this in a header file, I believe. */
  175. #endif /* STRATUSX25 */
  176.  
  177. #ifdef SUNX25
  178. #define ANYX25
  179. #endif /* SUNX25 */
  180.  
  181. #ifdef IBMX25                /* AIX 4.1 X.25 */
  182. #ifndef AIX41
  183. #undef IBMX25
  184. #else /* AIX41 */
  185. #define ANYX25
  186. #define MAX_USER_DATA NPI_MAX_DATA    /* used for buffer sizes */
  187. #endif /* AIX41 */
  188. #endif /* IBMX25 */
  189.  
  190. #ifdef HPX25                /* HP-UX 10.* X.25 */
  191. #ifndef HPUX10
  192. #undef HPX25
  193. #else /* HPUX10 */
  194. #define ANYX25
  195. #endif /* HPUX10 */
  196. #endif /* HPX25 */
  197.  
  198. #ifdef ANYX25
  199. #ifndef NETCONN                /* ANYX25 implies NETCONN */
  200. #define NETCONN
  201. #endif /* NETCONN */
  202.  
  203. #define MAXPADPARMS                22    /* Number of PAD parameters */
  204. #define MAXCUDATA           12    /* Max length of X.25 call user data */
  205. #define X29PID                1   /* X.29 protocol ID */
  206. #define X29PIDLEN            4   /* X.29 protocol ID length */
  207.  
  208. #define X29_SET_PARMS               2
  209. #define X29_READ_PARMS              4
  210. #define X29_SET_AND_READ_PARMS      6
  211. #define X29_INVITATION_TO_CLEAR     1
  212. #define X29_PARAMETER_INDICATION    0
  213. #define X29_INDICATION_OF_BREAK     3
  214. #define X29_ERROR                   5
  215.  
  216. #define INVALID_PAD_PARM            1
  217.  
  218. #define PAD_BREAK_CHARACTER         0
  219.  
  220. #define PAD_ESCAPE                  1
  221. #define PAD_ECHO                    2
  222. #define PAD_DATA_FORWARD_CHAR       3
  223. #define PAD_DATA_FORWARD_TIMEOUT    4
  224. #define PAD_FLOW_CONTROL_BY_PAD     5
  225. #define PAD_SUPPRESSION_OF_SIGNALS  6
  226. #define PAD_BREAK_ACTION            7
  227. #define PAD_SUPPRESSION_OF_DATA     8
  228. #define PAD_PADDING_AFTER_CR        9
  229. #define PAD_LINE_FOLDING           10
  230. #define PAD_LINE_SPEED             11
  231. #define PAD_FLOW_CONTROL_BY_USER   12
  232. #define PAD_LF_AFTER_CR            13
  233. #define PAD_PADDING_AFTER_LF       14
  234. #define PAD_EDITING                15
  235. #define PAD_CHAR_DELETE_CHAR       16
  236. #define PAD_BUFFER_DELETE_CHAR     17
  237. #define PAD_BUFFER_DISPLAY_CHAR    18
  238.  
  239. #define MAXIX25 MAX_USER_DATA*7
  240. #define MAXOX25 MAX_USER_DATA
  241. #endif /* ANYX25 */
  242.  
  243. #ifdef SUNX25
  244. #ifdef SOLARIS25            /* and presumably SunLink 9.xx */
  245. #include <fcntl.h>
  246. #include <errno.h>
  247. #include <sys/ioccom.h>
  248. #include <sys/types.h>
  249. #include <sys/socket.h>
  250. #include <sys/sockio.h>
  251. #include <sundev/syncstat.h>
  252. #include <netx25/x25_pk.h>
  253. #include <netx25/x25_ctl.h>
  254. #include <netx25/x25_ioctl.h>
  255. #else
  256. #include <sys/ioctl.h>            /* X.25 includes, Sun only */
  257. #include <sys/systm.h>
  258. #ifndef SOLARIS
  259. #include <sys/mbuf.h>
  260. #endif /* SOLARIS */
  261. #include <sys/socket.h>
  262. #include <sys/protosw.h>
  263. #ifdef SOLARIS
  264. #include <sys/sockio.h>
  265. #else
  266. #include <sys/domain.h>
  267. #endif /* SOLARIS */
  268. #include <sys/socketvar.h>
  269. #include <net/if.h>
  270. #include <sundev/syncstat.h>
  271. #include <netx25/x25_pk.h>
  272. #include <netx25/x25_ctl.h>
  273. #include <netx25/x25_ioctl.h>
  274. #endif /* SOLARIS25 */
  275. #endif /* SUNX25 */
  276.  
  277. #ifdef ANYX25
  278.  
  279. #ifdef IBMX25                /* X.25 includes, AIX only */
  280. #include <fcntl.h>
  281. #include <sys/twtypes.h>
  282. #include <sys/twlib.h>
  283.  
  284. #include <sys/stream.h>
  285. #include <stropts.h>
  286.  
  287. #define NPI_20                /* required to include the whole NPI */
  288. #include <sys/npi_20.h>
  289. #include <sys/npiapi.h>
  290. #include <sys/pktintf.h>
  291.  
  292. #include <odmi.h>            /* required for access to the ODM   */
  293. #include <sys/cfgodm.h>            /* database, needed to find out the */
  294.                     /* local NUA. see x25local_nua()    */
  295.  
  296.  
  297. /* IBM X25 NPI generic primitive type */
  298. typedef union N_npi_ctl_t {
  299.     ulong        PRIM_type;        /* generic primitive type */
  300.     char        buffer[NPI_MAX_CTL];    /* maximum primitive size */
  301.     N_bind_ack_t        bind_ack;
  302.     N_bind_req_t        bind_req;
  303.     N_conn_con_t        conn_con;
  304.     N_conn_ind_t        conn_ind;
  305.     N_conn_req_t        conn_req;
  306.     N_conn_res_t        conn_res;
  307.     N_data_req_t        data_req;
  308.     N_data_ind_t        data_ind;
  309.     N_discon_ind_t      discon_ind;
  310.     N_discon_req_t      discon_req;
  311.     N_error_ack_t       error_ack;
  312.     N_exdata_ind_t      exdata_ind;
  313.     N_info_ack_t        info_ack;
  314.     N_ok_ack_t          ok_ack;
  315.     N_reset_con_t       reset_con;
  316.     N_reset_req_t       reset_req;
  317.     N_reset_ind_t       reset_ind;
  318. } N_npi_ctl_t;
  319.  
  320. /* some extra definitions to help out */
  321. typedef char    x25addr_t[45];        /* max 40 defined by CCITT */
  322. typedef char    N_npi_data_t[NPI_MAX_DATA];
  323.  
  324. /* fd or server waiting for connections, used by netclos and netopen */
  325. extern int x25serverfd;
  326.  
  327. #endif /* IBMX25 */
  328.  
  329. #ifdef HPX25                /* X.25 includes, HP-UX only */
  330. #include <x25/ccittproto.h>
  331. #include <x25/x25.h>
  332. #include <x25/x25addrstr.h>
  333. #include <x25/x25codes.h>
  334. #include <x25/x25hd_ioctl.h>
  335. #include <x25/x25ioctls.h>
  336. #include <x25/x25str.h>
  337. #include <sys/ioctl.h>
  338. #endif /* HPX25 */
  339.  
  340. /* C-Kermit X.3 / X.25 / X.29 / X.121 support functions */
  341.  
  342. /* (riehm: this list of functions isn't quite right for AIX) */
  343.  
  344. _PROTOTYP( int shopad, (int) );
  345. _PROTOTYP( int shox25, (int) );
  346. _PROTOTYP( VOID initpad, (void) );
  347. _PROTOTYP( VOID setpad, (CHAR *, int) );
  348. _PROTOTYP( VOID readpad, (CHAR *, int, CHAR *) );
  349. _PROTOTYP( int qbitpkt, (CHAR *, int) );
  350. _PROTOTYP( VOID setqbit, (void) );
  351. _PROTOTYP( VOID resetqbit, (void) );
  352. _PROTOTYP( VOID breakact, (void) );
  353. _PROTOTYP( int pkx121, (char *, CHAR *) );
  354. _PROTOTYP( SIGTYP x25oobh, (int) );
  355. _PROTOTYP( int x25diag, (void) );
  356. _PROTOTYP( int x25intr, (char) );
  357. _PROTOTYP( int x25reset, (char, char) );
  358. _PROTOTYP( int x25clear, (void) );
  359. _PROTOTYP( int x25stat, (void) );
  360. _PROTOTYP( int x25in, (int, CHAR *) );
  361. _PROTOTYP( int setpadp, (void) );
  362. _PROTOTYP( int setx25, (void) );
  363. _PROTOTYP( int x25xin, (int, CHAR *) );
  364. _PROTOTYP( int x25inl, (CHAR *, int, int, CHAR) );
  365.  
  366. #ifdef IBMX25
  367.                     /* setup x25 */
  368. _PROTOTYP( ulong x25bind, (int, char *, char *, int, int, int, ulong) );
  369. _PROTOTYP( int x25call, (int, char *, char *) ); /* connect to remote */
  370. _PROTOTYP( int x25unbind, (int) );    /* disconnect */
  371. _PROTOTYP( char *x25prim, (int) );    /* display primitives */
  372. _PROTOTYP( int x25local_nua, (char *) ); /* find local NUA */
  373. #endif /* IBMX25 */
  374.  
  375. #endif /* ANYX25 */
  376.  
  377. /* CMU-OpenVMS/IP */
  378.  
  379. #ifdef CMU_TCPIP            /* CMU_TCPIP implies TCPSOCKET */
  380. #ifndef TCPSOCKET
  381. #define TCPSOCKET
  382. #endif /* TCPSOCKET */
  383. #ifndef TCPIPLIB
  384. #define TCPIPLIB
  385. #endif /* TCPIPLIB */
  386. #endif /* CMU_TCPIP */
  387.  
  388. /* DEC TCP/IP for (Open)VMS, previously known as UCX */
  389.  
  390. #ifdef DEC_TCPIP            /* DEC_TCPIP implies TCPSOCKET */
  391. #ifndef TCPSOCKET
  392. #define TCPSOCKET
  393. #endif /* TCPSOCKET */
  394. #ifndef TCPIPLIB
  395. #define TCPIPLIB
  396. #endif /* TCPIPLIB */
  397. #endif /* DEC_TCPIP */
  398.  
  399. /* SRI/TGV/Cisco/Process MultiNet, TCP/IP for VAX/VMS */
  400.  
  401. #ifdef MULTINET                /* MULTINET implies TCPSOCKET */
  402. #ifndef TCPSOCKET
  403. #define TCPSOCKET
  404. #endif /* TCPSOCKET */
  405. #ifndef TCPIPLIB
  406. #define TCPIPLIB
  407. #endif /* TCPIPLIB */
  408. #ifndef TGVORWIN            /* MULTINET and WINTCP */
  409. #define TGVORWIN            /* share a lot of code... */
  410. #endif /* TGVORWIN */
  411. #endif /* MULTINET */
  412.  
  413. /* Wollongong TCP/IP for VAX/VMS */
  414.  
  415. #ifdef WINTCP                /* WINTCP implies TCPSOCKET */
  416. #ifndef TCPSOCKET
  417. #define TCPSOCKET
  418. #endif /* TCPSOCKET */
  419. #ifndef TCPIPLIB
  420. #define TCPIPLIB
  421. #endif /* TCPIPLIB */
  422. #ifndef TGVORWIN            /* WINTCP and MULTINET */
  423. #define TGVORWIN            /* share a lot of code... */
  424. #endif /* TGVORWIN */
  425. #endif /* WINTCP */
  426.  
  427. /* Wollongong TCP/IP for AT&T Sys V */
  428.  
  429. #ifdef WOLLONGONG            /* WOLLONGONG implies TCPSOCKET */
  430. #ifndef TCPSOCKET            /* Don't confuse WOLLONGONG */
  431. #define TCPSOCKET            /* (which is for UNIX) with */
  432. #endif /* TCPSOCKET */            /* WINTCP, which is for VMS! */
  433. #endif /* WOLLONGONG */
  434.  
  435. #ifdef EXCELAN                /* EXCELAN implies TCPSOCKET */
  436. #ifndef TCPSOCKET
  437. #define TCPSOCKET
  438. #endif /* TCPSOCKET */
  439. #endif /* EXCELAN */
  440.  
  441. #ifdef INTERLAN                /* INTERLAN implies TCPSOCKET */
  442. #ifndef TCPSOCKET
  443. #define TCPSOCKET
  444. #endif /* TCPSOCKET */
  445. #endif /* INTERLAN */
  446.  
  447. #ifdef BEBOX
  448. #ifndef TCPSOCKET
  449. #define TCPSOCKET
  450. #endif /* TCPSOCKET */
  451. #ifndef TCPIPLIB
  452. #define TCPIPLIB
  453. #endif /* TCPIPLIB */
  454. #define socket_errno    h_errno
  455. #define socket_read(x,y,z)     recv(x,y,sizeof(char),z)
  456. #define socket_write(x,y,z)     send(x,y,sizeof(char),z)
  457. #define socket_ioctl    ioctl
  458. #define socket_close(x)         closesocket(x)
  459. #ifndef FIONBIO
  460. #define FIONBIO 2
  461. #endif /* FIONBIO */
  462. #ifndef FIONREAD
  463. #define FIONREAD       1
  464. #endif /* FIONREAD */
  465. #ifndef SIOCATMARK
  466. #define SIOCATMARK     3
  467. #endif /* SIOCATMARK */
  468. #endif /* BEBOX */
  469.  
  470. #ifdef COMMENT /* no longer used but might come in handy again later... */
  471. /*
  472.   CK_READ0 can (and should) be defined if and only if:
  473.   (a) read(fd,&x,0) can be used harmlessly on a TCP/IP socket connection.
  474.   (b) read(fd,&x,0) returns 0 if the connection is up, -1 if it is down.
  475. */
  476. #ifndef CK_READ0
  477. #ifdef TCPSOCKET
  478. #ifdef SUNOS41                /* It works in SunOS 4.1 */
  479. #define CK_READ0
  480. #else
  481. #ifdef NEXT                /* and NeXTSTEP */
  482. #define CK_READ0
  483. #endif /* NEXT */
  484. #endif /* SUNOS41 */
  485. #endif /* TCPSOCKET */
  486. #endif /* CK_READ0 */
  487. #endif /* COMMENT */
  488.  
  489. /* Telnet protocol */
  490.  
  491. #ifdef TCPSOCKET            /* TCPSOCKET implies TNCODE */
  492. #ifndef TNCODE                /* Which means... */
  493. #define TNCODE                /* Compile in telnet code */
  494. #endif /* TNCODE */
  495.  
  496. /*
  497.    Platforms where we must call gethostname(buf,len) and then
  498.    gethostbyname(buf) to get local IP address, rather than calling
  499.    gethostbyname("").
  500. */
  501. #ifndef CKGHNLHOST
  502. #ifdef datageneral
  503. #define CKGHNLHOST
  504. #else
  505. #ifdef SOLARIS
  506. #define CKGHNLHOST
  507. #else
  508. #ifdef SUNOS4
  509. #define CKGHNLHOST
  510. #else
  511. #ifdef UNIXWARE
  512. #define CKGHNLHOST
  513. #else
  514. #ifdef SINIX
  515. #define CKGHNLHOST
  516. #endif /* SINIX */
  517. #endif /* UNIXWARE */
  518. #endif /* SUNOS4 */
  519. #endif /* SOLARIS */
  520. #endif /* datageneral */
  521. #endif /* CKGHNLHOST */
  522.  
  523. #ifndef RLOGCODE            /* What about Rlogin? */
  524. #ifndef NORLOGIN
  525. /*
  526.   Rlogin can be enabled only for UNIX versions that have both SIGURG
  527.   (SCO doesn't) and CK_TTGWSIZ (OSF/1 doesn't), so we don't assume that
  528.   any others have these without verifying first.  Not that it really makes
  529.   much difference since you can only use Rlogin if you are root...
  530. */
  531. #ifdef SUNOS41
  532. #define RLOGCODE
  533. #else
  534. #ifdef SOLARIS
  535. #define RLOGCODE
  536. #else
  537. #ifdef HPUX9
  538. #define RLOGCODE
  539. #else
  540. #ifdef HPUX10
  541. #define RLOGCODE
  542. #else
  543. #ifdef OSF40
  544. #define RLOGCODE
  545. #else
  546. #ifdef NEXT
  547. #define RLOGCODE
  548. #else
  549. #ifdef AIX41
  550. #define RLOGCODE
  551. #else
  552. #ifdef UNIXWARE
  553. #define RLOGCODE
  554. #else
  555. #ifdef IRIX51
  556. #define RLOGCODE
  557. #else
  558. #ifdef IRIX60
  559. #define RLOGCODE
  560. #else
  561. #ifdef QNX
  562. #define RLOGCODE
  563. #else
  564. #ifdef __linux__
  565. #define RLOGCODE
  566. #else
  567. #ifdef BSD44
  568. #define RLOGCODE
  569. #endif /* BSD44 */
  570. #endif /* __linux__ */
  571. #endif /* QNX */
  572. #endif /* IRIX60 */
  573. #endif /* IRIX51 */
  574. #endif /* UNIXWARE */
  575. #endif /* AIX41 */
  576. #endif /* NEXT */
  577. #endif /* OSF40 */
  578. #endif /* HPUX10 */
  579. #endif /* HPUX9 */
  580. #endif /* SOLARIS */
  581. #endif /* SUNOS41 */
  582. #endif /* NORLOGIN */
  583. #ifdef VMS                /* VMS */
  584. #define RLOGCODE
  585. #endif /* VMS */
  586. #endif /* RLOGCODE */
  587. #endif /* TCPSOCKET */
  588.  
  589. #ifdef TNCODE
  590. /*
  591.   Telnet local-echo buffer, used for saving up user data that can't be
  592.   properly displayed and/or evaluated until pending Telnet negotiations are
  593.   complete.  TTLEBUF is defined for platforms (like UNIX) where net i/o is
  594.   done by the same routines that do serial i/o (in which case the relevant
  595.   code goes into the ck?tio.c module, in the ttinc(), ttchk(), etc, routines);
  596.   NETLETBUF is defined for platforms (like VMS) that use different APIs for
  597.   network and serial i/o, and enables the copies of the same routines that
  598.   are in ckcnet.c.
  599. */
  600. #ifndef TTLEBUF
  601. #ifdef UNIX
  602. #define TTLEBUF
  603. #else
  604. #ifdef datageneral
  605. #define TTLEBUF
  606. #endif /* datageneral */
  607. #endif /* UNIX */
  608. #endif /* TTLEBUF */
  609.  
  610. #ifndef NETLEBUF
  611. #ifdef VMS
  612. #define NETLEBUF
  613. #endif /* VMS */
  614. #endif /* NETLEBUF */
  615. #endif /* TNCODE */
  616.  
  617. #ifdef SUNX25                /* SUNX25 implies TCPSOCKET */
  618. #ifndef TCPSOCKET            /* But doesn't imply TNCODE */
  619. #define TCPSOCKET
  620. #endif /* TCPSOCKET */
  621. #endif /* SUNX25 */
  622.  
  623. #ifndef TCPSOCKET
  624. #ifndef NO_DNS_SRV
  625. #define NO_DNS_SRV
  626. #endif /* NO_DNS_SRV */
  627. #endif /* TCPSOCKET */
  628.  
  629. /* This is another TCPSOCKET section... */
  630.  
  631. #ifdef TCPSOCKET
  632. #ifndef NETCONN                /* TCPSOCKET implies NETCONN */
  633. #define NETCONN
  634. #endif /* NETCONN */
  635.  
  636. #ifndef NO_DNS_SRV
  637. #ifdef NOLOCAL
  638. #define NO_DNS_SRV
  639. #endif /* NOLOCAL */
  640. #ifdef OS2ONLY
  641. #define NO_DNS_SRV
  642. #endif /* OS2ONLY */
  643. #ifdef NT
  644. #ifdef _M_PPC
  645. #define NO_DNS_SRV
  646. #endif /* _M_DNS */
  647. #endif /* NO_DNS_SRV */
  648. #ifdef VMS
  649. #define NO_DNS_SRV
  650. #endif /* VMS */
  651. #ifdef STRATUS
  652. #define NO_DNS_SRV
  653. #endif /* STRATUS */
  654. #ifdef datageneral
  655. #define NO_DNS_SRV
  656. #endif /* datageneral */
  657. #ifdef ultrix
  658. #define NO_DNS_SRV
  659. #endif /* ultrix */
  660. #ifdef NEXT
  661. #define NO_DNS_SRV
  662. #endif /* NEXT */
  663. #endif /* NO_DNS_SRV */
  664.  
  665. #ifndef CK_DNS_SRV                      /* Use DNS SRV records to determine */
  666. #ifndef NO_DNS_SRV                      /* host and ports */
  667. #define CK_DNS_SRV
  668. #endif /* NO_DNS_SRV */
  669. #endif /* CK_DNS_SRV */
  670.  
  671. #ifndef NOLISTEN            /* select() is required to support */
  672. #ifndef SELECT                /* incoming connections. */
  673. #ifndef VMS
  674. #ifndef OS2
  675. #define NOLISTEN
  676. #endif /* OS2 */
  677. #endif /* VMS */
  678. #endif /* SELECT */
  679. #endif /* NOLISTEN */
  680.  
  681. /* BSD sockets library header files */
  682.  
  683. #ifdef VMS
  684. /*
  685.   Because bzero() and bcopy() are not portable among VMS versions,
  686.   or compilers, or TCP/IP products, etc.
  687. */
  688. #ifndef bzero
  689. #define bzero(s,n) memset(s,0,n)
  690. #endif /* bzero */
  691. #ifndef bcopy
  692. #define bcopy(h,a,l) memcpy(a,h,l)
  693. #endif /* bcopy */
  694. #endif /* VMS */
  695.  
  696. #ifdef UNIX                /* UNIX section */
  697.  
  698. #ifdef SVR4
  699. /*
  700.   These suggested by Rob Healey, rhealey@kas.helios.mn.org, to avoid
  701.   bugs in Berkeley compatibility library on Sys V R4 systems, but untested
  702.   by me (fdc).  Remove this bit if it gives you trouble.
  703.   (Later corrected by Marc Boucher <mboucher@iro.umontreal.ca> because
  704.   bzero/bcopy are not argument-compatible with memset/memcpy|memmove.)
  705. */
  706. #define bzero(s,n) memset(s,0,n)
  707. #ifdef SOLARIS
  708. #ifdef SUNX25
  709. #undef bzero
  710. /*
  711.   WOULD YOU BELIEVE... That the Solaris X.25 /opt/SUNWcomm/lib/libsockx25
  712.   library references bzero, even though the use of bzero is forbidden in
  713.   Solaris?  Look for the function definition in ckcnet.c.
  714. */
  715. _PROTOTYP( void bzero, (char *, int) );
  716. #endif /* SUNX25 */
  717. #define bcopy(h,a,l) memcpy(a,h,l)
  718. #else
  719. #define bcopy(h,a,l) memmove(a,h,l)
  720. #endif /* SOLARIS */
  721. #else /* !SVR4 */
  722. #ifdef PTX                /* Sequent DYNIX PTX 1.3 */
  723. #define bzero(s,n) memset(s,0,n)
  724. #define bcopy(h,a,l) memcpy(a,h,l)
  725. #endif /* PTX */
  726. #endif /* SVR4 */
  727.  
  728. #ifdef INTERLAN                /* Racal-Interlan TCP/IP */
  729. #include <interlan/socket.h>
  730. #include <interlan/il_types.h>
  731. #include <interlan/telnet.h>
  732. #include <interlan/il_errno.h>
  733. #include <interlan/in.h>
  734. #include <interlan/telnet.h>        /* Why twice ? ? ? */
  735. #else /* Not Interlan */
  736. #ifdef BEBOX
  737. #include <socket.h>
  738. #else /* Not BEBOX */            /* Normal BSD TCP/IP library */
  739. #ifdef COMMENT
  740. #ifndef HPUX
  741. #include <arpa/telnet.h>
  742. #endif /* HPUX */
  743. #endif /* COMMENT */
  744. #ifdef SCO234
  745. #include <sys/errno.tcp.h>
  746. #include <sys/types.tcp.h>
  747. #endif /* SCO234 */
  748. #include <sys/socket.h>
  749. #ifdef WOLLONGONG
  750. #include <sys/in.h>
  751. #else
  752. #include <netinet/in.h>
  753. #ifndef SV68R3V6        /* (maybe this should be SVR3 in general) */
  754. #include <netinet/tcp.h>    /* Added June 2001 */
  755. #endif /* SV68R3V6 */
  756. #endif /* WOLLONGONG */
  757. #endif /* BEBOX */
  758. #endif /* INTERLAN */
  759.  
  760. #ifndef EXCELAN
  761. #include <netdb.h>
  762. #ifndef INTERLAN
  763. #ifdef WOLLONGONG
  764. #define minor                /* Do not include <sys/macros.h> */
  765. #include <sys/inet.h>
  766. #else
  767. #ifndef OXOS
  768. #ifndef HPUX
  769. #ifndef BEBOX
  770. #include <arpa/inet.h>
  771. #endif /* BEBOX */
  772. #endif /* HPUX */
  773. #else /* OXOS */
  774. /* In too many releases of X/OS, <arpa/inet.h> declares inet_addr() as
  775.  * ``struct in_addr''.  This is definitively wrong, and could cause
  776.  * core dumps.  Instead of including that bad file, inet_addr() is
  777.  * correctly declared here.  Of course, all the declarations done there
  778.  * has been copied here.
  779.  */
  780. unsigned long inet_addr();
  781. char    *inet_ntoa();
  782. struct    in_addr inet_makeaddr();
  783. unsigned long inet_network();
  784. #endif /* OXOS */
  785. #endif /* WOLLONGONG */
  786. #endif /* INTERLAN */
  787. #endif /* EXCELAN */
  788.  
  789. #ifdef EXCELAN                /* Excelan TCP/IP */
  790. #ifndef bzero
  791. #define bzero(s,n) memset(s,0,n)
  792. #endif /* bzero */
  793. #ifndef bcopy
  794. #define bcopy(h,a,l) memcpy(a,h,l)
  795. #endif /* bcopy */
  796. #include <ex_errno.h>
  797. #endif /* EXCELAN */
  798.  
  799. #ifdef I386IX                /* Interactive Sys V R3 network. */
  800. /* #define TELOPTS */            /* This might need defining. */
  801. #define ORG_NLONG ENAMETOOLONG        /* Resolve conflicting symbols */
  802. #undef ENAMETOOLONG            /* in <errno.h> and <net/errno.h> */
  803. #define ORG_NEMPTY ENOTEMPTY
  804. #undef ENOTEMPTY
  805. #include <net/errno.h>
  806. #undef ENAMETOOLONG
  807. #define ENAMETOOLONG ORG_NLONG
  808. #undef ENOTEMPTY
  809. #define ENOTEMPTY ORG_NEMPTY
  810. #include <netinet/tcp.h>        /* for inet_addr() */
  811. #endif /* I386IX */
  812. /*
  813.   Data type of the inet_addr() function...
  814.   We define INADDRX if it is of type struct inaddr.
  815.   If it is undefined, unsigned long is assumed.
  816.   Look at <arpa/inet.h> to find out.  The following known cases are
  817.   handled here.  Other systems that need it can be added here, or else
  818.   -DINADDRX can be included in the CFLAGS on the cc command line.
  819. */
  820. #ifndef NOINADDRX
  821. #ifdef DU2                /* DEC Ultrix 2.0 */
  822. #define INADDRX
  823. #endif /* DU2 */
  824. #endif /* NOINADDRX */
  825.  
  826. #else /* Not UNIX */
  827.  
  828. #ifdef VMS                /* (Open)VMS section */
  829.  
  830. #ifdef MULTINET                /* TGV MultiNet */
  831. /*
  832.   In C-Kermit 7.0 Beta.08 we started getting scads of compile time warnings
  833.   in Multinet builds: "blah" is implicitly declared as a function, where blah
  834.   is socket_read/write/close, ntohs, htons, getpeername, accept, select, etc.
  835.   I have no idea why -- these routines are declared in the header files below,
  836.   and the includes haven't changed.  The executable still seems to work OK.
  837.   Messing with the order of the following includes is disastrous.
  838. */
  839. #ifdef MULTINET_NO_PROTOTYPES
  840. #undef MULTINET_NO_PROTOTYPES
  841. #endif /* MULTINET_NO_PROTOTYPES */
  842.  
  843. #ifdef  __cplusplus
  844. #undef  __cplusplus
  845. #endif /*  __cplusplus */
  846.  
  847. #include "multinet_root:[multinet.include]errno.h"
  848. #include "multinet_root:[multinet.include.sys]types.h"
  849. #include "multinet_root:[multinet.include.sys]socket.h"
  850. #include "multinet_root:[multinet.include]netdb.h"
  851. #include "multinet_root:[multinet.include.netinet]in.h"
  852. #include "multinet_root:[multinet.include.arpa]inet.h"
  853. #include "multinet_root:[multinet.include.sys]ioctl.h"
  854.  
  855. #ifdef COMMENT
  856. /*
  857.   No longer needed because now bzero/bcopy are macros defined as
  858.   memset/memmove in all VMS builds.
  859. */
  860. /*
  861.   We should be able to pick these up from <strings.h> but it's
  862.   not portable between VAXC and DECC.  And even with DECC 5.x we have a
  863.   difference between VAX and Alpha.  We get warnings here on the VAX
  864.   with DECC 5.6-003 but they are not fatal.
  865. */
  866. #ifndef __DECC_VER
  867. #ifndef bzero
  868. _PROTOTYP( void bzero, (char *, int) );
  869. #endif /* bzero */
  870. #ifndef bcopy
  871. _PROTOTYP( void bcopy, (char *, char *, int) );
  872. #endif /* bcopy */
  873. #endif /* __DECC_VER */
  874. #endif /* COMMENT */
  875.  
  876. #ifdef __DECC
  877. /*
  878.    If compiling under DEC C the socket calls must not be prefixed with
  879.    DECC$.  This is done by using the compiler switch /Prefix=Ansi_C89.
  880.    However, this causes some calls that should be prefixed to not be
  881.    (which I think is a bug in the compiler - I've been told these calls
  882.    are present in ANSI compilers).  At any rate, such calls are fixed
  883.    here by explicitly prefixing them.
  884. */
  885. #ifdef COMMENT
  886. /*
  887.    But this causes errors with VMS 6.2 / DEC C 5.3-006 / MultiNet 4.0A on
  888.    a VAX (but not on an Alpha).  So now what happens if we skip doing this?
  889. */
  890. #define close decc$close
  891. #define alarm decc$alarm
  892. #endif /* COMMENT */
  893. #endif /* __DECC */
  894.  
  895. #else /* Not MULTINET */
  896.  
  897. #ifdef WINTCP                /* WIN/TCP = PathWay for VMS */
  898. #ifdef OLD_TWG
  899. #include "twg$tcp:[netdist.include.sys]errno.h"
  900. #include "twg$tcp:[netdist.include.sys]types2.h" /* avoid some duplicates */
  901. #else
  902. #include "twg$tcp:[netdist.include]socket_aliases.h"
  903. #include <errno.h>
  904. #include "twg$tcp:[netdist.include.sys]types.h"
  905. #endif /* OLD_TWG */
  906. #include "twg$tcp:[netdist.include.sys]socket.h"
  907. #include "twg$tcp:[netdist.include]netdb.h"
  908. #include "twg$tcp:[netdist.include.sys]domain.h"
  909. #include "twg$tcp:[netdist.include.sys]protosw.h"
  910. #include "twg$tcp:[netdist.include.netinet]in.h"
  911. #include "twg$tcp:[netdist.include.arpa]inet.h"
  912. #include "twg$tcp:[netdist.include.sys]ioctl.h"
  913.  
  914. #else /* Not WINTCP */
  915.  
  916. #ifdef DEC_TCPIP
  917. #ifdef UCX50
  918. #ifndef IF_DOT_H
  919. #define IF_DOT_H
  920. #endif /*  IF_DOT_H */
  921. #endif /* UCX50 */
  922.  
  923. #ifdef IF_DOT_H
  924. #include <if.h>                /* Needed to put up u_int typedef */
  925. #else
  926. #ifdef NEEDUINT
  927. typedef unsigned int u_int;
  928. #endif /* NEEDUINT */
  929. #endif /* IF_DOT_H */
  930.  
  931. #include <in.h>
  932. #include <netdb.h>
  933. #include <socket.h>
  934. #include "ckvioc.h"
  935. #define socket_errno errno
  936.  
  937. #ifdef COMMENT
  938. /*
  939.   No longer needed because now bzero/bcopy are macros defined as
  940.   memset/memmove in all VMS builds.
  941. */
  942. /*
  943.   Translation: In <strings.h>, which exists only for DECC >= 5.2, bzero()
  944.   and bcopy() are declared only for OpenVMS >= 7.0.  This still might need
  945.   adjustment for DECC 5.0 and higher.
  946. */
  947. #ifdef __DECC_VER
  948. #ifdef VMSV70
  949. /*
  950.   Note: you can't use "#if (__VMS_VER>=70000000)" because that is not
  951.   portable and kills non-VMS builds.
  952. */
  953. #include <strings.h>
  954. #else
  955. #define bzero(s,n) memset(s,0,n)
  956. #define bcopy(h,a,l) memmove(a,h,l)
  957. #endif /* VMSV70 */
  958. #else
  959. #define bzero(s,n) memset(s,0,n)
  960. #define bcopy(h,a,l) memmove(a,h,l)
  961. #endif /* __DECC_VER */
  962. #endif /* COMMENT */
  963.  
  964. #define socket_read     read
  965. #define socket_write     write
  966. #define socket_ioctl    ioctl
  967. #define socket_close    close
  968.  
  969. #ifdef __DECC
  970. int ioctl (int d, int request, void *argp);
  971. #else
  972. int ioctl (int d, int request, char *argp);
  973. #endif /* DECC */
  974. /*
  975.   UCX supports select(), but does not provide the needed symbol and
  976.   structure definitions in any header file, so ...
  977. */
  978. #include <types.h>
  979. #ifndef NBBY
  980. /*-
  981.  * Copyright (c) 1982, 1986, 1991, 1993
  982.  *    The Regents of the University of California.  All rights reserved.
  983.  *
  984.  * Redistribution and use in source and binary forms, with or without
  985.  * modification, are permitted provided that the following conditions
  986.  * are met:
  987.  * 1. Redistributions of source code must retain the above copyright
  988.  *    notice, this list of conditions and the following disclaimer.
  989.  * 2. Redistributions in binary form must reproduce the above copyright
  990.  *    notice, this list of conditions and the following disclaimer in the
  991.  *    documentation and/or other materials provided with the distribution.
  992.  * 3. All advertising materials mentioning features or use of this software
  993.  *    must display the following acknowledgement:
  994.  *    This product includes software developed by the University of
  995.  *    California, Berkeley and its contributors.
  996.  * 4. Neither the name of the University nor the names of its contributors
  997.  *    may be used to endorse or promote products derived from this software
  998.  *    without specific prior written permission.
  999.  *
  1000.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1001.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1002.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1003.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1004.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1005.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1006.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1007.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1008.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1009.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1010.  * SUCH DAMAGE.
  1011.  *
  1012.  *    @(#)types.h    8.1 (Berkeley) 6/2/93
  1013.  */
  1014.  
  1015. #define    NBBY    8        /* number of bits in a byte */
  1016.  
  1017. /*
  1018.  * Select uses bit masks of file descriptors in longs.  These macros
  1019.  * manipulate such bit fields (the filesystem macros use chars).
  1020.  * FD_SETSIZE may be defined by the user, but the default here should
  1021.  * be enough for most uses.
  1022.  */
  1023. #ifndef    FD_SETSIZE
  1024. #define    FD_SETSIZE    256
  1025. #endif
  1026.  
  1027. typedef long    fd_mask;
  1028. #define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  1029.  
  1030. #ifndef howmany
  1031. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  1032. #endif
  1033.  
  1034. typedef    struct fd_set {
  1035.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  1036. } fd_set;
  1037.  
  1038. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  1039. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  1040. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  1041. #define    FD_COPY(f, t)    bcopy(f, t, sizeof(*(f)))
  1042. #define    FD_ZERO(p)    bzero(p, sizeof(*(p)))
  1043. #endif /* !NBBY */
  1044.  
  1045. #else  /* Not DEC_TCPIP */
  1046.  
  1047. #ifdef CMU_TCPIP
  1048. #include <types.h>
  1049. #include <in.h>
  1050. #include <netdb.h>
  1051. #include <socket.h>
  1052. #include <inet.h>
  1053. #include <ioctl.h>
  1054. #include "ckvioc.h"
  1055. #define socket_errno errno
  1056. #ifdef COMMENT
  1057. /* This is now done above for all VMS builds */
  1058. #define bzero(s,n) memset(s,0,n)
  1059. #define bcopy(h,a,l) memmove(a,h,l)
  1060. #endif /* COMMENT */
  1061.  
  1062. /*
  1063.  * Routines supplied in LIBCMU.OLB
  1064.  */
  1065. #define socket_ioctl    ioctl
  1066. #define socket_read     cmu_read
  1067. #define socket_write     cmu_write
  1068. #define socket_close    cmu_close
  1069.  
  1070. #endif /* CMU_TCPIP */
  1071. #endif /* DEC_TCPIP */
  1072. #endif /* WINTCP */
  1073. #endif /* MULTINET */
  1074.  
  1075. #else /* Not VMS */
  1076.  
  1077. #ifdef OS2
  1078. #include "ckonet.h"
  1079. #ifndef NT
  1080. #include <nerrno.h>
  1081. #endif
  1082. #endif /* OS2 */
  1083.  
  1084. #ifdef STRATUS  /* Stratus VOS using OS TCP/IP products S235, S236, S237 */
  1085. #include <tcp_socket.h>
  1086. /* This gets used some places when TCPSOCKET is defined. */
  1087. /* OS TCP provides bzero(), but not bcopy()... go figure. */
  1088. #define bcopy(s,d,z) memcpy(d,s,z)
  1089. #endif /* STRATUS */
  1090.  
  1091. #ifdef OSK
  1092. #ifndef OSKXXC
  1093. #include <inet/in.h>
  1094. #include <inet/netdb.h>
  1095. #include <inet/socket.h>
  1096. #else
  1097. #include <INET/in.h>
  1098. #include <INET/netdb.h>
  1099. #include <INET/socket.h>
  1100. #endif /* OSKXXC */
  1101. #define bzero(s,n) memset(s,0,n)
  1102. #define bcopy(h,a,l) memcpy(a,h,l)
  1103. typedef char * caddr_t; /* core address type */
  1104. #endif /* OSK */
  1105.  
  1106. #endif /* VMS */
  1107. #endif /* UNIX */
  1108. #endif /* TCPSOCKET */
  1109.  
  1110. #ifdef TCPSOCKET
  1111. #ifndef NOHADDRLIST
  1112. #ifndef HADDRLIST
  1113. #ifdef SUNOS41
  1114. #define HADDRLIST
  1115. #endif /* SUNOS41 */
  1116. #ifdef SOLARIS
  1117. #define HADDRLIST
  1118. #endif /* SOLARIS */
  1119. #ifdef LINUX
  1120. #define HADDRLIST
  1121. #endif /* LINUX */
  1122. #ifdef AIXRS
  1123. #define HADDRLIST
  1124. #endif /* AIXRS */
  1125. #ifdef HPUX
  1126. #define HADDRLIST
  1127. #endif /* HPUX */
  1128. #ifdef IRIX
  1129. #define HADDRLIST
  1130. #endif /* IRIX */
  1131. #ifdef I386IX
  1132. #define HADDRLIST
  1133. #endif /* I386IX */
  1134. #endif /* HADDRLIST */
  1135. /* A system that defines h_addr as h_addr_list[0] should be HADDRLIST */
  1136. #ifndef HADDRLIST
  1137. #ifdef h_addr
  1138. #define HADDRLIST
  1139. #endif /* h_addr */
  1140. #endif /* HADDRLIST */
  1141. #endif /* NOHADDRLIST */
  1142. #endif /* TCPSOCKET */
  1143.  
  1144. #ifdef TNCODE                /* If we're compiling telnet code... */
  1145. #ifndef IKS_OPTION
  1146. #ifndef STRATUS
  1147. #define IKS_OPTION
  1148. #endif /* STRATUS */
  1149. #endif /* IKS_OPTION */
  1150. #include "ckctel.h"
  1151. #else
  1152. extern int sstelnet;
  1153. #ifdef IKSD
  1154. #undef IKSD
  1155. #endif /* IKSD */
  1156. #ifndef NOIKSD
  1157. #define NOIKSD
  1158. #endif /* NOIKSD */
  1159. #ifdef IKS_OPTION
  1160. #undef IKS_OPTION
  1161. #endif /* IKS_OPTION */
  1162. #endif /* TNCODE */
  1163.  
  1164. #ifndef NOTCPOPTS
  1165. /*
  1166.   Automatically define NOTCPOPTS for configurations where they can't be
  1167.   used at runtime or cause too much trouble at compile time.
  1168. */
  1169. #ifdef CMU_TCPIP            /* CMU/Tek */
  1170. #define NOTCPOPTS
  1171. #endif /* CMU_TCPIP */
  1172. #ifdef MULTINET                /* Multinet on Alpha */
  1173. #ifdef __alpha
  1174. #define NOTCPOPTS
  1175. #endif /* __alpha */
  1176. #endif /* MULTINET */
  1177. #endif /* NOTCPOPTS */
  1178.  
  1179. #ifdef NOTCPOPTS
  1180. #ifdef TCP_NODELAY
  1181. #undef TCP_NODELAY
  1182. #endif /* TCP_NODELAY */
  1183. #ifdef SO_LINGER
  1184. #undef SO_LINGER
  1185. #endif /* SO_LINGER */
  1186. #ifdef SO_KEEPALIVE
  1187. #undef SO_KEEPALIVE
  1188. #endif /* SO_KEEPALIVE */
  1189. #ifdef SO_SNDBUF
  1190. #undef SO_SNDBUF
  1191. #endif /* SO_SNDBUF */
  1192. #ifdef SO_RCVBUF
  1193. #undef SO_RCVBUF
  1194. #endif /* SO_RCVBUF */
  1195. #endif /* NOTCPOPTS */
  1196.  
  1197. /* This function is declared even when TCPSOCKET is not available */
  1198. _PROTOTYP( char * ckgetpeer, (VOID));
  1199.  
  1200. #ifdef TCPSOCKET
  1201. #ifdef SOL_SOCKET
  1202. #ifdef TCP_NODELAY
  1203. _PROTOTYP( int no_delay, (int) );
  1204. #endif /* TCP_NODELAY */
  1205. #ifdef SO_KEEPALIVE
  1206. _PROTOTYP( int keepalive, (int) ) ;
  1207. #endif /* SO_KEEPALIVE */
  1208. #ifdef SO_LINGER
  1209. _PROTOTYP( int ck_linger, (int, int) ) ;
  1210. #endif /* SO_LINGER */
  1211. #ifdef SO_SNDBUF
  1212. _PROTOTYP( int sendbuf,(int) ) ;
  1213. #endif /* SO_SNDBUF */
  1214. #ifdef SO_RCVBUF
  1215. _PROTOTYP( int recvbuf, (int) ) ;
  1216. #endif /* SO_RCVBUF */
  1217. #ifdef SO_DONTROUTE
  1218. _PROTOTYP(int dontroute, (int));
  1219. #endif /* SO_DONTROUTE */
  1220. #endif /* SOL_SOCKET */
  1221. _PROTOTYP( int getlocalipaddr, (VOID));
  1222. _PROTOTYP( int getlocalipaddrs, (char *,int,int));
  1223. _PROTOTYP( char * ckgetfqhostname,(char *));
  1224. _PROTOTYP( struct hostent * ck_copyhostent,(struct hostent *));
  1225. _PROTOTYP( char * ckname2addr, (char *));
  1226. _PROTOTYP( char * ckaddr2name, (char *));
  1227.  
  1228. /* AIX */
  1229.  
  1230. #ifdef AIXRS
  1231. #ifndef TCP_NODELAY
  1232. #define TCP_NODELAY 0x1
  1233. #endif /* TCP_NODELAY */
  1234. #ifndef TCP_MAXSEG
  1235. #define TCP_MAXSEG 0x2
  1236. #endif /* TCP_MAXSEG */
  1237. #ifndef TCP_KEEPALIVE
  1238. #define TCP_KEEPALIVE 0x8
  1239. #endif /* TCP_KEEPALIVE */
  1240. #endif /* AIXRS */
  1241. #endif /* TCPSOCKET */
  1242.  
  1243. #ifdef RLOGCODE
  1244. #ifndef CK_TTGWSIZ
  1245. SORRY_RLOGIN_REQUIRES_TTGWSIZ_see_ckcplm.doc
  1246. #endif /* CK_TTGWSIZ */
  1247. #endif /* RLOGCODE */
  1248.  
  1249. #ifdef CK_NAWS
  1250. #ifndef CK_TTGWSIZ
  1251. SORRY_CK_NAWS_REQUIRES_TTGWSIZ_see_ckcplm.doc
  1252. #endif /* CK_TTGWSIZ */
  1253. #endif /* CK_NAWS */
  1254.  
  1255. #ifndef PF_INET
  1256. #ifdef  AF_INET
  1257. #define PF_INET AF_INET
  1258. #endif /* AF_INET */
  1259. #endif /* PF_INET */
  1260.  
  1261. #ifndef IPPORT_ECHO
  1262. #define IPPORT_ECHO 7
  1263. #endif /* IPPORT_ECHO */
  1264.  
  1265. #ifdef CK_KERBEROS
  1266. #ifdef RLOGCODE
  1267. _PROTOTYP(int ck_krb_rlogin,(CHAR *, int, CHAR *, CHAR *, CHAR *,
  1268.                               struct sockaddr_in *,
  1269.                               struct sockaddr_in *, int, int));
  1270. #endif /* RLOGCODE */
  1271. #endif /* CK_KERBEROS */
  1272.  
  1273. _PROTOTYP( VOID ini_kerb, ( void ) );   /* Kerberos initialization routine */
  1274. _PROTOTYP( int doauth, (int) );         /* AUTHENTICATE action routine */
  1275.  
  1276. #ifdef CK_DNS_SRV
  1277. _PROTOTYP(int locate_srv_dns,(char *host, char *service,
  1278.                   char *protocol, struct sockaddr **addr_pp,
  1279.                   int *naddrs));
  1280. #endif /* CK_DNS_SRV */
  1281.  
  1282. #ifndef NOHTTP
  1283. _PROTOTYP(int http_open, (char *, char *, int, char *, int));
  1284. _PROTOTYP(int http_reopen, (VOID));
  1285. _PROTOTYP(int http_close, (VOID));
  1286. _PROTOTYP(int http_get, (char *,char **,char *,char *,char,char *,char *,
  1287.              int));
  1288. _PROTOTYP(int http_head, (char *,char **,char *,char *,char,char *,char *,
  1289.               int));
  1290. _PROTOTYP(int http_put, (char *,char **,char *,char *,char *,char,char *,
  1291.              char *, char *, int));
  1292. _PROTOTYP(int http_delete, (char *,char **,char *,char *,char,char *));
  1293. _PROTOTYP(int http_connect, (int, char *,char **,char *,char *,char,char *));
  1294. _PROTOTYP(int http_post, (char *,char **,char *,char *,char *,char,char *,
  1295.           char *,char *, int));
  1296. _PROTOTYP(int http_index, (char *,char **,char *,char *,char,char *,char *,
  1297.                int));
  1298.  
  1299. extern char * tcp_http_proxy;           /* Name[:port] of http proxy server */
  1300. extern int    tcp_http_proxy_errno;     /* Return value from server */
  1301. extern char * tcp_http_proxy_user;      /* Name of user for authentication */
  1302. extern char * tcp_http_proxy_pwd;       /* Password of user */
  1303. #endif /* NOHTTP */
  1304.  
  1305. #ifdef TCPSOCKET
  1306.  
  1307. /* Type needed as 5th argument (length) to get/setsockopt() */
  1308.  
  1309. #ifndef SOCKOPT_T
  1310. #define SOCKOPT_T int
  1311. #ifdef AIX42
  1312. #undef SOCKOPT_T
  1313. #define SOCKOPT_T unsigned long
  1314. #else
  1315. #ifdef PTX
  1316. #undef SOCKOPT_T
  1317. #define SOCKOPT_T size_t
  1318. #else
  1319. #ifdef NT
  1320. #undef SOCKOPT_T
  1321. #define SOCKOPT_T int
  1322. #else /* NT */
  1323. #ifdef UNIXWARE
  1324. #undef SOCKOPT_T
  1325. #define SOCKOPT_T size_t
  1326. #else /* UNIXWARE */
  1327. #ifdef VMS
  1328. #ifdef DEC_TCPIP
  1329. #ifdef __DECC_VER
  1330. #undef SOCKOPT_T
  1331. #define SOCKOPT_T size_t
  1332. #endif /* __DECC_VER */
  1333. #endif /* DEC_TCPIP */
  1334. #endif /* VMS */
  1335. #endif /* UNIXWARE */
  1336. #endif /* NT */
  1337. #endif /* PTX */
  1338. #endif /* AIX42 */
  1339. #endif /* SOCKOPT_T */
  1340.  
  1341. /* Ditto for getsockname() */
  1342.  
  1343. #ifndef GSOCKNAME_T
  1344. #define GSOCKNAME_T int
  1345. #ifdef PTX
  1346. #undef GSOCKNAME_T
  1347. #define GSOCKNAME_T size_t
  1348. #else
  1349. #ifdef AIX42                            /* size_t in 4.2++, int in 4.1-- */
  1350. #undef GSOCKNAME_T
  1351. #define GSOCKNAME_T size_t
  1352. #else
  1353. #ifdef UNIXWARE
  1354. #undef GSOCKNAME_T
  1355. #define GSOCKNAME_T size_t
  1356. #else
  1357. #ifdef VMS
  1358. #ifdef DEC_TCPIP
  1359. #ifdef __DECC_VER
  1360. #undef GSOCKNAME_T
  1361. #define GSOCKNAME_T size_t
  1362. #endif /* __DECC_VER */
  1363. #endif /* DEC_TCPIP */
  1364. #endif /* VMS */
  1365. #endif /* UNIXWARE */
  1366. #endif /* AIX41 */
  1367. #endif /* PTX */
  1368. #endif /* GSOCKNAME_T */
  1369.  
  1370. #endif /* TCPSOCKET */
  1371.  
  1372. #endif /* CKCNET_H */
  1373.