Merge branch 'Teaman-ND' into Teaman-RT
[tomato.git] / release / src / router / xl2tpd / call.h
blob9d604b92ac2be7953984a868a545da3b088fd34d
1 /*
2 * Layer Two Tunnelling Protocol Daemon
3 * Copyright (C) 1998 Adtran, Inc.
4 * Copyright (C) 2002 Jeff McAdams
6 * Mark Spencer
8 * This software is distributed under the terms
9 * of the GPL, which you should have received
10 * along with this source.
12 * Handle a call as a separate thread (header file)
14 #include <sys/time.h>
15 #include "misc.h"
16 #include "common.h"
17 #include "ipsecmast.h"
19 #define CALL_CACHE_SIZE 256
21 struct call
23 /* int rbit; Set the "R" bit on the next packet? */
24 int lbit; /* Should we send length field? */
25 /* int throttle; Throttle the connection? */
26 int seq_reqd; /* Sequencing required? */
27 int tx_pkts; /* Transmitted packets */
28 int rx_pkts; /* Received packets */
29 int tx_bytes; /* transmitted bytes */
30 int rx_bytes; /* received bytes */
31 struct schedule_entry *zlb_xmit;
32 /* Scheduled ZLB transmission */
33 /* struct schedule_entry *dethrottle; */
34 /* Scheduled dethrottling (overrun) */
35 /* int timeout; Has our timeout expired? If so, we'll go ahead
36 and transmit, full window or not, and set the
37 R-bit on this packet. */
38 int prx; /* What was the last packet we sent
39 as an Nr? Used to manage payload ZLB's */
40 int state; /* Current state */
41 int frame; /* Framing being used */
42 struct call *next; /* Next call, for linking */
43 int debug;
44 int msgtype; /* What kind of message are we
45 working with right now? */
47 int ourcid; /* Our call number */
48 int cid; /* Their call number */
49 int qcid; /* Quitting CID */
50 int bearer; /* Bearer type of call */
51 unsigned int serno; /* Call serial number */
52 unsigned int addr; /* Address reserved for this call */
53 int txspeed; /* Transmit speed */
54 int rxspeed; /* Receive speed */
55 int ppd; /* Packet processing delay (of peer) */
56 int physchan; /* Physical channel ID */
57 char dialed[MAXSTRLEN]; /* Number dialed for call */
58 char dialing[MAXSTRLEN]; /* Original caller ID */
59 char subaddy[MAXSTRLEN]; /* Sub address */
61 int needclose; /* Do we need to close this call? */
62 int closing; /* Are we actually in the process of closing? */
64 needclose closing state
65 ========= ======= =====
66 0 0 Running
67 1 0 Send Closing notice
68 1 1 Waiting for closing notice
69 0 1 Closing ZLB received, actulaly close
71 struct tunnel *container; /* Tunnel we belong to */
72 int fd; /* File descriptor for pty */
73 struct termios *oldptyconf;
74 int die;
75 int nego; /* Show negotiation? */
76 int pppd; /* PID of pppd */
77 int result; /* Result code */
78 int error; /* Error code */
79 int fbit; /* Use sequence numbers? */
80 int ourfbit; /* Do we want sequence numbers? */
81 /* int ourrws; Our RWS for the call */
82 int cnu; /* Do we need to send updated Ns, Nr values? */
83 int pnu; /* ditto for payload packet */
84 char errormsg[MAXSTRLEN]; /* Error message */
85 /* int rws; Receive window size, or -1 for none */
86 struct timeval lastsent; /* When did we last send something? */
87 _u16 data_seq_num; /* Sequence for next payload packet */
88 _u16 data_rec_seq_num; /* Sequence for next received payload packet */
89 _u16 closeSs; /* What number was in Ns when we started to
90 close? */
91 int pLr; /* Last packet received by peer */
92 struct lns *lns; /* LNS that owns us */
93 struct lac *lac; /* LAC that owns us */
94 char dial_no[128]; /* jz: dialing number for outgoing call */
98 extern void push_handler (int);
99 extern void toss (struct buffer *);
100 extern struct call *get_call (int tunnel, int call, struct in_addr addr,
101 int port,
102 IPsecSAref_t refme, IPsecSAref_t refhim);
103 extern struct call *get_tunnel (int, unsigned int, int);
104 extern void destroy_call (struct call *);
105 extern struct call *new_call (struct tunnel *);
106 extern void set_error (struct call *, int, const char *, ...);
107 void *call_thread_init (void *);
108 void call_close (struct call *);