better implement Q931Uie_GenericDigits.
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@172 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
27cfa656c3
commit
68b898c69e
|
@ -710,6 +710,7 @@ static const char *q931_error_names[] = {
|
|||
"Q931E_RESTARTIND", /* -3027 */
|
||||
"Q931E_SEGMENT", /* -3028 */
|
||||
"Q931E_SIGNAL", /* -3029 */
|
||||
"Q931E_GENERIC_DIGITS" /* -3030 */
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -2998,27 +2998,64 @@ L3INT Q931Uie_GenericDigits(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3U
|
|||
{
|
||||
Q931ie_GenericDigits * pie = (Q931ie_GenericDigits*)OBuf;
|
||||
ie *pIE = &pMsg->GenericDigits;
|
||||
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(Q931ie_GenericDigits) + x -1;
|
||||
|
||||
pie->Size = (L3UCHAR)(sizeof(Q931ie_GenericDigits) + x -1);
|
||||
|
||||
return Q931E_NO_ERROR;
|
||||
L3INT Off = 0;
|
||||
L3INT Octet = 0;
|
||||
L3INT x;
|
||||
L3INT IESize;
|
||||
|
||||
*pIE=0;
|
||||
|
||||
/* Octet 1 */
|
||||
pie->IEId = IBuf[Octet];
|
||||
Octet ++;
|
||||
|
||||
/* Octet 2 */
|
||||
IESize = IBuf[Octet ++];
|
||||
|
||||
/* Octet 3 */
|
||||
pie->Type = (IBuf[Octet]) & 0x1F;
|
||||
pie->Encoding = (IBuf[Octet] >> 5) & 0x07;
|
||||
Octet ++;
|
||||
|
||||
/* Octet 4*/
|
||||
if (pie->Type == 0) { /* BCD Even */
|
||||
x = 0;
|
||||
do {
|
||||
pie->Digit[x++] = IBuf[Octet+Off] & 0x0f;
|
||||
pie->Digit[x++] = (IBuf[Octet+Off] >> 4) & 0x0f;
|
||||
Off++;
|
||||
} while (Q931MoreIE());
|
||||
} else if (pie->Type == 1) { /* BCD Odd */
|
||||
x = 0;
|
||||
do {
|
||||
pie->Digit[x++] = IBuf[Octet+Off] & 0x0f;
|
||||
if (Q931MoreIE()) {
|
||||
pie->Digit[x] = (IBuf[Octet+Off] >> 4) & 0x0f;
|
||||
}
|
||||
x++;
|
||||
Off++;
|
||||
} while (Q931MoreIE());
|
||||
} else if (pie->Type == 2) { /* IA5 */
|
||||
x = 0;
|
||||
do {
|
||||
pie->Digit[x++] = IBuf[Octet+Off] & 0x7f;
|
||||
Off++;
|
||||
} while (Q931MoreIE());
|
||||
} else {
|
||||
/* Binary encoding type unkown */
|
||||
Q931SetError(pTrunk, Q931E_GENERIC_DIGITS, Octet, Off);
|
||||
return Q931E_GENERIC_DIGITS;
|
||||
}
|
||||
|
||||
Q931IESizeTest(Q931E_GENERIC_DIGITS);
|
||||
|
||||
Q931SetIE(*pIE, *OOff);
|
||||
|
||||
*IOff = (*IOff) + Octet + Off;
|
||||
*OOff = (*OOff) + sizeof(Q931ie_CallingSub) + x -1;
|
||||
pie->Size = (L3UCHAR)(sizeof(Q931ie_CallingSub) + x -1);
|
||||
|
||||
return Q931E_NO_ERROR;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -3036,7 +3073,7 @@ L3INT Q931Uie_GenericDigits(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3U
|
|||
L3INT Q931Pie_GenericDigits(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet)
|
||||
{
|
||||
OBuf[(*Octet)++] = (Q931ie_GENERIC_DIGITS & 0xFF);
|
||||
OBuf[(*Octet)++] = 2;
|
||||
OBuf[(*Octet)++] = 0;
|
||||
|
||||
return Q931E_NO_ERROR;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,8 @@ typedef enum {
|
|||
Q931E_PROGIND = -3026,
|
||||
Q931E_RESTARTIND = -3027,
|
||||
Q931E_SEGMENT = -3028,
|
||||
Q931E_SIGNAL = -3029
|
||||
Q931E_SIGNAL = -3029,
|
||||
Q931E_GENERIC_DIGITS = -3030
|
||||
|
||||
} q931_error_t;
|
||||
|
||||
|
|
|
@ -1077,6 +1077,9 @@ typedef struct
|
|||
{
|
||||
L3UCHAR IEId; /* 00110111 */
|
||||
L3UCHAR Size; /* Length of Information Element */
|
||||
L3UCHAR Type; /* Type of number */
|
||||
L3UCHAR Encoding; /* Encoding of number */
|
||||
L3UCHAR Digit[1]; /* Number digits (IA5) */
|
||||
} Q931ie_GenericDigits;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue