netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
tcp.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <tcp.h>
#include <timer.h>
#include "logging.h"
Include dependency graph for tcp.c:

Data Structures

struct  tcp_server
 
struct  tcp_client
 

Macros

#define TCP_SERVER_LISTEN   20
 
#define TCP_CONNECT_TIMEOUT   1
 

Enumerations

enum  tcp_client_state {
  TCP_DISCONNECTED = 0,
  TCP_CONNECTING,
  TCP_CONNECTED
}
 

Functions

struct tcp_servertcp_server_create (struct tcp_conf *conf)
 
void tcp_server_destroy (struct tcp_server *c)
 
int tcp_server_get_fd (struct tcp_server *c)
 
int tcp_server_accept (struct tcp_server *c, struct sockaddr_in *addr)
 
int tcp_client_get_fd (struct tcp_client *c)
 
struct tcp_clienttcp_client_create (struct tcp_conf *conf)
 
void tcp_client_destroy (struct tcp_client *c)
 
ssize_t tcp_client_send (struct tcp_client *c, const void *data, int size)
 
ssize_t tcp_client_recv (struct tcp_client *c, void *data, int size)
 
void tcp_client_set_data (struct tcp_client *c, void *data)
 
void * tcp_client_get_data (struct tcp_client *c)
 

Macro Definition Documentation

#define TCP_CONNECT_TIMEOUT   1
#define TCP_SERVER_LISTEN   20

Referenced by tcp_server_create().

Enumeration Type Documentation

Enumerator
TCP_DISCONNECTED 
TCP_CONNECTING 
TCP_CONNECTED 

Function Documentation

struct tcp_client* tcp_client_create ( struct tcp_conf conf)

References tcp_sock::conf, init_alarm(), and NULL.

Referenced by tcp_client_start().

Here is the call graph for this function:

Here is the caller graph for this function:

void tcp_client_destroy ( struct tcp_client c)

References tcp_client::fd.

void* tcp_client_get_data ( struct tcp_client c)

References tcp_client::data.

int tcp_client_get_fd ( struct tcp_client c)

References tcp_client::fd.

Referenced by tcp_client_start().

Here is the caller graph for this function:

ssize_t tcp_client_recv ( struct tcp_client c,
void *  data,
int  size 
)
ssize_t tcp_client_send ( struct tcp_client c,
const void *  data,
int  size 
)
void tcp_client_set_data ( struct tcp_client c,
void *  data 
)

References tcp_client::data, and data.

int tcp_server_accept ( struct tcp_server c,
struct sockaddr_in *  addr 
)

References tcp_server::fd.

void tcp_server_destroy ( struct tcp_server c)

References tcp_server::fd.

int tcp_server_get_fd ( struct tcp_server c)

References tcp_server::fd.

Referenced by tcp_server_start().

Here is the caller graph for this function: