wiki:rtp

Version 3 (modified by ivano, 9 months ago) (diff)

fixed a bug

Running NetPDL parser failed a:
0, PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/idn.ini on line 1 in Unknown on line 0 /usr/local/netpdl/parser.php

NetPDL dissector..........Validation Error
Error 1871: Element 'assign-variable': This element is not expected. Expected is one of ( update-lookuptable, if ).
  Line: 42

--------------------------------------------


Original XML source
  1. <protocol name="rtp" longname="RTP (Real Time Protocol)" showsumtemplate="rtp">
  2.   <execute-code>
  3.     <verify>
  4.  
  5.       <if expr="(buf2int($packet[$currentoffset:1]) bitwand 0xC0) == 0x80">
  6.         <if-true>
  7.  
  8.           <if expr="checklookuptable($rtptable, $ipsrc, $ipdst, $portsrc, $portdst)">
  9.             <if-true>
  10.  
  11.               <if expr="$buf2int(rtptable.ssrc) == buf2int($packet[$currentoffset + 8 : 4])">
  12.                 <if-true>
  13.                   <assign-variable name="$protoverify_result" value="%FOUND"/>
  14.                 </if-true>
  15.  
  16.                 <if-false>
  17.                   <assign-variable name="$protoverify_result" value="%NOTFOUND"/>
  18.  
  19.                   <!-- We should avoid code that updates variables here unless we're 100% sure that this code must be executed. -->
  20.                   <!-- Please check the NetPDL documentation for more details. -->
  21.                   <!-- However, this is a case in which we're 100% sure :-) -->
  22.  
  23.                   <update-lookuptable name="$rtptable" action="purge">
  24.                     <lookupkey value="$ipsrc"/>
  25.                     <lookupkey value="$ipdst"/>
  26.                     <lookupkey value="$portsrc"/>
  27.                     <lookupkey value="$portdst"/>
  28.                   </update-lookuptable>
  29.                 </if-false>
  30.               </if>
  31.             </if-true>
  32.  
  33.             <if-false>
  34.               <assign-variable name="$protoverify_result" value="%DEFERRED"/>
  35.             </if-false>
  36.           </if>
  37.         </if-true>
  38.       </if>
  39.     </verify>
  40.  
  41.     <before when="$protoverify_result == %FOUND">
  42.       <assign-variable name="$session_hit" value="1"/>
  43.       <!-- Add RTP stream -->
  44.       <update-lookuptable name="$udpsessiontable" action="add" validity="updateonhit" keeptime="10" hittime="10">
  45.         <lookupkey value="$ipsrc"/>
  46.         <lookupkey value="$ipdst"/>
  47.         <lookupkey value="$portsrc"/>
  48.         <lookupkey value="$portdst"/>
  49.         <lookupdata value="#rtp"/>
  50.       </update-lookuptable>
  51.  
  52.       <!-- Add companion RTCP stream -->
  53.       <update-lookuptable name="$udpsessiontable" action="add" validity="updateonhit" keeptime="300" hittime="300">
  54.         <lookupkey value="$ipsrc"/>
  55.         <lookupkey value="$ipdst"/>
  56.         <lookupkey value="int2buf(buf2int($portsrc) + 1, 2)"/>
  57.         <lookupkey value="int2buf(buf2int($portdst) + 1, 2)"/>
  58.         <lookupdata value="#rtcp"/>
  59.       </update-lookuptable>
  60.  
  61.       <update-lookuptable name="$rtptable" action="purge">
  62.         <lookupkey value="$ipsrc"/>
  63.         <lookupkey value="$ipdst"/>
  64.         <lookupkey value="$portsrc"/>
  65.         <lookupkey value="$portdst"/>
  66.       </update-lookuptable>
  67.     </before>
  68.  
  69.     <before when="$protoverify_result == %DEFERRED">
  70.       <update-lookuptable name="$rtptable" action="add" validity="updateonhit" keeptime="10" hittime="10">
  71.         <lookupkey value="$ipsrc"/>
  72.         <lookupkey value="$ipdst"/>
  73.         <lookupkey value="$portsrc"/>
  74.         <lookupkey value="$portdst"/>
  75.         <lookupdata value="$packet[$currentoffset + 8 : 4]"/>
  76.       </update-lookuptable>
  77.  
  78.       <!-- We do not add RTCP in case of 'deferred'; we'll add the RTCP session only when we're sure we have an RTP stream -->
  79.       <!-- With this choice, we may have some RTCP packets that are not recognized (the ones that arrive -->
  80.       <!-- when the RTP session is still in the "deferred" state; however, this is rather uncommon -->
  81.     </before>
  82.   </execute-code>
  83.   <format>
  84.     <fields>
  85.       <field type="bit" name="ver" longname="Version" description="Always set to 2" mask="0xC0" size="1" showtemplate="FieldDec"/>
  86.       <field type="bit" name="pad" longname="Padding" description="Set to enable padding" mask="0x20" size="1" showtemplate="FieldBin"/>
  87.       <field type="bit" name="ext" longname="Extension" mask="0x10" size="1" showtemplate="FieldBin"/>
  88.       <field type="bit" name="cc" longname="CSRC Count" description="Number of CSRC Identifiers" mask="0x0F" size="1" showtemplate="FieldDec"/>
  89.       <field type="bit" name="mar" longname="Marker" mask="0x80" size="1" showtemplate="FieldDec"/>
  90.       <field type="bit" name="pt" longname="Payload Type" description="Format of RTP payload" mask="0x7F" size="1" showtemplate="rtp.pt"/>
  91.       <field type="fixed" name="sn" longname="Sequence Number" size="2" showtemplate="FieldHex"/>
  92.       <field type="fixed" name="ts" longname="TimeStamp" size="4" showtemplate="FieldHex"/>
  93.       <field type="fixed" name="ssrc" longname="SSRC synchronization Source" size="4" showtemplate="FieldHex"/>
  94.  
  95.       <block name="csrc" longname="CSRC List">
  96.         <loop type="times2repeat" expr="buf2int(cc)">
  97.           <field type="fixed" name="csrc" longname="Source CSRC" size="4" showtemplate="FieldDec"/>
  98.         </loop>
  99.       </block>
  100.  
  101.       <field type="variable" name="media" longname="Media Data" expr="$packetlength - $currentoffset" showtemplate="Field4BytesHex"/>
  102.  
  103.     </fields>
  104.   </format>
  105.  
  106.   <visualization>
  107.     <showsumtemplate name="rtp">
  108.  
  109.       <section name="next"/>
  110.       <text value="RTP: Seq "/>
  111.       <protofield name="sn" showdata="showvalue"/>
  112.       <text value=", Media type "/>
  113.       <protofield name="pt" showdata="showvalue"/>
  114.       <text value=" ("/>
  115.       <protofield name="pt" showdata="showmap"/>
  116.       <text value=")"/>
  117.       <if expr="$protoverify_result == %DEFERRED">
  118.         <if-true>
  119.           <text value=" (Candidate)"/>
  120.         </if-true>
  121.       </if>
  122.     </showsumtemplate>
  123.  
  124.     <showtemplate name="rtp.pt" showtype="dec">
  125.       <!-- http://www.iana.org/assignments/rtp-parameters -->
  126.       <showmap>
  127.         <switch expr="buf2int(this)">
  128.           <case value="0" show="PCMU (Audio, 8KHz, 1 Channel)"/>
  129.           <case value="3" show="GSM (Audio, 8KHz, 1 Channel)"/>
  130.           <case value="4" show="G723 (Audio, 8KHz, 1 Channel)"/>
  131.           <case value="5" show="DVI4 (Audio, 8KHz, 1 Channel)"/>
  132.           <case value="6" show="DVI4 (Audio, 16KHz, 1 Channel)"/>
  133.           <case value="7" show="LPC (Audio, 8KHz, 1 Channel)"/>
  134.           <case value="8" show="PCMA (Audio, 8KHz, 1 Channel)"/>
  135.           <case value="8" show="PCMA (Audio, 8KHz, 1 Channel)"/>
  136.           <case value="9" show="G722 (Audio, 8KHz, 1 Channel)"/>
  137.           <case value="10" show="L16 (Audio, 44.1KHz, 2 Channels)"/>
  138.           <case value="11" show="L16 (Audio, 44.1KHz, 1 Channel)"/>
  139.           <case value="12" show="QCELP (Audio, 8KHz, 1 Channel)"/>
  140.           <case value="13" show="CN (Audio, 8KHz, 1 Channel)"/>
  141.           <case value="14" show="MPA (Audio, 90KHz, 1 Channel)"/>
  142.           <case value="15" show="G728 (Audio, 8KHz, 1 Channel)"/>
  143.           <case value="16" show="DVI4 (Audio, 11.025KHz, 1 Channel)"/>
  144.           <case value="17" show="DVI4 (Audio, 22,05KHz, 1 Channel)"/>
  145.           <case value="18" show="G729 (Audio, 8KHz, 1 Channel)"/>
  146.           <case value="25" show="CelB (Video, 90KHz)"/>
  147.           <case value="26" show="JPEG (Video, 90KHz)"/>
  148.           <case value="28" show="nv (Video, 90KHz)"/>
  149.           <case value="31" show="H261 (Video, 90KHz)"/>
  150.           <case value="32" show="MPV (Video, 90KHz)"/>
  151.           <case value="33" show="MP2T (Audio Video, 90KHz)"/>
  152.           <case value="34" show="H263 (Video, 90KHz)"/>
  153.           <case value="96" maxvalue="127" show="Dynamically negotiated"/>
  154.           <default show="Payload type not recognized"/>
  155.         </switch>
  156.       </showmap>
  157.     </showtemplate>
  158.   </visualization>
  159. </protocol>
  160.  
  161.  
Processing time: 0.051