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

tcpproxy.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include <string.h>
#include <libgen.h>
#include <linux/netfilter.h>
#include "libipq.h"
#include <linux/ip.h>
#include <arpa/inet.h>
#include <signal.h>
#include <pthread.h>
#include "misc.h"
#include "tcp.h"
#include "scheduler.h"
#include "tcptimer.h"
#include "tcpproxy.h"

Go to the source code of this file.

Defines

#define IPQ_BUF_SIZE   10240

Functions

Tpacket_dataalloc_packet_data (ipq_packet_msg_t *p)
void dealloc_packet_data (Tpacket_data *pd)
unsigned short ip_chksum (ipq_packet_msg_t *p, unsigned int words)
int handle_icmp (Tpacket_data *pd)
int handle_other (Tpacket_data *pd)
int handle_packet (ipq_packet_msg_t *p)
void cleanup ()
void signal_handler (int signum)
int main (int argc, const char *argv[])

Variables

static struct ipq_handleqh
static __u32 mob_ip
static pthread_t sched_thread
static pthread_t timer_thread
volatile sig_atomic_t request_exit = 0
pthread_t main_thread


Define Documentation

#define IPQ_BUF_SIZE   10240
 

Definition at line 24 of file tcpproxy.c.

Referenced by main().


Function Documentation

Tpacket_data* alloc_packet_data ipq_packet_msg_t *  p  )  [inline]
 

Definition at line 42 of file tcpproxy.c.

References packet_data::ip, packet_data::ipq_pm, packet_data::payload, packet_data::trans, and xmalloc().

Referenced by handle_packet().

void cleanup  ) 
 

Definition at line 212 of file tcpproxy.c.

References EPRINT, EXIT_ERR_IPQ_DESTROY_HANDLE, ipq_destroy_handle(), ipq_perror(), IPRINT, request_exit, sched_thread, and timer_thread.

Referenced by main().

void dealloc_packet_data Tpacket_data pd  )  [inline]
 

Definition at line 61 of file tcpproxy.c.

References packet_data::payload, and xfree().

Referenced by clear_tcp_queue(), handle_packet(), handle_tcp(), queue_packet(), and send_packet().

int handle_icmp Tpacket_data pd  ) 
 

Definition at line 95 of file tcpproxy.c.

References queue_hipri().

Referenced by handle_packet().

int handle_other Tpacket_data pd  ) 
 

Definition at line 105 of file tcpproxy.c.

References queue_lowpri().

Referenced by handle_packet().

int handle_packet ipq_packet_msg_t *  p  ) 
 

Definition at line 116 of file tcpproxy.c.

References alloc_packet_data(), dealloc_packet_data(), DEBUG, packet_data::dir, DPRINT, EPRINT, EXIT_ERR_WRONG_IP_VER, handle_icmp(), handle_other(), handle_tcp(), packet_data::ip, ip_chksum(), ipq_perror(), ipq_set_verdict(), IPRINT, mob_ip, PACKET_DIR_IN, and PACKET_DIR_OUT.

Referenced by main().

unsigned short ip_chksum ipq_packet_msg_t *  p,
unsigned int  words
 

Definition at line 75 of file tcpproxy.c.

Referenced by handle_packet().

int main int  argc,
const char *  argv[]
 

Definition at line 260 of file tcpproxy.c.

References cleanup(), cleanup_sched(), cleanup_tcp(), cleanup_timer(), DPRINT, EPRINT, EXIT_ERR_BAD_MOBILE_IP, EXIT_ERR_CREATE_THREAD, EXIT_ERR_IPQ_CREATE_HANDLE, EXIT_ERR_IPQ_ERR_MESSAGE, EXIT_ERR_IPQ_MESSAGE_TYPE, EXIT_ERR_IPQ_SET_MODE, EXIT_ERR_PTHREAD_ATTR, EXIT_ERR_SET_SIG_HANDLER, EXIT_ERR_USAGE, handle_packet(), init_sched(), init_tcp(), init_timer(), IPQ_BUF_SIZE, ipq_create_handle(), ipq_get_msgerr(), ipq_get_packet(), ipq_message_type(), ipq_perror(), ipq_read(), ipq_set_mode(), main_thread, mob_ip, request_exit, sched_thread, scheduler(), signal_handler(), tcp_timer(), and timer_thread.

void signal_handler int  signum  ) 
 

Definition at line 233 of file tcpproxy.c.

References DPRINT, EPRINT, and request_exit.

Referenced by main().


Variable Documentation

pthread_t main_thread
 

Definition at line 36 of file tcpproxy.c.

Referenced by main(), and safe_exit().

__u32 mob_ip [static]
 

Definition at line 31 of file tcpproxy.c.

Referenced by handle_packet(), and main().

struct ipq_handle* qh [static]
 

Definition at line 30 of file tcpproxy.c.

volatile sig_atomic_t request_exit = 0
 

Definition at line 35 of file tcpproxy.c.

Referenced by cleanup(), main(), safe_exit(), scheduler(), signal_handler(), and tcp_timer().

pthread_t sched_thread [static]
 

Definition at line 32 of file tcpproxy.c.

Referenced by cleanup(), and main().

pthread_t timer_thread [static]
 

Definition at line 33 of file tcpproxy.c.

Referenced by cleanup(), and main().


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