* Started writing the Use Table code for the new networker
authorArt Cancro <ajc@citadel.org>
Fri, 12 Oct 2001 20:16:42 +0000 (20:16 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 12 Oct 2001 20:16:42 +0000 (20:16 +0000)
citadel/citadel.h
citadel/serv_network.c
citadel/serv_network.h

index 1c5a125414822d8a3bef78b05266e1334b3a8511..74f088a06aff2b39945e804ec846b20000a9a422 100644 (file)
@@ -58,7 +58,7 @@ typedef unsigned char CIT_UBYTE;
 struct ExpirePolicy {
        int expire_mode;
        int expire_value;
-       };
+};
 
 #define EXPIRE_NEXTLEVEL       0       /* Inherit expiration policy    */
 #define EXPIRE_MANUAL          1       /* Don't expire messages at all */
@@ -84,13 +84,13 @@ struct config {
        char c_moreprompt[80];          /* paginator prompt                 */
        char c_restrict;                /* restrict Internet mail flag      */
        long c_msgbase;                 /* size of message base             */
-       char c_bbs_city[32];            /* city and state you are located in*/
+       char c_bbs_city[32];            /* physical location of server      */
        char c_sysadm[26];              /* name of system administrator     */
        char c_bucket_dir[15];          /* bit bucket for files...          */
        int c_setup_level;              /* what rev level we've setup to    */
        int c_maxsessions;              /* maximum concurrent sessions      */
        char c_net_password[20];        /* system net password              */
-       int c_port_number;              /* TCP port to run the server on    */
+       int c_port_number;              /* Cit listener port (usually 504)  */
        int c_ipgm_secret;              /* Internal program authentication  */
        struct ExpirePolicy c_ep;       /* System default msg expire policy */
        int c_userpurge;                /* System default user purge (days) */
@@ -135,10 +135,10 @@ struct usersupp {                 /* User record                      */
        CIT_UBYTE USscreenwidth;        /* Screen width (for textmode users)*/
        CIT_UBYTE USscreenheight;       /* Screen height(for textmode users)*/
        char moderation_filter;         /* Moderation filter level          */
-       };
+};
 
 
-/****************************************************************************
+/*
  * This is the control record for the message base... 
  */
 struct CitControl {
@@ -147,7 +147,7 @@ struct CitControl {
        long MMnextuser;                /* highest user number on system    */
        long MMnextroom;                /* highest room number on system    */
        int version;                    /* Server-hosted upgrade level      */
-       };
+};
 
 /* Bits which may appear in CitControl.MMflags.  Note that these don't
  * necessarily pertain to the message base -- it's just a good place to
@@ -155,7 +155,7 @@ struct CitControl {
  */
 #define MM_VALID       4               /* New users need validating        */
 
-/****************************************************************************
+/*
  * Room records
  */
 struct quickroom {
@@ -172,8 +172,7 @@ struct quickroom {
        struct ExpirePolicy QRep;       /* Message expiration policy        */
        long QRnumber;                  /* Globally unique room number      */
        char QRorder;                   /* Sort key for room listing order  */
-       };
-
+};
 
 /* Private rooms are always flagged with QR_PRIVATE.  If neither QR_PASSWORDED
  * or QR_GUESSNAME is set, then it is invitation-only.  Passworded rooms are
@@ -219,7 +218,7 @@ struct floor {
 #define F_INUSE                1               /* floor is in use */
 
 
-/****************************************************************************
+/*
  * Values used internally for function call returns, etc.
  */
 
@@ -265,6 +264,7 @@ struct floor {
 #define        INTERNETCFG     "application/x-citadel-internet-config"
 #define IGNETCFG       "application/x-citadel-ignet-config"
 #define IGNETMAP       "application/x-citadel-ignet-map"
+#define USETABLE       "application/x-citadel-usetable"
 
 #define TRACE  lprintf(9, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
 
index b0dc2e75a71c14e7114b394ce31c2db33b5c123c..195b3918fcefed3bf91326a4db65d477bd6f27b3 100644 (file)
  * is global; this process *only* runs as part of the housekeeping loop and
  * therefore only one will run at a time.
  */
-struct RoomProcList {
-        struct RoomProcList *next;
-        char name[ROOMNAMELEN];
-};
-
 struct RoomProcList *rplist = NULL;
 
+/*
+ * We build a map of network nodes during processing.
+ */
+struct NetMap *the_netmap = NULL;
+
+
+
+
+
 
 /*
- * We build a map of the Citadel network during network runs.
+ * Manage the use table.  This is a list of messages which have recently
+ * arrived on the system.  It is maintained and queried to prevent the same
+ * message from being entered into the  FIXME not finished
  */
-struct NetMap {
-       struct NetMap *next;
-       char nodename[SIZ];
-       time_t lastcontact;
-       char nexthop[SIZ];
-};
+int network_usetable(int operation, struct CtdlMessage *msg) {
 
-struct NetMap *the_netmap = NULL;
+       static struct UseTable *ut = NULL;
+       struct UseTable *uptr = NULL;
+
+       switch(operation) {
+       
+               case UT_LOAD:
+                       return(1);
+                       break;
+
+               case UT_SAVE:
+                       return(1);
+                       break;
 
+               case UT_INSERT:
+                       return(1);
+                       break;
+
+       }
+
+       /* should never get here unless illegal operation specified */
+       return(2);
+}
 
 
 /* 
index 60ebce1e589d69a296e86fb9dbd59010e320a534..f3c9bbdb896d39ac989e92eb5b9c7e854df0d023 100644 (file)
@@ -8,3 +8,30 @@ struct SpoolControl {
        struct namelist *listrecps;
        struct namelist *ignet_push_shares;
 };
+
+struct RoomProcList {
+        struct RoomProcList *next;
+        char name[ROOMNAMELEN];
+};
+
+struct NetMap {
+       struct NetMap *next;
+       char nodename[SIZ];
+       time_t lastcontact;
+       char nexthop[SIZ];
+};
+
+struct UseTable {
+       struct UseTable *next;
+       char *message_id;
+       time_t timestamp;
+};
+
+/*
+ * Operations which can be performed by the network_usetable() function
+ */
+enum {
+       UT_INSERT,
+       UT_LOAD,
+       UT_SAVE
+};