This is msend.h in view mode; [Download] [Up]
/* msend.h: * * header file for 'msend' * * (c) Copyright 1988 Jim Frost. All Rights Reserved. Please see * the accompanying file "Copyright" for more information. */ #ifndef _MSEND_H_ #define _MSEND_H_ #include "network.h" #include <errno.h> #include <pwd.h> #include <signal.h> #include <stdio.h> #include <utmp.h> #include <sys/types.h> #include <sys/file.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> #include <netdb.h> #define ROOTUID 0 /* system superuser uid */ #define DAEMONUID 1 /* system daemon uid */ #define MAXHOSTNAME 255 /* longest hostname we allow */ #define MAXFILENAME 1024 /* longest filename we allow */ #define MAXDEST 1024 /* longest destination path */ #define MAXUSERNAME 10 /* longest username we allow */ #define MAXTTY 10 /* longest tty (from utmp.h) */ #define MAXSIGNATURE 40 /* longest signature */ #define MAXMSG 1024 /* longest message text (includes signature) */ #define MAXLINE 128 /* longest text line in options file */ #define MAXTOKEN 30 /* longest allowable options file token */ #define MAXFORWARD 5 /* never forward more than this many hosts (this prevents multiple host loops) */ #define BACKLOG 5 /* request backlog */ #define LIFETIME (10*60) /* how long we live before we give up */ /* message header for requests send to a daemon */ struct sheader { u_short taddrlen; /* length of destination address field */ u_short tttylen; /* length of destination tty field */ u_short msglen; /* length of message field (includes signature) */ }; #define SM_CLOSE 0x01 /* close connection after reply */ #define SM_TTY 0x02 /* send to tty */ #define SM_BROADCAST 0x04 /* broadcast */ #define SM_VERSION 0x08 /* version request */ /* message header for replies sent back to the caller */ struct rheader { u_short errno; u_short msglen; }; #define RE_OK 0 /* message delivered ok */ #define RE_SYSERR 1 /* system error */ #define RE_NOUSER 2 /* user doesn't exist on this host */ #define RE_NOMSGS 3 /* user's terminal may not be written to */ #define RE_NOTTHERE 4 /* user is not logged on at the destination */ #define RE_NOROUTE 5 /* routing is denied at this host */ #define RE_NOBROAD 6 /* broadcasting is denied at this host */ #define RE_FWDLOOP 7 /* forwarding loop (too many forwards) */ #define RE_INTERR 8 /* something really really bad happened */ #define RE_NOTFATAL 9 /* non-fatal error print message don't exit */ /* structures used for internal handling of messages */ struct simsg { u_short fwdcount; /* number of times this has been forwarded */ u_short mode; char taddr[MAXDEST+1]; char ttty[MAXTTY+1]; char msg[MAXMSG+1]; char tohost[MAXHOSTNAME+1]; /* hostname to send message to */ }; struct rimsg { struct rheader h; char msg[MAXMSG+1]; }; /* all global functions are defined here to make compilers and checkers * happier. */ #undef A #ifdef __STDC__ #define A(ARGS) ARGS #else #define A(ARGS) () #endif int main A((int argc, char **argv)); void domessage A((int s)); int establish A((int port)); int fwdloop A((char *host)); void blderr A((struct rimsg *ri, int errno, char *msg)); void die A((int i)); void error A((char *s)); int portnum A((void)); char *striphost A((char addr[], char *host)); char *gethome A((char *user)); int getid A((char *user)); void sendmessage A((struct simsg *si, struct rimsg *ri, int mode)); void sendreply A((int s, struct rimsg *ri, int mode)); void recvmessage A((int s, struct simsg *si)); struct utmp *getutent A((void)); void endutent A((void)); char *whoami A((void)); void broadcast A((struct simsg *si)); int writeuser A((struct simsg *si)); #ifdef NEEDS_FLOCK #ifndef LOCK_EX /* sometimes fcntl has these even though there's no flock */ #define LOCK_EX 1 #define LOCK_UN 2 #endif int flock A((int fd, int how)); #endif #endif _MSEND_H_
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.