-
Notifications
You must be signed in to change notification settings - Fork 1
/
call.h
109 lines (103 loc) · 4.75 KB
/
call.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* Layer Two Tunnelling Protocol Daemon
* Copyright (C) 1998 Adtran, Inc.
* Copyright (C) 2002 Jeff McAdams
*
* Mark Spencer
*
* This software is distributed under the terms
* of the GPL, which you should have received
* along with this source.
*
* Handle a call as a separate thread (header file)
*/
#include <sys/time.h>
#include "misc.h"
#include "common.h"
#include "ipsecmast.h"
#define CALL_CACHE_SIZE 256
struct call
{
/* int rbit; Set the "R" bit on the next packet? */
int lbit; /* Should we send length field? */
/* int throttle; Throttle the connection? */
int seq_reqd; /* Sequencing required? */
int tx_pkts; /* Transmitted packets */
int rx_pkts; /* Received packets */
int tx_bytes; /* transmitted bytes */
int rx_bytes; /* received bytes */
struct schedule_entry *zlb_xmit;
/* Scheduled ZLB transmission */
/* struct schedule_entry *dethrottle; */
/* Scheduled dethrottling (overrun) */
/* int timeout; Has our timeout expired? If so, we'll go ahead
and transmit, full window or not, and set the
R-bit on this packet. */
int prx; /* What was the last packet we sent
as an Nr? Used to manage payload ZLB's */
int state; /* Current state */
int frame; /* Framing being used */
struct call *next; /* Next call, for linking */
int debug;
int msgtype; /* What kind of message are we
working with right now? */
int ourcid; /* Our call number */
int cid; /* Their call number */
int qcid; /* Quitting CID */
int bearer; /* Bearer type of call */
unsigned int serno; /* Call serial number */
unsigned int addr; /* Address reserved for this call */
int txspeed; /* Transmit speed */
int rxspeed; /* Receive speed */
int ppd; /* Packet processing delay (of peer) */
int physchan; /* Physical channel ID */
char dialed[MAXSTRLEN]; /* Number dialed for call */
char dialing[MAXSTRLEN]; /* Original caller ID */
char subaddy[MAXSTRLEN]; /* Sub address */
int needclose; /* Do we need to close this call? */
int closing; /* Are we actually in the process of closing? */
/*
needclose closing state
========= ======= =====
0 0 Running
1 0 Send Closing notice
1 1 Waiting for closing notice
0 1 Closing ZLB received, actulaly close
*/
struct tunnel *container; /* Tunnel we belong to */
int fd; /* File descriptor for pty */
struct termios *oldptyconf;
char ptyname[6]; /* mf, 08.04.2003: string for ptyname */
int die;
int nego; /* Show negotiation? */
int pppd; /* PID of pppd */
int result; /* Result code */
int error; /* Error code */
int fbit; /* Use sequence numbers? */
int ourfbit; /* Do we want sequence numbers? */
/* int ourrws; Our RWS for the call */
int cnu; /* Do we need to send updated Ns, Nr values? */
int pnu; /* ditto for payload packet */
char errormsg[MAXSTRLEN]; /* Error message */
/* int rws; Receive window size, or -1 for none */
struct timeval lastsent; /* When did we last send something? */
_u16 data_seq_num; /* Sequence for next payload packet */
_u16 data_rec_seq_num; /* Sequence for next received payload packet */
_u16 closeSs; /* What number was in Ns when we started to
close? */
int pLr; /* Last packet received by peer */
struct lns *lns; /* LNS that owns us */
struct lac *lac; /* LAC that owns us */
char dial_no[128]; /* jz: dialing number for outgoing call */
};
extern void push_handler (int);
extern void toss (struct buffer *);
extern struct call *get_call (int tunnel, int call, struct in_addr addr,
int port,
IPsecSAref_t refme, IPsecSAref_t refhim);
extern struct call *get_tunnel (int, unsigned int, int);
extern void destroy_call (struct call *);
extern struct call *new_call (struct tunnel *);
extern void set_error (struct call *, int, const char *, ...);
void *call_thread_init (void *);
void call_close (struct call *);