home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / PPPBCKP / SRC / SRC15B96.ZIP / WATTCP.H < prev    next >
C/C++ Source or Header  |  1998-11-13  |  20KB  |  702 lines

  1.  
  2. #ifndef _wattcp_wattcp_h
  3. #define _wattcp_wattcp_h
  4.  
  5. /*
  6.  * Are we compiling the kernel?
  7.  *    or an application using the kernel?
  8.  */
  9. #if !defined(__WATTCP_USER__)
  10. #define __WATTCP_KERNEL__
  11. #endif
  12.  
  13. /*
  14.  * Note that some stuff is not available to user applications.
  15.  *   This is generally detail you shouldn't need to worry about,
  16.  *   and best stay away from to preserve the kernel integrity.
  17.  * Note also that there is a lot of other stuff that should probably
  18.  *   be protected but isn't.
  19.  */
  20.  
  21. #define WATTCPH
  22.  
  23. /* these are visible for select.c routine return values */
  24. #define SOCKESTABLISHED 1
  25. #define SOCKDATAREADY   2
  26. #define SOCKCLOSED      4
  27.  
  28. #if defined(__WATTCP_KERNEL__)
  29.  
  30. #define IP_TYPE     0x0008
  31.  
  32. #include <stdio.h>
  33. #include <elib.h>
  34.  
  35. #define MAX_GATE_DATA 12
  36. #define MAX_STRING 50   /* most strings are limited */
  37. #endif  /* defined(__WATTCP_KERNEL__) */
  38.  
  39. #define MAX_NAMESERVERS 10
  40. #define MAX_COOKIES 10
  41.  
  42. #if defined(__WATTCP_KERNEL__)
  43.  
  44. #define MAXVJSA     1440 /* 10 s */
  45. #define MAXVJSD     360  /* 10 s */
  46. #define SAFETYTCP  0x538f25a3L
  47. #define SAFETYUDP  0x3e45e154L
  48. #define TRUE        1
  49. #define true        TRUE
  50. #define FALSE       0
  51. #define false       FALSE
  52.  
  53. #define EL_INUSE        0x0001
  54. #define EL_DELAY        0x0002
  55. #define EL_TCP          0x0004
  56. #define EL_SERVER       0x0008
  57. #define EL_ASCII        0x0010
  58. #define EL_NEVER        0x0020
  59.  
  60. /* These are Ethernet protocol numbers but I use them for other things too */
  61. #define UDP_PROTO  0x11
  62. #define TCP_PROTO  0x06
  63. #define ICMP_PROTO 0x01
  64.  
  65. #endif /* defined(__WATTCP_KERNEL__) */
  66.  
  67. #define TCP_MODE_BINARY  0       /* default mode */
  68. #define TCP_MODE_ASCII   1
  69. #define UDP_MODE_CHK     0       /* default to having checksums */
  70. #define UDP_MODE_NOCHK   2       /* turn off checksums */
  71. #define TCP_MODE_NAGLE   0       /* Nagle algorithm */
  72. #define TCP_MODE_NONAGLE 4
  73.  
  74. typedef unsigned long longword;     /* 32 bits */
  75. typedef unsigned short word;        /* 16 bits */
  76. typedef unsigned char byte;         /*  8 bits */
  77.  
  78. typedef struct { byte eaddr[6]; } eth_address;    // 94.11.19 -- made an array
  79.  
  80. #if defined(__WATTCP_KERNEL__)
  81.  
  82. /* undesirable */
  83. extern longword MsecClock();
  84. #define clock_ValueRough() MsecClock()
  85.  
  86. #define TICKS_SEC 18
  87.  
  88. #define checksum( p, len) inchksum( p, len )
  89.  
  90. #define PD_ETHER 1
  91. #define PD_SLIP  6
  92.  
  93. extern word sock_inactive;      /* in pcbootp.c */
  94. extern word _pktdevclass;
  95. extern word _mss;
  96. extern word _bootptimeout;      /* in pcbootp.c */
  97. extern longword _bootphost;     /* in pcbootp.c */
  98. extern word _bootpon;
  99.  
  100. /* The Ethernet header */
  101. typedef struct {
  102.     eth_address     destination;
  103.     eth_address     source;
  104.     word            type;
  105. } eth_Header;
  106.  
  107. /* The Internet Header: */
  108. typedef struct {
  109.     unsigned        hdrlen  : 4;
  110.     unsigned        ver     : 4;
  111.     byte            tos;
  112.     word            length;
  113.     word            identification;
  114.     word            frags;
  115.     byte            ttl;
  116.     byte            proto;
  117.     word            checksum;
  118.     longword        source;
  119.     longword        destination;
  120. } in_Header;
  121.  
  122.  
  123. #define in_GetVersion(ip) ( (ip)->ver )
  124. #define in_GetHdrlen(ip)  ( (ip)->hdrlen )  /* 32 bit word size */
  125. #define in_GetHdrlenBytes(ip)  ( in_GetHdrlen(ip) << 2 ) /* 8 bit byte size */
  126. #define in_GetTos(ip)      ( (ip)->tos)
  127.  
  128. #define in_GetTTL(ip)      ((ip)->ttl)
  129. #define in_GetProtocol(ip) ((ip)->proto )
  130.  
  131. typedef struct {
  132.     word            srcPort;
  133.     word            dstPort;
  134.     word            length;
  135.     word            checksum;
  136. } udp_Header;
  137.  
  138. #define UDP_LENGTH ( sizeof( udp_Header ))
  139.  
  140. typedef struct {
  141.     word            srcPort;
  142.     word            dstPort;
  143.     longword        seqnum;
  144.     longword        acknum;
  145.     word            flags;
  146.     word            window;
  147.     word            checksum;
  148.     word            urgentPointer;
  149. } tcp_Header;
  150.  
  151. #define tcp_FlagFIN     0x0001
  152. #define tcp_FlagSYN     0x0002
  153. #define tcp_FlagRST     0x0004
  154. #define tcp_FlagPUSH    0x0008
  155. #define tcp_FlagACK     0x0010
  156. #define tcp_FlagURG     0x0020
  157. #define tcp_FlagDO      0xF000
  158. #define tcp_GetDataOffset(tp) (intel16((tp)->flags) >> 12)
  159.  
  160. #endif
  161.  
  162. /* The TCP/UDP Pseudo Header */
  163. typedef struct {
  164.     longword    src;
  165.     longword    dst;
  166.     byte        mbz;
  167.     byte        protocol;
  168.     word        length;
  169.     word        checksum;
  170. } tcp_PseudoHeader;
  171.  
  172.  
  173. /* A datahandler for tcp or udp sockets */
  174. typedef int (*dataHandler_t)( void *s, byte *data, int len, tcp_PseudoHeader *pseudohdr, void *protohdr );
  175. /* A socket function for delay routines */
  176. typedef int (*sockfunct_t)( void *s );
  177.  
  178. #if defined(__WATTCP_KERNEL__)
  179. /*
  180.  * TCP states, from tcp manual.
  181.  * Note: close-wait state is bypassed by automatically closing a connection
  182.  *       when a FIN is received.  This is easy to undo.
  183.  */
  184. #define tcp_StateLISTEN  0      /* listening for connection */
  185. #define tcp_StateSYNSENT 1      /* syn sent, active open */
  186. #define tcp_StateSYNREC  2      /* syn received, synack+syn sent. */
  187. #define tcp_StateESTAB   3      /* established */
  188. #define tcp_StateESTCL   4      /* established, but will FIN */
  189. #define tcp_StateFINWT1  5      /* sent FIN */
  190. #define tcp_StateFINWT2  6      /* sent FIN, received FINACK */
  191. #define tcp_StateCLOSWT  7      /* received FIN waiting for close */
  192. #define tcp_StateCLOSING 8      /* sent FIN, received FIN (waiting for FINACK) */
  193. #define tcp_StateLASTACK 9      /* fin received, finack+fin sent */
  194. #define tcp_StateTIMEWT  10     /* dally after sending final FINACK */
  195. #define tcp_StateCLOSEMSL 11
  196. #define tcp_StateCLOSED  12     /* finack received */
  197.  
  198. #define tcp_MaxBufSize 2048         /* maximum bytes to buffer on input */
  199.  
  200. #endif
  201.  
  202.  
  203. #if defined(__WATTCP_KERNEL__)
  204. /*
  205.  * UDP socket definition
  206.  */
  207. typedef struct _udp_socket {
  208.     struct _udp_socket *next;
  209.     word            ip_type;            /* always set to UDP_PROTO */
  210.     char           *err_msg;            /* null when all is ok */
  211.     char           *usr_name;
  212.     void          (*usr_yield)( void );
  213.     byte            rigid;
  214.     byte            stress;
  215.     word            sock_mode;          /* a logical OR of bits */
  216.     longword        usertimer;          /* ip_timer_set, ip_timer_timeout */
  217.     dataHandler_t  dataHandler;
  218.     eth_address     hisethaddr;         /* peer's ethernet address */
  219.     longword        hisaddr;            /* peer's internet address */
  220.     word            hisport;            /* peer's UDP port */
  221.     longword        myaddr;
  222.     word            myport;
  223.     word            locflags;
  224.  
  225.     int             queuelen;
  226.     byte           *queue;
  227.  
  228.     int             rdatalen;           /* must be signed */
  229.     word            maxrdatalen;
  230.     byte           *rdata;
  231.     byte            rddata[ tcp_MaxBufSize + 1];         /* if dataHandler = 0, len == 512 */
  232.     longword        safetysig;
  233. } udp_Socket;
  234. #else /* __WATTCP_USER */
  235. /*
  236.  * Don't give users access to the fields.
  237.  */
  238. typedef struct {
  239.     byte undoc[ 2200 ];
  240. } udp_Socket;
  241. #endif /* __WATTCP_USER__ */
  242.  
  243. #if defined(__WATTCP_KERNEL__)
  244. /*
  245.  * TCP Socket definition
  246.  */
  247. typedef struct _tcp_socket {
  248.     struct _tcp_socket *next;
  249.     word            ip_type;        /* always set to TCP_PROTO */
  250.     char           *err_msg;
  251.     char           *usr_name;
  252.     void          (*usr_yield)(void);
  253.     byte            rigid;
  254.     byte            stress;
  255.     word            sock_mode;      /* a logical OR of bits */
  256.  
  257.     longword        usertimer;      /* ip_timer_set, ip_timer_timeout */
  258.     dataHandler_t   dataHandler;    /* called with incoming data */
  259.     eth_address     hisethaddr;     /* ethernet address of peer */
  260.     longword        hisaddr;        /* internet address of peer */
  261.     word            hisport;        /* tcp ports for this connection */
  262.     longword        myaddr;
  263.     word            myport;
  264.     word            locflags;
  265.  
  266.     int             queuelen;
  267.     byte           *queue;
  268.  
  269.     int             rdatalen;       /* must be signed */
  270.     word            maxrdatalen;
  271.     byte           *rdata;
  272.     byte            rddata[tcp_MaxBufSize+1];    /* received data */
  273.     longword        safetysig;
  274.     word            state;          /* connection state */
  275.  
  276.     longword        acknum;
  277.     longword        seqnum;         /* data ack'd and sequence num */
  278.     long            timeout;        /* timeout, in milliseconds */
  279.     byte            unhappy;        /* flag, indicates retransmitting segt's */
  280.     byte            recent;         /* 1 if recently transmitted */
  281.     word            flags;          /* tcp flags word for last packet sent */
  282.  
  283.     word            window;         /* other guy's window */
  284.     int             datalen;        /* number of bytes of data to send */
  285.                                     /* must be signed */
  286.     int             unacked;        /* unacked data */
  287.  
  288.     byte            cwindow;        /* Van Jacobson's algorithm */
  289.     byte            wwindow;
  290.  
  291.     word            vj_sa;          /* VJ's alg, standard average */
  292.     word            vj_sd;          /* VJ's alg, standard deviation */
  293.     longword        vj_last;        /* last transmit time */
  294.     word            rto;
  295.     byte            karn_count;     /* count of packets */
  296.     byte            tos;            /* priority */
  297.     /* retransmission timeout proceedure */
  298.     /* these are in clock ticks */
  299.     longword        rtt_lasttran;       /* last transmission time */
  300.     longword        rtt_smooth;         /* smoothed round trip time */
  301.     longword        rtt_delay;          /* delay for next transmission */
  302.     longword        rtt_time;           /* time of next transmission */
  303.  
  304.     word            mss;
  305.     longword        inactive_to;           /* for the inactive flag */
  306.     int             sock_delay;
  307.  
  308.     byte            data[tcp_MaxBufSize+1]; /* data to send */
  309. } tcp_Socket;
  310. #else /* __WATTCP_USER */
  311. /*
  312.  * Don't give users access to the fields.
  313.  */
  314. typedef struct {
  315.     byte undoc[ 4300 ];
  316. } tcp_Socket;
  317. #endif /* __WATTCP_USER__ */
  318.  
  319. #if defined(__WATTCP_KERNEL__)
  320. /* sock_type used for socket io */
  321. typedef union {
  322.     udp_Socket udp;
  323.     tcp_Socket tcp;
  324. } sock_type;
  325. #else /* __WATTCP_USER__ */
  326. typedef void sock_type;
  327. #endif /* __WATTCP_USER__ */
  328.  
  329. /* similar to UNIX */
  330. typedef struct sockaddr {
  331.     word        s_type;
  332.     word        s_port;
  333.     longword    s_ip;
  334.     byte        s_spares[6];    /* unused in TCP realm */
  335. };
  336. #define sockaddr_in sockaddr
  337.  
  338.         /*
  339.          * TCP/IP system variables - do not change these since they
  340.          *      are not necessarily the source variables, instead use
  341.          *      ip_Init function
  342.          */
  343. extern longword my_ip_addr;
  344. extern longword sin_mask;       /* eg.  0xfffffe00L */
  345. extern word sock_delay;
  346.  
  347. #if defined(__WATTCP_KERNEL__)
  348. extern eth_address _eth_addr;
  349. extern eth_address _eth_brdcast;
  350. #endif
  351.  
  352.  
  353. #if defined(__WATTCP_KERNEL__)
  354. /*
  355.  * ARP definitions
  356.  */
  357. #define arp_TypeEther  0x100            /* ARP type of Ethernet address */
  358.  
  359. /* arp op codes */
  360. #define ARP_REQUEST 0x0100
  361. #define ARP_REPLY   0x0200
  362.  
  363. /*
  364.  * Arp header
  365.  */
  366. typedef struct {
  367.     word            hwType;
  368.     word            protType;
  369.     word            hwProtAddrLen;  // hw and prot addr len
  370.     word            opcode;
  371.     eth_address     srcEthAddr;
  372.     longword        srcIPAddr;
  373.     eth_address     dstEthAddr;
  374.     longword        dstIPAddr;
  375. } arp_Header;
  376.  
  377. #define ETH_MSS 1400  // MSS for Ethernet
  378.  
  379. byte *fragment( in_Header * ip );
  380. void timeout_frags( void );
  381.  
  382. #endif
  383.  
  384.  
  385. /*
  386.  * Ethernet interface -- pcsed.c
  387.  */
  388. void  _eth_init( void );
  389. byte *_eth_formatpacket( eth_address *eth_dest, word eth_type );
  390. int   _eth_send( word len );
  391. void  _eth_free( void *buf );
  392. byte *_eth_arrived( word *type_ptr );
  393. void  _eth_release( void );
  394. #if defined(__WATTCP_KERNEL__)
  395. extern void *_eth_hardware( byte *p );
  396. #endif
  397.  
  398.  
  399. /*
  400.  * timers -- pctcp.c
  401.  */
  402. void ip_timer_init( sock_type *s, int delayseconds );
  403. int ip_timer_expired( sock_type *s );
  404. longword MsecClock( void );
  405.  
  406.  
  407. /*
  408.  * sock_init()  -- initialize wattcp libraries -- sock_ini.c
  409.  */
  410. void sock_init(void);
  411. void sock_exit( void );   /* normally called via atexit() in sock_init() */
  412.  
  413.  
  414.         /*
  415.          * tcp_init/tcp_shutdown -- pctcp.c
  416.          *      - init/kill all tcp and lower services
  417.          *      - only call if you do not use sock_init
  418.          * (NOT RECOMMENDED)
  419.          */
  420. void tcp_shutdown(void);
  421. void tcp_init(void);
  422.  
  423. /*
  424.  * things you probably won't need to know about
  425.  */
  426. int tcp_config( char *path );
  427.         /*
  428.          * tcp_tick - called periodically by user application in sock_wait_...
  429.          *          - returns 1 when our socket closes
  430.          */
  431. int tcp_tick( sock_type *s );
  432.         /*
  433.          * Retransmitter - called periodically to perform tcp retransmissions
  434.          *          - normally called from tcp_tick, you have to be pretty
  435.          *            low down to use this one
  436.          */
  437. void tcp_Retransmitter(void);
  438.  
  439. /*
  440.  * check for bugs -- pctcp.c
  441.  */
  442. int tcp_checkfor( sock_type *t );
  443.  
  444. /*
  445.  * Timeout routines.
  446.  */
  447. unsigned long set_timeout( unsigned int seconds );
  448. unsigned long set_ttimeout( unsigned int ticks );
  449. int chk_timeout( unsigned long timeout );
  450.  
  451. /*
  452.  * socket macros
  453.  */
  454.  
  455. /*
  456.  * sock_wait_established()
  457.  *      - waits then aborts if timeout on s connection
  458.  * sock_wait_input()
  459.  *      - waits for received input on s
  460.  * - may not be valid input for sock_gets... check returned length
  461.  * sock_tick()
  462.  *      - do tick and jump on abort
  463.  * sock_wait_closed();
  464.  *      - discards all received data
  465.  *
  466.  * jump to sock_err with contents of *statusptr set to
  467.  *       1 on closed
  468.  *      -1 on timeout
  469.  *
  470.  */
  471.  
  472. int _ip_delay0( sock_type *s, int timeoutseconds, sockfunct_t fn, int *statusptr );
  473. int _ip_delay1( sock_type *s, int timeoutseconds, sockfunct_t fn, int *statusptr);
  474. int _ip_delay2( sock_type *s, int timeoutseconds, sockfunct_t fn, int *statusptr);
  475.  
  476.  
  477. #if defined(__WATTCP_KERNEL__)
  478. #define set_mstimeout( x ) (set_timeout(0)+ (x / 55))
  479. #endif  /* defined(__WATTCP_KERNEL__) */
  480.  
  481. #define sock_wait_established( s, seconds, fn, statusptr ) \
  482.     if (_ip_delay0( s, seconds, fn, statusptr )) goto sock_err;
  483. #define sock_wait_input( s, seconds, fn , statusptr ) \
  484.     if (_ip_delay1( s, seconds, fn, statusptr )) goto sock_err;
  485. #define sock_tick( s, statusptr ) \
  486.     if ( !tcp_tick(s)) { *statusptr = 1 ; goto sock_err; }
  487. #define sock_wait_closed(s, seconds, fn, statusptr )\
  488.     if (_ip_delay2( s, seconds, fn, statusptr )) goto sock_err;
  489.  
  490. /*
  491.  * TCP or UDP specific stuff, must be used for open's and listens, but
  492.  * sock stuff is used for everything else -- pctcp.c
  493.  */
  494. int tcp_open( tcp_Socket *s, word lport, longword ina, word port, dataHandler_t datahandler );
  495. int udp_open( udp_Socket *s, word lport, longword ina, word port, dataHandler_t datahandler );
  496. int tcp_listen( tcp_Socket *s, word lport, longword ina, word port, dataHandler_t datahandler, word timeout );
  497. int tcp_established( tcp_Socket *s );
  498.  
  499. /*
  500.  * Clean up a string -- pctcp.c
  501.  */
  502. char *rip( char *s);
  503.  
  504. /*
  505.  * Name service / name lookup routines -- udp_dom.c
  506.  */
  507. longword resolve( char *name );
  508. int reverse_addr_lookup( longword ipaddr, char *name );
  509.  
  510. /*
  511.  * less general functions
  512.  */
  513. longword intel( longword x );
  514. word intel16( word x );
  515. longword MsecClock( void );
  516.  
  517. /*
  518.  * Ctrl-break handling -- pc_cbrk.c
  519.  */
  520. void tcp_cbrk( int mode );
  521.  
  522. void outs( char far * string );
  523.  
  524. #if defined(__WATTCP_KERNEL__)
  525. /* icmp handler -- pcicmp.c */
  526. int icmp_handler( in_Header *ip );
  527. #endif
  528.  
  529.  
  530. /*
  531.  * ARP -- pcarp.c
  532.  */
  533. #if defined(__WATTCP_KERNEL__)
  534. void _arp_add_gateway( char *data, longword ip );
  535. int _arp_handler( arp_Header *in );
  536. #endif
  537. void _arp_register( longword use, longword instead_of );
  538. void _arp_tick( longword ip );      /* kernel only? */
  539. int _arp_resolve( longword ina, eth_address *ethap, int nowait );
  540.  
  541.  
  542.  
  543. /*
  544.  * Packet -- pcpkt.c
  545.  *
  546.  * These probably shouldn't be visible to user app code.
  547.  */
  548. eth_address *_pkt_eth_init( void );
  549. int pkt_send( char *buffer, int length );
  550. void pkt_buf_wipe( void );
  551. void pkt_buf_release( char *ptr );
  552. void * pkt_received( void );
  553. void pkt_release( void );
  554.  
  555. #if defined(__WATTCP_KERNEL__)
  556. void _add_server( int *counter, int max, longword *array, longword value );
  557. #endif
  558.  
  559.  
  560. /*
  561.  * pcbsd.c
  562.  */
  563. int _chk_socket( sock_type *s );
  564. char *inet_ntoa( char *s, longword x );
  565. longword inet_addr( char *s );
  566. char *sockerr( sock_type *s );
  567. char *sockstate( sock_type *s );
  568. longword gethostid( void );
  569. longword sethostid( longword ip );
  570. word ntohs( word a );
  571. word htons( word a );
  572. longword ntohl( longword x );
  573. longword htonl( longword x );
  574.  
  575.  
  576. #if defined(__WATTCP_KERNEL__)
  577. void *_tcp_lookup( longword hisip, word hisport, word myport );
  578.  
  579. void _tcp_cancel( in_Header *ip, int code, char *msg, longword dummyip );
  580. void _udp_cancel( in_Header *ip );
  581.  
  582. int _dobootp(void);
  583. #endif
  584.  
  585.  
  586. /*
  587.  * General socket I/O -- pctcp.c
  588.  */
  589. word sock_mode( sock_type *, word);        /* see TCP_MODE_... */
  590. void sock_abort( sock_type *);
  591. void tcp_sendsoon( tcp_Socket *s );
  592. int sock_fastwrite( sock_type *, byte *, int );
  593. int sock_write( sock_type *, byte *, int );
  594. int sock_read( sock_type *, byte *, int );
  595. int sock_fastread( sock_type *, byte *, int );
  596. int sock_gets( sock_type *, byte *, int );
  597. void sock_close( sock_type *s );
  598.  
  599. byte sock_putc( sock_type  *s, byte c );
  600. int sock_getc( sock_type  *s );
  601. int sock_puts( sock_type  *s, byte *dp );
  602. int sock_gets(sock_type *, byte *, int );
  603.  
  604. int sock_setbuf( sock_type *s, byte *dp, int len );
  605.  
  606. int sock_yield( tcp_Socket *s, void (*fn)( void ) );
  607.  
  608.  
  609. /*
  610.  *   s is the pointer to a udp or tcp socket
  611.  */
  612.  
  613.  
  614. /*
  615.  * Socket text output/input routines -- sock_prn.c
  616.  */
  617. int sock_printf( sock_type  *s, char *format, ... );
  618. int sock_scanf( sock_type  *s, char *format, ... );
  619.  
  620.  
  621. /*
  622.  * Misc. socket I/O -- pctcp.c
  623.  */
  624. int sock_setbuf( sock_type *s, byte *dp, int len );
  625. int sock_enqueue( sock_type  *s, byte *dp, int len );
  626. void sock_noflush( sock_type *s );
  627. void sock_flush( sock_type  *s );
  628. void sock_flushnext( sock_type  *s);
  629. int sock_dataready( sock_type  *s );
  630. int sock_established( sock_type *s );
  631. void sock_sturdy( sock_type *s, int level );
  632.  
  633. /*
  634.  * Socket Select -- select.c
  635.  */
  636. int sock_sselect( sock_type *s, int waitstate );
  637.  
  638.  
  639.  
  640. /*
  641.  * recv routines -- pcrecv.c
  642.  */
  643. int sock_recv_init( sock_type *s, void *space, word len );
  644. int sock_recv_from( sock_type *s, long *hisip, word *hisport, char *buffer, int len, word flags );
  645. int sock_recv( sock_type *s, char *buffer, int len, word flags );
  646.  
  647.  
  648. /*
  649.  * bsd-similar stuff -- pcbuf.c
  650.  */
  651. int sock_rbsize( sock_type *s );
  652. int sock_rbused( sock_type *s );
  653. int sock_rbleft( sock_type *s );
  654. int sock_tbsize( sock_type *s );
  655. int sock_tbused( sock_type *s );
  656. int sock_tbleft( sock_type *s );
  657. int sock_preread( sock_type *s, byte *dp, int len );
  658.  
  659.  
  660. /*
  661.  * Name conversion stuff -- udp_nds.c
  662.  */
  663. longword aton( char *text );
  664. int isaddr( char *text );
  665.  
  666. /*
  667.  * Configuration -- pcconfig.c
  668.  */
  669. char *_inet_atoeth( char *src, byte *eth );
  670. void _add_server( int *counter, int max, longword *array, longword value );
  671. int tcp_config( char *path );
  672.  
  673.         /*
  674.          * name domain constants
  675.          */
  676.  
  677. extern char *def_domain;
  678. extern longword def_nameservers[ MAX_NAMESERVERS ];
  679.  
  680. extern word wathndlcbrk;
  681. extern word watcbroke;
  682.  
  683. /* user initialization file */
  684. extern void (*usr_init)(char *name, char *value);
  685.  
  686. extern int _survivebootp;
  687.  
  688. extern int _last_cookie;
  689. extern longword _cookie[MAX_COOKIES];
  690.  
  691. extern int _last_nameserver;
  692. extern char *_hostname;
  693.  
  694. /*
  695.  * Elib stuff
  696.  */
  697. int isstring( char *string, unsigned stringlen );     /* isstring.c */
  698.  
  699.  
  700.  
  701. #endif /* ndef _wattcp_wattcp_h */
  702.