~ubuntu-branches/ubuntu/trusty/libpri/trusty

« back to all changes in this revision

Viewing changes to pri_q921.h

  • Committer: Package Import Robot
  • Author(s): Faidon Liambotis
  • Date: 2011-11-26 17:25:59 UTC
  • mfrom: (1.3.11)
  • Revision ID: package-import@ubuntu.com-20111126172559-f6c5r81fgkn0krlb
Tags: 1.4.12-1
* New upstream release. 
  - Drop patch gcc-4.6-werror, not needed anymore.
  - Adapt patch enable-gcc-optimizations.
  - Updated symbols file with (a lot of) new symbols.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
60
62
 
61
63
#define Q921_SAPI_CALL_CTRL             0
62
64
#define Q921_SAPI_GR303_EOC             1
69
71
#define Q921_SAPI_LAYER2_MANAGEMENT     63
70
72
 
71
73
 
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,
 
83
};
79
84
 
80
85
typedef struct q921_header {
81
86
#if __BYTE_ORDER == __BIG_ENDIAN
158
163
        struct q921_header h;
159
164
} q921_h;
160
165
 
 
166
enum q921_tx_frame_status {
 
167
        Q921_TX_FRAME_NEVER_SENT,
 
168
        Q921_TX_FRAME_PUSHED_BACK,
 
169
        Q921_TX_FRAME_SENT,
 
170
};
 
171
 
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 */
165
 
        q921_i h;
 
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. */
166
177
} q921_frame;
167
178
 
168
179
#define Q921_INC(j) (j) = (((j) + 1) % 128)
180
191
        Q921_TIMER_RECOVERY = 8,
181
192
} q921_state;
182
193
 
 
194
/*! TEI identity check procedure states. */
 
195
enum q921_tei_check_state {
 
196
        /*! Not participating in the TEI check procedure. */
 
197
        Q921_TEI_CHECK_NONE,
 
198
        /*! No reply to TEI check received. */
 
199
        Q921_TEI_CHECK_DEAD,
 
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,
 
204
};
 
205
 
 
206
/*! \brief Q.921 link controller structure */
 
207
struct q921_link {
 
208
        /*! Next Q.921 link in the chain. */
 
209
        struct q921_link *next;
 
210
        /*! D channel controller associated with this link. */
 
211
        struct pri *ctrl;
 
212
 
 
213
        /*!
 
214
         * \brief Q.931 Dummy call reference call associated with this TEI.
 
215
         *
 
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.
 
219
         */
 
220
        struct q931_call *dummy_call;
 
221
 
 
222
        /*! Q.921 Re-transmission queue */
 
223
        struct q921_frame *tx_queue;
 
224
 
 
225
        /*! Q.921 State */
 
226
        enum q921_state state;
 
227
 
 
228
        /*! TEI identity check procedure state. */
 
229
        enum q921_tei_check_state tei_check;
 
230
 
 
231
        /*! Service Access Profile Identifier (SAPI) of this link */
 
232
        int sapi;
 
233
        /*! Terminal Endpoint Identifier (TEI) of this link */
 
234
        int tei;
 
235
        /*! TEI assignment random indicator. */
 
236
        int ri;
 
237
 
 
238
        /*! V(A) - Next I-frame sequence number needing ack */
 
239
        int v_a;
 
240
        /*! V(S) - Next I-frame sequence number to send */
 
241
        int v_s;
 
242
        /*! V(R) - Next I-frame sequence number expected to receive */
 
243
        int v_r;
 
244
 
 
245
        /* Various timers */
 
246
 
 
247
        /*! T-200 retransmission timer */
 
248
        int t200_timer;
 
249
        /*! Retry Count (T200) */
 
250
        int RC;
 
251
        int t202_timer;
 
252
        int n202_counter;
 
253
        /*! Max idle time */
 
254
        int t203_timer;
 
255
        /*! PTP restart delay timer */
 
256
        int restart_timer;
 
257
 
 
258
        /* MDL variables */
 
259
        int mdl_timer;
 
260
        int mdl_error;
 
261
        unsigned int mdl_free_me:1;
 
262
 
 
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;
 
268
};
 
269
 
183
270
static inline int Q921_ADD(int a, int b)
184
271
{
185
272
        return (a + b) % 128;
189
276
extern void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx);
190
277
 
191
278
/* Bring up the D-channel */
192
 
extern void q921_start(struct pri *pri);
 
279
void q921_start(struct q921_link *link);
193
280
 
194
281
//extern void q921_reset(struct pri *pri, int reset_iqueue);
195
282
 
196
283
extern pri_event *q921_receive(struct pri *pri, q921_h *h, int len);
197
284
 
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);
199
286
 
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);
201
288
 
202
289
extern pri_event *q921_dchannel_up(struct pri *pri);
203
290