00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _Q931CALL_H_
00039 #define _Q931CALL_H_
00040
00041 #define Q931_CALL_MAX_EVENTS 3
00046 enum {
00047 Q931_EVENT_NONE = 0,
00049
00050 Q931_EVENT_SETUP_INDICATION,
00051 Q931_EVENT_SETUP_CONFIRM,
00052 Q931_EVENT_SETUP_COMPLETE_INDICATION,
00053 Q931_EVENT_MORE_INFO_INDICATION,
00054 Q931_EVENT_REJECT_INDICATION,
00055 Q931_EVENT_PROCEEDING_INDICATION,
00056 Q931_EVENT_ALERTING_INDICATION,
00057 Q931_EVENT_PROGRESS_INDICATION,
00058 Q931_EVENT_NOTIFY_INDICATION,
00059 Q931_EVENT_RELEASE_INDICATION,
00060 Q931_EVENT_RELEASE_CONFIRM,
00061 Q931_EVENT_SUSPEND_CONFIRM,
00062 Q931_EVENT_RESUME_CONFIRM,
00063 Q931_EVENT_DISCONNECT_INDICATION,
00064 Q931_EVENT_INFORMATION_INDICATION,
00065 Q931_EVENT_STATUS_INDICATION,
00066 Q931_EVENT_RESTART_CONFIRM,
00068
00069 Q931_EVENT_SETUP_RESPONSE,
00070 Q931_EVENT_REJECT_REQUEST,
00071 Q931_EVENT_INFORMATION_REQUEST,
00072 Q931_EVENT_ALERTING_REQUEST,
00073 Q931_EVENT_PROGRESS_REQUEST,
00074 Q931_EVENT_PROCEEDING_REQUEST,
00075 Q931_EVENT_NOTIFY_REQUEST,
00076 Q931_EVENT_SUSPEND_REQUEST,
00077 Q931_EVENT_DISCONNECT_REQUEST,
00078 Q931_EVENT_RESTART_REQUEST,
00080
00081 Q931_EVENT_TIMEOUT_INDICATION,
00082 Q931_EVENT_DL_FAILURE_INDICATION,
00084
00085 Q931_EVENT_RELEASE_CRV,
00086 };
00087
00091 enum {
00092 Q931_EVENT_TYPE_NONE = 0,
00093 Q931_EVENT_TYPE_CRV,
00094 Q931_EVENT_TYPE_TIMER,
00095 Q931_EVENT_TYPE_MESSAGE,
00096 };
00097
00101 struct Q931_CallTimerEvent
00102 {
00103 L3INT id;
00104 };
00105
00109 struct Q931_CallMessageEvent
00110 {
00111 L3INT type;
00112 Q931mes_Generic *data;
00113 };
00114
00118 struct Q931_CallEvent
00119 {
00120 L3INT id;
00121 L3INT type;
00122 L3BOOL error;
00124
00125 union {
00126 struct Q931_CallTimerEvent timer;
00127 struct Q931_CallMessageEvent message;
00128 };
00129 };
00130
00134 enum {
00135
00136 Q931_U0 = 0,
00137 Q931_U1,
00138 Q931_U2,
00139 Q931_U3,
00140 Q931_U4,
00141 Q931_U6 = 6,
00142 Q931_U7,
00143 Q931_U8,
00144 Q931_U9,
00145 Q931_U10,
00146 Q931_U11,
00147 Q931_U12,
00148 Q931_U15 = 15,
00149 Q931_U17 = 17,
00150 Q931_U19 = 19,
00151 Q931_U25 = 25,
00153 Q931_UANY = 0xff,
00155
00156 Q931_N0 = (0x0100 | 0),
00157 Q931_N1,
00158 Q931_N2,
00159 Q931_N3,
00160 Q931_N4,
00161 Q931_N6 = (0x0100 | 6),
00162 Q931_N7,
00163 Q931_N8,
00164 Q931_N9,
00165 Q931_N10,
00166 Q931_N11,
00167 Q931_N12,
00168 Q931_N15 = (0x0100 | 15),
00169 Q931_N17 = (0x0100 | 17),
00170 Q931_N19 = (0x0100 | 19),
00171 Q931_N22 = (0x0100 | 22),
00172 Q931_N25 = (0x0100 | 25),
00174 Q931_NANY = 0x1ff
00175 };
00176
00177
00181 enum {
00182 Q931_DIRECTION_INBOUND = 0,
00183 Q931_DIRECTION_OUTBOUND
00184 };
00185
00189 struct Q931_Call
00190 {
00191 L3UCHAR InUse;
00192
00193
00194
00195 L3UCHAR Tei;
00196
00197 L3UCHAR BChan;
00198
00199
00200
00201 L3UCHAR Direction;
00202 L3INT CRV;
00203
00204 L3UINT State;
00205
00206
00207
00208
00209
00210 L3ULONG Timer;
00211
00212
00213
00214 L3USHORT TimerID;
00215
00216
00217
00218
00219 L3UCHAR TimerCnt;
00220
00221
00222 Q931_TrunkInfo_t *Trunk;
00223
00224
00225 void *pvt;
00226
00227
00228
00229
00230 L3INT numevents;
00231 struct Q931_CallEvent events[Q931_CALL_MAX_EVENTS];
00232 };
00233
00234 typedef struct Q931_Call Q931_Call_t;
00235
00236 typedef void (*Q931CallEventCB_t) (struct Q931_Call *call, struct Q931_CallEvent *event, void *priv);
00237
00238
00239
00240
00241
00242
00243 void Q931CallSetState(struct Q931_Call *call, const L3INT state);
00244 L3INT Q931CallGetState(const struct Q931_Call *call);
00245 const char *Q931CallGetStateName(const struct Q931_Call *call);
00246 const char *Q931CallGetEventName(const L3INT event);
00247 const char *Q931CallGetTimerName(const L3USHORT timer);
00248
00249 void Q931CallSetPrivate(struct Q931_Call *call, const void *priv);
00250 void *Q931CallGetPrivate(const struct Q931_Call *call);
00251
00252 Q931_TrunkInfo_t *Q931CallGetTrunk(const struct Q931_Call *call);
00253
00254 void Q931SetCallEventCB(Q931_TrunkInfo_t *trunk, const Q931CallEventCB_t cb, const void *priv);
00255
00256
00257
00258
00259
00260
00261
00262 struct Q931_Call *Q931CallNew(Q931_TrunkInfo_t *trunk);
00263 L3INT Q931CallRelease(struct Q931_Call *call);
00264
00265 L3INT Q931CallGetCRV(const struct Q931_Call *call);
00266 L3INT Q931CallGetDirection(const struct Q931_Call *call);
00267 L3BOOL Q931CallIsOutgoing(const struct Q931_Call *call);
00268 L3BOOL Q931CallIsGlobal(const struct Q931_Call *call);
00269
00270 L3INT Q931CallEventGetType(const struct Q931_CallEvent *event);
00271 L3INT Q931CallEventGetId(const struct Q931_CallEvent *event);
00272 void *Q931CallEventGetData(const struct Q931_CallEvent *event);
00273
00274 struct Q931_Call *Q931GetCallByCRV(const Q931_TrunkInfo_t *trunk, const L3INT crv);
00275
00276
00277
00278
00279 #ifdef Q931PRIVATE
00280 void Q931CallDump(const struct Q931_Call *call);
00281
00282 void Q931CallInitEvent(struct Q931_CallEvent *event);
00283 void Q931CallSendEvent(const struct Q931_Call *call, const struct Q931_CallEvent *event);
00284
00285
00286 struct Q931_CallEvent *Q931CallNewEvent(struct Q931_Call *call);
00287 void Q931CallSendQueuedEvents(struct Q931_Call *call);
00288 void Q931CallQueueEvent(struct Q931_Call *call, struct Q931_CallEvent *event);
00289 void Q931CallFlushEvents(struct Q931_Call *call);
00290
00291
00292 struct Q931_Call *Q931CallNewIncoming(Q931_TrunkInfo_t *trunk, const L3INT crv);
00293 struct Q931_Call *Q931GetCallByIndex(const Q931_TrunkInfo_t *trunk, const L3INT callindex);
00294 struct Q931_Call *Q931GetGlobalCall(const Q931_TrunkInfo_t *trunk);
00295
00296 void Q931CallStartTimer(struct Q931_Call *call, L3USHORT timer);
00297 void Q931CallRestartTimer(struct Q931_Call *call, L3USHORT timer);
00298 void Q931CallStopTimer(struct Q931_Call *call, L3USHORT timer);
00299 void Q931CallStopAllTimers(struct Q931_Call *call);
00300 L3USHORT Q931CallGetTimerID(const struct Q931_Call *call);
00301 L3UCHAR Q931CallGetTimerExpireCount(const struct Q931_Call *call);
00302 void Q931CallIncrementTimerExpireCount(struct Q931_Call *call);
00303
00304 #endif
00305 #endif