-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathss_lthread.h
62 lines (52 loc) · 1.04 KB
/
ss_lthread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _SS_LTHREAD_H_
#define _SS_LTHREAD_H_
#include <sys/types.h>
#include <stdint.h>
#include <pthread.h>
#include "ss_queue.h"
struct lthread_args
{
char *listen_addr;
int listen_port;
char *cmd_listen_addr;
int cmd_listen_port;
int sock;
struct queue outpacket_queue;
int wildcard;
struct b2bua_slot *bslots;
};
#define INP(xp) ((xp)->body.inp)
#define OUTP(xp) ((xp)->body.outp)
enum wi_type {WI_INPACKET, WI_OUTPACKET};
struct inpacket_wi
{
u_char *databuf;
int rsize;
double dtime;
char *remote_addr;
int remote_port;
char *local_addr;
int local_port;
};
struct outpacket_wi
{
char *databuf;
int ssize;
char *remote_addr;
char *remote_port;
char *local_addr;
int local_port;
};
struct wi
{
enum wi_type wi_type;
union {
struct inpacket_wi inp;
struct outpacket_wi outp;
} body;
struct wi *next;
};
struct wi *wi_malloc(enum wi_type type);
void wi_free(struct wi *wi);
void lthread_mgr_run(struct lthread_args *args);
#endif