Main Page | Class List | File List | Class Members | File Members

tcpproxy.h

Go to the documentation of this file.
00001 /* TCP Proxy server.
00002  *
00003  */
00004 
00005 #ifndef _TCPPROXY_H
00006 #define _TCPPROXY_H
00007 
00008 #define _REENTRANT       /* Use thread-safe libraries. */
00009 #define MALLOC_CHECK_ 2  /* Abort immediately on malloc error. */ 
00010 
00011 #include "libipq.h"
00012 #include <signal.h>
00013 
00014 #define DEBUG 1
00015 
00016 #define TCP_MAX_CONN 256  /* Maximum number of concurrent TCP connections allowed. */
00017 
00018 /*
00019  * Structures
00020  */
00021 
00022 enum {
00023   EXIT_ERR_USAGE = 1,
00024   EXIT_ERR_BAD_MOBILE_IP,
00025   EXIT_ERR_IPQ_CREATE_HANDLE,
00026   EXIT_ERR_IPQ_SET_MODE,
00027   EXIT_ERR_IPQ_READ,
00028   EXIT_ERR_IPQ_MESSAGE_TYPE,
00029   EXIT_ERR_IPQ_ERR_MESSAGE,
00030   EXIT_ERR_MEM_ALLOC,
00031   EXIT_ERR_MEM_FREE,
00032   EXIT_ERR_IPQ_DESTROY_HANDLE,
00033   EXIT_ERR_WRONG_IP_VER,
00034   EXIT_ERR_CREATE_THREAD,
00035   EXIT_ERR_PTHREAD_ATTR,
00036   EXIT_ERR_SIG_MASK,
00037   EXIT_ERR_SET_SIG_HANDLER,
00038   EXIT_ERR_QUEUE_EMPTY,
00039   EXIT_ERR_QUEUE_FULL,
00040   EXIT_ERR_QUEUE_TYPE,
00041   EXIT_ERR_SEM_INIT,
00042   EXIT_ERR_MUTEX,
00043   EXIT_ERR_SOCKET
00044 };
00045 
00046 typedef enum packet_dir
00047 {
00048     PACKET_DIR_IN = 1,
00049     PACKET_DIR_OUT
00050 } Tpacket_dir;
00051 
00052 typedef struct packet_data
00053 {
00054     struct ipq_packet_msg ipq_pm;
00055     unsigned char *payload;
00056     struct iphdr *ip;
00057     union {
00058         struct tcphdr *tcp;
00059         char *hdr;
00060     } trans;
00061     enum packet_dir dir;
00062 } Tpacket_data;
00063 
00064 inline Tpacket_data *alloc_packet_data(ipq_packet_msg_t *p);
00065 inline void dealloc_packet_data(Tpacket_data *pd);
00066 
00067 extern volatile sig_atomic_t request_exit;
00068 extern pthread_t main_thread;
00069 
00070 #endif /* _TCPPROXY_H */

Generated on Sun May 14 13:36:52 2006 by  doxygen 1.4.2