home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / old / ckermit5a188 / ckcnet.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  11KB  |  391 lines

  1. #ifndef CKCNET_H
  2. #define CKCNET_H
  3.  
  4. /* Network types */
  5.  
  6. #define NET_NONE 0            /* None */
  7. #define NET_TCPB 1            /* TCP/IP Berkeley (socket) */
  8. #define NET_TCPA 2            /* TCP/IP AT&T (streams) */
  9. #define NET_SX25 3            /* SUNOS SunLink X.25 */
  10. #define NET_DEC  4            /* DECnet */
  11. #define NET_VPSI 5            /* VAX PSI */
  12. #define NET_PIPE 6            /* LAN Manager Named Pipe */
  13.  
  14. /* Network virtual terminal protocols */
  15.  
  16. #define NP_NONE 0            /* None (async) */
  17. #define NP_TELNET 1            /* TCP/IP telnet */
  18. #define NP_VTP 2            /* ISO Virtual Terminal Protocol */
  19. #define NP_X3 3                /* CCITT X.3 */
  20. #define NP_X28 4            /* CCITT X.28 */
  21. #define NP_X29 5            /* CCITT X.28 */
  22. #define NP_CTERM 20            /* DEC CTERM */
  23. #define NP_LAT 21            /* DEC LAT */
  24. /* others here... */
  25.  
  26. /* Basic network function prototypes, common to all. */
  27.  
  28. _PROTOTYP( int netopen, (char *, int *, int) );
  29. _PROTOTYP( int netclos, (void) );
  30. _PROTOTYP( int netflui, (void) );
  31. _PROTOTYP( int nettchk, (void) );
  32. _PROTOTYP( int netbreak, (void) );
  33. _PROTOTYP( int netinc, (int) );
  34. _PROTOTYP( int nettol, (char *, int) );
  35. _PROTOTYP( int nettoc, (char) );
  36.  
  37. /*
  38.   SunLink X.25 support by Marcello Frutig, Catholic University,
  39.   Rio de Janeiro, Brazil, 1990.
  40.  
  41.   Maybe this can be adapted to VAX PSI and other X.25 products too.
  42. */
  43. #ifndef SUNOS4                /* Only valid for SUNOS4 */
  44. #ifdef SUNX25
  45. #undef SUNX25
  46. #endif /* SUNX25 */
  47. #endif /* SUNOS4 */
  48.  
  49. #ifdef SUNX25
  50.  
  51. #ifndef NETCONN                /* SUNX25 implies NETCONN */
  52. #define NETCONN
  53. #endif /* NETCONN */
  54.  
  55. #define MAXPADPARMS                18    /* Number of PAD parameters */
  56. #define MAXCUDATA           12    /* Max length of X.25 call user data */
  57. #define X29PID                1   /* X.29 protocol ID */
  58. #define X29PIDLEN            4   /* X.29 protocol ID length */
  59.  
  60. #define X29_SET_PARMS               2
  61. #define X29_READ_PARMS              4
  62. #define X29_SET_AND_READ_PARMS      6
  63. #define X29_INVITATION_TO_CLEAR     1
  64. #define X29_PARAMETER_INDICATION    0
  65. #define X29_INDICATION_OF_BREAK     3
  66. #define X29_ERROR                   5
  67.  
  68. #define INVALID_PAD_PARM            1
  69.  
  70. #define PAD_BREAK_CHARACTER         0
  71.  
  72. #define PAD_ESCAPE                  1
  73. #define PAD_ECHO                    2
  74. #define PAD_DATA_FORWARD_CHAR       3
  75. #define PAD_DATA_FORWARD_TIMEOUT    4
  76. #define PAD_FLOW_CONTROL_BY_PAD     5
  77. #define PAD_SUPPRESSION_OF_SIGNALS  6
  78. #define PAD_BREAK_ACTION            7
  79. #define PAD_SUPPRESSION_OF_DATA     8
  80. #define PAD_PADDING_AFTER_CR        9
  81. #define PAD_LINE_FOLDING           10
  82. #define PAD_LINE_SPEED             11
  83. #define PAD_FLOW_CONTROL_BY_USER   12
  84. #define PAD_LF_AFTER_CR            13
  85. #define PAD_PADDING_AFTER_LF       14
  86. #define PAD_EDITING                15
  87. #define PAD_CHAR_DELETE_CHAR       16
  88. #define PAD_BUFFER_DELETE_CHAR     17
  89. #define PAD_BUFFER_DISPLAY_CHAR    18
  90.  
  91. #define MAXIX25 MAX_USER_DATA*7
  92. #define MAXOX25 MAX_USER_DATA
  93.  
  94. #include <sys/ioctl.h>            /* X.25 includes */
  95. #include <sys/param.h>
  96. #include <sys/systm.h>
  97. #include <sys/mbuf.h>
  98. #include <sys/socket.h>
  99. #include <sys/protosw.h>
  100. #include <sys/domain.h>
  101. #include <sys/socketvar.h>
  102. #include <net/if.h>
  103. #include <sundev/syncstat.h>
  104. #include <netx25/x25_pk.h>
  105. #include <netx25/x25_ctl.h>
  106. #include <netx25/x25_ioctl.h>
  107.  
  108. /* C-Kermit X.3 / X.25 / X.29 / X.121 support functions */
  109.  
  110. _PROTOTYP( VOID shopad, (void) );
  111. _PROTOTYP( VOID initpad, (void) );
  112. _PROTOTYP( VOID setpad, (CHAR *, int) );
  113. _PROTOTYP( VOID readpad, (CHAR *, int, CHAR *) );
  114. _PROTOTYP( int qbitpkt, (CHAR *, int) );
  115. _PROTOTYP( VOID setqbit, (void) );
  116. _PROTOTYP( VOID resetqbit, (void) );
  117. _PROTOTYP( VOID breakact, (void) );
  118. _PROTOTYP( int pkx121, (char *, CHAR *) );
  119. _PROTOTYP( VOID x25oobh, (void) );
  120. _PROTOTYP( int x25diag, (void) );
  121. _PROTOTYP( int x25intr, (char) );
  122. _PROTOTYP( int x25reset, (char, char) );
  123. _PROTOTYP( int x25clear, (void) );
  124. _PROTOTYP( int x25stat, (void) );
  125. _PROTOTYP( int x25in, (int, CHAR *) );
  126. _PROTOTYP( int x25inl, (CHAR *, int, int, CHAR) );
  127.  
  128. #endif /* SUNX25 */
  129.  
  130. /* DEC TCP/IP for (Open)VMS, previously known as UCX */
  131.  
  132. #ifdef DEC_TCPIP            /* DEC_TCPIP implies TCPSOCKET */
  133. #ifndef TCPSOCKET
  134. #define TCPSOCKET
  135. #endif /* TCPSOCKET */
  136. #ifndef VMSTCPIP
  137. #define VMSTCPIP
  138. #endif /* VMSTCPIP */
  139. #endif /* DEC_TCPIP */
  140.  
  141. /* TGV/SRI MultiNet, TCP/IP for VAX/VMS */
  142.  
  143. #ifdef MULTINET                /* MULTINET implies TCPSOCKET */
  144. #ifndef TCPSOCKET
  145. #define TCPSOCKET
  146. #endif /* TCPSOCKET */
  147. #ifndef VMSTCPIP
  148. #define VMSTCPIP
  149. #endif /* VMSTCPIP */
  150. #ifndef TGVORWIN            /* MULTINET and WINTCP */
  151. #define TGVORWIN            /* share a lot of code... */
  152. #endif /* TGVORWIN */
  153. #endif /* MULTINET */
  154.  
  155. /* Wollongong TCP/IP for VAX/VMS */
  156.  
  157. #ifdef WINTCP                /* WINTCP implies TCPSOCKET */
  158. #ifndef TCPSOCKET
  159. #define TCPSOCKET
  160. #endif /* TCPSOCKET */
  161. #ifndef VMSTCPIP
  162. #define VMSTCPIP
  163. #endif /* VMSTCPIP */
  164. #ifndef TGVORWIN            /* WINTCP and MULTINET */
  165. #define TGVORWIN            /* share a lot of code... */
  166. #endif /* TGVORWIN */
  167. #endif /* WINTCP */
  168.  
  169. /* Wollongong TCP/IP for AT&T Sys V */
  170.  
  171. #ifdef WOLLONGONG            /* WOLLONGONG implies TCPSOCKET */
  172. #ifndef TCPSOCKET            /* Don't confuse WOLLONGONG */
  173. #define TCPSOCKET            /* (which is for UNIX) with */
  174. #endif /* TCPSOCKET */            /* WINTCP, which is for VMS! */
  175. #endif /* WOLLONGONG */
  176.  
  177. #ifdef EXCELAN                /* EXCELAN implies TCPSOCKET */
  178. #ifndef TCPSOCKET
  179. #define TCPSOCKET
  180. #endif /* TCPSOCKET */
  181. #endif /* EXCELAN */
  182.  
  183. #ifdef INTERLAN                /* INTERLAN implies TCPSOCKET */
  184. #ifndef TCPSOCKET
  185. #define TCPSOCKET
  186. #endif /* TCPSOCKET */
  187. #endif /* INTERLAN */
  188.  
  189. /* Telnet protocol */
  190.  
  191. #ifdef TCPSOCKET            /* TCPSOCKET implies TNCODE */
  192. #ifndef TNCODE                /* Which means... */
  193. #define TNCODE                /* Compile in telnet code */
  194. #endif /* TNCODE */
  195. #endif /* TCPSOCKET */
  196.  
  197. #ifdef SUNX25                /* SUNX25 implies TCPSOCKET */
  198. #ifndef TCPSOCKET            /* But doesn't imply TNCODE */
  199. #define TCPSOCKET
  200. #endif /* TCPSOCKET */
  201. #endif /* SUNX25 */
  202.  
  203. /* This is the TCPSOCKET section... */
  204.  
  205. #ifdef TCPSOCKET
  206.  
  207. #ifndef NETCONN                /* TCPSOCKET implies NETCONN */
  208. #define NETCONN
  209. #endif /* NETCONN */
  210.  
  211. /* BSD sockets library header files */
  212.  
  213. #ifdef UNIX                /* UNIX section */
  214.  
  215. #ifdef INTERLAN                /* Racal-Interlan TCP/IP */
  216. #include <interlan/socket.h>
  217. #include <interlan/il_types.h>
  218. #include <interlan/telnet.h>
  219. #include <interlan/il_errno.h>
  220. #include <interlan/in.h>
  221. #include <interlan/telnet.h>
  222. #else                    /* Normal BSD TCP/IP library */
  223. #ifndef HPUX
  224. #include <arpa/telnet.h>
  225. #endif /* HPUX */
  226. #include <sys/socket.h>
  227. #ifdef WOLLONGONG
  228. #include <sys/in.h>
  229. #else
  230. #include <netinet/in.h>
  231. #endif /* WOLLONGONG */
  232. #endif /* INTERLAN */
  233.  
  234. #ifndef EXCELAN
  235. #include <netdb.h>
  236. #ifndef INTERLAN
  237. #ifdef WOLLONGONG
  238. #define minor                /* Do not include <sys/macros.h> */
  239. #include <sys/inet.h>
  240. #else
  241. #ifndef OXOS
  242. #ifndef HPUX
  243. #include <arpa/inet.h>
  244. #endif /* HPUX */
  245. #else /* OXOS */
  246. /* In too many releases of X/OS, <arpa/inet.h> declares inet_addr() as
  247.  * ``struct in_addr''.  This is definitively wrong, and could cause
  248.  * core dumps.  Instead of including that bad file, inet_addr() is
  249.  * correctly declared here.  Of course, all the declarations done there
  250.  * has been copied here.
  251.  */
  252. unsigned long inet_addr();
  253. char    *inet_ntoa();
  254. struct    in_addr inet_makeaddr();
  255. unsigned long inet_network();
  256. #endif /* OXOS */
  257. #endif /* WOLLONGONG */
  258. #endif /* INTERLAN */
  259. #endif /* EXCELAN */
  260.  
  261. #ifdef EXCELAN                /* Excelan TCP/IP */
  262. #include <ex_errno.h>
  263. #endif /* EXCELAN */
  264.  
  265. #ifdef I386IX                /* Interactive Sys V R3 network. */
  266. /* #define TELOPTS */            /* This might need defining. */
  267. #define ORG_NLONG ENAMETOOLONG        /* Resolve conflicting symbols */
  268. #undef ENAMETOOLONG            /* in <errno.h> and <net/errno.h> */
  269. #define ORG_NEMPTY ENOTEMPTY
  270. #undef ENOTEMPTY
  271. #include <net/errno.h>
  272. #undef ENAMETOOLONG
  273. #define ENAMETOOLONG ORG_NLONG
  274. #undef ENOTEMPTY
  275. #define ENOTEMPTY ORG_NEMPTY
  276. #endif /* I386IX */
  277. /*
  278.   Data type of the inet_addr() function...
  279.   We define INADDRX if it is of type struct inaddr.
  280.   If it is undefined, unsigned long is assumed.
  281.   Look at <arpa/inet.h> to find out.  The following known cases are
  282.   handled here.  Other systems that need it can be added here, or else
  283.   -DINADDRX can be included in the CFLAGS on the cc command line.
  284. */
  285. #ifdef DGUX540                /* Data General UX 5.40 */
  286. #define INADDRX
  287. #endif /* DGUX540 */
  288. #ifdef DU2                /* DEC Ultrix 2.0 */
  289. #define INADDRX
  290. #endif /* DU2 */
  291.  
  292. #else /* Not UNIX */
  293.  
  294. #ifdef VMS                /* VAX/VMS section */
  295.  
  296. #ifdef WINTCP                /* TWG WIN/TCP for VMS */
  297. #include <errno.h>
  298. #include "twg$tcp:[netdist.include.sys]types.h"
  299. #include "twg$tcp:[netdist.include.sys]socket.h"
  300. #include "twg$tcp:[netdist.include]netdb.h"
  301. #include "twg$tcp:[netdist.include.sys]domain.h"
  302. #include "twg$tcp:[netdist.include.sys]protosw.h"
  303. #include "twg$tcp:[netdist.include.netinet]in.h"
  304. #include "twg$tcp:[netdist.include.sys]ioctl.h"
  305. #endif /* WINTCP */
  306.  
  307. #ifdef MULTINET                /* TGV MultiNet */
  308. #include "multinet_root:[multinet.include]errno.h"
  309. #include "multinet_root:[multinet.include.sys]types.h"
  310. #include "multinet_root:[multinet.include.sys]socket.h"
  311. #include "multinet_root:[multinet.include]netdb.h"
  312. #include "multinet_root:[multinet.include.netinet]in.h"
  313. #include "multinet_root:[multinet.include.sys]ioctl.h"
  314. #endif /* MULTINET */
  315.  
  316. #ifdef DEC_TCPIP
  317. #include <in.h>
  318. #include <netdb.h>
  319. #include <socket.h>
  320. #include "ckvioc.h"
  321. #define socket_errno errno
  322. #define bzero(s,n) memset(s,0,n) 
  323. #define bcopy(h,a,l) memmove(a,h,l)
  324. #define socket_read     read
  325. #define socket_write     write
  326. #define socket_ioctl    ioctl
  327. #define socket_close    close
  328. #endif /* DEC_TCPIP */
  329.  
  330. #endif /* VMS */
  331. #endif /* UNIX */
  332. #endif /* TCPSOCKET */
  333.  
  334. #ifdef TNCODE                /* If we're compiling telnet code... */
  335. /*
  336.   Make sure telnet symbols are defined; can't rely on library header files
  337.   for any of them.
  338. */
  339. #ifndef IAC                /* First the telnet commands */
  340. #define IAC 255
  341. #endif /* IAC */
  342. #ifndef DONT
  343. #define DONT 254
  344. #endif /* DONT */
  345. #ifndef DO
  346. #define DO 253
  347. #endif /* DO */
  348. #ifndef WONT
  349. #define WONT 252
  350. #endif /* WONT */
  351. #ifndef WILL
  352. #define WILL 251
  353. #endif /* WILL */
  354. #ifndef SB
  355. #define SB 250
  356. #endif /* SB */
  357. #ifndef BREAK
  358. #define BREAK 243
  359. #endif /* BREAK */
  360. #ifndef SE
  361. #define SE 240
  362. #endif /* SE */
  363.  
  364. #ifndef TELOPT_ECHO            /* Then the options */
  365. #define TELOPT_ECHO 1
  366. #endif /* TELOPT_ECHO */
  367. #ifndef TELOPT_SGA
  368. #define    TELOPT_SGA 3
  369. #endif /* TELOPT_SGA */
  370. #ifndef TELOPT_STATUS
  371. #define    TELOPT_STATUS 5
  372. #endif /* TELOPT_STATUS */
  373. #ifndef TELOPT_TTYPE
  374. #define    TELOPT_TTYPE 24
  375. #endif /* TELOPT_TTYPE */
  376. #ifndef NTELOPTS
  377. #define    NTELOPTS 24
  378. #endif /* NTELOPTS */
  379.  
  380. /* Telnet protocol functions defined in C-Kermit */
  381.  
  382. _PROTOTYP( int tn_ini, (void) );    /* Telnet protocol support */
  383. _PROTOTYP( int tn_sopt, (int, int) );
  384. _PROTOTYP( int tn_doop, (CHAR, int, int (*)(int) ) );
  385. _PROTOTYP( int tn_sttyp, (void) );
  386. _PROTOTYP( int tnsndbrk, (void) );
  387.  
  388. #endif /* TNCODE */
  389.  
  390. #endif /* CKCNET_H */
  391.