#ifndef _NNTP_H_ #define _NNTP_H_ /* * Copyright (c) 1996, Ruslan R. Laishev (@RRL) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define LOCAL_TZ "MSK" #define LOCAL_HOST "Host1" #define LOG_LVL 5 /* * */ #define ID$ID ">-< DECThreads NNTP Server for OpenVMS >-<" /* * */ #define NNTP_tcpPort 1119 #define NNTP_EOL "\r\n" #define NNTP_EOT ".\r\n" #define NNTP_OK ".\r\n" #define NNTP_inpWorker 31 #define NNTP_outWorker 1 #define NNTP_maxWorker (NNTP_inpWorker+NNTP_outWorker) typedef struct { char *cmd; int (*nntp_fun) (); char *hlp; } NNTP_cmd_t; /* * Structure of nntp$msg.dat */ #define Msg_MaxRec 32000 #define MsgGrp$_pos 0 #define MsgGrp$_len 64+16 #define MsgGrp$_ref 0 #define MsgId$_pos MsgGrp$_len #define MsgId$_len 64 #define MsgId$_ref 1 #define MsgDate$_pos MsgId$_pos+MsgId$_len #define MsgDate$_len sizeof(time_t) #define MsgDate$_ref 2 typedef struct { char Grp [MsgGrp$_len]; char MsgId [MsgId$_len]; time_t Date; } MsgKey; /* * Structure of nntp$grp.dat */ typedef struct { char GrpName [64]; unsigned long First; unsigned long Last; char PostFlag; char SuckFlag; time_t DateCr; time_t DateUp; } GrpKey; #define Grp_MaxRec sizeof(GrpKey) #define GrpName$_pos 0 #define GrpName$_len 64 #define GrpName$_ref 0 #define NNTPMSGL (Msg_MaxRec - sizeof(MsgKey)) #define NNTPGRPL GrpName$_len /* * */ enum {T_Null,T_Suck,T_Feed,T_Clnt}; /* "Type" code's for Wctx.type */ enum {S_Null,S_Send,S_Read,S_Work}; /* "Stat" code's for Wctx.stat */ enum {A_Read = 0x1,A_Post = 0x2,A_Ihav = 0x4}; typedef struct { int type; /* Type of worker: suck,feed,client */ int stat; /* Current state of worker */ time_t time; /* Time chekpoint/expiration of worker */ pthread_mutex_t mutex; /* Mutual exclusion lock flag */ pthread_t tid; /* Thread identificator */ int indx; int chan; /* TCP I/O socket */ char bufp [ 514 ]; int bufl; /* Length of data in the buffer */ struct RAB Grprab; struct RAB Msgrab; char MsgBuff [Msg_MaxRec]; char GrpBuff [Grp_MaxRec]; /* Current News Group */ char Grp [GrpName$_len]; /* Current MsgID */ char Msg [MsgId$_len]; } WorkerContext; #endif /* _NNTP_H_ */