#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 /* * */ extern char *ID$IDcpy; extern char *ID$IDver; /* * */ #define NNTP_EOL "\r\n" #define NNTP_EOT ".\r\n" #define NNTP_OK ".\r\n" #define NNTP_ClientWorker 31 typedef struct { char *cmd; int (*nntp_fun) (); char *hlp; } NNTP_cmd_t; /* * Structure of nntp$msg.db */ #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.db */ typedef struct { char GrpName [64]; /* News group name */ unsigned long First; /* # of first available message */ unsigned long Last; /* # of last available message */ char PostFlag; /* 'form of posting' flag */ char SuckFlag; /* 'group cached' flag */ time_t DateCr; /* date of news group creation */ time_t DateUp; /* date of last 'GROUP ...' */ } GrpKey; #define Grp_MaxRec sizeof(GrpKey) #define GrpName$_pos 0 #define GrpName$_len 64 #define GrpName$_ref 0 /* * Structure of nntp$suck.db */ typedef struct { char Host_Grp [16+1+GrpName$_len]; /* IP address in ASCII form + "," */ /* + news group name */ unsigned long Last; /* Index of last geted message */ } SuckRec; #define Suck_MaxRec sizeof(SuckRec) #define Suck$_pos 0 #define Suck$_len (16+1+GrpName$_len) #define Suck$_ref 0 /* * */ enum {T_Null,T_Suck,T_Feed,T_Clnt}; /* "Type" code's for Wctx.type */ enum {A_Read = 0x1,A_Post = 0x2,A_Ihav = 0x4}; typedef struct { int type; /* Type of worker: suck,feed,client */ 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 ]; struct RAB Grprab; struct RAB Msgrab; struct RAB Suckrab; char MsgBuff [Msg_MaxRec]; /* Current News Group */ char Grp [GrpName$_len]; /* Current Message number */ int MsgNum; int MsgNumf; } WorkerContext; typedef struct { char *LocalHost; char *LocalTZ; int LocalPort; int LocalMgr; int MsgDBsize; int MsgPurgeDay; int MsgPurgeNum; int ClientTimeOut; int SuckTimeOut; int FeedTimeOut; char *GrpME; int GrpDay; char *Suck; char *Feed; char *Client; int LogLevel; time_t Update; int Expire; } nntp_conf_t; #ifndef nntp_conf nntp_conf_t nntp_conf; #else external nntp_conf_t nntp_conf; #endif #endif /* _NNTP_H_ */