home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / msgd / Include / msg.h next >
Encoding:
C/C++ Source or Header  |  1992-03-09  |  2.8 KB  |  93 lines

  1. /* msg.h
  2.    header file for msg and msgd
  3. */
  4.  
  5. /*
  6.  * $Header: /usr/source/users/msg/Include/RCS/msg.h,v 1.9 91/03/08 20:13:16 jmsellens Exp Locker: jmsellens $
  7.  * 
  8.  */
  9.  
  10. /* Options */
  11. #include "msgoptions.h"
  12.  
  13. #include <stdio.h>
  14. #include <sys/types.h>
  15. #include <utmp.h>
  16. #define UTMP    "/etc/utmp"    /* why isn't this in utmp.h?? */
  17. #ifdef USER_PROCESS
  18. #define SYSV_UTMP
  19. #endif
  20. #include <sys/stat.h>
  21. #define ALLOW    ((S_IWRITE>>3)|(S_IWRITE>>6))
  22. #ifdef VARARGS
  23. #include <varargs.h>
  24. #endif
  25.  
  26. #define DEV    "/dev/"
  27. #define MSGFILE    "/usr/tmp/msg."    /* where to save messages, append userid */
  28. #define PMSGFILE "/usr/tmp/pmsg." /* where to save outgoing messages */
  29. #define ANSBACK    "/usr/tmp/mesg."    /* where asnwerback message might be */
  30.  
  31. #define private        static
  32.  
  33. extern char hostname[];
  34. extern char *syserr();
  35.  
  36. /*
  37.  * Following are in network byte order.
  38.  */
  39. typedef struct header {
  40.     int    slen;    /* sender length */
  41.     int    ulen;    /* userid length */
  42.     int    mlen;    /* message length */
  43. } header;
  44.  
  45. /* This version header was added after the original version of msg had
  46.    been installed and was running.  To provide compatibility with versions
  47.    of msg that do not send a version as the first information, this
  48.    version struct must be twelve bytes long, and the first int is always
  49.    a 0, because if it is non-zero you can assume that it is a sender
  50.    length in a header, and not a version struct.
  51. */
  52. typedef union version {
  53.     header h;
  54.     struct v {
  55.     int zero;
  56.     int vnum;    /* version number */
  57.     int filler;
  58.     } v;
  59. } version;
  60. #define VERSION        (1)    /* current version */
  61.  
  62.  
  63. extern char    *errmessages[];
  64. /* error codes for message - msgtext.c relies on this ordering */
  65. #define OK        (0)
  66. #define VERSION_OK    OK    /* got a version, and we accept it */
  67. #define NOT_ON        (1)    /* user not signed on */
  68. #define NO_WRITE    (2)    /* couldn't write to terminal */
  69. #define BAD_HOST    (3)    /* host doesn't exist */
  70. #define NO_UTMP        (4)    /* couldn't open /etc/utmp */
  71. #define BAD_ARGS    (5)    /* bad arguments */
  72. #define NO_CONNECT    (6)    /* couldn't connect to remote host */
  73. #define FATAL        (7)    /* fatal error */
  74. #define NO_ACK        (8)    /* no result from remote host */
  75. #define REMOTE_WRITE    (9)    /* write error to remote host */
  76. #define REMOTE_READ    (10)    /* read error from remote host */
  77. #define MESG_OFF    (11)    /* dest user has mesg n set */
  78. #define NO_REPLY    (12)    /* can't get replies */
  79. #define TIMEOUT        (13)    /* timeout while writing to user's terminal */
  80. #define ANSWER        (14)    /* asnwerback message */
  81. #define ANS_WARN    (15)    /* user has answerback msg set */
  82. #define NO_TTY        (16)    /* user is not on a tty */
  83. #define    HOWEVER        (17)    /* However, another tty was writable. */
  84. #define NO_STAT        (18)    /* couldn't stat tty */
  85. #define BAD_VERSION    (19)    /* client newer than server */
  86.  
  87. #define ERROR_MESSAGE    (99)    /* error message being returned from msgd */
  88.  
  89. #define FPNULL        ((FILE *)NULL)
  90. #define CPNULL        ((char *)NULL)
  91. #define TRUE        (1)
  92. #define FALSE        (0)
  93.