home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckl196.zip / ckcnet.h < prev    next >
C/C++ Source or Header  |  1999-12-30  |  36KB  |  1,263 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, 2000,
  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_SSH  13                     /* Use SSH */
  31. #define NET_IX25 14            /* IBM AIX 4.1 X.25 */
  32. #define NET_HX25 15            /* HP-UX 10 X.25 */
  33. #define NET_PTY  16            /* Pseudoterminal */
  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 */
  59.  
  60. #define NP_DEFAULT 255
  61. #define NP_NONE 0            /* None (async) */
  62. #define NP_TELNET 1            /* TCP/IP telnet */
  63. #define NP_VTP 2            /* ISO Virtual Terminal Protocol */
  64. #define NP_X3 3                /* CCITT X.3 */
  65. #define NP_X28 4            /* CCITT X.28 */
  66. #define NP_X29 5            /* CCITT X.29 */
  67. #define NP_RLOGIN 6            /* TCP/IP Remote login */
  68. #define NP_KERMIT 7            /* TCP/IP Kermit */
  69. #define NP_FTP    8            /* TCP/IP FTP */
  70. #define NP_TCPRAW 9            /* TCP/IP Raw socket */
  71. #define NP_TCPUNK 10                    /* TCP/IP Unknown */
  72. #define NP_SSL 11                       /* TCP/IP SSLv23 */
  73. #define NP_TLS 12                       /* TCP/IP TLSv1 */
  74. #define NP_SSL_TELNET 13                /* TCP/IP Telnet over SSLv23 */
  75. #define NP_TLS_TELNET 14                /* TCP/IP Telnet over TLSv1 */
  76. #define NP_K4LOGIN     15               /* TCP/IP Kerberized remote login */
  77. #define NP_EK4LOGIN    16               /* TCP/IP Encrypted Kerberized ... */
  78. #define NP_K5LOGIN     17               /* TCP/IP Kerberized remote login */
  79. #define NP_EK5LOGIN    18               /* TCP/IP Encrypted Kerberized ... */
  80.  
  81. #define NP_CTERM 20            /* DEC CTERM */
  82. #define NP_LAT 21            /* 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/param.h>
  258. #include <sys/systm.h>
  259. #ifndef SOLARIS
  260. #include <sys/mbuf.h>
  261. #endif /* SOLARIS */
  262. #include <sys/socket.h>
  263. #include <sys/protosw.h>
  264. #ifdef SOLARIS
  265. #include <sys/sockio.h>
  266. #else
  267. #include <sys/domain.h>
  268. #endif /* SOLARIS */
  269. #include <sys/socketvar.h>
  270. #include <net/if.h>
  271. #include <sundev/syncstat.h>
  272. #include <netx25/x25_pk.h>
  273. #include <netx25/x25_ctl.h>
  274. #include <netx25/x25_ioctl.h>
  275. #endif /* SOLARIS25 */
  276. #endif /* SUNX25 */
  277.  
  278. #ifdef ANYX25
  279.  
  280. #ifdef IBMX25                /* X.25 includes, AIX only */
  281. #include <fcntl.h>
  282. #include <sys/twtypes.h>
  283. #include <sys/twlib.h>
  284.  
  285. #include <sys/stream.h>
  286. #include <stropts.h>
  287.  
  288. #define NPI_20                /* required to include the whole NPI */
  289. #include <sys/npi_20.h>
  290. #include <sys/npiapi.h>
  291. #include <sys/pktintf.h>
  292.  
  293. #include <odmi.h>            /* required for access to the ODM   */
  294. #include <sys/cfgodm.h>            /* database, needed to find out the */
  295.                     /* local NUA. see x25local_nua()    */
  296.  
  297.  
  298. /* IBM X25 NPI generic primitive type */
  299. typedef union N_npi_ctl_t {
  300.     ulong        PRIM_type;        /* generic primitive type */
  301.     char        buffer[NPI_MAX_CTL];    /* maximum primitive size */
  302.     N_bind_ack_t        bind_ack;
  303.     N_bind_req_t        bind_req;
  304.     N_conn_con_t        conn_con;
  305.     N_conn_ind_t        conn_ind;
  306.     N_conn_req_t        conn_req;
  307.     N_conn_res_t        conn_res;
  308.     N_data_req_t        data_req;
  309.     N_data_ind_t        data_ind;
  310.     N_discon_ind_t      discon_ind;
  311.     N_discon_req_t      discon_req;
  312.     N_error_ack_t       error_ack;
  313.     N_exdata_ind_t      exdata_ind;
  314.     N_info_ack_t        info_ack;
  315.     N_ok_ack_t          ok_ack;
  316.     N_reset_con_t       reset_con;
  317.     N_reset_req_t       reset_req;
  318.     N_reset_ind_t       reset_ind;
  319. } N_npi_ctl_t;
  320.  
  321. /* some extra definitions to help out */
  322. typedef char    x25addr_t[45];        /* max 40 defined by CCITT */
  323. typedef char    N_npi_data_t[NPI_MAX_DATA];
  324.  
  325. /* fd or server waiting for connections, used by netclos and netopen */
  326. extern int x25serverfd;
  327.  
  328. #endif /* IBMX25 */
  329.  
  330. #ifdef HPX25                /* X.25 includes, HP-UX only */
  331. #include <x25/ccittproto.h>
  332. #include <x25/x25.h>
  333. #include <x25/x25addrstr.h>
  334. #include <x25/x25codes.h>
  335. #include <x25/x25hd_ioctl.h>
  336. #include <x25/x25ioctls.h>
  337. #include <x25/x25str.h>
  338. #include <sys/ioctl.h>
  339. #endif /* HPX25 */
  340.  
  341. /* C-Kermit X.3 / X.25 / X.29 / X.121 support functions */
  342.  
  343. /* (riehm: this list of functions isn't quite right for AIX) */
  344.  
  345. _PROTOTYP( int shopad, (int) );
  346. _PROTOTYP( int shox25, (int) );
  347. _PROTOTYP( VOID initpad, (void) );
  348. _PROTOTYP( VOID setpad, (CHAR *, int) );
  349. _PROTOTYP( VOID readpad, (CHAR *, int, CHAR *) );
  350. _PROTOTYP( int qbitpkt, (CHAR *, int) );
  351. _PROTOTYP( VOID setqbit, (void) );
  352. _PROTOTYP( VOID resetqbit, (void) );
  353. _PROTOTYP( VOID breakact, (void) );
  354. _PROTOTYP( int pkx121, (char *, CHAR *) );
  355. _PROTOTYP( SIGTYP x25oobh, (int) );
  356. _PROTOTYP( int x25diag, (void) );
  357. _PROTOTYP( int x25intr, (char) );
  358. _PROTOTYP( int x25reset, (char, char) );
  359. _PROTOTYP( int x25clear, (void) );
  360. _PROTOTYP( int x25stat, (void) );
  361. _PROTOTYP( int x25in, (int, CHAR *) );
  362. _PROTOTYP( int setpadp, (void) );
  363. _PROTOTYP( int setx25, (void) );
  364. _PROTOTYP( int x25xin, (int, CHAR *) );
  365. _PROTOTYP( int x25inl, (CHAR *, int, int, CHAR) );
  366.  
  367. #ifdef IBMX25
  368.                     /* setup x25 */
  369. _PROTOTYP( ulong x25bind, (int, char *, char *, int, int, int, ulong) );
  370. _PROTOTYP( int x25call, (int, char *, char *) ); /* connect to remote */
  371. _PROTOTYP( int x25unbind, (int) );    /* disconnect */
  372. _PROTOTYP( char *x25prim, (int) );    /* display primitives */
  373. _PROTOTYP( int x25local_nua, (char *) ); /* find local NUA */
  374. #endif /* IBMX25 */
  375.  
  376. #endif /* ANYX25 */
  377.  
  378. /* CMU-OpenVMS/IP */
  379.  
  380. #ifdef CMU_TCPIP            /* CMU_TCPIP implies TCPSOCKET */
  381. #ifndef TCPSOCKET
  382. #define TCPSOCKET
  383. #endif /* TCPSOCKET */
  384. #ifndef TCPIPLIB
  385. #define TCPIPLIB
  386. #endif /* TCPIPLIB */
  387. #endif /* CMU_TCPIP */
  388.  
  389. /* DEC TCP/IP for (Open)VMS, previously known as UCX */
  390.  
  391. #ifdef DEC_TCPIP            /* DEC_TCPIP implies TCPSOCKET */
  392. #ifndef TCPSOCKET
  393. #define TCPSOCKET
  394. #endif /* TCPSOCKET */
  395. #ifndef TCPIPLIB
  396. #define TCPIPLIB
  397. #endif /* TCPIPLIB */
  398. #endif /* DEC_TCPIP */
  399.  
  400. /* SRI/TGV/Cisco/Process MultiNet, TCP/IP for VAX/VMS */
  401.  
  402. #ifdef MULTINET                /* MULTINET implies TCPSOCKET */
  403. #ifndef TCPSOCKET
  404. #define TCPSOCKET
  405. #endif /* TCPSOCKET */
  406. #ifndef TCPIPLIB
  407. #define TCPIPLIB
  408. #endif /* TCPIPLIB */
  409. #ifndef TGVORWIN            /* MULTINET and WINTCP */
  410. #define TGVORWIN            /* share a lot of code... */
  411. #endif /* TGVORWIN */
  412. #endif /* MULTINET */
  413.  
  414. /* Wollongong TCP/IP for VAX/VMS */
  415.  
  416. #ifdef WINTCP                /* WINTCP implies TCPSOCKET */
  417. #ifndef TCPSOCKET
  418. #define TCPSOCKET
  419. #endif /* TCPSOCKET */
  420. #ifndef TCPIPLIB
  421. #define TCPIPLIB
  422. #endif /* TCPIPLIB */
  423. #ifndef TGVORWIN            /* WINTCP and MULTINET */
  424. #define TGVORWIN            /* share a lot of code... */
  425. #endif /* TGVORWIN */
  426. #endif /* WINTCP */
  427.  
  428. /* Wollongong TCP/IP for AT&T Sys V */
  429.  
  430. #ifdef WOLLONGONG            /* WOLLONGONG implies TCPSOCKET */
  431. #ifndef TCPSOCKET            /* Don't confuse WOLLONGONG */
  432. #define TCPSOCKET            /* (which is for UNIX) with */
  433. #endif /* TCPSOCKET */            /* WINTCP, which is for VMS! */
  434. #endif /* WOLLONGONG */
  435.  
  436. #ifdef EXCELAN                /* EXCELAN implies TCPSOCKET */
  437. #ifndef TCPSOCKET
  438. #define TCPSOCKET
  439. #endif /* TCPSOCKET */
  440. #endif /* EXCELAN */
  441.  
  442. #ifdef INTERLAN                /* INTERLAN implies TCPSOCKET */
  443. #ifndef TCPSOCKET
  444. #define TCPSOCKET
  445. #endif /* TCPSOCKET */
  446. #endif /* INTERLAN */
  447.  
  448. #ifdef BEBOX
  449. #ifndef TCPSOCKET
  450. #define TCPSOCKET
  451. #endif /* TCPSOCKET */
  452. #ifndef TCPIPLIB
  453. #define TCPIPLIB
  454. #endif /* TCPIPLIB */
  455. #define socket_errno    h_errno
  456. #define socket_read(x,y,z)     recv(x,y,sizeof(char),z)
  457. #define socket_write(x,y,z)     send(x,y,sizeof(char),z)
  458. #define socket_ioctl    ioctl
  459. #define socket_close(x)         closesocket(x)
  460. #ifndef FIONBIO
  461. #define FIONBIO 2
  462. #endif /* FIONBIO */
  463. #ifndef COHERENT            /* eh? */
  464. #ifndef FIONREAD
  465. #define FIONREAD       1
  466. #endif /* FIONREAD */
  467. #endif /* COHERENT */
  468. #ifndef SIOCATMARK
  469. #define SIOCATMARK     3
  470. #endif /* SIOCATMARK */
  471. #endif /* BEBOX */
  472.  
  473. #ifdef COMMENT /* no longer used but might come in handy again later... */
  474. /*
  475.   CK_READ0 can (and should) be defined if and only if:
  476.   (a) read(fd,&x,0) can be used harmlessly on a TCP/IP socket connection.
  477.   (b) read(fd,&x,0) returns 0 if the connection is up, -1 if it is down.
  478. */
  479. #ifndef CK_READ0
  480. #ifdef TCPSOCKET
  481. #ifdef SUNOS41                /* It works in SunOS 4.1 */
  482. #define CK_READ0
  483. #else
  484. #ifdef NEXT                /* and NeXTSTEP */
  485. #define CK_READ0
  486. #endif /* NEXT */
  487. #endif /* SUNOS41 */
  488. #endif /* TCPSOCKET */
  489. #endif /* CK_READ0 */
  490. #endif /* COMMENT */
  491.  
  492. #ifdef TCPSOCKET
  493. #ifndef NOHADDRLIST
  494. #ifndef HADDRLIST
  495. #ifdef SUNOS41
  496. #define HADDRLIST
  497. #endif /* SUNOS41 */
  498. #ifdef SOLARIS
  499. #define HADDRLIST
  500. #endif /* SOLARIS */
  501. #ifdef LINUX
  502. #define HADDRLIST
  503. #endif /* LINUX */
  504. #ifdef AIXRX
  505. #define HADDRLIST
  506. #endif /* AIXRS */
  507. #ifdef HPUX
  508. #define HADDRLIST
  509. #endif /* HPUX */
  510. #ifdef IRIX
  511. #define HADDRLIST
  512. #endif /* IRIX */
  513. #ifdef I386IX
  514. #define HADDRLIST
  515. #endif /* I386IX */
  516. #endif /* HADDRLIST */
  517. #endif /* NOHADDRLIST */
  518. #endif /* TCPSOCKET */
  519.  
  520. /* Telnet protocol */
  521.  
  522. #ifdef TCPSOCKET            /* TCPSOCKET implies TNCODE */
  523. #ifndef TNCODE                /* Which means... */
  524. #define TNCODE                /* Compile in telnet code */
  525. #endif /* TNCODE */
  526.  
  527. /*
  528.    Platforms where we must call gethostname(buf,len) and then
  529.    gethostbyname(buf) to get local IP address, rather than calling
  530.    gethostbyname("").
  531. */
  532. #ifndef CKGHNLHOST
  533. #ifdef datageneral
  534. #define CKGHNLHOST
  535. #else
  536. #ifdef SOLARIS
  537. #define CKGHNLHOST
  538. #else
  539. #ifdef SUNOS4
  540. #define CKGHNLHOST
  541. #else
  542. #ifdef UNIXWARE
  543. #define CKGHNLHOST
  544. #else
  545. #ifdef SINIX
  546. #define CKGHNLHOST
  547. #endif /* SINIX */
  548. #endif /* UNIXWARE */
  549. #endif /* SUNOS4 */
  550. #endif /* SOLARIS */
  551. #endif /* datageneral */
  552. #endif /* CKGHNLHOST */
  553.  
  554. /*
  555.   Telnet local-echo buffer, used for saving up user data that can't be
  556.   properly displayed and/or evaluated until pending Telnet negotiations are
  557.   complete.  TTLEBUF is defined for platforms (like UNIX) where net i/o is
  558.   done by the same routines that do serial i/o (in which case the relevant
  559.   code goes into the ck?tio.c module, in the ttinc(), ttchk(), etc, routines);
  560.   NETLETBUF is defined for platforms (like VMS) that use different APIs for
  561.   network and serial i/o, and enables the copies of the same routines that
  562.   are in ckcnet.c.
  563. */
  564. #ifndef TTLEBUF
  565. #ifdef UNIX
  566. #define TTLEBUF
  567. #else
  568. #ifdef datageneral
  569. #define TTLEBUF
  570. #endif /* datageneral */
  571. #endif /* UNIX */
  572. #endif /* TTLEBUF */
  573.  
  574. #ifndef NETLEBUF
  575. #ifdef VMS
  576. #define NETLEBUF
  577. #endif /* VMS */
  578. #endif /* NETLEBUF */
  579.  
  580. #ifndef RLOGCODE            /* What about Rlogin? */
  581. #ifndef NORLOGIN
  582. /*
  583.   Rlogin can be enabled only for UNIX versions that have both SIGURG
  584.   (SCO doesn't) and CK_TTGWSIZ (OSF/1 doesn't), so we don't assume that
  585.   any others have these without verifying first.  Not that it really makes
  586.   little difference since you can only use Rlogin if you are root...
  587. */
  588. #ifdef SUNOS41
  589. #define RLOGCODE
  590. #else
  591. #ifdef SOLARIS
  592. #define RLOGCODE
  593. #else
  594. #ifdef HPUX9
  595. #define RLOGCODE
  596. #else
  597. #ifdef HPUX10
  598. #define RLOGCODE
  599. #else
  600. #ifdef OSF40
  601. #define RLOGCODE
  602. #else
  603. #ifdef NEXT
  604. #define RLOGCODE
  605. #else
  606. #ifdef AIX41
  607. #define RLOGCODE
  608. #else
  609. #ifdef UNIXWARE
  610. #define RLOGCODE
  611. #else
  612. #ifdef IRIX51
  613. #define RLOGCODE
  614. #else
  615. #ifdef IRIX60
  616. #define RLOGCODE
  617. #else
  618. #ifdef QNX
  619. #define RLOGCODE
  620. #else
  621. #ifdef __linux__
  622. #define RLOGCODE
  623. #endif /* __linux__ */
  624. #endif /* QNX */
  625. #endif /* IRIX60 */
  626. #endif /* IRIX51 */
  627. #endif /* UNIXWARE */
  628. #endif /* AIX41 */
  629. #endif /* NEXT */
  630. #endif /* OSF40 */
  631. #endif /* HPUX10 */
  632. #endif /* HPUX9 */
  633. #endif /* SOLARIS */
  634. #endif /* SUNOS41 */
  635. #endif /* NORLOGIN */
  636. #ifdef VMS                /* VMS */
  637. #define RLOGCODE
  638. #endif /* VMS */
  639. #endif /* RLOGCODE */
  640. #endif /* TCPSOCKET */
  641.  
  642. #ifdef SUNX25                /* SUNX25 implies TCPSOCKET */
  643. #ifndef TCPSOCKET            /* But doesn't imply TNCODE */
  644. #define TCPSOCKET
  645. #endif /* TCPSOCKET */
  646. #endif /* SUNX25 */
  647.  
  648. #ifndef TCPSOCKET
  649. #ifndef NO_DNS_SRV
  650. #define NO_DNS_SRV
  651. #endif /* NO_DNS_SRV */
  652. #endif /* TCPSOCKET */
  653.  
  654. /* This is the TCPSOCKET section... */
  655.  
  656. #ifdef TCPSOCKET
  657.  
  658. #ifndef NETCONN                /* TCPSOCKET implies NETCONN */
  659. #define NETCONN
  660. #endif /* NETCONN */
  661.  
  662. #ifndef NO_DNS_SRV
  663. #ifdef OS2ONLY
  664. #define NO_DNS_SRV
  665. #endif /* OS2ONLY */
  666. #ifdef VMS
  667. #define NO_DNS_SRV
  668. #endif /* VMS */
  669. #ifdef STRATUS
  670. #define NO_DNS_SRV
  671. #endif /* STRATUS */
  672. #ifdef datageneral
  673. #define NO_DNS_SRV
  674. #endif /* datageneral */
  675. #ifdef ultrix
  676. #define NO_DNS_SRV
  677. #endif /* ultrix */
  678. #ifdef NEXT
  679. #define NO_DNS_SRV
  680. #endif /* NEXT */
  681. #endif /* NO_DNS_SRV */
  682.  
  683. #ifndef CK_DNS_SRV                      /* Use DNS SRV records to determine */
  684. #ifndef NO_DNS_SRV                      /* host and ports */
  685. #define CK_DNS_SRV
  686. #endif /* NO_DNS_SRV */
  687. #endif /* CK_DNS_SRV */
  688.  
  689. #ifndef NOLISTEN            /* select() is required to support */
  690. #ifndef SELECT                /* incoming connections. */
  691. #ifndef VMS
  692. #ifndef OS2
  693. #define NOLISTEN
  694. #endif /* OS2 */
  695. #endif /* VMS */
  696. #endif /* SELECT */
  697. #endif /* NOLISTEN */
  698.  
  699. /* BSD sockets library header files */
  700.  
  701. #ifdef VMS
  702. /*
  703.   Because bzero() and bcopy() are not portable among VMS versions,
  704.   or compilers, or TCP/IP products, etc.
  705. */
  706. #ifndef bzero
  707. #define bzero(s,n) memset(s,0,n)
  708. #endif /* bzero */
  709. #ifndef bcopy
  710. #define bcopy(h,a,l) memcpy(a,h,l)
  711. #endif /* bcopy */
  712. #endif /* VMS */
  713.  
  714. #ifdef UNIX                /* UNIX section */
  715.  
  716. #ifdef SVR4
  717. /*
  718.   These suggested by Rob Healey, rhealey@kas.helios.mn.org, to avoid
  719.   bugs in Berkeley compatibility library on Sys V R4 systems, but untested
  720.   by me (fdc).  Remove this bit if it gives you trouble.
  721.   (Later corrected by Marc Boucher <mboucher@iro.umontreal.ca> because
  722.   bzero/bcopy are not argument-compatible with memset/memcpy|memmove.)
  723. */
  724. #define bzero(s,n) memset(s,0,n)
  725. #ifdef SOLARIS
  726. #ifdef SUNX25
  727. #undef bzero
  728. /*
  729.   WOULD YOU BELIEVE... That the Solaris X.25 /opt/SUNWcomm/lib/libsockx25
  730.   library references bzero, even though the use of bzero is forbidden in
  731.   Solaris?  Look for the function definition in ckcnet.c.
  732. */
  733. _PROTOTYP( void bzero, (char *, int) );
  734. #endif /* SUNX25 */
  735. #define bcopy(h,a,l) memcpy(a,h,l)
  736. #else
  737. #define bcopy(h,a,l) memmove(a,h,l)
  738. #endif /* SOLARIS */
  739. #else /* !SVR4 */
  740. #ifdef PTX                /* Sequent DYNIX PTX 1.3 */
  741. #define bzero(s,n) memset(s,0,n)
  742. #define bcopy(h,a,l) memcpy(a,h,l)
  743. #endif /* PTX */
  744. #endif /* SVR4 */
  745.  
  746. #ifdef INTERLAN                /* Racal-Interlan TCP/IP */
  747. #include <interlan/socket.h>
  748. #include <interlan/il_types.h>
  749. #include <interlan/telnet.h>
  750. #include <interlan/il_errno.h>
  751. #include <interlan/in.h>
  752. #include <interlan/telnet.h>        /* Why twice ? ? ? */
  753. #else /* Not Interlan */
  754. #ifdef BEBOX
  755. #include <socket.h>
  756. #else /* Not BEBOX */            /* Normal BSD TCP/IP library */
  757. #ifdef COMMENT
  758. #ifndef HPUX
  759. #include <arpa/telnet.h>
  760. #endif /* HPUX */
  761. #endif /* COMMENT */
  762. #ifdef SCO234
  763. #include <sys/errno.tcp.h>
  764. #include <sys/types.tcp.h>
  765. #endif /* SCO234 */
  766. #include <sys/socket.h>
  767. #ifdef WOLLONGONG
  768. #include <sys/in.h>
  769. #else
  770. #include <netinet/in.h>
  771. #endif /* WOLLONGONG */
  772. #endif /* BEBOX */
  773. #endif /* INTERLAN */
  774.  
  775. #ifndef EXCELAN
  776. #include <netdb.h>
  777. #ifndef INTERLAN
  778. #ifdef WOLLONGONG
  779. #define minor                /* Do not include <sys/macros.h> */
  780. #include <sys/inet.h>
  781. #else
  782. #ifndef OXOS
  783. #ifndef HPUX
  784. #ifndef BEBOX
  785. #include <arpa/inet.h>
  786. #endif /* BEBOX */
  787. #endif /* HPUX */
  788. #else /* OXOS */
  789. /* In too many releases of X/OS, <arpa/inet.h> declares inet_addr() as
  790.  * ``struct in_addr''.  This is definitively wrong, and could cause
  791.  * core dumps.  Instead of including that bad file, inet_addr() is
  792.  * correctly declared here.  Of course, all the declarations done there
  793.  * has been copied here.
  794.  */
  795. unsigned long inet_addr();
  796. char    *inet_ntoa();
  797. struct    in_addr inet_makeaddr();
  798. unsigned long inet_network();
  799. #endif /* OXOS */
  800. #endif /* WOLLONGONG */
  801. #endif /* INTERLAN */
  802. #endif /* EXCELAN */
  803.  
  804. #ifdef EXCELAN                /* Excelan TCP/IP */
  805. #ifndef bzero
  806. #define bzero(s,n) memset(s,0,n)
  807. #endif /* bzero */
  808. #ifndef bcopy
  809. #define bcopy(h,a,l) memcpy(a,h,l)
  810. #endif /* bcopy */
  811. #include <ex_errno.h>
  812. #endif /* EXCELAN */
  813.  
  814. #ifdef I386IX                /* Interactive Sys V R3 network. */
  815. /* #define TELOPTS */            /* This might need defining. */
  816. #define ORG_NLONG ENAMETOOLONG        /* Resolve conflicting symbols */
  817. #undef ENAMETOOLONG            /* in <errno.h> and <net/errno.h> */
  818. #define ORG_NEMPTY ENOTEMPTY
  819. #undef ENOTEMPTY
  820. #include <net/errno.h>
  821. #undef ENAMETOOLONG
  822. #define ENAMETOOLONG ORG_NLONG
  823. #undef ENOTEMPTY
  824. #define ENOTEMPTY ORG_NEMPTY
  825. #include <netinet/tcp.h>        /* for inet_addr() */
  826. #endif /* I386IX */
  827. /*
  828.   Data type of the inet_addr() function...
  829.   We define INADDRX if it is of type struct inaddr.
  830.   If it is undefined, unsigned long is assumed.
  831.   Look at <arpa/inet.h> to find out.  The following known cases are
  832.   handled here.  Other systems that need it can be added here, or else
  833.   -DINADDRX can be included in the CFLAGS on the cc command line.
  834. */
  835. #ifndef NOINADDRX
  836. #ifdef DU2                /* DEC Ultrix 2.0 */
  837. #define INADDRX
  838. #endif /* DU2 */
  839. #endif /* NOINADDRX */
  840.  
  841. #else /* Not UNIX */
  842.  
  843. #ifdef VMS                /* (Open)VMS section */
  844.  
  845. #ifdef MULTINET                /* TGV MultiNet */
  846. /*
  847.   In C-Kermit 7.0 Beta.08 we started getting scads of compile time warnings
  848.   in Multinet builds: "blah" is implicitly declared as a function, where blah
  849.   is socket_read/write/close, ntohs, htons, getpeername, accept, select, etc.
  850.   I have no idea why -- these routines are declared in the header files below,
  851.   and the includes haven't changed.  The executable still seems to work OK.
  852.   Messing with the order of the following includes is disastrous.
  853. */
  854. #ifdef MULTINET_NO_PROTOTYPES
  855. #undef MULTINET_NO_PROTOTYPES
  856. #endif /* MULTINET_NO_PROTOTYPES */
  857.  
  858. #ifdef  __cplusplus
  859. #undef  __cplusplus
  860. #endif /*  __cplusplus */
  861.  
  862. #include "multinet_root:[multinet.include]errno.h"
  863. #include "multinet_root:[multinet.include.sys]types.h"
  864. #include "multinet_root:[multinet.include.sys]socket.h"
  865. #include "multinet_root:[multinet.include]netdb.h"
  866. #include "multinet_root:[multinet.include.netinet]in.h"
  867. #include "multinet_root:[multinet.include.arpa]inet.h"
  868. #include "multinet_root:[multinet.include.sys]ioctl.h"
  869.  
  870. #ifdef COMMENT
  871. /*
  872.   No longer needed because now bzero/bcopy are macros defined as
  873.   memset/memmove in all VMS builds.
  874. */
  875. /*
  876.   We should be able to pick these up from <strings.h> but it's
  877.   not portable between VAXC and DECC.  And even with DECC 5.x we have a
  878.   difference between VAX and Alpha.  We get warnings here on the VAX
  879.   with DECC 5.6-003 but they are not fatal.
  880. */
  881. #ifndef __DECC_VER
  882. #ifndef bzero
  883. _PROTOTYP( void bzero, (char *, int) );
  884. #endif /* bzero */
  885. #ifndef bcopy
  886. _PROTOTYP( void bcopy, (char *, char *, int) );
  887. #endif /* bcopy */
  888. #endif /* __DECC_VER */
  889. #endif /* COMMENT */
  890.  
  891. #ifdef __DECC
  892. /*
  893.    If compiling under DEC C the socket calls must not be prefixed with
  894.    DECC$.  This is done by using the compiler switch /Prefix=Ansi_C89.
  895.    However, this causes some calls that should be prefixed to not be
  896.    (which I think is a bug in the compiler - I've been told these calls
  897.    are present in ANSI compilers).  At any rate, such calls are fixed
  898.    here by explicitly prefixing them.
  899. */
  900. #ifdef COMMENT
  901. /*
  902.    But this causes errors with VMS 6.2 / DEC C 5.3-006 / MultiNet 4.0A on
  903.    a VAX (but not on an Alpha).  So now what happens if we skip doing this?
  904. */
  905. #define close decc$close
  906. #define alarm decc$alarm
  907. #endif /* COMMENT */
  908. #endif /* __DECC */
  909.  
  910. #else /* Not MULTINET */
  911.  
  912. #ifdef WINTCP                /* WIN/TCP = PathWay for VMS */
  913. #ifdef OLD_TWG
  914. #include "twg$tcp:[netdist.include.sys]errno.h"
  915. #include "twg$tcp:[netdist.include.sys]types2.h" /* avoid some duplicates */
  916. #else
  917. #include "twg$tcp:[netdist.include]socket_aliases.h"
  918. #include <errno.h>
  919. #include "twg$tcp:[netdist.include.sys]types.h"
  920. #endif /* OLD_TWG */
  921. #include "twg$tcp:[netdist.include.sys]socket.h"
  922. #include "twg$tcp:[netdist.include]netdb.h"
  923. #include "twg$tcp:[netdist.include.sys]domain.h"
  924. #include "twg$tcp:[netdist.include.sys]protosw.h"
  925. #include "twg$tcp:[netdist.include.netinet]in.h"
  926. #include "twg$tcp:[netdist.include.arpa]inet.h"
  927. #include "twg$tcp:[netdist.include.sys]ioctl.h"
  928.  
  929. #else /* Not WINTCP */
  930.  
  931. #ifdef DEC_TCPIP
  932. #ifdef UCX50
  933. #ifndef IF_DOT_H
  934. #define IF_DOT_H
  935. #endif /*  IF_DOT_H */
  936. #endif /* UCX50 */
  937.  
  938. #ifdef IF_DOT_H
  939. #include <if.h>                /* Needed to put up u_int typedef */
  940. #else
  941. #ifdef NEEDUINT
  942. typedef unsigned int u_int;
  943. #endif /* NEEDUINT */
  944. #endif /* IF_DOT_H */
  945.  
  946. #include <in.h>
  947. #include <netdb.h>
  948. #include <socket.h>
  949. #include "ckvioc.h"
  950. #define socket_errno errno
  951.  
  952. #ifdef COMMENT
  953. /*
  954.   No longer needed because now bzero/bcopy are macros defined as
  955.   memset/memmove in all VMS builds.
  956. */
  957. /*
  958.   Translation: In <strings.h>, which exists only for DECC >= 5.2, bzero()
  959.   and bcopy() are declared only for OpenVMS >= 7.0.  This still might need
  960.   adjustment for DECC 5.0 and higher.
  961. */
  962. #ifdef __DECC_VER
  963. #ifdef VMSV70
  964. /*
  965.   Note: you can't use "#if (__VMS_VER>=70000000)" because that is not
  966.   portable and kills non-VMS builds.
  967. */
  968. #include <strings.h>
  969. #else
  970. #define bzero(s,n) memset(s,0,n)
  971. #define bcopy(h,a,l) memmove(a,h,l)
  972. #endif /* VMSV70 */
  973. #else
  974. #define bzero(s,n) memset(s,0,n)
  975. #define bcopy(h,a,l) memmove(a,h,l)
  976. #endif /* __DECC_VER */
  977. #endif /* COMMENT */
  978.  
  979. #define socket_read     read
  980. #define socket_write     write
  981. #define socket_ioctl    ioctl
  982. #define socket_close    close
  983.  
  984. #ifdef __DECC
  985. int ioctl (int d, int request, void *argp);
  986. #else
  987. int ioctl (int d, int request, char *argp);
  988. #endif /* DECC */
  989. /*
  990.   UCX supports select(), but does not provide the needed symbol and
  991.   structure definitions in any header file, so ...
  992. */
  993. #include <types.h>
  994. #ifndef NBBY
  995. /*-
  996.  * Copyright (c) 1982, 1986, 1991, 1993
  997.  *    The Regents of the University of California.  All rights reserved.
  998.  *
  999.  * Redistribution and use in source and binary forms, with or without
  1000.  * modification, are permitted provided that the following conditions
  1001.  * are met:
  1002.  * 1. Redistributions of source code must retain the above copyright
  1003.  *    notice, this list of conditions and the following disclaimer.
  1004.  * 2. Redistributions in binary form must reproduce the above copyright
  1005.  *    notice, this list of conditions and the following disclaimer in the
  1006.  *    documentation and/or other materials provided with the distribution.
  1007.  * 3. All advertising materials mentioning features or use of this software
  1008.  *    must display the following acknowledgement:
  1009.  *    This product includes software developed by the University of
  1010.  *    California, Berkeley and its contributors.
  1011.  * 4. Neither the name of the University nor the names of its contributors
  1012.  *    may be used to endorse or promote products derived from this software
  1013.  *    without specific prior written permission.
  1014.  *
  1015.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1016.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1017.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1018.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1019.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1020.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1021.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1022.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1023.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1024.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1025.  * SUCH DAMAGE.
  1026.  *
  1027.  *    @(#)types.h    8.1 (Berkeley) 6/2/93
  1028.  */
  1029.  
  1030. #define    NBBY    8        /* number of bits in a byte */
  1031.  
  1032. /*
  1033.  * Select uses bit masks of file descriptors in longs.  These macros
  1034.  * manipulate such bit fields (the filesystem macros use chars).
  1035.  * FD_SETSIZE may be defined by the user, but the default here should
  1036.  * be enough for most uses.
  1037.  */
  1038. #ifndef    FD_SETSIZE
  1039. #define    FD_SETSIZE    256
  1040. #endif
  1041.  
  1042. typedef long    fd_mask;
  1043. #define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  1044.  
  1045. #ifndef howmany
  1046. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  1047. #endif
  1048.  
  1049. typedef    struct fd_set {
  1050.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  1051. } fd_set;
  1052.  
  1053. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  1054. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  1055. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  1056. #define    FD_COPY(f, t)    bcopy(f, t, sizeof(*(f)))
  1057. #define    FD_ZERO(p)    bzero(p, sizeof(*(p)))
  1058. #endif /* !NBBY */
  1059.  
  1060. #else  /* Not DEC_TCPIP */
  1061.  
  1062. #ifdef CMU_TCPIP
  1063. #include <types.h>
  1064. #include <in.h>
  1065. #include <netdb.h>
  1066. #include <socket.h>
  1067. #include <ioctl.h>
  1068. #include "ckvioc.h"
  1069. #define socket_errno errno
  1070. #ifdef COMMENT
  1071. /* This is now done above for all VMS builds */
  1072. #define bzero(s,n) memset(s,0,n)
  1073. #define bcopy(h,a,l) memmove(a,h,l)
  1074. #endif /* COMMENT */
  1075.  
  1076. /*
  1077.  * Routines supplied in LIBCMU.OLB
  1078.  */
  1079. #define socket_ioctl    ioctl
  1080. #define socket_read     cmu_read
  1081. #define socket_write     cmu_write
  1082. #define socket_close    cmu_close
  1083.  
  1084. #endif /* CMU_TCPIP */
  1085. #endif /* DEC_TCPIP */
  1086. #endif /* WINTCP */
  1087. #endif /* MULTINET */
  1088.  
  1089. #else /* Not VMS */
  1090.  
  1091. #ifdef OS2
  1092. #include "ckonet.h"
  1093. #ifndef NT
  1094. #include <nerrno.h>
  1095. #endif
  1096. #endif /* OS2 */
  1097.  
  1098. #ifdef STRATUS  /* Stratus VOS using OS TCP/IP products S235, S236, S237 */
  1099. #include <tcp_socket.h>
  1100. /* This gets used some places when TCPSOCKET is defined. */
  1101. /* OS TCP provides bzero(), but not bcopy()... go figure. */
  1102. #define bcopy(s,d,z) memcpy(d,s,z)
  1103. #endif /* STRATUS */
  1104.  
  1105. #ifdef OSK
  1106. #include <inet/in.h>
  1107. #include <inet/netdb.h>
  1108. #include <inet/socket.h>
  1109. #define bzero(s,n) memset(s,0,n)
  1110. #define bcopy(h,a,l) memcpy(a,h,l)
  1111. typedef char * caddr_t; /* core address type */
  1112. #endif /* OSK */
  1113.  
  1114. #endif /* VMS */
  1115. #endif /* UNIX */
  1116. #endif /* TCPSOCKET */
  1117.  
  1118. #ifdef TNCODE                /* If we're compiling telnet code... */
  1119. #ifndef IKS_OPTION
  1120. #ifndef STRATUS
  1121. #define IKS_OPTION
  1122. #endif /* STRATUS */
  1123. #endif /* IKS_OPTION */
  1124. #include "ckctel.h"
  1125. #else
  1126. extern int sstelnet;
  1127. #ifdef IKSD
  1128. #undef IKSD
  1129. #endif /* IKSD */
  1130. #ifndef NOIKSD
  1131. #define NOIKSD
  1132. #endif /* NOIKSD */
  1133. #ifdef IKS_OPTION
  1134. #undef IKS_OPTION
  1135. #endif /* IKS_OPTION */
  1136. #endif /* TNCODE */
  1137.  
  1138. #ifndef NOTCPOPTS
  1139. /*
  1140.   Automatically define NOTCPOPTS for configurations where they can't be
  1141.   used at runtime or cause too much trouble at compile time.
  1142. */
  1143. #ifdef CMU_TCPIP            /* CMU/Tek */
  1144. #define NOTCPOPTS
  1145. #endif /* CMU_TCPIP */
  1146. #ifdef MULTINET                /* Multinet on Alpha */
  1147. #ifdef __alpha
  1148. #define NOTCPOPTS
  1149. #endif /* __alpha */
  1150. #endif /* MULTINET */
  1151. #endif /* NOTCPOPTS */
  1152.  
  1153. #ifdef NOTCPOPTS
  1154. #ifdef TCP_NODELAY
  1155. #undef TCP_NODELAY
  1156. #endif /* TCP_NODELAY */
  1157. #ifdef SO_LINGER
  1158. #undef SO_LINGER
  1159. #endif /* SO_LINGER */
  1160. #ifdef SO_KEEPALIVE
  1161. #undef SO_KEEPALIVE
  1162. #endif /* SO_KEEPALIVE */
  1163. #ifdef SO_SNDBUF
  1164. #undef SO_SNDBUF
  1165. #endif /* SO_SNDBUF */
  1166. #ifdef SO_RCVBUF
  1167. #undef SO_RCVBUF
  1168. #endif /* SO_RCVBUF */
  1169. #endif /* NOTCPOPTS */
  1170.  
  1171. #ifdef TCPSOCKET
  1172. #ifdef SOL_SOCKET
  1173. #ifdef TCP_NODELAY
  1174. _PROTOTYP( int no_delay, (int) );
  1175. #endif /* TCP_NODELAY */
  1176. #ifdef SO_KEEPALIVE
  1177. _PROTOTYP( int keepalive, (int) ) ;
  1178. #endif /* SO_KEEPALIVE */
  1179. #ifdef SO_LINGER
  1180. _PROTOTYP( int ck_linger, (int, int) ) ;
  1181. #endif /* SO_LINGER */
  1182. #ifdef SO_SNDBUF
  1183. _PROTOTYP( int sendbuf,(int) ) ;
  1184. #endif /* SO_SNDBUF */
  1185. #ifdef SO_RCVBUF
  1186. _PROTOTYP( int recvbuf, (int) ) ;
  1187. #endif /* SO_RCVBUF */
  1188. #ifdef SO_DONTROUTE
  1189. _PROTOTYP(int dontroute, (int));
  1190. #endif /* SO_DONTROUTE */
  1191. #endif /* SOL_SOCKET */
  1192. _PROTOTYP( int getlocalipaddr, (VOID));
  1193. _PROTOTYP( int getlocalipaddrs, (char *,int,int));
  1194. _PROTOTYP( char * ckgetpeer, (VOID));
  1195. _PROTOTYP( char * ckgetfqhostname,(char *));
  1196.  
  1197. /* AIX */
  1198.  
  1199. #ifdef AIXRS
  1200. #ifndef TCP_NODELAY
  1201. #define TCP_NODELAY 0x1
  1202. #endif /* TCP_NODELAY */
  1203. #ifndef TCP_MAXSEG
  1204. #define TCP_MAXSEG 0x2
  1205. #endif /* TCP_MAXSEG */
  1206. #ifndef TCP_KEEPALIVE
  1207. #define TCP_KEEPALIVE 0x8
  1208. #endif /* TCP_KEEPALIVE */
  1209. #endif /* AIXRS */
  1210. #endif /* TCPSOCKET */
  1211.  
  1212. #ifdef RLOGCODE
  1213. #ifndef CK_TTGWSIZ
  1214. SORRY_RLOGIN_REQUIRES_TTGWSIZ_see_ckcplm.doc
  1215. #endif /* CK_TTGWSIZ */
  1216. #endif /* RLOGCODE */
  1217.  
  1218. #ifdef CK_NAWS
  1219. #ifndef CK_TTGWSIZ
  1220. SORRY_CK_NAWS_REQUIRES_TTGWSIZ_see_ckcplm.doc
  1221. #endif /* CK_TTGWSIZ */
  1222. #endif /* CK_NAWS */
  1223.  
  1224. #ifndef PF_INET
  1225. #ifdef  AF_INET
  1226. #define PF_INET AF_INET
  1227. #endif /* AF_INET */
  1228. #endif /* PF_INET */
  1229.  
  1230. #ifndef IPPORT_ECHO
  1231. #define IPPORT_ECHO 7
  1232. #endif /* IPPORT_ECHO */
  1233.  
  1234. #ifdef CK_KERBEROS
  1235. #ifdef RLOGCODE
  1236. _PROTOTYP(int ck_krb_rlogin,(CHAR *, int, CHAR *, CHAR *, CHAR *,
  1237.                               struct sockaddr_in *,
  1238.                               struct sockaddr_in *, int, int));
  1239. #endif /* RLOGCODE */
  1240. #endif /* CK_KERBEROS */
  1241.  
  1242. _PROTOTYP( VOID ini_kerb, ( void ) );   /* Kerberos initialization routine */
  1243. _PROTOTYP( int doauth, (int) );         /* AUTHENTICATE action routine */
  1244.  
  1245. #ifdef CK_DNS_SRV
  1246. _PROTOTYP(int locate_srv_dns,(const char *host, const char *service,
  1247.                   const char *protocol, struct sockaddr **addr_pp,
  1248.                   int *naddrs));
  1249. #endif /* CK_DNS_SRV */
  1250.  
  1251. #ifndef NOHTTP
  1252. _PROTOTYP(int http_get, (char *,char **,char *,char *,char,char *,char *));
  1253. _PROTOTYP(int http_head, (char *,char **,char *,char *,char,char *,char *));
  1254. _PROTOTYP(int http_put, (char *,char **,char *,char *,char *,char,char *,
  1255.              char *));
  1256. _PROTOTYP(int http_delete, (char *,char **,char *,char *,char,char *));
  1257. _PROTOTYP(int http_post, (char *,char **,char *,char *,char *,char,char *,
  1258.           char *));
  1259. _PROTOTYP(int http_index, (char *,char **,char *,char *,char,char *,char *));
  1260. #endif /* NOHTTP */
  1261.  
  1262. #endif /* CKCNET_H */
  1263.