"Fossies" - the Fresh Open Source Software Archive

Member "netbiff-0.9.18/connection.h" (21 Sep 2003, 1191 Bytes) of package /linux/privat/old/netbiff-0.9.18.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #ifndef CONNECTION_H
    2 #define CONNECTION_H
    3 
    4 #include "action.h"
    5 #include "buffer.h"
    6 #include <sys/types.h>
    7 
    8 #define MAX_CONNECTION_UPDATES 64
    9 #define MAX_CONNECTION_RESETS 64
   10 #define MAX_CONNECTION_FOLDERS 64
   11 #define MAX_CONNECTIONS 64
   12 
   13 #define CSTATE_WAIT_HELLO 0
   14 #define CSTATE_ADDING_FOLDERS 1
   15 #define CSTATE_NORMAL 3
   16 #define CSTATE_PENALTY_BOX 4
   17 
   18 typedef struct _folder Folder;
   19 struct _folder {
   20   char *name;
   21   int biffed;
   22 };
   23 
   24 typedef struct _connection Connection;
   25 struct _connection {
   26   int state;
   27   int pending_commands;
   28 
   29   time_t retry_time;
   30   int penalty;
   31 
   32   int fd_in;
   33   int fd_out;
   34   Buffer bin;
   35   Buffer bout;
   36 
   37   char *name;
   38   char *command;
   39 
   40   unsigned nupdates;
   41   const Action *updates[MAX_CONNECTION_UPDATES];
   42 
   43   unsigned nresets;
   44   const Action *resets[MAX_CONNECTION_RESETS];
   45 
   46   unsigned nfolders;
   47   Folder folders[MAX_CONNECTION_FOLDERS];
   48   unsigned folders_added;
   49 };
   50 
   51 extern Connection connections[MAX_CONNECTIONS];
   52 extern unsigned nconnections;
   53 
   54 void connection_init(Connection *c);
   55 void connection_close(Connection *c);
   56 
   57 void connection_do_update(Connection *c, const char *folder);
   58 void connection_do_reset(Connection *c, const char *folder);
   59 
   60 #endif /* CONNECTION_H */