2 * Layer Two Tunnelling Protocol Daemon
3 * Copyright (C) 1998 Adtran, Inc.
4 * Copyright (C) 2002 Jeff McAdams
8 * This software is distributed under the terms
9 * of the GPL, which you should have received
10 * along with this source.
12 * Attribute Value Pair structures and
23 } __attribute__((packed
));
27 int num
; /* Number of AVP */
29 int (*handler
) (struct tunnel
*, struct call
*, void *, int);
30 /* This should handle the AVP
31 taking a tunnel, call, the data,
32 and the length of the AVP as
33 parameters. Should return 0
35 char *description
; /* A name, for debugging */
38 extern int handle_avps (struct buffer
*buf
, struct tunnel
*t
, struct call
*c
);
40 extern char *msgtypes
[];
42 #define VENDOR_ID 0 /* We don't have any extensions
43 so we shoouldn't have to
47 * Macros to extract information from length field of AVP
50 #define AMBIT(len) (len & 0x8000) /* Mandatory bit: If this is
51 set on an unknown AVP,
54 #define AHBIT(len) (len & 0x4000) /* Hidden bit: Specifies
57 #define AZBITS(len) (len & 0x3C00) /* Reserved bits: We must
58 drop anything with any
61 #define ALENGTH(len) (len & 0x03FF) /* Length: Lenth of AVP */
63 #define MAXAVPSIZE 1023
65 #define MAXTIME 300 /* time to wait before checking
68 #define MBIT 0x8000 /* for setting */
69 #define HBIT 0x4000 /* Set on hidden avp's */
71 #define ASYNC_FRAMING 2
72 #define SYNC_FRAMING 1
74 #define ANALOG_BEARER 2
75 #define DIGITAL_BEARER 1
77 #define VENDOR_ERROR 6
79 #define ERROR_RESERVED 3
80 #define ERROR_LENGTH 2
81 #define ERROR_NOTEXIST 1
83 #define ERROR_INVALID 6
84 #define RESULT_CLEAR 1
85 #define RESULT_ERROR 2
86 #define RESULT_EXISTS 3
87 extern void encrypt_avp (struct buffer
*, _u16
, struct tunnel
*);
88 extern int decrypt_avp (char *, struct tunnel
*);
89 extern int message_type_avp (struct tunnel
*, struct call
*, void *, int);
90 extern int protocol_version_avp (struct tunnel
*, struct call
*, void *, int);
91 extern int framing_caps_avp (struct tunnel
*, struct call
*, void *, int);
92 extern int bearer_caps_avp (struct tunnel
*, struct call
*, void *, int);
93 extern int firmware_rev_avp (struct tunnel
*, struct call
*, void *, int);
94 extern int hostname_avp (struct tunnel
*, struct call
*, void *, int);
95 extern int vendor_avp (struct tunnel
*, struct call
*, void *, int);
96 extern int assigned_tunnel_avp (struct tunnel
*, struct call
*, void *, int);
97 extern int receive_window_size_avp (struct tunnel
*, struct call
*, void *,
99 extern int result_code_avp (struct tunnel
*, struct call
*, void *, int);
100 extern int assigned_call_avp (struct tunnel
*, struct call
*, void *, int);
101 extern int call_serno_avp (struct tunnel
*, struct call
*, void *, int);
102 extern int bearer_type_avp (struct tunnel
*, struct call
*, void *, int);
103 extern int call_physchan_avp (struct tunnel
*, struct call
*, void *, int);
104 extern int dialed_number_avp (struct tunnel
*, struct call
*, void *, int);
105 extern int dialing_number_avp (struct tunnel
*, struct call
*, void *, int);
106 extern int sub_address_avp (struct tunnel
*, struct call
*, void *, int);
107 extern int frame_type_avp (struct tunnel
*, struct call
*, void *, int);
108 extern int rx_speed_avp (struct tunnel
*, struct call
*, void *, int);
109 extern int tx_speed_avp (struct tunnel
*, struct call
*, void *, int);
110 extern int packet_delay_avp (struct tunnel
*, struct call
*, void *, int);
111 extern int ignore_avp (struct tunnel
*, struct call
*, void *, int);
112 extern int seq_reqd_avp (struct tunnel
*, struct call
*, void *, int);
113 extern int challenge_avp (struct tunnel
*, struct call
*, void *, int);
114 extern int chalresp_avp (struct tunnel
*, struct call
*, void *, int);
115 extern int rand_vector_avp (struct tunnel
*, struct call
*, void *, int);
117 extern int add_challenge_avp (struct buffer
*, unsigned char *, int);
118 extern int add_avp_rws (struct buffer
*, _u16
);
119 extern int add_tunnelid_avp (struct buffer
*, _u16
);
120 extern int add_vendor_avp (struct buffer
*);
121 extern int add_hostname_avp (struct buffer
*, const char *);
122 extern int add_firmware_avp (struct buffer
*);
123 extern int add_bearer_caps_avp (struct buffer
*buf
, _u16 caps
);
124 extern int add_frame_caps_avp (struct buffer
*buf
, _u16 caps
);
125 extern int add_protocol_avp (struct buffer
*buf
);
126 extern int add_message_type_avp (struct buffer
*buf
, _u16 type
);
127 extern int add_result_code_avp (struct buffer
*buf
, _u16
, _u16
, char *, int);
128 extern int add_bearer_avp (struct buffer
*, int);
129 extern int add_frame_avp (struct buffer
*, int);
130 extern int add_rxspeed_avp (struct buffer
*, int);
131 extern int add_txspeed_avp (struct buffer
*, int);
132 extern int add_serno_avp (struct buffer
*, unsigned int);
134 extern int add_callid_avp (struct buffer
*, _u16
, struct tunnel
*);
136 extern int add_callid_avp (struct buffer
*, _u16
);
138 extern int add_ppd_avp (struct buffer
*, _u16
);
139 extern int add_seqreqd_avp (struct buffer
*);
140 extern int add_chalresp_avp (struct buffer
*, unsigned char *, int);
141 extern int add_randvect_avp (struct buffer
*, unsigned char *, int);
142 extern int add_minbps_avp (struct buffer
*buf
, int speed
); /* jz: needed for outgoing call */
143 extern int add_maxbps_avp (struct buffer
*buf
, int speed
); /* jz: needed for outgoing call */
144 extern int add_number_avp (struct buffer
*buf
, char *no
); /* jz: needed for outgoing call */