home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume27 / ytalk-3.0 / part01 / socket.h < prev    next >
C/C++ Source or Header  |  1993-08-20  |  3KB  |  110 lines

  1. /* socket.h */
  2.  
  3. #include <netdb.h>
  4.  
  5. /* ---- talk daemon information structure ---- */
  6.  
  7. #define MAXDAEMON    5
  8.  
  9. struct _talkd {
  10.     struct sockaddr_in sock;    /* socket */
  11.     int fd;            /* socket file descriptor */
  12.     short port;            /* port number */
  13.     yaddr mptr;            /* message pointer */
  14.     int mlen;            /* message length */
  15.     yaddr rptr;            /* response pointer */
  16.     int rlen;            /* response length */
  17. };
  18.  
  19. typedef struct _hostinfo {
  20.     struct _hostinfo *next;    /* next in linked list */
  21.     u_long host_addr;        /* host address */
  22.     int dtype;            /* active daemon types bitmask */
  23. } hostinfo;
  24.  
  25. typedef struct _readdr {
  26.     struct _readdr *next;    /* next in linked list */
  27.     u_long addr;        /* this net address [group?], */
  28.     u_long mask;        /* with this mask, */
  29.     u_long id_addr;        /* thinks I'm at this net address, */
  30.     u_long id_mask;        /* with this mask. */
  31. } readdr;
  32.  
  33. extern struct _talkd talkd[MAXDAEMON+1];
  34. extern int daemons;
  35.  
  36. /* ---- talk daemon I/O structures ---- */
  37.  
  38. #define NAME_SIZE 9
  39. #define TTY_SIZE 16
  40.  
  41. /* Control Message structure for earlier than BSD4.2
  42.  */
  43. typedef struct {
  44.     char    type;
  45.     char    l_name[NAME_SIZE];
  46.     char    r_name[NAME_SIZE];
  47.     char    filler;
  48.     u_long    id_num;
  49.     u_long    pid;
  50.     char    r_tty[TTY_SIZE];
  51.     struct    sockaddr_in addr;
  52.     struct    sockaddr_in ctl_addr;
  53. } CTL_MSG;
  54.  
  55. /* Control Response structure for earlier than BSD4.2
  56.  */
  57. typedef struct {
  58.     char    type;
  59.     char    answer;
  60.     u_short    filler;
  61.     u_long    id_num;
  62.     struct    sockaddr_in addr;
  63. } CTL_RESPONSE;
  64.  
  65. /* Control Message structure for BSD4.2
  66.  */
  67. typedef struct {
  68.     u_char    vers;
  69.     char    type;
  70.     u_short    filler;
  71.     u_long    id_num;
  72.     struct    sockaddr_in addr;
  73.     struct    sockaddr_in ctl_addr;
  74.     u_long    pid;
  75.     char    l_name[NAME_SIZE];
  76.     char    l_name_filler[3];
  77.     char    r_name[NAME_SIZE];
  78.     char    r_name_filler[3];
  79.     char    r_tty[TTY_SIZE];
  80. } CTL_MSG42;
  81.  
  82. /* Control Response structure for BSD4.2
  83.  */
  84. typedef struct {
  85.     u_char    vers;
  86.     char    type;
  87.     char    answer;
  88.     char    filler;
  89.     u_long    id_num;
  90.     struct    sockaddr_in addr;
  91. } CTL_RESPONSE42;
  92.  
  93. #define    TALK_VERSION    1        /* protocol version */
  94.  
  95. /* Dgram Types.
  96.  *
  97.  * These are the "type" arguments to feed to send_dgram().  Each acts
  98.  * either on the remote daemon or the local daemon, as marked.
  99.  */
  100.  
  101. #define LEAVE_INVITE    0    /* leave an invitation (local) */
  102. #define LOOK_UP        1    /* look up an invitation (remote) */
  103. #define DELETE        2    /* delete erroneous invitation (remote) */
  104. #define ANNOUNCE    3    /* ring a user (remote) */
  105. #define DELETE_INVITE    4    /* delete my invitation (local) */
  106. #define AUTO_LOOK_UP    5    /* look up auto-invitation (remote) */
  107. #define AUTO_DELETE    6    /* delete erroneous auto-invitation (remote) */
  108.  
  109. /* EOF */
  110.