home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / USOCK.H < prev    next >
C/C++ Source or Header  |  1994-04-17  |  3KB  |  132 lines

  1. /* Mods by G1EMM */
  2. #ifndef _USOCK_H
  3. #define _USOCK_H
  4.   
  5. #ifndef _CONFIG_H
  6. #include "config.h"
  7. #endif
  8.   
  9. #ifndef time_t
  10. #include "time.h"
  11. #endif
  12.   
  13. #ifndef _MBUF_H
  14. #include "mbuf.h"
  15. #endif
  16.   
  17. #ifndef _LZW_H
  18. #include "lzw.h"
  19. #endif
  20.   
  21. #ifndef _PROC_H
  22. #include "proc.h"
  23. #endif
  24.   
  25. #ifndef _TCP_H
  26. #include "tcp.h"
  27. #endif
  28.   
  29. #ifndef _UDP_H
  30. #include "udp.h"
  31. #endif
  32.   
  33. #ifndef _IP_H
  34. #include "ip.h"
  35. #endif
  36.   
  37. #ifndef _NETROM_H
  38. #include "netrom.h"
  39. #endif
  40.   
  41. #ifndef _SOCKADDR_H
  42. #include "sockaddr.h"
  43. #endif
  44.   
  45. struct loc {
  46.     struct usock *peer;
  47.     struct mbuf *q;
  48.     int hiwat;              /* Flow control point */
  49.     int flags;
  50. #define LOC_SHUTDOWN    1
  51. };
  52. #define NULLLOC (struct loc *)0
  53. #define LOCDFLOW        5       /* dgram socket flow-control point, packets */
  54. #define LOCSFLOW        2048    /* stream socket flow control point, bytes */
  55.   
  56. #if ((defined POP2SERV) || (defined POP3SERV))
  57. /* N7IPB - SOBUF was 256, it needs to be much larger, The POPServer blows */
  58. /* up when it receives lines longer than 256.  This WILL happen when you  */
  59. /* handle mail from USENET */
  60. #define SOBUF           1024     /* Size of buffer for usputc()/usprintf() */
  61. #else
  62. #define SOBUF           256     /* Size of buffer for usputc()/usprintf() */
  63. #endif
  64.   
  65. #define SOCKBASE        128     /* Start of socket indexes */
  66.   
  67. union sp {
  68.     struct sockaddr *sa;
  69.     struct sockaddr_in *in;
  70.     struct sockaddr_ax *ax;
  71.     struct sockaddr_nr *nr;
  72.     char *p;
  73. };
  74.   
  75. union cb {
  76.     struct tcb *tcb;
  77.     struct ax25_cb *ax25;
  78.     struct udp_cb *udp;
  79.     struct raw_ip *rip;
  80.     struct raw_nr *rnr;
  81.     struct nr4cb *nr4;
  82.     struct loc *local;
  83.     char *p;
  84. };
  85.   
  86. /* User sockets */
  87. struct usock {
  88.     struct usock *next;     /* Link to the next socket */
  89.     int number;             /* The socket number */
  90.     struct proc *owner;
  91.     int refcnt;
  92.     char noblock;
  93.     char type;
  94. #define NOTUSED                 0
  95. #define TYPE_TCP                1
  96. #define TYPE_UDP                2
  97. #define TYPE_AX25I              3
  98. #define TYPE_AX25UI             4
  99. #define TYPE_RAW                5
  100. #define TYPE_NETROML3           6
  101. #define TYPE_NETROML4           7
  102. #define TYPE_LOCAL_STREAM       8
  103. #define TYPE_LOCAL_DGRAM        9
  104.     int rdysock;
  105.     union cb cb;
  106.     char *name;
  107.     int namelen;
  108.     char *peername;
  109.     int peernamelen;
  110.     char errcodes[4];       /* Protocol-specific error codes */
  111.     struct mbuf *obuf;      /* Output buffer */
  112.     struct mbuf *ibuf;      /* Input buffer */
  113.     char eol[3];            /* Text mode end-of-line sequence, if any */
  114.     int flag;               /* Mode flags, defined in socket.h */
  115.     int flush;              /* Character to trigger flush, if any */
  116. #ifdef LZW
  117.     struct lzw *zout;       /* Pointer to compression structure */
  118.     struct lzw *zin;
  119. #endif
  120.     struct proc *look;      /* Sysop is tracing us ! */
  121.     time_t created;         /* Time this socket was opened */
  122. };
  123. #define NULLUSOCK       ((struct usock *)0)
  124.   
  125. extern char Badsocket[];
  126. extern char *Socktypes[];
  127.   
  128. struct usock *itop __ARGS((int s));
  129. void st_garbage __ARGS((int red));
  130.   
  131. #endif /* _USOCK_H */
  132.