| 1 | #define VERSION "ver1.26b11" |
|---|
| 2 | #include "friendsTCPCommands.h" |
|---|
| 3 | #include "tcpcalls.h" |
|---|
| 4 | |
|---|
| 5 | #include <stdio.h> |
|---|
| 6 | #include <stdlib.h> |
|---|
| 7 | #include <ctype.h> |
|---|
| 8 | #include <sys/types.h> |
|---|
| 9 | #include <sys/wait.h> |
|---|
| 10 | #include <sys/param.h> |
|---|
| 11 | #include <signal.h> |
|---|
| 12 | #include <time.h> |
|---|
| 13 | #include <sys/socket.h> |
|---|
| 14 | #include <netinet/in.h> |
|---|
| 15 | #include <netdb.h> |
|---|
| 16 | #include <memory.h> |
|---|
| 17 | #include <sys/stat.h> |
|---|
| 18 | #include <errno.h> |
|---|
| 19 | |
|---|
| 20 | #define DONE (-1) |
|---|
| 21 | #define ERR (-1) |
|---|
| 22 | |
|---|
| 23 | #define SUCCEED (1) |
|---|
| 24 | #define FAIL (0) |
|---|
| 25 | |
|---|
| 26 | #define MAXUSER (3072) |
|---|
| 27 | #define MAXSERVER (512) |
|---|
| 28 | |
|---|
| 29 | #define ERRFILE_PFX "FD" |
|---|
| 30 | |
|---|
| 31 | #define ALIVE_WO_CHILD (120) |
|---|
| 32 | #define WARNING_CONNECTION (32) |
|---|
| 33 | #define MAX_CONNECTION (32) |
|---|
| 34 | |
|---|
| 35 | typedef int flag; |
|---|
| 36 | #define on (1) |
|---|
| 37 | #define off (0) |
|---|
| 38 | |
|---|
| 39 | struct SERVER { |
|---|
| 40 | char id[ 16 ]; |
|---|
| 41 | char name[ 64 ]; |
|---|
| 42 | int access; |
|---|
| 43 | }; |
|---|
| 44 | |
|---|
| 45 | struct USER { |
|---|
| 46 | char login[ 9 ]; |
|---|
| 47 | char name[ 21 ]; |
|---|
| 48 | char tty[ 4 ]; |
|---|
| 49 | char idle[ 5 ]; |
|---|
| 50 | char when[ 11 ]; |
|---|
| 51 | char where[ 13 ]; |
|---|
| 52 | char server[ 16 ]; |
|---|
| 53 | char dummy[ 5 ]; |
|---|
| 54 | }; |
|---|
| 55 | |
|---|
| 56 | struct MEM { |
|---|
| 57 | struct SERVER serverlist[ MAXSERVER ]; |
|---|
| 58 | struct USER userlist[ MAXUSER ]; |
|---|
| 59 | flag ready, debug, dynamic; |
|---|
| 60 | }; |
|---|
| 61 | |
|---|
| 62 | extern int MMinitialize( int dProcs, int dThread, int ( *disposeNReqs )() ); |
|---|
| 63 | extern int MMterminate( void ); |
|---|
| 64 | extern int MMfinger( struct USER *ulist, struct SERVER *svlist, char ( *errsvlist )[ 16 ] ); |
|---|
| 65 | extern int disposeNReqs4MMfinger( void ); |
|---|
| 66 | extern int friendsManager( int id ); |
|---|
| 67 | extern int ischar( int c, char *add, char *sub ); |
|---|
| 68 | extern int strshrink( char *str ); |
|---|
| 69 | extern int strnshrink( char *str, int maxlen ); |
|---|
| 70 | extern int getServer( char *file ); |
|---|
| 71 | extern int main( int argc, char **argv ); |
|---|
| 72 | extern void termTasks(); |
|---|
| 73 | extern int server( int id ); |
|---|
| 74 | extern int shmStat( void ); |
|---|
| 75 | extern char *shmOpen( int size ); |
|---|
| 76 | extern int shmClose( void ); |
|---|
| 77 | extern void shmWrite( void ); |
|---|
| 78 | extern void shmRead( void ); |
|---|
| 79 | extern void shmReset( void ); |
|---|
| 80 | extern int getShmVersion( void ); |
|---|
| 81 | extern int setShmDebug( int mode ); |
|---|
| 82 | extern int getShmDebug( void ); |
|---|
| 83 | extern int setShmOwner( int new_id ); |
|---|
| 84 | extern int getShmOwner( void ); |
|---|