add message pack and unpack functions for Restart and RestartAck from Jan. Thanks Jan.

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@105 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris 2007-05-23 04:10:50 +00:00
parent bc07decb59
commit ce51441fa0
1 changed files with 145 additions and 59 deletions

View File

@ -983,65 +983,151 @@ L3INT Q931Pmes_ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3INT IS
return rc;
}
/*****************************************************************************
Function: Q931Umes_Restart
*****************************************************************************/
L3INT Q931Umes_Restart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q931Pmes_Restart
*****************************************************************************/
L3INT Q931Pmes_Restart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q931Umes_RestartAck
*****************************************************************************/
L3INT Q931Umes_RestartAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q931Pmes_RestartAck
*****************************************************************************/
L3INT Q931Pmes_RestartAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q931Umes_Restart
*****************************************************************************/
L3INT Q931Umes_Restart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
{
L3INT OOff=0;
Q931mes_Restart *mes = (Q931mes_Restart*)OBuf;
L3INT rc=Q931E_NO_ERROR;
while(IOff < Size)
{
switch(IBuf[IOff])
{
case Q931ie_CHANNEL_IDENTIFICATION:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID,&IBuf[IOff], &OBuf[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], &OBuf[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], &OBuf[OOff], &IOff, &OOff);
if(rc != Q931E_NO_ERROR)
return rc;
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
}
mes->Size = sizeof(Q931mes_Restart) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_Restart
*****************************************************************************/
L3INT Q931Pmes_Restart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3INT rc = Q931E_NO_ERROR;
Q931mes_Restart *pMes = (Q931mes_Restart *)IBuf;
L3INT Octet = 0;
/* Q931 Message Header */
OBuf[Octet++] = pMes->ProtDisc; /* Protocol discriminator */
OBuf[Octet++] = 2; /* length is 2 octets */
OBuf[Octet++] = (L3UCHAR)(pMes->CRV>>8); /* msb */
OBuf[Octet++] = (L3UCHAR)(pMes->CRV); /* lsb */
OBuf[Octet++] = pMes->MesType; /* message header */
/* ChanID */
if(Q931IsIEPresent(pMes->ChanID))
if((rc=Q931Pie[pTrunk->Dialect][pMes->MesType](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet))!=0)
return rc;
/* Display */
if(Q931IsIEPresent(pMes->Display))
if((rc=Q931Pie[pTrunk->Dialect][pMes->MesType](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet))!=0)
return rc;
/* RestartInd */
if(Q931IsIEPresent(pMes->RestartInd))
if((rc=Q931Pie[pTrunk->Dialect][pMes->MesType](pTrunk, Q931GetIEPtr(pMes->RestartInd,pMes->buf), OBuf, &Octet))!=0)
return rc;
return rc;
}
/*****************************************************************************
Function: Q931Umes_RestartAck
*****************************************************************************/
L3INT Q931Umes_RestartAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
{
L3INT OOff=0;
Q931mes_RestartAck *mes = (Q931mes_RestartAck*)OBuf;
L3INT rc=Q931E_NO_ERROR;
while(IOff < Size)
{
switch(IBuf[IOff])
{
case Q931ie_CHANNEL_IDENTIFICATION:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, &mes->ChanID,&IBuf[IOff], &OBuf[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], &OBuf[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], &OBuf[OOff], &IOff, &OOff);
if(rc != Q931E_NO_ERROR)
return rc;
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
}
mes->Size = sizeof(Q931mes_RestartAck) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_RestartAck
*****************************************************************************/
L3INT Q931Pmes_RestartAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3INT rc = Q931E_NO_ERROR;
Q931mes_RestartAck *pMes = (Q931mes_RestartAck *)IBuf;
L3INT Octet = 0;
/* Q931 Message Header */
OBuf[Octet++] = pMes->ProtDisc; /* Protocol discriminator */
OBuf[Octet++] = 2; /* length is 2 octets */
OBuf[Octet++] = (L3UCHAR)(pMes->CRV>>8); /* msb */
OBuf[Octet++] = (L3UCHAR)(pMes->CRV); /* lsb */
OBuf[Octet++] = pMes->MesType; /* message header */
/* ChanID */
if(Q931IsIEPresent(pMes->ChanID))
if((rc=Q931Pie[pTrunk->Dialect][pMes->MesType](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet))!=0)
return rc;
/* Display */
if(Q931IsIEPresent(pMes->Display))
if((rc=Q931Pie[pTrunk->Dialect][pMes->MesType](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet))!=0)
return rc;
/* RestartInd */
if(Q931IsIEPresent(pMes->RestartInd))
if((rc=Q931Pie[pTrunk->Dialect][pMes->MesType](pTrunk, Q931GetIEPtr(pMes->RestartInd,pMes->buf), OBuf, &Octet))!=0)
return rc;
return rc;
}
/*****************************************************************************