diff --git a/libs/openzap/Makefile b/libs/openzap/Makefile index f5cbeee8ab..628702c594 100644 --- a/libs/openzap/Makefile +++ b/libs/openzap/Makefile @@ -52,7 +52,6 @@ $(SRC)/isdn/Q931ie.o \ $(SRC)/isdn/Q931mes.o \ $(SRC)/isdn/Q931StateNT.o \ $(SRC)/isdn/Q931StateTE.o \ -$(SRC)/isdn/nationalie.o \ $(SRC)/isdn/nationalmes.o \ $(SRC)/isdn/nationalStateNT.o \ $(SRC)/isdn/nationalStateTE.o \ diff --git a/libs/openzap/msvc/openzap.vcproj b/libs/openzap/msvc/openzap.vcproj index d396d9dc86..1a60eded45 100644 --- a/libs/openzap/msvc/openzap.vcproj +++ b/libs/openzap/msvc/openzap.vcproj @@ -202,10 +202,6 @@ RelativePath="..\src\isdn\mfifo.c" > - - diff --git a/libs/openzap/src/isdn/Q931.c b/libs/openzap/src/isdn/Q931.c index bdc9324c5c..d522db0cc4 100644 --- a/libs/openzap/src/isdn/Q931.c +++ b/libs/openzap/src/isdn/Q931.c @@ -56,163 +56,14 @@ these table entries during system inititialization of a stack. *****************************************************************************/ -L3INT (*Q931Proc [Q931MAXDLCT][Q931MAXMES]) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *,L3INT); +q931proc_func_t *Q931Proc[Q931MAXDLCT][Q931MAXMES]; -L3INT (*Q931Umes [Q931MAXDLCT][Q931MAXMES]) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); -L3INT (*Q931Pmes [Q931MAXDLCT][Q931MAXMES]) (Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); +q931umes_func_t *Q931Umes[Q931MAXDLCT][Q931MAXMES]; +q931pmes_func_t *Q931Pmes[Q931MAXDLCT][Q931MAXMES]; -L3INT (*Q931Uie [Q931MAXDLCT][Q931MAXIE]) (Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT (*Q931Pie [Q931MAXDLCT][Q931MAXIE]) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); +q931uie_func_t *Q931Uie[Q931MAXDLCT][Q931MAXIE]; +q931pie_func_t *Q931Pie[Q931MAXDLCT][Q931MAXIE]; -L3UINT Q931MsgieOffset[Q931MAXIE]; - -void Q931Initialize_MsgieOffset() -{ - L3INT x; - Q931mes_Generic msg; - ie *index; - - for(x=0; xBearerCap; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -431,9 +432,10 @@ L3INT Q931Pie_BearerCap(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_CallID(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_CallID(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_CallID * pie = (Q931ie_CallID*)OBuf; + ie *pIE = &pMsg->CallID; L3INT Off = 0; L3INT Octet = 0; L3INT x=0; @@ -517,9 +519,10 @@ L3INT Q931Pie_CallID(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3I Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_CallState(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_CallState(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_CallState * pie = (Q931ie_CallState*)OBuf; + ie *pIE = &pMsg->CallState; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -594,9 +597,10 @@ L3INT Q931Pie_CallState(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_CalledSub(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_CalledSub(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_CalledSub * pie = (Q931ie_CalledSub*)OBuf; + ie *pIE = &pMsg->CalledSub; L3INT Off = 0; L3INT Octet = 0; L3INT x; @@ -690,9 +694,10 @@ L3INT Q931Pie_CalledSub(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_CalledNum(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_CalledNum(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_CalledNum * pie = (Q931ie_CalledNum*)OBuf; + ie *pIE = &pMsg->CalledNum; L3INT Off = 0; L3INT Octet = 0; L3INT x; @@ -783,9 +788,10 @@ L3INT Q931Pie_CalledNum(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_CallingNum(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_CallingNum(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { - Q931ie_CallingNum * pie = (Q931ie_CallingNum*)OBuf; + Q931ie_CallingNum * pie = (Q931ie_CallingNum*)OBuf; + ie *pIE = &pMsg->CallingNum; L3INT Off = 0; L3INT Octet = 0; L3INT x; @@ -897,9 +903,10 @@ L3INT Q931Pie_CallingNum(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_CallingSub(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_CallingSub(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_CallingSub * pie = (Q931ie_CallingSub*)OBuf; + ie *pIE = &pMsg->CallingSub; L3INT Off = 0; L3INT Octet = 0; L3INT x; @@ -993,9 +1000,10 @@ L3INT Q931Pie_CallingSub(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_Cause(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_Cause(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_Cause * pie = (Q931ie_Cause*)OBuf; + ie *pIE = &pMsg->Cause; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -1085,9 +1093,10 @@ L3INT Q931Pie_Cause(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3IN Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_CongLevel(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_CongLevel(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_CongLevel *pie = (Q931ie_CongLevel*)OBuf; + ie *pIE = &pMsg->CongestionLevel; L3INT Off = 0; L3INT Octet = 0; @@ -1143,9 +1152,10 @@ L3INT Q931Pie_CongLevel(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error code, 0 = OK *****************************************************************************/ -L3INT Q931Uie_ChanID(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_ChanID(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_ChanID * pie = (Q931ie_ChanID*)OBuf; + ie *pIE = &pMsg->ChanID; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -1336,9 +1346,10 @@ L3USHORT Q931Uie_CRV(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3I Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_DateTime(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_DateTime(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_DateTime * pie = (Q931ie_DateTime*)OBuf; + ie *pIE = &pMsg->DateTime; L3INT Off = 0; L3INT Octet = 0; L3INT IESize=0; @@ -1455,9 +1466,10 @@ L3INT Q931Pie_DateTime(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_Display(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_Display(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_Display * pie = (Q931ie_Display*)OBuf; + ie *pIE = &pMsg->Display; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -1538,9 +1550,10 @@ L3INT Q931Pie_Display(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3 Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_HLComp(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_HLComp(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_HLComp * pie = (Q931ie_HLComp*)OBuf; + ie *pIE = &pMsg->HLComp; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -1659,9 +1672,10 @@ L3INT Q931Pie_HLComp(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3I Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_KeypadFac(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_KeypadFac(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_KeypadFac * pie = (Q931ie_KeypadFac*)OBuf; + ie *pIE = &pMsg->KeypadFac; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -1741,9 +1755,10 @@ L3INT Q931Pie_KeypadFac(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_LLComp(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_LLComp(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_LLComp * pie = (Q931ie_LLComp*)OBuf; + ie *pIE = &pMsg->LLComp; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -2122,9 +2137,10 @@ L3INT Q931Pie_LLComp(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3I Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_NetFac(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_NetFac(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_NetFac * pie = (Q931ie_NetFac*)OBuf; + ie *pIE = &pMsg->NetFac; L3INT Off = 0; L3INT Octet = 0; L3INT x=0; @@ -2232,9 +2248,10 @@ L3INT Q931Pie_NetFac(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3I Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_NotifInd(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_NotifInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_NotifInd * pie = (Q931ie_NotifInd*)OBuf; + ie *pIE = &pMsg->NotifInd; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -2308,9 +2325,10 @@ L3INT Q931Pie_NotifInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_ProgInd(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_ProgInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_ProgInd * pie = (Q931ie_ProgInd*)OBuf; + ie *pIE = &pMsg->ProgInd; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -2393,9 +2411,10 @@ L3INT Q931Pie_ProgInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3 Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_RepeatInd(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_RepeatInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_RepeatInd *pie = (Q931ie_RepeatInd*)OBuf; + ie *pIE = &pMsg->RepeatInd; L3INT Off = 0; L3INT Octet = 0; @@ -2452,9 +2471,10 @@ L3INT Q931Pie_RepeatInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { ie iE; + /* ie *pIE = &pMsg->RevChargeInd; */ Q931SetIE(iE, *OOff); return iE; @@ -2497,9 +2517,10 @@ L3INT Q931Pie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBu Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_RestartInd(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_RestartInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_RestartInd * pie = (Q931ie_RestartInd*)OBuf; + ie *pIE = &pMsg->RestartInd; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -2574,9 +2595,10 @@ L3INT Q931Pie_RestartInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_Segment(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_Segment(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_Segment * pie = (Q931ie_Segment*)OBuf; + ie *pIE = &pMsg->Segment; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -2656,9 +2678,10 @@ L3INT Q931Pie_Segment(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3 Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_SendComplete(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_SendComplete(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_SendComplete *pie = (Q931ie_SendComplete*)OBuf; + ie *pIE = &pMsg->SendComplete; L3INT Off = 0; L3INT Octet = 0; @@ -2713,9 +2736,10 @@ L3INT Q931Pie_SendComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBu Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_Signal(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_Signal(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_Signal * pie = (Q931ie_Signal*)OBuf; + ie *pIE = &pMsg->Signal; L3INT Off = 0; L3INT Octet = 0; L3INT IESize; @@ -2787,9 +2811,10 @@ L3INT Q931Pie_Signal(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3I Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_TransNetSel(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_TransNetSel(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_TransNetSel * pie = (Q931ie_TransNetSel*)OBuf; + ie *pIE = &pMsg->TransNetSel; L3INT Off = 0; L3INT Octet = 0; L3INT x=0; @@ -2878,9 +2903,10 @@ L3INT Q931Pie_TransNetSel(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf Return Value: Error Message *****************************************************************************/ -L3INT Q931Uie_UserUser(Q931_TrunkInfo_t *pTrunk, ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) +L3INT Q931Uie_UserUser(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) { Q931ie_UserUser * pie = (Q931ie_UserUser*)OBuf; + ie *pIE = &pMsg->UserUser; L3INT Off = 0; L3INT Octet = 0; L3INT x=0; diff --git a/libs/openzap/src/isdn/Q931mes.c b/libs/openzap/src/isdn/Q931mes.c index 04ad6c4fff..bc2facd7cb 100644 --- a/libs/openzap/src/isdn/Q931mes.c +++ b/libs/openzap/src/isdn/Q931mes.c @@ -59,32 +59,12 @@ L3INT Q931Umes_Alerting(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic switch(IBuf[IOff]) { case Q931ie_BEARER_CAPABILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->BearerCap, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_PROGRESS_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ProgInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->HLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -168,27 +148,11 @@ L3INT Q931Umes_CallProceeding(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_G switch(IBuf[IOff]) { case Q931ie_BEARER_CAPABILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->BearerCap, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_PROGRESS_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ProgInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->HLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -300,42 +264,14 @@ L3INT Q931Umes_Connect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic switch(IBuf[IOff]) { case Q931ie_BEARER_CAPABILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->BearerCap, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_PROGRESS_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ProgInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DATETIME: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->DateTime, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_LOW_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->LLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->HLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -429,13 +365,8 @@ L3INT Q931Umes_ConnectAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Gener switch(IBuf[IOff]) { case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -498,22 +429,10 @@ L3INT Q931Umes_Disconnect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Gener switch(IBuf[IOff]) { case Q931ie_CAUSE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Cause, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_PROGRESS_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ProgInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -585,29 +504,13 @@ L3INT Q931Umes_Information(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Gene switch(IBuf[IOff]) { case Q931ie_SENDING_COMPLETE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->SendComplete, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_KEYPAD_FACILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->KeypadFac, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLED_PARTY_NUMBER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CalledNum, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; - default: return Q931E_ILLEGAL_IE; break; @@ -680,19 +583,9 @@ L3INT Q931Umes_Notify(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * switch(IBuf[IOff]) { case Q931ie_BEARER_CAPABILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->BearerCap, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_NOTIFICATION_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->NotifInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -753,27 +646,11 @@ L3INT Q931Umes_Progress(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic switch(IBuf[IOff]) { case Q931ie_BEARER_CAPABILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->BearerCap, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_CAUSE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Cause, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_PROGRESS_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ProgInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->HLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -849,17 +726,9 @@ L3INT Q931Umes_Release(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic switch(IBuf[IOff]) { case Q931ie_CAUSE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Cause, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -924,17 +793,9 @@ L3INT Q931Umes_ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_ switch(IBuf[IOff]) { case Q931ie_CAUSE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Cause, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -999,17 +860,9 @@ L3INT Q931Umes_Restart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic switch(IBuf[IOff]) { case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_RESTART_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->RestartInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1074,17 +927,9 @@ L3INT Q931Umes_RestartAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Gener switch(IBuf[IOff]) { case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_RESTART_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->RestartInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1149,7 +994,7 @@ L3INT Q931Umes_Resume(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * switch(IBuf[IOff]) { case Q931ie_CALL_IDENTITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CallID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1206,12 +1051,8 @@ L3INT Q931Umes_ResumeAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generi switch(IBuf[IOff]) { case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1273,12 +1114,8 @@ L3INT Q931Umes_ResumeReject(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Gen switch(IBuf[IOff]) { case Q931ie_CAUSE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Cause, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1357,101 +1194,33 @@ L3INT Q931Umes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *m switch(IBuf[IOff]) { case Q931ie_SENDING_COMPLETE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->SendComplete, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + case Q931ie_BEARER_CAPABILITY: + case Q931ie_CHANNEL_IDENTIFICATION: + case Q931ie_PROGRESS_INDICATOR: + case Q931ie_NETWORK_SPECIFIC_FACILITIES: + case Q931ie_DISPLAY: + case Q931ie_DATETIME: + case Q931ie_KEYPAD_FACILITY: + case Q931ie_SIGNAL: + case Q931ie_CALLING_PARTY_NUMBER: + case Q931ie_CALLING_PARTY_SUBADDRESS: + case Q931ie_CALLED_PARTY_NUMBER: + case Q931ie_CALLED_PARTY_SUBADDRESS: + case Q931ie_TRANSIT_NETWORK_SELECTION: + case Q931ie_LOW_LAYER_COMPATIBILITY: + case Q931ie_HIGH_LAYER_COMPATIBILITY: + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; case Q931ie_REPEAT_INDICATOR: - if(ir==0) - { - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->RepeatInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + if(ir < 2) { + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); ir++; - } - else if(ir==1) - { - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->LLRepeatInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - ir++; - } - else - { + } else { return Q931E_ILLEGAL_IE; } break; - case Q931ie_BEARER_CAPABILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->BearerCap, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_PROGRESS_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ProgInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_NETWORK_SPECIFIC_FACILITIES: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->NetFac, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_DATETIME: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->DateTime, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_KEYPAD_FACILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->KeypadFac, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLING_PARTY_NUMBER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CallingNum, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLING_PARTY_SUBADDRESS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CallingSub, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLED_PARTY_NUMBER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CalledSub, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLED_PARTY_SUBADDRESS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CalledSub, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_TRANSIT_NETWORK_SELECTION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->TransNetSel, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_LOW_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->LLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->HLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; default: return Q931E_ILLEGAL_IE; break; @@ -1606,22 +1375,10 @@ L3INT Q931Umes_SetupAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic switch(IBuf[IOff]) { case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_PROGRESS_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ProgInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1693,17 +1450,9 @@ L3INT Q931Umes_Status(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * switch(IBuf[IOff]) { case Q931ie_CAUSE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Cause, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_CALL_STATE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CallState, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1769,7 +1518,7 @@ L3INT Q931Umes_StatusEnquiry(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Ge switch(IBuf[IOff]) { case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1826,7 +1575,7 @@ L3INT Q931Umes_Suspend(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic switch(IBuf[IOff]) { case Q931ie_CALL_IDENTITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CallID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1884,7 +1633,7 @@ L3INT Q931Umes_SuspendAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Gener switch(IBuf[IOff]) { case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; @@ -1941,12 +1690,8 @@ L3INT Q931Umes_SuspendReject(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Ge switch(IBuf[IOff]) { case Q931ie_CAUSE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Cause, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; diff --git a/libs/openzap/src/isdn/include/Q931.h b/libs/openzap/src/isdn/include/Q931.h index a14bf85856..6c580d8bb6 100644 --- a/libs/openzap/src/isdn/include/Q931.h +++ b/libs/openzap/src/isdn/include/Q931.h @@ -371,6 +371,11 @@ typedef struct L3UCHAR ProtDisc; /* Protocol Discriminator */ L3UCHAR MesType; /* Message type */ L3INT CRV; /* Call reference value */ + L3UINT codeset; /* Current Codeset - Temporary variable */ + /* used for the Q931Uie functions */ + /* in a parsed message this will only */ + /* indicate the codeset of the last */ + /* ie parsed */ ie Shift; ie MoreData; @@ -588,15 +593,21 @@ typedef struct The proc tables are defined in Q931.c and initialized in Q931Initialize. *****************************************************************************/ -extern L3INT (*Q931Proc [Q931MAXDLCT][Q931MAXMES]) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *,L3INT); +typedef L3INT (q931proc_func_t) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *, L3INT); -extern L3INT (*Q931Umes [Q931MAXDLCT][Q931MAXMES]) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); -extern L3INT (*Q931Pmes [Q931MAXDLCT][Q931MAXMES]) (Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); +typedef L3INT (q931umes_func_t) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); +typedef L3INT (q931pmes_func_t) (Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -extern L3INT (*Q931Uie [Q931MAXDLCT][Q931MAXIE] ) (Q931_TrunkInfo_t *pTrunk,ie *pIE,L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -extern L3INT (*Q931Pie [Q931MAXDLCT][Q931MAXIE] ) (Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); +typedef L3INT (q931uie_func_t) (Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); +typedef L3INT (q931pie_func_t) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -extern L3UINT Q931MsgieOffset[Q931MAXIE]; +extern q931proc_func_t *Q931Proc[Q931MAXDLCT][Q931MAXMES]; + +extern q931umes_func_t *Q931Umes[Q931MAXDLCT][Q931MAXMES]; +extern q931pmes_func_t *Q931Pmes[Q931MAXDLCT][Q931MAXMES]; + +extern q931uie_func_t *Q931Uie[Q931MAXDLCT][Q931MAXIE]; +extern q931pie_func_t *Q931Pie[Q931MAXDLCT][Q931MAXIE]; /***************************************************************************** @@ -705,8 +716,6 @@ extern L3UINT Q931MsgieOffset[Q931MAXIE]; *****************************************************************************/ -extern Q931_TrunkInfo_t Q931Trunk[Q931MAXTRUNKS]; - #include "Q931ie.h" #include "Q932.h" @@ -847,14 +856,9 @@ void Q931CreateNT(L3UCHAR i); void Q931SetMesCreateCB(L3INT (*callback)()); void Q931SetDialectCreateCB(L3INT (*callback)(L3INT)); void Q931SetHeaderSpace(L3INT space); -void Q931SetMesProc(L3UCHAR mes, L3UCHAR dialect, - L3INT (*Q931ProcFunc)(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom), - L3INT (*Q931UmesFunc)(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size), - L3INT (*Q931PmesFunc)(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)); -void Q931SetIEProc(L3UCHAR iec, L3UCHAR dialect, - L3INT (*Q931PieProc)(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet), - L3INT (*Q931UieProc)(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff)); +void Q931SetMesProc(L3UCHAR mes, L3UCHAR dialect, q931proc_func_t *Q931ProcFunc, q931umes_func_t *Q931UmesFunc, q931pmes_func_t *Q931PmesFunc); +void Q931SetIEProc(L3UCHAR iec, L3UCHAR dialect, q931pie_func_t *Q931PieProc, q931uie_func_t *Q931UieProc); void Q931Initialize(); void Q931AddDialect(L3UCHAR iDialect, void (*Q931CreateDialectCB)(L3UCHAR iDialect)); @@ -873,8 +877,6 @@ void Q931SetGetTimeCB(L3ULONG (*callback)()); void Q931AddStateEntry(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir); L3BOOL Q931IsEventLegal(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir); -ie *Q931MegGetIE(Q931mes_Generic *msg, L3UINT ie_type); - /***************************************************************************** Q.931 Low Level API Function Prototyping. Implemented in Q931API.c diff --git a/libs/openzap/src/isdn/include/Q931ie.h b/libs/openzap/src/isdn/include/Q931ie.h index ad296951d0..27e292d1f9 100644 --- a/libs/openzap/src/isdn/include/Q931ie.h +++ b/libs/openzap/src/isdn/include/Q931ie.h @@ -96,6 +96,9 @@ typedef enum { #define Q931ie_USER_USER 0x7e /* 0111 1110 */ #define Q931ie_ESCAPE_FOR_EX 0x7f /* 0111 1111 */ +#define Q931ie_GENERIC_DIGITS 0x37 /* 0011 0111 */ + + /***************************************************************************** @@ -1061,6 +1064,19 @@ typedef struct /* 111 All interfaces */ }Q931ie_RestartInd; +/***************************************************************************** + + Struct: Q931ie_GenericDigits + + +*****************************************************************************/ + +typedef struct +{ + L3UCHAR IEId; /* 00110111 */ + L3UCHAR Size; /* Length of Information Element */ +} Q931ie_GenericDigits; + /***************************************************************************** @@ -1068,56 +1084,61 @@ typedef struct *****************************************************************************/ -L3INT Q931Pie_BearerCap(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_ChanID(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_ProgInd(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_Display(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_Signal(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_HLComp(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_Segment(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_DateTime(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_Cause(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_SendComplete(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_KeypadFac(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_NotifInd(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_CallID(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_RepeatInd(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_NetFac(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_CallingNum(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_CallingSub(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_CalledNum(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_CalledSub(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_CalledNum(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_TransNetSel(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_LLComp(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_CallState(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_RestartInd(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Pie_UserUser(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); +q931pie_func_t Q931Pie_BearerCap; +q931pie_func_t Q931Pie_ChanID; +q931pie_func_t Q931Pie_ProgInd; +q931pie_func_t Q931Pie_Display; +q931pie_func_t Q931Pie_Signal; +q931pie_func_t Q931Pie_HLComp; +q931pie_func_t Q931Pie_Segment; +q931pie_func_t Q931Pie_DateTime; +q931pie_func_t Q931Pie_Cause; +q931pie_func_t Q931Pie_SendComplete; +q931pie_func_t Q931Pie_KeypadFac; +q931pie_func_t Q931Pie_NotifInd; +q931pie_func_t Q931Pie_CallID; +q931pie_func_t Q931Pie_RepeatInd; +q931pie_func_t Q931Pie_NetFac; +q931pie_func_t Q931Pie_CallingNum; +q931pie_func_t Q931Pie_CallingSub; +q931pie_func_t Q931Pie_CalledNum; +q931pie_func_t Q931Pie_CalledSub; +q931pie_func_t Q931Pie_CalledNum; +q931pie_func_t Q931Pie_TransNetSel; +q931pie_func_t Q931Pie_LLComp; +q931pie_func_t Q931Pie_CallState; +q931pie_func_t Q931Pie_RestartInd; +q931pie_func_t Q931Pie_UserUser; + +q931pie_func_t Q931Pie_GenericDigits; -L3INT Q931Uie_BearerCap(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); L3USHORT Q931Uie_CRV(Q931_TrunkInfo_t *pTrunk,L3UCHAR * IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_ChanID(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_ProgInd(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_Display(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_Signal(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_HLComp(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_Segment(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_DateTime(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_Cause(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_SendComplete(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_KeypadFac(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_NotifInd(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_CallID(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_RepeatInd(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_NetFac(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_CallingNum(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_CallingSub(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_CalledNum(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_CalledSub(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_TransNetSel(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_LLComp(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_CallState(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_RestartInd(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Uie_UserUser(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); + +q931uie_func_t Q931Uie_BearerCap; +q931uie_func_t Q931Uie_ChanID; +q931uie_func_t Q931Uie_ProgInd; +q931uie_func_t Q931Uie_Display; +q931uie_func_t Q931Uie_Signal; +q931uie_func_t Q931Uie_HLComp; +q931uie_func_t Q931Uie_Segment; +q931uie_func_t Q931Uie_DateTime; +q931uie_func_t Q931Uie_Cause; +q931uie_func_t Q931Uie_SendComplete; +q931uie_func_t Q931Uie_KeypadFac; +q931uie_func_t Q931Uie_NotifInd; +q931uie_func_t Q931Uie_CallID; +q931uie_func_t Q931Uie_RepeatInd; +q931uie_func_t Q931Uie_NetFac; +q931uie_func_t Q931Uie_CallingNum; +q931uie_func_t Q931Uie_CallingSub; +q931uie_func_t Q931Uie_CalledNum; +q931uie_func_t Q931Uie_CalledSub; +q931uie_func_t Q931Uie_TransNetSel; +q931uie_func_t Q931Uie_LLComp; +q931uie_func_t Q931Uie_CallState; +q931uie_func_t Q931Uie_RestartInd; +q931uie_func_t Q931Uie_UserUser; + +q931uie_func_t Q931Uie_GenericDigits; #endif /* _Q931IE_NL */ diff --git a/libs/openzap/src/isdn/include/national.h b/libs/openzap/src/isdn/include/national.h index 1e9f5b1f8f..f6c79ed4c9 100644 --- a/libs/openzap/src/isdn/include/national.h +++ b/libs/openzap/src/isdn/include/national.h @@ -65,37 +65,6 @@ *****************************************************************************/ -/* Single octet information elements */ - -/* Variable Length Information Elements */ -#define nationalie_GENERIC_DIGITS 0x37 /* 0011 0111 */ - - - -/***************************************************************************** - - Struct: nationalie_GenericDigits - - -*****************************************************************************/ - -typedef struct -{ - L3UCHAR IEId; /* 00110111 */ - L3UCHAR Size; /* Length of Information Element */ -}nationalie_GenericDigits; - - -/***************************************************************************** - - Q.931 Information Element Pack/Unpack functions. Implemented in nationalie.c - -*****************************************************************************/ - -L3INT nationalPie_GenericDigits(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT nationalUie_GenericDigits(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff); - - /***************************************************************************** Q.931 Message Pack/Unpack functions. Implemented in nationalmes.c diff --git a/libs/openzap/src/isdn/nationalStateNT.c b/libs/openzap/src/isdn/nationalStateNT.c index 2465853fe1..29f766e073 100644 --- a/libs/openzap/src/isdn/nationalStateNT.c +++ b/libs/openzap/src/isdn/nationalStateNT.c @@ -116,7 +116,7 @@ void nationalCreateNT(L3UCHAR i) Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i,Q931Pie_LLComp, Q931Uie_LLComp); Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i,Q931Pie_HLComp, Q931Uie_HLComp); Q931SetIEProc(Q931ie_USER_USER, i,Q931Pie_UserUser, Q931Uie_UserUser); - Q931SetIEProc(nationalie_GENERIC_DIGITS, i,nationalPie_GenericDigits, nationalUie_GenericDigits); + Q931SetIEProc(Q931ie_GENERIC_DIGITS, i,Q931Pie_GenericDigits, Q931Uie_GenericDigits); /* The following define a state machine. The point is that the Message */ /* procs can when search this to find out if the message/state */ diff --git a/libs/openzap/src/isdn/nationalStateTE.c b/libs/openzap/src/isdn/nationalStateTE.c index 0f3186e288..fb2e7139c2 100644 --- a/libs/openzap/src/isdn/nationalStateTE.c +++ b/libs/openzap/src/isdn/nationalStateTE.c @@ -123,7 +123,7 @@ void nationalCreateTE(L3UCHAR i) Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i,Q931Pie_LLComp, Q931Uie_LLComp); Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i,Q931Pie_HLComp, Q931Uie_HLComp); Q931SetIEProc(Q931ie_USER_USER, i,Q931Pie_UserUser, Q931Uie_UserUser); - Q931SetIEProc(nationalie_GENERIC_DIGITS, i,nationalPie_GenericDigits, nationalUie_GenericDigits); + Q931SetIEProc(Q931ie_GENERIC_DIGITS, i,Q931Pie_GenericDigits, Q931Uie_GenericDigits); /* The following define a state machine. The point is that the Message */ /* procs can when search this to find out if the message/state */ diff --git a/libs/openzap/src/isdn/nationalie.c b/libs/openzap/src/isdn/nationalie.c deleted file mode 100644 index bf9afbad80..0000000000 --- a/libs/openzap/src/isdn/nationalie.c +++ /dev/null @@ -1,141 +0,0 @@ -/***************************************************************************** - - FileName: nationalie.c - - Contents: Information Element Pack/Unpack functions. - - These functions will pack out a National ISDN message from the bit - packed original format into structs that are easier to process - and pack the same structs back into bit fields when sending - messages out. - - The messages contains a short for each possible IE. The MSB - bit flags the precense of an IE, while the remaining bits - are the offset into a buffer to find the actual IE. - - Each IE are supported by 3 functions: - - nationalPie_XXX Pack struct into Q.931 IE - nationalUie_XXX Unpack Q.931 IE into struct - nationalInitIEXXX Initialize IE (see nationalapi.c). - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "national.h" - -/***************************************************************************** - - Macro: Q931MoreIE - - Description: Local helper macro detecting if there is more IE space left - based on the 3 standard parameters Octet, Off and IESpace. - This can be used to test if the IE is completed to avoid - that the header of the next IE is interpreted as a part of - the current IE. - -*****************************************************************************/ -#define Q931MoreIE() (Octet+Off - 2< IESize) - -#define Q931IESizeTest(x) {\ - if(Octet + Off - 2!= IESize)\ - {\ - Q931SetError(pTrunk,x, Octet, Off);\ - return x;\ - }\ - } - -/***************************************************************************** - - Function: nationalUie_GenericDigits - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT nationalUie_GenericDigits(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - nationalie_GenericDigits * pie = (nationalie_GenericDigits*)OBuf; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x=0; - L3INT IESize; - - *pIE=0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(nationalie_GenericDigits) + x -1; - - pie->Size = (L3UCHAR)(sizeof(nationalie_GenericDigits) + x -1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: nationalPie_GenericDigits - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ - -L3INT nationalPie_GenericDigits(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - OBuf[(*Octet)++] = nationalie_GENERIC_DIGITS ; - OBuf[(*Octet)++] = 2; - - return Q931E_NO_ERROR; -} - diff --git a/libs/openzap/src/isdn/nationalmes.c b/libs/openzap/src/isdn/nationalmes.c index 971016167f..b256a318d6 100644 --- a/libs/openzap/src/isdn/nationalmes.c +++ b/libs/openzap/src/isdn/nationalmes.c @@ -62,102 +62,34 @@ L3INT nationalUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generi switch(IBuf[IOff]) { case Q931ie_SENDING_COMPLETE: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->SendComplete, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + case Q931ie_BEARER_CAPABILITY: + case Q931ie_CHANNEL_IDENTIFICATION: + case Q931ie_PROGRESS_INDICATOR: + case Q931ie_NETWORK_SPECIFIC_FACILITIES: + case Q931ie_DISPLAY: + case Q931ie_DATETIME: + case Q931ie_KEYPAD_FACILITY: + case Q931ie_SIGNAL: + case Q931ie_CALLING_PARTY_NUMBER: + case Q931ie_CALLING_PARTY_SUBADDRESS: + case Q931ie_CALLED_PARTY_NUMBER: + case Q931ie_CALLED_PARTY_SUBADDRESS: + case Q931ie_TRANSIT_NETWORK_SELECTION: + case Q931ie_LOW_LAYER_COMPATIBILITY: + case Q931ie_HIGH_LAYER_COMPATIBILITY: + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); if(rc != Q931E_NO_ERROR) return rc; break; case Q931ie_REPEAT_INDICATOR: - if(ir==0) - { - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->RepeatInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + if(ir < 2) { + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); ir++; - } - else if(ir==1) - { - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->LLRepeatInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - ir++; - } - else - { + } else { return Q931E_ILLEGAL_IE; } break; - case Q931ie_BEARER_CAPABILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->BearerCap, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_PROGRESS_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ProgInd, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_NETWORK_SPECIFIC_FACILITIES: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->NetFac, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Display, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_DATETIME: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->DateTime, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_KEYPAD_FACILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->KeypadFac, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->Signal, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLING_PARTY_NUMBER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CallingNum, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLING_PARTY_SUBADDRESS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CallingSub, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLED_PARTY_NUMBER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CalledSub, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CALLED_PARTY_SUBADDRESS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->CalledSub, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_TRANSIT_NETWORK_SELECTION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->TransNetSel, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_LOW_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->LLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->HLComp, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if(rc != Q931E_NO_ERROR) - return rc; - break; - case nationalie_GENERIC_DIGITS: + case Q931ie_GENERIC_DIGITS: /* TODO: Implement this ie */ IOff = IOff + 4; break;