I have question about the two different buffers that are
accessed in this function:
/*****************************************************************************
Function: Q931Rx23
Description: Receive message from layer
2 (LAPD). Receiving a message
is always done in 2 steps. First the message must be
interpreted and translated to a static struct. Secondly
the message is processed and responded to.
The Q.931 message contains a static header that is
interpreted in this function. The rest is interpreted
in a sub function according to mestype.
Parameters: pTrunk
[IN] Ptr to trunk info.
buf [IN] Ptr to buffer containing
message.
Size [IN] Size of message.
Return Value: Error Code. 0 = No Error, <
0 :error, > 0 : Warning
see q931errors.h for details.
*****************************************************************************/
L3INT Q931Rx23(Q931_TrunkInfo_t *pTrunk, L3UCHAR *
buf, L3INT Size)
{
L3UCHAR
*Mes = &buf[Q931L2HeaderSpace];
L3INT
RetCode = Q931E_NO_ERROR;
Q931mes_Generic *m = (Q931mes_Generic *) pTrunk->L3Buf;
L3INT
ISize;
L3INT
IOff = 0;
/*
Protocol Discriminator */
m->ProtDisc = Mes[IOff++];
/* CRV */
m->CRVFlag = Mes[IOff + 1] & 0x80;
m->CRV
= Q931Uie_CRV(pTrunk, Mes, m->buf, &IOff, &ISize);
/* Message Type */
m->MesType = Mes[IOff++];
/*
Call table proc to unpack codec message */
/*debug */
printf("\n\nQ931Rx23-
Dialect: %d, MsgType: %d\nCause:
[%x]\n",pTrunk->Dialect,m->MesType,m->Cause);
printf("Message:
%s\n",Mes);
RetCode =
Q931Umes[pTrunk->Dialect][m->MesType](pTrunk, Mes, (Q931mes_Generic
*)pTrunk->L3Buf, Q931L4HeaderSpace + IOff , Size - Q931L4HeaderSpace - IOff
+ 1);
if(RetCode
>= Q931E_NO_ERROR)
{
RetCode = Q931Proc[pTrunk->Dialect][m->MesType](pTrunk, pTrunk->L3Buf,
2);
}
return RetCode;
}
What’s the difference between pTrunk->L3Buf and
*buf in this function? I’m trying to understand where the q931
message is coming from as it is passed up the stack from layer 2 to layer 3. I
may have found a clue about the phantom cause IE issue but I won’t know
for sure until I know what exactly I’m looking at.
Also, can you tell me what is accomplished by creating *Mes
as opposed to *m? I am familiar with the Q931mes_Generic data struct but
the line:
L3UCHAR
*Mes = &buf[Q931L2HeaderSpace];
… is confusing me. What does that do?
Thanks for your time!!
-MC