57
57
#define Q921_TEI_GR303_EOC_OPS 4
58
58
#define Q921_TEI_GR303_TMC_SWITCHING 0
59
59
#define Q921_TEI_GR303_TMC_CALLPROC 0
60
#define Q921_TEI_AUTO_FIRST 64
61
#define Q921_TEI_AUTO_LAST 126
61
63
#define Q921_SAPI_CALL_CTRL 0
62
64
#define Q921_SAPI_GR303_EOC 1
69
71
#define Q921_SAPI_LAYER2_MANAGEMENT 63
72
#define Q921_TEI_IDENTITY_REQUEST 1
73
#define Q921_TEI_IDENTITY_ASSIGNED 2
74
#define Q921_TEI_IDENTITY_DENIED 3
75
#define Q921_TEI_IDENTITY_CHECK_REQUEST 4
76
#define Q921_TEI_IDENTITY_CHECK_RESPONSE 5
77
#define Q921_TEI_IDENTITY_REMOVE 6
78
#define Q921_TEI_IDENTITY_VERIFY 7
74
/*! Q.921 TEI management message type */
75
enum q921_tei_identity {
76
Q921_TEI_IDENTITY_REQUEST = 1,
77
Q921_TEI_IDENTITY_ASSIGNED = 2,
78
Q921_TEI_IDENTITY_DENIED = 3,
79
Q921_TEI_IDENTITY_CHECK_REQUEST = 4,
80
Q921_TEI_IDENTITY_CHECK_RESPONSE = 5,
81
Q921_TEI_IDENTITY_REMOVE = 6,
82
Q921_TEI_IDENTITY_VERIFY = 7,
80
85
typedef struct q921_header {
81
86
#if __BYTE_ORDER == __BIG_ENDIAN
158
163
struct q921_header h;
166
enum q921_tx_frame_status {
167
Q921_TX_FRAME_NEVER_SENT,
168
Q921_TX_FRAME_PUSHED_BACK,
161
172
typedef struct q921_frame {
162
struct q921_frame *next; /* Next in list */
163
int len; /* Length of header + body */
164
int transmitted; /* Have we been transmitted */
173
struct q921_frame *next; /*!< Next in list */
174
int len; /*!< Length of header + body */
175
enum q921_tx_frame_status status; /*!< Tx frame status */
176
q921_i h; /*!< Actual frame contents. */
168
179
#define Q921_INC(j) (j) = (((j) + 1) % 128)
180
191
Q921_TIMER_RECOVERY = 8,
194
/*! TEI identity check procedure states. */
195
enum q921_tei_check_state {
196
/*! Not participating in the TEI check procedure. */
198
/*! No reply to TEI check received. */
200
/*! Reply to TEI check received in current poll. */
201
Q921_TEI_CHECK_REPLY,
202
/*! No reply to current TEI check poll received. A previous poll got a reply. */
203
Q921_TEI_CHECK_DEAD_REPLY,
206
/*! \brief Q.921 link controller structure */
208
/*! Next Q.921 link in the chain. */
209
struct q921_link *next;
210
/*! D channel controller associated with this link. */
214
* \brief Q.931 Dummy call reference call associated with this TEI.
216
* \note If present then this call is allocated with the D
217
* channel control structure or the link control structure
218
* unless this is the TE PTMP broadcast TEI or a GR303 link.
220
struct q931_call *dummy_call;
222
/*! Q.921 Re-transmission queue */
223
struct q921_frame *tx_queue;
226
enum q921_state state;
228
/*! TEI identity check procedure state. */
229
enum q921_tei_check_state tei_check;
231
/*! Service Access Profile Identifier (SAPI) of this link */
233
/*! Terminal Endpoint Identifier (TEI) of this link */
235
/*! TEI assignment random indicator. */
238
/*! V(A) - Next I-frame sequence number needing ack */
240
/*! V(S) - Next I-frame sequence number to send */
242
/*! V(R) - Next I-frame sequence number expected to receive */
247
/*! T-200 retransmission timer */
249
/*! Retry Count (T200) */
255
/*! PTP restart delay timer */
261
unsigned int mdl_free_me:1;
263
unsigned int peer_rx_busy:1;
264
unsigned int own_rx_busy:1;
265
unsigned int acknowledge_pending:1;
266
unsigned int reject_exception:1;
267
unsigned int l3_initiated:1;
183
270
static inline int Q921_ADD(int a, int b)
185
272
return (a + b) % 128;
189
276
extern void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx);
191
278
/* Bring up the D-channel */
192
extern void q921_start(struct pri *pri);
279
void q921_start(struct q921_link *link);
194
281
//extern void q921_reset(struct pri *pri, int reset_iqueue);
196
283
extern pri_event *q921_receive(struct pri *pri, q921_h *h, int len);
198
extern int q921_transmit_iframe(struct pri *pri, int tei, void *buf, int len, int cr);
285
int q921_transmit_iframe(struct q921_link *link, void *buf, int len, int cr);
200
extern int q921_transmit_uiframe(struct pri *pri, void *buf, int len);
287
int q921_transmit_uiframe(struct q921_link *link, void *buf, int len);
202
289
extern pri_event *q921_dchannel_up(struct pri *pri);