The Netsukuku Project
0.0.9
An Alternative routing method
|
Go to the source code of this file.
Data Structures | |
struct | _PACKED_ |
struct | PACKET |
struct | _PACKED_ |
struct | pkt_op_table |
struct | pkt_queue |
Macros | |
#define | NETSUKUKU_ID "ntk" |
#define | MAXMSGSZ 65536 |
#define | SKT_TCP 1 |
#define | SKT_UDP 2 |
#define | SKT_BCAST 3 |
#define | PKT_BIND_DEV 1 /* Bind the pkt.sk socket to pkt.dev */ |
#define | PKT_RECV_TIMEOUT (1<<1) |
#define | PKT_SEND_TIMEOUT (1<<2) |
#define | PKT_SET_LOWDELAY (1<<3) |
#define | PKT_COMPRESSED |
#define | PKT_KEEPALIVE (1<<5) /* Let the pkt.sk socket be alive */ |
#define | PKT_NONBLOCK (1<<6) /* Socket must not block */ |
#define | SEND_ACK 1 |
#define | BCAST_PKT |
#define | HOOK_PKT |
#define | ASYNC_REPLY |
#define | ASYNC_REPLIED (1<<4) |
#define | LOOPBACK_PKT (1<<5) /* This is a packet destinated to me */ |
#define | RESTRICTED_PKT |
#define | COMPRESSED_PKT (1<<7) /* The whole packet is Z compressed */ |
#define | BCAST_TRACER_PKT |
#define | BCAST_TRACER_BBLOCK |
#define | BCAST_TRACER_STARTERS |
#define | QSPN_BNODE_CLOSED |
#define | QSPN_BNODE_OPENED (1<<4) |
#define | PKT_MAX_MSG_SZ 1048576 /* bytes */ |
#define | PKT_COMPRESS_LEVEL Z_DEFAULT_COMPRESSION |
#define | PKT_COMPRESS_THRESHOLD |
#define | PACKET_SZ(sz) (sizeof(pkt_hdr)+(sz)) |
#define | BRDCAST_SZ(pkt_sz) (sizeof(brdcast_hdr)+(pkt_sz)) |
#define | BRDCAST_HDR_PTR(msg) ((brdcast_hdr *)(msg)) |
#define | PKT_Q_MTX_LOCKED 1 /* We are waiting the reply */ |
#define | PKT_Q_PKT_RECEIVED (1<<1) /* The reply was received */ |
#define | PKT_Q_TIMEOUT (1<<2) /* None replied ._, */ |
#define | PKT_Q_CHECK_FROM |
#define | SEND_RQ_ERR -1 |
#define | SEND_RQ_ERR_RQ -2 |
#define | SEND_RQ_ERR_RE -3 |
#define | SEND_RQ_ERR_PORT -4 |
#define | SEND_RQ_ERR_TO -5 |
#define | SEND_RQ_ERR_CONNECT -6 |
#define | SEND_RQ_ERR_SEND -7 |
#define | SEND_RQ_ERR_RECV -8 |
#define | SEND_RQ_ERR_RECVOP -9 |
#define | SEND_RQ_ERR_RECVID -10 |
#define | SEND_RQ_ERR_REPLY -11 |
Typedefs | |
typedef struct pkt_queue | pkt_queue |
Functions | |
void | pkts_init (interface *ifs, int ifs_n, int queue_init) |
void | pkt_addfrom (PACKET *pkt, inet_prefix *from) |
void | pkt_addto (PACKET *pkt, inet_prefix *to) |
void | pkt_add_dev (PACKET *pkt, interface *dev, int bind_the_socket) |
void | pkt_addsk (PACKET *pkt, int family, int sk, int sk_type) |
void | pkt_addport (PACKET *pkt, u_short port) |
void | pkt_addflags (PACKET *pkt, int flags) |
void | pkt_addtimeout (PACKET *pkt, u_int timeout, int recv, int send) |
void | pkt_addcompress (PACKET *pkt) |
void | pkt_addlowdelay (PACKET *pkt) |
void | pkt_addnonblock (PACKET *pkt) |
void | pkt_addhdr (PACKET *pkt, pkt_hdr *hdr) |
void | pkt_addmsg (PACKET *pkt, char *msg) |
void | pkt_copy (PACKET *dst, PACKET *src) |
void | pkt_clear (PACKET *pkt) |
void | pkt_free (PACKET *pkt, int close_socket) |
char * | pkt_pack (PACKET *pkt) |
int | pkt_verify_hdr (PACKET pkt) |
ssize_t | pkt_send (PACKET *pkt) |
ssize_t | pkt_recv (PACKET *pkt) |
int | pkt_tcp_connect (inet_prefix *host, short port, interface *dev) |
void | pkt_fill_hdr (pkt_hdr *hdr, u_char flags, int id, u_char op, size_t sz) |
int | send_rq (PACKET *pkt, int pkt_flags, u_char rq, int rq_id, u_char re, int check_ack, PACKET *rpkt) |
int | forward_pkt (PACKET rpkt, inet_prefix to) |
int | pkt_err (PACKET pkt, u_char err, int free_pkt) |
void | add_pkt_op (u_char op, char sk_type, u_short port, int(*exec_f)(PACKET pkt)) |
int | pkt_exec (PACKET pkt, int acpt_idx) |
void | pkt_queue_init (void) |
void | pkt_queue_close (void) |
int | pkt_q_wait_recv (int id, inet_prefix *from, PACKET *rpkt, pkt_queue **ret_pq) |
int | pkt_q_add_pkt (PACKET pkt) |
void | pkt_q_del (pkt_queue *pq, int close_socket) |
Variables | |
static const int_info | pkt_hdr_iinfo |
static const int_info | brdcast_hdr_iinfo = { 1, { 1 }, { sizeof(char)*4 }, { 1 } } |
struct pkt_op_table | pkt_op_tbl [(ACK_NEGATIVE+1)] |
pkt_queue * | pkt_q |
int | pkt_q_counter |
#define ASYNC_REPLIED (1<<4) |
#define ASYNC_REPLY |
#define BCAST_PKT |
#define BCAST_TRACER_BBLOCK |
#define BCAST_TRACER_PKT |
#define BCAST_TRACER_STARTERS |
#define BRDCAST_HDR_PTR | ( | msg | ) | ((brdcast_hdr *)(msg)) |
#define BRDCAST_SZ | ( | pkt_sz | ) | (sizeof(brdcast_hdr)+(pkt_sz)) |
#define COMPRESSED_PKT (1<<7) /* The whole packet is Z compressed */ |
#define HOOK_PKT |
#define LOOPBACK_PKT (1<<5) /* This is a packet destinated to me */ |
#define MAXMSGSZ 65536 |
#define NETSUKUKU_ID "ntk" |
#define PACKET_SZ | ( | sz | ) | (sizeof(pkt_hdr)+(sz)) |
#define PKT_BIND_DEV 1 /* Bind the pkt.sk socket to pkt.dev */ |
#define PKT_COMPRESS_LEVEL Z_DEFAULT_COMPRESSION |
#define PKT_COMPRESS_THRESHOLD |
#define PKT_COMPRESSED |
#define PKT_KEEPALIVE (1<<5) /* Let the pkt.sk socket be alive */ |
#define PKT_MAX_MSG_SZ 1048576 /* bytes */ |
#define PKT_NONBLOCK (1<<6) /* Socket must not block */ |
#define PKT_Q_CHECK_FROM |
#define PKT_Q_MTX_LOCKED 1 /* We are waiting the reply */ |
#define PKT_Q_PKT_RECEIVED (1<<1) /* The reply was received */ |
#define PKT_Q_TIMEOUT (1<<2) /* None replied ._, */ |
#define PKT_RECV_TIMEOUT (1<<1) |
#define PKT_SEND_TIMEOUT (1<<2) |
#define PKT_SET_LOWDELAY (1<<3) |
#define QSPN_BNODE_CLOSED |
#define QSPN_BNODE_OPENED (1<<4) |
#define RESTRICTED_PKT |
#define SEND_ACK 1 |
#define SEND_RQ_ERR -1 |
#define SEND_RQ_ERR_CONNECT -6 |
#define SEND_RQ_ERR_PORT -4 |
#define SEND_RQ_ERR_RE -3 |
#define SEND_RQ_ERR_RECV -8 |
#define SEND_RQ_ERR_RECVID -10 |
#define SEND_RQ_ERR_RECVOP -9 |
#define SEND_RQ_ERR_REPLY -11 |
#define SEND_RQ_ERR_RQ -2 |
#define SEND_RQ_ERR_SEND -7 |
#define SEND_RQ_ERR_TO -5 |
#define SKT_BCAST 3 |
#define SKT_TCP 1 |
#define SKT_UDP 2 |
void add_pkt_op | ( | u_char | op, |
char | sk_type, | ||
u_short | port, | ||
int(*)(PACKET pkt) | exec_f | ||
) |
int forward_pkt | ( | PACKET | rpkt, |
inet_prefix | to | ||
) |
void pkt_addcompress | ( | PACKET * | pkt | ) |
void pkt_addflags | ( | PACKET * | pkt, |
int | flags | ||
) |
void pkt_addfrom | ( | PACKET * | pkt, |
inet_prefix * | from | ||
) |
void pkt_addhdr | ( | PACKET * | pkt, |
pkt_hdr * | hdr | ||
) |
void pkt_addlowdelay | ( | PACKET * | pkt | ) |
void pkt_addmsg | ( | PACKET * | pkt, |
char * | msg | ||
) |
void pkt_addnonblock | ( | PACKET * | pkt | ) |
void pkt_addport | ( | PACKET * | pkt, |
u_short | port | ||
) |
void pkt_addsk | ( | PACKET * | pkt, |
int | family, | ||
int | sk, | ||
int | sk_type | ||
) |
void pkt_addtimeout | ( | PACKET * | pkt, |
u_int | timeout, | ||
int | recv, | ||
int | send | ||
) |
void pkt_addto | ( | PACKET * | pkt, |
inet_prefix * | to | ||
) |
void pkt_clear | ( | PACKET * | pkt | ) |
int pkt_err | ( | PACKET | pkt, |
u_char | err, | ||
int | free_pkt | ||
) |
int pkt_exec | ( | PACKET | pkt, |
int | acpt_idx | ||
) |
void pkt_fill_hdr | ( | pkt_hdr * | hdr, |
u_char | flags, | ||
int | id, | ||
u_char | op, | ||
size_t | sz | ||
) |
void pkt_free | ( | PACKET * | pkt, |
int | close_socket | ||
) |
char* pkt_pack | ( | PACKET * | pkt | ) |
int pkt_q_add_pkt | ( | PACKET | pkt | ) |
void pkt_q_del | ( | pkt_queue * | pq, |
int | close_socket | ||
) |
int pkt_q_wait_recv | ( | int | id, |
inet_prefix * | from, | ||
PACKET * | rpkt, | ||
pkt_queue ** | ret_pq | ||
) |
void pkt_queue_close | ( | void | ) |
void pkt_queue_init | ( | void | ) |
ssize_t pkt_recv | ( | PACKET * | pkt | ) |
ssize_t pkt_send | ( | PACKET * | pkt | ) |
int pkt_tcp_connect | ( | inet_prefix * | host, |
short | port, | ||
interface * | dev | ||
) |
int pkt_verify_hdr | ( | PACKET | pkt | ) |
void pkts_init | ( | interface * | ifs, |
int | ifs_n, | ||
int | queue_init | ||
) |
int send_rq | ( | PACKET * | pkt, |
int | pkt_flags, | ||
u_char | rq, | ||
int | rq_id, | ||
u_char | re, | ||
int | check_ack, | ||
PACKET * | rpkt | ||
) |
|
static |
|
static |
struct pkt_op_table pkt_op_tbl[ (ACK_NEGATIVE+1) ] |
pkt_queue* pkt_q |
int pkt_q_counter |