diff options
author | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2007-10-12 09:59:10 +0000 |
---|---|---|
committer | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2007-10-12 09:59:10 +0000 |
commit | 358c4399ba193157b580eea16fb32c9319e78016 (patch) | |
tree | 60031ce53a99a91195f4460c5bd6296af5b27892 | |
parent | 2e37539cd55ec1cd1f8888c40af0f91437b142b0 (diff) |
TLVs now defined in XML (from Stephen Croll).
svn path=/trunk/; revision=23156
-rw-r--r-- | plugins/wimaxasncp/ChangeLog | 6 | ||||
-rw-r--r-- | plugins/wimaxasncp/Makefile.am | 28 | ||||
-rw-r--r-- | plugins/wimaxasncp/Makefile.common | 6 | ||||
-rw-r--r-- | plugins/wimaxasncp/dictionary.dtd | 18 | ||||
-rw-r--r-- | plugins/wimaxasncp/dictionary.xml | 1986 | ||||
-rw-r--r-- | plugins/wimaxasncp/packet-wimaxasncp.c | 1710 | ||||
-rw-r--r-- | plugins/wimaxasncp/wimaxasncp_dict.l | 755 |
7 files changed, 2876 insertions, 1633 deletions
diff --git a/plugins/wimaxasncp/ChangeLog b/plugins/wimaxasncp/ChangeLog index 06b17c3db4..264fad1fe8 100644 --- a/plugins/wimaxasncp/ChangeLog +++ b/plugins/wimaxasncp/ChangeLog @@ -1,5 +1,11 @@ 2007-08-29 Stephen Croll <croll@mobilemetrics.net> * initial version + +2007-10-09 Stephen Croll <stephen.d.croll@gmail.com> + + * TLVs defined in XML files. + * packet-wimaxasncp.c: fixed memory leak in function + wimaxasncp_dissect_tlv_value() diff --git a/plugins/wimaxasncp/Makefile.am b/plugins/wimaxasncp/Makefile.am index a5883caebd..a68a327f76 100644 --- a/plugins/wimaxasncp/Makefile.am +++ b/plugins/wimaxasncp/Makefile.am @@ -22,6 +22,9 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # +# lex rules +include ../../Makefile.am.inc + INCLUDES = -I$(top_srcdir) -I$(includedir) include Makefile.common @@ -115,11 +118,28 @@ CLEANFILES = \ *~ MAINTAINERCLEANFILES = \ - Makefile.in \ + Makefile.in \ + wimaxasncp_dict.c \ + wimaxasncp_dict_lex.h \ plugin.c EXTRA_DIST = \ - Makefile.common \ - Makefile.nmake \ - moduleinfo.nmake \ + wimaxasncp_dict.l \ + Makefile.common \ + Makefile.nmake \ + moduleinfo.nmake \ plugin.rc.in + +RUNLEX = $(top_srcdir)/tools/runlex.sh + +wimaxasncp_dict_lex.h : wimaxasncp_dict.c + +# +# Install the wimaxasncp DTD and XML files in the "wimaxasncp" +# subdirectory of $(pkgdatadir) +# + +wimaxasncpdir = $(pkgdatadir)/wimaxasncp +wimaxasncp_DATA = \ + dictionary.dtd \ + dictionary.xml diff --git a/plugins/wimaxasncp/Makefile.common b/plugins/wimaxasncp/Makefile.common index e177f32f7a..c6c7629225 100644 --- a/plugins/wimaxasncp/Makefile.common +++ b/plugins/wimaxasncp/Makefile.common @@ -31,12 +31,14 @@ DISSECTOR_SRC = \ packet-wimaxasncp.c # corresponding headers -DISSECTOR_INCLUDES = \ +DISSECTOR_INCLUDES = \ + wimaxasncp_dict_lex.h \ packet-wimaxasncp.h # Dissector helpers. They're included in the source files in this # directory, but they're not dissectors themselves, i.e. they're not # used to generate "register.c"). -DISSECTOR_SUPPORT_SRC = +DISSECTOR_SUPPORT_SRC = \ + wimaxasncp_dict.c diff --git a/plugins/wimaxasncp/dictionary.dtd b/plugins/wimaxasncp/dictionary.dtd new file mode 100644 index 0000000000..97adff9c31 --- /dev/null +++ b/plugins/wimaxasncp/dictionary.dtd @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- $Id$ --> + +<!ELEMENT dictionary (tlv+)> + +<!ELEMENT tlv (enum*)> +<!ATTLIST tlv + name CDATA #REQUIRED + type CDATA #REQUIRED + decoder CDATA #IMPLIED +> + +<!ELEMENT enum EMPTY> +<!ATTLIST enum + name CDATA #REQUIRED + code CDATA #REQUIRED +> diff --git a/plugins/wimaxasncp/dictionary.xml b/plugins/wimaxasncp/dictionary.xml new file mode 100644 index 0000000000..b8b7e0c7b4 --- /dev/null +++ b/plugins/wimaxasncp/dictionary.xml @@ -0,0 +1,1986 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- $Id$ --> + +<!DOCTYPE dictionary SYSTEM "dictionary.dtd"> + +<dictionary> + + <!-- ****************************************************************** --> + + <tlv name="Accept/Reject Indicator" + type="1" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="accept" + code="0x00"/> + + <enum name="reject" + code="0x01"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Accounting Extension" + type="2" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Action Code" + type="3" + decoder="WIMAXASNCP_TLV_ENUM16"> + + <enum name="Deregister MS" + code="0x0000"/> + + <enum name="Suspend all MS traffic" + code="0x0001"/> + + <enum name="Suspend user traffic" + code="0x0002"/> + + <enum name="Resume traffic" + code="0x0003"/> + + <enum name="MS terminate current normal operations with BS" + code="0x0004"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Action Time" + type="4" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="AK" + type="5" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="AK Context" + type="6" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="AK ID" + type="7" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="AK Lifetime" + type="8" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="AK SN" + type="9" + decoder="WIMAXASNCP_TLV_HEX8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Anchor ASN GW ID / Anchor DPF Identifier" + type="10" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Anchor MM Context" + type="11" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Anchor PCID - Anchor Paging Controller ID" + type="12" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Anchor PC Relocation Destination" + type="13" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Anchor PC Relocation Request Response" + type="14" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="accept" + code="0xff"/> + + <enum name="refuse" + code="0x00"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Associated PHSI" + type="15" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Anchor Authenticator ID" + type="16" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Authentication Complete" + type="17" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Authentication Result" + type="18" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Success" + code="0"/> + + <enum name="Failure" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Authenticator Identifier" + type="19" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Auth-IND" + type="20" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Initial authentication" + code="0"/> + + <enum name="Re-authentication" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Authorization Policy" + type="21" + decoder="WIMAXASNCP_TLV_BITFLAGS16"> + + <enum name="RSA authorization" + code="WIMAXASNCP_BIT16(0)"/> + + <enum name="EAP authorization" + code="WIMAXASNCP_BIT16(1)"/> + + <enum name="Authenticated-EAP authorization" + code="WIMAXASNCP_BIT16(2)"/> + + <enum name="HMAC supported" + code="WIMAXASNCP_BIT16(3)"/> + + <enum name="CMAC supported" + code="WIMAXASNCP_BIT16(4)"/> + + <enum name="64-bit Short-HMAC" + code="WIMAXASNCP_BIT16(5)"/> + + <enum name="80-bit Short-HMAC" + code="WIMAXASNCP_BIT16(6)"/> + + <enum name="96-bit Short-HMAC" + code="WIMAXASNCP_BIT16(7)"/> + + <enum name="Reauthentication Policy (TBD)" + code="WIMAXASNCP_BIT16(8)"/> + + <enum name="Reauthentication Policy (TBD)" + code="WIMAXASNCP_BIT16(9)"/> + + <enum name="Reauthentication Policy (TBD)" + code="WIMAXASNCP_BIT16(10)"/> + + <enum name="Reauthentication Policy (TBD)" + code="WIMAXASNCP_BIT16(11)"/> + + <enum name="Reauthentication Policy (TBD)" + code="WIMAXASNCP_BIT16(12)"/> + + <enum name="Reauthentication Policy (TBD)" + code="WIMAXASNCP_BIT16(13)"/> + + <enum name="Reauthentication Policy (TBD)" + code="WIMAXASNCP_BIT16(14)"/> + + <enum name="Reauthentication Policy (TBD)" + code="WIMAXASNCP_BIT16(15)"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Available Radio Resource DL" + type="22" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Available Radio Resource UL" + type="23" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="BE Data Delivery Service" + type="24" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="BS ID" + type="25" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="BS Info" + type="26" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="BS-originated EAP-Start Flag" + type="27" + decoder="WIMAXASNCP_TLV_FLAG0"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Care-Of Address (CoA)" + type="28" + decoder="WIMAXASNCP_TLV_IPV4_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="CID" + type="29" + decoder="WIMAXASNCP_TLV_HEX16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Classifier" + type="30" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Classifier Action" + type="31" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Add Classifier" + code="0"/> + + <enum name="Replace Classifier" + code="1"/> + + <enum name="Delete Classifier" + code="2"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Classifier Rule Priority" + type="32" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Classifier Type" + type="33" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="IP TOS/DSCP Range and Mask" + code="1"/> + + <enum name="Protocol" + code="2"/> + + <enum name="IP Source Address and Mask" + code="3"/> + + <enum name="IP Destination Address and Mask" + code="4"/> + + <enum name="Protocol Source Port Range" + code="5"/> + + <enum name="Protocol Destination Port Range" + code="6"/> + + <enum name="IEEE 802.3/Ethernet Destination MAC address" + code="7"/> + + <enum name="IEEE 802.3/Ethernet Source MAC address" + code="8"/> + + <enum name="Ethertype/IEEE 802.2 SAP" + code="9"/> + + <enum name="IEEE 802.1D User_Priority" + code="10"/> + + <enum name="IEEE 802.1Q VLAN_ID" + code="11"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="CMAC_KEY_COUNT" + type="34" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Combined Resources Required" + type="35" + decoder="WIMAXASNCP_TLV_ENUM16"> + + <enum name="Not combined" + code="0x0000"/> + + <enum name="Combined" + code="0x0001"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Context Purpose Indicator" + type="36" + decoder="WIMAXASNCP_TLV_ENUM32"> + + <enum name="MS AK Context" + code="WIMAXASNCP_BIT32(0)"/> + + <enum name="MS Network Context" + code="WIMAXASNCP_BIT32(1)"/> + + <enum name="MS MAC Context" + code="WIMAXASNCP_BIT32(2)"/> + + <enum name="Service Authorization Context" + code="WIMAXASNCP_BIT32(3)"/> + + <enum name="FA Context" + code="WIMAXASNCP_BIT32(4)"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Correlation ID" + type="37" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Cryptographic Suite" + type="38" + decoder="WIMAXASNCP_TLV_ENUM32"> + + <enum name="No data encryption, no data authentication & 3-DES, 128" + code="0x000000"/> + + <enum name="CBC-Mode 56-bit DES, no data authentication & 3-DES, 128" + code="0x010001"/> + + <enum name="No data encryption, no data authentication & RSA, 1024" + code="0x000002"/> + + <enum name="CBC-Mode 56-bit DES, no data authentication & RSA, 1024" + code="0x010002"/> + + <enum name="CCM-Mode 128-bit AES, CCM-Mode, 128-bit, ECB mode AES with 128-bit key" + code="0x020103"/> + + <enum name="CCM-Mode 128bits AES, CCM-Mode, AES Key Wrap with 128-bit key" + code="0x020104"/> + + <enum name="CBC-Mode 128-bit AES, no data authentication, ECB mode AES with 128-bit key" + code="0x030003"/> + + <enum name="MBS CTR Mode 128 bits AES, no data authentication, AES ECB mode with 128-bit key" + code="0x800003"/> + + <enum name="MBS CTR mode 128 bits AES, no data authentication, AES Key Wrap with 128-bit key" + code="0x800004"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="CS Type" + type="39" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Packet, IPv4" + code="1"/> + + <enum name="Packet, IPv6" + code="2"/> + + <enum name="Packet, 802.3" + code="3"/> + + <enum name="Packet, 802.1Q" + code="4"/> + + <enum name="Packet, IPv4over802.3" + code="5"/> + + <enum name="Packet, IPv6over802.3" + code="6"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Data Integrity" + type="40" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="No recommendation" + code="0x0"/> + + <enum name="Data integrity requested" + code="0x1"/> + + <enum name="Data delay jitter sensitive" + code="0x2"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Data Integrity Info" + type="41" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Data Path Encapsulation Type" + type="42" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="GRE" + code="1"/> + + <enum name="IP-in-IP" + code="2"/> + + <enum name="VLAN" + code="3"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Data Path Establishment Option" + type="43" + decoder="WIMAXASNCP_TLV_HEX8"> + + <enum name="Do not (Pre-) Establish DP" + code="0"/> + + <enum name="(Pre-) Establish DP" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Data Path ID" + type="44" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Data Path Info" + type="45" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Data Path Integrity Mechanism" + type="46" + decoder="WIMAXASNCP_TLV_ENUM8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Data Path Type" + type="47" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Type1" + code="0"/> + + <enum name="Type2" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DCD/UCD Configuration Change Count" + type="48" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DCD Setting" + type="49" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Device Authentication Indicator" + type="50" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Reserved" + code="0"/> + + <enum name="Certificate-based device authentication has been successfully performed" + code="1"/> + + <enum name="Device authentication has been successfully performed." + code="2"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DHCP Key" + type="51" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DHCP Key ID" + type="52" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DHCP Key Lifetime" + type="53" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DHCP Proxy Info" + type="54" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DHCP Relay Address" + type="55" + decoder="WIMAXASNCP_TLV_IPV4_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DHCP Relay Info" + type="56" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DHCP Server Address" + type="57" + decoder="WIMAXASNCP_TLV_IPV4_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DHCP Server List" + type="58" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Direction" + type="59" + decoder="WIMAXASNCP_TLV_ENUM16"> + + <enum name="For Uplink" + code="0x001"/> + + <enum name="For Downlink" + code="0x002"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DL PHY Quality Info" + type="60" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="DL PHY Service Level" + type="61" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="EAP Payload" + type="62" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="EIK" + type="63" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="ERT-VR Data Delivery Service" + type="64" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Exit IDLE Mode Operation Indication" + type="65" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="No" + code="0"/> + + <enum name="Yes" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="FA-HA Key" + type="66" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="FA-HA Key Lifetime" + type="67" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="FA-HA Key SPI" + type="68" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Failure Indication" + type="69" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Unspecified Error" + code="0"/> + + <enum name="Incompatible Version Number" + code="1"/> + + <enum name="Invalid Function Type" + code="2"/> + + <enum name="Invalid Message Type" + code="3"/> + + <enum name="Unknown MSID" + code="4"/> + + <enum name="Transaction Failure" + code="5"/> + + <enum name="Unknown Source Identifier" + code="6"/> + + <enum name="Unknown Destination Identifier" + code="7"/> + + <enum name="Invalid Message Header" + code="8"/> + + <enum name="Invalid message format" + code="16"/> + + <enum name="Mandatory TLV missing" + code="17"/> + + <enum name="TLV Value Invalid" + code="18"/> + + <enum name="Unsupported Options" + code="19"/> + + <enum name="Timer expired without response" + code="32"/> + + <enum name="Requested Context Unavailable" + code="48"/> + + <enum name="Authorization Failure" + code="49"/> + + <enum name="Registration Failure" + code="50"/> + + <enum name="No Resources" + code="51"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="FA IP Address" + type="70" + decoder="WIMAXASNCP_TLV_IPV4_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="FA Relocation Indication" + type="71" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Success" + code="0"/> + + <enum name="Failure" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Full DCD Setting" + type="72" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Full UCD Setting" + type="73" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Global Service Class Change" + type="74" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="HA IP Address" + type="75" + decoder="WIMAXASNCP_TLV_IP_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="HO Confirm Type" + type="76" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Confirm" + code="0"/> + + <enum name="Unconfirm" + code="1"/> + + <enum name="Cancel" + code="2"/> + + <enum name="Reject" + code="3"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Home Address (HoA)" + type="77" + decoder="WIMAXASNCP_TLV_IPV4_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="HO Process Optimization" + type="78" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="HO Type" + type="79" + decoder="WIMAXASNCP_TLV_ENUM32"> + + <enum name="HHO" + code="0"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="IDLE Mode Info" + type="80" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="IDLE Mode Retain Info" + type="81" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="IP Destination Address and Mask" + type="82" + decoder="WIMAXASNCP_TLV_IP_ADDRESS_MASK_LIST"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="IP Remained Time" + type="83" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="IP Source Address and Mask" + type="84" + decoder="WIMAXASNCP_TLV_IP_ADDRESS_MASK_LIST"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="IP TOS/DSCP Range and Mask" + type="85" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Key Change Indicator" + type="86" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Success" + code="0"/> + + <enum name="Failure" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="L-BSID" + type="87" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Location Update Status" + type="88" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Refuse" + code="0"/> + + <enum name="Accept" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Location Update Success/Failure Indication" + type="89" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Success" + code="0"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="LU Result Indicator" + type="90" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Success" + code="0"/> + + <enum name="Failure" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Maximum Latency" + type="91" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Maximum Sustained Traffic Rate" + type="92" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Maximum Traffic Burst" + type="93" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Media Flow Type" + type="94" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Minimum Reserved Traffic Rate" + type="95" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MIP4 Info" + type="96" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MIP4 Security Info" + type="97" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MN-FA Key" + type="98" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MN-FA SPI" + type="99" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS Authorization Context" + type="100" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS FA Context" + type="101" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS ID" + type="102" + decoder="WIMAXASNCP_TLV_ETHER"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS Info" + type="103" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS Mobility Mode" + type="104" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS NAI" + type="105" + decoder="WIMAXASNCP_TLV_ASCII_STRING"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS Networking Context" + type="106" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS Security Context" + type="107" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="MS Security History" + type="108" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Network Exit Indicator" + type="109" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="MS Power Down indication" + code="0x00"/> + + <enum name="Radio link with MS is lost" + code="0x01"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Newer TEK Parameters" + type="110" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="NRT-VR Data Delivery Service" + type="111" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Older TEK Parameters" + type="112" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Old Anchor PCID" + type="113" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Packet Classification Rule / Media Flow Description" + type="114" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Paging Announce Timer" + type="115" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Paging Cause" + type="116" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="LCS" + code="1"/> + + <enum name="Incoming Data for Idle MS" + code="2"/> + + <enum name="Acknowledge Exiting Idle Mode" + code="3"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Paging Controller Identifier" + type="117" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Paging Cycle" + type="118" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Paging Information" + type="119" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Paging Offset" + type="120" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Paging Start/Stop" + type="121" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PC Relocation Indication" + type="122" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PGID - Paging Group ID" + type="123" + decoder="WIMAXASNCP_TLV_HEX16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PHSF" + type="124" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PHSI" + type="125" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PHSM" + type="126" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PHS Rule" + type="127" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PHS Rule Action" + type="128" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Add PHS Rule" + code="0"/> + + <enum name="Replace PHS Rule" + code="1"/> + + <enum name="Delete PHS Rule" + code="2"/> + + <enum name="Delete All PHS Rules" + code="3"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PHSS" + type="129" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PHSV" + type="130" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Verify" + code="0"/> + + <enum name="Don't verify" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PKM Context" + type="131" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="PKM Capabilities defined in the MTG Profile." + code="0"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PMIP4 Client Location" + type="132" + decoder="WIMAXASNCP_TLV_IPV4_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PMK SN" + type="133" + decoder="WIMAXASNCP_TLV_HEX8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PKM2" + type="134" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="EAP Transfer" + code="18"/> + + <enum name="Authenticated EAP Transfer" + code="19"/> + + <enum name="EAP Complete" + code="29"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PMK2 SN" + type="135" + decoder="WIMAXASNCP_TLV_HEX8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="PN Counter" + type="136" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Preamble Index/Sub-channel Index" + type="137" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Protocol" + type="138" + decoder="WIMAXASNCP_TLV_PROTOCOL_LIST"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Protocol Destination Port Range" + type="139" + decoder="WIMAXASNCP_TLV_PORT_RANGE_LIST"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Protocol Source Port Range" + type="140" + decoder="WIMAXASNCP_TLV_PORT_RANGE_LIST"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="QoS Parameters" + type="141" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Radio Resource Fluctuation" + type="142" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Reduced Resources Code" + type="143" + decoder="WIMAXASNCP_TLV_FLAG0"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="REG Context" + type="144" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="REG handshake related capabilities defined in the MTG Profile" + code="0"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Registration Type" + type="145" + decoder="WIMAXASNCP_TLV_ENUM32"> + + <enum name="Initial Network Entry" + code="0"/> + + <enum name="HO" + code="1"/> + + <enum name="In-Service Data Path Establishment" + code="2"/> + + <enum name="MS Network Exit" + code="3"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Relative Delay" + type="146" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Relocation Destination ID" + type="147" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Relocation Response" + type="148" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Relocation Success Indication" + type="149" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Request/Transmission Policy" + type="150" + decoder="WIMAXASNCP_TLV_BITFLAGS32"> + + <enum name="Service flow SHALL not use broadcast bandwidth request opportunities" + code="WIMAXASNCP_BIT32(0)"/> + + <enum name="Reserved" + code="WIMAXASNCP_BIT32(1)"/> + + <enum name="Service flow SHALL not piggyback requests with data" + code="WIMAXASNCP_BIT32(2)"/> + + <enum name="Service flow SHALL not fragment data" + code="WIMAXASNCP_BIT32(3)"/> + + <enum name="Service flow SHALL not suppress payload headers" + code="WIMAXASNCP_BIT32(4)"/> + + <enum name="Service flow SHALL not pack multiple SDUs (or fragments) into single MAC PDUs" + code="WIMAXASNCP_BIT32(5)"/> + + <enum name="Service flow SHALL not include CRC in the MAC PDU" + code="WIMAXASNCP_BIT32(6)"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Reservation Action" + type="151" + decoder="WIMAXASNCP_TLV_BITFLAGS16"> + + <enum name="Create service flow" + code="WIMAXASNCP_BIT16(15)"/> + + <enum name="Admit service flow" + code="WIMAXASNCP_BIT16(14)"/> + + <enum name="Activate service flow" + code="WIMAXASNCP_BIT16(13)"/> + + <enum name="Modify service flow" + code="WIMAXASNCP_BIT16(12)"/> + + <enum name="Delete service flow" + code="WIMAXASNCP_BIT16(11)"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Reservation Result" + type="152" + decoder="WIMAXASNCP_TLV_ENUM16"> + + <enum name="Successfully Created" + code="0x0000"/> + + <enum name="Request Denied - No resources" + code="0x0001"/> + + <enum name="Request Denied due to Policy" + code="0x0002"/> + + <enum name="Request Denied due to Requests for Other Flows Failed" + code="0x0003"/> + + <enum name="Request Failed (Unspecified reason)" + code="0x0004"/> + + <enum name="Request Denied due to MS reason" + code="0x0005"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Response Code" + type="153" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="not allowed - Paging Reference is zero" + code="1"/> + + <enum name="not allowed - no such SF" + code="2"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Result Code" + type="154" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Success" + code="0"/> + + <enum name="Failure" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="ROHC/ECRTP Context ID" + type="155" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Round Trip Delay" + type="156" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RRM Absolute Threshold Value J" + type="157" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RRM Averaging Time T" + type="158" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RRM BS Info" + type="159" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RRM BS-MS PHY Quality Info" + type="160" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RRM Relative Threshold RT" + type="161" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RRM Reporting Characteristics" + type="162" + decoder="WIMAXASNCP_TLV_BITFLAGS32"> + + <enum name="periodically as defined by reporting period P" + code="WIMAXASNCP_BIT32(0)"/> + + <enum name="regularly whenever resources have changed as defined by RT since the last measurement period" + code="WIMAXASNCP_BIT32(1)"/> + + <enum name="regularly whenever resources cross predefined total threshold(s) defined by reporting absolute threshold values J" + code="WIMAXASNCP_BIT32(2)"/> + + <enum name="DCD/UCD Configuration Change Count modification" + code="WIMAXASNCP_BIT32(3)"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RRM Reporting Period P" + type="163" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RRM Spare Capacity Report Type" + type="164" + decoder="WIMAXASNCP_TLV_HEX8"> + + <enum name="Type 1: Available radio resource indicator" + code="0"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RT-VR Data Delivery Service" + type="165" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="RxPN Counter" + type="166" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="R3 Operation Status" + type="167" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="R3 Release Reason" + type="168" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="MS power down" + code="0"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SAID" + type="169" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SA Descriptor" + type="170" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SA Index" + type="171" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SA Service Type" + type="172" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Unicast Service" + code="0"/> + + <enum name="Group Multicast Service" + code="1"/> + + <enum name="MBS Service" + code="2"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SA Type" + type="173" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Primary" + code="0"/> + + <enum name="Static" + code="1"/> + + <enum name="Dynamic" + code="2"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SBC Context" + type="174" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SDU BSN Map" + type="175" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SDU Info" + type="176" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SDU Size" + type="177" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SDU SN" + type="178" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Service Class Name" + type="179" + decoder="WIMAXASNCP_TLV_ASCII_STRING"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Service Level Prediction" + type="180" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Service Authorization Code" + type="181" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Serving/Target Indicator" + type="182" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Serving" + code="0"/> + + <enum name="Target" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SF Classification" + type="183" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="SF classification not supported" + code="0"/> + + <enum name="SF classification supported" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SFID" + type="184" + decoder="WIMAXASNCP_TLV_HEX32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="SF Info" + type="185" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Spare Capacity Indicator" + type="186" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="TEK" + type="187" + decoder="WIMAXASNCP_TLV_BYTES"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="TEK Lifetime" + type="188" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="TEK SN" + type="189" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Tolerated Jitter" + type="190" + decoder="WIMAXASNCP_TLV_DEC32"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Total Slots DL" + type="191" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Total Slots UL" + type="192" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Traffic Priority/QoS Priority" + type="193" + decoder="WIMAXASNCP_TLV_DEC8"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Tunnel Endpoint" + type="194" + decoder="WIMAXASNCP_TLV_IP_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="UCD Setting" + type="195" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="UGS Data Delivery Service" + type="196" + decoder="WIMAXASNCP_TLV_COMPOUND"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="UL PHY Quality Info" + type="197" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="UL PHY Service Level" + type="198" + decoder="WIMAXASNCP_TLV_TBD"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Unsolicited Grant Interval" + type="199" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Unsolicited Polling Interval" + type="200" + decoder="WIMAXASNCP_TLV_DEC16"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="VAAA IP Address" + type="201" + decoder="WIMAXASNCP_TLV_IP_ADDRESS"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="VAAA Realm" + type="202" + decoder="WIMAXASNCP_TLV_ASCII_STRING"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Control Plane Indicator" + type="1136" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Success" + code="0"/> + + <enum name="Failure" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="IM Auth Indication" + type="1228" + decoder="WIMAXASNCP_TLV_ENUM8"> + + <enum name="Success" + code="0"/> + + <enum name="Failure" + code="1"/> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Source Identifier" + type="0xff01" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Destination Identifier" + type="0xff02" + decoder="WIMAXASNCP_TLV_ID"> + </tlv> + + <!-- ****************************************************************** --> + + <tlv name="Vendor Specific" + type="0xffff" + decoder="WIMAXASNCP_TLV_VENDOR_SPECIFIC"> + </tlv> + +</dictionary> diff --git a/plugins/wimaxasncp/packet-wimaxasncp.c b/plugins/wimaxasncp/packet-wimaxasncp.c index 9bbcc95a0c..f3e874c39c 100644 --- a/plugins/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/wimaxasncp/packet-wimaxasncp.c @@ -43,9 +43,12 @@ #include <epan/addr_resolv.h> #include <epan/ipproto.h> #include <epan/expert.h> +#include <epan/filesystem.h> +#include <epan/report_err.h> /* TODO: delete?. */ #include "packet-wimaxasncp.h" +#include "wimaxasncp_dict.h" /* Forward declaration we need below */ void proto_reg_handoff_wimaxasncp(void); @@ -128,17 +131,7 @@ static gint ett_wimaxasncp_tlv_vendor_specific_information_field = -1; #define WIMAXASNCP_FLAGS_T WIMAXASNCP_BIT8(6) #define WIMAXASNCP_FLAGS_R WIMAXASNCP_BIT8(7) - -/* ------------------------------------------------------------------------- */ -/* generic - */ - -static const value_string wimaxasncp_tlv_success_failure_vals[] = -{ - { 0, "Success"}, - { 1, "Failure"}, - { 0, NULL} -}; +static wimaxasncp_dict_t *wimaxasncp_dict = NULL; /* ------------------------------------------------------------------------- */ @@ -391,1609 +384,31 @@ static const wimaxasncp_func_msg_t wimaxasncp_func_to_msg_vals_map[] = { WIMAXASNCP_FT_SESSION, wimaxasncp_session_msg_vals } }; -/* ========================================================================= - * TLV related structures. - * Note: The value_string structures and TLV types are kept in the same - * order as found in the spec. - * ========================================================================= */ - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_accept_reject_indicator_vals[]= -{ - { 0x00, "accept"}, - { 0x01, "reject"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_action_code_vals[] = -{ - { 0x0000, "Deregister MS"}, - { 0x0001, "Suspend all MS traffic"}, - { 0x0002, "Suspend user traffic"}, - { 0x0003, "Resume traffic"}, - { 0x0004, "MS terminate current normal operations with BS"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const -value_string wimaxasncp_tlv_anchor_pc_relocation_request_response_vals[] = -{ - { 0xff, "accept"}, - { 0x00, "refuse"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_auth_ind_vals[]= -{ - { 0, "Initial authentication"}, - { 1, "Re-authentication"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_authorization_policy_vals[] = -{ - { WIMAXASNCP_BIT16(0), "RSA authorization"}, - { WIMAXASNCP_BIT16(1), "EAP authorization"}, - { WIMAXASNCP_BIT16(2), "Authenticated-EAP authorization"}, - { WIMAXASNCP_BIT16(3), "HMAC supported"}, - { WIMAXASNCP_BIT16(4), "CMAC supported"}, - { WIMAXASNCP_BIT16(5), "64-bit Short-HMAC"}, - { WIMAXASNCP_BIT16(6), "80-bit Short-HMAC"}, - { WIMAXASNCP_BIT16(7), "96-bit Short-HMAC"}, - { WIMAXASNCP_BIT16(8), "Reauthentication Policy (TBD)"}, - { WIMAXASNCP_BIT16(9), "Reauthentication Policy (TBD)"}, - { WIMAXASNCP_BIT16(10), "Reauthentication Policy (TBD)"}, - { WIMAXASNCP_BIT16(11), "Reauthentication Policy (TBD)"}, - { WIMAXASNCP_BIT16(12), "Reauthentication Policy (TBD)"}, - { WIMAXASNCP_BIT16(13), "Reauthentication Policy (TBD)"}, - { WIMAXASNCP_BIT16(14), "Reauthentication Policy (TBD)"}, - { WIMAXASNCP_BIT16(15), "Reauthentication Policy (TBD)"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_classifier_action_vals[] = -{ - { 0, "Add Classifier"}, - { 1, "Replace Classifier"}, - { 2, "Delete Classifier"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_classifier_type_vals[] = -{ - { 1, "IP TOS/DSCP Range and Mask"}, - { 2, "Protocol"}, - { 3, "IP Source Address and Mask"}, - { 4, "IP Destination Address and Mask"}, - { 5, "Protocol Source Port Range"}, - { 6, "Protocol Destination Port Range"}, - { 7, "IEEE 802.3/Ethernet Destination MAC address"}, - { 8, "IEEE 802.3/Ethernet Source MAC address"}, - { 9, "Ethertype/IEEE 802.2 SAP"}, - { 10, "IEEE 802.1D User_Priority"}, - { 11, "IEEE 802.1Q VLAN_ID"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_combined_resources_required_vals[] = -{ - { 0x0000, "Not combined"}, - { 0x0001, "Combined"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_context_purpose_indicator_vals[] = -{ - { WIMAXASNCP_BIT32(0), "MS AK Context"}, - { WIMAXASNCP_BIT32(1), "MS Network Context"}, - { WIMAXASNCP_BIT32(2), "MS MAC Context"}, - { WIMAXASNCP_BIT32(3), "Service Authorization Context"}, - { WIMAXASNCP_BIT32(4), "FA Context"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_cryptographic_suite_vals[] = -{ - { 0x000000, "No data encryption, no data authentication & 3-DES, 128"}, - { 0x010001, "CBC-Mode 56-bit DES, no data authentication & 3-DES, 128"}, - { 0x000002, "No data encryption, no data authentication & RSA, 1024"}, - { 0x010002, "CBC-Mode 56-bit DES, no data authentication & RSA, 1024"}, - { 0x020103, "CCM-Mode 128-bit AES, CCM-Mode, 128-bit, ECB mode AES" - " with 128-bit key"}, - { 0x020104, "CCM-Mode 128bits AES, CCM-Mode, AES Key Wrap with 128-bit" - " key"}, - { 0x030003, "CBC-Mode 128-bit AES, no data authentication, ECB mode AES" - " with 128-bit key"}, - { 0x800003, "MBS CTR Mode 128 bits AES, no data authentication, AES ECB" - " mode with 128-bit key"}, - { 0x800004, "MBS CTR mode 128 bits AES, no data authentication, AES Key" - " Wrap with 128-bit key"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_cs_type_vals[]= -{ - { 1, "Packet, IPv4"}, - { 2, "Packet, IPv6"}, - { 3, "Packet, 802.3"}, - { 4, "Packet, 802.1Q"}, - { 5, "Packet, IPv4over802.3"}, - { 6, "Packet, IPv6over802.3"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_data_integrity_vals[] = -{ - { 0x0, "No recommendation"}, - { 0x1, "Data integrity requested"}, - { 0x2, "Data delay jitter sensitive"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_data_path_encapsulation_type_vals[] = -{ - { 1, "GRE"}, - { 2, "IP-in-IP"}, - { 3, "VLAN"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static -const value_string wimaxasncp_tlv_data_path_establishment_option_vals[] = -{ - { 0, "Do not (Pre-) Establish DP"}, - { 1, "(Pre-) Establish DP"}, - { 0, NULL } -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_data_path_integrity_mechanism_vals[]= -{ - /* No values defined yet. */ - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_data_path_type_vals[]= -{ - { 0, "Type1"}, - { 1, "Type2"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static -const value_string wimaxasncp_tlv_device_authentication_indicator_vals[]= -{ - { 0, "Reserved"}, - { 1, "Certificate-based device authentication has been successfully" - " performed"}, - { 2, "Device authentication has been successfully performed."}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_direction_vals[] = -{ - { 0x001, "For Uplink"}, - { 0x002, "For Downlink"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static -const value_string wimaxasncp_tlv_exit_idle_mode_operation_indication_vals[]= -{ - { 0, "No"}, - { 1, "Yes"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_failure_indication_vals[]= -{ - { 0, "Unspecified Error"}, - { 1, "Incompatible Version Number"}, - { 2, "Invalid Function Type"}, - { 3, "Invalid Message Type"}, - { 4, "Unknown MSID"}, - { 5, "Transaction Failure"}, - { 6, "Unknown Source Identifier"}, - { 7, "Unknown Destination Identifier"}, - { 8, "Invalid Message Header"}, - { 16, "Invalid message format"}, - { 17, "Mandatory TLV missing"}, - { 18, "TLV Value Invalid"}, - { 19, "Unsupported Options"}, - { 32, "Timer expired without response"}, - { 48, "Requested Context Unavailable"}, - { 49, "Authorization Failure"}, - { 50, "Registration Failure"}, - { 51, "No Resources"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_ho_confirm_type_vals[] = -{ - { 0, "Confirm"}, - { 1, "Unconfirm"}, - { 2, "Cancel"}, - { 3, "Reject"}, - { 0, NULL} -}; - -static const value_string wimaxasncp_tlv_ho_type_vals[] = -{ - { 0, "HHO"}, - { 0, NULL } -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_location_update_status_vals[]= -{ - { 0, "Refuse"}, - { 1, "Accept"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const -value_string wimaxasncp_tlv_location_update_success_failure_indication_vals[]= -{ - { 0, "Success"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_ms_mobility_mode_vals[]= -{ - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_network_exit_indicator_vals[]= -{ - { 0x00, "MS Power Down indication"}, - { 0x01, "Radio link with MS is lost"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_paging_cause_vals[]= -{ - { 1, "LCS"}, - { 2, "Incoming Data for Idle MS"}, - { 3, "Acknowledge Exiting Idle Mode"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_phs_rule_action_vals[]= -{ - { 0, "Add PHS Rule"}, - { 1, "Replace PHS Rule"}, - { 2, "Delete PHS Rule"}, - { 3, "Delete All PHS Rules"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_phsv_vals[]= -{ - { 0, "Verify"}, - { 1, "Don't verify"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_pkm_context_vals[]= -{ - { 0, "PKM Capabilities defined in the MTG Profile."}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_pkm2_vals[]= -{ - { 18, "EAP Transfer"}, - { 19, "Authenticated EAP Transfer"}, - { 29, "EAP Complete"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_reg_context_vals[] = -{ - { 0, "REG handshake related capabilities defined in the MTG Profile"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_registration_type_vals[] = -{ - { 0, "Initial Network Entry"}, - { 1, "HO"}, - { 2, "In-Service Data Path Establishment"}, - { 3, "MS Network Exit"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_reservation_action_vals[] = -{ - { WIMAXASNCP_BIT16(15), "Create service flow"}, - { WIMAXASNCP_BIT16(14), "Admit service flow"}, - { WIMAXASNCP_BIT16(13), "Activate service flow"}, - { WIMAXASNCP_BIT16(12), "Modify service flow"}, - { WIMAXASNCP_BIT16(11), "Delete service flow"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_reservation_result_vals[] = -{ - { 0x0000, "Successfully Created"}, - { 0x0001, "Request Denied - No resources"}, - { 0x0002, "Request Denied due to Policy"}, - { 0x0003, "Request Denied due to Requests for Other Flows Failed"}, - { 0x0004, "Request Failed (Unspecified reason)"}, - { 0x0005, "Request Denied due to MS reason"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_request_transmission_policy_vals[]= -{ - { WIMAXASNCP_BIT32(0), "Service flow SHALL not use broadcast bandwidth" - " request opportunities"}, - { WIMAXASNCP_BIT32(1), "Reserved"}, - { WIMAXASNCP_BIT32(2), "Service flow SHALL not piggyback requests" - " with data"}, - { WIMAXASNCP_BIT32(3), "Service flow SHALL not fragment data"}, - { WIMAXASNCP_BIT32(4), "Service flow SHALL not suppress payload headers"}, - { WIMAXASNCP_BIT32(5), "Service flow SHALL not pack multiple SDUs" - " (or fragments) into single MAC PDUs"}, - { WIMAXASNCP_BIT32(6), "Service flow SHALL not include CRC in the" - " MAC PDU"}, - {0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_response_code_vals[]= -{ - { 1, "not allowed - Paging Reference is zero"}, - { 2, "not allowed - no such SF"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_rrm_reporting_characteristics_vals[]= -{ - { WIMAXASNCP_BIT32(0), "periodically as defined by reporting period P"}, - { WIMAXASNCP_BIT32(1), "regularly whenever resources have changed as" - " defined by RT since the last measurement" - " period"}, - { WIMAXASNCP_BIT32(2), "regularly whenever resources cross predefined" - " total threshold(s) defined by reporting" - " absolute threshold values J"}, - { WIMAXASNCP_BIT32(3), "DCD/UCD Configuration Change Count modification"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_rrm_spare_capacity_report_type_vals[]= -{ - { 0, "Type 1: Available radio resource indicator"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_r3_operation_status_vals[]= -{ - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_r3_release_reason_vals[]= -{ - { 0, "MS power down"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_sa_service_type_vals[]= -{ - { 0, "Unicast Service"}, - { 1, "Group Multicast Service"}, - { 2, "MBS Service"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_sa_type_vals[]= -{ - { 0, "Primary"}, - { 1, "Static"}, - { 2, "Dynamic"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_serving_target_indicator_vals[] = -{ - { 0, "Serving"}, - { 1, "Target"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- */ - -static const value_string wimaxasncp_tlv_sf_classification_vals[]= -{ - { 0, "SF classification not supported"}, - { 1, "SF classification supported"}, - { 0, NULL} -}; - -/* ------------------------------------------------------------------------- - * decode types - * ------------------------------------------------------------------------- */ - -enum -{ - WIMAXASNCP_TLV_TBD, - WIMAXASNCP_TLV_COMPOUND, - WIMAXASNCP_TLV_BYTES, - WIMAXASNCP_TLV_ENUM8, - WIMAXASNCP_TLV_ENUM16, - WIMAXASNCP_TLV_ENUM32, - WIMAXASNCP_TLV_ETHER, - WIMAXASNCP_TLV_ASCII_STRING, - WIMAXASNCP_TLV_FLAG0, - WIMAXASNCP_TLV_BITFLAGS16, - WIMAXASNCP_TLV_BITFLAGS32, - WIMAXASNCP_TLV_ID, - WIMAXASNCP_TLV_HEX8, - WIMAXASNCP_TLV_HEX16, - WIMAXASNCP_TLV_HEX32, - WIMAXASNCP_TLV_DEC8, - WIMAXASNCP_TLV_DEC16, - WIMAXASNCP_TLV_DEC32, - WIMAXASNCP_TLV_IP_ADDRESS, /* Note: IPv4 or IPv6, determined by length */ - WIMAXASNCP_TLV_IPV4_ADDRESS, - WIMAXASNCP_TLV_PROTOCOL_LIST, - WIMAXASNCP_TLV_PORT_RANGE_LIST, - WIMAXASNCP_TLV_IP_ADDRESS_MASK_LIST, - WIMAXASNCP_TLV_VENDOR_SPECIFIC -}; - -/* ------------------------------------------------------------------------- - * TLV database - * ------------------------------------------------------------------------- */ - -typedef struct { - guint16 type; - const gchar *name; - gint decode_type; - const value_string *vals; -} wimaxasncp_tlv_info_t; - -/* ------------------------------------------------------------------------- */ - -static const wimaxasncp_tlv_info_t wimaxasncp_tlv_db[] = -{ - { - 1, "Accept/Reject Indicator", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_accept_reject_indicator_vals - }, - { - 2, "Accounting Extension", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 3, "Action Code", - WIMAXASNCP_TLV_ENUM16, - wimaxasncp_tlv_action_code_vals - }, - { - 4, "Action Time", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 5, "AK", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 6, "AK Context", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 7, "AK ID", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 8, "AK Lifetime", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 9, "AK SN", - WIMAXASNCP_TLV_HEX8, - NULL - }, - { - 10, "Anchor ASN GW ID / Anchor DPF Identifier", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 11, "Anchor MM Context", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 12, "Anchor PCID - Anchor Paging Controller ID", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 13, "Anchor PC Relocation Destination", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 14, "Anchor PC Relocation Request Response", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_anchor_pc_relocation_request_response_vals - }, - { - 15, "Associated PHSI", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 16, "Anchor Authenticator ID", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 17, "Authentication Complete", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 18, "Authentication Result", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_success_failure_vals - }, - { - 19, "Authenticator Identifier", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 20, "Auth-IND", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_auth_ind_vals - }, - { - 21, "Authorization Policy", - WIMAXASNCP_TLV_BITFLAGS16, - wimaxasncp_tlv_authorization_policy_vals - }, - { - 22, "Available Radio Resource DL", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 23, "Available Radio Resource UL", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 24, "BE Data Delivery Service", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 25, "BS ID", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 26, "BS Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 27, "BS-originated EAP-Start Flag", - WIMAXASNCP_TLV_FLAG0, - NULL - }, - { - 28, "Care-Of Address (CoA)", - WIMAXASNCP_TLV_IPV4_ADDRESS, - NULL - }, - { - 29, "CID", - WIMAXASNCP_TLV_HEX16, - NULL - }, - { - 30, "Classifier", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 31, "Classifier Action", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_classifier_action_vals - }, - { - 32, "Classifier Rule Priority", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 33, "Classifier Type", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_classifier_type_vals - }, - { - 34, "CMAC_KEY_COUNT", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 35, "Combined Resources Required", - WIMAXASNCP_TLV_ENUM16, - wimaxasncp_tlv_combined_resources_required_vals - }, - { - 36, "Context Purpose Indicator", - WIMAXASNCP_TLV_ENUM32, - wimaxasncp_tlv_context_purpose_indicator_vals - }, - { - 37, "Correlation ID", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 38, "Cryptographic Suite", - WIMAXASNCP_TLV_ENUM32, - wimaxasncp_tlv_cryptographic_suite_vals - }, - { - 39, "CS Type", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_cs_type_vals - }, - { - 40, "Data Integrity", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_data_integrity_vals - }, - { - 41, "Data Integrity Info", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 42, "Data Path Encapsulation Type", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_data_path_encapsulation_type_vals - }, - { - 43, "Data Path Establishment Option", - WIMAXASNCP_TLV_HEX8, - wimaxasncp_tlv_data_path_establishment_option_vals - }, - { - 44, "Data Path ID", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 45, "Data Path Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 46, "Data Path Integrity Mechanism", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_data_path_integrity_mechanism_vals - }, - { - 47, "Data Path Type", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_data_path_type_vals - }, - { - 48, "DCD/UCD Configuration Change Count", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 49, "DCD Setting", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 50, "Device Authentication Indicator", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_device_authentication_indicator_vals - }, - { - 51, "DHCP Key", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 52, "DHCP Key ID", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 53, "DHCP Key Lifetime", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 54, "DHCP Proxy Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 55, "DHCP Relay Address", - WIMAXASNCP_TLV_IPV4_ADDRESS, - NULL - }, - { - 56, "DHCP Relay Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 57, "DHCP Server Address", - WIMAXASNCP_TLV_IPV4_ADDRESS, - NULL - }, - { - 58, "DHCP Server List", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 59, "Direction", - WIMAXASNCP_TLV_ENUM16, - wimaxasncp_tlv_direction_vals - }, - { - 60, "DL PHY Quality Info", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 61, "DL PHY Service Level", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 62, "EAP Payload", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 63, "EIK", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 64, "ERT-VR Data Delivery Service", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 65, "Exit IDLE Mode Operation Indication", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_exit_idle_mode_operation_indication_vals - }, - { - 66, "FA-HA Key", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 67, "FA-HA Key Lifetime", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 68, "FA-HA Key SPI", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 69, "Failure Indication", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_failure_indication_vals - }, - { - 70, "FA IP Address", - WIMAXASNCP_TLV_IPV4_ADDRESS, - NULL - }, - { - 71, "FA Relocation Indication", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_success_failure_vals - }, - { - 72, "Full DCD Setting", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 73, "Full UCD Setting", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 74, "Global Service Class Change", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 75, "HA IP Address", - WIMAXASNCP_TLV_IP_ADDRESS, - NULL - }, - { - 76, "HO Confirm Type", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_ho_confirm_type_vals - }, - { - 77, "Home Address (HoA)", - WIMAXASNCP_TLV_IPV4_ADDRESS, - NULL - }, - { - 78, "HO Process Optimization", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 79, "HO Type", - WIMAXASNCP_TLV_ENUM32, - wimaxasncp_tlv_ho_type_vals - }, - { - 80, "IDLE Mode Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 81, "IDLE Mode Retain Info", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 82, "IP Destination Address and Mask", - WIMAXASNCP_TLV_IP_ADDRESS_MASK_LIST, - NULL - }, - { - 83, "IP Remained Time", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 84, "IP Source Address and Mask", - WIMAXASNCP_TLV_IP_ADDRESS_MASK_LIST, - NULL - }, - { - 85, "IP TOS/DSCP Range and Mask", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 86, "Key Change Indicator", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_success_failure_vals - }, - { - 87, "L-BSID", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 88, "Location Update Status", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_location_update_status_vals - }, - { - 89, "Location Update Success/Failure Indication", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_location_update_success_failure_indication_vals - }, - { - 90, "LU Result Indicator", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_success_failure_vals - }, - { - 91, "Maximum Latency", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 92, "Maximum Sustained Traffic Rate", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 93, "Maximum Traffic Burst", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 94, "Media Flow Type", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 95, "Minimum Reserved Traffic Rate", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 96, "MIP4 Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 97, "MIP4 Security Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 98, "MN-FA Key", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 99, "MN-FA SPI", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 100, "MS Authorization Context", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 101, "MS FA Context", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 102, "MS ID", - WIMAXASNCP_TLV_ETHER, - NULL - }, - { - 103, "MS Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 104, "MS Mobility Mode", - WIMAXASNCP_TLV_TBD, - wimaxasncp_tlv_ms_mobility_mode_vals - }, - { - 105, "MS NAI", - WIMAXASNCP_TLV_ASCII_STRING, - NULL - }, - { - 106, "MS Networking Context", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 107, "MS Security Context", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 108, "MS Security History", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 109, "Network Exit Indicator", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_network_exit_indicator_vals - }, - { - 110, "Newer TEK Parameters", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 111, "NRT-VR Data Delivery Service", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 112, "Older TEK Parameters", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 113, "Old Anchor PCID", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 114, "Packet Classification Rule / Media Flow Description", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 115, "Paging Announce Timer", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 116, "Paging Cause", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_paging_cause_vals - }, - { - 117, "Paging Controller Identifier", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 118, "Paging Cycle", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 119, "Paging Information", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 120, "Paging Offset", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 121, "Paging Start/Stop", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 122, "PC Relocation Indication", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 123, "PGID - Paging Group ID", - WIMAXASNCP_TLV_HEX16, - NULL - }, - { - 124, "PHSF", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 125, "PHSI", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 126, "PHSM", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 127, "PHS Rule", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 128, "PHS Rule Action", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_phs_rule_action_vals - }, - { - 129, "PHSS", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 130, "PHSV", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_phsv_vals - }, - { - 131, "PKM Context", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_pkm_context_vals - }, - { - 132, "PMIP4 Client Location", - WIMAXASNCP_TLV_IPV4_ADDRESS, - NULL - }, - { - 133, "PMK SN", - WIMAXASNCP_TLV_HEX8, - NULL - }, - { - 134, "PKM2", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_pkm2_vals - }, - { - 135, "PMK2 SN", - WIMAXASNCP_TLV_HEX8, - NULL - }, - { - 136, "PN Counter", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 137, "Preamble Index/Sub-channel Index", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 138, "Protocol", - WIMAXASNCP_TLV_PROTOCOL_LIST, - NULL - }, - { - 139, "Protocol Destination Port Range", - WIMAXASNCP_TLV_PORT_RANGE_LIST, - NULL - }, - { - 140, "Protocol Source Port Range", - WIMAXASNCP_TLV_PORT_RANGE_LIST, - NULL - }, - { - 141, "QoS Parameters", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 142, "Radio Resource Fluctuation", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 143, "Reduced Resources Code", - WIMAXASNCP_TLV_FLAG0, - NULL - }, - { - 144, "REG Context", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_reg_context_vals - }, - { - 145, "Registration Type", - WIMAXASNCP_TLV_ENUM32, - wimaxasncp_tlv_registration_type_vals - }, - { - 146, "Relative Delay", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 147, "Relocation Destination ID", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 148, "Relocation Response", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 149, "Relocation Success Indication", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 150, "Request/Transmission Policy", - WIMAXASNCP_TLV_BITFLAGS32, - wimaxasncp_tlv_request_transmission_policy_vals - }, - { - 151, "Reservation Action", - WIMAXASNCP_TLV_BITFLAGS16, - wimaxasncp_tlv_reservation_action_vals - }, - { - 152, "Reservation Result", - WIMAXASNCP_TLV_ENUM16, - wimaxasncp_tlv_reservation_result_vals - }, - { - 153, "Response Code", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_response_code_vals - }, - { - 154, "Result Code", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_success_failure_vals - }, - { - 155, "ROHC/ECRTP Context ID", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 156, "Round Trip Delay", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 157, "RRM Absolute Threshold Value J", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 158, "RRM Averaging Time T", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 159, "RRM BS Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 160, "RRM BS-MS PHY Quality Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 161, "RRM Relative Threshold RT", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 162, "RRM Reporting Characteristics", - WIMAXASNCP_TLV_BITFLAGS32, - wimaxasncp_tlv_rrm_reporting_characteristics_vals - }, - { - 163, "RRM Reporting Period P", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 164, "RRM Spare Capacity Report Type", - WIMAXASNCP_TLV_HEX8, - wimaxasncp_tlv_rrm_spare_capacity_report_type_vals - }, - { - 165, "RT-VR Data Delivery Service", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 166, "RxPN Counter", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 167, "R3 Operation Status", - WIMAXASNCP_TLV_TBD, - wimaxasncp_tlv_r3_operation_status_vals - }, - { - 168, "R3 Release Reason", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_r3_release_reason_vals - }, - { - 169, "SAID", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 170, "SA Descriptor", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 171, "SA Index", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 172, "SA Service Type", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_sa_service_type_vals - }, - { - 173, "SA Type", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_sa_type_vals - }, - { - 174, "SBC Context", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 175, "SDU BSN Map", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 176, "SDU Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 177, "SDU Size", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 178, "SDU SN", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 179, "Service Class Name", - WIMAXASNCP_TLV_ASCII_STRING, - NULL - }, - { - 180, "Service Level Prediction", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 181, "Service Authorization Code", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 182, "Serving/Target Indicator", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_serving_target_indicator_vals - }, - { - 183, "SF Classification", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_sf_classification_vals - }, - { - 184, "SFID", - WIMAXASNCP_TLV_HEX32, - NULL - }, - { - 185, "SF Info", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 186, "Spare Capacity Indicator", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 187, "TEK", - WIMAXASNCP_TLV_BYTES, - NULL - }, - { - 188, "TEK Lifetime", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 189, "TEK SN", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 190, "Tolerated Jitter", - WIMAXASNCP_TLV_DEC32, - NULL - }, - { - 191, "Total Slots DL", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 192, "Total Slots UL", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 193, "Traffic Priority/QoS Priority", - WIMAXASNCP_TLV_DEC8, - NULL - }, - { - 194, "Tunnel Endpoint", - WIMAXASNCP_TLV_IP_ADDRESS, - NULL - }, - { - 195, "UCD Setting", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 196, "UGS Data Delivery Service", - WIMAXASNCP_TLV_COMPOUND, - NULL - }, - { - 197, "UL PHY Quality Info", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 198, "UL PHY Service Level", - WIMAXASNCP_TLV_TBD, - NULL - }, - { - 199, "Unsolicited Grant Interval", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 200, "Unsolicited Polling Interval", - WIMAXASNCP_TLV_DEC16, - NULL - }, - { - 201, "VAAA IP Address", - WIMAXASNCP_TLV_IP_ADDRESS, - NULL - }, - { - 202, "VAAA Realm", - WIMAXASNCP_TLV_ASCII_STRING, - NULL - }, - { - 1136, "Control Plane Indicator", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_success_failure_vals - }, - { - 1228, "IM Auth Indication", - WIMAXASNCP_TLV_ENUM8, - wimaxasncp_tlv_success_failure_vals - }, - { - 0xff01, "Source Identifier", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 0xff02, "Destination Identifier", - WIMAXASNCP_TLV_ID, - NULL - }, - { - 0xffff, "Vendor Specific", - WIMAXASNCP_TLV_VENDOR_SPECIFIC, - NULL - } -}; - /* ========================================================================= */ -static const wimaxasncp_tlv_info_t *wimaxasncp_get_tlv_info( +static const wimaxasncp_dict_tlv_t *wimaxasncp_get_tlv_info( guint16 type) { - static wimaxasncp_tlv_info_t not_found = + static wimaxasncp_dict_tlv_t not_found = { - 0, "Unknown", + 0, + "Unknown", + NULL, WIMAXASNCP_TLV_BYTES, + NULL, NULL }; - gsize i; - for (i = 0; i < array_length(wimaxasncp_tlv_db); ++i) + if (wimaxasncp_dict) { - if (wimaxasncp_tlv_db[i].type == type) + wimaxasncp_dict_tlv_t *tlv; + + for (tlv = wimaxasncp_dict->tlvs; tlv; tlv = tlv->next) { - return &wimaxasncp_tlv_db[i]; + if (tlv->type == type) + { + return tlv; + } } } @@ -2008,16 +423,16 @@ static const wimaxasncp_tlv_info_t *wimaxasncp_get_tlv_info( /* ========================================================================= */ static const gchar *wimaxasncp_get_enum_name( - const wimaxasncp_tlv_info_t *tlv_info, - guint32 value) + const wimaxasncp_dict_tlv_t *tlv_info, + guint32 code) { + wimaxasncp_dict_enum_t *e; - if (tlv_info->vals != NULL) + for (e = tlv_info->enums; e; e = e->next) { - const gchar *name = match_strval(value, tlv_info->vals); - if (name != NULL) + if (e->code == code) { - return name; + return e->name; } } @@ -2072,7 +487,7 @@ static void wimaxasncp_dissect_tlv_value( packet_info *pinfo _U_, proto_tree *tree, proto_item *tlv_item, - const wimaxasncp_tlv_info_t *tlv_info) + const wimaxasncp_dict_tlv_t *tlv_info) { guint offset = 0; guint length; @@ -2080,7 +495,7 @@ static void wimaxasncp_dissect_tlv_value( length = tvb_reported_length(tvb); - switch(tlv_info->decode_type) + switch(tlv_info->decoder) { case WIMAXASNCP_TLV_ENUM8: { @@ -2090,7 +505,7 @@ static void wimaxasncp_dissect_tlv_value( break; } - if (tlv_info->vals == NULL) + if (tlv_info->enums == NULL) { if (debug_enabled) { @@ -2125,7 +540,7 @@ static void wimaxasncp_dissect_tlv_value( break; } - if (tlv_info->vals == NULL) + if (tlv_info->enums == NULL) { if (debug_enabled) { @@ -2160,7 +575,7 @@ static void wimaxasncp_dissect_tlv_value( break; } - if (tlv_info->vals == NULL) + if (tlv_info->enums == NULL) { if (debug_enabled) { @@ -2225,7 +640,8 @@ static void wimaxasncp_dissect_tlv_value( tvb, offset, length, p); proto_item_append_text( - tlv_item, " - %s", tvb_get_string(tvb, offset, length)); + tlv_item, " - %s", + tvb_get_ephemeral_string(tvb, offset, length)); } return; @@ -2248,7 +664,7 @@ static void wimaxasncp_dissect_tlv_value( break; } - if (tlv_info->vals == NULL) + if (tlv_info->enums == NULL) { /* enum values missing */ } @@ -2303,7 +719,7 @@ static void wimaxasncp_dissect_tlv_value( break; } - if (tlv_info->vals == NULL) + if (tlv_info->enums == NULL) { /* enum values missing */ } @@ -2955,7 +1371,7 @@ static void wimaxasncp_dissect_tlv_value( if (debug_enabled) { g_print( - "fix-me: unknown decode_type: %d\n", tlv_info->decode_type); + "fix-me: unknown decoder: %d\n", tlv_info->decoder); } break; } @@ -2984,7 +1400,7 @@ static guint dissect_wimaxasncp_tlvs( { proto_tree *tlv_tree = NULL; proto_item *tlv_item = NULL; - const wimaxasncp_tlv_info_t *tlv_info; + const wimaxasncp_dict_tlv_t *tlv_info; guint16 type; guint16 length; @@ -3026,9 +1442,9 @@ static guint dissect_wimaxasncp_tlvs( } /* Indicate if a compound tlv */ - if (tlv_info->decode_type == WIMAXASNCP_TLV_COMPOUND) + if (tlv_info->decoder == WIMAXASNCP_TLV_COMPOUND) { - proto_item_append_text(tlv_item, "[Compound]"); + proto_item_append_text(tlv_item, " [Compound]"); } /* Create TLV subtree */ @@ -3063,7 +1479,7 @@ static guint dissect_wimaxasncp_tlvs( * -------------------------------------------------------------------- */ - if (tlv_info->decode_type == WIMAXASNCP_TLV_COMPOUND) + if (tlv_info->decoder == WIMAXASNCP_TLV_COMPOUND) { if (length == 0) { @@ -3563,11 +1979,16 @@ void proto_register_wimaxasncp(void) { module_t *wimaxasncp_module; + gboolean debug_parser; + gboolean dump_dict; + gchar *dir; + gchar* dict_error; + + /* ------------------------------------------------------------------------ + * List of header fields + * ------------------------------------------------------------------------ + */ - /* -------------------------------------------------------------------- - * List of header fields - * -------------------------------------------------------------------- - */ static hf_register_info hf[] = { { &hf_wimaxasncp_version, /* ID */ @@ -4169,7 +2590,11 @@ proto_register_wimaxasncp(void) } }; - /* Protocol subtree array */ + /* ------------------------------------------------------------------------ + * Protocol subtree array + * ------------------------------------------------------------------------ + */ + static gint *ett[] = { &ett_wimaxasncp, &ett_wimaxasncp_flags, @@ -4183,6 +2608,37 @@ proto_register_wimaxasncp(void) &ett_wimaxasncp_tlv_vendor_specific_information_field }; + /* ------------------------------------------------------------------------ + * load the XML dictionary + * ------------------------------------------------------------------------ + */ + + debug_parser = getenv("WIRESHARK_DEBUG_WIMAXASNCP_DICT_PARSER") != NULL; + dump_dict = getenv("WIRESHARK_DUMP_WIMAXASNCP_DICT") != NULL; + + dir = ep_strdup_printf( + "%s" G_DIR_SEPARATOR_S "wimaxasncp", + get_datafile_dir()); + + wimaxasncp_dict = + wimaxasncp_dict_scan(dir, "dictionary.xml", debug_parser, &dict_error); + + if (dict_error) + { + report_failure("wimaxasncp - %s", dict_error); + g_free(dict_error); + } + + if (wimaxasncp_dict && dump_dict) + { + wimaxasncp_dict_print(stdout, wimaxasncp_dict); + } + + /* ------------------------------------------------------------------------ + * complete registration + * ------------------------------------------------------------------------ + */ + /* Register the protocol name and description */ proto_wimaxasncp = proto_register_protocol( "WiMAX ASN Control Plane Protocol", diff --git a/plugins/wimaxasncp/wimaxasncp_dict.l b/plugins/wimaxasncp/wimaxasncp_dict.l new file mode 100644 index 0000000000..8b08d5b54b --- /dev/null +++ b/plugins/wimaxasncp/wimaxasncp_dict.l @@ -0,0 +1,755 @@ +/* + * We want to stop processing when we get to the end of the input. + */ +%option noyywrap + +/* + * We don't use unput, so don't generate code for it. + */ +%option nounput + +/* + * We don't read from the terminal. + */ +%option never-interactive + +/* + * The language we're scanning is case-insensitive. + */ +%option caseless + +/* + * We use start condition stacks. + */ +%option stack + +/* + * Prefix scanner routines with "WimaxasncpDict" rather than "yy", so this + * scanner can coexist with other scanners. + */ +%option prefix="WimaxasncpDict" + +%option outfile="wimaxasncp_dict.c" + +%{ + /* + ** wimaxasncp_dict.h + ** WIMAXASNCP Dictionary Import Routines + ** + ** $Id$ + ** + ** (c) 2007, Luis E. Garcia Ontanon <luis.ontanon@gmail.com> + ** (c) 2007, Stephen Croll <stephen.d.croll@gmail.com> + ** + ** This library is free software; you can redistribute it and/or + ** modify it under the terms of the GNU Library General Public + ** License as published by the Free Software Foundation; either + ** version 2 of the License, or (at your option) any later version. + ** + ** This library is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + ** Library General Public License for more details. + ** + ** You should have received a copy of the GNU Library General Public + ** License along with this library; if not, write to the Free Software + ** Foundation, Inc., 51 Franklin Street, Fifth Floor, + ** Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <glib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +#include <stdarg.h> +#include <epan/emem.h> +#include <epan/value_string.h> +#include <epan/packet.h> /* array_length */ +#include "wimaxasncp_dict.h" +#include "wimaxasncp_dict_lex.h" + +typedef struct entity_t { + gchar *name; + gchar *file; + struct entity_t *next; +} entity_t; + +#define ATTR_UINT(cont) do { D(("attr_uint " #cont "\t" )); attr_uint = &(cont); yy_push_state(GET_UINT_ATTR); } while(0) +#define ATTR_UINT16(cont) do { D(("attr_uint16 " #cont "\t" )); attr_uint16 = &(cont); yy_push_state(GET_UINT16_ATTR); } while(0) +#define ATTR_STR(cont) do { D(("attr_str " #cont "\t" )); attr_str = &(cont); yy_push_state(GET_ATTR); } while(0) +#define ATTR_DECODER(cont) do { D(("attr_decoder " #cont "\t" )); attr_uint = &(cont); yy_push_state(GET_DECODER_ATTR); } while(0) +#define IGNORE() do { D(("ignore: %s\t",yytext)); yy_push_state(IGNORE_ATTR); } while(0) + +#define D(args) wimaxasncp_dict_debug args + +#define MAX_INCLUDE_DEPTH 10 +#define YY_INPUT(buf,result,max_size) { result = current_yyinput(buf,max_size); } +#define ECHO +#define APPEND(txt,len) append_to_buffer(txt,len) + +static entity_t ents; +static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; +static int include_stack_ptr = 0; +static size_t (*current_yyinput)(gchar*,size_t); +static const gchar *sys_dir; +static wimaxasncp_dict_t *dict; +static wimaxasncp_dict_tlv_t *tlv; +static wimaxasncp_dict_enum_t *enumitem; +static wimaxasncp_dict_xmlpi_t *xmlpi; + +static wimaxasncp_dict_tlv_t *last_tlv; +static wimaxasncp_dict_enum_t *last_enumitem; +static wimaxasncp_dict_xmlpi_t *last_xmlpi; + +static gchar **attr_str; +static guint *attr_uint; +static gint16 *attr_uint16; + +static guint wimaxasncp_bits(guint bits, char *n); +static gint wimaxasncp_decode_type(const gchar *name); +static void wimaxasncp_dict_debug(const gchar *fmt, ...); +static void append_to_buffer(gchar *txt, int len); +static FILE *wimaxasncp_dict_open(const gchar*, const gchar*); + +static GString *dict_error = NULL; + +%} + + +xmlpi_start [[:blank:] \r\n]*<\?[[:blank:] \r\n]* +xmlpi_end [[:blank:] \r\n]*\?>[[:blank:] \r\n]* +xmlpi_key_attr [[:blank:] \r\n]*key[[:blank:] \r\n]*=[[:blank:] \r\n]*\042 +xmlpi_value_attr [[:blank:] \r\n]*value[[:blank:] \r\n]*=[[:blank:] \r\n]*\042 + +comment_start [[:blank:] \r\n]*<!--[[:blank:] \r\n]* +comment_end [[:blank:] \r\n]*-->[[:blank:] \r\n]* +open_tag [[:blank:] \r\n]*<[[:blank:] \r\n]* +end_tag [[:blank:] \r\n]*\/>[[:blank:] \r\n]* +close_tag [[:blank:] \r\n]*>[[:blank:] \r\n]* +open_closetag [[:blank:] \r\n]*<\/[[:blank:] \r\n]* +equals [[:blank:] \r\n]*=[[:blank:] \r\n]* +whitespace [[:blank:] \r\n]* +dquoted \042[^\042]*\042 + +doctype [[:blank:] \r\n]*<!DOCTYPE[^\[]*\[[[:blank:] \r\n]* +doctype_end [[:blank:] \r\n]*\][[:blank:] \r\n]*>[[:blank:] \r\n]* + +start_entity [[:blank:] \r\n]*<\!ENTITY[[:blank:] \r\n]* +system [[:blank:] \r\n]*SYSTEM[[:blank:] \r\n]*\042 +entityname [a-z0-9-]+ +ndquot [^\042]+ +end_entity \042[[:blank:] \r\n]*>[[:blank:] \r\n]* + +entity \&[a-z0-9-]+; + +any . + + + + +stop > +stop_end \/> +dquot \042 +number [-]?[0-9]*|(0x)?[0-9a-fA-F]* + +dictionary_start <dictionary> +dictionary_end <\/dictionary> + +tlv_start <tlv +tlv_end <\/tlv> + +type_start <type +enum_start <enum + +ignored_attr [a-z0-9-]+= +ignored_quoted \042[^\042]*\042 + +name_attr name=\042 +type_attr type=\042 +code_attr code=\042 +typename_attr type-name=\042 +description_attr description=\042 +decoder_attr decoder=\042 + + +%S LOADING LOADING_COMMENT LOADING_XMLPI ENTITY GET_SYSTEM GET_FILE END_ENTITY +%S GET_ATTR GET_UINT_ATTR GET_UINT16_ATTR +%S BIT32 BIT16 BIT8 GET_DECODER_ATTR END_ATTR +%S OUTSIDE IN_DICT IN_APPL IN_TLV IGNORE_ATTR +%S ENUM_ATTRS TLV_ATTRS +%S XMLPI_ATTRS XMLPI_GETKEY XMLPI_GETVAL XMLPI_ENDATTR +%% +<LOADING>{doctype} ; +<LOADING>{doctype_end} ; + +<LOADING>{comment_start} BEGIN LOADING_COMMENT; +<LOADING_COMMENT>. ; +<LOADING_COMMENT>{comment_end} BEGIN LOADING; + +<LOADING>{xmlpi_start} BEGIN LOADING_XMLPI; +<LOADING_XMLPI>{whitespace} ; +<LOADING_XMLPI>{entityname} { + xmlpi = g_malloc(sizeof(wimaxasncp_dict_xmlpi_t)); + xmlpi->name = g_strdup(yytext); + xmlpi->key = NULL; + xmlpi->value = NULL; + xmlpi->next = NULL; + + if (!dict->xmlpis) last_xmlpi = dict->xmlpis = xmlpi; + else last_xmlpi = last_xmlpi->next = xmlpi; + + BEGIN XMLPI_ATTRS; +} + +<XMLPI_ATTRS>{xmlpi_key_attr} BEGIN XMLPI_GETKEY; +<XMLPI_GETKEY>{ndquot} { xmlpi->key = g_strdup(yytext); BEGIN XMLPI_ATTRS; } + +<XMLPI_ATTRS>{xmlpi_value_attr} BEGIN XMLPI_GETVAL; +<XMLPI_GETVAL>{ndquot} { xmlpi->value = g_strdup(yytext); BEGIN XMLPI_ATTRS; } + +<XMLPI_ATTRS>. +<XMLPI_ATTRS>{xmlpi_end} BEGIN LOADING; + + +<LOADING>{start_entity} BEGIN ENTITY; +<ENTITY>{entityname} { + entity_t *e = g_malloc(sizeof(entity_t)); + D(("ENTITY: %s\n",yytext)); + e->name = g_strdup(yytext); + e->next = ents.next; + ents.next = e; + BEGIN GET_SYSTEM; +}; +<GET_SYSTEM>{system} BEGIN GET_FILE; +<GET_FILE>{ndquot} { + D(("GET_FILE: %s\n",yytext)); + ents.next->file = g_strdup(yytext); + BEGIN END_ENTITY; +} +<END_ENTITY>{end_entity} BEGIN LOADING; + +<LOADING>{open_tag} APPEND("<",1); + +<LOADING>{close_tag} APPEND(">",1); + +<LOADING>{end_tag} APPEND("/>",2); + +<LOADING>{open_closetag} APPEND("</",2); + +<LOADING>{whitespace} APPEND(" ",1); + +<LOADING>{dquoted} APPEND(yytext,yyleng); + +<LOADING>{equals} APPEND("=",1); + +<LOADING>{any} APPEND(yytext,yyleng); + +<LOADING,IN_DICT>{entity} { + gchar *p = ++yytext; + entity_t* e; + + while(*p != ';') p++; + + *p = '\0'; + + D(("looking for entity: %s\n",yytext)); + + if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) { + g_string_append_printf( + dict_error, "included files nested too deeply\n"); + yyterminate(); + } + + include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; + + + for (e = ents.next; e; e = e->next) { + if (strcmp(e->name,yytext) == 0) { + yyin = wimaxasncp_dict_open(sys_dir,e->file); + D(("entity: %s filename: %s yyin: %p\n",e->name,e->file,yyin)); + if (!yyin) { + yyterminate(); + } else { + yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) ); + } + break; + } + } + + if (!e) { + g_string_append_printf( + dict_error, "cannot find entity: '%s'\n", e->name); + yyterminate(); + } + +} + +<<EOF>> { + if (!yyin) yyterminate(); + + fclose(yyin); + D(("closing: %p %i\n",yyin,include_stack_ptr)); + + if ( --include_stack_ptr < 0 ) { + D(("DONE READING\n")); + yyin = NULL; + yyterminate(); + } else { + yy_delete_buffer( YY_CURRENT_BUFFER ); + yy_switch_to_buffer(include_stack[include_stack_ptr]); + BEGIN LOADING; + } +} + + +<GET_ATTR>{ndquot} { + *attr_str = g_strdup(yytext); + D(("%s\n",yytext)); + attr_str = NULL; + BEGIN END_ATTR; +} + +<GET_UINT_ATTR>{number} { + *attr_uint = strtoul(yytext,NULL,0); + D(("%s\n",yytext);); + attr_uint = NULL; + BEGIN END_ATTR; +} + +<GET_UINT16_ATTR>{number} { + *attr_uint16 = strtol(yytext,NULL,0); + D(("%s\n",yytext);); + attr_uint16 = NULL; + BEGIN END_ATTR; +} + +<GET_UINT_ATTR>"WIMAXASNCP_BIT32"[ \t]*"(" { BEGIN BIT32; } + +<BIT32>[0-9]+ { + *attr_uint = wimaxasncp_bits(32, yytext); + D(("WIMAXASNCP_BIT32(%s)\n",yytext);); + attr_uint = NULL; +} + +<GET_UINT_ATTR>"WIMAXASNCP_BIT16"[ \t]*"(" { BEGIN BIT16; } + +<BIT16>[0-9]+ { + *attr_uint = wimaxasncp_bits(16, yytext); + D(("WIMAXASNCP_BIT16(%s)\n",yytext);); + attr_uint = NULL; +} + +<GET_UINT_ATTR>"WIMAXASNCP_BIT8"[ \t]*"(" { BEGIN BIT8; } + +<BIT8>[0-9]+ { + *attr_uint = wimaxasncp_bits(8, yytext); + D(("WIMAXASNCP_BIT8(%s)\n",yytext);); + attr_uint = NULL; +} + +<BIT32,BIT16,BIT8>[ \t]*")" { BEGIN END_ATTR; } + +<GET_DECODER_ATTR>{ndquot} { + *attr_uint = wimaxasncp_decode_type(yytext); + D(("%s\n",yytext)); + attr_uint = NULL; + BEGIN END_ATTR; +} + +<END_ATTR>{dquot} { yy_pop_state(); } + +<IGNORE_ATTR>. { + /* XXX: should go?*/ + D(("{%s}",yytext)); +} + +<IGNORE_ATTR>{ignored_quoted} { + D(("=>%s<=\n",yytext)); + yy_pop_state(); +} + +<OUTSIDE>{dictionary_start} { + D(("dictionary_start\n")); + + BEGIN IN_DICT; +} + +<IN_DICT>{tlv_start} { + D(("tlv_start\n")); + + tlv = g_malloc(sizeof(wimaxasncp_dict_tlv_t)); + tlv->type = 0; + tlv->name = NULL; + tlv->description = NULL; + tlv->decoder = 0; + tlv->enums = NULL; + tlv->next = NULL; + + if (! dict->tlvs ) last_tlv = dict->tlvs = tlv; + else last_tlv = last_tlv->next = tlv; + + BEGIN TLV_ATTRS; +} + +<TLV_ATTRS>{name_attr} { ATTR_STR(tlv->name); } +<TLV_ATTRS>{description_attr} { ATTR_STR(tlv->description); } +<TLV_ATTRS>{type_attr} { ATTR_UINT16(tlv->type); } +<TLV_ATTRS>{decoder_attr} { ATTR_DECODER(tlv->decoder); } +<TLV_ATTRS>{stop} { BEGIN IN_TLV; } +<TLV_ATTRS>{stop_end} { BEGIN IN_DICT; } + + +<IN_TLV>{enum_start} { + D(("enum_start\n")); + + enumitem = g_malloc(sizeof(wimaxasncp_dict_enum_t)); + enumitem->name = NULL; + enumitem->code = 0; + enumitem->next = NULL; + + if (!tlv->enums) last_enumitem = tlv->enums = enumitem; + else last_enumitem = last_enumitem->next = enumitem; + + BEGIN ENUM_ATTRS; +} + + +<ENUM_ATTRS>{name_attr} { ATTR_STR(enumitem->name); } +<ENUM_ATTRS>{code_attr} { ATTR_UINT(enumitem->code); } + +<ENUM_ATTRS>{stop} { BEGIN IN_TLV; } +<ENUM_ATTRS>{stop_end} { BEGIN IN_TLV; } + +<IN_TLV>{tlv_end} { D(("tlv_end")); BEGIN IN_DICT; } + +<IN_DICT>{dictionary_end} { + yyterminate(); +} + +<TLV_ATTRS,ENUM_ATTRS>{ignored_attr} IGNORE(); + +<OUTSIDE>. ; + + + + + + +%% + +static int debugging = 0; + +static void wimaxasncp_dict_debug(const gchar *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + if (debugging) vfprintf(stderr, fmt, ap); + va_end(ap); + + fflush(stderr); +} + +static guint wimaxasncp_bits(guint bits, char *n) +{ + return 1 << ((bits - 1) - (strtoul(n, NULL, 10))); +} + +static const value_string wimaxasncp_decode_type_vals[] = +{ + { WIMAXASNCP_TLV_TBD, "WIMAXASNCP_TLV_TBD"}, + { WIMAXASNCP_TLV_COMPOUND, "WIMAXASNCP_TLV_COMPOUND"}, + { WIMAXASNCP_TLV_BYTES, "WIMAXASNCP_TLV_BYTES"}, + { WIMAXASNCP_TLV_ENUM8, "WIMAXASNCP_TLV_ENUM8"}, + { WIMAXASNCP_TLV_ENUM16, "WIMAXASNCP_TLV_ENUM16"}, + { WIMAXASNCP_TLV_ENUM32, "WIMAXASNCP_TLV_ENUM32"}, + { WIMAXASNCP_TLV_ETHER, "WIMAXASNCP_TLV_ETHER"}, + { WIMAXASNCP_TLV_ASCII_STRING, "WIMAXASNCP_TLV_ASCII_STRING"}, + { WIMAXASNCP_TLV_FLAG0, "WIMAXASNCP_TLV_FLAG0"}, + { WIMAXASNCP_TLV_BITFLAGS16, "WIMAXASNCP_TLV_BITFLAGS16"}, + { WIMAXASNCP_TLV_BITFLAGS32, "WIMAXASNCP_TLV_BITFLAGS32"}, + { WIMAXASNCP_TLV_ID, "WIMAXASNCP_TLV_ID"}, + { WIMAXASNCP_TLV_HEX8, "WIMAXASNCP_TLV_HEX8"}, + { WIMAXASNCP_TLV_HEX16, "WIMAXASNCP_TLV_HEX16"}, + { WIMAXASNCP_TLV_HEX32, "WIMAXASNCP_TLV_HEX32"}, + { WIMAXASNCP_TLV_DEC8, "WIMAXASNCP_TLV_DEC8"}, + { WIMAXASNCP_TLV_DEC16, "WIMAXASNCP_TLV_DEC16"}, + { WIMAXASNCP_TLV_DEC32, "WIMAXASNCP_TLV_DEC32"}, + { WIMAXASNCP_TLV_IP_ADDRESS, "WIMAXASNCP_TLV_IP_ADDRESS"}, + { WIMAXASNCP_TLV_IPV4_ADDRESS, "WIMAXASNCP_TLV_IPV4_ADDRESS"}, + { WIMAXASNCP_TLV_PROTOCOL_LIST, "WIMAXASNCP_TLV_PROTOCOL_LIST"}, + { WIMAXASNCP_TLV_PORT_RANGE_LIST, "WIMAXASNCP_TLV_PORT_RANGE_LIST"}, + { WIMAXASNCP_TLV_IP_ADDRESS_MASK_LIST,"WIMAXASNCP_TLV_IP_ADDRESS_MASK_LIST"}, + { WIMAXASNCP_TLV_VENDOR_SPECIFIC, "WIMAXASNCP_TLV_VENDOR_SPECIFIC"}, + { 0, NULL} +}; + +static gint wimaxasncp_decode_type(const gchar *name) +{ + gsize i; + for (i = 0; i < array_length(wimaxasncp_decode_type_vals) - 1; ++i) + { + if (strcmp(name, wimaxasncp_decode_type_vals[i].strptr) == 0) + { + return wimaxasncp_decode_type_vals[i].value; + } + } + + /* not found, emit some sort of error here? */ + + return WIMAXASNCP_TLV_TBD; +} + +static gchar *strbuf = NULL; +static gchar *write_ptr = NULL; +static gchar *read_ptr = NULL; + +static guint size_strbuf = 8192; +static guint len_strbuf = 0; + +extern void wimaxasncp_dict_unused(void); +void wimaxasncp_dict_unused(void) { + yy_top_state(); +} + +static void append_to_buffer(gchar *txt, int len) { + + if (strbuf == NULL) { + read_ptr = write_ptr = strbuf = g_malloc(size_strbuf); + } + + if ( (len_strbuf + len + 1) >= size_strbuf ) { + read_ptr = strbuf = g_realloc(strbuf,size_strbuf *= 2); + } + + write_ptr = strbuf + len_strbuf; + strncpy(write_ptr,txt,len); + len_strbuf += len; + strbuf[len_strbuf] = '\0'; +} + +static size_t file_input(gchar *buf, size_t max) { + size_t read; + + read = fread(buf,1,max,yyin); + + if ( read == max ) { + return max; + } else if (read > 0) { + return read; + } else { + return YY_NULL; + } +} + + +static size_t string_input(gchar *buf, size_t max) { + if (read_ptr >= write_ptr ) { + return YY_NULL; + } else if ( read_ptr + max > write_ptr ) { + max = write_ptr - read_ptr; + } + + memcpy(buf,read_ptr,max); + read_ptr += max; + + return max; +} + +static FILE *wimaxasncp_dict_open( + const gchar *system_directory, + const gchar *filename) +{ + FILE *fh; + gchar *fname; + if (system_directory) + { + int len = strlen(system_directory) + strlen(filename) + + strlen(G_DIR_SEPARATOR_S) + 1; + fname = g_malloc(len); + g_snprintf(fname, len, "%s%s%s", + system_directory, G_DIR_SEPARATOR_S,filename); + } + else + { + fname = g_strdup(filename); + } + + fh = fopen(fname,"r"); + + D(("fname: %s fh: %p\n",fname,fh)); + + if ( ! fh) + { + g_string_append_printf( + dict_error, + "cannot open file: '%s', error: %s\n", + fname, + g_strerror(errno)); + } + + g_free(fname); + + + return fh; +} + +wimaxasncp_dict_t *wimaxasncp_dict_scan( + const gchar *system_directory, const gchar *filename, int dbg, + gchar **error) { + + entity_t *e; + + dict_error = g_string_new(""); + + debugging = dbg; + + sys_dir = system_directory; + + write_ptr = NULL; + read_ptr = NULL; + + if (dict) + { + wimaxasncp_dict_free(dict); + } + + dict = g_malloc(sizeof(wimaxasncp_dict_t)); + dict->tlvs = NULL; + dict->xmlpis = NULL; + + tlv = NULL; + enumitem = NULL; + xmlpi = NULL; + + last_tlv = NULL; + last_enumitem = NULL; + last_xmlpi = NULL; + + ents.next = NULL; + + yyin = wimaxasncp_dict_open(sys_dir,filename); + + if (yyin) + { + current_yyinput = file_input; + BEGIN LOADING; + yylex(); + + D(("\n---------------\n%s\n------- %d -------\n", + strbuf, len_strbuf)); + + current_yyinput = string_input; + + BEGIN OUTSIDE; + yylex(); + } + + e = ents.next; + while (e) + { + entity_t *next = e->next; + g_free(e->name); + g_free(e->file); + g_free(e); + e = next; + } + + g_free(strbuf); + strbuf = NULL; + size_strbuf = 8192; + + if (dict_error->len > 0) + { + *error = dict_error->str; + g_string_free(dict_error, FALSE); + } + else + { + *error = NULL; + g_string_free(dict_error, TRUE); + } + + return dict; +} + +void wimaxasncp_dict_free(wimaxasncp_dict_t *d) { + wimaxasncp_dict_tlv_t *t, *tn; + +#define FREE_NAMEANDOBJ(n) do { if(n->name) g_free(n->name); g_free(n); } while(0) + + for (t = d->tlvs; t; t = tn) { + wimaxasncp_dict_enum_t *e, *en; + tn = t->next; + + for (e = t->enums; e; e = en) { + en = e->next; + FREE_NAMEANDOBJ(e); + } + + if (!t->description) g_free(t->description); + FREE_NAMEANDOBJ(t); + } + + g_free(d); +} + +void wimaxasncp_dict_print(FILE *fh, wimaxasncp_dict_t *d) { + wimaxasncp_dict_tlv_t *tlv; + + fprintf(fh,"\n"); + + for (tlv = d->tlvs; tlv; tlv = tlv->next) { + wimaxasncp_dict_enum_t *e; + fprintf(fh,"TLV: %s[%u] %s[%d] %s\n", + tlv->name ? tlv->name : "-", + tlv->type, + val_to_str(tlv->decoder, + wimaxasncp_decode_type_vals, + "Unknown"), + tlv->decoder, + tlv->description ? tlv->description : ""); + + for (e = tlv->enums; e; e = e->next) { + fprintf(fh,"\tEnum: %s[%u]\n", + e->name ? e->name : "-", + e->code); + } + } +} + +#ifdef TEST_WIMAXASNCP_DICT_STANDALONE +int main(int argc, char **argv) { + wimaxasncp_dict_t *d; + gchar *dname = NULL; + gchar *fname; + int i = 1; + + switch (argc) { + case 3: + dname = argv[i++]; + case 2: + fname = argv[i]; + break; + default: + fprintf(stderr,"%s: usage [dictionary_dir] dictionary_filename\n",argv[0]); + return 1; + } + + d = wimaxasncp_dict_scan(dname,fname,1); + + if (dict_error) + { + printf("wimaxasncp - %s", dict_error); + g_free(dict_error); + } + + wimaxasncp_dict_print(stdout, d); + + return 0; +} +#endif |