buf is the data buffer you are reading the q931 message into.<br><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">pTrunk->L3Buf is the buffer in the trunk that you are reading it from it has the last received message in it.</span></font><br>
<br><br>*Mes is a pointer being declared to point at &buf[Q931L2HeaderSpace];<br><br>buf is a raw buffer<br>Q931L2HeaderSpace is a constant of the 921 header space which i think is 2 bytes.<br><br>so it's a pointer to the beginning of the actual message which is 2 bytes into buf.<br>
<br><br><font face="Courier New" size="2"><span style="font-size: 10pt;"></span></font><br><div class="gmail_quote">On Tue, Jun 24, 2008 at 12:33 AM, Michael Collins <<a href="mailto:mcollins@fcnetwork.com">mcollins@fcnetwork.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">I have question about the two different buffers that are
accessed in this function:</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">/*****************************************************************************</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> Function: Q931Rx23</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> Description: Receive message from layer
2 (LAPD). Receiving a message </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
is always done in 2 steps. First the message must be </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
interpreted and translated to a static struct. Secondly</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
the message is processed and responded to.</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
The Q.931 message contains a static header that is </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
interpreted in this function. The rest is interpreted</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
in a sub function according to mestype.</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> Parameters: pTrunk
[IN] Ptr to trunk info.</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
buf [IN] Ptr to buffer containing
message.</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
Size [IN] Size of message.</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> Return Value: Error Code. 0 = No Error, <
0 :error, > 0 : Warning</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">
see q931errors.h for details.</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">*****************************************************************************/</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">L3INT Q931Rx23(Q931_TrunkInfo_t *pTrunk, L3UCHAR *
buf, L3INT Size)</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="ES">{</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="ES"> L3UCHAR
*Mes = &buf[Q931L2HeaderSpace];</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="ES"> L3INT
RetCode = Q931E_NO_ERROR;</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="ES"> </span></font><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE">Q931mes_Generic *m = (Q931mes_Generic *) pTrunk->L3Buf;</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> L3INT
ISize;</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> L3INT
IOff = 0;</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> /*
Protocol Discriminator */</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE">
m->ProtDisc = Mes[IOff++];</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> /* CRV */</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE">
m->CRVFlag = Mes[IOff + 1] & 0x80;</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> m->CRV
= Q931Uie_CRV(pTrunk, Mes, m->buf, &IOff, &ISize);</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="DE"> </span></font><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR">/* Message Type */</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR">
m->MesType = Mes[IOff++];</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR"> </span></font><font face="Courier New" size="2"><span style="font-size: 10pt;">/*
Call table proc to unpack codec message */</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> /*debug */</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> printf("\n\nQ931Rx23-
Dialect: %d, MsgType: %d\nCause:
[%x]\n",pTrunk->Dialect,m->MesType,m->Cause); </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> printf("Message:
%s\n",Mes);</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> RetCode =
Q931Umes[pTrunk->Dialect][m->MesType](pTrunk, Mes, (Q931mes_Generic
*)pTrunk->L3Buf, Q931L4HeaderSpace + IOff , Size - Q931L4HeaderSpace - IOff
+ 1);</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="ES">if(RetCode
>= Q931E_NO_ERROR)</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="ES"> {</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="ES">
RetCode = Q931Proc[pTrunk->Dialect][m->MesType](pTrunk, pTrunk->L3Buf,
2);</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="ES"> </span></font><font face="Courier New" size="2"><span style="font-size: 10pt;">}</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;"> return RetCode;</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;">}</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">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.</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">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:</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font><font face="Courier New" size="2"><span style="font-size: 10pt;">L3UCHAR
*Mes = &buf[Q931L2HeaderSpace];</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">… is confusing me. What does that do?</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Thanks for your time!!</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p><font color="#888888">
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">-MC</span></font></p>
</font></div>
</div>
<br>_______________________________________________<br>
Freeswitch-dev mailing list<br>
<a href="mailto:Freeswitch-dev@lists.freeswitch.org">Freeswitch-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400