26 #define NETSUKUKU_ID "ntk"
27 #define MAXMSGSZ 65536
44 #define PKT_BIND_DEV 1
45 #define PKT_RECV_TIMEOUT (1<<1)
46 #define PKT_SEND_TIMEOUT (1<<2)
47 #define PKT_SET_LOWDELAY (1<<3)
48 #define PKT_COMPRESSED (1<<4)
50 #define PKT_KEEPALIVE (1<<5)
51 #define PKT_NONBLOCK (1<<6)
57 #define BCAST_PKT (1<<1)
59 #define HOOK_PKT (1<<2)
61 #define ASYNC_REPLY (1<<3)
64 #define ASYNC_REPLIED (1<<4)
65 #define LOOPBACK_PKT (1<<5)
66 #define RESTRICTED_PKT (1<<6)
68 #define COMPRESSED_PKT (1<<7)
74 #define BCAST_TRACER_PKT 1
76 #define BCAST_TRACER_BBLOCK (1<<1)
78 #define BCAST_TRACER_STARTERS (1<<2)
80 #define QSPN_BNODE_CLOSED (1<<3)
82 #define QSPN_BNODE_OPENED (1<<4)
85 #define PKT_MAX_MSG_SZ 1048576
86 #define PKT_COMPRESS_LEVEL Z_DEFAULT_COMPRESSION
87 #define PKT_COMPRESS_THRESHOLD 1024
106 {
sizeof(char)*3,
sizeof(
char)*5+
sizeof(int),
107 sizeof(
char)*5+
sizeof(int)+
sizeof(
size_t) },
110 #define PACKET_SZ(sz) (sizeof(pkt_hdr)+(sz))
166 #define BRDCAST_SZ(pkt_sz) (sizeof(brdcast_hdr)+(pkt_sz))
167 #define BRDCAST_HDR_PTR(msg) ((brdcast_hdr *)(msg))
186 #define PKT_Q_MTX_LOCKED 1
187 #define PKT_Q_PKT_RECEIVED (1<<1)
188 #define PKT_Q_TIMEOUT (1<<2)
189 #define PKT_Q_CHECK_FROM (1<<3)
247 #define SEND_RQ_ERR -1
248 #define SEND_RQ_ERR_RQ -2
249 #define SEND_RQ_ERR_RE -3
250 #define SEND_RQ_ERR_PORT -4
251 #define SEND_RQ_ERR_TO -5
252 #define SEND_RQ_ERR_CONNECT -6
253 #define SEND_RQ_ERR_SEND -7
254 #define SEND_RQ_ERR_RECV -8
255 #define SEND_RQ_ERR_RECVOP -9
256 #define SEND_RQ_ERR_RECVID -10
257 #define SEND_RQ_ERR_REPLY -11
259 int check_ack,
PACKET *rpkt);
pthread_mutex_t mtx
Definition: pkts.h:210
void pkt_addtimeout(PACKET *pkt, u_int timeout, int recv, int send)
Definition: pkts.c:94
u_char gttl
Definition: pkts.h:157
u_char op
Definition: pkts.h:100
inet_prefix from
Definition: pkts.h:122
void pkt_addto(PACKET *pkt, inet_prefix *to)
Definition: pkts.c:67
int id
Definition: pkts.h:98
char sk_type
Definition: pkts.h:180
PACKET pkt
Definition: pkts.h:209
u_int timeout
Definition: pkts.h:141
void pkt_addsk(PACKET *pkt, int family, int sk, int sk_type)
Definition: pkts.c:82
char sk_type
Definition: pkts.h:135
pkt_hdr hdr
Definition: pkts.h:148
void add_pkt_op(u_char op, char sk_type, u_short port, int(*exec_f)(PACKET pkt))
Definition: pkts.c:563
char * msg
Definition: pkts.h:149
int pkt_q_add_pkt(PACKET pkt)
Definition: pkts.c:1003
int pkt_q_counter
Definition: pkts.h:217
ssize_t pkt_recv(PACKET *pkt)
Definition: pkts.c:477
int send_rq(PACKET *pkt, int pkt_flags, u_char rq, int rq_id, u_char re, int check_ack, PACKET *rpkt)
Definition: pkts.c:604
void pkt_addflags(PACKET *pkt, int flags)
u_char sub_id
Definition: pkts.h:159
struct pkt_op_table pkt_op_tbl[(ACK_NEGATIVE+1)]
ssize_t pkt_send(PACKET *pkt)
Definition: pkts.c:335
static const int_info brdcast_hdr_iinfo
Definition: pkts.h:165
void pkt_addport(PACKET *pkt, u_short port)
Definition: pkts.c:89
void pkt_free(PACKET *pkt, int close_socket)
Definition: pkts.c:162
char flags
Definition: pkts.h:162
void pkts_init(interface *ifs, int ifs_n, int queue_init)
Definition: pkts.c:44
int sk
Definition: pkts.h:134
u_short port
Definition: pkts.h:136
void pkt_addhdr(PACKET *pkt, pkt_hdr *hdr)
Definition: pkts.c:119
interface * dev
Definition: pkts.h:125
void pkt_queue_init(void)
Definition: pkts.c:878
#define TOTAL_OPS
Definition: request.h:102
void pkt_addmsg(PACKET *pkt, char *msg)
Definition: pkts.c:127
int family
Definition: pkts.h:133
static const int_info pkt_hdr_iinfo
Definition: pkts.h:104
u_char g_node
Definition: pkts.h:155
u_short port
Definition: pkts.h:181
void pkt_add_dev(PACKET *pkt, interface *dev, int bind_the_socket)
Definition: pkts.c:75
void pkt_copy(PACKET *dst, PACKET *src)
Definition: pkts.c:151
inet_prefix to
Definition: pkts.h:123
u_char pkt_flags
Definition: pkts.h:138
u_char flags
Definition: pkts.h:99
int pkt_tcp_connect(inet_prefix *host, short port, interface *dev)
Definition: pkts.c:502
#define INT_INFO
Definition: endianness.h:90
void * exec_func
Definition: pkts.h:182
size_t uncompress_sz
Definition: pkts.h:102
int pkt_err(PACKET pkt, u_char err, int free_pkt)
Definition: pkts.c:775
int pkt_q_wait_recv(int id, inet_prefix *from, PACKET *rpkt, pkt_queue **ret_pq)
Definition: pkts.c:946
void pkt_addfrom(PACKET *pkt, inet_prefix *from)
Definition: pkts.c:59
pkt_queue * pkt_q
Definition: pkts.h:216
void pkt_addcompress(PACKET *pkt)
Definition: pkts.c:104
void pkt_clear(PACKET *pkt)
Definition: pkts.c:138
size_t sz
Definition: pkts.h:101
#define LLIST_HDR(_struct)
Definition: llist.c:44
int family
Definition: if.c:34
int flags
Definition: if.c:39
void pkt_fill_hdr(pkt_hdr *hdr, u_char flags, int id, u_char op, size_t sz)
Definition: pkts.c:545
void pkt_addnonblock(PACKET *pkt)
Definition: pkts.c:114
void pkt_q_del(pkt_queue *pq, int close_socket)
Definition: pkts.c:1043
void pkt_queue_close(void)
Definition: pkts.c:886
#define INT_TYPE_32BIT
Definition: endianness.h:35
void pkt_addlowdelay(PACKET *pkt)
Definition: pkts.c:109
int pkt_exec(PACKET pkt, int acpt_idx)
Definition: pkts.c:813
int forward_pkt(PACKET rpkt, inet_prefix to)
Definition: pkts.c:756
char * pkt_pack(PACKET *pkt)
Definition: pkts.c:227
int pkt_verify_hdr(PACKET pkt)
Definition: pkts.c:320
int flags
Definition: pkts.h:139
char flags
Definition: pkts.h:212