"Fossies" - the Fresh Open Source Software Archive

Member "tcpproxy-2.0.0-beta15/tcpproxy.h" (28 Aug 2006, 3116 Bytes) of package /linux/privat/old/tcpproxy-2.0.0-beta15.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. For more information about "tcpproxy.h" see the Fossies "Dox" file reference documentation.

    1 
    2 #ifndef _TCPPROXY_INCLUDED
    3 #define _TCPPROXY_INCLUDED
    4 
    5 
    6 #include <stdarg.h>
    7 
    8 
    9 #define PROXYNAME       "tcpproxy"
   10 #define PIDFILE                 "/var/run/tcpproxy.pid"
   11 #define ERROR_LOG               "/tmp/tcpproxy-error.log"
   12 #define MAX_PORT                80
   13 
   14 
   15 typedef struct _port {
   16     unsigned int port;
   17     int     count;
   18     char    ip[40];
   19     int     sock;
   20     } port_t;
   21 
   22 
   23 #define PROXY_DEFAULT       0
   24 #define PROXY_SERVER        1
   25 #define PROXY_PROGRAM       2
   26 
   27 #define REDIR_NONE      0
   28 #define REDIR_ACCEPT        1
   29 #define REDIR_FORWARD       2
   30 #define REDIR_FORWARD_ONLY  3
   31 
   32 #define ERRMODE_NONE        0
   33 #define ERRMODE_KEEP        1
   34 #define ERRMODE_HANDLER     2
   35 
   36 #define ERR_EXITCODEMASK    15
   37 
   38 #define ERR_STDERR      0x000080
   39 
   40 #define ERR_ACCESS      0x000100
   41 #define ERR_CONNECT     0x000200
   42 #define ERR_TIMEOUT     0x000400
   43 #define ERR_SERVER      0x000800
   44 #define ERR_CLIENT      0x001000
   45 #define ERR_PROXY       0x002000
   46 #define ERR_INFO        0x004000
   47 #define ERR_OK          0x008000
   48 #define ERR_ANY         0xFFFFFF
   49 
   50 /* #define  MAX_ARGS        32 */
   51 
   52 
   53 typedef struct _config {
   54     char    interface[300];
   55     unsigned int port;
   56     
   57     unsigned int uid;
   58     unsigned int gid;
   59     char    logname[80];
   60     char    writefile[200];
   61     int     timeout;
   62     int     cleanenv;
   63     int     extendedinfo;
   64     int     redirmode;
   65     char    acp[200];
   66     char    ctp[200];
   67     char    name[80];
   68 
   69     string_t    acl;
   70 
   71     int     proxytype;
   72     char    server[200];    /* Pointer to program or server list. */
   73 
   74     struct {
   75     int count, max; /* Array of source IP numbers. */
   76     char    **srcip;
   77 
   78     char    interface[40];  /* Selected outgoing interface ... */
   79     unsigned int port;  /* ... and port. */
   80     } srcip;
   81 
   82     peer_t  sock;
   83     peer_t  client;
   84     peer_t  origdst;    /* Original server from redirect */
   85     peer_t  s;      /* Remote server */
   86 
   87     long    bytes_send;
   88     long    bytes_received;
   89     unsigned long started;
   90 
   91     struct _config *next;
   92     } proxy_t;
   93 
   94 
   95 typedef struct {
   96     int     standalone;
   97 
   98     char    logname[200];
   99 
  100     proxy_t *def;
  101 
  102     int     binds;
  103     port_t  *bindport;
  104 
  105     proxy_t *first;
  106     proxy_t *last;
  107     int     proxy_count;
  108     } config_t;
  109 
  110 
  111 extern char *program;
  112 extern int debug;
  113 extern int onlynumbers;
  114 extern char varname[40];
  115 
  116 extern char statdir[200];
  117 extern char sessiondir[200];
  118 
  119 
  120 extern int geterrcode(char *name);
  121 extern int printerror(int rc, char *type, char *format, ...);
  122 
  123 extern int cleanenv(char **envp);
  124 extern int setvar(char *prefix, char *var, char *value);
  125 extern int setnumvar(char *prefix, char *var, unsigned long value);
  126 extern int set_variables(proxy_t *proxy);
  127 extern int run_acp(proxy_t *proxy);
  128 extern int run_ctp(proxy_t *proxy);
  129 
  130 extern proxy_t *new_configuration(config_t *config, proxy_t *def);
  131 extern proxy_t *find_configuration(config_t *config, char *interface, unsigned int port);
  132 
  133 extern int addsrcip(proxy_t *x, char *par);
  134 extern int addsrc(proxy_t *x, char *par, char *filename, int lineno);
  135 
  136 extern int set_redirmode(proxy_t *x, char *word, char *filename, int lineno);
  137 extern int get_sessionmode(proxy_t *x, char *word, char *filename, int lineno);
  138 extern int set_username(proxy_t *x, char *username, char *filename, int lineno);
  139 extern int read_configuration(config_t *config, char *filename);
  140 
  141 #endif
  142