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 "tcp.h"
#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 "conntrackd.h"
#include "fds.h"
Include dependency graph for tcp.c:

Macros

#define SO_RCVBUFFORCE   33
 
#define SO_SNDBUFFORCE   32
 
#define TCP_CONNECT_TIMEOUT   1
 

Functions

struct tcp_socktcp_server_create (struct tcp_conf *c)
 
void tcp_server_destroy (struct tcp_sock *m)
 
struct tcp_socktcp_client_create (struct tcp_conf *c)
 
void tcp_client_destroy (struct tcp_sock *m)
 
int tcp_accept (struct tcp_sock *m)
 
ssize_t tcp_send (struct tcp_sock *m, const void *data, int size)
 
ssize_t tcp_recv (struct tcp_sock *m, void *data, int size)
 
int tcp_get_fd (struct tcp_sock *m)
 
int tcp_isset (struct tcp_sock *m, fd_set *readfds)
 
int tcp_accept_isset (struct tcp_sock *m, fd_set *readfds)
 
int tcp_snprintf_stats (char *buf, size_t buflen, char *ifname, struct tcp_sock *client, struct tcp_sock *server)
 
int tcp_snprintf_stats2 (char *buf, size_t buflen, const char *ifname, const char *status, int active, struct tcp_stats *s, struct tcp_stats *r)
 

Macro Definition Documentation

#define SO_RCVBUFFORCE   33

Referenced by tcp_server_create().

#define SO_SNDBUFFORCE   32
#define TCP_CONNECT_TIMEOUT   1

Referenced by tcp_send().

Function Documentation

int tcp_accept ( struct tcp_sock m)

References tcp_sock::client_fd, tcp_sock::fd, NULL, tcp_sock::state, STATE, TCP_SERVER_ACCEPTING, TCP_SERVER_CONNECTED, and unregister_fd().

Here is the call graph for this function:

int tcp_accept_isset ( struct tcp_sock m,
fd_set *  readfds 
)

References tcp_sock::fd.

struct tcp_sock* tcp_client_create ( struct tcp_conf c)
void tcp_client_destroy ( struct tcp_sock m)

References tcp_sock::fd.

int tcp_get_fd ( struct tcp_sock m)

References tcp_sock::fd.

int tcp_isset ( struct tcp_sock m,
fd_set *  readfds 
)

References tcp_sock::client_fd.

ssize_t tcp_recv ( struct tcp_sock m,
void *  data,
int  size 
)
struct tcp_sock* tcp_server_create ( struct tcp_conf c)
void tcp_server_destroy ( struct tcp_sock m)

References tcp_sock::fd.

int tcp_snprintf_stats ( char *  buf,
size_t  buflen,
char *  ifname,
struct tcp_sock client,
struct tcp_sock server 
)
int tcp_snprintf_stats2 ( char *  buf,
size_t  buflen,
const char *  ifname,
const char *  status,
int  active,
struct tcp_stats s,
struct tcp_stats r 
)