remove codeset form generic message struct, it doesn't belong there, this is still messy, need a cleaner way.

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@178 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris 2007-05-29 15:32:37 +00:00
parent ed79956a5e
commit ecfacdef7e
4 changed files with 53 additions and 42 deletions

View File

@ -334,9 +334,6 @@ L3INT Q931Rx23(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT Size)
/* Message Type */ /* Message Type */
m->MesType = Mes[IOff++]; m->MesType = Mes[IOff++];
/* Starting Codeset */
m->codeset = Q931_CODESET_0;
if (m->ProtDisc != 8) { if (m->ProtDisc != 8) {
return Q931E_UNKNOWN_MESSAGE; return Q931E_UNKNOWN_MESSAGE;
} }

View File

@ -372,11 +372,6 @@ typedef struct
L3UCHAR ProtDisc; /* Protocol Discriminator */ L3UCHAR ProtDisc; /* Protocol Discriminator */
L3UCHAR MesType; /* Message type */ L3UCHAR MesType; /* Message type */
L3INT CRV; /* Call reference value */ 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 Shift;
ie MoreData; ie MoreData;

View File

@ -98,7 +98,7 @@ typedef enum {
/* Variable Length Codeset 6 Information Elements */ /* Variable Length Codeset 6 Information Elements */
#define Q931ie_GENERIC_DIGITS (Q931_CODESET_6 | 0x37) /* 0011 0111 */ #define Q931ie_GENERIC_DIGITS 0x37 /* 0011 0111 */

View File

@ -56,22 +56,26 @@ L3INT nationalUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generi
L3INT ir=0; L3INT ir=0;
L3INT OOff=0; L3INT OOff=0;
L3INT rc=Q931E_NO_ERROR; L3INT rc=Q931E_NO_ERROR;
L3UINT last_codeset = mes->codeset; L3UCHAR last_codeset = 0, codeset = 0;
L3UCHAR shift_lock = 1; L3UCHAR shift_lock = 1;
while(IOff < Size) while(IOff < Size)
{ {
if (!shift_lock) { if (!shift_lock) {
mes->codeset = last_codeset; codeset = last_codeset;
} }
if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT ) { if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT ) {
mes->codeset = ((IBuf[IOff] & 0x07) << 8);
shift_lock = (IBuf[IOff] & 0x08); shift_lock = (IBuf[IOff] & 0x08);
if (shift_lock) {
last_codeset = codeset;
}
codeset = ((IBuf[IOff] & 0x07) << 8);
IOff++; IOff++;
} }
switch(mes->codeset | IBuf[IOff]) if (codeset == 0) {
switch(IBuf[IOff])
{ {
case Q931ie_SENDING_COMPLETE: case Q931ie_SENDING_COMPLETE:
case Q931ie_BEARER_CAPABILITY: case Q931ie_BEARER_CAPABILITY:
@ -89,7 +93,6 @@ L3INT nationalUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generi
case Q931ie_TRANSIT_NETWORK_SELECTION: case Q931ie_TRANSIT_NETWORK_SELECTION:
case Q931ie_LOW_LAYER_COMPATIBILITY: case Q931ie_LOW_LAYER_COMPATIBILITY:
case Q931ie_HIGH_LAYER_COMPATIBILITY: case Q931ie_HIGH_LAYER_COMPATIBILITY:
case Q931ie_GENERIC_DIGITS:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &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) if(rc != Q931E_NO_ERROR)
return rc; return rc;
@ -106,6 +109,22 @@ L3INT nationalUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generi
return Q931E_ILLEGAL_IE; return Q931E_ILLEGAL_IE;
break; break;
} }
} else if (codeset == 6) {
switch(IBuf[IOff])
{
case Q931ie_GENERIC_DIGITS:
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;
}
} else {
return Q931E_ILLEGAL_IE;
}
} }
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR; return Q931E_NO_ERROR;