home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / Misc / ytalk / Source / ytalk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-12  |  3.2 KB  |  126 lines

  1. /* ytalk.h V2.0 */
  2.  
  3. /*               NOTICE
  4.  *
  5.  * Copyright (c) 1990 Britt Yenne.  All rights reserved.
  6.  * 
  7.  * This software is provided AS-IS.  The author gives no warranty,
  8.  * real or assumed, and takes no responsibility whatsoever for any 
  9.  * use or misuse of this software, or any damage created by its use
  10.  * or misuse.
  11.  * 
  12.  * This software may be freely copied and distributed provided that
  13.  * no part of this NOTICE is deleted or edited in any manner.
  14.  * 
  15.  */
  16.  
  17. /* Mail comments or questions to yenne@ccwf.cc.utexas.edu */
  18.  
  19. /* --------------------------------------- */
  20. /* IT IS NOT NECESSARY TO MODIFY THIS FILE */
  21. /* --------------------------------------- */
  22.  
  23. #include "config.h"
  24. #include "talkd.h"
  25. #include <errno.h>
  26.  
  27. #define MAXC    10    /* Max number of talk windows at one time */
  28.  
  29. typedef struct {
  30.     unsigned char w_rows, w_cols;    /* terminal rows and cols */
  31.     char clr;                /* clear the screen key */
  32.     char pad[61];
  33. } y_parm;
  34. #define YPARMLEN    sizeof(y_parm)
  35. #define WROWS        yparms.w_rows
  36. #define WCOLS        yparms.w_cols
  37.  
  38. #ifdef POSIX
  39. typedef signed char s_char;  /* some systems don't default "char" as signed */
  40. #else
  41. typedef char s_char;
  42. #endif
  43.  
  44. typedef struct {
  45. #define NAMELEN    12
  46.     char name[NAMELEN];        /* user name */
  47. #define HOSTLEN 64
  48.     char host[HOSTLEN];        /* user host */
  49.     char tty[TTY_SIZE];        /* his tty */
  50.     int sfd;            /* socket fd */
  51.     int ffd;            /* file fd (if applicable) */
  52.     int flags;            /* flags (see below) */
  53.     int id, a_id;        /* talkd id's */
  54.     int win;            /* window id */
  55.     long last_ring;        /* time of last ring */
  56.     struct sockaddr_in sock;    /* socket */
  57.     s_char edit[4];        /* edit characters */
  58.     y_parm yparms;        /* ytalk parameters */
  59. } person;
  60.  
  61. #define RUB    edit[0]
  62. #define KILL    edit[1]
  63. #define WORD    edit[2]
  64. #define CLR    edit[3]
  65.  
  66. /* FLAGS */
  67. #define P_CONTACT    0x01    /* Contact has been made */
  68. #define P_CONNECT    0x02    /* Socket is connected */
  69. #define P_PRIVATE    0x04    /* Session is private */
  70. #define P_YTALK        0x08    /* Is a YTalk program (vs. Berkeley) */
  71.  
  72. /* DAEMON TYPES */
  73. #define D_UNKNOWN    0    /* unknown as of yet */
  74. #define D_BSD        1    /* BSD before 4.2 */
  75. #define D_BSD42        2    /* BSD after 4.2 */
  76. #define D_YTALK        4    /* BSD through YTalkd */
  77.  
  78. typedef struct {
  79.     s_char code;
  80.     char name[60];
  81.     char data[256];
  82. } inptype;
  83.  
  84. /* The following structure is for communicating between YTalk hosts.
  85.  * If you change this structure, BE SURE the final structure can be
  86.  * transferred and understood by different machine architectures.
  87.  * Ie: check your padding and address boundaries for integers.
  88.  */
  89.  
  90. typedef struct {
  91.     s_char code;        /* see below */
  92.     char filler;
  93.     char name[NAMELEN];        /* user name */
  94.     char host[HOSTLEN];        /* user host */
  95. } cpack;
  96.  
  97. #define CSIZ    sizeof(cpack)
  98. #define EXPORT    (s_char) -126    /* export a user */
  99. #define IMPORT    (s_char) -125    /* import a user */
  100. #define ACCEPT    (s_char) -124    /* accept a connection from a user */
  101. #define AUTO    (s_char) -123    /* accept auto invitation */
  102. #define RUBDEF    (s_char) -2    /* rub a character */
  103.  
  104. #define RCSIZ    508
  105. #define YTPORT    15348
  106. typedef struct {
  107.     short type;
  108.     short length;
  109.     char buf[RCSIZ];
  110. } rcpack;
  111.  
  112.  
  113. #ifdef NOTOUCHOLAP
  114. #define wtouch(x,y)    touchwin((y))
  115. #else
  116. #define wtouch(x,y)    touchoverlap((x),(y))
  117. #endif
  118.  
  119. #ifdef NOCBREAK
  120. #define cmode()        crmode()
  121. #else
  122. #define cmode()        cbreak()
  123. #endif
  124.  
  125. /* EOF */
  126.