diff options
Diffstat (limited to 'plugins/wimax')
54 files changed, 37521 insertions, 0 deletions
diff --git a/plugins/wimax/AUTHORS b/plugins/wimax/AUTHORS new file mode 100644 index 0000000000..f7c8e66c71 --- /dev/null +++ b/plugins/wimax/AUTHORS @@ -0,0 +1,5 @@ +Authors: +Lu Pan <lu.pan@intel.com> +Mike Harvey <michael.harvey@intel.com> +John R. Underwood <junderx@yahoo.com> +Daniel J. Sauble <djsauble@gmail.com> diff --git a/plugins/wimax/COPYING b/plugins/wimax/COPYING new file mode 100644 index 0000000000..d60c31a97a --- /dev/null +++ b/plugins/wimax/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/plugins/wimax/ChangeLog b/plugins/wimax/ChangeLog new file mode 100644 index 0000000000..d148bc8e80 --- /dev/null +++ b/plugins/wimax/ChangeLog @@ -0,0 +1,2 @@ + + diff --git a/plugins/wimax/Makefile.am b/plugins/wimax/Makefile.am new file mode 100644 index 0000000000..3bf4f0dc93 --- /dev/null +++ b/plugins/wimax/Makefile.am @@ -0,0 +1,56 @@ +# Makefile.am +# Automake file for Wireshark WiMax Plugin +# +# $Id$ +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@ethereal.com> +# Copyright 1998 Gerald Combs +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +INCLUDES = -I$(top_srcdir) + +plugindir = @plugindir@ + +plugin_LTLIBRARIES = wimax.la +wimax_la_SOURCES = packet-wmx.c wimax_ffb_decoder.c wimax_fch_decoder.c wimax_pdu_decoder.c\ + wimax_cdma_code_decoder.c wimax_hack_decoder.c wimax_phy_attributes_decoder.c \ + mac_hd_generic_decoder.c mac_hd_type1_decoder.c mac_hd_type2_decoder.c \ + mac_mgmt_msg_decoder.c msg_dcd.c msg_ucd.c msg_dlmap.c msg_ulmap.c \ + msg_rng_req.c msg_rng_rsp.c msg_reg_req.c msg_reg_rsp.c msg_dreg.c \ + msg_dsa.c msg_dsc.c msg_dsd.c msg_arq.c msg_sbc.c msg_pkm.c msg_aas_fbck.c \ + msg_fpc.c msg_pmc.c msg_prc_lt_ctrl.c msg_aas_beam.c msg_res_cmd.c msg_rep.c \ + msg_clk_cmp.c msg_dsx_rvd.c wimax_harq_map_decoder.c \ + wimax_compact_dlmap_ie_decoder.c wimax_compact_ulmap_ie_decoder.c \ + wimax_utils.c crc.c crc_data.c wimax_tlv.c moduleinfo.h +wimax_la_LDFLAGS = -module -avoid-version +wimax_la_LIBADD = @PLUGIN_LIBS@ + +# Libs must be cleared, or else libtool won't create a shared module. +# If your module needs to be linked against any particular libraries, +# add them here. +LIBS = + +CLEANFILES = \ + wimax \ + *~ + +MAINTAINERCLEANFILES = \ + Makefile.in + +EXTRA_DIST = \ + Makefile.nmake diff --git a/plugins/wimax/Makefile.nmake b/plugins/wimax/Makefile.nmake new file mode 100644 index 0000000000..1bf5985379 --- /dev/null +++ b/plugins/wimax/Makefile.nmake @@ -0,0 +1,40 @@ +# +# + +include ..\..\config.nmake + +############### no need to modify below this line ######### + +CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ + /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) + +#LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) + +!IFDEF ENABLE_LIBWIRESHARK +LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib +CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) + +OBJECTS=packet-wmx.obj wimax_cdma_code_decoder.obj wimax_fch_decoder.obj \ + wimax_pdu_decoder.obj wimax_ffb_decoder.obj wimax_hack_decoder.obj \ + wimax_phy_attributes_decoder.obj mac_hd_generic_decoder.obj \ + mac_hd_type1_decoder.obj mac_hd_type2_decoder.obj \ + mac_mgmt_msg_decoder.obj msg_dcd.obj msg_ucd.obj msg_dlmap.obj msg_ulmap.obj \ + msg_rng_req.obj msg_rng_rsp.obj msg_reg_req.obj msg_reg_rsp.obj msg_dsa.obj \ + msg_dsc.obj msg_dsd.obj msg_arq.obj msg_sbc.obj msg_pkm.obj msg_aas_fbck.obj \ + msg_dreg.obj msg_fpc.obj msg_pmc.obj msg_prc_lt_ctrl.obj wimax_harq_map_decoder.obj \ + msg_aas_beam.obj msg_res_cmd.obj msg_rep.obj msg_clk_cmp.obj msg_dsx_rvd.obj \ + wimax_compact_dlmap_ie_decoder.obj wimax_compact_ulmap_ie_decoder.obj \ + wimax_utils.obj crc.obj crc_data.obj wimax_tlv.obj + +wimax.dll wimax.exp wimax.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:wimax.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ + $(GLIB_LIBS) + +!ENDIF + +clean: + rm -f $(OBJECTS) wimax.dll wimax.exp wimax.lib $(PDB_FILE) + +distclean: clean + +maintainer-clean: distclean diff --git a/plugins/wimax/README.wimax b/plugins/wimax/README.wimax new file mode 100644 index 0000000000..8769960247 --- /dev/null +++ b/plugins/wimax/README.wimax @@ -0,0 +1,88 @@ +$Id$ + +This document is an attempt, to explain how to use the wimax plugin +in this directory. + + +Overview +-------- +The wimax plugin is a standalone Wireshark plugin that contains a set +of WiMax Protocol dissectors. The plugin registers the WiMax Protocol +dissectors without attached to any packet type. So none of the +dissectors will be called by the Wireshark because there is no any +packet type hookup to the plugin. However, it is very simple to add +the WiMax Protocol decoding capability into any of the packet decoder +by searching and calling the WiMax Protocol dissectors since they are +registered to Wireshark already. m2m plugin is an example that uses +the wimax plugin to decode the WiMax MAC to MAC Protocol TLV packet. + + +WiMax Protocol dissector list +------------- +WiMax Burst Dissectors: + 1. wimax_cdma_code_burst_handler - WiMax CDMA Code Attribute Burst dissector. + 2. wimax_fch_burst_handler - WiMax FCH Burst dissector. + 3. wimax_ffb_burst_handler - WiMax Fast Feedback Burst dissector. + 4. wimax_pdu_burst_handler - WiMax PDU Burst dissector. + 5. wimax_hack_burst_handler - WiMax HACK Burst dissector. + 6. wimax_phy_attributes_burst_handler - WiMax PHY Attributes Burst dissector. + +WiMax MAC dissectors: + 7. mac_header_type_1_handler - WiMax TYPE I MAC Header PDU dissector. + 8. mac_header_type_2_handler - WiMax TYPE II MAC Header PDU dissector. + 9. mac_header_generic_handler - WiMax Generic MAC Header PDU dissector. + 10. mac_mgmt_msg_handler - WiMax MAC Management Messages dissector. + +WiMax Utility dissectors: +11. wimax_service_flow_encodings_decoder - WiMax Service Flow Encodings dissector. +12. wimax_error_parameter_set_decoder - WiMax Error Parameter Set dissector. +13. wimax_security_negotiation_parameters_decoder - WiMax Security Negotiation Parameter dissector. +14. wimax_pkm_tlv_encoded_attributes_decoder - WiMax PKM TLV Encoded Attributes dissector. +15. wimax_tek_parameters_decoder - WiMax TEK Parameters dissector. +16. wimax_pkm_configuration_settings_decoder - WiMax PKM Configuration Settings dissector. +17. wimax_sa_descriptor_decoder - WiMax SA Descriptor dissector. +18. wimax_cryptographic_suite_list_decoder - WiMax Cryptographic Suite List dissector. +19. wimax_security_capabilities_decoder - WiMax Security Capabilities dissector. +20. wimax_common_tlv_encoding_decoder - WiMax Common TLV Encoding dissector. +19. wimax_vendor_specific_information_decoder - WiMax Vendor-Specific Information dissector. + + +Usages +-------- +To use any of the dissectors listed above: + +1. Call Wireshark function: handle = find_dissector("dissector_name") +to get the dissector's handler. +Example: mgt_msg_handle = find_dissector("mac_mgmt_msg_handler"); + +2. If find_dissector() finds the dissector successfully a non-NULL +handle will be returned. Then call another Wireshark function: +call_dissector(handle, tvb, pinfo, tree) to call the dissector +corresponding to the handle. + +Here, handle is the value returned by find_dissector() function. + tvb is the pointer of the data buffer which contains the exact + content defined by the IEEE 802.16 standards for the dissector. + pinfo is the pointer to the packet information from Wireshark. + tree is the pointer to the display tree or sub-tree. +Example: call_dissector(mgt_msg_handle, mgt_msg_tvb, pinfo, mgt_msg_tree); + +3. The WiMax Utility dissectors should be called directly. + + +Notes +-------- +1. All the burst data has to be defraged before passing it to the +WiMax burst dissectors. + +2. The wimax_pdu_burst_handler will automatically call +mac_header_generic_handler, mac_header_type_1_handler and +mac_header_type_2_handler based on the PDU contents. + +3. The mac_header_generic_handler will automatically call +mac_mgmt_msg_handler based on the PDU payload. + +4. All the dissectors can be called independently but the data passed +to the dissectors has to contain exact content defined by the +IEEE 802.16 standards. + diff --git a/plugins/wimax/crc.c b/plugins/wimax/crc.c new file mode 100644 index 0000000000..504ef59435 --- /dev/null +++ b/plugins/wimax/crc.c @@ -0,0 +1,199 @@ +/* crc.c + * crc checksum generation and calculation functions: crc.c + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Mike Harvey <michael.harvey@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "crc.h" + +#define WMAX_MAC_CRC32_POLYNOMIAL 0x04c11db7L /* polynomial used in calculating the CRC-32 checksum */ +#define CCITT_X25_CRC16_POLYNOMIAL 0x1021 /* polynomial used in calculating the CRC-16 checksum */ +#define WMAX_MAC_CRC8_POLYNOMIAL 0x07 /* polynomial used in calculating the CRC-8 checksum */ +#define CRC32_INITIAL_VALUE 0xFFFFFFFF +#define CRC16_INITIAL_VALUE 0xFFFF + +#ifndef STATIC_DATA +static guint8 crc8_table[256]; +static guint32 crc32_table[256]; + +extern guint16 crc16_table[256]; + +/* + void wimax_mac_gen_crc32_table(void) + + REQUIRES: The functions must be called only once to initialze CRC table + + DESCRIPTION: Generate the table of CRC remainders + for all possible bytes + + ARGS: + + RETURNS: + + SIDE EFFECTS: + +*/ +void wimax_mac_gen_crc32_table(void) +{ + guint32 index, bit; + guint32 crc; + + /* little-endian (reflected) algorithm */ + for ( index = 0; index < 256; index++ ) + { + crc = ( index << 24 ); + for ( bit = 0; bit < 8; bit++ ) + { + if ( crc & 0x80000000L ) + crc = ( crc << 1 ) ^ WMAX_MAC_CRC32_POLYNOMIAL; + else + crc = ( crc << 1 ); + } + crc32_table[index] = crc; + } +} + +/* + void wimax_mac_gen_crc8_table(void) + + REQUIRES: The functions must be called only once to initialze CRC table + + DESCRIPTION: Generate the table of CRC remainders + for all possible bytes + + ARGS: + + RETURNS: + + SIDE EFFECTS: + +*/ +void wimax_mac_gen_crc8_table(void) +{ + guint index, bit; + guint8 crc; + + for ( index = 0; index < 256; index++ ) + { + crc = index; + for ( bit = 0; bit < 8; bit++ ) + { + if ( crc & 0x80 ) + crc = ( crc << 1 ) ^ WMAX_MAC_CRC8_POLYNOMIAL; + else + crc = ( crc << 1 ); + } + crc8_table[index] = crc; + } +} +#endif + +/* + + guint32 wimax_mac_calc_crc32(guint8 *data, guint data_len) + + REQUIRES: wimax_mac_gen_crc32_table() must be called before + + DESCRIPTION: Calculate the 32-bit CRC from a given data block + + ARGS: data - pointer to data + data_len - length of data (in bytes) + + RETURNS: calculated crc32 + + SIDE EFFECTS: + +*/ +guint32 wimax_mac_calc_crc32(guint8 *data, guint data_len) +{ + guint32 crc=CRC32_INITIAL_VALUE; + guint i, j; + + for ( j = 0; j < data_len; j++ ) + { + i = ( (guint8)(crc>>24) ^ data[j] ) & 0xff; + crc = ( crc<<8 ) ^ crc32_table[i]; + } + return ~crc; +} + +/* + + guint16 wimax_mac_calc_crc16(guint8 *data, guint data_len) + + REQUIRES: crc16_table[] in crc_data.c + + DESCRIPTION: Calculate the 16-bit CRC from a given data block + + ARGS: data - pointer to data + data_len - length of data (in bytes) + + RETURNS: calculated crc16 + + SIDE EFFECTS: + +*/ +guint16 wimax_mac_calc_crc16(guint8 *data, guint data_len) +{ + guint32 crc=CRC16_INITIAL_VALUE; + guint j; + + for ( j = 0; j < data_len; j++ ) + { + crc ^= data[j] << 8; + crc = (crc << 8) ^ crc16_table[(crc & 0xff00) >> 8]; + } + crc ^= 0xFFFF; /* Invert the output. */ + crc &= 0xFFFF; + return crc; +} + +/* + + guint8 wimax_mac_calc_crc8(guint8 *data, guint data_len) + + REQUIRES: wimax_mac_gen_crc8_table() must be called before + + DESCRIPTION: Calculate the 8-bit CRC from a given data block + + ARGS: data - pointer to data + data_len - length of data (in bytes) + + RETURNS: calculated crc8 + + SIDE EFFECTS: + +*/ +guint8 wimax_mac_calc_crc8(guint8 *data, guint data_len) +{ + guint8 crc=0; + guint i; + + for(i = 0; i < data_len; i++) + { + crc = crc8_table[data[i]^crc]; + } + return crc; +} diff --git a/plugins/wimax/crc.h b/plugins/wimax/crc.h new file mode 100644 index 0000000000..65d4cd136e --- /dev/null +++ b/plugins/wimax/crc.h @@ -0,0 +1,47 @@ +/* crc.h + * header file of crc.c + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Mike Harvey <michael.harvey@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef CRC_H +#define CRC_H + +#include <glib.h> + +/* use lookup tables to compute CRC values */ +#ifdef STATIC_DATA +extern guint8 crc8_table[]; +extern guint32 crc32_table[]; +#else +void wimax_mac_gen_crc32_table(void); +void wimax_mac_gen_crc8_table(void); +#endif + +guint32 wimax_mac_calc_crc32 (guint8 *data, guint data_len); +guint16 wimax_mac_calc_crc16(guint8 *data, guint data_len); +guint8 wimax_mac_calc_crc8 (guint8 *data, guint data_len); + +#endif /* CRC_H */ diff --git a/plugins/wimax/crc_data.c b/plugins/wimax/crc_data.c new file mode 100644 index 0000000000..d5046d3d1e --- /dev/null +++ b/plugins/wimax/crc_data.c @@ -0,0 +1,173 @@ +/* crc_data.c + * static crc tables for crc.c + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Mike Harvey <michael.harvey@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "crc.h" + +#ifdef STATIC_DATA + +#include <gmodule.h> + +guint32 crc32_table[256] = { + 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, + 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, + 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, + 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, + 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, + 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, + 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, + 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, + 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, + 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, + 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, + 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, + 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, + 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, + 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, + 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, + 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, + 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, + 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, + 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, + 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, + 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, + 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, + 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, + 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, + 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, + 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, + 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, + 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, + 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, + 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, + 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, + 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, + 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, + 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, + 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, + 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, + 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, + 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, + 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, + 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, + 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, + 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, + 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, + 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, + 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, + 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, + 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, + 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, + 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, + 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, + 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, + 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, + 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, + 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, + 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, + 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, + 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 +}; + + +guint8 hcs_table[256] = { + 0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, + 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, + 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, + 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, + 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, + 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, + 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, + 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, + 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, + 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, + 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, + 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, + 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, + 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, + 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, + 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, + 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, + 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, + 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, + 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, + 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, + 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, + 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, + 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, + 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, + 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, + 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, + 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, + 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, + 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, + 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, + 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3 +}; +#endif + +guint16 crc16_table[256] = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0, +}; + diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c new file mode 100644 index 0000000000..3f0b0bcc1c --- /dev/null +++ b/plugins/wimax/mac_hd_generic_decoder.c @@ -0,0 +1,2298 @@ +/* mac_hd_generic_decoder.c + * WiMax Generic MAC Header decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* TODO: Add FT_UINT24 and FT_INT24 cases to gtk_widget_get_toplevel() + * to prevent having to make all the changes from BASE_DEC to BASE_HEX + * made to this file today: 10/20/06. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* +#define DEBUG +*/ + +#include "moduleinfo.h" + +#include <string.h> +#include <glib.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include <epan/address.h> +#include <epan/reassemble.h> +#include "crc.h" + +extern gint proto_wimax; + +extern gint seen_a_service_type; +extern gboolean first_gmh; /* defined in wimax_pdu_decoder.c */ +guint get_service_type( void ); /* defined in wimax_utils.c */ + +extern gint8 arq_enabled; /* declared in packet-wmx.c */ +extern gint scheduling_service_type; /* declared in packet-wmx.c */ +extern gint mac_sdu_length; /* declared in packet-wmx.c */ + +extern address bs_address; /* declared in packet-wmx.c */ +extern guint max_logical_bands; /* declared in wimax_compact_dlmap_ie_decoder.c */ +extern gboolean is_down_link(address *src_address);/* declared in packet-wmx.c */ +extern void proto_register_mac_mgmt_msg(void); /* defined in macmgmtmsgdecoder.c */ +extern void init_wimax_globals(); /* defined in msg_ulmap.c */ + +extern void dissect_mac_mgmt_msg_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +/* global variables */ +gboolean include_cor2_changes = FALSE; + +/* Well-known CIDs */ +guint cid_initial_ranging = 0x0000; +guint global_cid_max_basic = 320; +guint cid_max_primary = 640; +guint cid_aas_ranging = 0xFeFF; +guint cid_normal_multicast = 0xFFFa; +guint cid_sleep_multicast = 0xFFFb; +guint cid_idle_multicast = 0xFFFc; +guint cid_frag_broadcast = 0xFFFd; +guint cid_padding = 0xFFFe; +guint cid_broadcast = 0xFFFF; + +/* Maximum number of CID's */ +#define MAX_CID 64 + +/* forward reference */ +void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +static gint extended_subheader_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +static gint arq_feedback_payload_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *parent_item); + +/* Static variables */ +static GHashTable *payload_frag_table = NULL; + +gint proto_mac_header_generic_decoder = -1; +static gint ett_mac_header_generic_decoder = -1; +static gint ett_mac_subheader_decoder = -1; +static gint ett_mac_mesh_subheader_decoder = -1; +static gint ett_mac_frag_subheader_decoder = -1; +static gint ett_mac_grant_mgmt_subheader_decoder = -1; +static gint ett_mac_pkt_subheader_decoder = -1; +static gint ett_mac_fast_fb_subheader_decoder = -1; +static gint ett_mac_ext_subheader_decoder = -1; +static gint ett_mac_ext_subheader_dl_decoder = -1; +static gint ett_mac_ext_subheader_ul_decoder = -1; +static gint ett_mac_arq_fb_payload_decoder = -1; +static gint ett_mac_data_pdu_decoder = -1; +static gint hf_mac_header_generic_value_bytes = -1; + +static guint frag_type, frag_len; +static guint extended_type, arq_fb_payload, seq_number; + +static guint cid_adjust[MAX_CID]; /* Must not start with 0 */ +static guint cid_vernier[MAX_CID]; +static guint cid_adj_array_size = 0; +static guint *cid_adj_array = NULL; +static guint8 *frag_num_array = NULL; + +static address save_src; +static address save_dst; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_header_generic_decoder, + &ett_mac_subheader_decoder, + &ett_mac_mesh_subheader_decoder, + &ett_mac_frag_subheader_decoder, + &ett_mac_grant_mgmt_subheader_decoder, + &ett_mac_pkt_subheader_decoder, + &ett_mac_fast_fb_subheader_decoder, + &ett_mac_ext_subheader_decoder, + &ett_mac_ext_subheader_dl_decoder, + &ett_mac_ext_subheader_ul_decoder, + &ett_mac_arq_fb_payload_decoder, + &ett_mac_data_pdu_decoder, +}; + +#define WIMAX_MAC_HEADER_SIZE 6 +#define IP_HEADER_BYTE 0x45 + +#define EXTENDED_SUB_HEADER_RSV_MASK 0x80 +#define EXTENDED_SUB_HEADER_TYPE_MASK 0x7F + +/* WIMAX GENERIC MAC HEADER FIELDS (figure 19) */ +/* 1st to 3rd bytes */ +#define WIMAX_MAC_HEADER_GENERIC_HT 0x800000 +#define WIMAX_MAC_HEADER_GENERIC_EC 0x400000 +#define WIMAX_MAC_HEADER_GENERIC_TYPE_5 0x200000 +#define WIMAX_MAC_HEADER_GENERIC_TYPE_4 0x100000 +#define WIMAX_MAC_HEADER_GENERIC_TYPE_3 0x080000 +#define WIMAX_MAC_HEADER_GENERIC_TYPE_2 0x040000 +#define WIMAX_MAC_HEADER_GENERIC_TYPE_1 0x020000 +#define WIMAX_MAC_HEADER_GENERIC_TYPE_0 0x010000 +#define WIMAX_MAC_HEADER_GENERIC_ESF 0x008000 +#define WIMAX_MAC_HEADER_GENERIC_CI 0x004000 +#define WIMAX_MAC_HEADER_GENERIC_EKS 0x003000 +#define WIMAX_MAC_HEADER_GENERIC_RSV 0x000800 +#define WIMAX_MAC_HEADER_GENERIC_LEN 0x0007FF + +/* WIMAX GENERIC MAC HEADER 1st byte masks */ +#define WIMAX_MAC_HEADER_GENERIC_HT_MASK 0x80 +#define WIMAX_MAC_HEADER_GENERIC_EC_MASK 0x40 +#define WIMAX_MAC_HEADER_GENERIC_TYPE_MASK 0x3F +/* WiMax Generic MAC Header Sub Type Masks */ +#define GENERIC_SUB_TYPE_0 0x01 +#define GENERIC_SUB_TYPE_1 0x02 +#define GENERIC_SUB_TYPE_2 0x04 +#define GENERIC_SUB_TYPE_3 0x08 +#define GENERIC_SUB_TYPE_4 0x10 +#define GENERIC_SUB_TYPE_5 0x20 + +/* WIMAX GENERIC MAC HEADER 2nd byte masks */ +#define WIMAX_MAC_HEADER_GENERIC_ESF_MASK 0x80 +#define WIMAX_MAC_HEADER_GENERIC_CI_MASK 0x40 +#define WIMAX_MAC_HEADER_GENERIC_EKS_MASK 0x30 +#define WIMAX_MAC_HEADER_GENERIC_LEN_MASK 0x07 + +static int hf_mac_header_generic_ht = -1; +static int hf_mac_header_generic_ec = -1; +static int hf_mac_header_generic_type_0 = -1; +static int hf_mac_header_generic_type_1 = -1; +static int hf_mac_header_generic_type_2 = -1; +static int hf_mac_header_generic_type_3 = -1; +static int hf_mac_header_generic_type_4 = -1; +static int hf_mac_header_generic_type_5 = -1; +static int hf_mac_header_generic_esf = -1; +static int hf_mac_header_generic_ci = -1; +static int hf_mac_header_generic_eks = -1; +static int hf_mac_header_generic_rsv = -1; +static int hf_mac_header_generic_len = -1; +static int hf_mac_header_generic_cid = -1; +static int hf_mac_header_generic_hcs = -1; +static int hf_mac_header_generic_crc = -1; + +/* MAC Header types */ +static const value_string ht_msgs[] = +{ + { 0, "Generic" }, + { 1, "Signaling" }, + { 0, NULL} +}; + +/* Encryption Controls */ +static const value_string ec_msgs[] = +{ + { 0, "Not encrypted" }, + { 1, "Encrypted" }, + { 0, NULL} +}; + +/* ESF messages */ +static const value_string esf_msgs[] = +{ + { 0, "Extended subheader is absent" }, + { 1, "Extended subheader is present" }, + { 0, NULL} +}; + +/* CRC Indicator messages */ +static const value_string ci_msgs[] = +{ + { 0, "No CRC is included" }, + { 1, "CRC is included" }, + { 0, NULL} +}; + +/* Sub-Type message 0 */ +static const value_string type_msg0[] = +{ + { 0, "Fast-feedback allocation subheader(DL)/Grant management subheader(UL) is absent" }, + { 1, "Fast-feedback allocation subheader(DL)/Grant management subheader(UL) is present" }, + { 0, NULL} +}; + +/* Sub-Type message 1 */ +static const value_string type_msg1[] = +{ + { 0, "Packing subheader is absent" }, + { 1, "Packing Subheader is present" }, + { 0, NULL} +}; + +/* Sub-Type message 2 */ +static const value_string type_msg2[] = +{ + { 0, "Fragmentation subheader is absent" }, + { 1, "Fragmentation subheader is present" }, + { 0, NULL} +}; + +/* Sub-Type message 3 */ +static const value_string type_msg3[] = +{ + { 0, "The subheader is not extended" }, + { 1, "The subheader is extended" }, + { 0, NULL} +}; + +/* Sub-Type message 4 */ +static const value_string type_msg4[] = +{ + { 0, "ARQ feedback payload is absent" }, + { 1, "ARQ feedback payload is present" }, + { 0, NULL} +}; + +/* Sub-Type message 5 */ +static const value_string type_msg5[] = +{ + { 0, "Mesh subheader is absent" }, + { 1, "Mesh subheader is present" }, + { 0, NULL} +}; + +/* Fast-Feedback Feedback Types */ +static const value_string fast_fb_types[] = +{ + { 0, "Fast DL measurement" }, + { 1, "Fast MIMO Feedback, Antenna #0" }, + { 2, "Fast MIMO Feedback, Antenna #1" }, + { 3, "MIMO Mode and Permutation Mode Feedback" }, + { 0, NULL} +}; + +/* Generic MAC header display */ +static hf_register_info hf[] = +{ + { + &hf_mac_header_generic_value_bytes, + { + "Values", "wimax.genericValueBytes", + FT_BYTES, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_ht, + { + "MAC Header Type", "wimax.genericHt", + FT_UINT24, BASE_HEX, VALS(ht_msgs), WIMAX_MAC_HEADER_GENERIC_HT, + "", HFILL + } + }, + { + &hf_mac_header_generic_ec, + { + "MAC Encryption Control", "wimax.genericEc", + FT_UINT24, BASE_HEX, VALS(ec_msgs), WIMAX_MAC_HEADER_GENERIC_EC, + "", HFILL + } + }, + { + &hf_mac_header_generic_type_0, + { + "MAC Sub-type Bit 0", "wimax.genericType0", + FT_UINT24, BASE_HEX, VALS(type_msg0), WIMAX_MAC_HEADER_GENERIC_TYPE_0, + "", HFILL + } + }, + { + &hf_mac_header_generic_type_1, + { + "MAC Sub-type Bit 1", "wimax.genericType1", + FT_UINT24, BASE_HEX, VALS(type_msg1), WIMAX_MAC_HEADER_GENERIC_TYPE_1, + "", HFILL + } + }, + { + &hf_mac_header_generic_type_2, + { + "MAC Sub-type Bit 2", "wimax.genericType2", + FT_UINT24, BASE_HEX, VALS(type_msg2), WIMAX_MAC_HEADER_GENERIC_TYPE_2, + "", HFILL + } + }, + { + &hf_mac_header_generic_type_3, + { + "MAC Sub-type Bit 3", "wimax.genericType3", + FT_UINT24, BASE_HEX, VALS(type_msg3), WIMAX_MAC_HEADER_GENERIC_TYPE_3, + "", HFILL + } + }, + { + &hf_mac_header_generic_type_4, + { + "MAC Sub-type Bit 4", "wimax.genericType4", + FT_UINT24, BASE_HEX, VALS(type_msg4), WIMAX_MAC_HEADER_GENERIC_TYPE_4, + "", HFILL + } + }, + { + &hf_mac_header_generic_type_5, + { + "MAC Sub-type Bit 5", "wimax.genericType5", + FT_UINT24, BASE_HEX, VALS(type_msg5), WIMAX_MAC_HEADER_GENERIC_TYPE_5, + "", HFILL + } + }, + { + &hf_mac_header_generic_esf, + { + "Extended Sub-header Field", "wimax.genericEsf", + FT_UINT24, BASE_HEX, VALS(esf_msgs), WIMAX_MAC_HEADER_GENERIC_ESF, + "", HFILL + } + }, + { + &hf_mac_header_generic_ci, + { + "CRC Indicator", "wimax.genericCi", + FT_UINT24, BASE_HEX, VALS(ci_msgs), WIMAX_MAC_HEADER_GENERIC_CI, + "", HFILL + } + }, + { + &hf_mac_header_generic_eks, + { + "Encryption Key Sequence", "wimax.genericEks", + FT_UINT24, BASE_HEX, NULL, WIMAX_MAC_HEADER_GENERIC_EKS, + "", HFILL + } + }, + { + &hf_mac_header_generic_rsv, + { + "Reserved", "wimax.genericRsv", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_GENERIC_RSV, + "", HFILL + } + }, + { + &hf_mac_header_generic_len, + { + "Length", "wimax.genericLen", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_GENERIC_LEN, + "", HFILL + } + }, + { + &hf_mac_header_generic_cid, + { + "Connection ID", "wimax.genericCid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_hcs, + { + "Header Check Sequence", "wimax.genericHcs", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_crc, + { + "CRC", "wimax.genericCrc", + FT_UINT32, BASE_HEX, NULL, 0x0, + "", HFILL + } + } +}; + +/* Extended sub-headers */ +/* DL sub-header types */ +enum +{ +SDU_SN, +DL_SLEEP_CONTROL, +FEEDBACK_REQ, +SN_REQ, +PDU_SN_SHORT_DL, +PDU_SN_LONG_DL +} DL_EXT_SUBHEADER; + +static const value_string dl_ext_sub_header_type[] = +{ + {0, "SDU_SN"}, + {1, "DL Sleep Control"}, + {2, "Feedback Request"}, + {3, "SN Request"}, + {4, "PDU SN (short)"}, + {5, "PDU SN (long)"}, + {0, NULL} +}; + +/* DL Sleep Control Extended Subheader field masks (table 13e) */ +#define DL_SLEEP_CONTROL_POWER_SAVING_CLASS_ID_MASK 0xFC0000 /*0x00003F*/ +#define DL_SLEEP_CONTROL_OPERATION_MASK 0x020000 /*0x000040*/ +#define DL_SLEEP_CONTROL_FINAL_SLEEP_WINDOW_EXPONENT_MASK 0x01C000 /*0x000380*/ +#define DL_SLEEP_CONTROL_FINAL_SLEEP_WINDOW_BASE_MASK 0x003FF0 /*0x0FFC00*/ +#define DL_SLEEP_CONTROL_RESERVED_MASK 0x00000F /*0xF00000*/ + +/* Feedback Request Extended Subheader field masks (table 13f) */ +#define FEEDBACK_REQUEST_UIUC_MASK 0xF00000 /*0x00000F*/ +#define FEEDBACK_REQUEST_FEEDBACK_TYPE_MASK 0x0F0000 /*0x0000F0*/ +#define FEEDBACK_REQUEST_OFDMA_SYMBOL_OFFSET_MASK 0x00FC00 /*0x003F00*/ +#define FEEDBACK_REQUEST_SUBCHANNEL_OFFSET_MASK 0x0003F0 /*0x0FC000*/ +#define FEEDBACK_REQUEST_NUMBER_OF_SLOTS_MASK 0x00000E /*0x700000*/ +#define FEEDBACK_REQUEST_FRAME_OFFSET_MASK 0x000001 /*0x800000*/ + +/* OFDMA UIUC Values ??? */ +static const value_string uiuc_values[] = +{ + { 0, "Fast-Feedback Channel" }, + { 1, "Burst Profile 1" }, + { 2, "Burst Profile 2" }, + { 3, "Burst Profile 3" }, + { 4, "Burst Profile 4" }, + { 5, "Burst Profile 5" }, + { 6, "Burst Profile 6" }, + { 7, "Burst Profile 7" }, + { 8, "Burst Profile 8" }, + { 9, "Burst Profile 9" }, + { 10, "Burst Profile 10" }, + { 11, "Extended UIUC 2 IE" }, + { 12, "CDMA Bandwidth Request, CDMA Ranging" }, + { 13, "PAPR Reduction Allocation, Safety Zone" }, + { 14, "CDMA Allocation IE" }, + { 15, "Extended UIUC" }, + { 0, NULL} +}; + +/* UL sub-header types */ +enum +{ +MIMO_MODE_FEEDBACK, +UL_TX_POWER_REPORT, +MINI_FEEDBACK, +PDU_SN_SHORT_UL, +PDU_SN_LONG_UL +} UL_EXT_SUBHEADER; + +static const value_string ul_ext_sub_header_type[] = +{ + {0, "MIMO Mode Feedback"}, + {1, "UL TX Power Report"}, + {2, "Mini-feedback"}, + {3, "PDU SN (short)"}, + {4, "PDU SN (long)"}, + {0, NULL} +}; + +/* MIMO Mode Feedback Extended Subheader field masks (table 13g) */ +#define MIMO_FEEDBACK_TYPE_MASK 0xC0 /*0x03*/ +#define MIMO_FEEDBACK_CONTENT_MASK 0x3F /*0xFC*/ +/* Mimo Feedback Types ??? */ +static const value_string mimo_fb_types[] = +{ + { 0, "Fast DL measurement" }, + { 1, "Default Feedback with Antenna Grouping" }, + { 2, "Antenna Selection and Reduced Codebook" }, + { 3, "Quantized Precoding Weight Feedback" }, + { 0, NULL} +}; + +/* MNI-Feedback Extended Subheader field masks (table 13i) */ +#define MINI_FEEDBACK_TYPE_MASK 0xF000 /*0x000F*/ +#define MINI_FEEDBACK_CONTENT_MASK 0x0FFF /*0xFFF0*/ +/* Feedback Types */ +static const value_string fb_types[] = +{ + { 0, "CQI and MIMO Feedback" }, + { 1, "DL average CINR" }, + { 2, "MIMO Coefficients Feedback" }, + { 3, "Preferred DL Channel DIUC Feedback" }, + { 4, "UL Transmission Power" }, + { 5, "PHY Channel Feedback" }, + { 6, "AMC Band Indication Bitmap" }, + { 7, "Life Span of Short-term Precoding Feedback" }, + { 8, "Multiple Types of Feedback" }, + { 9, "Long-term Precoding Feedback" }, + { 10, "Combined DL Average CINR of Active BSs" }, + { 11, "MIMO Channel Feedback" }, + { 12, "CINR Feedback" }, + { 13, "Close-loop MIMO Feedback" }, + { 14, "Reserved" }, + { 15, "Reserved" }, + { 0, NULL} +}; + +/* common fields */ +static gint hf_mac_header_generic_ext_subheader_rsv = -1; +/* DL sub-header */ +static gint hf_mac_header_generic_ext_subheader_type_dl = -1; +static gint hf_mac_header_generic_ext_subheader_sdu_sn = -1; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_pscid = -1; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_op = -1; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_fswe = -1; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_fswb = -1; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_rsv = -1; +static gint hf_mac_header_generic_ext_subheader_fb_req_uiuc = -1; +static gint hf_mac_header_generic_ext_subheader_fb_req_fb_type = -1; +static gint hf_mac_header_generic_ext_subheader_fb_req_ofdma_symbol_offset = -1; +static gint hf_mac_header_generic_ext_subheader_fb_req_subchannel_offset = -1; +static gint hf_mac_header_generic_ext_subheader_fb_req_slots = -1; +static gint hf_mac_header_generic_ext_subheader_fb_req_frame_offset = -1; + +/* DL Sleep Control Operations */ +static const value_string dl_sleep_control_ops[] = +{ + { 0, "De-activate Power Saving Class" }, + { 1, "Activate Power Saving Class" }, + { 0, NULL} +}; + +/* UL sub-header */ +static gint hf_mac_header_generic_ext_subheader_type_ul = -1; +static gint hf_mac_header_generic_ext_subheader_mimo_mode_fb_type = -1; +static gint hf_mac_header_generic_ext_subheader_mimo_fb_content = -1; +static gint hf_mac_header_generic_ext_subheader_ul_tx_pwr_rep = -1; +static gint hf_mac_header_generic_ext_subheader_mini_fb_type = -1; +static gint hf_mac_header_generic_ext_subheader_mini_fb_content = -1; +/* common fields */ +static gint hf_mac_header_generic_ext_subheader_pdu_sn_short = -1; +static gint hf_mac_header_generic_ext_subheader_pdu_sn_long = -1; + +/* SN Request subheader */ +#define SN_REQUEST_SUBHEADER_SN_REPORT_INDICATION_1_MASK 0x01 +#define SN_REQUEST_SUBHEADER_SN_REPORT_INDICATION_2_MASK 0x02 +#define SN_REQUEST_SUBHEADER_RESERVED_MASK 0xFC + +static gint hf_mac_header_generic_ext_subheader_sn_req_rep_ind_1 = -1; +static gint hf_mac_header_generic_ext_subheader_sn_req_rep_ind_2 = -1; +static gint hf_mac_header_generic_ext_subheader_sn_req_rsv = -1; +/* SN Report Indication message */ +static const value_string sn_rep_msg[] = +{ + { 0, "" }, + { 1, "request transmission" }, + { 0, NULL} +}; + +/* Extended Subheader display */ +static hf_register_info hf_ext[] = +{ + { + &hf_mac_header_generic_ext_subheader_rsv, + { + "Reserved", "wimax.genericExtSubhd.Rsv", + FT_UINT8, BASE_DEC, NULL, EXTENDED_SUB_HEADER_RSV_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_type_dl, + { + "DL Extended Subheader Type", "wimax.genericExtSubhd.Dl", + FT_UINT8, BASE_DEC, VALS(dl_ext_sub_header_type), EXTENDED_SUB_HEADER_TYPE_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_type_ul, + { + "UL Extended Subheader Type", "wimax.genericExtSubhd.Ul", + FT_UINT8, BASE_DEC, VALS(ul_ext_sub_header_type), EXTENDED_SUB_HEADER_TYPE_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_sdu_sn, + { + "SDU Sequence Number", "wimax.genericExtSubhd.SduSn", + FT_UINT8, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_dl_sleep_control_pscid, + { + "Power Saving Class ID", "wimax.genericExtSubhd.DlSleepCtrlPSCID", + FT_UINT24, BASE_DEC, NULL, DL_SLEEP_CONTROL_POWER_SAVING_CLASS_ID_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_dl_sleep_control_op, + { + "Operation", "wimax.genericExtSubhd.DlSleepCtrlOP", + FT_UINT24, BASE_HEX, VALS(dl_sleep_control_ops), DL_SLEEP_CONTROL_OPERATION_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_dl_sleep_control_fswe, + { + "Final Sleep Window Exponent", "wimax.genericExtSubhd.DlSleepCtrlFSWE", + FT_UINT24, BASE_DEC, NULL, DL_SLEEP_CONTROL_FINAL_SLEEP_WINDOW_EXPONENT_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_dl_sleep_control_fswb, + { + "Final Sleep Window Base", "wimax.genericExtSubhd.DlSleepCtrlFSWB", + FT_UINT24, BASE_DEC, NULL, DL_SLEEP_CONTROL_FINAL_SLEEP_WINDOW_BASE_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_dl_sleep_control_rsv, + { + "Reserved", "wimax.genericExtSubhd.DlSleepCtrlRsv", + FT_UINT24, BASE_DEC, NULL, DL_SLEEP_CONTROL_RESERVED_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_fb_req_uiuc, + { + "UIUC", "wimax.genericExtSubhd.FbReqUIUC", + FT_UINT24, BASE_HEX, VALS(uiuc_values), FEEDBACK_REQUEST_UIUC_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_fb_req_fb_type, + { + "Feedback Type", "wimax.genericExtSubhd.FbReqFbType", + FT_UINT24, BASE_HEX, VALS(fb_types), FEEDBACK_REQUEST_FEEDBACK_TYPE_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_fb_req_ofdma_symbol_offset, + { + "OFDMA Symbol Offset", "wimax.genericExtSubhd.FbReqOfdmaSymbolOffset", + FT_UINT24, BASE_HEX, NULL, FEEDBACK_REQUEST_OFDMA_SYMBOL_OFFSET_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_fb_req_subchannel_offset, + { + "Subchannel Offset", "wimax.genericExtSubhd.FbReqSubchannelOffset", + FT_UINT24, BASE_HEX, NULL, FEEDBACK_REQUEST_SUBCHANNEL_OFFSET_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_fb_req_slots, + { + "Number of Slots", "wimax.genericExtSubhd.FbReqSlots", + FT_UINT24, BASE_HEX, NULL, FEEDBACK_REQUEST_NUMBER_OF_SLOTS_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_fb_req_frame_offset, + { + "Frame Offset", "wimax.genericExtSubhd.FbReqFrameOffset", + FT_UINT24, BASE_HEX, NULL, FEEDBACK_REQUEST_FRAME_OFFSET_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_sn_req_rep_ind_1, + { + "First SN Report Indication", "wimax.genericExtSubhd.SnReqRepInd1", + FT_UINT8, BASE_DEC, VALS(sn_rep_msg), SN_REQUEST_SUBHEADER_SN_REPORT_INDICATION_1_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_sn_req_rep_ind_2, + { + "Second SN Report Indication", "wimax.genericExtSubhd.SnReqRepInd2", + FT_UINT8, BASE_DEC, VALS(sn_rep_msg), SN_REQUEST_SUBHEADER_SN_REPORT_INDICATION_2_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_sn_req_rsv, + { + "Reserved", "wimax.genericExtSubhd.SnReqRsv", + FT_UINT8, BASE_DEC, NULL, SN_REQUEST_SUBHEADER_RESERVED_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_mimo_mode_fb_type, + { + "Feedback Type", "wimax.genericExtSubhd.MimoFbType", + FT_UINT8, BASE_DEC, VALS(mimo_fb_types), MIMO_FEEDBACK_TYPE_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_mimo_fb_content, + { + "Feedback Content", "wimax.genericExtSubhd.MimoFbContent", + FT_UINT8, BASE_DEC, NULL, MIMO_FEEDBACK_CONTENT_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_ul_tx_pwr_rep, + { + "UL TX Power", "wimax.genericExtSubhd.UlTxPwr", + FT_UINT8, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_mini_fb_type, + { + "Feedback Type", "wimax.genericExtSubhd.MiniFbType", + FT_UINT16, BASE_DEC, VALS(fb_types), MINI_FEEDBACK_TYPE_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_mini_fb_content, + { + "Feedback Content", "wimax.genericExtSubhd.MiniFbContent", + FT_UINT16, BASE_DEC, NULL, MINI_FEEDBACK_CONTENT_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_pdu_sn_short, + { + "PDU Sequence Number", "wimax.genericExtSubhd.PduSnShort", + FT_UINT8, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_ext_subheader_pdu_sn_long, + { + "PDU Sequence Number", "wimax.genericExtSubhd.PduSnLong", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + } +}; + +/* Mesh Subheader */ +static gint hf_mac_header_generic_mesh_subheader = -1; + +/* Mesh Subheader display */ +static hf_register_info hf_mesh[] = +{ + { + &hf_mac_header_generic_mesh_subheader, + { + "Xmt Node Id", "wimax.genericMeshSubhd", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + } +}; + +/* Fragmentation Subheader (table 8) */ +#define FRAGMENTATION_SUBHEADER_FC_MASK 0xC000 /*0x0003*/ +#define FRAGMENTATION_SUBHEADER_BSN_MASK 0x3FF8 /*0x1FFC*/ +#define FRAGMENTATION_SUBHEADER_RSV_EXT_MASK 0x0007 /*0xE000*/ +#define FRAGMENTATION_SUBHEADER_FSN_MASK 0x38 /*0x1C*/ +#define FRAGMENTATION_SUBHEADER_RSV_MASK 0x07 /*0xE0*/ +#define FRAGMENT_TYPE_MASK 0xC0 +#define SEQ_NUMBER_MASK 0x38 +#define SEQ_NUMBER_MASK_11 0x3FF8 + +#define NO_FRAG 0 +#define LAST_FRAG 1 +#define FIRST_FRAG 2 +#define MIDDLE_FRAG 3 + +static gint hf_mac_header_generic_frag_subhd_fc = -1; +static gint hf_mac_header_generic_frag_subhd_fc_ext = -1; +static gint hf_mac_header_generic_frag_subhd_bsn = -1; +static gint hf_mac_header_generic_frag_subhd_fsn = -1; +static gint hf_mac_header_generic_frag_subhd_fsn_ext = -1; +static gint hf_mac_header_generic_frag_subhd_rsv = -1; +static gint hf_mac_header_generic_frag_subhd_rsv_ext = -1; + +/* Fragment Types */ +static const value_string frag_types[] = +{ + { 0, "No fragmentation" }, + { 1, "Last fragment" }, + { 2, "First fragment" }, + { 3, "Continuing (middle) fragment" }, + { 0, NULL} +}; + +/* Fragmentation Subheader display */ +static hf_register_info hf_frag[] = +{ + { + &hf_mac_header_generic_frag_subhd_fc, + { + "Fragment Type", "wimax.genericFragSubhd.Fc", + FT_UINT8, BASE_DEC, VALS(frag_types), FRAGMENTATION_SUBHEADER_FC_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_frag_subhd_fc_ext, + { + "Fragment Type", "wimax.genericFragSubhd.FcExt", + FT_UINT16, BASE_DEC, VALS(frag_types), FRAGMENTATION_SUBHEADER_FC_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_frag_subhd_bsn, + { + "Block Sequence Number (BSN)", "wimax.genericFragSubhd.Bsn", + FT_UINT16, BASE_DEC, NULL, FRAGMENTATION_SUBHEADER_BSN_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_frag_subhd_fsn, + { + "Fragment Sequence Number (FSN)", "wimax.genericFragSubhd.Fsn", + FT_UINT8, BASE_DEC, NULL, FRAGMENTATION_SUBHEADER_FSN_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_frag_subhd_fsn_ext, + { + "Fragment Sequence Number (FSN)", "wimax.genericFragSubhd.FsnExt", + FT_UINT16, BASE_DEC, NULL, FRAGMENTATION_SUBHEADER_BSN_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_frag_subhd_rsv, + { + "Reserved", "wimax.genericFragSubhd.Rsv", + FT_UINT8, BASE_DEC, NULL, FRAGMENTATION_SUBHEADER_RSV_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_frag_subhd_rsv_ext, + { + "Reserved", "wimax.genericFragSubhd.RsvExt", + FT_UINT16, BASE_DEC, NULL, FRAGMENTATION_SUBHEADER_RSV_EXT_MASK, + "", HFILL + } + } +}; + +/* Packing Subheader (table 11) */ +#define PACKING_SUBHEADER_FC_MASK 0xC00000 +#define PACKING_SUBHEADER_BSN_MASK 0x3FF800 +#define PACKING_SUBHEADER_FSN_MASK 0x38 +#define PACKING_SUBHEADER_LENGTH_MASK 0x07FF +#define PACKING_SUBHEADER_LENGTH_EXT_MASK 0x0007FF + +#define FRAG_LENGTH_MASK 0x0007FF00 + +static gint hf_mac_header_generic_packing_subhd_fc = -1; +static gint hf_mac_header_generic_packing_subhd_fc_ext = -1; +static gint hf_mac_header_generic_packing_subhd_bsn = -1; +static gint hf_mac_header_generic_packing_subhd_fsn = -1; +static gint hf_mac_header_generic_packing_subhd_fsn_ext = -1; +static gint hf_mac_header_generic_packing_subhd_len = -1; +static gint hf_mac_header_generic_packing_subhd_len_ext = -1; + +/* Packing Subheader display */ +static hf_register_info hf_pack[] = +{ + { + &hf_mac_header_generic_packing_subhd_fc, + { + "Fragment Type", "wimax.genericPackSubhd.Fc", + FT_UINT16, BASE_DEC, VALS(frag_types), PACKING_SUBHEADER_FC_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_packing_subhd_fc_ext, + { + "Fragment Type", "wimax.genericPackSubhd.FcExt", + FT_UINT24, BASE_HEX, VALS(frag_types), PACKING_SUBHEADER_FC_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_packing_subhd_bsn, + { + "First Block Sequence Number", "wimax.genericPackSubhd.Bsn", + FT_UINT24, BASE_DEC, NULL, PACKING_SUBHEADER_BSN_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_packing_subhd_fsn, + { + "Fragment Number", "wimax.genericPackSubhd.Fsn", + FT_UINT16, BASE_DEC, NULL, PACKING_SUBHEADER_FSN_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_packing_subhd_fsn_ext, + { + "Fragment Number", "wimax.genericPackSubhd.FsnExt", + FT_UINT24, BASE_DEC, NULL, PACKING_SUBHEADER_BSN_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_packing_subhd_len, + { + "Length", "wimax.genericPackSubhd.Len", + FT_UINT16, BASE_DEC, NULL, PACKING_SUBHEADER_LENGTH_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_packing_subhd_len_ext, + { + "Length", "wimax.genericPackSubhd.LenExt", + FT_UINT24, BASE_DEC, NULL, PACKING_SUBHEADER_LENGTH_EXT_MASK, + "", HFILL + } + } +}; + +/* Fast-feedback Allocation Subheader (table 13) */ +#define FAST_FEEDBACK_ALLOCATION_OFFSET_MASK 0xFC /*0x3F*/ +#define FAST_FEEDBACK_FEEDBACK_TYPE_MASK 0x03 /*0xC0*/ + +static gint hf_mac_header_generic_fast_fb_subhd_alloc_offset = -1; +static gint hf_mac_header_generic_fast_fb_subhd_fb_type = -1; + +/* Fast-feedback Allocation Subheader display */ +static hf_register_info hf_fast[] = +{ + { + &hf_mac_header_generic_fast_fb_subhd_alloc_offset, + { + "Allocation Offset", "wimax.genericFastFbSubhd.AllocOffset", + FT_UINT8, BASE_DEC, NULL, FAST_FEEDBACK_ALLOCATION_OFFSET_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_fast_fb_subhd_fb_type, + { + "Feedback Type", "wimax.genericFastFbSubhd.FbType", + FT_UINT8, BASE_DEC, VALS(fast_fb_types), FAST_FEEDBACK_FEEDBACK_TYPE_MASK, + "", HFILL + } + } +}; + +/* Grant Management Subheader (table 9 & 10) */ +#define GRANT_MGMT_SUBHEADER_UGS_SI_MASK 0x8000 /*0x0001*/ +#define GRANT_MGMT_SUBHEADER_UGS_PM_MASK 0x4000 /*0x0002*/ +#define GRANT_MGMT_SUBHEADER_UGS_FLI_MASK 0x2000 /*0x0004*/ +#define GRANT_MGMT_SUBHEADER_UGS_FL_MASK 0x1E00 /*0x0078*/ +#define GRANT_MGMT_SUBHEADER_UGS_RSV_MASK 0x01FF /*0xFF80*/ +#define GRANT_MGMT_SUBHEADER_EXT_PBR_MASK 0xFFE0 /*0x07FF*/ +#define GRANT_MGMT_SUBHEADER_EXT_FLI_MASK 0x0010 /*0x0800*/ +#define GRANT_MGMT_SUBHEADER_EXT_FL_MASK 0x000F /*0xF000*/ + +enum +{ + SCHEDULE_SERVICE_TYPE_RSVD, + SCHEDULE_SERVICE_TYPE_UNDEFINED, + SCHEDULE_SERVICE_TYPE_BE, + SCHEDULE_SERVICE_TYPE_NRTPS, + SCHEDULE_SERVICE_TYPE_RTPS, + SCHEDULE_SERVICE_TYPE_EXT_RTPS, + SCHEDULE_SERVICE_TYPE_UGS +} SCHEDULE_SERVICE_TYPE; + +static gint hf_mac_header_generic_grant_mgmt_ugs_tree = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_si = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_pm = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_fli = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_fl = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_rsv = -1; +static gint hf_mac_header_generic_grant_mgmt_ext_rtps_tree = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_ext_pbr = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_ext_fli = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_ext_fl = -1; +static gint hf_mac_header_generic_grant_mgmt_ext_pbr_tree = -1; +static gint hf_mac_header_generic_grant_mgmt_subhd_pbr = -1; + +/* Slip Indicators */ +static const value_string si_msgs[] = +{ + { 0, "No action" }, + { 1, "A slip of UL grants relative to the UL queue depth" }, + { 0, NULL} +}; + +/* Poll-Me Messages */ +static const value_string pm_msgs[] = +{ + { 0, "No action" }, + { 1, "Request a bandwidth poll" }, + { 0, NULL} +}; + +/* Frame Latency Indications */ +static const value_string fli_msgs[] = +{ + { 0, "Frame latency field disabled" }, + { 1, "Frame latency field enabled" }, + { 0, NULL} +}; + +/* Grant Management Subheader display */ +static hf_register_info hf_grant[] = +{ + { + &hf_mac_header_generic_grant_mgmt_ext_pbr_tree, + { + "Scheduling Service Type (Default)", + "wimax.genericGrantSubhd.Default", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_pbr, + { + "PiggyBack Request", "wimax.genericGrantSubhd.Pbr", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_ugs_tree, + { + "Scheduling Service Type (UGS)", "wimax.genericGrantSubhd.UGS", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_ugs_si, + { + "Slip Indicator", "wimax.genericGrantSubhd.Si", + FT_UINT16, BASE_DEC, VALS(si_msgs), GRANT_MGMT_SUBHEADER_UGS_SI_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_ugs_pm, + { + "Poll-Me", "wimax.genericGrantSubhd.Pm", + FT_UINT16, BASE_DEC, VALS(pm_msgs), GRANT_MGMT_SUBHEADER_UGS_PM_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_ugs_fli, + { + "Frame Latency Indication", "wimax.genericGrantSubhd.Fli", + FT_UINT16, BASE_DEC, VALS(fli_msgs), GRANT_MGMT_SUBHEADER_UGS_FLI_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_ugs_fl, + { + "Frame Latency", "wimax.genericGrantSubhd.Fl", + FT_UINT16, BASE_DEC, NULL, GRANT_MGMT_SUBHEADER_UGS_FL_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_ugs_rsv, + { + "Reserved", "wimax.genericGrantSubhd.Rsv", + FT_UINT16, BASE_DEC, NULL, GRANT_MGMT_SUBHEADER_UGS_RSV_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_ext_rtps_tree, + { + "Scheduling Service Type (Extended rtPS)", + "wimax.genericGrantSubhd.ExtendedRTPS", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_ext_pbr, + { + "Extended PiggyBack Request", "wimax.genericGrantSubhd.ExtPbr", + FT_UINT16, BASE_DEC, NULL, GRANT_MGMT_SUBHEADER_EXT_PBR_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_ext_fli, + { + "Frame Latency Indication", "wimax.genericGrantSubhd.ExtFli", + FT_UINT16, BASE_DEC, VALS(fli_msgs), GRANT_MGMT_SUBHEADER_EXT_FLI_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_grant_mgmt_subhd_ext_fl, + { + "Frame Latency", "wimax.genericGrantSubhd.ExtFl", + FT_UINT16, BASE_DEC, NULL, GRANT_MGMT_SUBHEADER_EXT_FL_MASK, + "", HFILL + } + } +}; + +/* ARQ Feedback Payload */ + +/* ARQ Feedback IE bit masks (table 111) */ +#define ARQ_FB_IE_LAST_BIT_MASK 0x8000 /*0x0001*/ +#define ARQ_FB_IE_ACK_TYPE_MASK 0x6000 /*0x0006*/ +#define ARQ_FB_IE_BSN_MASK 0x1FFC /*0x3FF8*/ +#define ARQ_FB_IE_NUM_MAPS_MASK 0x0003 /*0xC000*/ +#define ARQ_FB_IE_SEQ_FORMAT_MASK 0x8000 /*0x0001*/ +#define ARQ_FB_IE_SEQ_ACK_MAP_MASK 0x7000 /*0x000E*/ +#define ARQ_FB_IE_SEQ1_LENGTH_MASK 0x0F00 /*0x00F0*/ +#define ARQ_FB_IE_SEQ2_LENGTH_MASK 0x00F0 /*0x0F00*/ +#define ARQ_FB_IE_SEQ3_LENGTH_MASK 0x000F /*0xF000*/ +#define ARQ_FB_IE_SEQ_ACK_MAP_2_MASK 0x6000 /*0x0006*/ +#define ARQ_FB_IE_SEQ1_LENGTH_6_MASK 0x1F80 /*0x01F8*/ +#define ARQ_FB_IE_SEQ2_LENGTH_6_MASK 0x007E /*0x7E00*/ +#define ARQ_FB_IE_RSV_MASK 0x0001 /*0x8000*/ + +static gint hf_mac_header_generic_arq_fb_ie_cid = -1; +static gint hf_mac_header_generic_arq_fb_ie_last = -1; +static gint hf_mac_header_generic_arq_fb_ie_ack_type = -1; +static gint hf_mac_header_generic_arq_fb_ie_bsn = -1; +static gint hf_mac_header_generic_arq_fb_ie_num_maps = -1; +static gint hf_ack_type_reserved = -1; +static gint hf_mac_header_generic_arq_fb_ie_sel_ack_map = -1; +static gint hf_mac_header_generic_arq_fb_ie_seq_format = -1; +static gint hf_mac_header_generic_arq_fb_ie_seq_ack_map = -1; +static gint hf_mac_header_generic_arq_fb_ie_seq1_length = -1; +static gint hf_mac_header_generic_arq_fb_ie_seq2_length = -1; +static gint hf_mac_header_generic_arq_fb_ie_seq3_length = -1; +static gint hf_mac_header_generic_arq_fb_ie_seq_ack_map_2 = -1; +static gint hf_mac_header_generic_arq_fb_ie_seq1_length_6 = -1; +static gint hf_mac_header_generic_arq_fb_ie_seq2_length_6 = -1; +static gint hf_mac_header_generic_arq_fb_ie_rsv = -1; + +/* Last IE Indicators */ +static const value_string last_ie_msgs[] = +{ + { 0, "No" }, + { 1, "Yes" }, + { 0, NULL} +}; + +/* ARQ Feedback Payload display */ +static hf_register_info hf_arq[] = +{ + { + &hf_mac_header_generic_arq_fb_ie_cid, + { + "CID", "wimax.genericArq.FbIeCid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_last, + { + "Last IE", "wimax.genericArq.FbIeLast", + FT_UINT16, BASE_DEC, VALS(last_ie_msgs), ARQ_FB_IE_LAST_BIT_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_ack_type, + { + "ACK Type", "wimax.genericArq.FbIeAckType", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_ACK_TYPE_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_bsn, + { + "BSN", "wimax.genericArq.FbIeBsn", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_BSN_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_num_maps, + { + "Number of ACK Maps", "wimax.genericArq.FbIeMaps", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_NUM_MAPS_MASK, + "", HFILL + } + }, + { + &hf_ack_type_reserved, + { + "Reserved", "wimax.genericArq.FbIeRsvd", FT_UINT16, BASE_DEC, NULL, 0x03, "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_sel_ack_map, + { + "Selective ACK Map", "wimax.genericArq.FbIeSelAckMap", + FT_UINT16, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_seq_format, + { + "Sequence Format", "wimax.genericArq.FbIeSeqFmt", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_SEQ_FORMAT_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_seq_ack_map, + { + "Sequence ACK Map", "wimax.genericArq.FbIeSeqAckMap", + FT_UINT16, BASE_HEX, NULL, ARQ_FB_IE_SEQ_ACK_MAP_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_seq1_length, + { + "Sequence 1 Length", "wimax.genericArq.FbIeSeq1Len", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_SEQ1_LENGTH_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_seq2_length, + { + "Sequence 2 Length", "wimax.genericArq.FbIeSeq2Len", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_SEQ2_LENGTH_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_seq3_length, + { + "Sequence 3 Length", "wimax.genericArq.FbIeSeq3Len", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_SEQ3_LENGTH_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_seq_ack_map_2, + { + "Sequence ACK Map", "wimax.genericArq.FbIeSeqAckMap2", + FT_UINT16, BASE_HEX, NULL, ARQ_FB_IE_SEQ_ACK_MAP_2_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_seq1_length_6, + { + "Sequence 1 Length", "wimax.genericArq.FbIeSeq1Len", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_SEQ1_LENGTH_6_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_seq2_length_6, + { + "Sequence 2 Length", "wimax.genericArq.FbIeSeq2Len", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_SEQ2_LENGTH_6_MASK, + "", HFILL + } + }, + { + &hf_mac_header_generic_arq_fb_ie_rsv, + { + "Reserved", "wimax.genericArq.FbIeRsv", + FT_UINT16, BASE_DEC, NULL, ARQ_FB_IE_RSV_MASK, + "", HFILL + } + } +}; + +/* Register Wimax defrag table init routine. */ +void wimax_defragment_init(void) +{ + gint i; + + fragment_table_init(&payload_frag_table); + + /* Init fragmentation variables. */ + for (i = 0; i < MAX_CID; i++) + { + cid_adjust[i] = 1; /* Must not start with 0 */ + cid_vernier[i] = 0; + } + cid_adj_array_size = 0; + /* Free the array memory. */ + if (cid_adj_array) { + free(cid_adj_array); + } + cid_adj_array = NULL; + if (frag_num_array) { + free(frag_num_array); + } + frag_num_array = NULL; + + /* Initialize to make sure bs_address gets set in FCH decoder. */ + bs_address.len = 0; + + /* Initialize the Scheduling Service Type flag */ + seen_a_service_type = 0; + + max_logical_bands = 12; + + /* Initialize UL_MAP globals. */ + init_wimax_globals(); +} + +static guint decode_packing_subheader(tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree *tree, guint payload_length, guint payload_offset, proto_item *parent_item) +{ + proto_item *generic_item = NULL; + proto_tree *generic_tree = NULL; + guint starting_offset = payload_offset; + + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Packing subhdr"); + } + /* add the Packing subheader info */ + proto_item_append_text(parent_item, ", Packing Subheader"); + /* display Packing subheader type */ + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, payload_tvb, payload_offset, ((arq_enabled|extended_type)?3:2), "Packing subheader (%u bytes)", ((arq_enabled|extended_type)?3:2)); + /* add Packing subheader subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_pkt_subheader_decoder); + /* decode and display the Packing subheader */ + /* Get the fragment type */ + frag_type = (tvb_get_guint8(payload_tvb, payload_offset) & FRAGMENT_TYPE_MASK) >> 6; + /* if ARQ Feedback payload is present */ + if (arq_fb_payload) + { /* get the frag length */ + frag_len = ((tvb_get_ntohl(payload_tvb, payload_offset) & FRAG_LENGTH_MASK) >> 8); + /* get the sequence number */ + seq_number = (tvb_get_ntohs(payload_tvb, payload_offset) & SEQ_NUMBER_MASK_11) >> 3; + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_fc_ext, payload_tvb, payload_offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_bsn, payload_tvb, payload_offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_len_ext, payload_tvb, payload_offset, 3, FALSE); + /* update the length and offset */ + payload_length -= 3; + payload_offset += 3; + frag_len -= 3; + } + else + { + if (extended_type) + { /* get the frag length */ + frag_len = ((tvb_get_ntohl(payload_tvb, payload_offset) & FRAG_LENGTH_MASK) >> 8); + /* get the sequence number */ + seq_number = (tvb_get_ntohs(payload_tvb, payload_offset) & SEQ_NUMBER_MASK_11) >> 3; + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_fc_ext, payload_tvb, payload_offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_fsn_ext, payload_tvb, payload_offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_len_ext, payload_tvb, payload_offset, 3, FALSE); + /* update the length and offset */ + payload_length -= 3; + payload_offset += 3; + frag_len -= 3; + } + else + { /* get the frag length */ + frag_len = (tvb_get_ntohs(payload_tvb, payload_offset) & PACKING_SUBHEADER_LENGTH_MASK); + /* get the sequence number */ + seq_number = (tvb_get_guint8(payload_tvb, payload_offset) & SEQ_NUMBER_MASK) >> 3; + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_fc, payload_tvb, payload_offset, 2, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_fsn, payload_tvb, payload_offset, 2, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_packing_subhd_len, payload_tvb, payload_offset, 2, FALSE); + /* update the length and offset */ + payload_length -= 2; + payload_offset += 2; + frag_len -= 2; + } + } + /* Prevent a crash! */ + if ((gint)frag_len < 0) + frag_len = 0; + /* Return the number of bytes decoded. */ + return payload_offset - starting_offset; +} + +/* Register Wimax Generic Mac Header Protocol and Dissector */ +void proto_register_mac_header_generic(void) +{ + if (proto_mac_header_generic_decoder == -1) + { + proto_mac_header_generic_decoder = proto_register_protocol ( + "WiMax Generic/Type1/Type2 MAC Header Messages", /* name */ + "WiMax Generic/Type1/Type2 MAC Header (hdr)", /* short name */ + "hdr" /* abbrev */ + ); + /* register the field display messages */ + proto_register_field_array(proto_mac_header_generic_decoder, hf, array_length(hf)); + proto_register_field_array(proto_mac_header_generic_decoder, hf_ext, array_length(hf_ext)); + proto_register_field_array(proto_mac_header_generic_decoder, hf_mesh, array_length(hf_mesh)); + proto_register_field_array(proto_mac_header_generic_decoder, hf_frag, array_length(hf_frag)); + proto_register_field_array(proto_mac_header_generic_decoder, hf_pack, array_length(hf_pack)); + proto_register_field_array(proto_mac_header_generic_decoder, hf_fast, array_length(hf_fast)); + proto_register_field_array(proto_mac_header_generic_decoder, hf_grant, array_length(hf_grant)); + proto_register_field_array(proto_mac_header_generic_decoder, hf_arq, array_length(hf_arq)); + proto_register_subtree_array(ett, array_length(ett)); + } + /* register the generic mac header dissector */ + register_dissector("mac_header_generic_handler", dissect_mac_header_generic_decoder, proto_mac_header_generic_decoder); + /* register the mac payload dissector */ + proto_register_mac_mgmt_msg(); + /* Register the payload fragment table init routine */ + register_init_routine(wimax_defragment_init); +} + +void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint payload_offset, payload_length; + + static guint8 frag_number[MAX_CID]; + static guint cid_list[MAX_CID]; + static guint cid_base; + static char *reassem_str = "Reassembled Data transport PDU (%u bytes)"; + static char *data_str = "Data transport PDU (%u bytes)"; + char *str_ptr; + gint length, i, cid_index; + guint tvb_len, ret_length, ubyte, new_tvb_len, new_payload_len; + guint mac_ht, mac_ec, mac_esf, mac_ci, mac_eks, mac_len, mac_cid, cid; + guint ffb_grant_mgmt_subheader, packing_subheader, fragment_subheader; + guint mesh_subheader; + guint packing_length; + guint32 mac_crc, calculated_crc; + proto_item *parent_item = NULL; + proto_item *generic_item = NULL; + proto_tree *generic_tree = NULL; + proto_item *child_item = NULL; + proto_tree *child_tree = NULL; + tvbuff_t *payload_tvb; + tvbuff_t *data_pdu_tvb; + fragment_data *payload_frag; + gboolean first_arq_fb_payload = TRUE; + + dissector_handle_t mac_payload_handle; + + proto_mac_header_generic_decoder = proto_wimax; + if (tree) + { /* we are being asked for details */ +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "GMH"); + } +#endif + /* Get the frame length */ + tvb_len = tvb_length(tvb); + if (tvb_len < WIMAX_MAC_HEADER_SIZE) + { /* display the error message */ + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, tvb_len, "Error: the size of Generic MAC Header tvb is too small! (%u bytes)", tvb_len); + /* add subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_header_generic_decoder); + /* display the Generic MAC Header in Hex */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_value_bytes, tvb, offset, tvb_len, FALSE); + return; + } + /* get the parent */ + parent_item = proto_tree_get_parent(tree); + /* add the MAC header info */ + proto_item_append_text(parent_item, " - Generic MAC Header"); + /* display MAC header message */ + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, WIMAX_MAC_HEADER_SIZE, "Generic MAC Header (%u bytes)", WIMAX_MAC_HEADER_SIZE); + /* add MAC header subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_header_generic_decoder); + /* Decode and display the MAC header */ + /* Get the first byte */ + ubyte = tvb_get_guint8(tvb, offset); + /* get the Header Type (HT) */ + mac_ht = ((ubyte & WIMAX_MAC_HEADER_GENERIC_HT_MASK)?1:0); + /* get the Encryption Control (EC) */ + mac_ec = ((ubyte & WIMAX_MAC_HEADER_GENERIC_EC_MASK)?1:0); + /* get the sub types */ + ffb_grant_mgmt_subheader = ((ubyte & GENERIC_SUB_TYPE_0)?1:0); + packing_subheader = ((ubyte & GENERIC_SUB_TYPE_1)?1:0); + fragment_subheader = ((ubyte & GENERIC_SUB_TYPE_2)?1:0); + extended_type = ((ubyte & GENERIC_SUB_TYPE_3)?1:0); + arq_fb_payload = ((ubyte & GENERIC_SUB_TYPE_4)?1:0); + mesh_subheader = ((ubyte & GENERIC_SUB_TYPE_5)?1:0); + /* Get the 2nd byte */ + ubyte = tvb_get_guint8(tvb, (offset+1)); + /* get the Extended subheader field (ESF) */ + mac_esf = ((ubyte & WIMAX_MAC_HEADER_GENERIC_ESF_MASK)?1:0); + /* get the CRC indicator (CI) */ + mac_ci = ((ubyte & WIMAX_MAC_HEADER_GENERIC_CI_MASK)?1:0); + /* get the Encryption key sequence (EKS) */ + mac_eks = ((ubyte & WIMAX_MAC_HEADER_GENERIC_EKS_MASK)>>4); + /* get the MAC length */ + mac_len = (tvb_get_ntohs(tvb, (offset+1)) & WIMAX_MAC_HEADER_GENERIC_LEN); + /* get the CID */ + mac_cid = tvb_get_ntohs(tvb, (offset+3)); + /* display the Header Type (HT) */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_ht, tvb, offset, 3, FALSE); + /* display the Encryption Control (EC) */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_ec, tvb, offset, 3, FALSE); + /* display the sub-types (Type) */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_type_5, tvb, offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_type_4, tvb, offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_type_3, tvb, offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_type_2, tvb, offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_type_1, tvb, offset, 3, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_type_0, tvb, offset, 3, FALSE); + /* display the Extended sub-header Field (ESF) */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_esf, tvb, offset, 3, FALSE); + /* display the CRC Indicator (CI) */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_ci, tvb, offset, 3, FALSE); + /* display the Encryption Key Sequence (EKS) */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_eks, tvb, offset, 3, FALSE); + /* display the reserved field */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_rsv, tvb, offset, 3, FALSE); + /* display the length */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_len, tvb, offset, 3, FALSE); + /* Decode and display the CID */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_cid, tvb, (offset+3), 2, FALSE); + /* Decode and display the HCS */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_hcs, tvb, (offset+5), 1, FALSE); + /* get the frame length without MAC header */ + length = mac_len - WIMAX_MAC_HEADER_SIZE; +#ifdef DEBUG + proto_item_append_text(parent_item, "tvb length=%u, mac length=%u, frame length=%u,", tvb_len, mac_len, length); +#endif + /* set the offset for the frame */ + offset += WIMAX_MAC_HEADER_SIZE; + /* the processing of the subheaders is order sensitive */ + /* do not change the order */ + + if (mac_ec) + { + if (mac_ci) + { + if (length >= (gint)sizeof(mac_crc)) + { + length -= sizeof(mac_crc); + } + } + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Encrypted PDU (%u bytes)", length); + /* add payload subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_data_pdu_decoder); + proto_tree_add_item(generic_tree, hf_mac_header_generic_value_bytes, tvb, offset, length, FALSE); + goto check_crc; + } + + /* if Extended subheader is present */ + if (mac_esf) + { /* add the Extended subheader info */ + proto_item_append_text(parent_item, ", Extended Subheader(s)"); + ret_length = extended_subheader_decoder(tvb_new_subset(tvb, offset, length, length), pinfo, tree); + /* update the length and offset */ + length -= ret_length; + offset += ret_length; + } + /* if Mesh subheader is present */ + if (mesh_subheader) + { /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Mesh subhdr"); + } + /* add the Mesh subheader info */ + proto_item_append_text(parent_item, ", Mesh Subheader"); + /* display Mesh subheader type */ + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Mesh subheader (2 bytes)"); + /* add Mesh subheader subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_mesh_subheader_decoder); + /* decode and display the Mesh subheader */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_mesh_subheader, tvb, offset, 2, FALSE); + /* update the length and offset */ + length -= 2; + offset += 2; + } + /* if Fast-feedback allocation (DL) subheader or Grant management (UL) subheader is present */ + if (ffb_grant_mgmt_subheader) + { /* check if it is downlink packet */ + if (is_down_link(&(pinfo->src))) + { /* Fast-feedback allocation (DL) subheader is present */ + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Fast-fb subhdr"); + } + /* add the Fast-feedback subheader info */ + proto_item_append_text(parent_item, ", Fast-feedback Subheader"); + /* display Fast-feedback allocation subheader type */ + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Fast-feedback allocation (DL) subheader (%u bytes)", length); + /* add Fast-feedback allocation subheader subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_fast_fb_subheader_decoder); + proto_tree_add_item(generic_tree, hf_mac_header_generic_fast_fb_subhd_alloc_offset, tvb, offset, 1, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_fast_fb_subhd_fb_type, tvb, offset, 1, FALSE); + /* update the length and offset */ + length -= 1; + offset += 1; + } + else /* Grant management (UL) subheader is present */ + { /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Grant mgmt subhdr"); + } + /* add the Grant management subheader info */ + proto_item_append_text(parent_item, ", Grant Management Subheader"); + /* display Grant management subheader type */ + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, 2, "Grant management (UL) subheader (2 bytes)"); + /* add Grant management subheader subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_grant_mgmt_subheader_decoder); + scheduling_service_type = get_service_type(); + switch (scheduling_service_type) + { + case SCHEDULE_SERVICE_TYPE_UGS: + proto_item_append_text(generic_item, ": It looks like UGS is the correct Scheduling Service Type"); + break; + case SCHEDULE_SERVICE_TYPE_EXT_RTPS: + proto_item_append_text(generic_item, ": It looks like Extended rtPS is the correct Scheduling Service Type"); + break; + case -1: + proto_item_append_text(generic_item, ": Cannot determine the correct Scheduling Service Type"); + break; + default: + proto_item_append_text(generic_item, ": It looks like Piggyback Request is the correct Scheduling Service Type"); + break; + } + /* Create tree for Scheduling Service Type (UGS) */ + child_item = proto_tree_add_item(generic_tree, hf_mac_header_generic_grant_mgmt_ugs_tree, tvb, offset, 2, FALSE); + child_tree = proto_item_add_subtree(child_item, ett_mac_grant_mgmt_subheader_decoder); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_ugs_si, tvb, offset, 2, FALSE); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_ugs_pm, tvb, offset, 2, FALSE); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_ugs_fli, tvb, offset, 2, FALSE); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_ugs_fl, tvb, offset, 2, FALSE); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_ugs_rsv, tvb, offset, 2, FALSE); + + /* Create tree for Scheduling Service Type (Extended RTPS) */ + child_item = proto_tree_add_item(generic_tree, hf_mac_header_generic_grant_mgmt_ext_rtps_tree, tvb, offset, 2, FALSE); + child_tree = proto_item_add_subtree(child_item, ett_mac_grant_mgmt_subheader_decoder); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_ext_pbr, tvb, offset, 2, FALSE); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_ext_fli, tvb, offset, 2, FALSE); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_ext_fl, tvb, offset, 2, FALSE); + + /* Create tree for Scheduling Service Type (Piggyback Request) */ + child_item = proto_tree_add_item(generic_tree, hf_mac_header_generic_grant_mgmt_ext_pbr_tree, tvb, offset, 2, FALSE); + child_tree = proto_item_add_subtree(child_item, ett_mac_grant_mgmt_subheader_decoder); + proto_tree_add_item(child_tree, hf_mac_header_generic_grant_mgmt_subhd_pbr, tvb, offset, 2, FALSE); + + /* update the length and offset */ + length -= 2; + offset += 2; + } + } + /* if Fragmentation subheader is present */ + if (fragment_subheader) + { /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Frag subhdr"); + } + /* add the Fragmentation subheader info */ + proto_item_append_text(parent_item, ", Frag Subheader"); + /* display Fragmentation subheader type */ + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, ((arq_enabled|extended_type)?2:1), "Fragmentation subheader (%u bytes)", ((arq_enabled|extended_type)?2:1)); + /* add Fragmentation subheader subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_frag_subheader_decoder); + /* Get the fragment type */ + frag_type = (tvb_get_guint8(tvb, offset) & FRAGMENT_TYPE_MASK) >> 6; + if (arq_fb_payload) + { /* get the sequence number */ + seq_number = (tvb_get_ntohs(tvb, offset) & SEQ_NUMBER_MASK_11) >> 3; + /* decode and display the header */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_fc_ext, tvb, offset, 2, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_bsn, tvb, offset, 2, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_rsv_ext, tvb, offset, 2, FALSE); + /* update the length and offset */ + length -= 2; + offset += 2; + } + else + { + if (extended_type) + { /* get the sequence number */ + seq_number = (tvb_get_ntohs(tvb, offset) & SEQ_NUMBER_MASK_11) >> 3; + /* decode and display the header */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_fc_ext, tvb, offset, 2, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_fsn_ext, tvb, offset, 2, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_rsv_ext, tvb, offset, 2, FALSE); + /* update the length and offset */ + length -= 2; + offset += 2; + } + else + { /* get the sequence number */ + seq_number = (tvb_get_guint8(tvb, offset) & SEQ_NUMBER_MASK) >> 3; + /* decode and display the header */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_fc, tvb, offset, 1, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_fsn, tvb, offset, 1, FALSE); + proto_tree_add_item(generic_tree, hf_mac_header_generic_frag_subhd_rsv, tvb, offset, 1, FALSE); + /* update the length and offset */ + length -= 1; + offset += 1; + } + } + frag_len = length; + } + else /* ??? default fragment type: no fragment */ + { + frag_type = NO_FRAG; + } + /* Decode the MAC payload if there is any */ + if (mac_ci) + { + if (length < (gint)sizeof(mac_crc)) + { /* display error message */ + proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Error - the frame is too short (%u bytes)", length); + return; + } + length -= sizeof(mac_crc); + } + while (length > 0) + { + frag_len = length; /* Can be changed by Packing subhdr */ + if (packing_subheader) + { + packing_length = decode_packing_subheader(tvb, pinfo, tree, length, offset, parent_item); + length -= packing_length; + offset += packing_length; + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, frag_len, "Data transport PDU (%u bytes)", frag_len); + /* add payload subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_data_pdu_decoder); + proto_tree_add_item(generic_tree, hf_mac_header_generic_value_bytes, tvb, offset, frag_len, FALSE); + } + /* defragment first if it is fragmented */ + if (frag_type == NO_FRAG) + { /* not fragmented payload */ + payload_tvb = tvb_new_subset(tvb, offset, length, length); + payload_length = length; + new_payload_len = length; + } + else /* fragmented payload */ + { /* add the frag */ + /* Make sure cid will not match a previous packet with different data */ + for (i = 0; i < MAX_CID; i++) + { + if (cid_list[i] == mac_cid) + { + cid_base = i * (0xFFFFFFFF / MAX_CID); + break; + } + if (cid_list[i] == 0) + { + cid_list[i] = mac_cid; + cid_base = i * (0xFFFFFFFF / MAX_CID); + break; + } + } + cid_index = i; + while (pinfo->fd->num > cid_adj_array_size) + { + cid_adj_array_size += 1024; + cid_adj_array = g_realloc(cid_adj_array, sizeof(guint) * cid_adj_array_size); + frag_num_array = g_realloc(frag_num_array, sizeof(guint8) * cid_adj_array_size); + /* Clear the added memory */ + memset(&cid_adj_array[cid_adj_array_size - 1024], 0, sizeof(guint) * 1024); + } + if (first_gmh) + { + /* New cid_adjust for each packet with fragment(s) */ + cid_adjust[cid_index] += cid_vernier[cid_index]; + /* cid_vernier must always be 0 at start of packet. */ + cid_vernier[cid_index] = 0; + } + /* Create artificial sequence numbers. */ + frag_number[cid_index]++; + if (frag_type == FIRST_FRAG) + { + frag_number[cid_index] = 0; + } + if (cid_adj_array[pinfo->fd->num]) + { + /* We apparently just clicked on the packet again. */ + cid_adjust[cid_index] = cid_adj_array[pinfo->fd->num]; + /* Set the frag_number at start of packet. */ + if (first_gmh) + { + frag_number[cid_index] = frag_num_array[pinfo->fd->num]; + } + } else { + /* Save for next time we click on this packet. */ + cid_adj_array[pinfo->fd->num] = cid_adjust[cid_index]; + if (first_gmh) + { + frag_num_array[pinfo->fd->num] = frag_number[cid_index]; + } + } + /* Reset in case we stay in this while() loop to finish the packet. */ + first_gmh = FALSE; + cid = cid_base + cid_adjust[cid_index] + cid_vernier[cid_index]; + /* Save address pointers. */ + save_src = pinfo->src; + save_dst = pinfo->dst; + /* Use dl_src and dl_dst in defrag. */ + pinfo->src = pinfo->dl_src; + pinfo->dst = pinfo->dl_dst; + payload_frag = fragment_add_seq(tvb, offset, pinfo, cid, payload_frag_table, frag_number[cid_index], frag_len, ((frag_type==LAST_FRAG)?0:1)); + /* Restore address pointers. */ + pinfo->src = save_src; + pinfo->dst = save_dst; + if (frag_type == LAST_FRAG) + { + /* Make sure fragment_add_seq() sees next one as a new frame. */ + cid_vernier[cid_index]++; + } + /* Don't show reassem packet until last frag. */ + proto_tree_add_text(tree, tvb, offset, frag_len, "Payload Fragment (%d bytes)", frag_len); + + if (payload_frag && frag_type == LAST_FRAG) + { /* defragmented completely */ + payload_length = payload_frag->len; + /* create the new tvb for defragmented frame */ + payload_tvb = tvb_new_real_data(payload_frag->data, payload_length, payload_length); + /* attach the payload_tvb to tvb so that it will be cleaned up when tvb is cleaned up */ + tvb_set_child_real_data_tvbuff(tvb, payload_tvb); + /* add the defragmented data to the data source list */ + add_new_data_source(pinfo, payload_tvb, "Reassembled WiMax MAC payload"); + /* save the tvb langth */ + new_payload_len = payload_length; + } + else /* error or defragment is not complete */ + { + payload_tvb = NULL; +#ifdef DEBUG /* for debug only */ +/* if (frag_type == LAST_FRAG)*/ + { /* error */ + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Dropped the incomplete frame"); + } +#endif +#if 0 + if (frag_type == FIRST_FRAG) + { /* Set up to decode the first fragment (even though next fragment not read yet) */ + payload_tvb = tvb_new_subset(tvb, offset, length, length); + payload_length = length; + frag_len = length; + } +#endif + } + } + /* process the defragmented payload */ + if (payload_tvb) + { /* reset the payload_offset */ + payload_offset = 0; + /* process the payload */ + if (payload_length > 0) + { + if (!new_payload_len) + continue; + /* if ARQ Feedback payload is present, it should be the first SDU */ + if (first_arq_fb_payload && arq_fb_payload) + { /* decode and display the ARQ feedback payload */ + first_arq_fb_payload = FALSE; + ret_length = arq_feedback_payload_decoder(tvb_new_subset(payload_tvb, payload_offset, new_payload_len, new_payload_len), pinfo, generic_tree, parent_item); +#ifdef DEBUG /* for debug only */ + if (ret_length != new_payload_len) + { /* error */ + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "incorrect ARQ fb payload size"); + } +#endif + } + else /* decode SDUs */ + { /* check the payload type */ + if (mac_cid == cid_padding) + { /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Padding CID"); + } + /* get the parent */ + generic_item = proto_tree_get_parent(tree); + /* add the MAC header info */ + proto_item_append_text(generic_item, ", Padding CID"); + /* display padding CID */ + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, payload_tvb, payload_offset, new_payload_len, "Padding CID (%u bytes)", new_payload_len); + /* add payload subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_header_generic_decoder); + /* display the Padding CID payload in Hex */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_value_bytes, payload_tvb, payload_offset, new_payload_len, FALSE); + } + else if ((mac_cid <= (2 * global_cid_max_basic)) || (mac_cid == cid_aas_ranging) + || (mac_cid >= cid_normal_multicast)) + { /* MAC management message */ + dissect_mac_mgmt_msg_decoder(tvb_new_subset(payload_tvb, payload_offset, new_payload_len, new_payload_len), pinfo, tree); + } + else /* data transport PDU */ + { /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Data"); + } + /* add the MAC payload info */ + proto_item_append_text(parent_item, ", Data"); + /* display payload info */ + if ((new_payload_len + payload_offset) > payload_length) + { + new_tvb_len = new_payload_len - payload_offset; + } + else + { + new_tvb_len = new_payload_len; + } + if (frag_type == LAST_FRAG || frag_type == NO_FRAG) + { + if (frag_type == NO_FRAG) + { + str_ptr = data_str; + new_payload_len = frag_len; + } + else + { + str_ptr = reassem_str; + } + { + data_pdu_tvb = tvb_new_subset(payload_tvb, payload_offset, new_tvb_len, new_tvb_len); + generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, data_pdu_tvb, payload_offset, new_payload_len, str_ptr, new_payload_len); + /* add payload subtree */ + generic_tree = proto_item_add_subtree(generic_item, ett_mac_data_pdu_decoder); + /* check the data type */ + if (tvb_get_guint8(payload_tvb, payload_offset) == IP_HEADER_BYTE) + { + mac_payload_handle = find_dissector("ip"); + if (mac_payload_handle) + call_dissector(mac_payload_handle, tvb_new_subset(payload_tvb, payload_offset, new_tvb_len, new_tvb_len), pinfo, generic_tree); + else /* display the Generic MAC Header in Hex */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_value_bytes, payload_tvb, payload_offset, new_tvb_len, FALSE); + } + else /* display the Generic MAC Header in Hex */ + proto_tree_add_item(generic_tree, hf_mac_header_generic_value_bytes, payload_tvb, payload_offset, new_tvb_len, FALSE); + } + } + } + } + payload_length -= new_payload_len; + payload_offset += new_payload_len; + } /* end of while loop */ + } /* end of payload processing */ + length -= frag_len; + offset += frag_len; + } /* end of payload decoding */ +check_crc: + /* Decode and display the CRC if it is present */ + if (mac_ci) + { + /* add the CRC info */ + proto_item_append_text(parent_item, ", CRC"); + /* check the length */ + if (MIN(tvb_len, tvb_reported_length(tvb)) >= mac_len) + { /* get the CRC */ + mac_crc = tvb_get_ntohl(tvb, mac_len - sizeof(mac_crc)); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc32((guint8 *)tvb_get_ptr(tvb, 0, mac_len - sizeof(mac_crc)), mac_len - sizeof(mac_crc)); + /* display the CRC */ + generic_item = proto_tree_add_item(tree, hf_mac_header_generic_crc, tvb, mac_len - sizeof(mac_crc), sizeof(mac_crc), FALSE); + if (mac_crc != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + } + else + { /* display error message */ + proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, 0, tvb_len, "CRC missing - the frame is too short (%u bytes)", tvb_len); + } + } + else /* CRC is not included */ + { /* add the CRC info */ + proto_item_append_text(parent_item, ", No CRC"); + /* display message */ + proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, 0, tvb_len, "CRC is not included in this frame!"); + } + } +} + +static gint extended_subheader_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + gint offset = 0; + gint length, ext_length, ubyte, i; + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + proto_tree *ti_tree = NULL; + + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Ext subhdrs"); + } + + /* Get the tvb length */ + length = tvb_length(tvb); + if (!length) + { /* display the error message */ + proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Error: extended subheader tvb is empty ! (%u bytes)", length); + return length; + } + + /* Get the length of the extended subheader group */ + ext_length = tvb_get_guint8(tvb, offset); + /* display subheader type */ + ti = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Extended subheader group (%u bytes)", ext_length); + /* add extended subheader subtree */ + sub_tree = proto_item_add_subtree(ti, ett_mac_ext_subheader_decoder); + /* decode and display the extended subheaders */ + for (i=1; i<ext_length;) + { /* Get the extended subheader type */ + ubyte = (tvb_get_guint8(tvb, (offset+i)) & EXTENDED_SUB_HEADER_TYPE_MASK); + /* decode and display the extended subheader type (MSB) */ + proto_tree_add_item(sub_tree, hf_mac_header_generic_ext_subheader_rsv, tvb, (offset+i), 1, FALSE); + /* for downlink */ + if (is_down_link(&(pinfo->src))) /* for downlink */ + { /* decode and display the extended subheader type */ + ti = proto_tree_add_item(sub_tree, hf_mac_header_generic_ext_subheader_type_dl, tvb, (offset+i), 1, FALSE); + /* add subtree */ + ti_tree = proto_item_add_subtree(ti, ett_mac_ext_subheader_dl_decoder); + i++; + switch (ubyte) + { + case SDU_SN: + /* decode and display the extended sdu sn subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_sdu_sn, tvb, (offset+i), 1, FALSE); + i++; + break; + case DL_SLEEP_CONTROL: + /* decode and display the extended dl sleep control subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_dl_sleep_control_pscid, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_dl_sleep_control_op, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_dl_sleep_control_fswe, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_dl_sleep_control_fswb, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_dl_sleep_control_rsv, tvb, (offset+i), 3, FALSE); + i += 3; + break; + case FEEDBACK_REQ: + /* decode and display the extended feedback request subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_fb_req_uiuc, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_fb_req_fb_type, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_fb_req_ofdma_symbol_offset, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_fb_req_subchannel_offset, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_fb_req_slots, tvb, (offset+i), 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_fb_req_frame_offset, tvb, (offset+i), 3, FALSE); + i += 3; + break; + case SN_REQ: + /* decode and display the extended SN request subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_sn_req_rep_ind_1, tvb, (offset+i), 1, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_sn_req_rep_ind_2, tvb, (offset+i), 1, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_sn_req_rsv, tvb, (offset+i), 1, FALSE); + i++; + break; + case PDU_SN_SHORT_DL: + /* decode and display the extended pdu sn (short) subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_pdu_sn_short, tvb, (offset+i), 1, FALSE); + i++; + break; + case PDU_SN_LONG_DL: + /* decode and display the extended pdu sn (long) subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_pdu_sn_long, tvb, (offset+i), 2, FALSE); + i += 2; + break; + default: /* reserved */ + break; + } + } + else /* for uplink */ + { /* decode and display the extended subheader type */ + ti = proto_tree_add_item(sub_tree, hf_mac_header_generic_ext_subheader_type_ul, tvb, (offset+i), 1, FALSE); + /* add subtree */ + ti_tree = proto_item_add_subtree(ti, ett_mac_ext_subheader_ul_decoder); + i++; + switch (ubyte) + { + case MIMO_MODE_FEEDBACK: + /* decode and display the extended MIMO Mode Feedback subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_mimo_mode_fb_type, tvb, (offset+i), 1, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_mimo_fb_content, tvb, (offset+i), 1, FALSE); + i++; + break; + case UL_TX_POWER_REPORT: + /* decode and display the extended ul tx power report subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_ul_tx_pwr_rep, tvb, (offset+i), 1, FALSE); + i++; + break; + case MINI_FEEDBACK: + /* decode and display the extended MINI Feedback subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_mini_fb_type, tvb, (offset+i), 2, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_mini_fb_content, tvb, (offset+i), 2, FALSE); + i += 2; + break; + case PDU_SN_SHORT_UL: + /* decode and display the extended pdu sn (short) subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_pdu_sn_short, tvb, (offset+i), 1, FALSE); + i++; + break; + case PDU_SN_LONG_UL: + /* decode and display the extended pdu sn (long) subheader */ + proto_tree_add_item(ti_tree, hf_mac_header_generic_ext_subheader_pdu_sn_long, tvb, (offset+i), 2, FALSE); + i += 2; + break; + default: /* reserved */ + break; + } + } + } + /* return the extended subheader length */ + return ext_length; +} + +static gint arq_feedback_payload_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *parent_item) +{ + gint length, i; + gint offset; + gint last_ie = 0; + gint ack_type, num_maps, seq_format; + gint word2, word3; + proto_item *ti = NULL; + proto_item *sub_ti = NULL; + proto_tree *sub_tree = NULL; + + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "ARQ feedback payld"); + } + + /* add the MAC header info */ + proto_item_append_text(parent_item, ", ARQ feedback payload"); + + /* reset the offset */ + offset = 0; + + /* Get the tvb length */ + length = tvb_length(tvb); + if (!length) + { /* display the error message */ + proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Error: ARQ feedback payload tvb is empty ! (%u bytes)", length); + return length; + } + + /* display subheader type */ + ti = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "ARQ feedback payload "); + /* add extended subheader subtree */ + sub_tree = proto_item_add_subtree(ti, ett_mac_arq_fb_payload_decoder); + /* decode and display the ARQ Feedback IEs */ + while (!last_ie) + { /* decode and display CID */ + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_cid, tvb, offset, 2, FALSE); + /* move to next 16-bit word */ + offset += 2; + /* Get the 2nd 16-bit */ + word2 = tvb_get_ntohs(tvb, offset); + /* get the last bit */ + last_ie = (word2 & ARQ_FB_IE_LAST_BIT_MASK); + /* get the ACK type */ + ack_type = ((word2 & ARQ_FB_IE_ACK_TYPE_MASK) >> 13); + /* get the number of ACK maps */ + num_maps = (word2 & ARQ_FB_IE_NUM_MAPS_MASK) + 1; + /* decode and display the 2nd word */ + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_last, tvb, offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_ack_type, tvb, offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_bsn, tvb, offset, 2, FALSE); + /* decode and display the 3rd word */ + if (ack_type != 1) + { + sub_ti = proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_num_maps, tvb, offset, 2, FALSE); + /* move to next 16-bit word */ + offset += 2; + proto_item_append_text(sub_ti, " (%d map(s))", num_maps); + for (i = 0; i < num_maps; i++) + { + if (ack_type != 3) + { + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_sel_ack_map, tvb, offset, 2, FALSE); + } + else + { /* Get the next 16-bit */ + word3 = tvb_get_ntohs(tvb, offset); + /* get the sequence format */ + seq_format = (word3 & ARQ_FB_IE_SEQ_FORMAT_MASK); + /* decode and display the sequence format */ + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_seq_format, tvb, offset, 2, FALSE); + if (!seq_format) + { + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_seq_ack_map_2, tvb, offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_seq1_length_6, tvb, offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_seq2_length_6, tvb, offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_rsv, tvb, offset, 2, FALSE); + } + else + { + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_seq_ack_map, tvb, offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_seq1_length, tvb, offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_seq2_length, tvb, offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_mac_header_generic_arq_fb_ie_seq3_length, tvb, offset, 2, FALSE); + } + } + /* move to next 16-bit word */ + offset += 2; + } + } + else + { + /* Number of ACK Maps bits are reserved when ACK TYPE == 1 */ + proto_tree_add_item(sub_tree, hf_ack_type_reserved, tvb, offset, 2, FALSE); + /* move to next 16-bit word */ + offset += 2; + } + } + /* append text */ + proto_item_append_text(ti,"(%u bytes)", offset); + /* return the offset */ + return offset; +} diff --git a/plugins/wimax/mac_hd_type1_decoder.c b/plugins/wimax/mac_hd_type1_decoder.c new file mode 100644 index 0000000000..148364c626 --- /dev/null +++ b/plugins/wimax/mac_hd_type1_decoder.c @@ -0,0 +1,575 @@ +/* mac_hd_type1_decoder.c + * WiMax MAC Type I Signaling Header decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* TODO: Add FT_UINT24 and FT_INT24 cases to gtk_widget_get_toplevel() + * to prevent having to make all the changes from BASE_DEC to BASE_HEX + * made to this file today: 10/20/06. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* +#define DEBUG +*/ + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> + +extern gint proto_mac_header_generic_decoder; + +/* forward reference */ +void proto_register_mac_header_type_1(void); +void dissect_mac_header_type_1_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_header_type_1_decoder = -1; +static gint ett_mac_header_type_1_decoder = -1; +static gint hf_mac_header_type_1_value_bytes = -1; + +#define WIMAX_MAC_HEADER_SIZE 6 + +/* WiMax MAC Header Type I Sub Types */ +enum +{ + BR_INCREMENTAL, /* 0 */ + BR_AGGREGATE, /* 1 */ + PHY_CHANNEL_REPORT, /* 2 */ + BR_WITH_UL_TX_POWER_REPORT,/* 3 */ + BR_AND_CINR_REPORT, /* 4 */ + BR_WITH_UL_SLEEP_CONTROL, /* 5 */ + SN_REPORT, /* 6 */ + CQICH_ALLOCATION_REQUEST, /* 7 */ + TYPE_I_SUBTYPE_MAX +} TYPE_I_SUBTYPE; + +static char *type1_subtype_abbrv[TYPE_I_SUBTYPE_MAX] = +{ + "BR INCREMENTAL", /* 0 */ + "BR AGGREGATE", /* 1 */ + "PHY CHANNEL_REPORT", /* 2 */ + "BR WITH UL TX POWER_REPORT",/* 3 */ + "BR AND CINR REPORT", /* 4 */ + "BR WITH UL SLEEP CONTROL", /* 5 */ + "SN REPORT", /* 6 */ + "CQICH ALLOCATION REQUEST" /* 7 */ +}; + +#define WIMAX_MAC_HEADER_TYPE_1_SUB_TYPE_MASK 0x38 + +/* WIMAX MAC HEADER TYPE I FILEDS */ +/* 1st to 3rd bytes */ +/* Common Fields */ +#define WIMAX_MAC_HEADER_TYPE_1_HT 0x800000 +#define WIMAX_MAC_HEADER_TYPE_1_EC 0x400000 +#define WIMAX_MAC_HEADER_TYPE_1_TYPE 0x380000 +/* Bandwidth Request Incremental Header (type 0) & + Bandwidth Request Aggregate Header (type 1) only */ +#define WIMAX_MAC_HEADER_TYPE_1_BR 0x07FFFF +/* PHY Channel Report Header (type 2) only */ +#define WIMAX_MAC_HEADER_TYPE_1_DIUC 0x078000 +#define WIMAX_MAC_HEADER_TYPE_1_UL_TX_PWR 0x007F80 +#define WIMAX_MAC_HEADER_TYPE_1_UL_HDRM 0x00007E +#define WIMAX_MAC_HEADER_TYPE_1_RSV_2 0x000001 +/* Bandwidth Request and UL TX Power Report Header (type 3), + Bandwidth Request and CINR Report Header (type 4), & + Bandwidth Request and Uplink Sleep Control Header (type 5) only */ +#define WIMAX_MAC_HEADER_TYPE_1_BR_3 0x07FF00 +/* Bandwidth Request and UL TX Power Report Header (type 3) only */ +#define WIMAX_MAC_HEADER_TYPE_1_UL_TX_PWR_3 0x0000FF +/* Bandwidth Request and CINR Report Header (type 4) only */ +#define WIMAX_MAC_HEADER_TYPE_1_CINR 0x0000FE +#define WIMAX_MAC_HEADER_TYPE_1_DCI 0x000001 +/* Bandwidth Request and Uplink Sleep Control Header (type 5) only */ +#define WIMAX_MAC_HEADER_TYPE_1_PSCID 0x0000FC +#define WIMAX_MAC_HEADER_TYPE_1_OP 0x000002 +#define WIMAX_MAC_HEADER_TYPE_1_RSV_5 0x000001 +/* SN Report Header (type 6) only */ +#define WIMAX_MAC_HEADER_TYPE_1_LAST 0x040000 +#define WIMAX_MAC_HEADER_TYPE_1_SDU_SN1 0x03F000 +#define WIMAX_MAC_HEADER_TYPE_1_SDU_SN2 0x000FC0 +#define WIMAX_MAC_HEADER_TYPE_1_SDU_SN3 0x00003F +/* CQICH Allocation Request (type 7) only */ +#define WIMAX_MAC_HEADER_TYPE_1_FB_TYPE 0x070000 +#define WIMAX_MAC_HEADER_TYPE_1_FBSSI 0x008000 +#define WIMAX_MAC_HEADER_TYPE_1_PERIOD 0x007000 +#define WIMAX_MAC_HEADER_TYPE_1_RSV_7 0x000FFF +/* 4th to 6th bytes */ +//#define WIMAX_MAC_HEADER_TYPE_1_CID 0xFFFF +//#define WIMAX_MAC_HEADER_TYPE_1_HCS 0xFF +/* Common Fields */ +static int hf_mac_header_type_1_ht = -1; +static int hf_mac_header_type_1_ec = -1; +static int hf_mac_header_type_1_type = -1; +/* type 0 & type 1 only */ +static int hf_mac_header_type_1_br = -1; +/* type 3, type 4, & type 5 only */ +static int hf_mac_header_type_1_br_3 = -1; +/* type 2 only */ +static int hf_mac_header_type_1_diuc = -1; +static int hf_mac_header_type_1_ultxpwr = -1; +static int hf_mac_header_type_1_ulhdrm = -1; +static int hf_mac_header_type_1_rsv_2 = -1; +/* type 3 only */ +static int hf_mac_header_type_1_ultxpwr_3 = -1; +/* type 4 only */ +static int hf_mac_header_type_1_cinr = -1; +static int hf_mac_header_type_1_dci = -1; +/* type 5 only */ +static int hf_mac_header_type_1_pscid = -1; +static int hf_mac_header_type_1_op = -1; +static int hf_mac_header_type_1_rsv_5 = -1; +/* type 6 only */ +static int hf_mac_header_type_1_last = -1; +static int hf_mac_header_type_1_sdu_sn1 = -1; +static int hf_mac_header_type_1_sdu_sn2 = -1; +static int hf_mac_header_type_1_sdu_sn3 = -1; +/* type 7 only */ +static int hf_mac_header_type_1_fb_type = -1; +static int hf_mac_header_type_1_fbssi = -1; +static int hf_mac_header_type_1_period = -1; +static int hf_mac_header_type_1_rsv_7 = -1; +/* Common Fields */ +static int hf_mac_header_type_1_cid = -1; +static int hf_mac_header_type_1_hcs = -1; + +/* MAC Header Type I Sub-Types */ +static const value_string sub_types[] = +{ + { BR_INCREMENTAL, "Bandwidth Request Incremental" }, + { BR_AGGREGATE, "Bandwidth Request Aggregate" }, + { PHY_CHANNEL_REPORT, "PHY Channel Report" }, + { BR_WITH_UL_TX_POWER_REPORT, "Bandwidth Request with UL TX Power Report" }, + { BR_AND_CINR_REPORT, "Bandwidth Request and CINR Report" }, + { BR_WITH_UL_SLEEP_CONTROL, "Bandwidth Request with Sleep Control" }, + { SN_REPORT, "SN Report" }, + { CQICH_ALLOCATION_REQUEST, "CQICH Allocation Request" }, + { 0, NULL} +}; + +/* Feedback Types (need to be changed for type I) */ +static const value_string fb_types[] = +{ + { 0, "CQI and MIMO Feedback" }, + { 1, "DL average CINR" }, + { 2, "MIMO Coefficients Feedback" }, + { 3, "Preferred DL Channel DIUC Feedback" }, + { 4, "UL Transmission Power" }, + { 5, "PHY Channel Feedback" }, + { 6, "AMC Band Indication Bitmap" }, + { 7, "Life Span of Short-term Precoding Feedback" }, + { 0, NULL} +}; + +/* DCD Change Indication messages */ +static const value_string dci_msgs[] = +{ + { 0, "Match DCD Change Count" }, + { 1, "Mismatch DCD Change Count" }, + { 0, NULL} +}; + +/* Operation messages */ +static const value_string op_msgs[] = +{ + { 0, "Deactivate Power Saving Class" }, + { 1, "Activate Power Saving Class" }, + { 0, NULL} +}; + +/* Last ARQ BSN or SDU SN Indication messages */ +static const value_string last_msgs[] = +{ + { 0, "First three connections" }, + { 1, "Last three connections" }, + { 0, NULL} +}; + +/* TLV display */ +static hf_register_info hf[] = +{ + { + &hf_mac_header_type_1_value_bytes, + { + "Values", "wimax.type1ValueBytes", + FT_BYTES, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_type_1_ht, + { + "MAC Header Type", "wimax.type1Ht", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_HT, + "", HFILL + } + }, + { + &hf_mac_header_type_1_ec, + { + "MAC Encryption Control", "wimax.type1Ec", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_EC, + "", HFILL + } + }, + { + &hf_mac_header_type_1_type, + { + "MAC Sub-Type", "wimax.type1Type", + FT_UINT24, BASE_HEX, VALS(sub_types), WIMAX_MAC_HEADER_TYPE_1_TYPE, + "", HFILL + } + }, + { + &hf_mac_header_type_1_br, + { + "Bandwidth Request", "wimax.type1Br", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_BR, + "", HFILL + } + }, + { + &hf_mac_header_type_1_br_3, + { + "Bandwidth Request", "wimax.type1Br3", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_BR_3, + "", HFILL + } + }, + { + &hf_mac_header_type_1_fb_type, + { + "Feedback Type", "wimax.type1FbType", + FT_UINT24, BASE_HEX, VALS(fb_types), WIMAX_MAC_HEADER_TYPE_1_FB_TYPE, + "", HFILL + } + }, + { + &hf_mac_header_type_1_diuc, + { + "Preferred DIUC Index", "wimax.type1Diuc", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_DIUC, + "", HFILL + } + }, + { + &hf_mac_header_type_1_ultxpwr, + { + "UL TX Power", "wimax.type1UlTxPwr", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_UL_TX_PWR, + "", HFILL + } + }, + { + &hf_mac_header_type_1_ultxpwr_3, + { + "UL TX Power", "wimax.type1UlTxPwr3", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_UL_TX_PWR_3, + "", HFILL + } + }, + { + &hf_mac_header_type_1_ulhdrm, + { + "Headroom to UL Max Power Level", "wimax.type1HdRm", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_UL_HDRM, + "", HFILL + } + }, + { + &hf_mac_header_type_1_cinr, + { + "CINR Value", "wimax.type1Cinr", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_CINR, + "", HFILL + } + }, + { + &hf_mac_header_type_1_dci, + { + "DCD Change Indication", "wimax.type1Dci", + FT_UINT24, BASE_HEX, VALS(dci_msgs), WIMAX_MAC_HEADER_TYPE_1_DCI, + "", HFILL + } + }, + { + &hf_mac_header_type_1_pscid, + { + "Power Saving Class ID", "wimax.type1PsCid", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_PSCID, + "", HFILL + } + }, + { + &hf_mac_header_type_1_op, + { + "Operation", "wimax.type1Op", + FT_UINT24, BASE_HEX, VALS(op_msgs), WIMAX_MAC_HEADER_TYPE_1_OP, + "", HFILL + } + }, + { + &hf_mac_header_type_1_last, + { + "Last ARQ BSN or SDU SN", "wimax.type1Last", + FT_UINT24, BASE_HEX, VALS(last_msgs), WIMAX_MAC_HEADER_TYPE_1_LAST, + "", HFILL + } + }, + { + &hf_mac_header_type_1_sdu_sn1, + { + "ARQ BSN or MAC SDU SN (1)", "wimax.type1SduSn1", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_SDU_SN1, + "", HFILL + } + }, + { + &hf_mac_header_type_1_sdu_sn2, + { + "ARQ BSN or MAC SDU SN (2)", "wimax.type1SduSn2", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_SDU_SN2, + "", HFILL + } + }, + { + &hf_mac_header_type_1_sdu_sn3, + { + "ARQ BSN or MAC SDU SN (3)", "wimax.type1SduSn3", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_SDU_SN3, + "", HFILL + } + }, + { + &hf_mac_header_type_1_fbssi, + { + "FBSS Indicator", "wimax.type1Fbssi", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_FBSSI, + "", HFILL + } + }, + { + &hf_mac_header_type_1_period, + { + "Preferred CQICH Allocation Period", "wimax.type1Period", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_PERIOD, + "", HFILL + } + }, + { + &hf_mac_header_type_1_rsv_2, + { + "Reserved", "wimax.type1Rsv2", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_RSV_2, + "", HFILL + } + }, + { + &hf_mac_header_type_1_rsv_5, + { + "Reserved", "wimax.type1Rsv5", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_RSV_5, + "", HFILL + } + }, + { + &hf_mac_header_type_1_rsv_7, + { + "Reserved", "wimax.type1Rsv7", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_1_RSV_7, + "", HFILL + } + }, + { + &hf_mac_header_type_1_cid, + { + "Connection ID", "wimax.type1Cid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_type_1_hcs, + { + "Header Check Sequence", "wimax.type1Hcs", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + } +}; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_header_type_1_decoder, +}; + +/* Register Wimax Mac Header Type II Protocol and Dissector */ +void proto_register_mac_header_type_1(void) +{ + if (proto_mac_header_type_1_decoder == -1) + { + proto_mac_header_type_1_decoder = proto_mac_header_generic_decoder; + + proto_register_field_array(proto_mac_header_type_1_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } + register_dissector("mac_header_type_1_handler", dissect_mac_header_type_1_decoder, -1); +} + +void dissect_mac_header_type_1_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + gint tvb_len, offset = 0; + guint first_byte, sub_type; + proto_item *parent_item = NULL; + proto_item *ti = NULL; + proto_tree *ti_tree = NULL; + + if (tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display the MAC Type I Header message */ + ti = proto_tree_add_protocol_format(tree, proto_mac_header_type_1_decoder, tvb, offset, tvb_len, "Mac Type I Header (%u bytes)", WIMAX_MAC_HEADER_SIZE); + /* add subtree */ + ti_tree = proto_item_add_subtree(ti, ett_mac_header_type_1_decoder); + if(tvb_len < WIMAX_MAC_HEADER_SIZE) + { + /* display the MAC Type I Header in Hex */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_value_bytes, tvb, offset, tvb_len, FALSE); + return; + } +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, type1_subtype_abbrv[]); + } +#endif + /* get the parent */ + parent_item = proto_tree_get_parent(tree); + /* Decode and display the first 3 bytes of the header */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_ht, tvb, offset, 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_type_1_ec, tvb, offset, 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_type_1_type, tvb, offset, 3, FALSE); + /* Get the first byte */ + first_byte = tvb_get_guint8(tvb, offset); + /* get the sub Type */ + sub_type = ((first_byte & WIMAX_MAC_HEADER_TYPE_1_SUB_TYPE_MASK)>>3); + if(sub_type < TYPE_I_SUBTYPE_MAX) + { + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, type1_subtype_abbrv[sub_type]); + } + else + { + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Unknown type 1 subtype"); + /* display MAC Header Type I Subtype */ + proto_tree_add_protocol_format(ti_tree, proto_mac_header_type_1_decoder, tvb, offset, tvb_len, "Unknown type 1 subtype: %u", sub_type); + /* display the MAC Type I Header in Hex */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_value_bytes, tvb, offset, tvb_len, FALSE); + return; + } + /* add the MAC header info */ + proto_item_append_text(parent_item, "%s", type1_subtype_abbrv[sub_type]); + switch (sub_type) + { + case BR_INCREMENTAL: + case BR_AGGREGATE: + /* Decode and display the Bandwidth Request */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_br, tvb, offset, 3, FALSE); + break; + case PHY_CHANNEL_REPORT: + /* Decode and display the Preferred-DIUC */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_diuc, tvb, offset, 3, FALSE); + /* Decode and display the UL TX Power */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_ultxpwr, tvb, offset, 3, FALSE); + /* Decode and display the UL Headroom */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_ulhdrm, tvb, offset, 3, FALSE); + /* Decode and display the reserved filed */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_rsv_2, tvb, offset, 3, FALSE); + break; + case BR_WITH_UL_TX_POWER_REPORT: + /* Decode and display the Bandwidth Request */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_br_3, tvb, offset, 3, FALSE); + /* Decode and display the UL TX Power */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_ultxpwr_3, tvb, offset, 3, FALSE); + break; + case BR_AND_CINR_REPORT: + /* Decode and display the Bandwidth Request */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_br_3, tvb, offset, 3, FALSE); + /* Decode and display the CINR */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_cinr, tvb, offset, 3, FALSE); + /* Decode and display the DCD Change Indication */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_dci, tvb, offset, 3, FALSE); + break; + case BR_WITH_UL_SLEEP_CONTROL: + /* Decode and display the Bandwidth Request */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_br_3, tvb, offset, 3, FALSE); + /* Decode and display the Power Saving Class ID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_pscid, tvb, offset, 3, FALSE); + /* Decode and display the Operation */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_op, tvb, offset, 3, FALSE); + /* Decode and display the reserved filed */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_rsv_5, tvb, offset, 3, FALSE); + break; + case SN_REPORT: + /* Decode and display the Last field */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_last, tvb, offset, 3, FALSE); + /* Decode and display the SDU SN1 */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_sdu_sn1, tvb, offset, 3, FALSE); + /* Decode and display the SDU SN2 */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_sdu_sn2, tvb, offset, 3, FALSE); + /* Decode and display the SDU SN3 */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_sdu_sn3, tvb, offset, 3, FALSE); + break; + case CQICH_ALLOCATION_REQUEST: + /* Decode and display the Feedback Type */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_fb_type, tvb, offset, 3, FALSE); + /* Decode and display the FBSSI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_fbssi, tvb, offset, 3, FALSE); + /* Decode and display the Prreferred-period */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_period, tvb, offset, 3, FALSE); + /* Decode and display the reserved filed */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_rsv_7, tvb, offset, 3, FALSE); + break; + } + /* Decode and display the CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_cid, tvb, (offset+3), 2, FALSE); + /* Decode and display the HCS */ + proto_tree_add_item(ti_tree, hf_mac_header_type_1_hcs, tvb, (offset+5), 1, FALSE); + } +} diff --git a/plugins/wimax/mac_hd_type2_decoder.c b/plugins/wimax/mac_hd_type2_decoder.c new file mode 100644 index 0000000000..1e7caaa0c6 --- /dev/null +++ b/plugins/wimax/mac_hd_type2_decoder.c @@ -0,0 +1,1390 @@ +/* mac_hd_type2_decoder.c + * WiMax MAC Type II Signaling Header decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* TODO: Add FT_UINT24 and FT_INT24 cases to gtk_widget_get_toplevel() + * to prevent having to make all the changes from BASE_DEC to BASE_HEX + * made to this file today: 10/20/06. + */ + +/* +#define DEBUG +*/ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> + +extern gint proto_mac_header_generic_decoder; + +/* forward reference */ +void proto_register_mac_header_type_2(void); +void dissect_mac_header_type_2_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_header_type_2_decoder = -1; +static gint ett_mac_header_type_2_decoder = -1; +static gint hf_mac_header_type_2_value_bytes = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_header_type_2_decoder, +}; + +#define WIMAX_MAC_HEADER_SIZE 6 + +/* WiMax MAC Header Type II Feedback Types */ +enum +{ + CQI_MIMO_FB, /* 0 */ + DL_AVG_CINR, /* 1 */ + MIMO_COEF_FB, /* 2 */ + PREF_DL_CHAN_DIUC_FB,/* 3 */ + UL_TX_PWR, /* 4 */ + PHY_CHAN_FB, /* 5 */ + AMC_BAND_BITMAP, /* 6 */ + SHORT_PRECODE_FB, /* 7 */ + MULTI_TYPES_FB, /* 8 */ + LONG_PRECODE_FB, /* 9 */ + COMB_DL_AVG_CINR, /* 10 */ + MIMO_CHAN_FB, /* 11 */ + CINR_FB, /* 12 */ + CL_MIMO_FB, /* 13 */ + TYPE_II_FB_TYPE_MAX +} TYPE_II_FB_TYPE; + +static char *type2_fb_type_abbrv[TYPE_II_FB_TYPE_MAX] = +{ + "CQI and MIMO Feedback", + "DL average CINR", + "MIMO Coefficients Feedback", + "Preferred DL Channel DIUC Feedback", + "UL Transmission Power", + "PHY Channel Feedback", + "AMC Band Indication Bitmap", + "Life Span of Short-term Precoding Feedback", + "Multiple Types of Feedback", + "Long-term Precoding Feedback", + "Combined DL Average CINR of Active BSs", + "MIMO Channel Feedback", + "CINR Feedback", + "Close-loop MIMO Feedback" +}; + +/* WIMAX MAC HEADER TYPE II FILEDS */ +/* first byte */ +#define WIMAX_MAC_HEADER_TYPE_2_HT 0x80 +#define WIMAX_MAC_HEADER_TYPE_2_EC 0x40 +#define WIMAX_MAC_HEADER_TYPE_2_TYPE 0x20 +#define WIMAX_MAC_HEADER_TYPE_2_CII 0x10 +#define WIMAX_MAC_HEADER_TYPE_2_FB_TYPE 0x0F +static int hf_mac_header_type_2_ht = -1; +static int hf_mac_header_type_2_ec = -1; +static int hf_mac_header_type_2_type = -1; +static int hf_mac_header_type_2_cii = -1; +static int hf_mac_header_type_2_fb_type = -1; + +/* 2nd to 5th bytes (varies by different fb types) */ +static int hf_mac_header_type_2_cid = -1; +static int hf_mac_header_type_2_no_cid = -1; +/* CQI and MIMO Feedback */ +/* 2nd & 3rd bytes */ +#define WIMAX_MAC_HEADER_TYPE_2_CQI_FB_TYPE 0xE000 +#define WIMAX_MAC_HEADER_TYPE_2_CQI_PAYLOAD 0x1F80 +#define WIMAX_MAC_HEADER_TYPE_2_CQI_RSV 0x007F +static int hf_mac_header_type_2_cqi_fb_type = -1; +static int hf_mac_header_type_2_cqi_payload = -1; +static int hf_mac_header_type_2_cqi_rsv = -1; +/* 4th & 5th without CID */ +//#define WIMAX_MAC_HEADER_TYPE_2_NO_CID 0xFFFF + +/* DL average CINR */ +/* 2nd byte */ +#define WIMAX_MAC_HEADER_TYPE_2_DL_AVE_CINR 0xF800 +#define WIMAX_MAC_HEADER_TYPE_2_DL_AVE_RSV 0x07FF +static int hf_mac_header_type_2_dl_ave_cinr = -1; +static int hf_mac_header_type_2_dl_ave_rsv = -1; + +/* MIMO Coefficients Feedback */ +/* 2nd & 3rd bytes */ +#define WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF_NI 0xC000 +#define WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF_AI 0x3000 +#define WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF 0x0F80 +#define WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF_RSV 0x007F +static int hf_mac_header_type_2_mimo_coef_ni = -1; +static int hf_mac_header_type_2_mimo_coef_ai = -1; +static int hf_mac_header_type_2_mimo_coef = -1; +static int hf_mac_header_type_2_mimo_coef_rsv = -1; + +/* Preferred DL Channel DIUC Feedback */ +/* 2nd byte */ +#define WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_DIUC 0xF000 +#define WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_DCD 0x0F00 +#define WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_RSV 0x00FF +static int hf_mac_header_type_2_dl_chan_diuc = -1; +static int hf_mac_header_type_2_dl_chan_dcd = -1; +static int hf_mac_header_type_2_dl_chan_rsv = -1; + +/* UL Transmission Power */ +/* 2nd byte */ +#define WIMAX_MAC_HEADER_TYPE_2_UL_TX_PWR 0xFF00 +#define WIMAX_MAC_HEADER_TYPE_2_UL_TX_PWR_RSV 0x00FF +static int hf_mac_header_type_2_ul_tx_pwr = -1; +static int hf_mac_header_type_2_ul_tx_pwr_rsv = -1; + +/* PHY Channel Feedback */ +/* 2nd to 4th bytes */ +#define WIMAX_MAC_HEADER_TYPE_2_PHY_DIUC 0xF00000 +#define WIMAX_MAC_HEADER_TYPE_2_PHY_UL_TX_PWR 0x0FF000 +#define WIMAX_MAC_HEADER_TYPE_2_PHY_UL_HDRM 0x000FC0 +#define WIMAX_MAC_HEADER_TYPE_2_PHY_RSV 0x00003F +static int hf_mac_header_type_2_phy_diuc = -1; +static int hf_mac_header_type_2_phy_ul_tx_pwr = -1; +static int hf_mac_header_type_2_phy_ul_hdrm = -1; +static int hf_mac_header_type_2_phy_rsv = -1; + +/* AMC Band Indication Bitmap */ +/* 2nd to 5th bytes */ +#define WIMAX_MAC_HEADER_TYPE_2_AMC_BITMAP 0xFFF00000 +#define WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_1 0x000F8000 +#define WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_2 0x00007C00 +#define WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_3 0x000003E0 +#define WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_4 0x0000001F +static int hf_mac_header_type_2_amc_bitmap = -1; +static int hf_mac_header_type_2_amc_cqi_1 = -1; +static int hf_mac_header_type_2_amc_cqi_2 = -1; +static int hf_mac_header_type_2_amc_cqi_3 = -1; +static int hf_mac_header_type_2_amc_cqi_4 = -1; + +/* Life Span of Short-term Precoding Feedback */ +/* 2nd byte */ +#define WIMAX_MAC_HEADER_TYPE_2_LIFE_SPAN 0xF000 +#define WIMAX_MAC_HEADER_TYPE_2_LIFE_SPAN_RSV 0x0FFF +static int hf_mac_header_type_2_life_span = -1; +static int hf_mac_header_type_2_life_span_rsv = -1; + +/* Multiple Types of Feedback */ +/* 2nd to 5th bytes ??? */ +#define WIMAX_MAC_HEADER_TYPE_2_MT_NUM_FB_TYPES 0xC0000000 +#define WIMAX_MAC_HEADER_TYPE_2_MT_OCCU_FB_TYPE 0x3C000000 +#define WIMAX_MAC_HEADER_TYPE_2_MT_FB_CONTENTS 0x03FFFFFF +static int hf_mac_header_type_2_mt_num_fb_types = -1; +static int hf_mac_header_type_2_mt_occu_fb_type = -1; +static int hf_mac_header_type_2_mt_fb_contents = -1; + +/* Long-term Precoding Feedback */ +/* 2nd & 3rd bytes */ +#define WIMAX_MAC_HEADER_TYPE_2_LT_ID_FB 0xFC00 +#define WIMAX_MAC_HEADER_TYPE_2_LT_RANK 0x0300 +#define WIMAX_MAC_HEADER_TYPE_2_LT_FEC_QAM 0x00FC +#define WIMAX_MAC_HEADER_TYPE_2_LT_RSV 0x0003 +static int hf_mac_header_type_2_lt_id_fb = -1; +static int hf_mac_header_type_2_lt_rank = -1; +static int hf_mac_header_type_2_lt_fec_qam = -1; +static int hf_mac_header_type_2_lt_rsv = -1; + +/* Combined DL Average CINR of Active BSs */ +/* 2nd & 3rd bytes */ +#define WIMAX_MAC_HEADER_TYPE_2_COMB_DL_AVE 0xF800 +#define WIMAX_MAC_HEADER_TYPE_2_COMB_DL_RSV 0x0EFF +static int hf_mac_header_type_2_comb_dl_ave = -1; +static int hf_mac_header_type_2_comb_dl_rsv = -1; + +/* MIMO Channel Feedback */ +/* 2nd byte */ +#define WIMAX_MAC_HEADER_TYPE_2_DIUC 0xF0 +#define WIMAX_MAC_HEADER_TYPE_2_PBWI 0x0F +/* 3rd to 5th bytes with CID */ +#define WIMAX_MAC_HEADER_TYPE_2_SLPB 0xFE0000 +#define WIMAX_MAC_HEADER_TYPE_2_PBRI_CID 0x010000 +#define WIMAX_MAC_HEADER_TYPE_2_CID 0x00FFFF +/* 3rd to 5th bytes without CID */ +#define WIMAX_MAC_HEADER_TYPE_2_PBRI 0x018000 +#define WIMAX_MAC_HEADER_TYPE_2_CTI 0x007000 +#define WIMAX_MAC_HEADER_TYPE_2_AI_0 0x000800 +#define WIMAX_MAC_HEADER_TYPE_2_AI_1 0x000400 +#define WIMAX_MAC_HEADER_TYPE_2_AI_2 0x000200 +#define WIMAX_MAC_HEADER_TYPE_2_AI_3 0x000100 +#define WIMAX_MAC_HEADER_TYPE_2_MI 0x0000C0 +#define WIMAX_MAC_HEADER_TYPE_2_CT 0x000020 +#define WIMAX_MAC_HEADER_TYPE_2_CQI 0x00001F +static int hf_mac_header_type_2_mimo_diuc = -1; +static int hf_mac_header_type_2_mimo_pbwi = -1; +static int hf_mac_header_type_2_mimo_slpb = -1; +static int hf_mac_header_type_2_mimo_bpri = -1; +static int hf_mac_header_type_2_mimo_bpri_cid = -1; +static int hf_mac_header_type_2_mimo_cid = -1; +static int hf_mac_header_type_2_mimo_cti = -1; +static int hf_mac_header_type_2_mimo_ai_0 = -1; +static int hf_mac_header_type_2_mimo_ai_1 = -1; +static int hf_mac_header_type_2_mimo_ai_2 = -1; +static int hf_mac_header_type_2_mimo_ai_3 = -1; +static int hf_mac_header_type_2_mimo_mi = -1; +static int hf_mac_header_type_2_mimo_ct = -1; +static int hf_mac_header_type_2_mimo_cqi = -1; + +/* CINR Feedback */ +/* 2nd byte */ +//#define WIMAX_MAC_HEADER_TYPE_2_CINR_MEAN 0xFF +/* 3rd byte */ +//#define WIMAX_MAC_HEADER_TYPE_2_CINR_DEVI 0xFF +static int hf_mac_header_type_2_cinr_mean = -1; +static int hf_mac_header_type_2_cinr_devi = -1; + +/* Close-loop MIMO Feedback */ +/* 2nd & 3rd bytes */ +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_TYPE 0xC000 +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_ANT_ID 0x3C00 +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CQI 0x03E0 +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_RSV 0x008F +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_STREAMS 0x3000 +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_ANT_SEL 0x0E00 +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CQI_1 0x01F0 +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_RSV_1 0x000F +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CODEBOOK_ID 0x3F00 +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CQI_2 0x00F8 +#define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_RSV_2 0x000E +static int hf_mac_header_type_2_cl_mimo_type = -1; +static int hf_mac_header_type_2_cl_mimo_ant_id = -1; +static int hf_mac_header_type_2_cl_mimo_cqi = -1; +static int hf_mac_header_type_2_cl_mimo_cqi_1 = -1; +static int hf_mac_header_type_2_cl_mimo_cqi_2 = -1; +static int hf_mac_header_type_2_cl_mimo_rsv = -1; +static int hf_mac_header_type_2_cl_mimo_rsv_1 = -1; +static int hf_mac_header_type_2_cl_mimo_rsv_2 = -1; +static int hf_mac_header_type_2_cl_mimo_streams = -1; +static int hf_mac_header_type_2_cl_mimo_ant_sel = -1; +static int hf_mac_header_type_2_cl_mimo_codebook_id = -1; + +/* last byte */ +//#define WIMAX_MAC_HEADER_TYPE_2_HCS 0xFF +static int hf_mac_header_type_2_hcs = -1; + +/* CID Inclusion Indication messages */ +static const value_string cii_msgs[] = +{ + { 0, "without CID" }, + { 1, "with CID" }, + { 0, NULL} +}; + +/* Feedback Types */ +static const value_string fb_types[] = +{ + { 0, "CQI and MIMO Feedback" }, + { 1, "DL average CINR" }, + { 2, "MIMO Coefficients Feedback" }, + { 3, "Preferred DL Channel DIUC Feedback" }, + { 4, "UL Transmission Power" }, + { 5, "PHY Channel Feedback" }, + { 6, "AMC Band Indication Bitmap" }, + { 7, "Life Span of Short-term Precoding Feedback" }, + { 8, "Multiple Types of Feedback" }, + { 9, "Long-term Precoding Feedback" }, + { 10, "Combined DL Average CINR of Active BSs" }, + { 11, "MIMO Channel Feedback" }, + { 12, "CINR Feedback" }, + { 13, "Close-loop MIMO Feedback" }, + { 14, "Reserved" }, + { 15, "Reserved" }, + { 0, NULL} +}; + +/* Table of the Preferred Bandwidth Ratio of bandwidth over used channel bandwidth */ +static const value_string pbwi_table[] = +{ + { 0, "1" }, + { 1, "3/4" }, + { 2, "2/3" }, + { 3, "1/2" }, + { 4, "1/3" }, + { 5, "1/4" }, + { 6, "1/5" }, + { 7, "1/6" }, + { 8, "1/8" }, + { 9, "1/10" }, + { 10, "1/12" }, + { 11, "1/16" }, + { 12, "1/24" }, + { 13, "1/32" }, + { 14, "1/48" }, + { 15, "1/64" }, + { 0, NULL} +}; + +/* Burst Profile Ranking Indicator table */ +static const value_string bpri_table[] = +{ + { 0, "1st preferred burst profile" }, + { 1, "2nd preferred burst profile" }, + { 2, "3rd preferred burst profile" }, + { 3, "4th preferred burst profile" }, + { 0, NULL} +}; + +/* Coherent Time Index Table */ +static const value_string cti_table[] = +{ + { 0, "Infinite" }, + { 1, "1 frame" }, + { 2, "2 frames" }, + { 3, "3 frames" }, + { 4, "4 frames" }, + { 5, "8 frames" }, + { 6, "14 frames" }, + { 7, "24 frames" }, + { 0, NULL} +}; + +/* The MS Matrix Index Table */ +static const value_string mi_table[] = +{ + { 0, "No STC" }, + { 1, "Matrix A" }, + { 2, "Matrix B" }, + { 3, "Matrix C" }, + { 0, NULL} +}; + +/* CQI Feedback Types */ +static const value_string ct_msgs[] = +{ + { 0, "DL average feedback" }, + { 1, "CQI feedback" }, + { 0, NULL} +}; + +/* Antenna Indication messages */ +static const value_string ai_msgs[] = +{ + { 0, "Not applicable" }, + { 1, "Applicable" }, + { 0, NULL} +}; + +/* MAC HEADER TYPE II display */ +static hf_register_info hf[] = +{ + { + &hf_mac_header_type_2_value_bytes, + { + "Values", "wimax.type2ValueBytes", + FT_BYTES, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_type_2_ht, + { + "MAC Header Type", "wimax.type2Ht", + FT_UINT8, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_HT, + "", HFILL + } + }, + { + &hf_mac_header_type_2_ec, + { + "MAC Encryption Control", "wimax.type2Ec", + FT_UINT8, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_EC, + "", HFILL + } + }, + { + &hf_mac_header_type_2_type, + { + "MAC Sub-Type", "wimax.type2Type", + FT_UINT8, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_TYPE, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cii, + { + "CID Inclusion Indication", "wimax.type2Cii", + FT_UINT8, BASE_DEC, VALS(cii_msgs), WIMAX_MAC_HEADER_TYPE_2_CII, + "", HFILL + } + }, + { + &hf_mac_header_type_2_fb_type, + { + "Feedback Type", "wimax.type2FbType", + FT_UINT8, BASE_DEC, VALS(fb_types), WIMAX_MAC_HEADER_TYPE_2_FB_TYPE, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cqi_fb_type, + { + "Mimo Feedback Type", "wimax.type2MimoFbType", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CQI_FB_TYPE, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cqi_payload, + { + "CQI and Mimo Feedback Payload", "wimax.type2MimoFbPayload", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CQI_PAYLOAD, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cqi_rsv, + { + "Reserved", "wimax.type2MimoFbRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CQI_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_dl_ave_cinr, + { + "DL Average CINR", "wimax.type2DlAveCinr", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_DL_AVE_CINR, + "", HFILL + } + }, + { + &hf_mac_header_type_2_dl_ave_rsv, + { + "Reserved", "wimax.type2DlAveRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_DL_AVE_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_coef_ni, + { + "Number of Index", "wimax.type2MimoCoefNi", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF_NI, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_coef_ai, + { + "Occurences of Antenna Index", "wimax.type2MimoCoefAi", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF_AI, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_coef, + { + "MIMO Coefficients", "wimax.type2MimoCoef", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_coef_rsv, + { + "Reserved", "wimax.type2MimoCoefRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_dl_chan_diuc, + { + "Prefered DIUC", "wimax.type2DlChanDiuc", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_DIUC, + "", HFILL + } + }, + { + &hf_mac_header_type_2_dl_chan_dcd, + { + "DCD Change Count", "wimax.type2DlChanDcd", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_DCD, + "", HFILL + } + }, + { + &hf_mac_header_type_2_dl_chan_rsv, + { + "Reserved", "wimax.type2DlChanRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_ul_tx_pwr, + { + "UL TX Power", "wimax.type2UlTxPwr", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_UL_TX_PWR, + "", HFILL + } + }, + { + &hf_mac_header_type_2_ul_tx_pwr_rsv, + { + "Reserved", "wimax.type2UlTxPwrRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_UL_TX_PWR_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_phy_diuc, + { + "Preferred DIUC Index", "wimax.type2PhyDiuc", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_PHY_DIUC, + "", HFILL + } + }, + { + &hf_mac_header_type_2_phy_ul_tx_pwr, + { + "UL TX Power", "wimax.type2PhyUlTxPwr", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_PHY_UL_TX_PWR, + "", HFILL + } + }, + { + &hf_mac_header_type_2_phy_ul_hdrm, + { + "UL Headroom", "wimax.type2PhyHdRm", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_PHY_UL_HDRM, + "", HFILL + } + }, + { + &hf_mac_header_type_2_phy_rsv, + { + "Reserved", "wimax.type2PhyRsv", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_PHY_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_amc_bitmap, + { + "AMC Band Indication Bitmap", "wimax.type2AmcBitmap", + FT_UINT32, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_AMC_BITMAP, + "", HFILL + } + }, + { + &hf_mac_header_type_2_amc_cqi_1, + { + "CQI 1", "wimax.type2AmcCqi1", + FT_UINT32, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_1, + "", HFILL + } + }, + { + &hf_mac_header_type_2_amc_cqi_2, + { + "CQI 2", "wimax.type2AmcCqi2", + FT_UINT32, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_2, + "", HFILL + } + }, + { + &hf_mac_header_type_2_amc_cqi_3, + { + "CQI 3", "wimax.type2AmcCqi3", + FT_UINT32, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_3, + "", HFILL + } + }, + { + &hf_mac_header_type_2_amc_cqi_4, + { + "CQI 4", "wimax.type2AmcCqi4", + FT_UINT32, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_4, + "", HFILL + } + }, + { + &hf_mac_header_type_2_life_span, + { + "Life Span of Short-term", "wimax.type2LifeSpan", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_LIFE_SPAN, + "", HFILL + } + }, + { + &hf_mac_header_type_2_life_span_rsv, + { + "Reserved", "wimax.type2LifeSpanRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_LIFE_SPAN_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mt_num_fb_types, + { + "Number of Feedback Types", "wimax.type2MtNumFbTypes", + FT_UINT32, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_MT_NUM_FB_TYPES, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mt_occu_fb_type, + { + "Occurrences of Feedback Type", "wimax.type2MtOccuFbType", + FT_UINT32, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_MT_OCCU_FB_TYPE, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mt_fb_contents, + { + "Number of Feedback Types", "wimax.type2MtNumFbTypes", + FT_UINT32, BASE_HEX, NULL, WIMAX_MAC_HEADER_TYPE_2_MT_FB_CONTENTS, + "", HFILL + } + }, + { + &hf_mac_header_type_2_lt_id_fb, + { + "Long-term Feedback Index", "wimax.type2LtFbId", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_LT_ID_FB, + "", HFILL + } + }, + { + &hf_mac_header_type_2_lt_rank, + { + "Rank of Precoding Codebook", "wimax.type2LtRank", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_LT_RANK, + "", HFILL + } + }, + { + &hf_mac_header_type_2_lt_fec_qam, + { + "FEC and QAM", "wimax.type2LtFecQam", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_LT_FEC_QAM, + "", HFILL + } + }, + { + &hf_mac_header_type_2_lt_rsv, + { + "Reserved", "wimax.type2LtFbId", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_LT_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_comb_dl_ave, + { + "Combined DL Average CINR of Active BSs", "wimax.type2CombDlAve", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_COMB_DL_AVE, + "", HFILL + } + }, + { + &hf_mac_header_type_2_comb_dl_rsv, + { + "Reserved", "wimax.type2CombDlRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_COMB_DL_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_diuc, + { + "Preferred DIUC Index", "wimax.type2MimoDiuc", + FT_UINT8, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_DIUC, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_pbwi, + { + "Preferred Bandwidth Index", "wimax.type2MimoPbwi", + FT_UINT8, BASE_DEC, VALS(pbwi_table), WIMAX_MAC_HEADER_TYPE_2_PBWI, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_slpb, + { + "Starting Location of Preferred Bandwidth", "wimax.type2MimoSlpb", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_SLPB, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_bpri_cid, + { + "Burst Profile Ranking Indicator with CID", "wimax.type2MimoBpriCid", + FT_UINT24, BASE_HEX, VALS(bpri_table), WIMAX_MAC_HEADER_TYPE_2_PBRI_CID, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_cid, + { + "Connection ID", "wimax.type2MimoCid", + FT_UINT24, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CID, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_bpri, + { + "Burst Profile Ranking Indicator without CID", "wimax.type2MimoBpri", + FT_UINT24, BASE_HEX, VALS(bpri_table), WIMAX_MAC_HEADER_TYPE_2_PBRI, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_cti, + { + "Coherent Time Index", "wimax.type2MimoCti", + FT_UINT24, BASE_HEX, VALS(cti_table), WIMAX_MAC_HEADER_TYPE_2_CTI, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_ai_0, + { + "Antenna 0 Indication", "wimax.type2MimoAi", + FT_UINT24, BASE_HEX, VALS(ai_msgs), WIMAX_MAC_HEADER_TYPE_2_AI_0, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_ai_1, + { + "Antenna 1 Indication", "wimax.type2MimoAi", + FT_UINT24, BASE_HEX, VALS(ai_msgs), WIMAX_MAC_HEADER_TYPE_2_AI_1, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_ai_2, + { + "Antenna 2 Indication", "wimax.type2MimoAi", + FT_UINT24, BASE_HEX, VALS(ai_msgs), WIMAX_MAC_HEADER_TYPE_2_AI_2, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_ai_3, + { + "Antenna 3 Indication", "wimax.type2MimoAi", + FT_UINT24, BASE_HEX, VALS(ai_msgs), WIMAX_MAC_HEADER_TYPE_2_AI_3, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_mi, + { + "MS Matrix Indicator", "wimax.type2MimoMi", + FT_UINT24, BASE_HEX, VALS(mi_table), WIMAX_MAC_HEADER_TYPE_2_MI, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_ct, + { + "CQI Type", "wimax.type2MimoCt", + FT_UINT24, BASE_HEX, VALS(ct_msgs), WIMAX_MAC_HEADER_TYPE_2_CT, + "", HFILL + } + }, + { + &hf_mac_header_type_2_mimo_cqi, + { + "CQI Feedback", "wimax.type2MimoCqi", + FT_UINT24, BASE_HEX, NULL, WIMAX_MAC_HEADER_TYPE_2_CQI, + "", HFILL + } + }, + { &hf_mac_header_type_2_cinr_mean, + { + "CINR Mean", "wimax.type2CinrMean", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cinr_devi, + { + "CINR Standard Deviation", "wimax.type2CinrDevi", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_type, + { + "Closed-Loop MIMO Type", "wimax.type2ClMimoType", + FT_UINT16, BASE_HEX, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_TYPE, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_ant_id, + { + "Antenna Grouping Index", "wimax.type2ClMimoAntId", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_ANT_ID, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_cqi, + { + "Average CQI", "wimax.type2ClMimoCqi", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CQI, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_cqi_1, + { + "Average CQI", "wimax.type2ClMimoCqi", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CQI_1, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_cqi_2, + { + "Average CQI", "wimax.type2ClMimoCqi", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CQI_2, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_rsv, + { + "Reserved", "wimax.type2ClMimoRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_RSV, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_rsv_1, + { + "Reserved", "wimax.type2ClMimoRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_RSV_1, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_rsv_2, + { + "Reserved", "wimax.type2ClMimoRsv", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_RSV_2, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_streams, + { + "Number of Streams", "wimax.type2ClMimoStreams", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_STREAMS, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_ant_sel, + { + "Antenna Selection Option Index", "wimax.type2ClMimoAntSel", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_ANT_SEL, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cl_mimo_codebook_id, + { + "Codebook Index", "wimax.type2ClMimoCodeBkId", + FT_UINT16, BASE_DEC, NULL, WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CODEBOOK_ID, + "", HFILL + } + }, + { + &hf_mac_header_type_2_cid, + { + "Connection ID", "wimax.type2Cid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_type_2_no_cid, + { + "Reserved", "wimax.type2NoCid", + FT_UINT16, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_header_type_2_hcs, + { + "Header Check Sequence", "wimax.type2Hcs", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + } +}; + +/* Register Wimax Mac Header Type II Protocol and Dissector */ +void proto_register_mac_header_type_2(void) +{ + if (proto_mac_header_type_2_decoder == -1) + { + proto_mac_header_type_2_decoder = proto_mac_header_generic_decoder; + + proto_register_field_array(proto_mac_header_type_2_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } + register_dissector("mac_header_type_2_handler", dissect_mac_header_type_2_decoder, -1); +} + + +void dissect_mac_header_type_2_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + gint tvb_len, offset = 0; + guint cii_bit, first_byte, fb_type, mimo_type; + proto_item *parent_item = NULL; + proto_item *ti = NULL; + proto_tree *ti_tree = NULL; + + if (tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display the MAC Type II Header message */ + ti = proto_tree_add_protocol_format(tree, proto_mac_header_type_2_decoder, tvb, offset, tvb_len, "Mac Type II Header (6 bytes)"); + /* add subtree */ + ti_tree = proto_item_add_subtree(ti, ett_mac_header_type_2_decoder); + if(tvb_len < WIMAX_MAC_HEADER_SIZE) + { + /* display the error message */ + proto_tree_add_protocol_format(ti_tree, proto_mac_header_type_2_decoder, tvb, offset, tvb_len, "Error: the size of Mac Header Type II tvb is too small! (%u bytes)", tvb_len); + /* display the MAC Type II Header in Hex */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_value_bytes, tvb, offset, tvb_len, FALSE); + return; + } +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "MAC Signaling Header Type II"); + } +#endif + /* get the parent */ + parent_item = proto_tree_get_parent(tree); + /* Decode and display the first byte of the header */ + /* header type */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_ht, tvb, offset, 1, FALSE); + /* encryption control */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_ec, tvb, offset, 1, FALSE); + /* sub-type */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_type, tvb, offset, 1, FALSE); + /* CID inclusion indication */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cii, tvb, offset, 1, FALSE); + /* feedback type */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_fb_type, tvb, offset, 1, FALSE); + /* Get the first byte */ + first_byte = tvb_get_guint8(tvb, offset); + /* get the CII field */ + cii_bit = ((first_byte & WIMAX_MAC_HEADER_TYPE_2_CII)?1:0); + /* check the Type field */ + if(!(first_byte & WIMAX_MAC_HEADER_TYPE_2_TYPE)) + { + /* Get the feedback type */ + fb_type = (first_byte & WIMAX_MAC_HEADER_TYPE_2_FB_TYPE); + if(fb_type < TYPE_II_FB_TYPE_MAX) + { + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, type2_fb_type_abbrv[fb_type]); + } + else + { + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Unknown type 2 fb type"); + /* display the MAC Type I Header in Hex */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_value_bytes, tvb, offset, tvb_len, FALSE); + return; + } + /* move to the second byte */ + offset++; + /* add the MAC header info */ + proto_item_append_text(parent_item, "%s", type2_fb_type_abbrv[fb_type]); + /* process the feedback header based on the fb type */ + switch (fb_type) + { + case CQI_MIMO_FB: + /* Decode and display the CQI and MIMO feedback */ + /* CQI feedback type */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cqi_fb_type, tvb, offset, 2, FALSE); + /* CQI payload */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cqi_payload, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cqi_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case DL_AVG_CINR: + /* Decode and display the DL average CINR feedback */ + /* DL average CINR payload */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_dl_ave_cinr, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_dl_ave_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case MIMO_COEF_FB: + /* Decode and display the MIMO coefficients feedback */ + /* number of index */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_coef_ni, tvb, offset, 2, FALSE); + /* occurrences of antenna index */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_coef_ai, tvb, offset, 2, FALSE); + /* MIMO coefficients */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_coef, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_coef_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* Decode and display the CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case PREF_DL_CHAN_DIUC_FB: + /* Decode and display the Preffed DL Channel DIUC feedback */ + /* Preferred DIUC */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_dl_chan_diuc, tvb, offset, 2, FALSE); + /* DCD Change Count */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_dl_chan_dcd, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_dl_chan_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case UL_TX_PWR: + /* Decode and display the UL TX Power feedback */ + /* UL TX Power */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_ul_tx_pwr, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_ul_tx_pwr_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case PHY_CHAN_FB: + /* Decode and display the PHY Channel feedback */ + /* Preffed DIUC */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_phy_diuc, tvb, offset, 2, FALSE); + /* UL TX Power */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_phy_ul_tx_pwr, tvb, offset, 2, FALSE); + /* UL Headroom */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_phy_ul_hdrm, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_phy_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case AMC_BAND_BITMAP: + /* Decode and display the AMC Band CQIs feedback */ + /* AMC Band Indication Bitmap */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_amc_bitmap, tvb, offset, 2, FALSE); + /* AMC CQI 1 */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_amc_cqi_1, tvb, offset, 2, FALSE); + /* AMC CQI 2 */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_amc_cqi_2, tvb, offset, 2, FALSE); + /* AMC CQI 3 */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_amc_cqi_3, tvb, offset, 2, FALSE); + /* AMC CQI 4 */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_amc_cqi_4, tvb, offset, 2, FALSE); +#if 0 + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } +#endif + break; + case SHORT_PRECODE_FB: + /* Decode and display the Life Span of Short-term precoding feedback */ + /* Life Span */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_life_span, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_life_span_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case MULTI_TYPES_FB: + /* Decode and display the Multi types of feedback */ + /* Number of feedback types */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mt_num_fb_types, tvb, offset, 4, FALSE); + /* Occurrences of feedback type */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mt_occu_fb_type, tvb, offset, 4, FALSE); + /* feedback contents */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mt_fb_contents, tvb, offset, 4, FALSE); +#if 0 + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } +#endif + break; + case LONG_PRECODE_FB: + /* Decode and display the Long-term precoding feedback */ + /* Feedback of index */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_lt_id_fb, tvb, offset, 2, FALSE); + /* rank of prrecoding codebook */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_lt_rank, tvb, offset, 2, FALSE); + /* EFC and QAM feedback */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_lt_fec_qam, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_lt_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case COMB_DL_AVG_CINR: + /* Decode and display the Combined DL Average CINR feedback */ + /* Combined DL average CINR of Active BSs */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_comb_dl_ave, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_comb_dl_rsv, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case MIMO_CHAN_FB: + /* Decode and display the second byte of the header */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_diuc, tvb, (offset+1), 1, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_pbwi, tvb, (offset+1), 1, FALSE); + /* Decode and display the 3rd to 5th bytes of the header */ + /* Decode and display the SLPB */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_slpb, tvb, offset, 3, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* Decode and display the BPRI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_bpri_cid, tvb, offset, 3, FALSE); + /* Decode and display the CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_cid, tvb, offset, 3, FALSE); + } + else + { /* without CID */ + /* Decode and display the BPRI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_bpri, tvb, offset, 3, FALSE); + /* Decode and display the CTI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_cti, tvb, offset, 3, FALSE); + /* Decode and display the AI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_ai_0, tvb, offset, 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_ai_1, tvb, offset, 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_ai_2, tvb, offset, 3, FALSE); + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_ai_3, tvb, offset, 3, FALSE); + /* Decode and display the MI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_mi, tvb, offset, 3, FALSE); + /* Decode and display the CT */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_ct, tvb, offset, 3, FALSE); + /* Decode and display the CQI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_mimo_cqi, tvb, offset, 3, FALSE); + } + break; + case CINR_FB: + /* Decode and display the CINRC feedback */ + /* CINR Mean */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cinr_mean, tvb, offset, 2, FALSE); + /* CINR Standard Deviation */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cinr_devi, tvb, offset, 2, FALSE); + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* Decode and display the CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + case CL_MIMO_FB: + /* Get the MIMO type */ + mimo_type = ((tvb_get_guint8(tvb, offset) & 0xC0) >> 6); + /* Decode and display the MIMO type */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_type, tvb, offset, 2, FALSE); + if(mimo_type == 1) + { + /* Decode and display the umber of streams */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_streams, tvb, offset, 2, FALSE); + /* Decode and display the antenna selection option index */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_ant_sel, tvb, offset, 2, FALSE); + /* Decode and display the average CQI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_cqi_1, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_rsv_1, tvb, offset, 2, FALSE); + } + else if(mimo_type == 2) + { + /* Decode and display the umber of streams */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_streams, tvb, offset, 2, FALSE); + /* Decode and display the antenna selection option index */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_codebook_id, tvb, offset, 2, FALSE); + /* Decode and display the average CQI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_cqi_2, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_rsv_2, tvb, offset, 2, FALSE); + } + else + { + /* Decode and display the antenna grouping index */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_ant_id, tvb, offset, 2, FALSE); + /* Decode and display the average CQI */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_cqi, tvb, offset, 2, FALSE); + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cl_mimo_rsv, tvb, offset, 2, FALSE); + } + /* check the CII field */ + if(cii_bit) + { /* with CID */ + /* Decode and display the CID */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_cid, tvb, (offset+2), 2, FALSE); + } + else + { /* without CID */ + /* reserved */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_no_cid, tvb, (offset+2), 2, FALSE); + } + break; + default: + break; + } + /* Decode and display the HCS */ + proto_tree_add_item(ti_tree, hf_mac_header_type_2_hcs, tvb, (offset+4), 1, FALSE); + } + else + { + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Error - Undefined Type"); + } + } + } +} diff --git a/plugins/wimax/mac_mgmt_msg_decoder.c b/plugins/wimax/mac_mgmt_msg_decoder.c new file mode 100644 index 0000000000..560bebcbe8 --- /dev/null +++ b/plugins/wimax/mac_mgmt_msg_decoder.c @@ -0,0 +1,878 @@ +/* mac_mgmt_msg_decoder.c + * WiMax MAC Management Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "wimax_mac.h" + +extern gint proto_wimax; + +extern void proto_register_wimax_utility_decoders(void); + +extern void proto_register_mac_mgmt_msg_dcd(void); +extern void proto_register_mac_mgmt_msg_ucd(void); +extern void proto_register_mac_mgmt_msg_dlmap(void); +extern void proto_register_mac_mgmt_msg_ulmap(void); +extern void proto_register_mac_mgmt_msg_rng_req(void); +extern void proto_register_mac_mgmt_msg_rng_rsp(void); +extern void proto_register_mac_mgmt_msg_reg_req(void); +extern void proto_register_mac_mgmt_msg_reg_rsp(void); +extern void proto_register_mac_mgmt_msg_dsa(void); +extern void proto_register_mac_mgmt_msg_dsc(void); +extern void proto_register_mac_mgmt_msg_dsd(void); +extern void proto_register_mac_mgmt_msg_arq_feedback(void); +extern void proto_register_mac_mgmt_msg_arq_discard(void); +extern void proto_register_mac_mgmt_msg_arq_reset(void); +extern void proto_register_mac_mgmt_msg_dreg_req(void); +extern void proto_register_mac_mgmt_msg_dreg_cmd(void); +extern void proto_register_mac_mgmt_msg_fpc(void); +extern void proto_register_mac_mgmt_msg_sbc(void); +extern void proto_register_mac_mgmt_msg_pkm(void); +extern void proto_register_mac_mgmt_msg_pmc_req(void); +extern void proto_register_mac_mgmt_msg_pmc_rsp(void); +extern void proto_register_mac_mgmt_msg_prc_lt_ctrl(void); +extern void proto_register_mac_mgmt_msg_aas_fbck(void); +extern void proto_register_mac_mgmt_msg_aas_beam(void); +extern void proto_register_mac_mgmt_msg_res_cmd(void); +extern void proto_register_mac_mgmt_msg_rep(void); +extern void proto_register_mac_mgmt_msg_clk_cmp(void); +extern void proto_register_mac_mgmt_msg_dsx_rvd(void); + +extern void dissect_mac_mgmt_msg_ucd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dlmap_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_ulmap_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_rng_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_rng_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_reg_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_reg_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_pkm_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_pkm_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsa_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsa_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsa_ack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsc_ack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsd_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsd_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_fpc_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_sbc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_sbc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dreg_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dreg_cmd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_arq_feedback_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_arq_discard_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_arq_reset_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_pmc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_pmc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_prc_lt_ctrl_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_aas_fbck_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_aas_fbck_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_aas_beam_select_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_res_cmd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_rep_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_rep_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_clk_cmp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_dsx_rvd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +/* forward reference */ +void proto_register_mac_mgmt_msg(void); +void dissect_mac_mgmt_msg_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_decoder = -1; +static gint ett_mac_mgmt_msg_decoder = -1; + +/* WIMAX MAC Management message type info */ +char *mgt_msg_abbrv[MAC_MGMT_MSG_TYPE_MAX] = +{ + "UCD", /* 0 */ + "DCD", + "DL-MAP", + "UL-MAP", + "RNG-REQ", + "RNG-RSP", + "REG-REQ", + "REG-RSP", + "Reserved8", + "PKM-REQ", + "PKM-RSP", /* 10 */ + "DSA-REQ", + "DSA-RSP", + "DSA-ACK", + "DSC-REQ", + "DSC-RSP", + "DSC-ACK", + "DSD-REQ", + "DSD-RSP", + "Reserved19", + "Reserved20", /* 20 */ + "MCA-REQ", + "MCA-RSP", + "DBPC-REQ", + "DBPC-RSP", + "RES-CMD", + "SBC-REQ", + "SBC-RSP", + "CLK-CMP", + "DREG-CMD", + "DSX-RVD", /* 30 */ + "TFTP-CPLT", + "TFTP-RSP", + "ARQ-FEEDBACK", + "ARQ-DISCARD", + "ARQ-RESET", + "REP-REQ", + "REP-RSP", + "FPC", + "MSH-NCFG", + "MSH-NENT", /* 40 */ + "MSH-DSCH", + "MSH-CSCH", + "MSH-CSCF", + "AAS-FBCK_REQ", + "AAS-FBCK_RSP", + "AAS-BEAM_SELECT", + "AAS-BEAM_REQ", + "AAS-BEAM_RSP", + "DREG-REQ", + "MOB-SLP-REQ", /* 50 */ + "MOB-SLP-RSP", + "MOB-TRF-IND", + "MOB-NBR-ADV", + "MOB-SCN-REQ", + "MOB-SCN-RSP", + "MOB-BSHO-REQ", + "MOB-MSHO-REQ", + "MOB-BSHO-RSP", + "MOB-HO-IND", + "MOB-SCN-REP", /* 60 */ + "MOB-PAG-ADV", + "MBS-MAP", + "PMC-REQ", + "PMC-RSP", + "PRC-LT-CTRL", + "MOB-ASC-REP" +}; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_decoder, +}; + +static gint hf_mac_mgmt_msg_values = -1; +static gint hf_mac_mgmt_msg_unknown_type = -1; + +/* Payload display */ +static hf_register_info hf[] = +{ + { + &hf_mac_mgmt_msg_values, + { + "Values", "wimax.values", + FT_BYTES, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_mac_mgmt_msg_unknown_type, + { + "Unknown MAC Message Type", "wimax.unknown_type", + FT_BYTES, BASE_HEX, NULL, 0x0, + "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg(void) +{ + if (proto_mac_mgmt_msg_decoder == -1) + { + proto_mac_mgmt_msg_decoder = proto_wimax; +#if 0 + proto_mac_mgmt_msg_decoder = proto_register_protocol ( + "WiMax MAC Management Message", /* name */ + "MGMT MSG", /* short name */ + "mgmtmsg" /* abbrev */ + ); +#endif + + proto_register_field_array(proto_mac_mgmt_msg_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } + + proto_register_wimax_utility_decoders(); + + proto_register_mac_mgmt_msg_dcd(); + proto_register_mac_mgmt_msg_ucd(); + proto_register_mac_mgmt_msg_dlmap(); + proto_register_mac_mgmt_msg_ulmap(); + proto_register_mac_mgmt_msg_rng_req(); + proto_register_mac_mgmt_msg_rng_rsp(); + proto_register_mac_mgmt_msg_reg_req(); + proto_register_mac_mgmt_msg_reg_rsp(); + proto_register_mac_mgmt_msg_dsa(); + proto_register_mac_mgmt_msg_dsc(); + proto_register_mac_mgmt_msg_dsd(); + proto_register_mac_mgmt_msg_arq_feedback(); + proto_register_mac_mgmt_msg_arq_discard(); + proto_register_mac_mgmt_msg_arq_reset(); + proto_register_mac_mgmt_msg_dreg_req(); + proto_register_mac_mgmt_msg_dreg_cmd(); + proto_register_mac_mgmt_msg_fpc(); + proto_register_mac_mgmt_msg_sbc(); + proto_register_mac_mgmt_msg_pkm(); + proto_register_mac_mgmt_msg_pmc_req(); + proto_register_mac_mgmt_msg_pmc_rsp(); + proto_register_mac_mgmt_msg_prc_lt_ctrl(); + proto_register_mac_mgmt_msg_aas_fbck(); + proto_register_mac_mgmt_msg_aas_beam(); + proto_register_mac_mgmt_msg_res_cmd(); + proto_register_mac_mgmt_msg_rep(); + proto_register_mac_mgmt_msg_clk_cmp(); + proto_register_mac_mgmt_msg_dsx_rvd(); +} + +void dissect_mac_mgmt_msg_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, message_type; + dissector_handle_t mgt_msg_handle; + proto_item *parent_item = NULL; + proto_item *message_item = NULL; + proto_tree *message_tree = NULL; + + if (tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + if(!tvb_len) + { + /* display the error message */ + proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "Error: Mac payload tvb is empty ! (%u bytes)", tvb_len); + return; + } + /* Get the payload type */ + message_type = tvb_get_guint8(tvb, offset); + /* add the payload type into the info column */ + if(message_type < MAC_MGMT_MSG_TYPE_MAX) + { + /* Display message type in Info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", mgt_msg_abbrv[message_type]); + } + } + else + { + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_str(pinfo->cinfo, COL_INFO, "Unknown message type,"); + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "Unknown message type: %u (%u bytes)", message_type, tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + return; + } + /* get the parent */ + parent_item = proto_tree_get_parent(tree); + /* add the MAC header info */ + proto_item_append_text(parent_item, ", %s", mgt_msg_abbrv[message_type]); + /* Decode and display the MAC payload */ + switch (message_type) + { + case MAC_MGMT_MSG_UCD: + /* UCD message handler */ + dissect_mac_mgmt_msg_ucd_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DCD: + /* DCD message handler */ + dissect_mac_mgmt_msg_dcd_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DL_MAP: + /* DL-MAP message handler */ + dissect_mac_mgmt_msg_dlmap_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_UL_MAP: + /* UL-MAP message handler */ + dissect_mac_mgmt_msg_ulmap_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_RNG_REQ: + /* Ranging request message handler */ + dissect_mac_mgmt_msg_rng_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_RNG_RSP: + /* Ranging response message handler */ + dissect_mac_mgmt_msg_rng_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_REG_REQ: + /* Registration request message handler */ + dissect_mac_mgmt_msg_reg_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_REG_RSP: + /* Registration response message handler */ + dissect_mac_mgmt_msg_reg_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_PKM_REQ: + /* Privacy Key Management request message handler */ + dissect_mac_mgmt_msg_pkm_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_PKM_RSP: + /* Privacy Key Management response message handler */ + dissect_mac_mgmt_msg_pkm_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSA_REQ: + /* Dynamic Service Addition request message handler */ + dissect_mac_mgmt_msg_dsa_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSA_RSP: + /* Dynamic Service Addition response message handler */ + dissect_mac_mgmt_msg_dsa_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSA_ACK: + /* Dynamic Service Addition acknowledge message handler */ + dissect_mac_mgmt_msg_dsa_ack_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSC_REQ: + /* Dynamic Service Change request message handler */ + dissect_mac_mgmt_msg_dsc_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSC_RSP: + /* Dynamic Service Change response message handler */ + dissect_mac_mgmt_msg_dsc_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSC_ACK: + /* Dynamic Service Change acknowledge message handler */ + dissect_mac_mgmt_msg_dsc_ack_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSD_REQ: + /* Dynamic Service Deletion request message handler */ + dissect_mac_mgmt_msg_dsd_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSD_RSP: + /* Dynamic Service Deletion response message handler */ + dissect_mac_mgmt_msg_dsd_rsp_decoder(tvb, pinfo, tree); + case MAC_MGMT_MSG_MCA_REQ: + /* find the Multicast Assignment request message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mca_req_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MCA_RSP: + /* find the Multicast Assignment response message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mca_rsp_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_DBPC_REQ: + /* find the DL Burst Profile Change request message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_dbpc_req_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_DBPC_RSP: + /* find the DL Burst Profile Change response message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_dbpc_rsp_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_RES_CMD: + /* Reset Command message handler */ + dissect_mac_mgmt_msg_res_cmd_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_SBC_REQ: + /* SS Basic Capability request message handler */ + dissect_mac_mgmt_msg_sbc_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_SBC_RSP: + /* SS Basic Capability response message handler */ + dissect_mac_mgmt_msg_sbc_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_CLK_CMP: + /* SS Network Clock Comparison message handler */ + dissect_mac_mgmt_msg_clk_cmp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DREG_CMD: + /* De/Re-register Command message handler */ + dissect_mac_mgmt_msg_dreg_cmd_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_DSX_RVD: + /* DSx Recieved message handler */ + dissect_mac_mgmt_msg_dsx_rvd_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_TFTP_CPLT: + /* find the Config File TFTP Complete message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_tftp_cplt_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_TFTP_RSP: + /* find the Config File TFTP Complete response message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_tftp_rsp_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_ARQ_FEEDBACK: + /* Standalone ARQ feedback message handler */ + dissect_mac_mgmt_msg_arq_feedback_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_ARQ_DISCARD: + dissect_mac_mgmt_msg_arq_discard_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_ARQ_RESET: + /* ARQ Reset message handler */ + dissect_mac_mgmt_msg_arq_reset_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_REP_REQ: + /* Channel measurement Report request message handler */ + dissect_mac_mgmt_msg_rep_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_REP_RSP: + /* Channel measurement Report response message handler */ + dissect_mac_mgmt_msg_rep_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_FPC: + /* Fast Power Control message handler */ + dissect_mac_mgmt_msg_fpc_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_MSH_NCFG: + /* find the Mesh Network Configuration message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_ncfg_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MSH_NENT: + /* find the Mesh Network Entry message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_nent_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MSH_DSCH: + /* find the Mesh Distributed Schedule message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_dsch_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MSH_CSCH: + /* find the Mesh Centralized Schedule message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_csch_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MSH_CSCF: + /* find the Mesh Centralized Schedule Configuration message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_cscf_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_AAS_FBCK_REQ: + /* AAS feedback request message handler */ + dissect_mac_mgmt_msg_aas_fbck_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_AAS_FBCK_RSP: + /* AAS feedback response message handler */ + dissect_mac_mgmt_msg_aas_fbck_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_AAS_BEAM_SELECT: + /* AAS Beam Select message handler */ + dissect_mac_mgmt_msg_aas_beam_select_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_AAS_BEAM_REQ: + /* find the AAS Beam request message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_aas_beam_req_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_AAS_BEAM_RSP: + /* find the AAS Beam response message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_aas_beam_rsp_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_DREG_REQ: + /* SS De-registation message handler */ + dissect_mac_mgmt_msg_dreg_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_MOB_SLP_REQ: + /* find the Sleep Request message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_slp_req_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_SLP_RSP: + /* find the Sleep Response message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_slp_rsp_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_TRF_IND: + /* find the Traffic Indication message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_trf_ind_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_NBR_ADV: + /* find the Neighbor Advertisement message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_nbr_adv_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_SCN_REQ: + /* find the Scanning Interval Allocation Reqest message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_scn_req_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_SCN_RSP: + /* find the Scanning Interval Allocation Response message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_scn_rsp_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_BSHO_REQ: + /* find the BS HO Request message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_bsho_req_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_MSHO_REQ: + /* find the MS HO Request message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_msho_req_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_BSHO_RSP: + /* find the BS HO Response message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_bsho_rsp_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_HO_IND: + /* find the HO Indication message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_ho_ind_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_SCN_REP: + /* find the Scanning Result Report message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_scn_rep_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MOB_PAG_ADV: + /* find the BS Broadcast Paging message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_pag_adv_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_MBS_MAP: + /* find the MBS MAP message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mbs_map_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + case MAC_MGMT_MSG_PMC_REQ: + /* Power Control Mode Change Reuest message handler */ + dissect_mac_mgmt_msg_pmc_req_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_PMC_RSP: + /* Power Control Mode Change Response message handler */ + dissect_mac_mgmt_msg_pmc_rsp_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_PRC_LT_CTRL: + /* Setup/Tear-down of Long-term MIMO Precoding message handler */ + dissect_mac_mgmt_msg_prc_lt_ctrl_decoder(tvb, pinfo, tree); + break; + case MAC_MGMT_MSG_MOB_ASC_REP: + /* find the Association Result Report message handler */ + mgt_msg_handle = find_dissector("mac_mgmt_msg_mob_asc_rep_handler"); + if(mgt_msg_handle) + call_dissector(mgt_msg_handle, tvb, pinfo, tree); + else + { + /* display MAC payload types */ + message_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_decoder, tvb, offset, tvb_len, "%s (%u bytes)", mgt_msg_abbrv[message_type], tvb_len); + /* add MAC payload subtree */ + message_tree = proto_item_add_subtree(message_item, ett_mac_mgmt_msg_decoder); + /* display the MAC payload in Hex */ + proto_tree_add_item(message_tree, hf_mac_mgmt_msg_values, tvb, offset, tvb_len, FALSE); + } + break; + default: + /* display the unknown message in hex */ + proto_tree_add_item(tree, hf_mac_mgmt_msg_unknown_type, tvb, offset, (tvb_len - offset), FALSE); + break; + } + } +} diff --git a/plugins/wimax/moduleinfo.h b/plugins/wimax/moduleinfo.h new file mode 100644 index 0000000000..c4f666a355 --- /dev/null +++ b/plugins/wimax/moduleinfo.h @@ -0,0 +1,25 @@ +/* Included *after* config.h, in order to re-define these macros */ + +#ifdef PACKAGE +#undef PACKAGE +#endif + +/* Name of package */ +#define PACKAGE "wimax" + + +#ifdef VERSION +#undef VERSION +#endif + +/* Version number of package */ + +#define stringiz1(x) #x +#define stringize(x) stringiz1(x) + +#ifndef BUILD_NUMBER +#define BUILD_NUMBER 0 +#endif + +#define VERSION "1.1." stringize(BUILD_NUMBER) + diff --git a/plugins/wimax/msg_aas_beam.c b/plugins/wimax/msg_aas_beam.c new file mode 100644 index 0000000000..5df7384b0d --- /dev/null +++ b/plugins/wimax/msg_aas_beam.c @@ -0,0 +1,371 @@ +/* msg_aas_beam.c + * WiMax MAC Management AAS-BEAM-SELECT/REQ/RSP Messages decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define OFDM /* disable it if not supporting OFDM */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include "wimax_mac.h" + +extern gint proto_mac_mgmt_msg_aas_fbck_decoder; + +#define AAS_BEAM_SELECT_AAS_BEAM_INDEX_MASK 0xFC +#define AAS_BEAM_SELECT_RESERVED_MASK 0x03 +#define AAS_BEAM_FEEDBACK_REQUEST_NUMBER_MASK 0xE0 +#define AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK 0x18 +#define AAS_BEAM_RESOLUTION_PARAMETER_MASK 0x07 + +#define AAS_BEAM_BEAM_BIT_MASK_MASK 0xF0 +#define AAS_BEAM_RESERVED_MASK 0x0F + +/* forward reference */ +void proto_register_mac_mgmt_msg_aas_beam(void); +void dissect_mac_mgmt_msg_aas_beam_select_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +#ifdef OFDM +static void dissect_mac_mgmt_msg_aas_beam_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +static void dissect_mac_mgmt_msg_aas_beam_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +#endif + +static gint proto_mac_mgmt_msg_aas_beam_decoder = -1; +static gint ett_mac_mgmt_msg_aas_beam_select_decoder = -1; +static gint ett_mac_mgmt_msg_aas_beam_req_decoder = -1; +static gint ett_mac_mgmt_msg_aas_beam_rsp_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_aas_beam_select_decoder, + &ett_mac_mgmt_msg_aas_beam_req_decoder, + &ett_mac_mgmt_msg_aas_beam_rsp_decoder, +}; + +#ifdef OFDM +static const value_string vals_report_types[] = +{ + {0, "BEAM_REP_IE"}, + {0, NULL} +}; + +static const value_string vals_resolution_parameter[] = +{ + {0, "report every 4th subcarrier"}, + {1, "report every 8th subcarrier"}, + {2, "report every 16th subcarrier"}, + {3, "report every 32nd subcarrier"}, + {4, "report every 64th subcarrier"}, + {0, NULL} +}; +#endif + +/* fix fields */ +static gint hf_aas_beam_message_type = -1; +static gint hf_aas_beam_unknown_type = -1; +static gint hf_aas_beam_select_index = -1; +static gint hf_aas_beam_select_reserved = -1; +#ifdef OFDM +static gint hf_aas_beam_frame_number = -1; +static gint hf_aas_beam_feedback_request_number = -1; +static gint hf_aas_beam_measurement_report_type = -1; +static gint hf_aas_beam_resolution_parameter = -1; +static gint hf_aas_beam_beam_bit_mask = -1; +static int hf_aas_beam_freq_value_re = -1; +static int hf_aas_beam_freq_value_im = -1; +static int hf_aas_beam_rssi_value = -1; +static int hf_aas_beam_cinr_value = -1; +#endif + +/* AAS-BEAM display */ +static hf_register_info hf_aas_beam[] = +{ + { + &hf_aas_beam_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.aas_beam", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_beam_select_index, + { + "AAS Beam Index", "wimax.aas_beam.aas_beam_index", + FT_UINT8, BASE_DEC, NULL, AAS_BEAM_SELECT_AAS_BEAM_INDEX_MASK, "", HFILL + } + }, + { + &hf_aas_beam_beam_bit_mask, + { + "Beam Bit Mask", "wimax.aas_beam.beam_bit_mask", + FT_UINT8, BASE_HEX, NULL, AAS_BEAM_BEAM_BIT_MASK_MASK, "", HFILL + } + }, +#ifdef OFDM + { + &hf_aas_beam_cinr_value, + { + "CINR Mean Value", "wimax.aas_beam.cinr_mean_value", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_beam_feedback_request_number, + { + "Feedback Request Number", "wimax.aas_beam.feedback_request_number", + FT_UINT8, BASE_DEC, NULL, AAS_BEAM_FEEDBACK_REQUEST_NUMBER_MASK, "", HFILL + } + }, + { + &hf_aas_beam_frame_number, + { + "Frame Number", "wimax.aas_beam.frame_number", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_beam_freq_value_im, + { + "Frequency Value (imaginary part)", "wimax.aas_beam.freq_value_im", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_beam_freq_value_re, + { + "Frequency Value (real part)", "wimax.aas_beam.freq_value_re", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_beam_measurement_report_type, + { + "Measurement Report Type", "wimax.aas_beam.measurement_report_type", + FT_UINT8, BASE_DEC, VALS(vals_report_types), AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK, "", HFILL + } + }, + { + &hf_aas_beam_select_reserved, + { + "Reserved", "wimax.aas_beam.reserved", + FT_UINT8, BASE_HEX, NULL, AAS_BEAM_SELECT_RESERVED_MASK, "", HFILL + } + }, + { + &hf_aas_beam_resolution_parameter, + { + "Resolution Parameter", "wimax.aas_beam.resolution_parameter", + FT_UINT8, BASE_DEC, VALS(vals_resolution_parameter), AAS_BEAM_RESOLUTION_PARAMETER_MASK, "", HFILL + } + }, + { + &hf_aas_beam_rssi_value, + { + "RSSI Mean Value", "wimax.aas_beam.rssi_mean_value", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, +#endif + { + &hf_aas_beam_unknown_type, + { + "Unknown TLV type", "wimax.aas_beam.unknown_type", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_aas_beam(void) +{ + if (proto_mac_mgmt_msg_aas_beam_decoder == -1) + { + proto_mac_mgmt_msg_aas_beam_decoder = proto_mac_mgmt_msg_aas_fbck_decoder; + + proto_register_field_array(proto_mac_mgmt_msg_aas_beam_decoder, hf_aas_beam, array_length(hf_aas_beam)); + proto_register_subtree_array(ett, array_length(ett)); + } + register_dissector("mac_mgmt_msg_aas_beam_select_handler", dissect_mac_mgmt_msg_aas_beam_select_decoder, -1); +#ifdef OFDM + register_dissector("mac_mgmt_msg_aas_beam_req_handler", dissect_mac_mgmt_msg_aas_beam_req_decoder, -1); + register_dissector("mac_mgmt_msg_aas_beam_rsp_handler", dissect_mac_mgmt_msg_aas_beam_rsp_decoder, -1); +#endif +} + +void dissect_mac_mgmt_msg_aas_beam_select_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *aas_beam_item = NULL; + proto_tree *aas_beam_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is AAS-BEAM-SELECT */ + if(payload_type != MAC_MGMT_MSG_AAS_BEAM_SELECT) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + aas_beam_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_aas_beam_decoder, tvb, offset, tvb_len, "AAS Beam Select (AAS-BEAM-SELECT) (%u bytes)", tvb_len); + /* add subtree */ + aas_beam_tree = proto_item_add_subtree(aas_beam_item, ett_mac_mgmt_msg_aas_beam_select_decoder); + /* Display the AAS-BEAM-SELECT message type */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* Decode and display the AAS-BEAM-SELECT message body */ + /* display the AAS Beam Index */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_select_index, tvb, offset, 1, FALSE); + /* display the reserved fields */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_select_reserved, tvb, offset, 1, FALSE); + } +} + +#ifdef OFDM +static void dissect_mac_mgmt_msg_aas_beam_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *aas_beam_item = NULL; + proto_tree *aas_beam_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is AAS-BEAM-REQ */ + if(payload_type != MAC_MGMT_MSG_AAS_BEAM_REQ) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + aas_beam_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_aas_beam_decoder, tvb, offset, tvb_len, "AAS Beam Request (AAS-BEAM-REQ) (%u bytes)", tvb_len); + /* add subtree */ + aas_beam_tree = proto_item_add_subtree(aas_beam_item, ett_mac_mgmt_msg_aas_beam_req_decoder); + /* Display the AAS-BEAM-REQ message type */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* Decode and display the AAS-BEAM-REQ message body */ + /* display the Frame Number */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_frame_number, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Feedback Request Number */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_feedback_request_number, tvb, offset, 1, FALSE); + /* display the Measurement Report Type */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_measurement_report_type, tvb, offset, 1, FALSE); + /* display the Resolution Parameter */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_resolution_parameter, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Beam Bit mask */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_beam_bit_mask, tvb, offset, 1, FALSE); + /* display the reserved fields */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_select_reserved, tvb, offset, 1, FALSE); + } +} + +static void dissect_mac_mgmt_msg_aas_beam_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, report_type; + guint number_of_frequencies, index; + proto_item *aas_beam_item = NULL; + proto_tree *aas_beam_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is AAS-BEAM-RSP */ + if(payload_type != MAC_MGMT_MSG_AAS_BEAM_RSP) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + aas_beam_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_aas_beam_decoder, tvb, offset, tvb_len, "AAS Beam Response (AAS-BEAM-RSP) (%u bytes)", tvb_len); + /* add subtree */ + aas_beam_tree = proto_item_add_subtree(aas_beam_item, ett_mac_mgmt_msg_aas_beam_req_decoder); + /* Display the AAS-BEAM-RSP message type */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* Decode and display the AAS-BEAM-RSP message body */ + /* display the Frame Number */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_frame_number, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* get the Measurement Report Type */ + report_type = tvb_get_guint8(tvb, offset); + /* display the Feedback Request Number */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_feedback_request_number, tvb, offset, 1, FALSE); + /* display the Measurement Report Type */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_measurement_report_type, tvb, offset, 1, FALSE); + /* display the Resolution Parameter */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_resolution_parameter, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Beam Bit mask */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_beam_bit_mask, tvb, offset, 1, FALSE); + /* display the reserved fields */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_select_reserved, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* check the Measurement Report Type */ + if((report_type & AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK) == 0) + { + /* calculate the total number of frequencies */ + number_of_frequencies = (tvb_len - offset) / 2 - 1; + /* display the frequency */ + for(index = 0; index < number_of_frequencies; index++) + { /* display the Frequency Value (real part) */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_freq_value_re, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Frequency Value (imaginary part) */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_freq_value_im, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + } + } + /* display the RSSI Mean Value */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_rssi_value, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the CINR Mean Value */ + proto_tree_add_item(aas_beam_tree, hf_aas_beam_cinr_value, tvb, offset, 1, FALSE); + } +} +#endif diff --git a/plugins/wimax/msg_aas_fbck.c b/plugins/wimax/msg_aas_fbck.c new file mode 100644 index 0000000000..94cdada3e5 --- /dev/null +++ b/plugins/wimax/msg_aas_fbck.c @@ -0,0 +1,365 @@ +/* msg_aas_beam.c + * WiMax MAC Management AAS-BEAM-SELECT/REQ/RSP Messages decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include "wimax_mac.h" + +#define OFDMA_AAS_FBCK_REQ_NUMBER_OF_FRAME_MASK 0xFE +#define OFDMA_AAS_FBCK_REQ_DATA_TYPE_MASK 0x01 +#define OFDMA_AAS_FBCK_REQ_FB_REQ_COUNTER_MASK 0xE0 +#define OFDMA_AAS_FBCK_REQ_FB_REQ_RESOLUTION_MASK 0x18 +#define OFDMA_AAS_FBCK_REQ_FB_REQ_RESERVED_MASK 0x07 + +#define OFDMA_AAS_FBCK_REQ_FB_RSP_RESERVED_MASK 0xC0 +#define OFDMA_AAS_FBCK_RSP_DATA_TYPE_MASK 0x20 +#define OFDMA_AAS_FBCK_REQ_FB_RSP_COUNTER_MASK 0x1C +#define OFDMA_AAS_FBCK_REQ_FB_RSP_RESOLUTION_MASK 0x03 + +/* forward reference */ +void proto_register_mac_mgmt_msg_aas_fbck(void); +void dissect_mac_mgmt_msg_aas_fbck_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_aas_fbck_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +gint proto_mac_mgmt_msg_aas_fbck_decoder = -1; +static gint ett_mac_mgmt_msg_aas_fbck_req_decoder = -1; +static gint ett_mac_mgmt_msg_aas_fbck_rsp_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_aas_fbck_req_decoder, + &ett_mac_mgmt_msg_aas_fbck_rsp_decoder, +}; + +static const value_string vals_data_types[] = +{ + {0, "measure on downlink preamble only"}, + {1, "measure on downlink data (for this SS) only"}, + {0, NULL} +}; + +static const value_string vals_resolutions_0[] = +{ + {0, "32 subcarriers"}, + {1, "64 subcarriers"}, + {2, "128 subcarriers"}, + {3, "256 subcarriers"}, + {0, NULL} +}; + +static const value_string vals_resolutions_1[] = +{ + {0, "1 subcarrier"}, + {1, "4 subcarriers"}, + {2, "8 subcarriers"}, + {3, "16 subcarriers"}, + {0, NULL} +}; + +/* fix fields */ +static int hf_aas_fbck_message_type = -1; +static int hf_aas_fbck_unknown_type = -1; +static int hf_aas_fbck_frame_number = -1; +static int hf_aas_fbck_number_of_frames = -1; +static int hf_aas_fbck_req_data_type = -1; +static int hf_aas_fbck_rsp_data_type = -1; +static int hf_aas_fbck_req_counter = -1; +static int hf_aas_fbck_rsp_counter = -1; +static int hf_aas_fbck_req_resolution_0 = -1; +static int hf_aas_fbck_rsp_resolution_0 = -1; +static int hf_aas_fbck_req_resolution_1 = -1; +static int hf_aas_fbck_rsp_resolution_1 = -1; +static int hf_aas_fbck_req_reserved = -1; +static int hf_aas_fbck_rsp_reserved = -1; +static int hf_aas_fbck_freq_value_re = -1; +static int hf_aas_fbck_freq_value_im = -1; +static int hf_aas_fbck_rssi_value = -1; +static int hf_aas_fbck_cinr_value = -1; + +/* AAS-FBCK display */ +static hf_register_info hf_aas_fbck[] = +{ + { + &hf_aas_fbck_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.aas_fbck", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_fbck_cinr_value, + { + "CINR Mean Value", "wimax.aas_fbck.cinr_mean_value", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_fbck_req_counter, + { + "Feedback Request Counter", "wimax.aas_fbck.counter", + FT_UINT8, BASE_DEC, NULL, OFDMA_AAS_FBCK_REQ_FB_REQ_COUNTER_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_frame_number, + { + "Frame Number", "wimax.aas_fbck.frame_number", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_fbck_freq_value_re, + { + "Frequency Value (real part)", "wimax.aas_fbck.freq_value_re", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_fbck_freq_value_im, + { + "Frequency Value (imaginary part)", "wimax.aas_fbck.freq_value_im", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_fbck_number_of_frames, + { + "Number Of Frames", "wimax.aas_fbck.number_of_frames", + FT_UINT8, BASE_DEC, NULL, OFDMA_AAS_FBCK_REQ_NUMBER_OF_FRAME_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_req_resolution_0, + { + "Frequency Measurement Resolution", "wimax.aas_fbck.resolution", + FT_UINT8, BASE_DEC, VALS(vals_resolutions_0), OFDMA_AAS_FBCK_REQ_FB_REQ_RESOLUTION_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_req_resolution_1, + { + "Frequency Measurement Resolution", "wimax.aas_fbck.resolution", + FT_UINT8, BASE_DEC, VALS(vals_resolutions_1), OFDMA_AAS_FBCK_REQ_FB_REQ_RESOLUTION_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_rssi_value, + { + "RSSI Mean Value", "wimax.aas_fbck.rssi_mean_value", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_fbck_unknown_type, + { + "Unknown TLV type", "wimax.aas_fbck.unknown_type", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_aas_fbck_req_data_type, + { + "Measurement Data Type", "wimax.aas_fbck_req.data_type", + FT_UINT8, BASE_DEC, VALS(vals_data_types), OFDMA_AAS_FBCK_REQ_DATA_TYPE_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_req_reserved, + { + "Reserved", "wimax.aas_fbck_req.reserved", + FT_UINT8, BASE_HEX, NULL, OFDMA_AAS_FBCK_REQ_FB_REQ_RESERVED_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_rsp_counter, + { + "Feedback Request Counter", "wimax.aas_fbck_rsp.counter", + FT_UINT8, BASE_DEC, NULL, OFDMA_AAS_FBCK_REQ_FB_RSP_COUNTER_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_rsp_data_type, + { + "Measurement Data Type", "wimax.aas_fbck_rsp.data_type", + FT_UINT8, BASE_DEC, VALS(vals_data_types), OFDMA_AAS_FBCK_RSP_DATA_TYPE_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_rsp_reserved, + { + "Reserved", "wimax.aas_fbck_rsp.reserved", + FT_UINT8, BASE_HEX, NULL, OFDMA_AAS_FBCK_REQ_FB_RSP_RESERVED_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_rsp_resolution_0, + { + "Frequency Measurement Resolution", "wimax.aas_fbck_rsp.resolution", + FT_UINT8, BASE_DEC, VALS(vals_resolutions_0), OFDMA_AAS_FBCK_REQ_FB_RSP_RESOLUTION_MASK, "", HFILL + } + }, + { + &hf_aas_fbck_rsp_resolution_1, + { + "Frequency Measurement Resolution", "wimax.aas_fbck_rsp.resolution", + FT_UINT8, BASE_DEC, VALS(vals_resolutions_1), OFDMA_AAS_FBCK_REQ_FB_RSP_RESOLUTION_MASK, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_aas_fbck(void) +{ + if (proto_mac_mgmt_msg_aas_fbck_decoder == -1) + { + proto_mac_mgmt_msg_aas_fbck_decoder = proto_register_protocol ( + "WiMax AAS-FEEDBACK/BEAM Messages", /* name */ + "WiMax AAS-FEEDBACK/BEAM (aas)", /* short name */ + "aas" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_aas_fbck_decoder, hf_aas_fbck, array_length(hf_aas_fbck)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +void dissect_mac_mgmt_msg_aas_fbck_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, data_type; + proto_item *aas_fbck_item = NULL; + proto_tree *aas_fbck_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is AAS-FBCK-REQ */ + if(payload_type != MAC_MGMT_MSG_AAS_FBCK_REQ) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + aas_fbck_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_aas_fbck_decoder, tvb, offset, tvb_len, "AAS Channel Feedback Request (AAS-FBCK-REQ) (%u bytes)", tvb_len); + /* add subtree */ + aas_fbck_tree = proto_item_add_subtree(aas_fbck_item, ett_mac_mgmt_msg_aas_fbck_req_decoder); + /* Display the AAS-FBCK-REQ message type */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* Decode and display the AAS-FBCK-REQ message body */ + /* display the Frame Number */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_frame_number, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* get the data type */ + data_type = tvb_get_guint8(tvb, offset); + /* display the number of Frames */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_number_of_frames, tvb, offset, 1, FALSE); + /* display the Data Type */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_req_data_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Feedback Request Counter */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_req_counter, tvb, offset, 1, FALSE); + /* display the Frequency Measurement Resolution */ + if(data_type & OFDMA_AAS_FBCK_REQ_DATA_TYPE_MASK) + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_req_resolution_1, tvb, offset, 1, FALSE); + else + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_req_resolution_0, tvb, offset, 1, FALSE); + /* display the reserved fields */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_req_reserved, tvb, offset, 1, FALSE); + } +} + +void dissect_mac_mgmt_msg_aas_fbck_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, data_type; + proto_item *aas_fbck_item = NULL; + proto_tree *aas_fbck_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is AAS-FBCK-RSP */ + if(payload_type != MAC_MGMT_MSG_AAS_FBCK_RSP) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + aas_fbck_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_aas_fbck_decoder, tvb, offset, tvb_len, "AAS Channel Feedback Response (AAS-FBCK-RSP) (%u bytes)", tvb_len); + /* add subtree */ + aas_fbck_tree = proto_item_add_subtree(aas_fbck_item, ett_mac_mgmt_msg_aas_fbck_req_decoder); + /* Display the AAS-FBCK-RSP message type */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* get the data type */ + data_type = tvb_get_guint8(tvb, offset); + /* Decode and display the AAS-FBCK-RSP message body */ + /* display the reserved fields */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_rsp_reserved, tvb, offset, 1, FALSE); + /* display the Data Type */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_rsp_data_type, tvb, offset, 1, FALSE); + /* display the Feedback Request Counter */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_rsp_counter, tvb, offset, 1, FALSE); + /* display the Frequency Measurement Resolution */ + if(data_type & OFDMA_AAS_FBCK_RSP_DATA_TYPE_MASK) + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_rsp_resolution_1, tvb, offset, 1, FALSE); + else + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_rsp_resolution_0, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + for(; offset < (tvb_len - 2); ) + { + /* display the Frequency Value (real part) */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_freq_value_re, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Frequency Value (imaginary part) */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_freq_value_im, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + } + /* display the RSSI Mean Value */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_rssi_value, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the CINR Mean Value */ + proto_tree_add_item(aas_fbck_tree, hf_aas_fbck_cinr_value, tvb, offset, 1, FALSE); + } +} diff --git a/plugins/wimax/msg_arq.c b/plugins/wimax/msg_arq.c new file mode 100644 index 0000000000..488aa0786b --- /dev/null +++ b/plugins/wimax/msg_arq.c @@ -0,0 +1,508 @@ +/* msg_arq.c + * WiMax MAC Management ARQ Feedback, Discard, Reset Message decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" +#include "wimax_mac.h" + +extern gint man_ofdma; + +/* Forward reference */ +void dissect_mac_mgmt_msg_arq_feedback_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_arq_discard_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_arq_reset_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_arq_feedback_decoder = -1; +static gint proto_mac_mgmt_msg_arq_discard_decoder = -1; +static gint proto_mac_mgmt_msg_arq_reset_decoder = -1; + +static gint ett_mac_mgmt_msg_arq_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_arq_decoder, +}; + + +/* ARQ fields */ +static gint hf_arq_cid = -1; +static gint hf_arq_last = -1; +static gint hf_arq_ack_type = -1; +static gint hf_ack_type_reserved = -1; +static gint hf_arq_bsn = -1; +static gint hf_arq_num_ack_maps = -1; +static gint hf_arq_selective_map = -1; +static gint hf_arq_seq_format = -1; +static gint hf_arq_0seq_ack_map = -1; +static gint hf_arq_0seq1_len = -1; +static gint hf_arq_0seq2_len = -1; +static gint hf_arq_1seq_ack_map = -1; +static gint hf_arq_1seq1_len = -1; +static gint hf_arq_1seq2_len = -1; +static gint hf_arq_1seq3_len = -1; +static gint hf_arq_reserved = -1; + +static gint hf_arq_discard_cid = -1; +static gint hf_arq_discard_reserved = -1; +static gint hf_arq_discard_bsn = -1; + +static gint hf_arq_reset_cid = -1; +static gint hf_arq_reset_type = -1; +static gint hf_arq_reset_direction = -1; +static gint hf_arq_reset_reserved = -1; + +static gint hf_arq_message_type = -1; + +/* STRING RESOURCES */ + +static const true_false_string tfs_present = { + "present", + "absent" +}; + +static const true_false_string tfs_rng_req_aas_broadcast = { + "SS cannot receive broadcast messages", + "SS can receive broadcast messages" +}; + +static const true_false_string tfs_arq_last = { + "Last ARQ feedback IE in the list", + "More ARQ feedback IE in the list" +}; + +static const value_string vals_arq_ack_type[] = { + {0, "Selective ACK entry"}, + {1, "Cumulative ACK entry"}, + {2, "Cumulative with Selective ACK entry"}, + {3, "Cumulative ACK with Block Sequence Ack entry"}, + {0, NULL} +}; + +static const value_string vals_arq_reset_type[] = { + {0, "Original message from Initiator"}, + {1, "Acknowledgment from Responder"}, + {2, "Confirmation from Initiator"}, + {3, "Reserved"}, + {0, NULL} +}; + +static const value_string vals_arq_reset_direction[] = { + {0, "Uplink or downlink"}, + {1, "Uplink"}, + {2, "Downlink"}, + {3, "Reserved"}, + {0, NULL} +}; + +/* ARQ fields display */ +static hf_register_info hf[] = +{ + /* TODO: Make three separate arq message types */ + { + &hf_arq_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.arq", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_arq_ack_type, + { + "ACK Type", "wimax.arq.ack_type", + FT_UINT8, BASE_DEC, VALS(vals_arq_ack_type), 0x60, "", HFILL + } + }, + { + &hf_arq_bsn, + { + "BSN", "wimax.arq.bsn", + FT_UINT16, BASE_DEC, NULL, 0x1FFC, "", HFILL + } + }, + { + &hf_arq_cid, + { + "Connection ID", "wimax.arq.cid", + FT_UINT16, BASE_DEC, NULL, 0x00, "The ID of the connection being referenced", HFILL + } + }, + { + &hf_arq_discard_bsn, + { + "BSN", "wimax.arq.discard_bsn", + FT_UINT16, BASE_DEC, NULL, 0x07FF, "", HFILL + } + }, + { + &hf_arq_discard_cid, + { + "Connection ID", "wimax.arq.discard_cid", + FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_arq_discard_reserved, + { + "Reserved", "wimax.arq.discard_reserved", + FT_UINT8, BASE_DEC, NULL, 0xF8, "", HFILL + } + }, + { + &hf_arq_last, + { + "LAST", "wimax.arq.last", + FT_BOOLEAN, 8, TFS(&tfs_arq_last), 0x80, "", HFILL + } + }, + { + &hf_arq_num_ack_maps, + { + "Number of ACK Maps", "wimax.arq.num_maps", + FT_UINT8, BASE_DEC, NULL, 0x03, "", HFILL + } + }, + { + &hf_arq_reserved, + { + "Reserved", "wimax.arq.reserved", + FT_UINT8, BASE_DEC, NULL, 0x01, "", HFILL + } + }, + { + &hf_arq_reset_cid, + { + "Connection ID", "wimax.arq.reset_cid", + FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_arq_reset_direction, + { + "Direction", "wimax.arq.reset_direction", + FT_UINT8, BASE_DEC, VALS(vals_arq_reset_direction), 0x30, "", HFILL + } + }, + { + &hf_arq_reset_reserved, + { + "Reserved", "wimax.arq.reset_reserved", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, + { + &hf_arq_reset_type, + { + "Type", "wimax.arq.reset_type", + FT_UINT8, BASE_DEC, VALS(vals_arq_reset_type), 0xC0, "", HFILL + } + }, + { + &hf_arq_selective_map, + { + "Selective ACK Map", "wimax.arq.selective_map", + FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_arq_0seq_ack_map, + { + "Sequence ACK Map", "wimax.arq.seq_ack_map", + FT_UINT8, BASE_HEX, NULL, 0x60, "", HFILL + } + }, + { + &hf_arq_1seq_ack_map, + { + "Sequence ACK Map", "wimax.arq.seq_ack_map", + FT_UINT8, BASE_HEX, NULL, 0x70, "", HFILL + } + }, + { + &hf_arq_seq_format, + { + "Sequence Format", "wimax.arq.seq_format", + FT_UINT8, BASE_DEC, NULL, 0x80, "", HFILL + } + }, + { + &hf_arq_0seq1_len, + { + "Sequence 1 Length", "wimax.arq.seq1_len", + FT_UINT16, BASE_DEC, NULL, 0x1F80, "", HFILL + } + }, + { + &hf_arq_0seq2_len, + { + "Sequence 2 Length", "wimax.arq.seq2_len", + FT_UINT16, BASE_DEC, NULL, 0x007E, "", HFILL + } + }, + { + &hf_arq_1seq1_len, + { + "Sequence 1 Length", "wimax.arq.seq1_len", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, + { + &hf_arq_1seq2_len, + { + "Sequence 2 Length", "wimax.arq.seq2_len", + FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL + } + }, + { + &hf_arq_1seq3_len, + { + "Sequence 3 Length", "wimax.arq.seq3_len", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, + { + &hf_ack_type_reserved, + { + "Reserved", "wimax.ack_type.reserved", + FT_UINT8, BASE_DEC, NULL, 0x03, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_arq_feedback(void) +{ + if (proto_mac_mgmt_msg_arq_feedback_decoder == -1) + { + proto_mac_mgmt_msg_arq_feedback_decoder = proto_register_protocol ( + "WiMax ARQ Feedback/Discard/Reset Messages", /* name */ + "WiMax ARQ Feedback/Discard/Reset (arq)", /* short name */ + "arq" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_arq_feedback_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_arq_discard(void) +{ + if (proto_mac_mgmt_msg_arq_discard_decoder == -1) + { + proto_mac_mgmt_msg_arq_discard_decoder = proto_mac_mgmt_msg_arq_feedback_decoder; + + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_arq_reset(void) +{ + if (proto_mac_mgmt_msg_arq_reset_decoder == -1) + { + proto_mac_mgmt_msg_arq_reset_decoder = proto_mac_mgmt_msg_arq_feedback_decoder; + + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode ARQ-Feedback messages. */ +void dissect_mac_mgmt_msg_arq_feedback_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint arq_feedback_ie_count = 0; + guint arq_cid; + gboolean arq_last = FALSE; + guint arq_ack_type; + guint arq_bsn; + guint arq_num_ack_maps; + guint tvb_len, payload_type; + proto_item *arq_feedback_item = NULL; + proto_tree *arq_feedback_tree = NULL; + proto_item *arq_fb_item = NULL; + proto_tree *arq_fb_tree = NULL; + proto_item *ti = NULL; + guint i, seq_format; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_ARQ_FEEDBACK) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type ARQ-Feedback */ + arq_feedback_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_arq_feedback_decoder, tvb, offset, tvb_len, "MAC Management Message, ARQ-Feedback (33)"); + /* add MAC ARQ Feedback subtree */ + arq_feedback_tree = proto_item_add_subtree(arq_feedback_item, ett_mac_mgmt_msg_arq_decoder); + /* display the Message Type */ + proto_tree_add_item(arq_feedback_tree, hf_arq_message_type, tvb, offset, 1, FALSE); + offset += 1; + + while(offset < tvb_len && !arq_last) + { + arq_feedback_ie_count++; + arq_cid = tvb_get_ntohs(tvb, offset); + arq_last = ((tvb_get_guint8(tvb, offset + 2) & 0x80) != 0); + arq_ack_type = (tvb_get_guint8(tvb, offset + 2) & 0x60) >> 5; + arq_bsn = (tvb_get_ntohs(tvb, offset + 2) & 0x1FFC) >> 2; + arq_num_ack_maps = 1 + (tvb_get_guint8(tvb, offset + 3) & 0x03); + + arq_fb_item = proto_tree_add_protocol_format(arq_feedback_tree, proto_mac_mgmt_msg_arq_feedback_decoder, tvb, offset, tvb_len, "ARQ_Feedback_IE"); + proto_item_append_text(arq_fb_item, ", CID: %u, %s ARQ feedback IE, %s, BSN: %u", + arq_cid, arq_last ? "Last" : "More", val_to_str(arq_ack_type, vals_arq_ack_type, ""), arq_bsn); + if (arq_ack_type != ARQ_CUMULATIVE_ACK_ENTRY) { + proto_item_append_text(arq_fb_item, ", %u ACK Map(s)", arq_num_ack_maps); + } + /* add ARQ Feedback IE subtree */ + arq_fb_tree = proto_item_add_subtree(arq_fb_item, ett_mac_mgmt_msg_arq_decoder); + proto_tree_add_item(arq_fb_tree, hf_arq_cid, tvb, offset, 2, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_last, tvb, offset + 2, 1, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_ack_type, tvb, offset + 2, 1, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_bsn, tvb, offset + 2, 2, FALSE); + if (arq_ack_type != ARQ_CUMULATIVE_ACK_ENTRY) { + ti = proto_tree_add_item(arq_fb_tree, hf_arq_num_ack_maps, tvb, offset + 3, 1, FALSE); + proto_item_append_text(ti, " (%d map(s))", arq_num_ack_maps); + offset += 2; + + for (i = 0; i < arq_num_ack_maps; i++) { + /* Each ACK Map is 16 bits. */ + offset += 2; + if (arq_ack_type != 3) { + proto_tree_add_item(arq_fb_tree, hf_arq_selective_map, tvb, offset, 2, FALSE); + } else { + proto_tree_add_item(arq_fb_tree, hf_arq_seq_format, tvb, offset, 1, FALSE); + seq_format = (tvb_get_guint8(tvb, offset) & 0x80) >> 7; + if (seq_format == 0) { + proto_tree_add_item(arq_fb_tree, hf_arq_0seq_ack_map, tvb, offset, 1, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_0seq1_len, tvb, offset, 2, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_0seq2_len, tvb, offset, 2, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_reserved, tvb, offset + 1, 1, FALSE); + } else { + proto_tree_add_item(arq_fb_tree, hf_arq_1seq_ack_map, tvb, offset, 1, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_1seq1_len, tvb, offset, 1, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_1seq2_len, tvb, offset + 1, 1, FALSE); + proto_tree_add_item(arq_fb_tree, hf_arq_1seq3_len, tvb, offset + 1, 1, FALSE); + } + } + } + } else { + /* Number of ACK Maps bits are reserved when ACK TYPE == 1 */ + proto_tree_add_item(arq_fb_tree, hf_ack_type_reserved, tvb, offset + 3, 1, FALSE); + /* update the offset */ + offset += 2; + } + /* update the offset */ + offset += 2; + } + proto_item_append_text(arq_feedback_item, ", %u ARQ_feedback_IE(s)", arq_feedback_ie_count); + } +} + +/* Decode ARQ-Discard messages. */ +void dissect_mac_mgmt_msg_arq_discard_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint tvb_len, payload_type; + proto_item *arq_discard_item = NULL; + proto_tree *arq_discard_tree = NULL; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_ARQ_DISCARD) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type ARQ-Discard */ + arq_discard_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_arq_discard_decoder, tvb, 0, tvb_len, "MAC Management Message, ARQ-Discard (34)"); + /* add MAC ARQ Discard subtree */ + arq_discard_tree = proto_item_add_subtree(arq_discard_item, ett_mac_mgmt_msg_arq_decoder); + /* display the Message Type */ + proto_tree_add_item(arq_discard_tree, hf_arq_message_type, tvb, 0, 1, FALSE); + + proto_tree_add_item(arq_discard_tree, hf_arq_discard_cid, tvb, 1, 2, FALSE); + proto_tree_add_item(arq_discard_tree, hf_arq_discard_reserved, tvb, 3, 1, FALSE); + proto_tree_add_item(arq_discard_tree, hf_arq_discard_bsn, tvb, 3, 2, FALSE); + } +} + +/* Decode ARQ-Reset messages. */ +void dissect_mac_mgmt_msg_arq_reset_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint tvb_len, payload_type; + proto_item *arq_reset_item = NULL; + proto_tree *arq_reset_tree = NULL; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_ARQ_RESET) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type ARQ-Reset */ + arq_reset_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_arq_reset_decoder, tvb, 0, tvb_len, "MAC Management Message, ARQ-Reset (35)"); + /* add MAC ARQ Reset subtree */ + arq_reset_tree = proto_item_add_subtree(arq_reset_item, ett_mac_mgmt_msg_arq_decoder); + /* display the Message Type */ + proto_tree_add_item(arq_reset_tree, hf_arq_message_type, tvb, 0, 1, FALSE); + + proto_tree_add_item(arq_reset_tree, hf_arq_reset_cid, tvb, 1, 2, FALSE); + proto_tree_add_item(arq_reset_tree, hf_arq_reset_type, tvb, 3, 1, FALSE); + proto_tree_add_item(arq_reset_tree, hf_arq_reset_direction, tvb, 3, 1, FALSE); + proto_tree_add_item(arq_reset_tree, hf_arq_reset_reserved, tvb, 3, 1, FALSE); + } +} + diff --git a/plugins/wimax/msg_clk_cmp.c b/plugins/wimax/msg_clk_cmp.c new file mode 100644 index 0000000000..8b2b2e047c --- /dev/null +++ b/plugins/wimax/msg_clk_cmp.c @@ -0,0 +1,169 @@ +/* msg_clk_cmp.c + * WiMax MAC Management CLK_CMP Message decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "wimax_mac.h" + +/* Forward reference */ +void dissect_mac_mgmt_msg_clk_cmp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_clk_cmp_decoder = -1; + +static gint ett_mac_mgmt_msg_clk_cmp_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_clk_cmp_decoder, +}; + +/* CLK_CMP fields */ +static gint hf_clk_cmp_message_type = -1; +static gint hf_clk_cmp_clock_count = -1; +static gint hf_clk_cmp_clock_id = -1; +static gint hf_clk_cmp_seq_number = -1; +static gint hf_clk_cmp_comparision_value = -1; +static gint hf_clk_cmp_invalid_tlv = -1; + +/* CLK_CMP fields display */ +static hf_register_info hf_clk_cmp[] = +{ + { + &hf_clk_cmp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.clk_cmp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_clk_cmp_clock_count, + { + "Clock Count", "wimax.clk_cmp.clock_count", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_clk_cmp_clock_id, + { + "Clock ID", "wimax.clk_cmp.clock_id", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_clk_cmp_comparision_value, + { + "Comparision Value", "wimax.clk_cmp.comparision_value", + FT_INT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_clk_cmp_invalid_tlv, + { + "Invalid TLV", "wimax.clk_cmp.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_clk_cmp_seq_number, + { + "Sequence Number", "wimax.clk_cmp.seq_number", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + } +}; + + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_clk_cmp(void) +{ + if (proto_mac_mgmt_msg_clk_cmp_decoder == -1) { + proto_mac_mgmt_msg_clk_cmp_decoder = proto_register_protocol ( + "WiMax CLK-CMP Message", /* name */ + "WiMax CLK-CMP (clk)", /* short name */ + "clk" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_clk_cmp_decoder, hf_clk_cmp, array_length(hf_clk_cmp)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode CLK_CMP messages. */ +void dissect_mac_mgmt_msg_clk_cmp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint i; + guint clock_count; + guint tvb_len, payload_type; + proto_item *clk_cmp_item = NULL; + proto_tree *clk_cmp_tree = NULL; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_CLK_CMP) + { + return; + } + + if (tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type CLK_CMP */ + clk_cmp_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_clk_cmp_decoder, tvb, offset, tvb_len, "Clock Comparision (CLK-CMP) (%u bytes)", tvb_len); + /* add MAC CLK_CMP subtree */ + clk_cmp_tree = proto_item_add_subtree(clk_cmp_item, ett_mac_mgmt_msg_clk_cmp_decoder); + /* display the Message Type */ + proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_message_type, tvb, offset, 1, FALSE); + /* set the offset for clock count */ + offset ++; + /* get the clock count */ + clock_count = tvb_get_guint8(tvb, offset); + /* display the clock count */ + proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_clock_count, tvb, offset, 1, FALSE); + /* set the offset for clock comparision */ + offset++; + for (i = 0; i < clock_count; i++ ) + { /* display the Clock ID */ + proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_clock_id, tvb, offset++, 1, FALSE); + /* display the sequence number */ + proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_seq_number, tvb, offset++, 1, FALSE); + /* display the comparision value */ + proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_comparision_value, tvb, offset++, 1, FALSE); + } + } +} + diff --git a/plugins/wimax/msg_dcd.c b/plugins/wimax/msg_dcd.c new file mode 100644 index 0000000000..be745359b4 --- /dev/null +++ b/plugins/wimax/msg_dcd.c @@ -0,0 +1,1318 @@ +/* msg_dcd.c + * WiMax MAC Management DCD Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* +#define DEBUG +*/ + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" + +extern gint proto_wimax; + +/* Delete the following variable as soon as possible */ +extern gboolean include_cor2_changes; + +/* forward reference */ +void proto_register_mac_mgmt_msg_dcd(void); +void dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +gint proto_mac_mgmt_msg_dcd_decoder = -1; +static gint ett_mac_mgmt_msg_dcd_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_dcd_decoder, +}; + +/* fix fields */ +static gint hf_dcd_message_type = -1; +static gint hf_dcd_downlink_channel_id = -1; +static gint hf_dcd_config_change_count = -1; +static gint hf_dcd_dl_burst_profile_rsv = -1; +static gint hf_dcd_dl_burst_profile_diuc = -1; + +static gint hf_dcd_bs_eirp = -1; +static gint hf_dcd_frame_duration = -1; +static gint hf_dcd_phy_type = -1; +static gint hf_dcd_power_adjustment = -1; +static gint hf_dcd_channel_nr = -1; +static gint hf_dcd_ttg = -1; +static gint hf_dcd_rtg = -1; +#ifdef WIMAX_16D_2004 +static gint hf_dcd_rss = -1; +#endif +static gint hf_dcd_channel_switch_frame_nr = -1; +static gint hf_dcd_frequency = -1; +static gint hf_dcd_bs_id = -1; +static gint hf_dcd_frame_duration_code = -1; +static gint hf_dcd_frame_nr = -1; +#ifdef WIMAX_16D_2004 +static gint hf_dcd_size_cqich_id = -1; +#endif +static gint hf_dcd_h_arq_ack_delay = -1; +static gint hf_dcd_mac_version = -1; +static gint hf_dcd_restart_count = -1; + +static gint hf_dl_burst_reserved = -1; +static gint hf_dl_burst_diuc = -1; +static gint hf_dcd_burst_freq = -1; +static gint hf_dcd_burst_fec = -1; +static gint hf_dcd_burst_diuc_exit_threshold = -1; +static gint hf_dcd_burst_diuc_entry_threshold = -1; +static gint hf_dcd_burst_tcs = -1; +static gint hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone = -1; +static gint hf_dcd_tlv_t_20_maximum_retransmission = -1; +static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter = -1; +static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_physical_cinr_measurements = -1; +static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_rssi_measurements = -1; +static gint hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap = -1; + +static gint hf_dcd_tlv_t_34_dl_region_definition = -1; +static gint hf_dcd_tlv_t_34_dl_region_definition_num_region = -1; +static gint hf_dcd_tlv_t_34_dl_region_definition_reserved = -1; +static gint hf_dcd_tlv_t_34_dl_region_definition_symbol_offset = -1; +static gint hf_dcd_eirxp = -1; +static gint hf_dcd_tlv_t_34_dl_region_definition_subchannel_offset = -1; +static gint hf_dcd_tlv_t_34_dl_region_definition_num_symbols = -1; +static gint hf_dcd_tlv_t_34_dl_region_definition_num_subchannels = -1; +static gint hf_dcd_tlv_t_50_ho_type_support = -1; +static gint hf_dcd_tlv_t_50_ho_type_support_ho = -1; +static gint hf_dcd_tlv_t_50_ho_type_support_mdho = -1; +static gint hf_dcd_tlv_t_50_ho_type_support_fbss_ho = -1; +static gint hf_dcd_tlv_t_50_ho_type_support_reserved = -1; +static gint hf_dcd_tlv_t_31_h_add_threshold = -1; +static gint hf_dcd_tlv_t_45_paging_interval_length = -1; +static gint hf_dcd_tlv_t_32_h_delete_threshold = -1; +static gint hf_dcd_tlv_t_33_asr = -1; +static gint hf_dcd_tlv_t_33_asr_m = -1; +static gint hf_dcd_tlv_t_33_asr_l = -1; +static gint hf_dcd_tlv_t_35_paging_group_id = -1; +static gint hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap = -1; +static gint hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap = -1; +static gint hf_dcd_tlv_t_51_hysteresis_margin = -1; +static gint hf_dcd_tlv_t_52_time_to_trigger_duration = -1; +static gint hf_dcd_tlv_t_60_noise_interference = -1; +static gint hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types = -1; + +static gint hf_dcd_tlv_t_541_type_function_action = -1; +static gint hf_dcd_tlv_t_541_type = -1; +static gint hf_dcd_tlv_t_541_function = -1; +static gint hf_dcd_tlv_t_541_action = -1; +static gint hf_dcd_tlv_t_542_trigger_value = -1; +static gint hf_dcd_tlv_t_543_trigger_averaging_duration = -1; + +static gint hf_dcd_unknown_type = -1; +static gint hf_dcd_invalid_tlv = -1; + +/* DCD DIUC messages (table 143) */ +static const value_string diuc_msgs[] = +{ + {0, "Downlink Burst Profile 1"}, + {1, "Downlink Burst Profile 2"}, + {2, "Downlink Burst Profile 3"}, + {3, "Downlink Burst Profile 4"}, + {4, "Downlink Burst Profile 5"}, + {5, "Downlink Burst Profile 6"}, + {6, "Downlink Burst Profile 7"}, + {7, "Downlink Burst Profile 8"}, + {8, "Downlink Burst Profile 9"}, + {9, "Downlink Burst Profile 10"}, + {10, "Downlink Burst Profile 11"}, + {11, "Downlink Burst Profile 12"}, + {12, "Downlink Burst Profile 13"}, + {13, "Reserved"}, + {14, "Gap"}, + {15, "End of DL-MAP"}, + {0, NULL} +}; + +static const value_string vals_dcd_type[] = +{ + {0, "CINR metric"}, + {1, "RSSI metric"}, + {2, "RTD metric"}, + {3, "Reserved"}, + {0, NULL} +}; + +static const value_string vals_dcd_function[] = +{ + {0, "Reserved"}, + {1, "Metric of neighbor BS is greater than absolute value"}, + {2, "Metric of neighbor BS is less than absolute value"}, + {3, "Metric of neighbor BS is greater than serving BS metric by relative value"}, + {4, "Metric of neighbor BS is less than serving BS metric by relative value"}, + {5, "Metric of serving BS greater than absolute value"}, + {6, "Metric of serving BS less than absolute value"}, + {7, "Reserved"}, + {0, NULL} +}; + +static const value_string vals_dcd_action[] = +{ + {0, "Reserved"}, + {1, "Respond on trigger with MOB_SCN-REP after the end of each scanning interval"}, + {2, "Respond on trigger with MOB_MSH-REQ"}, + {3, "On trigger, MS starts neighbor BS scanning process by sending MOB_SCN-REQ"}, + {4, "Reserved"}, + {0, NULL} +}; + +static const value_string vals_dcd_power_adjustmnt[] = +{ + {0, "Preserve Peak Power"}, + {1, "Preserve Mean Power"}, + {0, NULL} +}; + +static const true_false_string tfs_dcd_power_adjustment = +{ + "Preserve Mean Power", + "Preserve Peak Power" +}; + +static const value_string vals_reg_rsp_status[] = +{ + {0, "OK"}, + {1, "Message authentication failure"}, + {0, NULL} +}; + +static const value_string vals_dcd_burst_tcs[] = +{ + {0, "TCS disabled"}, + {1, "TCS enabled"}, + {0, NULL} +}; + +static const true_false_string tfs_dcd_burst_tcs = +{ + "TCS enabled", + "TCS disabled" +}; + +static const value_string vals_dcd_frame_duration[] = +{ + {0, "2.5"}, + {1, "4"}, + {2, "5"}, + {3, "8"}, + {4, "10"}, + {5, "12.5"}, + {6, "20"}, + {0, NULL} +}; + +#ifdef WIMAX_16D_2004 +static const value_string vals_dcd_size_of_cqich_id[] = +{ + {0, "Reserved"}, + {1, "3 bits"}, + {2, "4 bits"}, + {3, "5 bits"}, + {4, "6 bits"}, + {5, "7 bits"}, + {6, "8 bits"}, + {7, "9 bits"}, + {0, NULL} +}; +#endif + +static const value_string vals_dcd_mac_version[] = +{ + {1, "Conformance with IEEE Std 802.16-2001"}, + {2, "Conformance with IEEE Std 802.16c-2002 and its predecessors"}, + {3, "Conformance with IEEE Std 802.16a-2003 and its predecessors"}, + {4, "Conformance with IEEE Std 802.16-2004"}, + {5, "Conformance with IEEE Std 802.16-2004 and IEEE Std 802.16e-2005"}, + {6, "reserved"}, + {0, NULL} +}; + +/* table 363 */ +static const value_string vals_dcd_burst_fec_ofdma[] = +{ + {0, "QPSK (CC) 1/2"}, + {1, "QPSK (CC) 3/4"}, + {2, "16-QAM (CC) 1/2"}, + {3, "16-QAM (CC) 3/4"}, + {4, "64-QAM (CC) 1/2"}, + {5, "64-QAM (CC) 2/3"}, + {6, "64-QAM (CC) 3/4"}, + {7, "QPSK (BTC) 1/2"}, + {8, "QPSK (BTC) 3/4 or 2/3"}, + {9, "16-QAM (BTC) 3/5"}, + {10, "16-QAM (BTC) 4/5"}, + {11, "64-QAM (BTC) 2/3 or 5/8"}, + {12, "64-QAM (BTC) 5/6 or 4/5"}, + {13, "QPSK (CTC) 1/2"}, + {14, "Reserved"}, + {15, "QPSK (CTC) 3/4"}, + {16, "16-QAM (CTC) 1/2"}, + {17, "16-QAM (CTC) 3/4"}, + {18, "64-QAM (CTC) 1/2"}, + {19, "64-QAM (CTC) 2/3"}, + {20, "64-QAM (CTC) 3/4"}, + {21, "64-QAM (CTC) 5/6"}, + {22, "QPSK (ZT CC) 1/2"}, + {23, "QPSK (ZT CC) 3/4"}, + {24, "16-QAM (ZT CC) 1/2"}, + {25, "16-QAM (ZT CC) 3/4"}, + {26, "64-QAM (ZT CC) 1/2"}, + {27, "64-QAM (ZT CC) 2/3"}, + {28, "64-QAM (ZT CC) 3/4"}, + {29, "QPSK (LDPC) 1/2"}, + {30, "QPSK (LDPC) 2/3 A code"}, + {31, "16-QAM (LDPC) 3/4 A code"}, + {32, "16-QAM (LDPC) 1/2"}, + {33, "16-QAM (LDPC) 2/3 A code"}, + {34, "16-QAM (LDPC) 3/4 A code"}, + {35, "64-QAM (LDPC) 1/2"}, + {36, "64-QAM (LDPC) 2/3 A code"}, + {37, "64-QAM (LDPC) 3/4 A code"}, + {38, "QPSK (LDPC) 2/3 B code"}, + {39, "QPSK (LDPC) 3/4 B code"}, + {40, "16-QAM (LDPC) 2/3 B code"}, + {41, "16-QAM (LDPC) 3/4 B code"}, + {42, "64-QAM (LDPC) 2/3 B code"}, + {43, "64-QAM (LDPC) 3/4 B code"}, + {44, "QPSK (CC with optional interleaver) 1/2"}, + {45, "QPSK (CC with optional interleaver) 3/4"}, + {46, "16-QAM (CC with optional interleaver) 1/2"}, + {47, "16-QAM (CC optional interleaver) 3/4"}, + {48, "64-QAM (CC with optional interleaver) 2/3"}, + {49, "64-QAM (CC with optional interleaver) 3/4"}, + {50, "QPSK (LDPC) 5/6"}, + {51, "16-QAM (LDPC) 5/6"}, + {52, "64-QAM (LDPC) 5/6"}, + {0, NULL} +}; + +static const value_string vals_dcd_permutation_type[] = +{ + {0, "PUSC"}, + {1, "FUSC"}, + {2, "optional FUSC"}, + {3, "AMC"}, + {0, NULL} +}; + +static const value_string tfs_support[] = +{ + {0, "not supported"}, + {1, "supported"}, + {0, NULL} +}; + +/* DCD display */ +static hf_register_info hf[] = +{ + { + &hf_dcd_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dcd", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_33_asr, + { + "ASR (Anchor Switch Report) Slot Length (M) and Switching Period (L)", "wimax.dcd.asr", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_33_asr_l, + { + "ASR Switching Period (L)", "wimax.dcd.asr.l", + FT_UINT8, BASE_DEC, NULL, 0x0f, "", HFILL + } + }, + { + &hf_dcd_tlv_t_33_asr_m, + { + "ASR Slot Length (M)", "wimax.dcd.asr.m", + FT_UINT8, BASE_DEC, NULL, 0xf0, "", HFILL + } + }, + { + &hf_dcd_bs_eirp, + { + "BS EIRP", "wimax.dcd.bs_eirp", + FT_INT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_bs_id, + { + "Base Station ID", "wimax.dcd.bs_id", + FT_ETHER, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_restart_count, + { + "BS Restart Count", "wimax.dcd.bs_restart_count", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dl_burst_diuc, + { + "DIUC", "wimax.dcd.burst.diuc", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, + { + &hf_dcd_burst_diuc_entry_threshold, + { + "DIUC Minimum Entry Threshold (in 0.25 dB units)", "wimax.dcd.burst.diuc_entry_threshold", + FT_FLOAT, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_burst_diuc_exit_threshold, + { + "DIUC Mandatory Exit Threshold (in 0.25 dB units)", "wimax.dcd.burst.diuc_exit_threshold", + FT_FLOAT, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_burst_fec, + { + "FEC Code Type", "wimax.dcd.burst.fec", + FT_UINT8, BASE_DEC, VALS(vals_dcd_burst_fec_ofdma), 0x00, "", HFILL + } + }, + { + &hf_dcd_burst_freq, + { + "Frequency", "wimax.dcd.burst.freq", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dl_burst_reserved, + { + "Reserved", "wimax.dcd.burst.reserved", + FT_UINT8, BASE_HEX, NULL, 0xF0, "", HFILL + } + }, + { + &hf_dcd_burst_tcs, + { + "TCS", "wimax.dcd.burst.tcs", + FT_UINT8, BASE_DEC, VALS(vals_dcd_burst_tcs), 0x00, "", HFILL + } + }, + { + &hf_dcd_channel_nr, + { + "Channel Nr", "wimax.dcd.channel_nr", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_config_change_count, + { + "Configuration Change Count", "wimax.dcd.config_change_count", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_physical_cinr_measurements, + { + "Default Averaging Parameter for Physical CINR Measurements (in multiples of 1/16)", "wimax.dcd.default_physical_cinr_meas_averaging_parameter", + FT_UINT8, BASE_HEX, NULL, 0xf0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter, + { + "Default RSSI and CINR Averaging Parameter", "wimax.dcd.default_rssi_and_cinr_averaging_parameter", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_rssi_measurements, + { + "Default Averaging Parameter for RSSI Measurements (in multiples of 1/16)", "wimax.dcd.default_rssi_meas_averaging_parameter", + FT_UINT8, BASE_HEX, NULL, 0x0f, "", HFILL + } + }, + { + &hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap, + { + "DL AMC Allocated Physical Bands Bitmap", "wimax.dcd.dl_amc_allocated_phy_bands_bitmap", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_dl_burst_profile_diuc, + { + "DIUC", "wimax.dcd.dl_burst_profile_diuc", + FT_UINT8, BASE_DEC, VALS(diuc_msgs), 0x0F, "", HFILL + } + }, + { + &hf_dcd_dl_burst_profile_rsv, + { + "Reserved", "wimax.dcd.dl_burst_profile_rsv", + FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL + } + }, + { + &hf_dcd_downlink_channel_id, + { + "Reserved", "wimax.dcd.dl_channel_id", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types, + { + "Downlink Burst Profile for Multiple FEC Types","wimax.dcd.dl_burst_profile_multiple_fec_types", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_34_dl_region_definition, + { + "DL Region Definition", "wimax.dcd.dl_region_definition", + FT_BYTES, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_34_dl_region_definition_num_region, + { + "Number of Regions", "wimax.dcd.dl_region_definition.num_region", + FT_UINT8, BASE_DEC, NULL, 0xFC, "", HFILL + } + }, + { + &hf_dcd_tlv_t_34_dl_region_definition_num_subchannels, + { + "Number of Subchannels", "wimax.dcd.dl_region_definition.num_subchannels", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_34_dl_region_definition_num_symbols, + { + "Number of OFDMA Symbols", "wimax.dcd.dl_region_definition.num_symbols", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_34_dl_region_definition_reserved, + { + "Reserved", "wimax.dcd.dl_region_definition.reserved", + FT_UINT8, BASE_DEC, NULL, 0x03, "", HFILL + } + }, + { + &hf_dcd_tlv_t_34_dl_region_definition_subchannel_offset, + { + "Subchannel Offset", "wimax.dcd.dl_region_definition.subchannel_offset", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_34_dl_region_definition_symbol_offset, + { + "OFDMA Symbol Offset", "wimax.dcd.dl_region_definition.symbol_offset", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, +#ifndef WIMAX_16D_2004 + { + &hf_dcd_eirxp, + { + "EIRXP (IR, max)", "wimax.dcd.eirxp", + FT_INT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, +#endif + { + &hf_dcd_frame_duration, + { + "Frame Duration", "wimax.dcd.frame_duration", + FT_UINT32, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_frame_duration_code, + { + "Frame Duration Code", "wimax.dcd.frame_duration_code", + FT_UINT8, BASE_HEX, VALS(vals_dcd_frame_duration), 0x00, "", HFILL + } + }, + { + &hf_dcd_frame_nr, + { + "Frame Number", "wimax.dcd.frame_nr", + FT_UINT24, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_frequency, + { + "Downlink Center Frequency", "wimax.dcd.frequency", + FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_31_h_add_threshold, + { + "H_add Threshold", "wimax.dcd.h_add_threshold", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, +#ifdef WIMAX_16D_2004 + { + &hf_dcd_h_arq_ack_delay, + { + "H-ARQ ACK Delay for DL Burst", "wimax.dcd.h_arq_ack_delay_dl_burst", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, +#else + { + &hf_dcd_h_arq_ack_delay, + { + "H-ARQ ACK Delay for UL Burst", "wimax.dcd.h_arq_ack_delay_ul_burst", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, +#endif + { + &hf_dcd_tlv_t_32_h_delete_threshold, + { + "H_delete Threshold", "wimax.dcd.h_delete_threshold", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_50_ho_type_support, + { + "HO Type Support", "wimax.dcd.ho_type_support", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_50_ho_type_support_fbss_ho, + { + "FBSS HO", "wimax.dcd.ho_type_support.fbss_ho", + FT_UINT8, BASE_HEX, VALS(tfs_support), 0x20, "", HFILL + } + }, + { + &hf_dcd_tlv_t_50_ho_type_support_ho, + { + "HO", "wimax.dcd.ho_type_support.ho", + FT_UINT8, BASE_HEX, VALS(tfs_support), 0x80, "", HFILL + } + }, + { + &hf_dcd_tlv_t_50_ho_type_support_mdho, + { + "MDHO", "wimax.dcd.ho_type_support.mdho", + FT_UINT8, BASE_HEX, VALS(tfs_support), 0x40, "", HFILL + } + }, + { + &hf_dcd_tlv_t_50_ho_type_support_reserved, + { + "Reserved", "wimax.dcd.ho_type_support.reserved", + FT_UINT8, BASE_HEX, NULL, 0x1f, "", HFILL + } + }, + { + &hf_dcd_tlv_t_51_hysteresis_margin, + { + "Hysteresis Margin", "wimax.dcd.hysteresis_margin", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_invalid_tlv, + { + "Invalid TLV", "wimax.dcd.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_dcd_mac_version, + { + "MAC Version", "wimax.dcd.mac_version", + FT_UINT8, BASE_DEC, VALS(vals_dcd_mac_version), 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_20_maximum_retransmission, + { + "Maximum Retransmission", "wimax.dcd.maximum_retransmission", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_60_noise_interference, + { + "Noise and Interference", "wimax.dcd.noise_interference", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_35_paging_group_id, + { + "Paging Group ID", "wimax.dcd.paging_group_id", + FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap, + { + "TUSC1 permutation active subchannels bitmap", "wimax.dcd.tusc1", + FT_UINT16, BASE_HEX, NULL, 0xFF80, "", HFILL + } + }, + { + &hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap, + { + "TUSC2 permutation active subchannels bitmap", "wimax.dcd.tusc2", + FT_UINT16, BASE_HEX, NULL, 0xFFF8, "", HFILL + } + }, + { + &hf_dcd_tlv_t_45_paging_interval_length, + { + "Paging Interval Length", "wimax.dcd.paging_interval_length", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone, + { + "Permutation Type for Broadcast Region in HARQ Zone", "wimax.dcd.permutation_type_broadcast_region_in_harq_zone", + FT_UINT8, BASE_DEC, VALS(vals_dcd_permutation_type), 0x00, "", HFILL + } + }, + { + &hf_dcd_phy_type, + { + "PHY Type", "wimax.dcd.phy_type", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_power_adjustment, + { + "Power Adjustment Rule", "wimax.dcd.power_adjustment", + FT_UINT8, BASE_HEX, VALS(vals_dcd_power_adjustmnt), 0x00, "", HFILL + } + }, +#ifdef WIMAX_16D_2004 + { + &hf_dcd_rss, + { + "RSS (IR, max)", "wimax.dcd.rss", + FT_INT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, +#endif + { + &hf_dcd_rtg, + { + "RTG", "wimax.dcd.rtg", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, +#ifdef WIMAX_16D_2004 + { + &hf_dcd_size_cqich_id, + { + "Size of CQICH-ID Field", "wimax.dcd.size_cqich_id", + FT_UINT8, BASE_DEC, VALS(vals_dcd_size_of_cqich_id), 0x00, "", HFILL + } + }, +#endif + { + &hf_dcd_channel_switch_frame_nr, + { + "Channel Switch Frame Number", "wimax.dcd.switch_frame", + FT_UINT24, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_52_time_to_trigger_duration, + { + "Time to Trigger Duration", "wimax.dcd.time_trigger_duration", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_543_trigger_averaging_duration, + { + "Trigger Averaging Duration", "wimax.dcd.trigger_averaging_duration", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_542_trigger_value, + { + "Trigger Value", "wimax.dcd.trigger_value", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_ttg, + { + "TTG", "wimax.dcd.ttg", + FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dcd_tlv_t_541_type_function_action, + { + "Type/Function/Action", "wimax.dcd.type_function_action", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dcd_tlv_t_541_action, + { + "Action", "wimax.dcd.type_function_action.action", + FT_UINT8, BASE_HEX, VALS(vals_dcd_action), 0x7, "", HFILL + } + }, + { + &hf_dcd_tlv_t_541_function, + { + "Function", "wimax.dcd.type_function_action.function", + FT_UINT8, BASE_HEX, VALS(vals_dcd_function), 0x38, "", HFILL + } + }, + { + &hf_dcd_tlv_t_541_type, + { + "Type", "wimax.dcd.type_function_action.type", + FT_UINT8, BASE_HEX, VALS(vals_dcd_type), 0xC0, "", HFILL + } + }, + { + &hf_dcd_unknown_type, + { + "Unknown DCD Type", "wimax.dcd.unknown_tlv_value", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_dcd(void) +{ + if (proto_mac_mgmt_msg_dcd_decoder == -1) + { + proto_mac_mgmt_msg_dcd_decoder = proto_register_protocol ( + "WiMax DCD/UCD Messages", /* name */ + "WiMax DCD/UCD (cd)", /* short name */ + "cd" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_dcd_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* WiMax MAC Management DCD message (table 15) dissector */ +void dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, length; + guint configChangeCount; + gint tlv_type, tlv_len, tlv_offset, tlv_value_offset; + guint dl_burst_diuc, dl_num_regions; + proto_item *dcd_item = NULL; + proto_tree *dcd_tree = NULL; + proto_item *tlv_item = NULL; + proto_tree *tlv_tree = NULL; + proto_tree *sub_tree = NULL; + tlv_info_t tlv_info; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_DCD) + { + return; + } + + if(tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type DCD */ + dcd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tvb_len, "Downlink Channel Descriptor (DCD) (%u bytes)", tvb_len); + /* add MAC DCD subtree */ + dcd_tree = proto_item_add_subtree(dcd_item, ett_mac_mgmt_msg_dcd_decoder); + /* Decode and display the Downlink Channel Descriptor (DCD) */ + /* display the Message Type */ + proto_tree_add_item(dcd_tree, hf_dcd_message_type, tvb, offset, 1, FALSE); + /* set the offset for the Downlink Channel ID */ + offset++; + /* display the Downlink Channel ID */ + proto_tree_add_item(dcd_tree, hf_dcd_downlink_channel_id, tvb, offset, 1, FALSE); + /* set the offset for the Configuration Change Count */ + offset++; + /* get the Configuration Change Count */ + configChangeCount = tvb_get_guint8(tvb, offset); + /* display the Configuration Change Count */ + proto_tree_add_item(dcd_tree, hf_dcd_config_change_count, tvb, offset, 1, FALSE); + /* set the offset for the TLV Encoded info */ + offset++; + /* process the DCD TLV Encoded information (table 358) */ + while(offset < tvb_len) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DCD TLV error"); + } + proto_tree_add_item(dcd_tree, hf_dcd_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + tlv_item = proto_tree_add_protocol_format(dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, (tlv_len + tlv_value_offset), "DCD Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len, offset, tvb_len); +#endif + /* update the offset */ + offset += tlv_value_offset; + /* process DCD TLVs */ + switch (tlv_type) + { + case DCD_DOWNLINK_BURST_PROFILE: + { /* Downlink Burst Profile TLV (table 363)*/ + /* get the DIUC */ + dl_burst_diuc = (tvb_get_guint8(tvb, offset) & 0x0F); + /* display TLV info */ + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tlv_len, "Downlink_Burst_Profile (DIUC=%u) (%u bytes)", (dl_burst_diuc+1), tlv_len); + /* detail display */ + proto_tree_add_item(tlv_tree, hf_dcd_dl_burst_profile_rsv, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_dl_burst_profile_diuc, tvb, offset, 1, FALSE); + /* process subTLVs */ + for (tlv_offset = 1; tlv_offset < tlv_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset+tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DL Burst Profile TLV error"); + } + proto_tree_add_item(tlv_tree, hf_dcd_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case DCD_BURST_FREQUENCY: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_burst_freq, tvb, (offset+tlv_offset), 1, FALSE); + tlv_item = proto_tree_add_item(sub_tree, hf_dcd_burst_freq, tvb, (offset+tlv_offset), 1, FALSE); + proto_item_append_text(tlv_item, " kHz"); + break; + } + case DCD_BURST_FEC_CODE_TYPE: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_burst_fec, tvb, (offset+tlv_offset), 1, FALSE); + proto_tree_add_item(sub_tree, hf_dcd_burst_fec, tvb, (offset+tlv_offset), 1, FALSE); + break; + } + case DCD_BURST_DIUC_EXIT_THRESHOLD: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_burst_diuc_exit_threshold, tvb, (offset+tlv_offset), length, FALSE); + tlv_item = proto_tree_add_item(sub_tree, hf_dcd_burst_diuc_exit_threshold, tvb, (offset+tlv_offset), length, FALSE); + break; + } + case DCD_BURST_DIUC_ENTRY_THRESHOLD: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_burst_diuc_entry_threshold, tvb, (offset+tlv_offset), length, FALSE); + tlv_item = proto_tree_add_item(sub_tree, hf_dcd_burst_diuc_entry_threshold, tvb, (offset+tlv_offset), length, FALSE); + break; + } + case DCD_BURST_TCS_ENABLE: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_burst_tcs, tvb, (offset+tlv_offset), length, FALSE); + proto_tree_add_item(sub_tree, hf_dcd_burst_tcs, tvb, (offset+tlv_offset), 1, FALSE); + break; + } + default: + /* ??? */ + break; + } + tlv_offset += length; + } + break; + } + case DCD_BS_EIRP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_bs_eirp, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_bs_eirp, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " dBm"); + break; + } + case DCD_FRAME_DURATION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_frame_duration, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_frame_duration, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_PHY_TYPE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_phy_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_phy_type, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_POWER_ADJUSTMENT: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_power_adjustment, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_power_adjustment, tvb, offset, 1, FALSE); + break; + } + case DCD_CHANNEL_NR: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_channel_nr, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_channel_nr, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TTG: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_ttg, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_ttg, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " PS"); + break; + } + case DCD_RTG: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_rtg, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_rtg, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " PS"); + break; + } +#ifdef WIMAX_16D_2004 + case DCD_RSS: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_rss, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_rss, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " dBm"); + break; + } +#else + case DCD_EIRXP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_eirxp, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_eirxp, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " dBm"); + break; + } +#endif + case DCD_CHANNEL_SWITCH_FRAME_NR: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_channel_switch_frame_nr, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_channel_switch_frame_nr, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_FREQUENCY: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_frequency, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_frequency, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " kHz"); + break; + } + case DCD_BS_ID: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_bs_id, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_bs_id, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_FRAME_DURATION_CODE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_frame_duration_code, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_frame_duration_code, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_FRAME_NR: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_frame_nr, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_frame_nr, tvb, offset, tlv_len, FALSE); + break; + } +#ifdef WIMAX_16D_2004 + case DCD_SIZE_CQICH_ID: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_size_cqich_id, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_size_cqich_id, tvb, offset, tlv_len, FALSE); + break; + } +#endif + case DCD_H_ARQ_ACK_DELAY: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_h_arq_ack_delay, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_h_arq_ack_delay, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " frame offset"); + break; + } + case DCD_MAC_VERSION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_mac_version, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_mac_version, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_19_PERMUTATION_TYPE_FOR_BROADCAST_REGION_IN_HARQ_ZONE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_20_MAXIMUM_RETRANSMISSION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_20_maximum_retransmission, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_20_maximum_retransmission, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_21_DEFAULT_RSSI_AND_CINR_AVERAGING_PARAMETER: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, 1, "Default RSSI and CINR averaging parameter (%u byte(s))", tlv_len); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_physical_cinr_measurements, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_rssi_measurements, tvb, offset, 1, FALSE); + break; + } + case DCD_TLV_T_22_DL_AMC_ALLOCATED_PHYSICAL_BANDS_BITMAP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_34_DL_REGION_DEFINITION: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tlv_len, "DL region definition (%u byte(s))", tlv_len); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition, tvb, offset, tlv_len, FALSE); + dl_num_regions = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_num_region, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_reserved, tvb, offset, 1, FALSE); + tlv_offset = offset; + for(length = 0; length < dl_num_regions; length++) + { + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_symbol_offset, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_subchannel_offset, tvb, (tlv_offset+1), 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_num_symbols, tvb, (tlv_offset+2), 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_num_subchannels, tvb, (tlv_offset+3), 1, FALSE); + tlv_offset += 4; + } + break; + } + case DCD_TLV_T_50_HO_TYPE_SUPPORT: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tlv_len, "HO type support (%u byte(s))", tlv_len); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support_ho, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support_mdho, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support_fbss_ho, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support_reserved, tvb, offset, 1, FALSE); + break; + } + case DCD_TLV_T_31_H_ADD_THRESHOLD: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_31_h_add_threshold, tvb, offset, 1, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_31_h_add_threshold, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " dB"); + break; + } + case DCD_TLV_T_32_H_DELETE_THRESHOLD: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_32_h_delete_threshold, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_32_h_delete_threshold, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " dB"); + break; + } + case DCD_TLV_T_33_ASR: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tlv_len, "ASR Slot Length (M) and Switching Period (L) (%u byte(s))", tlv_len); + proto_tree_add_item(dcd_tree, hf_dcd_tlv_t_33_asr, tvb, offset, 1, FALSE); + tlv_item = proto_tree_add_item(dcd_tree, hf_dcd_tlv_t_33_asr_m, tvb, offset, 1, FALSE); + proto_item_append_text(tlv_item, " frames"); + tlv_item = proto_tree_add_item(dcd_tree, hf_dcd_tlv_t_33_asr_l, tvb, offset, 1, FALSE); + proto_item_append_text(tlv_item, " frames"); + break; + } + case DCD_TLV_T_35_PAGING_GROUP_ID: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_35_paging_group_id, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_35_paging_group_id, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_36_TUSC1_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_37_TUSC2_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_51_HYSTERSIS_MARGIN: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_51_hysteresis_margin, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_51_hysteresis_margin, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " dB"); + break; + } + case DCD_TLV_T_52_TIME_TO_TRIGGER_DURATION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_52_time_to_trigger_duration, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_52_time_to_trigger_duration, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " ms"); + break; + } + case DCD_TLV_T_54_TRIGGER: + { /* Trigger TLV (table 358a & 358b) */ + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tlv_len, "DCD Trigger (%u bytes)", tlv_len); + for (tlv_offset = 0; tlv_offset < tlv_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset + tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Trigger TLV error"); + } + proto_tree_add_item(tlv_tree, hf_dcd_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + /* table 358a */ + switch (tlv_type) + { + case DCD_TLV_T_541_TYPE_FUNCTION_ACTION: + { /* table 358b */ + sub_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, (offset + tlv_offset), length, "Trigger; Type/function/action description (%u byte(s))", tlv_len); + proto_tree_add_item(sub_tree, hf_dcd_tlv_t_541_type, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(sub_tree, hf_dcd_tlv_t_541_function, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(sub_tree, hf_dcd_tlv_t_541_action, tvb, (offset + tlv_offset), 1, FALSE); + } + break; + case DCD_TLV_T542_TRIGGER_VALUE: + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_tlv_t_542_trigger_value, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(sub_tree, hf_dcd_tlv_t_542_trigger_value, tvb, (offset + tlv_offset), length, FALSE); + break; + case DCD_TLV_T_543_TRIGGER_AVERAGING_DURATION: + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_tlv_t_543_trigger_averaging_duration, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(sub_tree, hf_dcd_tlv_t_543_trigger_averaging_duration, tvb, (offset + tlv_offset), length, FALSE); + break; + } + tlv_offset += length; + } + break; + } + case DCD_TLV_T_60_NOISE_AND_INTERFERENCE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_60_noise_interference, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_60_noise_interference, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_153_DOWNLINK_BURST_PROFILE_FOR_MULTIPLE_FEC_TYPES: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_RESTART_COUNT: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_restart_count, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_restart_count, tvb, offset, tlv_len, FALSE); + break; + } + case DCD_TLV_T_45_PAGING_INTERVAL_LENGTH: + { + if (include_cor2_changes) { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tlv_len, "Reserved (%u byte(s))", tlv_len); + proto_tree_add_text(tlv_tree, tvb, offset, tlv_len, "Reserved"); + } else { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_tlv_t_45_paging_interval_length, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_45_paging_interval_length, tvb, offset, tlv_len, FALSE); + } + break; + } + default: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, hf_dcd_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_dcd_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + } + offset += tlv_len; + } /* end of TLV process while loop */ + } +} diff --git a/plugins/wimax/msg_dlmap.c b/plugins/wimax/msg_dlmap.c new file mode 100644 index 0000000000..e5be7abb9a --- /dev/null +++ b/plugins/wimax/msg_dlmap.c @@ -0,0 +1,2819 @@ +/* msg_dlmap.c + * WiMax MAC Management DL-MAP Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Mike Harvey <michael.harvey@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_bits.h" + +extern gint proto_wimax; +extern gboolean include_cor2_changes; + +#define MAC_MGMT_MSG_DLMAP 2 + +#define XBIT(var, bits, desc) \ + do { \ + var = BIT_BITS(bit, bufptr, bits); \ + proto_tree_add_text(tree, tvb, BITHI(bit, bits), desc ": %d", var); \ + bit += bits; \ + } while(0) + +#define VBIT(var, bits, hf) \ + do { \ + var = BIT_BITS(bit, bufptr, bits); \ + proto_tree_add_uint(tree, hf, tvb, BITHI(bit,bits), var); \ + bit += bits; \ + } while(0) + +#define XNIB(var, nibs, desc) \ + do { \ + var = NIB_NIBS(nib, bufptr, nibs); \ + proto_tree_add_text(tree, tvb, NIBHI(nib, nibs), desc ": %d", var); \ + nib += nibs; \ + } while(0) + +gint harq = 0; /* 1 if HARQ enabled (TODO) */ +gint fusc = 0; /* 1 if current zone permutation is FUSC or optional FUSC (TODO) */ +gint tusc = 0; /* 1 if current zone permutation is AMC, TUSC1 or TUSC2 (TODO) */ +gint ir_type = 0; /* reduced AAS map (TODO) */ +gint RCID_Type = 0; +gint N_layer = 0; +gint STC_Zone_Dedicated_Pilots = 0; +gint STC_Zone_Matrix = 0; +gint INC_CID = 0; +gint sub_dl_ul_map = 0; + + +extern gint man_ofdma; + +/* forward reference */ +void dissect_mac_mgmt_msg_dlmap_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +gint proto_mac_mgmt_msg_dlmap_decoder = -1; + +static gint ett_dlmap = -1; +static gint ett_dlmap_ie = -1; +static gint ett_dlmap_c_ie = -1; +static gint ett_109x = -1; /* SUB-DL-UL-MAP */ +static gint ett_109x_dl = -1; +static gint ett_109x_ul = -1; +static gint ett_275_phy = -1; +static gint ett_275_1 = -1; +static gint ett_277 = -1; +static gint ett_277b = -1; +static gint ett_278 = -1; +static gint ett_279 = -1; +static gint ett_280 = -1; +static gint ett_281 = -1; +static gint ett_282 = -1; +static gint ett_283 = -1; +static gint ett_284 = -1; +static gint ett_285 = -1; +static gint ett_286 = -1; +static gint ett_286a = -1; +static gint ett_286b = -1; +static gint ett_286c = -1; +static gint ett_286d = -1; +static gint ett_286e = -1; +static gint ett_286f = -1; +static gint ett_286g = -1; +static gint ett_286h = -1; +static gint ett_286i = -1; +static gint ett_286j = -1; +static gint ett_286k = -1; +static gint ett_286l = -1; +static gint ett_286m = -1; +static gint ett_286n = -1; +static gint ett_286o = -1; +static gint ett_286p = -1; +static gint ett_286q = -1; +static gint ett_286r = -1; +static gint ett_286s = -1; +static gint ett_286t = -1; +static gint ett_286u = -1; +static gint ett_286v = -1; +static gint ett_286w = -1; +static gint ett_286x = -1; +static gint ett_286y = -1; +static gint ett_286z = -1; +static gint ett_305 = -1; +static gint ett_305_dl = -1; +static gint ett_308a = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_dlmap, + &ett_dlmap_ie, + &ett_dlmap_c_ie, + &ett_109x, + &ett_109x_dl, + &ett_109x_ul, + &ett_275_phy, + &ett_275_1, + &ett_277, + &ett_277b, + &ett_278, + &ett_279, + &ett_280, + &ett_281, + &ett_282, + &ett_283, + &ett_284, + &ett_285, + &ett_286, + &ett_286a, + &ett_286b, + &ett_286c, + &ett_286d, + &ett_286e, + &ett_286f, + &ett_286g, + &ett_286h, + &ett_286i, + &ett_286j, + &ett_286k, + &ett_286l, + &ett_286m, + &ett_286n, + &ett_286o, + &ett_286p, + &ett_286q, + &ett_286r, + &ett_286s, + &ett_286t, + &ett_286u, + &ett_286v, + &ett_286w, + &ett_286x, + &ett_286y, + &ett_286z, + &ett_305, + &ett_305_dl, + &ett_308a, +}; + +#define DCD_DOWNLINK_BURST_PROFILE 1 +#define DCD_BS_EIRP 2 +#define DCD_FRAME_DURATION 3 +#define DCD_PHY_TYPE 4 +#define DCD_POWER_ADJUSTMENT 5 +#define DCD_CHANNEL_NR 6 +#define DCD_TTG 7 +#define DCD_RTG 8 +#define DCD_RSS 9 +#define DCD_CHANNEL_SWITCH_FRAME_NR 10 +#define DCD_FREQUENCY 12 +#define DCD_BS_ID 13 +#define DCD_FRAME_DURATION_CODE 14 +#define DCD_FRAME_NR 15 +#define DCD_SIZE_CQICH_ID 16 +#define DCD_H_ARQ_ACK_DELAY 17 +#define DCD_MAC_VERSION 148 +#define DCD_RESTART_COUNT 154 + +#define DCD_BURST_FREQUENCY 1 +#define DCD_BURST_FEC_CODE_TYPE 150 +#define DCD_BURST_DIUC_EXIT_THRESHOLD 151 +#define DCD_BURST_DIUC_ENTRY_THRESHOLD 152 +#define DCD_BURST_TCS_ENABLE 153 + +#define DCD_TLV_T_541_TYPE_FUNCTION_ACTION 1 +#define DCD_TLV_T542_TRIGGER_VALUE 2 +#define DCD_TLV_T_543_TRIGGER_AVERAGING_DURATION 3 +#define DCD_TLV_T_19_PERMUTATION_TYPE_FOR_BROADCAST_REGION_IN_HARQ_ZONE 19 +#define DCD_TLV_T_20_MAXIMUM_RETRANSMISSION 20 +#define DCD_TLV_T_21_DEFAULT_RSSI_AND_CINR_AVERAGING_PARAMETER 21 +#define DCD_TLV_T_22_DL_AMC_ALLOCATED_PHYSICAL_BANDS_BITMAP 22 +#define DCD_TLV_T_31_H_ADD_THRESHOLD 31 +#define DCD_TLV_T_32_H_DELETE_THRESHOLD 32 +#define DCD_TLV_T_33_ASR 33 +#define DCD_TLV_T_34_DL_REGION_DEFINITION 34 +#define DCD_TLV_T_35_PAGING_GROUP_ID 35 +#define DCD_TLV_T_36_TUSC1_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP 36 +#define DCD_TLV_T_37_TUSC2_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP 37 +#define DCD_TLV_T_45_PAGING_INTERVAL_LENGTH 45 +#define DCD_TLV_T_50_HO_TYPE_SUPPORT 50 +#define DCD_TLV_T_51_HYSTERSIS_MARGIN 51 +#define DCD_TLV_T_52_TIME_TO_TRIGGER_DURATION 52 +#define DCD_TLV_T_54_TRIGGER 54 +#define DCD_TLV_T_153_DOWNLINK_BURST_PROFILE_FOR_MULTIPLE_FEC_TYPES 153 + +#define DL_MAP_NCT_PMP 0 +#define DL_MAP_NCT_DM 1 +#define DL_MAP_NCT_PTP 2 + +/* NCT messages */ +static const value_string nct_msgs[] = +{ + { DL_MAP_NCT_PMP, "PMP" }, + { DL_MAP_NCT_PMP, "DM" }, + { DL_MAP_NCT_PMP, "PTP" }, + { 0, NULL } +}; + +/* Repetition Coding Indications */ +static const value_string rep_msgs[] = +{ + { 0, "No Repetition Coding" }, + { 1, "Repetition Coding of 2 Used" }, + { 2, "Repetition Coding of 4 Used" }, + { 3, "Repetition Coding of 6 Used" }, + { 0, NULL } +}; + +/* DL Frame Prefix Coding Indications */ +static const value_string boost_msgs[] = +{ + { 0, "Normal (not boosted)" }, + { 1, "+6dB" }, + { 2, "-6dB" }, + { 3, "+9dB" }, + { 4, "+3dB" }, + { 5, "-3dB" }, + { 6, "-9dB" }, + { 7, "-12dB" }, + { 0, NULL } +}; + +/* dl-map fields */ +static gint hf_dlmap_message_type = -1; + +static gint hf_dlmap_phy_fdur = -1; +static gint hf_dlmap_phy_fnum = -1; +static gint hf_dlmap_fch_expected = -1; +static gint hf_dlmap_dcd = -1; +static gint hf_dlmap_bsid = -1; +static gint hf_dlmap_ofdma_sym = -1; +static gint hf_dlmap_ie = -1; +static gint hf_dlmap_ie_diuc = -1; +static gint hf_dlmap_ie_ncid = -1; +static gint hf_dlmap_ie_cid = -1; +static gint hf_dlmap_ie_offsym = -1; +static gint hf_dlmap_ie_offsub = -1; +static gint hf_dlmap_ie_boosting = -1; +static gint hf_dlmap_ie_numsym = -1; +static gint hf_dlmap_ie_numsub = -1; +static gint hf_dlmap_ie_rep = -1; +static gint hf_dlmap_ie_offsym2 = -1; +static gint hf_dlmap_ie_offsub2 = -1; +static gint hf_dlmap_ie_boosting2 = -1; +static gint hf_dlmap_ie_numsym2 = -1; +static gint hf_dlmap_ie_numsub2 = -1; +static gint hf_dlmap_ie_rep2 = -1; + +static gint hf_dlmap_xie_diuc = -1; +static gint hf_dlmap_xie_len = -1; + +static gint hf_dlmapc_compr = -1; +static gint hf_dlmapc_ulmap = -1; +static gint hf_dlmapc_rsv = -1; +static gint hf_dlmapc_len = -1; +static gint hf_dlmapc_sync = -1; +static gint hf_dlmapc_opid = -1; +static gint hf_dlmapc_secid = -1; +static gint hf_dlmapc_count = -1; + +static gint hf_109x_cmi = -1; +static gint hf_109x_len = -1; +static gint hf_109x_rcid = -1; +static gint hf_109x_haoi = -1; +static gint hf_109x_dl = -1; +static gint hf_109x_ul = -1; +static gint hf_109x_dlie = -1; +static gint hf_109x_symofs = -1; +static gint hf_109x_subofs = -1; +static gint hf_109x_rsv = -1; + +static gint hf_308a_cmi = -1; +static gint hf_308a_ulmap = -1; +static gint hf_308a_type = -1; +static gint hf_308a_mult = -1; +static gint hf_308a_rsv = -1; +static gint hf_mac_header_compress_dlmap_crc = -1; + +/* DL-MAP fields display */ +static hf_register_info hf[] = +{ + { + &hf_dlmap_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dlmap", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_bsid, + { + "Base Station ID", "wimax.dlmap.bsid", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_dcd, + { + "DCD Count", "wimax.dlmap.dcd", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_fch_expected, + { + "FCH Expected", "wimax.dlmap.fch_expected", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_ie, + { + "DL-MAP IE", "wimax.dlmap.ie", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_ie_boosting, + { + "Boosting", "wimax.dlmap.ie.boosting", + FT_UINT32, BASE_DEC, VALS(boost_msgs), 0x00038000, "", HFILL + } + }, + { + &hf_dlmap_ie_boosting2, + { + "Boosting", "wimax.dlmap.ie.boosting", + FT_UINT32, BASE_DEC, VALS(boost_msgs), 0x0000E000, "", HFILL + } + }, + { + &hf_dlmap_ie_cid, + { + "CID", "wimax.dlmap.ie.cid", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_ie_diuc, + { + "DIUC", "wimax.dlmap.ie.diuc", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_ie_ncid, + { + "N_CID", "wimax.dlmap.ie.ncid", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_ie_numsub, + { + "Number of Subchannels", "wimax.dlmap.ie.numsub", + FT_UINT32, BASE_DEC, NULL, 0x000000FC, "", HFILL + } + }, + { + &hf_dlmap_ie_numsym, + { + "Number of OFDMA Symbols", "wimax.dlmap.ie.numsym", + FT_UINT32, BASE_DEC, NULL, 0x00007F00, "", HFILL + } + }, + { + &hf_dlmap_ie_numsub2, + { + "Number of Subchannels", "wimax.dlmap.ie.numsub", + FT_UINT32, BASE_DEC, NULL, 0x000000FC, "", HFILL + } + }, + { + &hf_dlmap_ie_numsym2, + { + "Number of OFDMA Symbols", "wimax.dlmap.ie.numsym", + FT_UINT32, BASE_DEC, NULL, 0x00001F00, "", HFILL + } + }, + { + &hf_dlmap_ie_offsub, + { + "Subchannel Offset", "wimax.dlmap.ie.offsub", + FT_UINT32, BASE_DEC, NULL, 0x00FC0000, "", HFILL + } + }, + { + &hf_dlmap_ie_offsym, + { + "OFDMA Symbol Offset", "wimax.dlmap.ie.offsym", + FT_UINT32, BASE_DEC, NULL, 0xFF000000, "", HFILL + } + }, + /* alt ie format */ + { + &hf_dlmap_ie_offsub2, + { + "Subchannel Offset", "wimax.dlmap.ie.offsub", + FT_UINT32, BASE_DEC, NULL, 0x00FF0000, "", HFILL + } + }, + { + &hf_dlmap_ie_offsym2, + { + "OFDMA Symbol Offset", "wimax.dlmap.ie.offsym", + FT_UINT32, BASE_DEC, NULL, 0xFF000000, "", HFILL + } + }, + { + &hf_dlmap_ie_rep, + { + "Repetition Coding Indication", "wimax.dlmap.ie.rep", + FT_UINT32, BASE_DEC, VALS(rep_msgs), 0x00000003, "", HFILL + } + }, + { + &hf_dlmap_ie_rep2, + { + "Repetition Coding Indication", "wimax.dlmap.ie.rep", + FT_UINT32, BASE_DEC, VALS(rep_msgs), 0x00000003, "", HFILL + } + }, + { + &hf_dlmap_ofdma_sym, + { + "Num OFDMA Symbols", "wimax.dlmap.ofdma_sym", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_phy_fdur, + { + "Frame Duration Code", "wimax.dlmap.phy_fdur", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_dlmap_phy_fnum, + { + "Frame Number", "wimax.dlmap.phy_fnum", + FT_UINT24, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmapc_compr, + { + "Compressed map indicator", "wimax.dlmapc.compr", + FT_UINT16, BASE_DEC, NULL, 0xe000, "", HFILL + } + }, + { + &hf_dlmapc_count, + { + "DL IE Count", "wimax.dlmapc.count", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmapc_len, + { + "Map message length", "wimax.dlmapc.len", + FT_UINT16, BASE_DEC, NULL, 0x07FF, "", HFILL + } + }, + { + &hf_dlmapc_opid, + { + "Operator ID", "wimax.dlmapc.opid", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmapc_rsv, + { + "Reserved", "wimax.dlmapc.rsv", + FT_UINT16, BASE_DEC, NULL, 0x0800, "", HFILL + } + }, + { + &hf_dlmapc_secid, + { + "Sector ID", "wimax.dlmapc.secid", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmapc_sync, + { + "PHY Synchronization Field", "wimax.dlmapc.sync", + FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmapc_ulmap, + { + "UL-MAP appended", "wimax.dlmapc.ulmap", + FT_UINT16, BASE_DEC, NULL, 0x1000, "", HFILL + } + }, + { + &hf_dlmap_xie_diuc, + { + "Extended DIUC", "wimax.dlmapc.xie_diuc", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dlmap_xie_len, + { + "Length", "wimax.dlmapc.xie_len", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_109x_cmi, + { + "SUB-DL-UL-MAP map indicator", "wimax.dlul.cmi", + FT_UINT16, BASE_DEC, NULL, 0xE000, "", HFILL + } + }, + { + &hf_109x_dl, + { + "DL HARQ ACK offset", "wimax.dlul.dl", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_109x_dlie, + { + "DL IE Count", "wimax.dlul.dlie", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_109x_haoi, + { + "HARQ ACK offset indicator", "wimax.dlul.haoi", + FT_UINT16, BASE_DEC, NULL, 0x0001, "", HFILL + } + }, + { + &hf_109x_len, + { + "Map message length - The length is limited to 735 bytes at most", "wimax.dlul.len", + FT_UINT16, BASE_DEC, NULL, 0x1FF8, "", HFILL + } + }, + { + &hf_109x_rcid, + { + "RCID_Type", "wimax.dlul.rcid", + FT_UINT16, BASE_DEC, NULL, 0x0006, "", HFILL + } + }, + { + &hf_109x_subofs, + { + "Subchannel offset", "wimax.dlul.subofs", + FT_UINT8, BASE_DEC, NULL, 0xFE, "", HFILL + } + }, + { + &hf_109x_symofs, + { + "OFDMA Symbol offset of subsequent sub-bursts " + "in this Sub-DL-UL-MAP message with reference to " + "the start of UL sub-frame.", "wimax.dlul.symofs", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_109x_rsv, + { + "Reserved", "wimax.dlul.rsv", + FT_UINT8, BASE_DEC, NULL, 0x01, "", HFILL + } + }, + { + &hf_109x_ul, + { + "UL HARQ ACK offset", "wimax.dlul.ul", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_308a_cmi, + { + "Compressed map indicator", "wimax.dlmap.reduced_aas_private.cmi", + FT_UINT8, BASE_DEC, NULL, 0xe0, "", HFILL + } + }, + { + &hf_308a_mult, + { + "Multiple IE", "wimax.dlmap.reduced_aas_private.mult", + FT_UINT8, BASE_DEC, NULL, 0x02, "", HFILL + } + }, + { + &hf_308a_rsv, + { + "Reserved", "wimax.dlmap.reduced_aas_private.rsv", + FT_UINT8, BASE_DEC, NULL, 0x01, "", HFILL + } + }, + { + &hf_308a_type, + { + "Compressed Map Type", "wimax.dlmap.reduced_aas_private.type", + FT_UINT8, BASE_DEC, NULL, 0x0d, "", HFILL + } + }, + { + &hf_308a_ulmap, + { + "UL-MAP appended", "wimax.dlmap.reduced_aas_private.ulmap", + FT_UINT8, BASE_DEC, NULL, 0x10, "", HFILL + } + }, + { + &hf_mac_header_compress_dlmap_crc, + { + "CRC", "wimax.compress_dlmap_crc", + FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL + } + } +}; + +/******************************************************************** + * DL-MAP Miscellaneous IEs and TLVs + *******************************************************************/ + +gint RCID_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb, gint RCID_Type) +{ + /* RCID_IE 8.4.5.3 and 8.4.5.3.20.1 */ + /* offset of IE in bits, length is variable */ + gint bit = offset; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint Prefix = 0; + gint cid = 0; + + if (RCID_Type == 0) + length = 16; + else { + Prefix = BIT_BIT(bit, bufptr); + if (Prefix == 1) length = 12; + else if (RCID_Type == 1) length = 12; + else if (RCID_Type == 2) length = 8; + else if (RCID_Type == 3) length = 4; + } + + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, length), "RCID_IE"); + tree = proto_item_add_subtree(ti, ett_286j); + + if (RCID_Type == 0) { + XBIT(cid, 16, "CID"); + } else { + proto_tree_add_text(tree, tvb, BITHI(bit,1), "Prefix: %d", Prefix); + bit++; + + if (Prefix == 1) { + /* RCID 11 */ + XBIT(cid, 11, "CID11"); + } else { + if (RCID_Type == 1) { + /* RCID 11 */ + XBIT(cid, 11, "CID11"); + } else if (RCID_Type == 2) { + /* RCID 7 */ + XBIT(cid, 7, "CID7"); + } else if (RCID_Type == 3) { + /* RCID 3 */ + XBIT(cid, 3, "CID3"); + } + } + } + + proto_item_append_text(ti, " (CID = %d)", cid); + + return length; /* return length in bits */ +} + +/******************************************************************** + * DL-MAP Extended-2 HARQ sub-burst IEs (8.4.5.3.21) + *******************************************************************/ + +gint Dedicated_DL_Control_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.3.20 */ + /* offset of IE in nibbles, length is variable */ + gint nib; + gint nibble; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint len; + + nib = offset; + + length = NIB_NIBBLE(nib, bufptr); /* length in nibbles */ + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length+1), "Dedicated_DL_Control_IE"); + tree = proto_item_add_subtree(ti, ett_286i); + + proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Length: %d", length); + nib++; + nibble = NIB_NIBBLE(nib, bufptr); + proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Control Header: %d", nibble); + nib++; + if ((nibble & 1) == 1) { + nibble = NIB_NIBBLE(nib, bufptr); + proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Num SDMA Layers: %d", (nibble >> 2) & 0x3); + /* Bit padding */ + if ((nib*4)+2 < (offset+length)*4) { + len = ((offset + length - nib) * 4) - 2; + proto_tree_add_text(tree, tvb, BITHI(nib*4, len), "Reserved bits"); + } + } else { + /* Nibble padding */ + if (nib < offset+length) { + len = (offset + length) - nib; + proto_tree_add_text(tree, tvb, NIBHI(nib,len), "Reserved bits"); + } + } + return (length + 1); +} + +gint Dedicated_MIMO_DL_Control_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* offset of IE in bits, length is variable */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint mci, cqi, cmi, matrix = 0, pad, CQICH_num, mimo_mode; + gint j; + + bit = offset; + + /* 8.4.5.3.21 table 286t */ + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 1), "Dedicated MIMO DL Control IE"); + tree = proto_item_add_subtree(ti, ett_286t); + + XBIT(length, 5, "Length (nibbles)"); + XBIT(mci, 1, "Control Header (MIMO Control Info)"); + XBIT(cqi, 1, "Control Header (CQI Control Info)"); + XBIT(cmi, 1, "Control Header (Closed MIMO Control Info)"); + XBIT(N_layer, 2, "N_layer"); + + /* MIMO Control Info */ + if (mci == 1) { + XBIT(matrix, 2, "Matrix"); + if (STC_Zone_Dedicated_Pilots == 1) { + XBIT(data, 2, "Num_Beamformed_Streams"); + } + } + + /* CQICH Control Info */ + if (cqi == 1) { + CQICH_num = 0; + XBIT(data, 3, "Period"); + XBIT(data, 3, "Frame Offset"); + XBIT(data, 4, "Duration"); + for (j = 0; j < N_layer; j++) { + XBIT(data, 6, "Allocation Index"); + } + XBIT(CQICH_num, 2, "CQICH_Num"); + for (j = 0; j < CQICH_num; j++) { + XBIT(data, 3, "Feedback type"); + XBIT(data, 6, "Allocation index"); + } + } + + /* Closed MIMO Control Info */ + if (cmi == 1) { + if (mci == 1) { + mimo_mode = matrix; + } else { + mimo_mode = STC_Zone_Matrix; + } + if (mimo_mode == 0 || mimo_mode == 1) { + XBIT(data, 3, "Antenna Grouping Index"); + } else if (mimo_mode == 2) { + XBIT(data, 2, "Num_stream"); + XBIT(data, 3, "Antenna Selection Index"); + } else if (mimo_mode == 3) { + XBIT(data, 2, "Num_stream"); + XBIT(data, 6, "Codebook Precoding Index"); + } + } + + /* padding to nibble */ + pad = BIT_PADDING(bit,4); + if(pad){ + proto_tree_add_text(tree, tvb, BITHI(bit,pad), "Padding: %d bits", pad); + bit += pad; + } + + return (bit - offset); +} + +gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.3.21 DL_HARQ_Chase_sub_burst_IE */ + /* offset of IE in nibbles, length is variable */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint nsub, ddci, dur, sbi, res, diuc, rci, ind, per, ofs; + gint j; + + bit = NIB_TO_BIT(offset); + + /* 8.4.5.3.21 table 286m */ + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 4), "DL_HARQ_Chase_sub_burst_IE"); + tree = proto_item_add_subtree(ti, ett_286m); + + XBIT(nsub, 4, "N sub burst[ISI]"); + XBIT(data, 4, "N ACK channel"); + + for (j = 0; j < nsub; j++) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + XBIT(dur, 10, "Duration"); + XBIT(sbi, 1, "Sub-Burst DIUC Indicator"); + XBIT(res, 1, "Reserved"); + + if (sbi == 1) { + XBIT(diuc, 4, "DIUC"); + XBIT(rci, 2, "Repetition Coding Indication"); + XBIT(res, 2, "Reserved"); + } + + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 1, "ACK disable"); + XBIT(ddci, 2, "Dedicated DL Control Indicator"); + + if ((ddci & 1) == 1) { + XBIT(dur, 4, "Duration (d)"); + if (dur != 0) { + XBIT(ind, 6, "Allocation Index"); + XBIT(per, 3, "Period (p)"); + XBIT(ofs, 3, "Frame offset"); + } + } + + if ((ddci & 2) == 2) { + bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb) * 4; + } + } + + proto_tree_add_text(tree, tvb, BITHI(bit,4), "(DL HARQ Chase sub-burst IE)"); + return (BIT_TO_NIB(bit) - offset); +} + +gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* offset of IE in nibbles, length is variable */ + gint bit; + guint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_item *generic_item = NULL; + gint nsub, ddci, dur, ind, per, ofs; + gint j; + guint32 calculated_crc; + + bit = NIB_TO_BIT(offset); + + /* 8.4.5.3.21 table 286n */ + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 4), "DL HARQ IR CTC sub-burst IE"); + tree = proto_item_add_subtree(ti, ett_286n); + + XBIT(nsub, 4, "N sub burst[ISI]"); + XBIT(data, 4, "N ACK channel"); + + nsub += 1; + for (j = 0; j < nsub; j++) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + + XBIT(data, 4, "N(EP)"); + XBIT(data, 4, "N(SCH)"); + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 1, "ACK disable"); + XBIT(data, 2, "Reserved"); + XBIT(ddci, 2, "Dedicated DL Control Indicator"); + + if ((ddci & 1) == 1) { + XBIT(dur, 4, "Duration (d)"); + + if (dur != 0) { + XBIT(ind, 6, "Allocation Index"); + XBIT(per, 3, "Period (p)"); + XBIT(ofs, 3, "Frame offset"); + } + } + if ((ddci & 2) == 2) { + bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (BIT_TO_NIB(bit) - offset); +} + +gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* offset of IE in nibbles, length is variable */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_item *generic_item = NULL; + gint nsub, sbdi, ddci, dur, ind, per, ofs; + gint j; + guint16 calculated_crc; + + bit = NIB_TO_BIT(offset); + + /* 8.4.5.3.21 table 286o */ + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 4), "DL HARQ IR CC sub-burst IE"); + tree = proto_item_add_subtree(ti, ett_286o); + + XBIT(nsub, 4, "N sub burst[ISI]"); + XBIT(data, 4, "N ACK channel"); + + nsub += 1; + for (j = 0; j < nsub; j++) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type) / 4; + + XBIT(data, 10, "Duration"); + XBIT(sbdi, 1, "Sub-Burst DIUC Indicator"); + XBIT(data, 1, "Reserved"); + + if (sbdi) { + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 2, "Reserved"); + } + + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 2, "SPID"); + XBIT(data, 1, "ACK disable"); + XBIT(ddci, 2, "Dedicated DL Control Indicator"); + XBIT(data, 2, "Reserved"); + + if (ddci & 1) { + XBIT(dur, 4, "Duration (d)"); + + if (dur != 0) { + XBIT(ind, 6, "Allocation Index"); + XBIT(per, 3, "Period (p)"); + XBIT(ofs, 3, "Frame offset"); + } + } + if ((ddci & 2) == 2) { + bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (BIT_TO_NIB(bit) - offset); +} + +gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* offset of IE in nibbles, length is variable */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_item *generic_item = NULL; + gint nsub, mui, dci, akd; + gint i, j; + guint16 calculated_crc; + + bit = NIB_TO_BIT(offset); + + /* 8.4.5.3.21 table 286p */ + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 1), "MIMO DL Chase HARQ sub-burst IE"); + tree = proto_item_add_subtree(ti, ett_286p); + + XBIT(nsub, 4, "N sub burst[ISI]"); + XBIT(data, 6, "N ACK channel"); + + nsub += 1; + for (j = 0; j < nsub; j++) { + XBIT(mui, 1, "MU Indicator"); + XBIT(dci, 1, "Dedicated MIMO DL Control Indicator"); + XBIT(akd, 1, "ACK Disable"); + if (mui == 0) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + if (dci == 1) { + bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb); + } + XBIT(data, 10, "Duration"); + for (i = 0; i < N_layer; i++) { + if (mui == 1) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + if (akd == 0) { + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + } + } + } + /* Padding to nibble */ + data = BIT_PADDING(bit, 4); + if (data) { + proto_tree_add_text(tree, tvb, BITHI(bit,data), "Padding: %d bits", data); + bit += data; + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (BIT_TO_NIB(bit) - offset); +} + +gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* offset of IE in nibbles, length is variable */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_item *generic_item = NULL; + gint nsub, mui, dci, akd; + gint i, j; + guint16 calculated_crc; + + bit = NIB_TO_BIT(offset); + + /* 8.4.5.3.21 table 286q */ + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 4), "MIMO DL IR HARQ sub-burst IE"); + tree = proto_item_add_subtree(ti, ett_286q); + + XBIT(nsub, 4, "N sub burst[ISI]"); + XBIT(data, 6, "N ACK channel"); + + nsub += 1; + for (j = 0; j < nsub; j++) { + XBIT(mui, 1, "MU Indicator"); + XBIT(dci, 1, "Dedicated MIMO DL Control Indicator"); + XBIT(akd, 1, "ACK Disable"); + if (mui == 0) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + if (dci == 1) { + bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb); + } + XBIT(data, 4, "N(SCH)"); + for (i = 0; i < N_layer; i++) { + if (mui == 1) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + XBIT(data, 4, "N(EP)"); + if (akd) { + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + } + } + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (BIT_TO_NIB(bit) - offset); +} + +gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* offset of IE in nibbles, length is variable */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_item *generic_item = NULL; + gint nsub, mui, dci, akd; + gint i, j; + guint16 calculated_crc; + + bit = NIB_TO_BIT(offset); + + /* 8.4.5.3.21 table 286r */ + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 1), "MIMO DL IR HARQ for CC sub-burst IE"); + tree = proto_item_add_subtree(ti, ett_286r); + + XBIT(nsub, 4, "N sub burst[ISI]"); + XBIT(data, 6, "N ACK channel"); + + nsub += 1; + for (j = 0; j < nsub; j++) { + XBIT(mui, 1, "MU Indicator"); + XBIT(dci, 1, "Dedicated MIMO DL Control Indicator"); + XBIT(akd, 1, "ACK Disable"); + if (mui == 0) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + if (dci == 1) { + bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb); + } + XBIT(data, 10, "Duration"); + for (i = 0; i < N_layer; i++) { + if (mui == 1) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + if (akd == 0) { + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 2, "SPID"); + } + } + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (BIT_TO_NIB(bit) - offset); +} + +gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* offset of IE in nibbles, length is variable */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_item *generic_item = NULL; + gint nsub, sbi, txc, akd, dmci; + gint j; + guint16 calculated_crc; + + bit = NIB_TO_BIT(offset); + + /* 8.4.5.3.21 table 286s */ + ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 1), "MIMO DL STC HARQ sub-burst IE"); + tree = proto_item_add_subtree(ti, ett_286s); + + XBIT(nsub, 4, "N sub burst[ISI]"); + XBIT(data, 6, "N ACK channel"); + + nsub += 1; + for (j = 0; j < nsub; j++) { + XBIT(txc, 2, "TX Count"); + XBIT(data, 10, "Duration"); + XBIT(sbi, 1, "Sub-burst offset indication"); + XBIT(data, 3, "Reserved"); + if (sbi == 1) { + XBIT(data, 8, "Sub-burst offset"); + } + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + XBIT(akd, 1, "ACK Disable"); + if (txc == 0) { + XBIT(dmci, 1, "Dedicated MIMO DL Control Indicator"); + if (dmci == 1) { + bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb); + } + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition coding Indication"); + } + if (akd == 0) { + XBIT(data, 4, "ACID"); + } + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (BIT_TO_NIB(bit) - offset); +} + +/******************************************************************** + * DL-MAP Extended-2 IEs + *******************************************************************/ + +gint MBS_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 0 */ + /* 8.4.5.3.12 MBS_MAP_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint mde, dci, s3i; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "MBS_MAP_IE"); + tree = proto_item_add_subtree(ti, ett_286a); + + XBIT(data, 4, "Extended-2 DIUC"); + XBIT(data, 8, "Length"); + + XBIT(data, 7, "MBS Zone identifier"); + XBIT(mde, 1, "Macro diversity enhanced"); + if (mde == 1) + { + XBIT(data, 2, "Permutation"); + XBIT(data, 5, "DL_PermBase"); + XBIT(data, 2, "PRBS_ID"); + XBIT(data, 7, "OFDMA_Symbol_Offset"); + XBIT(dci, 1, "DIUC_change_indication"); + XBIT(data, 3, "Reserved"); + if (dci == 1) { + XBIT(data, 3, "Reserved"); + XBIT(data, 3, "Boosting"); + XBIT(data, 4, "DIUC"); + XBIT(data, 6, "No. Subchannels"); + XBIT(data, 6, "No. OFDMA Symbols"); + XBIT(data, 2, "Repetition Coding Indication"); + } + } else { + XBIT(data, 4, "DIUC"); + XBIT(data, 16, "CID"); + XBIT(data, 8, "OFDMA Symbols Offset"); + XBIT(data, 6, "Subchannel offset"); + XBIT(data, 3, "Boosting"); + XBIT(s3i, 1, "SLC_3_indication"); + XBIT(data, 6, "No. OFDMA Symbols"); + XBIT(data, 6, "No. Subchannels"); + XBIT(data, 2, "Repetition Coding Indication"); + if (s3i == 1) { + XBIT(data, 8, "Next MBS_MAP_IE frame offset"); + } + } + data = BIT_PADDING(bit, 4); + if (data) { + proto_tree_add_text(tree, tvb, BITHI(bit,data), "Padding: %d bits", data); + bit += data; + } + return BIT_TO_NIB(bit); +} + +gint HO_Anchor_Active_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 1 */ + /* 8.4.5.3.14 [2] HO_Anchor_Active_DL-MAP_IE TODO 1.1 */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HO_Anchor_Active_DL_MAP_IE"); + tree = proto_item_add_subtree(ti, ett_286c); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); + return nib; +} + +gint HO_Active_Anchor_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 2 */ + /* 8.4.5.3.15 HO_Active_Anchor_DL_MAP_IE TODO 1.1 */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HO_Active_Anchor_DL_MAP_IE"); + tree = proto_item_add_subtree(ti, ett_286d); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); + return nib; +} + +gint HO_CID_Translation_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 3 */ + /* 8.4.5.3.16 HO_CID_Translation_MAP_IE TODO 1.1 */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "CID_Translation_MAP_IE"); + tree = proto_item_add_subtree(ti, ett_286e); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); + return nib; +} + +gint MIMO_in_another_BS_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 4 */ + /* 8.4.5.3.17 [2] MIMO_in_another_BS_IE (not implemented)*/ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "MIMO_in_another_BS_IE"); + tree = proto_item_add_subtree(ti, ett_286f); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); + return nib; +} + +gint Macro_MIMO_DL_Basic_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* dl-map extended-2 ie = 5 */ + /* 8.4.5.3.18 [2] Macro-MIMO_DL_Basic_IE (not implemented) */ + /* offset of tlv in nibbles, length of tlv in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Macro_MIMO_DL_Basic_IE"); + tree = proto_item_add_subtree(ti, ett_286g); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); + return nib; +} + +gint Skip_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 6 */ + /* 8.4.5.3.20.2 Skip_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Skip_IE"); + tree = proto_item_add_subtree(ti, ett_286k); + + XBIT(data, 4, "Extended-2 DIUC"); + XBIT(data, 8, "Length"); + + XBIT(data, 1, "Mode"); + XBIT(data, 7, "Reserved"); + + return BIT_TO_NIB(bit); +} + +gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 7 */ + /* 8.4.5.3.21 [2] HARQ_DL_MAP_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint len, lastbit, rui, mode; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HARQ_DL_MAP_IE"); + tree = proto_item_add_subtree(ti, ett_286l); + + XBIT(data, 4, "Extended-2 DIUC"); + XBIT(len, 8, "Length"); + + XBIT(RCID_Type, 2, "RCID_Type"); + XBIT(data, 2, "Reserved"); + + /* while data remains */ + length = NIB_TO_BIT(length); + /* Subtract extra nibble to be sure to stop in time. */ + lastbit = bit + BYTE_TO_BIT(len) - 14 - 4; + while (bit < lastbit) { + XBIT(data, 3, "Boosting"); + XBIT(rui, 1, "Region_ID use indicator"); + + if (rui == 0) { + XBIT(data, 8, "OFDMA symbol offset"); + XBIT(data, 7, "Subchannel offset"); + XBIT(data, 7, "Number of OFDMA symbols"); + XBIT(data, 7, "Number of subchannels"); + if (include_cor2_changes) + { + XBIT(data, 1, "Rectangular Sub-Burst Indicator"); /* Implemented: "Rectangular Sub-Burst Indicator" field added */ + XBIT(data, 2, "Reserved"); /* and "Reserved" field resized from 3 bits to 2 bits */ + } + else + { + XBIT(data, 3, "Reserved"); + } + } else { + XBIT(data, 8, "Region_ID"); + } + XBIT(mode, 4, "Mode"); + XBIT(data, 8, "Sub-burst IE Length"); + + /* 8.4.5.3.21 */ + /* length of these are variable, each returns length in nibbles */ + if (mode == 0) { + bit += 4*DL_HARQ_Chase_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } else if (mode == 1) { + bit += 4*DL_HARQ_IR_CTC_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } else if (mode == 2) { + bit += 4*DL_HARQ_IR_CC_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } else if (mode == 3) { + bit += 4*MIMO_DL_Chase_HARQ_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } else if (mode == 4) { + bit += 4*MIMO_DL_IR_HARQ_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } else if (mode == 5) { + bit += 4*MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } else if (mode == 6) { + bit += 4*MIMO_DL_STC_HARQ_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb); + } else { + proto_tree_add_text(diuc_tree, tvb, BITHI(bit,1), "(reserved Mode)"); + break; /* cannot continue */ + } + } + return BIT_TO_NIB(bit); +} + +gint HARQ_ACK_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 8 */ + /* 8.4.5.3.22 HARQ_ACK IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint data; + gint nib; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HARQ_ACK_IE"); + tree = proto_item_add_subtree(ti, ett_286u); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib,length-3), "(bitmap data)"); + + return nib; +} + +gint Enhanced_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 9 */ + /* 8.4.5.3.23 Enhanced DL MAP IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint numass, n_cid; + gint i, n; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Enhanced_DL-MAP_IE"); + tree = proto_item_add_subtree(ti, ett_286v); + + XBIT(data, 4, "Extended-2 DIUC"); + XBIT(data, 8, "Length"); + + XBIT(numass, 4, "Num_Assignment"); + for (i = 0; i < numass; i++) { + if (INC_CID == 1) { + XBIT(n_cid, 8, "N_CID"); + for (n = 0; n < n_cid; n++) { + XBIT(data, 16, "CID"); + } + } + XBIT(data, 4, "DIUC"); + XBIT(data, 3, "Boosting"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 8, "Region_ID"); + XBIT(data, 3, "Reserved"); + } + return BIT_TO_NIB(bit); +} + +gint Closed_loop_MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 0xA */ + /* 8.4.5.3.24 Closed-loop MIMO DL Enhanced IE (not implemented) */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "CL_MIMO_DL_Enhanced_IE"); + tree = proto_item_add_subtree(ti, ett_286w); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); + return nib; +} + +gint AAS_SDMA_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended-2 IE = 0xE */ + /* 8.4.5.3.26 AAS_SDMA_DL_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint num_region, num_users, pilot_pattern, encoding_mode, ackch_alloc, cqich_alloc; + gint aas_preamble = 1; + gint zone_permut = 0; /* TODO */ + gint i, j; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "AAS_SDMA_DL_IE"); + tree = proto_item_add_subtree(ti, ett_286y); + + XBIT(data, 4, "Extended-2 DIUC"); + XBIT(data, 8, "Length"); + + XBIT(RCID_Type, 2, "RCID_Type"); + XBIT(num_region, 4, "Num_Burst_Region"); + XBIT(data, 2, "Reserved"); + for (i = 0; i < num_region; i++) { + XBIT(data, 8, "OFDMA Symbol Offset"); + if (zone_permut == 0) { + XBIT(data, 8, "Subchannel offset"); + XBIT(data, 5, "No. OFDMA triple symbols"); + XBIT(data, 6, "No. subchannels"); + } else { + XBIT(data, 6, "Subchannel offset"); + XBIT(data, 7, "No. OFDMA triple symbols"); + XBIT(data, 6, "No. subchannels"); + } + XBIT(num_users, 3, "Number of Users"); + XBIT(data, 2, "Reserved"); + for (j = 0; j < num_users; j++) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + XBIT(encoding_mode, 2, "Encoding Mode"); + XBIT(cqich_alloc, 1, "CQICH Allocation"); + XBIT(ackch_alloc, 1, "ACKCH Allocation"); + XBIT(pilot_pattern, 1, "Pilot Pattern Modifier"); + if (aas_preamble) { + XBIT(data, 4, "Preamble Modifier Index"); + } + if (pilot_pattern) { + XBIT(data, 2, "Pilot Pattern"); + XBIT(data, 1, "Reserved"); + } else { + XBIT(data, 3, "Reserved"); + } + if (encoding_mode == 0x0) { + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 2, "Reserved"); + } + if (encoding_mode == 0x1) { + if (ackch_alloc) { + XBIT(data, 5, "ACK CH Index"); + } else { + XBIT(data, 1, "Reserved"); + } + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + } + if (encoding_mode == 0x2) { + if (ackch_alloc) { + XBIT(data, 5, "ACK CH Index"); + } else { + XBIT(data, 1, "Reserved"); + } + XBIT(data, 4, "N(EP)"); + XBIT(data, 4, "N(SCH)"); + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + } + if (encoding_mode == 0x3) { + if (ackch_alloc) { + XBIT(data, 5, "ACK CH Index"); + XBIT(data, 2, "Reserved"); + } else { + XBIT(data, 3, "Reserved"); + } + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + } + if (cqich_alloc) { + XBIT(data, 6, "Allocation Index"); + XBIT(data, 3, "Period (p)"); + XBIT(data, 3, "Frame offset"); + XBIT(data, 4, "Duration (d)"); + } + } + } + data = BIT_PADDING(bit,4); + /* Should this be an optional field? Or do we want it, even if it has a length of zero? */ + proto_tree_add_text(tree, tvb, BITHI(bit,data), "Padding: %d bits", data); + bit += data; + + return BIT_TO_NIB(bit); +} + + + +/******************************************************************** + * DL-MAP Extended IEs + *******************************************************************/ + +gint Channel_Measurement_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 0 */ + /* 8.4.5.3.5 [1] Channel_Measurement_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Channel_Measurement_IE"); + tree = proto_item_add_subtree(ti, ett_280); + + XNIB(data, 1, "Extended DIUC"); + XNIB(data, 1, "Length"); + + XNIB(data, 2, "Channel Nr"); + XNIB(data, 2, "OFDMA Symbol Offset"); + data = NIB_WORD(nib, bufptr); + proto_tree_add_text(tree, tvb, NIBHI(nib,4), "CID: %d", data); + nib += 4; + return nib; +} + +gint STC_Zone_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 1 */ + /* 8.4.5.3.4 STC_Zone_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + /* set globals: STC_Zone_Dedicated_Pilots, STC_Zone_Matrix + * used in 8.4.5.3.21.1 Dedicated MIMO Control IE 286t */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "STC_Zone_IE"); + tree = proto_item_add_subtree(ti, ett_279); + + XBIT(data, 4, "Extended DIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 8, "OFDMA Symbol Offset"); + XBIT(data, 2, "Permutations"); + XBIT(data, 1, "Use All SC indicator"); + XBIT(data, 2, "STC"); + XBIT(STC_Zone_Matrix, 2, "Matrix indicator"); + XBIT(data, 5, "DL_PermBase"); + XBIT(data, 2, "PRBS_ID"); + XBIT(data, 2, "AMC type"); + XBIT(data, 1, "Midamble Presence"); + XBIT(data, 1, "Midamble Boosting"); + XBIT(data, 1, "2/3 antenna select"); + XBIT(STC_Zone_Dedicated_Pilots, 1, "Dedicated Pilots"); + XBIT(data, 4, "Reserved"); + + return BIT_TO_NIB(bit); +} + +gint AAS_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 2 */ + /* 8.4.5.3.3 AAS_DL_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "AAS_DL_IE"); + tree = proto_item_add_subtree(ti, ett_278); + + XBIT(data, 4, "Extended DIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 8, "OFDMA Symbol Offset"); + XBIT(data, 3, "Permutation"); + XBIT(data, 6, "DL_PermBase"); + XBIT(data, 2, "Downlink_preamble_config"); + XBIT(data, 1, "Preamble type"); + XBIT(data, 2, "PRBS_ID"); + XBIT(data, 1, "Diversity Map"); + XBIT(data, 1, "Reserved"); + + return BIT_TO_NIB(bit); +} + +gint Data_location_in_another_BS_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 3 */ + /* 8.4.5.3.6 Data_location_in_another_BS_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Data location in another BS IE"); + tree = proto_item_add_subtree(ti, ett_281); + + XBIT(data, 4, "Extended DIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 2, "Segment"); + XBIT(data, 6, "Used subchannels"); + XBIT(data, 4, "DIUC"); + XBIT(data, 3, "Frame Advance"); + XBIT(data, 1, "Reserved"); + XBIT(data, 8, "OFDMA Symbol Offset"); + XBIT(data, 6, "Subchannel Offset"); + XBIT(data, 3, "Boosting"); + XBIT(data, 7, "Preamble Index"); + XBIT(data, 8, "No. OFDMA Symbols"); + XBIT(data, 6, "No. Subchannels"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 16, "CID"); + + return BIT_TO_NIB(bit); +} + +gint CID_Switch_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 4 */ + /* 8.4.5.3.7 [1] CID_Switch_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + INC_CID = INC_CID ? 0 : 1; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "CID_Switch_IE"); + proto_item_append_text(ti, " (INC_CID = %d)",INC_CID); + tree = proto_item_add_subtree(ti, ett_282); + + XNIB(data, 1, "Extended DIUC"); + XNIB(data, 1, "Length"); + + return nib; +} + +gint MIMO_DL_Basic_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 5 */ + /* 8.4.5.3.8 MIMO_DL_Basic_IE (not implemented) */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "MIMO_DL_Basic_IE"); + tree = proto_item_add_subtree(ti, ett_283); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-2), "(not implemented)"); + return nib; +} + +gint MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 6 */ + /* 8.4.5.3.9 MIMO_DL_Enhanced_IE (not implemented) */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "MIMO_DL_Enhanced_IE"); + tree = proto_item_add_subtree(ti, ett_284); + + XNIB(data, 1, "Extended-2 DIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-2), "(not implemented)"); + return nib; +} + +gint HARQ_Map_Pointer_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 7 */ + /* 8.4.5.3.10 [2] HARQ_Map_Pointer_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint length_in_bits, rep, map, diuc, slots, idle, sleep, mask_len; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HARQ_Map_Pointer_IE"); + tree = proto_item_add_subtree(ti, ett_285); + + XBIT(data, 4, "Extended DIUC"); + XBIT(data, 4, "Length"); + + length_in_bits = NIB_TO_BIT(length-1); + while (bit < length_in_bits) { + XBIT(diuc, 4, "DIUC"); + XBIT(slots, 8, "No. Slots"); + XBIT(rep, 2, "Repetition Coding Indication"); + XBIT(map, 2, "Map Version"); + if (map == 2) { + XBIT(idle, 1, "Idle users"); + XBIT(sleep, 1, "Sleep users"); + XBIT(mask_len, 2, "CID Mask Length"); + if (mask_len == 0) { + /* 12 bits */ + proto_tree_add_text(diuc_tree, tvb, BITHI(bit,12), "CID Mask: 12 bits"); + bit += 12; + } else if (mask_len == 1) { + /* 20 bits */ + proto_tree_add_text(diuc_tree, tvb, BITHI(bit,20), "CID Mask: 20 bits"); + bit += 20; + } else if (mask_len == 2) { + /* 36 bits */ + proto_tree_add_text(diuc_tree, tvb, BITHI(bit,36), "CID Mask: 36 bits"); + bit += 36; + } else if (mask_len == 3) { + /* 52 bits */ + proto_tree_add_text(diuc_tree, tvb, BITHI(bit,52), "CID Mask: 52 bits"); + bit += 52; + } + } + } + return BIT_TO_NIB(bit); +} + +gint PHYMOD_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 8 */ + /* 8.4.5.3.11 PHYMOD_DL_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint pmt; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "PHYMOD_DL_IE"); + tree = proto_item_add_subtree(ti, ett_286); + + XBIT(data, 4, "Extended DIUC"); + XBIT(data, 4, "Length"); + + XBIT(pmt, 1, "Preamble Modifier Type"); + if (pmt == 0) { + XBIT(data, 4, "Preamble frequency shift index"); + } else { + XBIT(data, 4, "Preamble Time Shift Index"); + } + XBIT(data, 1, "Pilot Pattern Modifier"); + XBIT(data, 2, "Pilot Pattern Index"); + + return BIT_TO_NIB(bit); +} + +gint Broadcast_Control_Pointer_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 0xA */ + /* 8.4.5.3.25 Broadcast Control Pointer IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint skip; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Broadcast Control Pointer IE"); + tree = proto_item_add_subtree(ti, ett_286x); + + XBIT(data, 4, "Extended DIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 7, "DCD_UCD Transmission Frame"); + XBIT(skip, 1, "Skip Broadcast_System_Update"); + if (skip == 0) { + XBIT(data, 1, "Broadcast_System_Update_Type"); + XBIT(data, 7, "Broadcast_System_Update_Transmission_Frame"); + } + return BIT_TO_NIB(bit); +} + +gint DL_PUSC_Burst_Allocation_in_Other_Segment_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 0xB */ + /* 8.4.5.3.13 DL PUSC Burst Allocation in Other Segment IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "DL_PUSC_Burst_Allocation_in_Other_Segment_IE"); + tree = proto_item_add_subtree(ti, ett_286b); + + XBIT(data, 4, "Extended DIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 16, "CID"); + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Segment"); + XBIT(data, 3, "Boosting"); + XBIT(data, 5, "IDcell"); + XBIT(data, 5, "DL_PermBase"); + XBIT(data, 2, "PRBS_ID"); + XBIT(data, 2, "Repetition coding indication"); + XBIT(data, 6, "Used Subchannels"); + XBIT(data, 8, "OFDMA symbol offset"); + XBIT(data, 1, "Reserved"); + XBIT(data, 7, "# OFDMA symbols"); + XBIT(data, 6, "Subchannel offset"); + XBIT(data, 6, "# subchannels"); + XBIT(data, 7, "Reserved"); + return BIT_TO_NIB(bit); +} + +gint PUSC_ASCA_Alloc_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 0xC */ + /* 8.4.5.3.27 PUSC_ASCA_Alloc_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "PUSC_ASCA_Alloc_IE"); + tree = proto_item_add_subtree(ti, ett_286z); + + XBIT(data, 4, "Extended DIUC"); + XBIT(data, 4, "Length"); + XBIT(data, 4, "DIUC"); + XBIT(data, 12, "Short Basic CID"); + XBIT(data, 8, "OFDMA Symbol offset"); + XBIT(data, 6, "Subchannel offset"); + XBIT(data, 7, "# OFDMA Symbols"); + XBIT(data, 6, "# Symbols"); + XBIT(data, 2, "Repetition Coding Information"); + XBIT(data, 4, "Permutation ID"); + XBIT(data, 7, "Reserved"); + + return BIT_TO_NIB(bit); +} + +gint UL_interference_and_noise_level_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* DL-MAP Extended IE = 0xF */ + /* 8.4.5.3.19 UL_interference_and_noise_level_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint bitmap; + + nib = offset; + + ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "UL_interference_and_noise_level_IE"); + tree = proto_item_add_subtree(ti, ett_286h); + + XNIB(data, 1, "Extended DIUC"); + XNIB(data, 1, "Length"); + + XNIB(bitmap, 1, "Bitmap"); + + if (bitmap & 0x01) { + XNIB(data, 2, "CQI/ACK/Periodic Ranging region NI"); + } + if (bitmap & 0x02) { + XNIB(data, 2, "PUSC region NI"); + } + if (bitmap & 0x04) { + XNIB(data, 2, "Optional PUSC region NI"); + } + if (bitmap & 0x08) { + XNIB(data, 2, "AMC region NI"); + } + if (bitmap & 0x10) { + XNIB(data, 2, "AAS region NI"); + } + if (bitmap & 0x20) { + XNIB(data, 2, "Periodic Ranging region NI"); + } + if (bitmap & 0x40) { + XNIB(data, 2, "Sounding region NI"); + } + if (bitmap & 0x80) { + XNIB(data, 2, "MIMO region NI"); + } + + return nib; +} + +/******************************************************************** + * DL-MAP Plugin + *******************************************************************/ + +extern gint wimax_decode_ulmapc(proto_tree *base_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb); + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_dlmap(void) +{ + if (proto_mac_mgmt_msg_dlmap_decoder == -1) + { + proto_mac_mgmt_msg_dlmap_decoder = proto_register_protocol ( + "WiMax DLMAP/ULMAP Messages", /* name */ + "WiMax DLMAP/ULMAP (map)", /* short name */ + "map" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_dlmap_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* decode a single DL-MAP IE and return the + * length of the IE in nibbles + * offset = start of IE (nibbles) + * length = total length of bufptr (nibbles) */ + proto_item *ti = NULL; + proto_tree *tree = NULL; + + gint nibble = offset; + gint diuc; + gint ext2_diuc; + gint len; + gint ext_diuc; + + gint alt_format = 0; + guint data = 0; + gint i; + gint papr = 0; + gint ie_len = 9; + + gint n_cid; + + /* 8.4.5.3 DL-MAP IE format - table 275 */ + diuc = NIB_NIBBLE(nibble, bufptr); + if (diuc == 14) + { + /* 8.4.5.3.2.2 [2] Extended-2 DIUC dependent IE table 277b */ + ext2_diuc = NIB_NIBBLE(1+nibble, bufptr); + len = NIB_BYTE(1+nibble+1, bufptr); + + ti = proto_tree_add_uint(ie_tree, hf_dlmap_ie_diuc, tvb, NIBHI(nibble, 1+3+len*2), diuc); + proto_item_append_text(ti, " (Extended-2)"); + tree = proto_item_add_subtree(ti, ett_277b); + nibble++; + + len = 3 + BYTE_TO_NIB(len); + + /* table 277c [2] */ + switch (ext2_diuc) + { + case 0x00: + /* 8.4.5.3.12 MBS_MAP_IE */ + nibble = MBS_MAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x01: + /* 8.4.5.3.14 HO_Anchor_Active_DL-MAP_IE */ + nibble = HO_Anchor_Active_DL_MAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x02: + /* 8.4.5.3.15 HO_Active_Anchor_DL_MAP_IE */ + nibble = HO_Active_Anchor_DL_MAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x03: + /* 8.4.5.3.16 HO_CID_Translation_MAP_IE */ + nibble = HO_CID_Translation_MAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x04: + /* 8.4.5.3.17 MIMO_in_another_BS_IE */ + nibble = MIMO_in_another_BS_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x05: + /* 8.4.5.3.18 Macro-MIMO_DL_Basic_IE */ + nibble = Macro_MIMO_DL_Basic_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x06: + /* 8.4.5.3.20.2 Skip_IE */ + nibble = Skip_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x07: + /* 8.4.5.3.21 HARQ_DL_MAP_IE */ + nibble += HARQ_DL_MAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x08: + /* 8.4.5.3.22 HARQ_ACK IE */ + nibble = HARQ_ACK_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x09: + /* 8.4.5.3.23 Enhanced DL MAP IE */ + nibble = Enhanced_DL_MAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x0a: + /* 8.4.5.3.24 Closed-loop MIMO DL Enhanced IE */ + nibble = Closed_loop_MIMO_DL_Enhanced_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x0b: + nibble = MIMO_DL_Basic_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x0c: + nibble = MIMO_DL_Enhanced_IE(tree, bufptr, nibble, len, tvb); + break; + + case 0x0e: + nibble = AAS_SDMA_DL_IE(tree, bufptr, nibble, len, tvb); + break; + + default: + proto_tree_add_text(tree, tvb, NIBHI(nibble,len), "(reserved Extended-2 DIUC: %d)", ext2_diuc); + nibble += len; + break; + + } + } + else if (diuc == 15) + { + /* 8.4.5.3.2.1 [1] Extended DIUC dependent IE - table 277 */ + ext_diuc = NIB_NIBBLE(1+nibble, bufptr); + len = NIB_NIBBLE(1+nibble+1, bufptr); + + ti = proto_tree_add_uint(ie_tree, hf_dlmap_ie_diuc, tvb, NIBHI(nibble, 1+2+len*2), diuc); + proto_item_append_text(ti, " (Extended)"); + tree = proto_item_add_subtree(ti, ett_277); + nibble++; + + len = 2 + BYTE_TO_NIB(len); + + /* TODO 8.4.5.3.27 PUSC_ASCA_IE -- unspecified ExtDIUC? */ + + /* 8.4.5.3.2.1 table 277a */ + switch (ext_diuc) + { + case 0x00: + /* 8.4.5.3.? Channel_Measurement_IE */ + nibble = Channel_Measurement_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x01: + /* 8.4.5.3.4 STC_Zone_IE */ + nibble = STC_Zone_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x02: + /* 8.4.5.3.3 AAS_DL_IE */ + nibble = AAS_DL_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x03: + /* 8.4.5.3.6 Data_location_in_another_BS_IE */ + nibble = Data_location_in_another_BS_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x04: + /* 8.4.5.3.7 CID_Switch_IE */ + nibble = CID_Switch_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x07: + /* 8.4.5.3.10 HARQ_Map_Pointer_IE */ + nibble = HARQ_Map_Pointer_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x08: + /* 8.4.5.3.11 PHYMOD_DL_IE */ + nibble = PHYMOD_DL_IE(tree, bufptr, nibble, len, tvb); + break; + + case 0x0b: + /* 8.4.5.3.13 DL PUSC Burst Allocation in Other Segment IE */ + nibble = DL_PUSC_Burst_Allocation_in_Other_Segment_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x0c: + nibble = PUSC_ASCA_Alloc_IE(tree, bufptr, nibble, len, tvb); + break; + + case 0x0f: + /* 8.4.5.3.19 UL_interference_and_noise_level_IE */ + nibble = UL_interference_and_noise_level_IE(tree, bufptr, nibble, len, tvb); + break; + + default: + proto_tree_add_text(tree, tvb, NIBHI(nibble,len), "(reserved Extended DIUC: %d)", ext_diuc); + nibble += len; + break; + } + } + else + { + /* Downlink IE */ + alt_format = 0; + data = 0; + papr = 0; + ie_len = 9; + + /* TODO: alt_format = 1 if (Permutation == 0x11) and (AMC type is 2x3 or 1x6) */ + + /* precalculate IE len for correct highlighting */ + if (INC_CID && !sub_dl_ul_map) { + ie_len += 2 + (NIB_BYTE(nibble+1, bufptr) * 4); + } + + /* DL-MAP_IE */ + ti = proto_tree_add_uint(ie_tree, hf_dlmap_ie_diuc, tvb, NIBHI(nibble, ie_len), diuc); + tree = proto_item_add_subtree(ti, ett_275_1); + nibble += 1; + + if (diuc == 13) { + /* 8.4.5.3.1 [1] Gap/PAPR Reduction */ + papr = 1; + proto_item_append_text(ti, " (Gap/PAPR Reduction)"); + } + + + if (INC_CID) + { + n_cid = NIB_BYTE(nibble, bufptr); + proto_tree_add_item(tree, hf_dlmap_ie_ncid, tvb, NIBHI(nibble,2), FALSE); + nibble += 2; + + for (i = 0; i < n_cid; i++) + { + if (sub_dl_ul_map) { + /* RCID_IE 8.4.5.3 and 8.4.5.3.20.1, only part of SUB-DL-UL-MAP */ + /* RCID_Type comes from 6.3.2.3.43.2 [2] Format_configuration_IE in Compact_DL-MAP_IE */ + nibble += RCID_IE(tree, bufptr, nibble*4, length, tvb, RCID_Type) / 4; + } else { + proto_tree_add_item(tree, hf_dlmap_ie_cid, tvb, NIBHI(nibble,4), FALSE); + nibble += 4; + } + } + } + + data = NIB_LONG(nibble, bufptr); + if (alt_format) { + proto_tree_add_uint(tree, hf_dlmap_ie_offsym2, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_offsub2, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_boosting2, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_numsym2, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_numsub2, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_rep2, tvb, NIBHI(nibble, 8), data); + } else { + proto_tree_add_uint(tree, hf_dlmap_ie_offsym, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_offsub, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_boosting, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_numsym, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_numsub, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_dlmap_ie_rep, tvb, NIBHI(nibble, 8), data); + } + nibble += 8; + } + + /* length in nibbles */ + return (nibble - offset); +} + + +void dissect_mac_mgmt_msg_dlmap_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tree) +{ + /* 6.3.2.3.2 [2] DL-MAP table 16 */ + guint offset = 0; + gint length, nib, pad; + proto_item *ti = NULL; + proto_tree *dlmap_tree = NULL; + proto_tree *ie_tree = NULL; + proto_tree *phy_tree = NULL; + gint tvb_len = tvb_length(tvb); + const guint8 *bufptr = tvb_get_ptr(tvb, offset, tvb_len); + + UNREFERENCED_PARAMETER(pinfo); + + INC_CID = 0; + + /* add protocol */ + ti = proto_tree_add_protocol_format(base_tree, proto_mac_mgmt_msg_dlmap_decoder, tvb, offset, tvb_len, "DL-MAP (%u bytes)", tvb_len); + dlmap_tree = proto_item_add_subtree(ti, ett_dlmap); + + /* Decode and display the DL-MAP */ + proto_tree_add_item(dlmap_tree, hf_dlmap_message_type, tvb, offset, 1, FALSE); + offset++; + /* PHY Synchronization Field 8.4.5.1 */ + { + ti = proto_tree_add_text(dlmap_tree, tvb, offset, 4, "Phy Synchronization Field"); + phy_tree = proto_item_add_subtree(ti, ett_275_phy); + proto_tree_add_item(phy_tree, hf_dlmap_phy_fdur, tvb, offset, 1, FALSE); + offset++; + proto_tree_add_item(phy_tree, hf_dlmap_phy_fnum, tvb, offset, 3, FALSE); + offset += 3; + } + proto_tree_add_item(dlmap_tree, hf_dlmap_dcd, tvb, offset, 1, FALSE); + offset++; + proto_tree_add_item(dlmap_tree, hf_dlmap_bsid, tvb, offset, 6, FALSE); + offset += 6; + proto_tree_add_item(dlmap_tree, hf_dlmap_ofdma_sym, tvb, offset, 1, FALSE); + offset++; + + /* DL-MAP IEs */ + length = tvb_len - offset; /* remaining length in bytes */ + ti = proto_tree_add_text(dlmap_tree, tvb, offset, length, "DL-MAP IEs (%d bytes)", length); + ie_tree = proto_item_add_subtree(ti, ett_dlmap_ie); + + length = BYTE_TO_NIB(length); /* convert length to nibbles */ + + nib = BYTE_TO_NIB(offset); + while (nib < ((tvb_len*2)-1)) { + nib += dissect_dlmap_ie(ie_tree, bufptr, nib, tvb_len * 2, tvb); + } + pad = NIB_PADDING(nib); + if (pad) { + proto_tree_add_text(dlmap_tree, tvb, NIBHI(nib,1), "Padding nibble"); + nib++; + } +} + +gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tree) +{ + /* 8.4.5.6.1 [2] Compressed DL-MAP */ + /* decode a compressed dl-map and return the length in bytes; */ + /* if there is a compressed ul-map, also decode that and include in the length */ + guint offset = 0; + proto_item *ti = NULL; + proto_item *generic_item = NULL; + proto_tree *tree = NULL; + proto_tree *ie_tree = NULL; + gint ulmap_appended; + guint length, lennib, pad; + guint mac_len, dl_ie_count; + guint tvb_len = tvb_length(tvb); + const guint8 * bufptr = tvb_get_ptr(tvb, offset, tvb_len); + guint nib = 0; + guint32 mac_crc, calculated_crc; + + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Compressed DL-MAP"); + } + + INC_CID = 0; + + length = tvb_get_ntohs(tvb, offset) & 0x07FF; /* compressed map length is 11 bits */ + mac_len = length; + lennib = BYTE_TO_NIB(length); + + ulmap_appended = (tvb_get_guint8(tvb, offset) >> 4) & 1; /* UL MAP appended? */ + + /* display MAC Compressed DL-MAP and create subtree */ + ti = proto_tree_add_protocol_format(base_tree, proto_mac_mgmt_msg_dlmap_decoder, tvb, offset, length, "Compressed DL-MAP (%u bytes)", length); + tree = proto_item_add_subtree(ti, ett_305); + + /* decode dlmap fields */ + proto_tree_add_item(tree, hf_dlmapc_compr, tvb, offset, 2, FALSE); + proto_tree_add_item(tree, hf_dlmapc_ulmap, tvb, offset, 2, FALSE); + proto_tree_add_item(tree, hf_dlmapc_rsv, tvb, offset, 2, FALSE); + proto_tree_add_item(tree, hf_dlmapc_len, tvb, offset, 2, FALSE); + proto_tree_add_item(tree, hf_dlmapc_sync, tvb, offset+2, 4, FALSE); /* PHY Synchronization (8.4.5.1) */ + proto_tree_add_item(tree, hf_dlmap_dcd, tvb, offset+6, 1, FALSE); + proto_tree_add_item(tree, hf_dlmapc_opid, tvb, offset+7, 1, FALSE); + proto_tree_add_item(tree, hf_dlmapc_secid, tvb, offset+8, 1, FALSE); + proto_tree_add_item(tree, hf_dlmap_ofdma_sym, tvb, offset+9, 1, FALSE); /* 2005 */ + proto_tree_add_item(tree, hf_dlmapc_count, tvb, offset+10,1, FALSE); + dl_ie_count = tvb_get_guint8(tvb, offset + 10); + offset += 11; + nib = BYTE_TO_NIB(offset); + + /* DL-MAP IEs */ + length -= 15; /* remaining length in bytes (11 bytes above + CRC at end) */ + if (dl_ie_count) { + ti = proto_tree_add_text(tree, tvb, offset, length, "DL-MAP IEs (%d bytes)", length); + ie_tree = proto_item_add_subtree(ti, ett_dlmap_ie); + + length = BYTE_TO_NIB(mac_len - sizeof(mac_crc) - 1); /* convert length to nibbles */ + + while (nib < length) { + nib += dissect_dlmap_ie(ie_tree, bufptr, nib, tvb_len * 2, tvb); + } + pad = NIB_PADDING(nib); + if (pad) { + proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Padding nibble"); + nib++; + } + } + + if (ulmap_appended) { + /* subtract 8 from lennib (CRC) */ + nib += wimax_decode_ulmapc(base_tree, bufptr, nib, lennib - 8, tvb); + } + + /* CRC is always appended */ + /* check the length */ + if (MIN(tvb_len, tvb_reported_length(tvb)) >= mac_len) + { /* get the CRC */ + mac_crc = tvb_get_ntohl(tvb, mac_len - sizeof(mac_crc)); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc32((guint8 *)tvb_get_ptr(tvb, 0, mac_len - sizeof(mac_crc)), mac_len - sizeof(mac_crc)); + /* display the CRC */ + generic_item = proto_tree_add_item(base_tree, hf_mac_header_compress_dlmap_crc, tvb, mac_len - sizeof(mac_crc), sizeof(mac_crc), FALSE); + if (mac_crc != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + } + else + { /* display error message */ + proto_tree_add_protocol_format(base_tree, proto_mac_mgmt_msg_dlmap_decoder, tvb, 0, tvb_len, "CRC missing - the frame is too short (%u bytes)", tvb_len); + } + + return mac_len; +} + +extern gint dissect_ulmap_ie(proto_tree *ie_tree, + const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb); +extern gint wimax_decode_ulmap_reduced_aas(proto_tree *ie_tree, + const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb); + +gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tree) +{ + /* decode a SUB-DL-UL-MAP message 6.3.2.3.60 and return the length in bytes */ + /* first three bits are 0x7, which following a compressed DL map indicates this message */ + guint offset = 0; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_tree *ie_tree = NULL; + proto_item *generic_item = NULL; + gint data; + gint i, numie; + guint16 calculated_crc; + + gint length = tvb_length(tvb); + const guint8 * bufptr = tvb_get_ptr(tvb, offset, length); + gint nib = 0; + gint lennib = BYTE_TO_NIB(length); + + UNREFERENCED_PARAMETER(pinfo); + + sub_dl_ul_map = 1; /* set flag */ + + ti = proto_tree_add_text(base_tree, tvb, NIBHI(nib,lennib-nib), "SUB-DL-UL-MAP"); + tree = proto_item_add_subtree(ti, ett_109x); + + data = NIB_WORD(nib,bufptr); + proto_tree_add_uint(tree, hf_109x_cmi, tvb, NIBHI(nib,4), data); + proto_tree_add_uint(tree, hf_109x_len, tvb, NIBHI(nib,4), data); + proto_tree_add_uint(tree, hf_109x_rcid, tvb, NIBHI(nib,4), data); + proto_tree_add_uint(tree, hf_109x_haoi, tvb, NIBHI(nib,4), data); + nib += 4; + + /* HARQ ACK offset indicator */ + if (data & 1) { + data = NIB_BYTE(nib,bufptr); + proto_tree_add_uint(tree, hf_109x_dl, tvb, NIBHI(nib,2), data); + nib += 2; + data = NIB_BYTE(nib,bufptr); + proto_tree_add_uint(tree, hf_109x_ul, tvb, NIBHI(nib,2), data); + nib += 2; + } + + numie = NIB_BYTE(nib,bufptr); + proto_tree_add_uint(tree, hf_109x_dlie, tvb, NIBHI(nib,2), numie); + nib += 2; + + /* DL-MAP IEs */ + ti = proto_tree_add_text(tree, tvb, NIBHI(nib,1), "DL-MAP IEs"); + ie_tree = proto_item_add_subtree(ti, ett_109x_dl); + for (i = 0; i < numie; i++) { + nib += dissect_dlmap_ie(ie_tree, bufptr, nib, lennib - nib, tvb); + } + + data = NIB_BYTE(nib,bufptr); + proto_tree_add_uint(tree, hf_109x_symofs, tvb, NIBHI(nib,2), data); + nib += 2; + data = NIB_BYTE(nib,bufptr); + proto_tree_add_uint(tree, hf_109x_subofs, tvb, NIBHI(nib,2), data); + proto_tree_add_uint(tree, hf_109x_rsv, tvb, NIBHI(nib,2), data); + nib += 2; + + /* UL-MAP IEs */ + ti = proto_tree_add_text(tree, tvb, NIBHI(nib,lennib-nib), "UL-MAP IEs"); + ie_tree = proto_item_add_subtree(ti, ett_109x_ul); + for ( ; nib < lennib - 1; ) { + nib += dissect_ulmap_ie(ie_tree, bufptr, nib, lennib - nib, tvb); + } + + /* padding */ + if (nib & 1) { + proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Padding Nibble"); + nib++; + } + + /* CRC-16 is always appended */ + data = NIB_WORD(nib, bufptr); + generic_item = proto_tree_add_text(tree, tvb, NIBHI(nib,4), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, NIB_TO_BYTE(nib)), NIB_TO_BYTE(nib)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + nib += 4; + + + sub_dl_ul_map = 0; /* clear flag */ + /* return length */ + return length; +} + +gint wimax_decode_dlmap_reduced_aas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tree) +{ + /* 8.4.5.8.1 [2] Reduced AAS private DL-MAP */ + /* if there is an appended UL-MAP, also decode that */ + guint offset = 0; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_item *generic_item = NULL; + gint ulmap_appended; + gint length; + gint tvb_len = tvb_length(tvb); + const guint8 * bufptr = tvb_get_ptr(tvb, offset, tvb_len); + gint bit = 0; + guint data, pad, mult; + gint numie = 1; + gint i; + guint16 calculated_crc; + gint smcs,cidi,dcdi,phyi,cqci; + + UNREFERENCED_PARAMETER(pinfo); + length = tvb_len; + + /* display MAC Reduced_AAS_Private_DL-MAP and create subtree */ + ti = proto_tree_add_protocol_format(base_tree, proto_mac_mgmt_msg_dlmap_decoder, tvb, offset, length, "Reduced_AAS_Private_DL-MAP"); + tree = proto_item_add_subtree(ti, ett_308a); + + VBIT(data, 3, hf_308a_cmi); + VBIT(ulmap_appended, 1, hf_308a_ulmap); + VBIT(data, 2, hf_308a_type); + VBIT(mult, 1, hf_308a_mult); + VBIT(data, 1, hf_308a_rsv); + + if (mult) { + XBIT(numie, 8, "NUM IE"); + } + + for (i = 0; i < numie; i++) { + XBIT(data, 2, "Periodicity"); + XBIT(cidi, 1, "CID Included"); + XBIT(dcdi, 1, "DCD Count Included"); + XBIT(phyi, 1, "PHY modification included"); + XBIT(cqci, 1, "CQICH control indicator"); + XBIT(data, 2, "Encoding Mode"); + XBIT(smcs, 1, "Separate MCS Enabled"); + + if (smcs) { + XBIT(data,10, "Duration"); + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + } + if (cidi) { + XBIT(data,16, "CID"); + } + if (cqci) { + XBIT(data, 6, "Allocation Index"); + XBIT(data, 3, "Report Period"); + XBIT(data, 3, "Frame Offset"); + XBIT(data, 4, "Report Duration"); + XBIT(data, 2, "CQI Measurement Type"); + XBIT(data, 2, "Reserved"); + } + if (dcdi) { + XBIT(data, 8, "DCD Count"); + } + if (phyi) { + XBIT(data, 1, "Preamble Select"); + XBIT(data, 4, "Preamble Shift Index"); + XBIT(data, 1, "Pilot Pattern Modifier"); + XBIT(data, 2, "Pilot Pattern Index"); + } + XBIT(data, 3, "DL Frame Offset"); + if (fusc) { + XBIT(data, 8, "Zone Symbol Offset"); + } + XBIT(data, 8, "OFDMA Symbol Offset"); + if (tusc) { + XBIT(data, 8, "Subchannel Offset"); + XBIT(data, 5, "No. OFDMA triple symbol"); + XBIT(data, 6, "No. subchannels"); + } else { + XBIT(data, 6, "Subchannel Offset"); + XBIT(data, 7, "No. OFDMA symbols"); + XBIT(data, 6, "No. subchannels"); + } + XBIT(data, 4, "DIUC/N(EP)"); + if (harq) { + XBIT(data, 1, "DL HARQ ACK bitmap"); + XBIT(data, 6, "ACK Allocation Index"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + if (ir_type) { + XBIT(data, 4, "N(SCH)"); + XBIT(data, 2, "SPID"); + XBIT(data, 2, "Reserved"); + } + } + XBIT(data, 2, "Repetition Coding Indication"); + if (ulmap_appended) { + /* offset and length are in bits */ + bit += wimax_decode_ulmap_reduced_aas(tree, bufptr, offset, length*8, tvb); + } + XBIT(data, 3, "Reserved"); + } + + /* padding */ + pad = BIT_PADDING(bit,8); + if (pad) { + proto_tree_add_text(tree, tvb, BITHI(bit,pad), "Padding: %d bits",pad); + bit += pad; + } + + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + + return BIT_TO_BYTE(bit) - offset; +} diff --git a/plugins/wimax/msg_dreg.c b/plugins/wimax/msg_dreg.c new file mode 100644 index 0000000000..dbbc268bd5 --- /dev/null +++ b/plugins/wimax/msg_dreg.c @@ -0,0 +1,571 @@ +/* msg_dreg.c + * WiMax MAC Management DREG-REQ, DREG-CMD Message decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint man_ofdma; +extern gboolean include_cor2_changes; + +/* Forward reference */ +static void dissect_dreg_tlv(proto_tree *dreg_tree, gint tlv_type, tvbuff_t *tvb, guint tlv_offset, guint tlv_len, gint dreg_decoder); +void dissect_mac_mgmt_msg_dreg_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_dreg_cmd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_dreg_req_decoder = -1; +static gint proto_mac_mgmt_msg_dreg_cmd_decoder = -1; + +static gint ett_mac_mgmt_msg_dreg_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_dreg_decoder, +}; + +/* DREG fields */ +static gint hf_dreg_cmd_message_type = -1; +static gint hf_dreg_req_message_type = -1; +static gint hf_ack_type_reserved = -1; +static gint hf_dreg_cmd_action = -1; +static gint hf_dreg_cmd_action_cor2 = -1; +static gint hf_dreg_cmd_reserved = -1; +static gint hf_dreg_paging_cycle = -1; +static gint hf_dreg_paging_offset = -1; +static gint hf_dreg_paging_group_id = -1; +static gint hf_dreg_req_duration = -1; +static gint hf_paging_controller_id = -1; +static gint hf_mac_hash_skip_threshold = -1; +static gint hf_dreg_paging_cycle_request = -1; +static gint hf_dreg_retain_ms_service_sbc = -1; +static gint hf_dreg_retain_ms_service_pkm = -1; +static gint hf_dreg_retain_ms_service_reg = -1; +static gint hf_dreg_retain_ms_service_network_address = -1; +static gint hf_dreg_retain_ms_service_tod = -1; +static gint hf_dreg_retain_ms_service_tftp = -1; +static gint hf_dreg_retain_ms_service_full_service = -1; +static gint hf_dreg_consider_paging_pref = -1; +static gint hf_tlv_value = -1; +static gint hf_dreg_req_action = -1; +static gint hf_dreg_req_reserved = -1; +static gint hf_dreg_invalid_tlv = -1; + +/* STRING RESOURCES */ +static const value_string vals_dreg_req_code[] = { + {0, "SS De-Registration request from BS and network"}, + {1, "MS request for De-Registration from serving BS and initiation of Idle Mode"}, + {2, "MS response for the Unsolicited De-Registration initiated by BS"}, + {3, "Reject for the unsolicited DREG-CMD with action \ +code 05 (idle mode request) by the BS. \ +Applicable only when MS has pending UL data to transmit"}, + {4, "Reserved"}, + {0, NULL} +}; + +static const value_string vals_dreg_cmd_action[] = { + {0, "SS shall immediately terminate service with the BS and \ +should attempt network entry at another BS"}, + {1, "SS shall listen to the current channel BS but shall not \ +transmit until an RES-CMD message or DREG-CMD with \ +Action Code 02 or 03 is received"}, + {2, "SS shall listen to the BS but only transmit \ +on the Basic, and Primary Management Connections"}, + {3, "SS shall return to normal operation and may transmit on \ +any of its active connections"}, + {4, "SS shall terminate current Normal Operations with the BS; \ +the BS shall transmit this action code only in response \ +to any SS DREG-REQ message"}, + {5, "MS shall immediately begin de-registration from serving \ +BS and request initiation of MS Idle Mode"}, + {6, "The MS may retransmit the DREG-REQ message after the \ +time duration (REQ-duration) provided in the message"}, + {7, "The MS shall not retransmit the DREG-REQ message and shall \ +wait for the DREG-CMD message. BS transmittal of a \ +subsequent DREG-CMD with Action Code 03 shall cancel \ +this restriction"}, + {0, NULL} +}; + +static const value_string vals_dreg_cmd_action_cor2[] = { + {0, "SS shall immediately terminate service with the BS and \ +should attempt network entry at another BS"}, + {1, "SS shall listen to the current channel BS but shall not \ +transmit until an RES-CMD message or DREG-CMD with \ +Action Code 02 or 03 is received"}, + {2, "SS shall listen to the BS but only transmit \ +on the Basic, and Primary Management Connections"}, + {3, "SS shall return to normal operation and may transmit on \ +any of its active connections"}, + {4, "Only valid in response to a DREG-REQ message with DREG \ +Code = 00. SS shall terminate current Normal Operations with the BS"}, + {5, "MS shall immediately begin de-registration from serving \ +BS and request initiation of MS Idle Mode"}, + {6, "Only valid in response to a DREG-REQ message with DREG \ +Code = 01. The MS may retransmit the DREG-REQ message after the \ +REQ-duration provided in the message; \ +BS sending a subsequent DREG-CMD message with \ +Action Code 03 cancels this restriction"}, + {0, NULL} +}; + +/* DREG fields display */ +static hf_register_info hf[] = +{ + { + &hf_dreg_consider_paging_pref, + { + "Consider Paging Preference of each Service Flow in resource retention", "wimax.dreg.consider_paging_preference", + FT_UINT8, BASE_DEC, NULL, 0x80, "", HFILL + } + }, + { + &hf_dreg_invalid_tlv, + { + "Invalid TLV", "wimax.dreg.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_mac_hash_skip_threshold, + { + "MAC Hash Skip Threshold", "wimax.dreg.mac_hash_skip_threshold", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_paging_controller_id, + { + "Paging Controller ID", "wimax.dreg.paging_controller_id", + FT_ETHER, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dreg_paging_cycle, + { + "PAGING CYCLE", "wimax.dreg.paging_cycle", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dreg_paging_cycle_request, + { + "Paging Cycle Request", "wimax.dreg.paging_cycle_request", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dreg_paging_group_id, + { + "Paging-group-ID", "wimax.dreg.paging_group_id", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dreg_paging_offset, + { + "PAGING OFFSET", "wimax.dreg.paging_offset", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dreg_req_duration, + { + "REQ-duration (Waiting value for the DREG-REQ message re-transmission in frames)", "wimax.dreg.req_duration", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dreg_retain_ms_service_full_service, + { + "Retain MS service and operation information associated with Full service", "wimax.dreg.retain_ms_full_service", + FT_UINT8, BASE_DEC, NULL, 0x40, "", HFILL + } + }, + { + &hf_dreg_retain_ms_service_network_address, + { + "Retain MS service and operational information associated with Network Address", "wimax.dreg.retain_ms_service_network_address", + FT_UINT8, BASE_DEC, NULL, 0x08, "", HFILL + } + }, + { + &hf_dreg_retain_ms_service_pkm, + { + "Retain MS service and operational information associated with PKM-REQ/RSP", "wimax.dreg.retain_ms_service_pkm", + FT_UINT8, BASE_DEC, NULL, 0x02, "", HFILL + } + }, + { + &hf_dreg_retain_ms_service_reg, + { + "Retain MS service and operational information associated with REG-REQ/RSP", "wimax.dreg.retain_ms_service_reg", + FT_UINT8, BASE_DEC, NULL, 0x04, "", HFILL + } + }, + { + &hf_dreg_retain_ms_service_sbc, + { + "Retain MS service and operational information associated with SBC-REQ/RSP", "wimax.dreg.retain_ms_service_sbc", + FT_UINT8, BASE_DEC, NULL, 0x01, "", HFILL + } + }, + { + &hf_dreg_retain_ms_service_tftp, + { + "Retain MS service and operational information associated with TFTP messages", "wimax.dreg.retain_ms_service_tftp", + FT_UINT8, BASE_DEC, NULL, 0x20, "", HFILL + } + }, + { + &hf_dreg_retain_ms_service_tod, + { + "Retain MS service and operational information associated with Time of Day", "wimax.dreg.retain_ms_service_tod", + FT_UINT8, BASE_DEC, NULL, 0x10, "", HFILL + } + }, + { + &hf_dreg_cmd_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dreg_cmd", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dreg_cmd_action, + { + "DREG-CMD Action code", "wimax.dreg_cmd.action", + FT_UINT8, BASE_DEC, VALS(vals_dreg_cmd_action), 0x07, "", HFILL + } + }, + { + &hf_dreg_cmd_action_cor2, + { + "DREG-CMD Action code", "wimax.dreg_cmd.action", + FT_UINT8, BASE_DEC, VALS(vals_dreg_cmd_action_cor2), 0x07, "", HFILL + } + }, + { + &hf_dreg_cmd_reserved, + { + "Reserved", "wimax.dreg_cmd.action_reserved", + FT_UINT8, BASE_DEC, NULL, 0xF8, "", HFILL + } + }, + { + &hf_dreg_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dreg_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dreg_req_action, + { + "DREG-REQ Action code", "wimax.dreg_req.action", + FT_UINT8, BASE_DEC, VALS(vals_dreg_req_code), 0x03, "", HFILL + } + }, + { + &hf_dreg_req_reserved, + { + "Reserved", "wimax.dreg_req.action_reserved", + FT_UINT8, BASE_DEC, NULL, 0xFC, "", HFILL + } + }, + { + &hf_tlv_value, + { + "Value", "wimax.dreg.unknown_tlv_value", + FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL + } + }, + { + &hf_ack_type_reserved, + { + "Reserved", "wimax.ack_type_reserved", + FT_UINT8, BASE_DEC, NULL, 0x03, "", HFILL + } + } +}; + + +/* Decode sub-TLV's of either DREG-REQ or DREG-CMD. */ +static void dissect_dreg_tlv(proto_tree *dreg_tree, gint tlv_type, tvbuff_t *tvb, guint tlv_offset, guint tlv_len, gint dreg_decoder) +{ + guint tvb_len; + /*guint tlv_len;*/ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + + switch (tlv_type) { + case DREG_PAGING_INFO: + proto_tree_add_item(dreg_tree, hf_dreg_paging_cycle, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_paging_offset, tvb, tlv_offset + 2, 1, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_paging_group_id, tvb, tlv_offset + 3, 2, FALSE); + break; + case DREG_REQ_DURATION: + proto_tree_add_item(dreg_tree, hf_dreg_req_duration, tvb, tlv_offset, 1, FALSE); + break; + case DREG_PAGING_CONTROLLER_ID: + proto_tree_add_item(dreg_tree, hf_paging_controller_id, tvb, tlv_offset, 6, FALSE); + break; + case DREG_IDLE_MODE_RETAIN_INFO: + proto_tree_add_item(dreg_tree, hf_dreg_retain_ms_service_sbc, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_retain_ms_service_pkm, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_retain_ms_service_reg, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_retain_ms_service_network_address, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_retain_ms_service_tod, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_retain_ms_service_tftp, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_retain_ms_service_full_service, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(dreg_tree, hf_dreg_consider_paging_pref, tvb, tlv_offset, 1, FALSE); + break; + case DREG_MAC_HASH_SKIP_THRESHOLD: + proto_tree_add_item(dreg_tree, hf_mac_hash_skip_threshold, tvb, tlv_offset, 2, FALSE); + break; + case DREG_PAGING_CYCLE_REQUEST: + proto_tree_add_item(dreg_tree, hf_dreg_paging_cycle_request, tvb, tlv_offset, 2, FALSE); + break; + default: + proto_tree_add_item(dreg_tree, hf_tlv_value, tvb, tlv_offset, tlv_len, FALSE); + break; + } +} + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_dreg_req(void) +{ + if (proto_mac_mgmt_msg_dreg_req_decoder == -1) { + proto_mac_mgmt_msg_dreg_req_decoder = proto_register_protocol ( + "WiMax DREG-REQ/CMD Messages", /* name */ + "WiMax DREG-REQ/CMD (dreg)", /* short name */ + "dreg" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_dreg_req_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_dreg_cmd(void) +{ + if (proto_mac_mgmt_msg_dreg_cmd_decoder == -1) { + proto_mac_mgmt_msg_dreg_cmd_decoder = proto_mac_mgmt_msg_dreg_req_decoder; + + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode DREG-REQ messages. */ +void dissect_mac_mgmt_msg_dreg_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tlv_offset; + guint tvb_len, payload_type; + proto_item *dreg_req_item = NULL; + proto_tree *dreg_req_tree = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + gint tlv_type; + gint tlv_len; + gboolean hmac_found = FALSE; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_DREG_REQ) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type DREG-REQ */ + dreg_req_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dreg_req_decoder, tvb, 0, tvb_len, "MAC Management Message, DREG-REQ (49)"); + /* add MAC DREG REQ subtree */ + dreg_req_tree = proto_item_add_subtree(dreg_req_item, ett_mac_mgmt_msg_dreg_decoder); + /* display the Message Type */ + proto_tree_add_item(dreg_req_tree, hf_dreg_req_message_type, tvb, offset, 1, FALSE); + offset++; + /* display the Action Code */ + proto_tree_add_item(dreg_req_tree, hf_dreg_req_action, tvb, offset, 1, FALSE); + /* show the Reserved bits */ + proto_tree_add_item(dreg_req_tree, hf_dreg_req_reserved, tvb, offset, 1, FALSE); + offset++; + + while(offset < tvb_len) + { + /* Get the TLV data. */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DREG-REQ TLV error"); + } + proto_tree_add_item(dreg_req_tree, hf_dreg_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the offset to the TLV data */ + tlv_offset = offset + get_tlv_value_offset(&tlv_info); + + switch (tlv_type) { + case HMAC_TUPLE: /* Table 348d */ + /* decode and display the HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dreg_decoder, dreg_req_tree, proto_mac_mgmt_msg_dreg_req_decoder, tvb, tlv_offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + wimax_hmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tlv_len); + hmac_found = TRUE; + break; + case CMAC_TUPLE: /* Table 348b */ + /* decode and display the CMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dreg_decoder, dreg_req_tree, proto_mac_mgmt_msg_dreg_req_decoder, tvb, tlv_offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len); + wimax_cmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tlv_len); + break; + default: + /* Decode DREG-REQ sub-TLV's */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dreg_decoder, dreg_req_tree, proto_mac_mgmt_msg_dreg_req_decoder, tvb, tlv_offset, tlv_len, "DREG-REQ sub-TLV's (%u byte(s))", tlv_len); + dissect_dreg_tlv(tlv_tree, tlv_type, tvb, tlv_offset, tlv_len, proto_mac_mgmt_msg_dreg_req_decoder); + break; + } + + + offset = tlv_len + tlv_offset; + } /* end of TLV process while loop */ + if (!hmac_found) + proto_item_append_text(dreg_req_tree, " (HMAC Tuple is missing !)"); + } +} + +/* Decode DREG-CMD messages. */ +void dissect_mac_mgmt_msg_dreg_cmd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tlv_offset; + guint tvb_len, payload_type; + proto_item *dreg_cmd_item = NULL; + proto_tree *dreg_cmd_tree = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + gint tlv_type; + gint tlv_len; + gboolean hmac_found = FALSE; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_DREG_CMD) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type DREG-CMD */ + dreg_cmd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dreg_cmd_decoder, tvb, 0, tvb_len, "MAC Management Message, DREG-CMD (29)"); + /* add MAC DREG CMD subtree */ + dreg_cmd_tree = proto_item_add_subtree(dreg_cmd_item, ett_mac_mgmt_msg_dreg_decoder); + /* display the Message Type */ + proto_tree_add_item(dreg_cmd_tree, hf_dreg_cmd_message_type, tvb, offset, 1, FALSE); + offset ++; + /* display the Action Code */ + if (include_cor2_changes) + proto_tree_add_item(dreg_cmd_tree, hf_dreg_cmd_action_cor2, tvb, offset, 1, FALSE); + else + proto_tree_add_item(dreg_cmd_tree, hf_dreg_cmd_action, tvb, offset, 1, FALSE); + /* show the Reserved bits */ + proto_tree_add_item(dreg_cmd_tree, hf_dreg_cmd_reserved, tvb, offset, 1, FALSE); + offset ++; + + while(offset < tvb_len) + { + /* Get the TLV data. */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DREG-CMD TLV error"); + } + proto_tree_add_item(dreg_cmd_tree, hf_dreg_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the offset to the TLV data */ + tlv_offset = offset + get_tlv_value_offset(&tlv_info); + + switch (tlv_type) { + case HMAC_TUPLE: /* Table 348d */ + /* decode and display the HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dreg_decoder, dreg_cmd_tree, proto_mac_mgmt_msg_dreg_cmd_decoder, tvb, tlv_offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + wimax_hmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tlv_len); + hmac_found = TRUE; + break; + case CMAC_TUPLE: /* Table 348b */ + /* decode and display the CMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dreg_decoder, dreg_cmd_tree, proto_mac_mgmt_msg_dreg_cmd_decoder, tvb, tlv_offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len); + wimax_cmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tlv_len); + break; + default: + /* Decode DREG-CMD sub-TLV's */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dreg_decoder, dreg_cmd_tree, proto_mac_mgmt_msg_dreg_cmd_decoder, tvb, tlv_offset, tlv_len, "DREG-CMD sub-TLV's (%u byte(s))", tlv_len); + dissect_dreg_tlv(tlv_tree, tlv_type, tvb, tlv_offset, tlv_len, proto_mac_mgmt_msg_dreg_cmd_decoder); + break; + } + + offset = tlv_len + tlv_offset; + } /* end of TLV process while loop */ + if (!hmac_found) + proto_item_append_text(dreg_cmd_tree, " (HMAC Tuple is missing !)"); + } +} + diff --git a/plugins/wimax/msg_dsa.c b/plugins/wimax/msg_dsa.c new file mode 100644 index 0000000000..0bb9c9d6e1 --- /dev/null +++ b/plugins/wimax/msg_dsa.c @@ -0,0 +1,245 @@ +/* msg_dsa.c + * WiMax MAC Management DSA-REQ/RSP/ACK Messages decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* +#define DEBUG +*/ + +#include <gmodule.h> +#include <epan/packet.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint proto_wimax; + +/* forward reference */ +void proto_register_mac_mgmt_msg_dsa(void); +void dissect_mac_mgmt_msg_dsa_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_dsa_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_dsa_ack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +gint proto_mac_mgmt_msg_dsa_decoder = -1; +static gint ett_mac_mgmt_msg_dsa_req_decoder = -1; +static gint ett_mac_mgmt_msg_dsa_rsp_decoder = -1; +static gint ett_mac_mgmt_msg_dsa_ack_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_dsa_req_decoder, + &ett_mac_mgmt_msg_dsa_rsp_decoder, + &ett_mac_mgmt_msg_dsa_ack_decoder, +}; + +static gchar *dsa_msgs[] = +{ + "Dynamic Service Addition Request (DSA-REQ)", + "Dynamic Service Addition Response (DSA-RSP)", + "Dynamic Service Addition Acknowledge (DSA-ACK)" +}; + +/* fix fields */ +static gint hf_dsa_req_message_type = -1; +static gint hf_dsa_transaction_id = -1; +static gint hf_dsa_rsp_message_type = -1; +static gint hf_dsa_confirmation_code = -1; +static gint hf_dsa_ack_message_type = -1; + +/* DSx display */ +static hf_register_info hf[] = +{ + { + &hf_dsa_ack_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dsa_ack", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsa_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dsa_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsa_rsp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dsa_rsp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsa_confirmation_code, + { + "Confirmation code", "wimax.dsa.confirmation_code", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsa_transaction_id, + { + "Transaction ID", "wimax.dsa.transaction_id", + FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_dsa(void) +{ + if (proto_mac_mgmt_msg_dsa_decoder == -1) + { + proto_mac_mgmt_msg_dsa_decoder = proto_register_protocol ( + "WiMax DSA/C/D Messages", /* name */ + "WiMax DSA/C/D (ds)", /* short name */ + "ds" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_dsa_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +void dissect_mac_mgmt_msg_dsa_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *dsa_item = NULL; + proto_tree *dsa_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSA REQ */ + if(payload_type != MAC_MGMT_MSG_DSA_REQ) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsa_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsa_decoder, tvb, offset, tvb_len, "%s (%u bytes)", dsa_msgs[payload_type - MAC_MGMT_MSG_DSA_REQ], tvb_len); + /* add MAC DSx subtree */ + dsa_tree = proto_item_add_subtree(dsa_item, ett_mac_mgmt_msg_dsa_req_decoder); + /* Decode and display the Uplink Channel Descriptor (UCD) */ + /* display the Message Type */ + proto_tree_add_item(dsa_tree, hf_dsa_req_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Transaction ID */ + proto_tree_add_item(dsa_tree, hf_dsa_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* process DSA-REQ message TLV Encode Information */ + wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, dsa_tree); + } +} + +void dissect_mac_mgmt_msg_dsa_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *dsa_item = NULL; + proto_tree *dsa_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSA RSP */ + if(payload_type != MAC_MGMT_MSG_DSA_RSP) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsa_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsa_decoder, tvb, offset, tvb_len, "%s (%u bytes)", dsa_msgs[payload_type - MAC_MGMT_MSG_DSA_REQ], tvb_len); + /* add MAC DSx subtree */ + dsa_tree = proto_item_add_subtree(dsa_item, ett_mac_mgmt_msg_dsa_rsp_decoder); + /* Decode and display the Uplink Channel Descriptor (UCD) */ + /* display the Message Type */ + proto_tree_add_item(dsa_tree, hf_dsa_rsp_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Transaction ID */ + proto_tree_add_item(dsa_tree, hf_dsa_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* display the Confirmation Code */ + proto_tree_add_item(dsa_tree, hf_dsa_confirmation_code, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* process DSA RSP message TLV Encode Information */ + wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, dsa_tree); + } +} + +void dissect_mac_mgmt_msg_dsa_ack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *dsa_item = NULL; + proto_tree *dsa_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSA ACK */ + if(payload_type != MAC_MGMT_MSG_DSA_ACK) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsa_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsa_decoder, tvb, offset, tvb_len, "%s (%u bytes)", dsa_msgs[payload_type - MAC_MGMT_MSG_DSA_REQ], tvb_len); + /* add MAC DSx subtree */ + dsa_tree = proto_item_add_subtree(dsa_item, ett_mac_mgmt_msg_dsa_ack_decoder); + /* Decode and display the Uplink Channel Descriptor (UCD) */ + /* display the Message Type */ + proto_tree_add_item(dsa_tree, hf_dsa_ack_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Transaction ID */ + proto_tree_add_item(dsa_tree, hf_dsa_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* display the Confirmation Code */ + proto_tree_add_item(dsa_tree, hf_dsa_confirmation_code, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* process DSA-REQ message TLV Encode Information */ + wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, dsa_tree); + } +} + diff --git a/plugins/wimax/msg_dsc.c b/plugins/wimax/msg_dsc.c new file mode 100644 index 0000000000..2a8c1eb970 --- /dev/null +++ b/plugins/wimax/msg_dsc.c @@ -0,0 +1,250 @@ +/* msg_dsc.c + * WiMax MAC Management DSC-REQ/RSP/ACK Messages decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* +#define DEBUG +*/ + +#include <gmodule.h> +#include <epan/packet.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint proto_mac_mgmt_msg_dsa_decoder; + +/* forward reference */ +void proto_register_mac_mgmt_msg_dsc(void); +void dissect_mac_mgmt_msg_dsc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_dsc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_dsc_ack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_dsc_decoder = -1; +static gint ett_mac_mgmt_msg_dsc_req_decoder = -1; +static gint ett_mac_mgmt_msg_dsc_rsp_decoder = -1; +static gint ett_mac_mgmt_msg_dsc_ack_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_dsc_req_decoder, + &ett_mac_mgmt_msg_dsc_rsp_decoder, + &ett_mac_mgmt_msg_dsc_ack_decoder +}; + +static gchar *dsc_msgs[] = +{ + "Dynamic Service Change Request (DSC-REQ)", + "Dynamic Service Change Response (DSC-RSP)", + "Dynamic Service Change Acknowledge (DSC-ACK)" +}; + +/* fix fields */ +static gint hf_dsc_req_message_type = -1; +static gint hf_dsc_transaction_id = -1; +static gint hf_dsc_rsp_message_type = -1; +static gint hf_dsc_confirmation_code = -1; +static gint hf_dsc_ack_message_type = -1; + +/* DSx display */ +static hf_register_info hf[] = +{ + { + &hf_dsc_ack_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dsc_ack", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsc_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dsc_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsc_rsp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dsc_rsp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsc_confirmation_code, + { + "Confirmation code", "wimax.dsc.confirmation_code", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsc_transaction_id, + { + "Transaction ID", "wimax.dsc.transaction_id", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_dsc(void) +{ + if (proto_mac_mgmt_msg_dsc_decoder == -1) + { + proto_mac_mgmt_msg_dsc_decoder = proto_mac_mgmt_msg_dsa_decoder; + + proto_register_field_array(proto_mac_mgmt_msg_dsc_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +void dissect_mac_mgmt_msg_dsc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + guint dsc_transaction_id; + proto_item *dsc_item = NULL; + proto_tree *dsc_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSC REQ/RSP/ACK */ + if(payload_type != MAC_MGMT_MSG_DSC_REQ) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsc_decoder, tvb, offset, tvb_len, "%s (%u bytes)", dsc_msgs[payload_type - MAC_MGMT_MSG_DSC_REQ], tvb_len); + /* add MAC DSx subtree */ + dsc_tree = proto_item_add_subtree(dsc_item, ett_mac_mgmt_msg_dsc_req_decoder); + /* Decode and display the Uplink Channel Descriptor (UCD) */ + /* display the Message Type */ + proto_tree_add_item(dsc_tree, hf_dsc_req_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* get the Configuration Change Count */ + dsc_transaction_id = tvb_get_ntohs(tvb, offset); + /* display the Transaction ID */ + proto_tree_add_item(dsc_tree, hf_dsc_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* process DSC REQ message TLV Encode Information */ + wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, dsc_tree); + } +} + +void dissect_mac_mgmt_msg_dsc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + guint dsc_transaction_id; + proto_item *dsc_item = NULL; + proto_tree *dsc_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSC REQ/RSP/ACK */ + if(payload_type != MAC_MGMT_MSG_DSC_RSP) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsc_decoder, tvb, offset, tvb_len, "%s (%u bytes)", dsc_msgs[payload_type - MAC_MGMT_MSG_DSC_REQ], tvb_len); + /* add MAC DSx subtree */ + dsc_tree = proto_item_add_subtree(dsc_item, ett_mac_mgmt_msg_dsc_rsp_decoder); + /* Decode and display the Uplink Channel Descriptor (UCD) */ + /* display the Message Type */ + proto_tree_add_item(dsc_tree, hf_dsc_rsp_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* get the Configuration Change Count */ + dsc_transaction_id = tvb_get_ntohs(tvb, offset); + /* display the Transaction ID */ + proto_tree_add_item(dsc_tree, hf_dsc_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* display the Confirmation Code */ + proto_tree_add_item(dsc_tree, hf_dsc_confirmation_code, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* process DSC RSP message TLV Encode Information */ + wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, dsc_tree); + } +} + +void dissect_mac_mgmt_msg_dsc_ack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + guint dsc_transaction_id; + proto_item *dsc_item = NULL; + proto_tree *dsc_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSC REQ/RSP/ACK */ + if((payload_type < MAC_MGMT_MSG_DSC_REQ) || (payload_type > MAC_MGMT_MSG_DSC_ACK)) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsc_decoder, tvb, offset, tvb_len, "%s (%u bytes)", dsc_msgs[payload_type - MAC_MGMT_MSG_DSC_REQ], tvb_len); + /* add MAC DSx subtree */ + dsc_tree = proto_item_add_subtree(dsc_item, ett_mac_mgmt_msg_dsc_ack_decoder); + /* Decode and display the Uplink Channel Descriptor (UCD) */ + /* display the Message Type */ + proto_tree_add_item(dsc_tree, hf_dsc_ack_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* get the Configuration Change Count */ + dsc_transaction_id = tvb_get_ntohs(tvb, offset); + /* display the Transaction ID */ + proto_tree_add_item(dsc_tree, hf_dsc_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* display the Confirmation Code */ + proto_tree_add_item(dsc_tree, hf_dsc_confirmation_code, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* process DSC ACK message TLV Encode Information */ + wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, dsc_tree); + } +} + diff --git a/plugins/wimax/msg_dsd.c b/plugins/wimax/msg_dsd.c new file mode 100644 index 0000000000..db698b2b86 --- /dev/null +++ b/plugins/wimax/msg_dsd.c @@ -0,0 +1,308 @@ +/* msg_dsd.c + * WiMax MAC Management DSD-REQ/RSP Messages decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* +#define DEBUG +*/ + +#include <gmodule.h> +#include <epan/packet.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint proto_mac_mgmt_msg_dsa_decoder; + +/* forward reference */ +void proto_register_mac_mgmt_msg_dsd(void); +void dissect_mac_mgmt_msg_dsd_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_dsd_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +gint proto_mac_mgmt_msg_dsd_decoder = -1; +static gint ett_mac_mgmt_msg_dsd_req_decoder = -1; +static gint ett_mac_mgmt_msg_dsd_rsp_decoder = -1; +static gint ett_dsd_ul_sfe_decoder = -1; +static gint ett_dsd_dl_sfe_decoder = -1; +static gint ett_dsd_hmac_tuple = -1; +static gint ett_dsd_cmac_tuple = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_dsd_req_decoder, + &ett_mac_mgmt_msg_dsd_rsp_decoder, + &ett_dsd_ul_sfe_decoder, + &ett_dsd_dl_sfe_decoder, + &ett_dsd_hmac_tuple, + &ett_dsd_cmac_tuple, +}; + +static gchar *dsd_msgs[] = +{ + "Dynamic Service Deletion Request (DSD-REQ)", + "Dynamic Service Deletion Response (DSD-RSP)" +}; + +/* fix fields */ +static gint hf_dsd_req_message_type = -1; +static gint hf_dsd_transaction_id = -1; +static gint hf_dsd_service_flow_id = -1; +static gint hf_dsd_rsp_message_type = -1; +static gint hf_dsd_confirmation_code = -1; +static gint hf_dsd_invalid_tlv = -1; +static gint hf_dsd_unknown_type = -1; + +/* DSx display */ +static hf_register_info hf[] = +{ + { + &hf_dsd_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dsd_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsd_rsp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.dsd_rsp", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_dsd_confirmation_code, + { + "Confirmation code", "wimax.dsd.confirmation_code", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsd_service_flow_id, + { + "Service Flow ID", "wimax.dsd.service_flow_id", + FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_dsd_transaction_id, + { + "Transaction ID", "wimax.dsd.transaction_id", + FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_dsd(void) +{ + if (proto_mac_mgmt_msg_dsd_decoder == -1) + { + proto_mac_mgmt_msg_dsd_decoder = proto_mac_mgmt_msg_dsa_decoder; + + proto_register_field_array(proto_mac_mgmt_msg_dsd_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +void dissect_mac_mgmt_msg_dsd_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, tlv_len, tlv_value_offset; + gint tlv_type; + proto_item *dsd_item = NULL; + proto_tree *dsd_tree = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSD REQ/RSP/ACK */ + if(payload_type != MAC_MGMT_MSG_DSD_REQ) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tvb_len, "%s (%u bytes)", dsd_msgs[payload_type - MAC_MGMT_MSG_DSD_REQ], tvb_len); + /* add MAC DSx subtree */ + dsd_tree = proto_item_add_subtree(dsd_item, ett_mac_mgmt_msg_dsd_req_decoder); + /* Decode and display the DSD message */ + /* display the Message Type */ + proto_tree_add_item(dsd_tree, hf_dsd_req_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Transaction ID */ + proto_tree_add_item(dsd_tree, hf_dsd_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* display the Service Flow ID */ + proto_tree_add_item(dsd_tree, hf_dsd_service_flow_id, tvb, offset, 4, FALSE); + /* move to next field */ + offset += 4; + /* process DSD REQ message TLV Encode Information */ + while(offset < tvb_len) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DSD-REQ TLV error"); + } + proto_tree_add_item(dsd_tree, hf_dsd_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(dsd_tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tlv_len + tlv_value_offset, "DSD-REQ TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len + tlv_value_offset, offset, tvb_len); +#endif + /* update the offset */ + offset += tlv_value_offset; + /* process TLV */ + switch (tlv_type) + { + case HMAC_TUPLE: /* Table 348d */ + /* decode and display the HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dsd_req_decoder, dsd_tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + wimax_hmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); + break; + case CMAC_TUPLE: /* Table 348b */ + /* decode and display the CMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dsd_req_decoder, dsd_tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len); + wimax_cmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); + break; + default: + /* display the unknown tlv in hex */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dsd_req_decoder, dsd_tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tlv_len, "Unknown TLV (%u byte(s))", tlv_len); + proto_tree_add_item(tlv_tree, hf_dsd_unknown_type, tvb, (offset - tlv_value_offset), (tlv_len + tlv_value_offset), FALSE); + break; + } + offset += tlv_len; + } /* end of while loop */ + } +} + +void dissect_mac_mgmt_msg_dsd_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, tlv_len, tlv_value_offset; + gint tlv_type; + proto_item *dsd_item = NULL; + proto_tree *dsd_tree = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSD REQ/RSP/ACK */ + if(payload_type != MAC_MGMT_MSG_DSD_RSP) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tvb_len, "%s (%u bytes)", dsd_msgs[payload_type - MAC_MGMT_MSG_DSD_REQ], tvb_len); + /* add MAC DSx subtree */ + dsd_tree = proto_item_add_subtree(dsd_item, ett_mac_mgmt_msg_dsd_rsp_decoder); + /* Decode and display the DSD message */ + /* display the Message Type */ + proto_tree_add_item(dsd_tree, hf_dsd_rsp_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Transaction ID */ + proto_tree_add_item(dsd_tree, hf_dsd_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* display the Confirmation Code */ + proto_tree_add_item(dsd_tree, hf_dsd_confirmation_code, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Service Flow ID */ + proto_tree_add_item(dsd_tree, hf_dsd_service_flow_id, tvb, offset, 4, FALSE); + /* move to next field */ + offset += 4; + /* process DSD RSP message TLV Encode Information */ + while(offset < tvb_len) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DSD RSP TLV error"); + } + proto_tree_add_item(dsd_tree, hf_dsd_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(dsd_tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tlv_len + tlv_value_offset, "DSD-RSP TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len + tlv_value_offset, offset, tvb_len); +#endif + /* update the offset */ + offset += tlv_value_offset; + /* process TLV */ + switch (tlv_type) + { + case HMAC_TUPLE: /* Table 348d */ + /* decode and display the HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dsd_req_decoder, dsd_tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + wimax_hmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); + break; + case CMAC_TUPLE: /* Table 348b */ + /* decode and display the CMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dsd_req_decoder, dsd_tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len); + wimax_cmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); + break; + default: + /* display the unknown tlv in hex */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dsd_req_decoder, dsd_tree, proto_mac_mgmt_msg_dsd_decoder, tvb, offset, tlv_len, "Unknown TLV (%u byte(s))", tlv_len); + proto_tree_add_item(tlv_tree, hf_dsd_unknown_type, tvb, (offset - tlv_value_offset), (tlv_len + tlv_value_offset), FALSE); + break; + } + offset += tlv_len; + } /* end of while loop */ + } +} diff --git a/plugins/wimax/msg_dsx_rvd.c b/plugins/wimax/msg_dsx_rvd.c new file mode 100644 index 0000000000..2241802a8e --- /dev/null +++ b/plugins/wimax/msg_dsx_rvd.c @@ -0,0 +1,121 @@ +/* msg_dsx_rvd.c + * WiMax MAC Management DSX-RVD Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include "wimax_mac.h" + +/* forward reference */ +void dissect_mac_mgmt_msg_dsx_rvd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_dsx_rvd_decoder = -1; +static gint ett_mac_mgmt_msg_dsx_rvd_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_dsx_rvd_decoder, +}; + +/* fix fields */ +static gint hf_dsx_rvd_message_type = -1; +static gint hf_dsx_rvd_transaction_id = -1; +static gint hf_dsx_rvd_confirmation_code = -1; + +/* DSX_RVD display */ +static hf_register_info hf_dsx_rvd[] = +{ + { + &hf_dsx_rvd_message_type, + {"MAC Management Message Type", "wimax.macmgtmsgtype.dsx_rvd", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_dsx_rvd_confirmation_code, + { "Confirmation code", "wimax.dsx_rvd.confirmation_code", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_dsx_rvd_transaction_id, + { "Transaction ID", "wimax.dsx_rvd.transaction_id", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_dsx_rvd(void) +{ + if (proto_mac_mgmt_msg_dsx_rvd_decoder == -1) + { + proto_mac_mgmt_msg_dsx_rvd_decoder = proto_register_protocol ( + "WiMax DSX-RVD Message", /* name */ + "WiMax DSX-RVD (dsx)", /* short name */ + "dsx" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_dsx_rvd_decoder, hf_dsx_rvd, array_length(hf_dsx_rvd)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode DSX-RVD messages. */ +void dissect_mac_mgmt_msg_dsx_rvd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *dsx_rvd_item = NULL; + proto_tree *dsx_rvd_tree = NULL; + + if(tree) + { /* we are being asked for details */ + /* get the message type */ + payload_type = tvb_get_guint8(tvb, offset); + /* ensure the message type is DSX-RVD */ + if(payload_type != MAC_MGMT_MSG_DSX_RVD) + return; + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC message type */ + dsx_rvd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsx_rvd_decoder, tvb, offset, tvb_len, "DSx Received (DSX-RVD) (%u bytes)", tvb_len); + /* add MAC DSx subtree */ + dsx_rvd_tree = proto_item_add_subtree(dsx_rvd_item, ett_mac_mgmt_msg_dsx_rvd_decoder); + /* display the Message Type */ + proto_tree_add_item(dsx_rvd_tree, hf_dsx_rvd_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* display the Transaction ID */ + proto_tree_add_item(dsx_rvd_tree, hf_dsx_rvd_transaction_id, tvb, offset, 2, FALSE); + /* move to next field */ + offset += 2; + /* display the Confirmation Code */ + proto_tree_add_item(dsx_rvd_tree, hf_dsx_rvd_confirmation_code, tvb, offset, 1, FALSE); + } +} diff --git a/plugins/wimax/msg_fpc.c b/plugins/wimax/msg_fpc.c new file mode 100644 index 0000000000..606128b2cb --- /dev/null +++ b/plugins/wimax/msg_fpc.c @@ -0,0 +1,190 @@ +/* msg_fpc.c + * WiMax MAC Management FPC Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" +#include "wimax_mac.h" + +extern gint man_ofdma; + +/* Forward reference */ +void dissect_mac_mgmt_msg_fpc_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_fpc_decoder = -1; + +static gint ett_mac_mgmt_msg_fpc_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_fpc_decoder, +}; + +/* FPC fields */ +static gint hf_fpc_message_type = -1; +static gint hf_fpc_number_of_stations = -1; +static gint hf_fpc_basic_cid = -1; +static gint hf_fpc_power_adjust = -1; +static gint hf_fpc_power_measurement_frame = -1; +static gint hf_fpc_invalid_tlv = -1; + +/* FPC fields display */ +static hf_register_info hf[] = +{ + { + &hf_fpc_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.fpc", + FT_UINT8, BASE_DEC, NULL, 0x0, + "", HFILL + } + }, + { + &hf_fpc_basic_cid, + { + "Basic CID", "wimax.fpc.basic_cid", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_fpc_invalid_tlv, + { + "Invalid TLV", "wimax.fpc.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_fpc_number_of_stations, + { + "Number of stations", "wimax.fpc.number_stations", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_fpc_power_adjust, + { + "Power Adjust. Signed change in power level (incr of 0.25dB) that the SS shall apply to its current power setting", "wimax.fpc.power_adjust", + FT_FLOAT, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_fpc_power_measurement_frame, + { + "Power measurement frame. The 8 LSB of the frame number in which the BS measured the power corrections referred to in the message", "wimax.fpc.power_measurement_frame", + FT_INT8, BASE_DEC, NULL, 0x0, "", HFILL + } + } +}; + + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_fpc(void) +{ + if (proto_mac_mgmt_msg_fpc_decoder == -1) { + proto_mac_mgmt_msg_fpc_decoder = proto_register_protocol ( + "WiMax FPC Message", /* name */ + "WiMax FPC (fpc)", /* short name */ + "fpc" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_fpc_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode FPC messages. */ +void dissect_mac_mgmt_msg_fpc_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint i; + guint number_stations; + guint tvb_len, payload_type; + proto_item *fpc_item = NULL; + proto_tree *fpc_tree = NULL; + gint8 value; + gfloat power_change; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_FPC) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type FPC */ + fpc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_fpc_decoder, tvb, 0, tvb_len, "MAC Management Message, FPC (38)"); + /* add MAC FPC subtree */ + fpc_tree = proto_item_add_subtree(fpc_item, ett_mac_mgmt_msg_fpc_decoder); + /* display the Message Type */ + proto_tree_add_item(fpc_tree, hf_fpc_message_type, tvb, offset, 1, FALSE); + offset ++; + /* display the Number of stations */ + proto_tree_add_item(fpc_tree, hf_fpc_number_of_stations, tvb, offset, 1, FALSE); + + number_stations = tvb_get_guint8(tvb, offset); + offset++; + for (i = 0; i < number_stations; i++ ) { + /* display the Basic CID*/ + proto_tree_add_item(fpc_tree, hf_fpc_basic_cid, tvb, offset, 2, FALSE); + offset += 2; + + /* display the Power adjust value */ + value = (gint8)tvb_get_guint8(tvb, offset); + power_change = (float)0.25 * value; /* 0.25dB incr */ + + /* display the Power adjust value in dB */ + proto_tree_add_float_format_value(fpc_tree, hf_fpc_power_adjust, tvb, offset, 1, power_change, " %.2f dB", power_change); + offset++; + + /* display the Power measurement frame */ + proto_tree_add_item(fpc_tree, hf_fpc_power_measurement_frame, tvb, offset, 1, FALSE); + offset++; + + if ( offset >= tvb_len ) { + break; + } + } + } +} + diff --git a/plugins/wimax/msg_pkm.c b/plugins/wimax/msg_pkm.c new file mode 100644 index 0000000000..e148b70b75 --- /dev/null +++ b/plugins/wimax/msg_pkm.c @@ -0,0 +1,222 @@ +/* msg_pkm.c + * WiMax MAC Management PKM-REQ/RSP Messages decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* +#define DEBUG // for debug only +*/ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +/* forward reference */ +void proto_register_mac_mgmt_msg_pkm(void); +void dissect_mac_mgmt_msg_pkm_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_pkm_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_pkm_decoder = -1; +static gint ett_mac_mgmt_msg_pkm_req_decoder = -1; +static gint ett_mac_mgmt_msg_pkm_rsp_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett_pkm[] = +{ + &ett_mac_mgmt_msg_pkm_req_decoder, + &ett_mac_mgmt_msg_pkm_rsp_decoder, +}; + +static const value_string vals_pkm_msg_code[] = +{ + {3, "SA ADD"}, + {4, "Auth Request"}, + {5, "Auth Reply"}, + {6, "Auth Reject"}, + {7, "Key Request"}, + {8, "Key Reply"}, + {9, "Key Reject"}, + {10, "Auth Invalid"}, + {11, "TEK Invalid"}, + {12, "Auth Info"}, + {13, "PKMv2 RSA-Request"}, + {14, "PKMv2 RSA-Reply"}, + {15, "PKMv2 RSA-Reject"}, + {16, "PKMv2 RSA-Acknowledgement"}, + {17, "PKMv2 EAP Start"}, + {18, "PKMv2 EAP-Transfer"}, + {19, "PKMv2 Authenticated EAP-Transfer"}, + {20, "PKMv2 SA TEK Challenge"}, + {21, "PKMv2 SA TEK Request"}, + {22, "PKMv2 SA TEK Response"}, + {23, "PKMv2 Key-Request"}, + {24, "PKMv2 Key-Reply"}, + {25, "PKMv2 Key-Reject"}, + {26, "PKMv2 SA-Addition"}, + {27, "PKMv2 TEK-Invalid"}, + {28, "PKMv2 Group-Key-Update-Command"}, + {29, "PKMv2 EAP Complete"}, + {30, "PKMv2 Authenticated EAP Start"}, + { 0, NULL} +}; + +/* fix fields */ +static gint hf_pkm_req_message_type = -1; +static gint hf_pkm_rsp_message_type = -1; +static gint hf_pkm_msg_code = -1; +static gint hf_pkm_msg_pkm_id = -1; + +/* PKM display */ +static hf_register_info hf_pkm[] = +{ + { + &hf_pkm_msg_code, + {"Code", "wimax.pkm.msg_code",FT_UINT8, BASE_DEC, VALS(vals_pkm_msg_code),0x0, "", HFILL} + }, + { + &hf_pkm_msg_pkm_id, + {"PKM Identifier", "wimax.pkm.msg_pkm_identifier",FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_pkm_req_message_type, + {"MAC Management Message Type", "wimax.macmgtmsgtype.pkm_req", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_pkm_rsp_message_type, + {"MAC Management Message Type", "wimax.macmgtmsgtype.pkm_rsp", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + } +}; + +/* Register Wimax Mac PKM-REQ/RSP Messages Dissectors */ +void proto_register_mac_mgmt_msg_pkm(void) +{ + if (proto_mac_mgmt_msg_pkm_decoder == -1) + { + proto_mac_mgmt_msg_pkm_decoder = proto_register_protocol ( + "WiMax PKM-REQ/RSP Messages", /* name */ + "WiMax PKM-REQ/RSP (pkm)", /* short name */ + "pkm" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_pkm_decoder, hf_pkm, array_length(hf_pkm)); + proto_register_subtree_array(ett_pkm, array_length(ett_pkm)); + } +} + +/* Wimax Mac PKM-REQ Message Dissector */ +void dissect_mac_mgmt_msg_pkm_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, length; + proto_item *pkm_item = NULL; + proto_tree *pkm_tree = NULL; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_PKM_REQ) + { + return; + } + + if(tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type PKM-REQ */ + pkm_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_pkm_decoder, tvb, offset, tvb_len, "Privacy Key Management Request (PKM-REQ) (%u bytes)", tvb_len); + /* add MAC PKM subtree */ + pkm_tree = proto_item_add_subtree(pkm_item, ett_mac_mgmt_msg_pkm_req_decoder); + /* Decode and display the Privacy Key Management Request Message (PKM-REQ) (table 24) */ + /* display the Message Type */ + proto_tree_add_item(pkm_tree, hf_pkm_req_message_type, tvb, offset, 1, FALSE); + /* set the offset for the PKM Code */ + offset++; + /* display the PKM Code */ + proto_tree_add_item(pkm_tree, hf_pkm_msg_code, tvb, offset, 1, FALSE); + /* set the offset for the PKM ID */ + offset++; + /* display the PKM ID */ + proto_tree_add_item(pkm_tree, hf_pkm_msg_pkm_id, tvb, offset, 1, FALSE); + /* set the offset for the TLV Encoded info */ + offset++; + /* process the PKM TLV Encoded Attributes */ + length = tvb_len - offset; + wimax_pkm_tlv_encoded_attributes_decoder(tvb_new_subset(tvb, offset, length, length), pinfo, pkm_tree); + } +} + +/* Wimax Mac PKM-RSP Message Dissector */ +void dissect_mac_mgmt_msg_pkm_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, length; + proto_item *pkm_item = NULL; + proto_tree *pkm_tree = NULL; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_PKM_RSP) + { + return; + } + + if(tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type PKM-RSP */ + pkm_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_pkm_decoder, tvb, offset, tvb_len, "Privacy Key Management Response (PKM-RSP) (%u bytes)", tvb_len); + /* add MAC PKM subtree */ + pkm_tree = proto_item_add_subtree(pkm_item, ett_mac_mgmt_msg_pkm_rsp_decoder); + /* Decode and display the Privacy Key Management Response (PKM-RSP) (table 25) */ + /* display the Message Type */ + proto_tree_add_item(pkm_tree, hf_pkm_rsp_message_type, tvb, offset, 1, FALSE); + /* set the offset for the PKM Code */ + offset++; + /* display the PKM Code */ + proto_tree_add_item(pkm_tree, hf_pkm_msg_code, tvb, offset, 1, FALSE); + /* set the offset for the PKM ID */ + offset++; + /* display the PKM ID */ + proto_tree_add_item(pkm_tree, hf_pkm_msg_pkm_id, tvb, offset, 1, FALSE); + /* set the offset for the TLV Encoded info */ + offset++; + /* process the PKM TLV Encoded Attributes */ + length = tvb_len - offset; + wimax_pkm_tlv_encoded_attributes_decoder(tvb_new_subset(tvb, offset, length, length), pinfo, pkm_tree); + } +} diff --git a/plugins/wimax/msg_pmc.c b/plugins/wimax/msg_pmc.c new file mode 100644 index 0000000000..ffc3f8fd50 --- /dev/null +++ b/plugins/wimax/msg_pmc.c @@ -0,0 +1,294 @@ +/* msg_pmc.c + * WiMax MAC Management PMC-REQ, PMC-RSP Message decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint man_ofdma; +extern gboolean include_cor2_changes; + +/* Forward reference */ +void dissect_mac_mgmt_msg_pmc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_pmc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_pmc_req_decoder = -1; +static gint proto_mac_mgmt_msg_pmc_rsp_decoder = -1; + +static gint ett_mac_mgmt_msg_pmc_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_pmc_decoder, +}; + +/* PMC fields */ +static gint hf_pmc_req_message_type = -1; +static gint hf_pmc_rsp_message_type = -1; +static gint hf_pmc_req_pwr_control_mode_change = -1; +static gint hf_pmc_req_pwr_control_mode_change_cor2 = -1; +static gint hf_pmc_req_tx_power_level = -1; +static gint hf_pmc_req_confirmation = -1; +static gint hf_pmc_req_reserved = -1; +static gint hf_pmc_rsp_start_frame = -1; +static gint hf_pmc_rsp_power_adjust = -1; +static gint hf_pmc_rsp_offset_BS_per_MS = -1; + +/* STRING RESOURCES */ +static const value_string vals_pmc_req_pwr[] = { + {0, "Closed loop power control mode"}, + {1, "Reserved"}, + {2, "Open loop power control passive mode"}, + {3, "Open loop power control active mode"}, + {0, NULL} +}; + +static const value_string vals_pmc_req_pwr_cor2[] = { + {0, "Closed loop power control mode"}, + {1, "Open loop power control passive mode with Offset_SSperSS retention"}, + {2, "Open loop power control passive mode with Offset_SSperSS reset"}, + {3, "Open loop power control active mode"}, + {0, NULL} +}; + +static const value_string vals_pmc_req_confirmation[] = { + {0, "MS requests to change the power control mode"}, + {1, "MS confirms the receipt of PMC_RSP from BS"}, + {0, NULL} +}; + +/* PMC fields display */ +static hf_register_info hf[] = +{ + { + &hf_pmc_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.pmc_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_pmc_req_confirmation, + { + "Confirmation", "wimax.pmc_req.confirmation", + FT_UINT16, BASE_DEC, VALS(vals_pmc_req_confirmation), 0x0020, "", HFILL + } + }, + { + &hf_pmc_req_pwr_control_mode_change, + { + "Power control mode change", "wimax.pmc_req.power_control_mode", + FT_UINT16, BASE_DEC, VALS(vals_pmc_req_pwr), 0xC000, "", HFILL + } + }, + { + &hf_pmc_req_pwr_control_mode_change_cor2, + { + "Power control mode change", "wimax.pmc_req.power_control_mode", + FT_UINT16, BASE_DEC, VALS(vals_pmc_req_pwr_cor2), 0xC000, "", HFILL + } + }, + { + &hf_pmc_req_reserved, + { + "Reserved", "wimax.pmc_req.reserved", + FT_UINT16, BASE_DEC, NULL, 0x001F, "", HFILL + } + }, + { + &hf_pmc_req_tx_power_level, + { + "UL Tx power level for the burst that carries this header (11.1.1). When the Tx power is different from slot to slot, the maximum value is reported", "wimax.pmc_req.ul_tx_power_level", + FT_UINT16, BASE_DEC, NULL, 0x3FC0, "", HFILL + } + }, + { + &hf_pmc_rsp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.pmc_rsp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_pmc_rsp_offset_BS_per_MS, + { + "Offset_BS per MS. Signed change in power level (incr of 0.25 dB) that the MS shall apply to the open loop power control formula in 8.4.10.3.2", "wimax.pmc_rsp.offset_BS_per_MS", + FT_FLOAT, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_pmc_rsp_power_adjust, + { + "Power adjust. Signed change in power level (incr of 0.25 dB) the MS shall apply to its current transmission power. When subchannelization is employed, the SS shall interpret as a required change to the Tx power density", "wimax.pmc_rsp.power_adjust", + FT_FLOAT, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_pmc_rsp_start_frame, + { + "Start frame. Apply mode change from current frame when 6 LSBs of frame match this", "wimax.pmc_rsp.start_frame", + FT_UINT16, BASE_HEX, NULL, 0x3F00, "", HFILL + } + } +}; + + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_pmc_req(void) +{ + if (proto_mac_mgmt_msg_pmc_req_decoder == -1) { + proto_mac_mgmt_msg_pmc_req_decoder = proto_register_protocol ( + "WiMax PMC-REQ/RSP Messages", /* name */ + "WiMax PMC-REQ/RSP (pmc)", /* short name */ + "pmc" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_pmc_req_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_pmc_rsp(void) +{ + if (proto_mac_mgmt_msg_pmc_rsp_decoder == -1) { + proto_mac_mgmt_msg_pmc_rsp_decoder = proto_mac_mgmt_msg_pmc_req_decoder; + + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode PMC-REQ messages. */ +void dissect_mac_mgmt_msg_pmc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *pmc_req_item = NULL; + proto_tree *pmc_req_tree = NULL; + + UNREFERENCED_PARAMETER(pinfo); + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_PMC_REQ) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type PMC-REQ */ + pmc_req_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_pmc_req_decoder, tvb, 0, tvb_len, "MAC Management Message, PMC-REQ (63)"); + /* add MAC PMC REQ subtree */ + pmc_req_tree = proto_item_add_subtree(pmc_req_item, ett_mac_mgmt_msg_pmc_decoder); + /* display the Message Type */ + proto_tree_add_item(pmc_req_tree, hf_pmc_req_message_type, tvb, offset, 1, FALSE); + offset++; + /* display the Power Control Mode Change */ + proto_tree_add_item(pmc_req_tree, hf_pmc_req_pwr_control_mode_change, tvb, offset, 2, FALSE); + /* show the Transmit Power Level */ + proto_tree_add_item(pmc_req_tree, hf_pmc_req_tx_power_level, tvb, offset, 2, FALSE); + /* display the Confirmation/request */ + proto_tree_add_item(pmc_req_tree, hf_pmc_req_confirmation, tvb, offset, 2, FALSE); + /* show the Reserved bits */ + proto_tree_add_item(pmc_req_tree, hf_pmc_req_reserved, tvb, offset, 2, FALSE); + } +} + +/* Decode PMC-RSP messages. */ +void dissect_mac_mgmt_msg_pmc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *pmc_rsp_item = NULL; + proto_tree *pmc_rsp_tree = NULL; + guint8 pwr_control_mode; + gint8 value; + gfloat power_change; + + UNREFERENCED_PARAMETER(pinfo); + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_PMC_RSP) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type PMC-RSP */ + pmc_rsp_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_pmc_rsp_decoder, tvb, 0, tvb_len, "MAC Management Message, PMC-RSP (64)"); + /* add MAC PMC RSP subtree */ + pmc_rsp_tree = proto_item_add_subtree(pmc_rsp_item, ett_mac_mgmt_msg_pmc_decoder); + /* display the Message Type */ + proto_tree_add_item(pmc_rsp_tree, hf_pmc_rsp_message_type, tvb, offset, 1, FALSE); + offset ++; + + /* display the Power Control Mode Change */ + if (include_cor2_changes) + proto_tree_add_item(pmc_rsp_tree, hf_pmc_req_pwr_control_mode_change_cor2, tvb, offset, 2, FALSE); + else + proto_tree_add_item(pmc_rsp_tree, hf_pmc_req_pwr_control_mode_change, tvb, offset, 2, FALSE); + /* display the Power Adjust start frame */ + proto_tree_add_item(pmc_rsp_tree, hf_pmc_rsp_start_frame, tvb, offset, 2, FALSE); + pwr_control_mode = 0xC0 & tvb_get_guint8(tvb, offset); + offset++; + + value = (gint8)tvb_get_guint8(tvb, offset); + power_change = (float)0.25 * value; /* 0.25dB incr */ + /* Check if Power Control Mode is 0 */ + if (pwr_control_mode == 0) { + /* display the amount of power change requested */ + proto_tree_add_float_format_value(pmc_rsp_tree, hf_pmc_rsp_power_adjust, tvb, offset, 1, power_change, " %.2f dB", power_change); + } else { + /* display the amount of MS power change requested */ + proto_tree_add_float_format_value(pmc_rsp_tree, hf_pmc_rsp_offset_BS_per_MS, tvb, offset, 1, power_change, " %.2f dB", power_change); + } + } +} + diff --git a/plugins/wimax/msg_prc_lt_ctrl.c b/plugins/wimax/msg_prc_lt_ctrl.c new file mode 100644 index 0000000000..b16e537951 --- /dev/null +++ b/plugins/wimax/msg_prc_lt_ctrl.c @@ -0,0 +1,160 @@ +/* msg_prc_lt_ctrl.c + * WiMax MAC Management PRC-LT-CTRL Message decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" +#include "wimax_mac.h" + +extern gint man_ofdma; + +/* Forward reference */ +void dissect_mac_mgmt_msg_prc_lt_ctrl_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_prc_lt_ctrl_decoder = -1; + +static gint ett_mac_mgmt_msg_prc_lt_ctrl_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_prc_lt_ctrl_decoder, +}; + +/* PRC-LT-CTRL fields */ +static gint hf_prc_lt_ctrl_message_type = -1; +static gint hf_prc_lt_ctrl_precoding = -1; +static gint hf_prc_lt_ctrl_precoding_delay = -1; +static gint hf_prc_lt_ctrl_invalid_tlv = -1; + +static const value_string vals_turn_on[] = { + {0, "Turn off"}, + {1, "Turn on"}, + {0, NULL} +}; + +/* PRC-LT-CTRL fields display */ +static hf_register_info hf[] = +{ + { + &hf_prc_lt_ctrl_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.prc_lt_ctrl", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_prc_lt_ctrl_invalid_tlv, + { + "Invalid TLV", "wimax.prc_lt_ctrl.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_prc_lt_ctrl_precoding, + { + "Setup/Tear-down long-term precoding with feedback", + "wimax.prc_lt_ctrl.precoding", + FT_UINT8, BASE_DEC, VALS(&vals_turn_on), 0x80, "", HFILL + } + }, + { + &hf_prc_lt_ctrl_precoding_delay, + { + "BS precoding application delay", + "wimax.prc_lt_ctrl.precoding_delay", + FT_UINT8, BASE_DEC, NULL, 0x60, "", HFILL + } + } +}; + + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_prc_lt_ctrl(void) +{ + if (proto_mac_mgmt_msg_prc_lt_ctrl_decoder == -1) { + proto_mac_mgmt_msg_prc_lt_ctrl_decoder = proto_register_protocol ( + "WiMax PRC-LT-CTRL Message", /* name */ + "WiMax PRC-LT-CTRL (prc)", /* short name */ + "prc" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_prc_lt_ctrl_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode PRC-LT-CTRL messages. */ +void dissect_mac_mgmt_msg_prc_lt_ctrl_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + proto_item *prc_lt_ctrl_item = NULL; + proto_tree *prc_lt_ctrl_tree = NULL; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, 0); + if(payload_type != MAC_MGMT_MSG_PRC_LT_CTRL) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type PRC-LT-CTRL */ + prc_lt_ctrl_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_prc_lt_ctrl_decoder, tvb, 0, tvb_len, "MAC Management Message, PRC-LT-CTRL (65)"); + + /* add MAC PRC-LT-CTRL subtree */ + prc_lt_ctrl_tree = proto_item_add_subtree(prc_lt_ctrl_item, ett_mac_mgmt_msg_prc_lt_ctrl_decoder); + + /* display the Message Type */ + proto_tree_add_item(prc_lt_ctrl_tree, hf_prc_lt_ctrl_message_type, tvb, offset, 1, FALSE); + offset ++; + + /* display whether to Setup or Tear-down the + * long-term MIMO precoding delay */ + proto_tree_add_item(prc_lt_ctrl_tree, hf_prc_lt_ctrl_precoding, tvb, offset, 1, FALSE); + + /* display the Precoding Delay */ + proto_tree_add_item(prc_lt_ctrl_tree, hf_prc_lt_ctrl_precoding_delay, tvb, offset, 1, FALSE); + } +} + diff --git a/plugins/wimax/msg_reg_req.c b/plugins/wimax/msg_reg_req.c new file mode 100644 index 0000000000..0f5dfd9f13 --- /dev/null +++ b/plugins/wimax/msg_reg_req.c @@ -0,0 +1,1375 @@ +/* msg_reg_req.c + * WiMax MAC Management REG-REQ Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define WIMAX_16E_2005 + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint proto_wimax; +extern gboolean include_cor2_changes; + +/* Forward reference */ +void dissect_mac_mgmt_msg_reg_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + + +gint proto_mac_mgmt_msg_reg_req_decoder = -1; +static gint ett_mac_mgmt_msg_reg_req_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_reg_req_decoder +}; + +/* REG-REQ fields */ +static gint hf_reg_ss_mgmt_support = -1; +static gint hf_reg_ip_mgmt_mode = -1; +static gint hf_reg_ip_version = -1; +static gint hf_reg_req_secondary_mgmt_cid = -1; +static gint hf_reg_ul_cids = -1; +static gint hf_reg_max_classifiers = -1; +static gint hf_reg_phs = -1; +static gint hf_reg_arq = -1; +static gint hf_reg_dsx_flow_control = -1; +static gint hf_reg_mac_crc_support = -1; +static gint hf_reg_mca_flow_control = -1; +static gint hf_reg_mcast_polling_cids = -1; +static gint hf_reg_num_dl_trans_cid = -1; +static gint hf_reg_mac_address = -1; +static gint hf_reg_tlv_t_20_1_max_mac_level_data_per_dl_frame = -1; +static gint hf_reg_tlv_t_20_2_max_mac_level_data_per_ul_frame = -1; +static gint hf_reg_tlv_t_21_packing_support = -1; +static gint hf_reg_tlv_t_22_mac_extended_rtps_support = -1; +static gint hf_reg_tlv_t_23_max_num_bursts_concurrently_to_the_ms = -1; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcp = -1; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_mobile_ipv4 = -1; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcpv6 = -1; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_ipv6 = -1; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_rsvd = -1; +static gint hf_reg_tlv_t_27_handover_fbss_mdho_ho_disable = -1; +static gint hf_reg_tlv_t_27_handover_fbss_mdho_dl_rf_monitoring_maps = -1; +static gint hf_reg_tlv_t_27_handover_mdho_dl_monitoring_single_map = -1; +static gint hf_reg_tlv_t_27_handover_mdho_dl_monitoring_maps = -1; +static gint hf_reg_tlv_t_27_handover_mdho_ul_multiple = -1; +static gint hf_reg_tlv_t_27_handover_reserved = -1; +static gint hf_reg_tlv_t_29_ho_process_opt_ms_timer = -1; +static gint hf_reg_tlv_t_31_mobility_handover = -1; +static gint hf_reg_tlv_t_31_mobility_sleep_mode = -1; +static gint hf_reg_tlv_t_31_mobility_idle_mode = -1; +static gint hf_reg_req_tlv_t_32_sleep_mode_recovery_time = -1; +static gint hf_ms_previous_ip_address_v4 = -1; +static gint hf_ms_previous_ip_address_v6 = -1; +static gint hf_idle_mode_timeout = -1; +static gint hf_reg_req_tlv_t_45_ms_periodic_ranging_timer = -1; +static gint hf_reg_tlv_t_40_arq_ack_type_selective_ack_entry = -1; +static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_entry = -1; +static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_with_selective_ack_entry = -1; +static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_with_block_sequence_ack = -1; +static gint hf_reg_tlv_t_40_arq_ack_type_reserved = -1; +static gint hf_reg_tlv_t_41_ho_connections_param_processing_time = -1; +static gint hf_reg_tlv_t_42_ho_tek_processing_time = -1; +static gint hf_reg_tlv_t_43_bandwidth_request_ul_tx_power_report_header_support = -1; +static gint hf_reg_tlv_t_43_bandwidth_request_cinr_report_header_support = -1; +static gint hf_reg_tlv_t_43_cqich_allocation_request_header_support = -1; +static gint hf_reg_tlv_t_43_phy_channel_report_header_support = -1; +static gint hf_reg_tlv_t_43_bandwidth_request_ul_sleep_control_header_support = -1; +static gint hf_reg_tlv_t_43_sn_report_header_support = -1; +static gint hf_reg_tlv_t_43_feedback_header_support = -1; +static gint hf_reg_tlv_t_43_sdu_sn_extended_subheader_support_and_parameter = -1; +static gint hf_reg_tlv_t_43_sdu_sn_parameter = -1; +static gint hf_reg_tlv_t_43_dl_sleep_control_extended_subheader = -1; +static gint hf_reg_tlv_t_43_feedback_request_extended_subheader = -1; +static gint hf_reg_tlv_t_43_mimo_mode_feedback_extended_subheader = -1; +static gint hf_reg_tlv_t_43_ul_tx_power_report_extended_subheader = -1; +static gint hf_reg_tlv_t_43_mini_feedback_extended_subheader = -1; +static gint hf_reg_tlv_t_43_sn_request_extended_subheader = -1; +static gint hf_reg_tlv_t_43_pdu_sn_short_extended_subheader = -1; +static gint hf_reg_tlv_t_43_pdu_sn_long_extended_subheader = -1; +static gint hf_reg_tlv_t_43_reserved = -1; +static gint hf_reg_tlv_t_46_handover_indication_readiness_timer = -1; +static gint hf_reg_req_min_time_for_intra_fa = -1; +static gint hf_reg_req_min_time_for_inter_fa = -1; +static gint hf_reg_encap_atm_4 = -1; +static gint hf_reg_encap_ipv4_4 = -1; +static gint hf_reg_encap_ipv6_4 = -1; +static gint hf_reg_encap_802_3_4 = -1; +static gint hf_reg_encap_802_1q_4 = -1; +static gint hf_reg_encap_ipv4_802_3_4 = -1; +static gint hf_reg_encap_ipv6_802_3_4 = -1; +static gint hf_reg_encap_ipv4_802_1q_4 = -1; +static gint hf_reg_encap_ipv6_802_1q_4 = -1; +static gint hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_4 = -1; +static gint hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_4 = -1; +static gint hf_reg_encap_packet_ip_rohc_header_compression_4 = -1; +static gint hf_reg_encap_packet_ip_ecrtp_header_compression_4 = -1; +static gint hf_reg_encap_rsvd_4 = -1; +static gint hf_reg_encap_atm_2 = -1; +static gint hf_reg_encap_ipv4_2 = -1; +static gint hf_reg_encap_ipv6_2 = -1; +static gint hf_reg_encap_802_3_2 = -1; +static gint hf_reg_encap_802_1q_2 = -1; +static gint hf_reg_encap_ipv4_802_3_2 = -1; +static gint hf_reg_encap_ipv6_802_3_2 = -1; +static gint hf_reg_encap_ipv4_802_1q_2 = -1; +static gint hf_reg_encap_ipv6_802_1q_2 = -1; +static gint hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_2 = -1; +static gint hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_2 = -1; +static gint hf_reg_encap_packet_ip_rohc_header_compression_2 = -1; +static gint hf_reg_encap_packet_ip_ecrtp_header_compression_2 = -1; +static gint hf_reg_encap_rsvd_2 = -1; +static gint hf_tlv_type = -1; +static gint hf_reg_invalid_tlv = -1; + +static gint hf_reg_req_message_type = -1; + +/* STRING RESOURCES */ + +static const true_false_string tfs_reg_ip_mgmt_mode = { + "IP-managed mode", + "Unmanaged mode" +}; + +static const true_false_string tfs_reg_ss_mgmt_support = { + "secondary management connection", + "no secondary management connection" +}; + +static const true_false_string tfs_arq_enable = { + "ARQ Requested/Accepted", + "ARQ Not Requested/Accepted" +}; + +static const true_false_string tfs_arq_deliver_in_order = { + "Order of delivery is preserved", + "Order of delivery is not preserved" +}; + +static const true_false_string tfs_reg_fbss_mdho_ho_disable = { + "Disable", + "Enable" +}; + +static const value_string vals_reg_ip_version[] = { + {0x1, "IPv4"}, + {0x2, "IPV6"}, + {0, NULL} +}; + +static const value_string vals_reg_phs_support[] = { + {0, "no PHS support"}, + {1, "ATM PHS"}, + {2, "Packet PHS"}, + {3, "ATM and Packet PHS"}, + {0, NULL} +}; + +static const true_false_string tfs_supported = { + "supported", + "unsupported" +}; + +static const true_false_string tfs_mac_crc_support = { + "MAC CRC Support (Default)", + "No MAC CRC Support" +}; + +static const value_string tfs_support[] = { + {0, "not supported"}, + {1, "supported"}, + {0, NULL} +}; + +/* REG-REQ fields display */ +static hf_register_info hf[] = +{ + { + &hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcp, + { + "DHCP", "wimax.reg.alloc_sec_mgmt_dhcp", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x01, "", HFILL + } + }, + { + &hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcpv6, + { + "DHCPv6", "wimax.reg.alloc_sec_mgmt_dhcpv6", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x04, "", HFILL + } + }, + { + &hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_ipv6, + { + "IPv6 Stateless Address Autoconfiguration", "wimax.reg.alloc_sec_mgmt_ipv6", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x08, "", HFILL + } + }, + { + &hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_mobile_ipv4, + { + "Mobile IPv4", "wimax.reg.alloc_sec_mgmt_mobile_ipv4", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x02, "", HFILL + } + }, + { + &hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_rsvd, + { + "Reserved", "wimax.reg.alloc_sec_mgmt_rsvd", + FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL + } + }, + { + &hf_reg_arq, + { + "ARQ support", "wimax.reg.arq", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_entry, + { + "Cumulative ACK entry", "wimax.reg.arq_ack_type_cumulative_ack_entry", + FT_UINT8, BASE_DEC, NULL, 0x2, "", HFILL + } + }, + { + &hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_with_block_sequence_ack, + { + "Cumulative ACK with Block Sequence ACK", "wimax.reg.arq_ack_type_cumulative_ack_with_block_sequence_ack", + FT_UINT8, BASE_DEC, NULL, 0x8, "", HFILL + } + }, + { + &hf_reg_tlv_t_40_arq_ack_type_cumulative_with_selective_ack_entry, + { + "Cumulative with Selective ACK entry", "wimax.reg.arq_ack_type_cumulative_with_selective_ack_entry", + FT_UINT8, BASE_DEC, NULL, 0x4, "", HFILL + } + }, + { + &hf_reg_tlv_t_40_arq_ack_type_reserved, + { + "Reserved", "wimax.reg.arq_ack_type_reserved", + FT_UINT8, BASE_DEC, NULL, 0xf0, "", HFILL + } + }, + { + &hf_reg_tlv_t_40_arq_ack_type_selective_ack_entry, + { + "Selective ACK entry", "wimax.reg.arq_ack_type_selective_ack_entry", + FT_UINT8, BASE_DEC, NULL, 0x1, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_bandwidth_request_cinr_report_header_support, + { + "Bandwidth request and CINR report header support", "wimax.reg.bandwidth_request_cinr_report_header_support", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x2, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_bandwidth_request_ul_sleep_control_header_support, + { + "Bandwidth request and uplink sleep control header support", "wimax.reg.bandwidth_request_ul_sleep_control_header_support", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x10, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_cqich_allocation_request_header_support, + { + "CQICH Allocation Request header support", "wimax.reg.cqich_allocation_request_header_support", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x4, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_dl_sleep_control_extended_subheader, + { + "Downlink sleep control extended subheader", "wimax.reg.dl_sleep_control_extended_subheader", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x800, "", HFILL + } + }, + { + &hf_reg_dsx_flow_control, + { + "DSx flow control", "wimax.reg.dsx_flow_control", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + /* When REG-REQ TLV 7 is length 2 */ + { + &hf_reg_encap_802_1q_2, + { + "Packet, 802.1Q VLAN", "wimax.reg.encap_802_1q", + FT_UINT16, BASE_HEX, NULL, 0x0010, "", HFILL + } + }, + { + &hf_reg_encap_802_3_2, + { + "Packet, 802.3/Ethernet", "wimax.reg.encap_802_3", + FT_UINT16, BASE_HEX, NULL, 0x00000008, "", HFILL + } + }, + { + &hf_reg_encap_atm_2, + { + "ATM", "wimax.reg.encap_atm", + FT_UINT16, BASE_HEX, NULL, 0x00000001, "", HFILL + } + }, + { + &hf_reg_encap_ipv4_2, + { + "Packet, IPv4", "wimax.reg.encap_ipv4", + FT_UINT16, BASE_HEX, NULL, 0x00000002, "", HFILL + } + }, + { + &hf_reg_encap_ipv6_2, + { + "Packet, IPv6", "wimax.reg.encap_ipv6", + FT_UINT16, BASE_HEX, NULL, 0x00000004, "", HFILL + } + }, + { + &hf_reg_encap_ipv4_802_1q_2, + { + "Packet, IPv4 over 802.1Q VLAN", "wimax.reg.encap_ipv4_802_1q", + FT_UINT16, BASE_HEX, NULL, 0x00000080, "", HFILL + } + }, + { + &hf_reg_encap_ipv4_802_3_2, + { + "Packet, IPv4 over 802.3/Ethernet", "wimax.reg.encap_ipv4_802_3", + FT_UINT16, BASE_HEX, NULL, 0x00000020, "", HFILL + } + }, + { + &hf_reg_encap_ipv6_802_1q_2, + { + "Packet, IPv6 over 802.1Q VLAN", "wimax.reg.encap_ipv6_802_1q", + FT_UINT16, BASE_HEX, NULL, 0x00000100, "", HFILL + } + }, + { + &hf_reg_encap_ipv6_802_3_2, + { + "Packet, IPv6 over 802.3/Ethernet", "wimax.reg.encap_ipv6_802_3", + FT_UINT16, BASE_HEX, NULL, 0x00000040, "", HFILL + } + }, + { + &hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_2, + { + "Packet, 802.3/Ethernet (with optional 802.1Q VLAN tags) and ECRTP header compression", "wimax.reg.encap_packet_802_3_ethernet_and_ecrtp_header_compression", + FT_UINT16, BASE_HEX, NULL, 0x00000400, "", HFILL + } + }, + { + &hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_2, + { + "Packet, 802.3/Ethernet (with optional 802.1Q VLAN tags) and ROHC header compression", "wimax.reg.encap_packet_802_3_ethernet_and_rohc_header_compression", + FT_UINT16, BASE_HEX, NULL, 0x00000200, "", HFILL + } + }, + { + &hf_reg_encap_packet_ip_ecrtp_header_compression_2, + { + "Packet, IP (v4 or v6) with ECRTP header compression", "wimax.reg.encap_packet_ip_ecrtp_header_compression", + FT_UINT16, BASE_HEX, NULL, 0x00001000, "", HFILL + } + }, + { + &hf_reg_encap_packet_ip_rohc_header_compression_2, + { + "Packet, IP (v4 or v6) with ROHC header compression", "wimax.reg.encap_packet_ip_rohc_header_compression", + FT_UINT16, BASE_HEX, NULL, 0x00000800, "", HFILL + } + }, + { + &hf_reg_encap_rsvd_2, + { + "Reserved", "wimax.reg.encap_rsvd", + FT_UINT16, BASE_HEX, NULL, 0x0000E000, "", HFILL + } + }, + /* When REG-REQ TLV 7 is length 4 */ + { + &hf_reg_encap_802_1q_4, + { + "Packet, 802.1Q VLAN", "wimax.reg.encap_802_1q", + FT_UINT32, BASE_HEX, NULL, 0x0010, "", HFILL + } + }, + { + &hf_reg_encap_802_3_4, + { + "Packet, 802.3/Ethernet", "wimax.reg.encap_802_3", + FT_UINT32, BASE_HEX, NULL, 0x00000008, "", HFILL + } + }, + { + &hf_reg_encap_atm_4, + { + "ATM", "wimax.reg.encap_atm", + FT_UINT32, BASE_HEX, NULL, 0x00000001, "", HFILL + } + }, + { + &hf_reg_encap_ipv4_4, + { + "Packet, IPv4", "wimax.reg.encap_ipv4", + FT_UINT32, BASE_HEX, NULL, 0x00000002, "", HFILL + } + }, + { + &hf_reg_encap_ipv4_802_1q_4, + { + "Packet, IPv4 over 802.1Q VLAN", "wimax.reg.encap_ipv4_802_1q", + FT_UINT32, BASE_HEX, NULL, 0x00000080, "", HFILL + } + }, + { + &hf_reg_encap_ipv4_802_3_4, + { + "Packet, IPv4 over 802.3/Ethernet", "wimax.reg.encap_ipv4_802_3", + FT_UINT32, BASE_HEX, NULL, 0x00000020, "", HFILL + } + }, + { + &hf_reg_encap_ipv6_4, + { + "Packet, IPv6", "wimax.reg.encap_ipv6", + FT_UINT32, BASE_HEX, NULL, 0x00000004, "", HFILL + } + }, + { + &hf_reg_encap_ipv6_802_1q_4, + { + "Packet, IPv6 over 802.1Q VLAN", "wimax.reg.encap_ipv6_802_1q", + FT_UINT32, BASE_HEX, NULL, 0x00000100, "", HFILL + } + }, + { + &hf_reg_encap_ipv6_802_3_4, + { + "Packet, IPv6 over 802.3/Ethernet", "wimax.reg.encap_ipv6_802_3", + FT_UINT32, BASE_HEX, NULL, 0x00000040, "", HFILL + } + }, + { + &hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_4, + { + "Packet, 802.3/Ethernet (with optional 802.1Q VLAN tags) and ECRTP header compression", "wimax.reg.encap_packet_802_3_ethernet_and_ecrtp_header_compression", + FT_UINT32, BASE_HEX, NULL, 0x00000400, "", HFILL + } + }, + { + &hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_4, + { + "Packet, 802.3/Ethernet (with optional 802.1Q VLAN tags) and ROHC header compression", "wimax.reg.encap_packet_802_3_ethernet_and_rohc_header_compression", + FT_UINT32, BASE_HEX, NULL, 0x00000200, "", HFILL + } + }, + { + &hf_reg_encap_packet_ip_ecrtp_header_compression_4, + { + "Packet, IP (v4 or v6) with ECRTP header compression", "wimax.reg.encap_packet_ip_ecrtp_header_compression", + FT_UINT32, BASE_HEX, NULL, 0x00001000, "", HFILL + } + }, + { + &hf_reg_encap_packet_ip_rohc_header_compression_4, + { + "Packet, IP (v4 or v6) with ROHC header compression", "wimax.reg.encap_packet_ip_rohc_header_compression", + FT_UINT32, BASE_HEX, NULL, 0x00000800, "", HFILL + } + }, + { + &hf_reg_encap_rsvd_4, + { + "Reserved", "wimax.reg.encap_rsvd", + FT_UINT32, BASE_HEX, NULL, 0xFFFFE000, "", HFILL + } + }, + { + &hf_reg_tlv_t_22_mac_extended_rtps_support, + { + "MAC extended rtPS support", "wimax.reg.ext_rtps_support", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x01, "", HFILL + } + }, + { + &hf_reg_tlv_t_27_handover_fbss_mdho_dl_rf_monitoring_maps, + { + "FBSS/MDHO DL RF Combining with monitoring MAPs from active BSs", "wimax.reg.fbss_mdho_dl_rf_combining", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x02, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_bandwidth_request_ul_tx_power_report_header_support, + { + "Bandwidth request and UL Tx Power Report header support", + "wimax.reg.bandwidth_request_ul_tx_pwr_report_header_support", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x1, "", HFILL + } + }, + { + &hf_reg_tlv_t_27_handover_fbss_mdho_ho_disable, + { + "MDHO/FBSS HO. BS ignore all other bits when set to 1", "wimax.reg.fbss_mdho_ho_disable", + FT_BOOLEAN, 8, TFS(&tfs_reg_fbss_mdho_ho_disable), 0x01, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_feedback_header_support, + { + "Feedback header support", "wimax.reg.feedback_header_support", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x40, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_feedback_request_extended_subheader, + { + "Feedback request extended subheader", "wimax.reg.feedback_request_extended_subheader", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x1000, "", HFILL + } + }, + { + &hf_reg_tlv_t_46_handover_indication_readiness_timer, + { + "Handover indication readiness timer", "wimax.reg.handover_indication_readiness_timer", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_27_handover_reserved, + { + "Reserved", "wimax.reg.handover_reserved", + FT_UINT8, BASE_DEC, NULL, 0xE0, "", HFILL + } + }, + { + &hf_reg_tlv_t_41_ho_connections_param_processing_time, + { + "MS HO connections parameters processing time", "wimax.reg.ho_connections_param_processing_time", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_29_ho_process_opt_ms_timer, + { + "HO Process Optimization MS Timer", "wimax.reg.ho_process_opt_ms_timer", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_42_ho_tek_processing_time, + { + "MS HO TEK processing time", "wimax.reg.ho_tek_processing_time", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_idle_mode_timeout, + { + "Idle Mode Timeout", "wimax.reg.idle_mode_timeout", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_ip_mgmt_mode, + { + "IP management mode", "wimax.reg.ip_mgmt_mode", + FT_BOOLEAN, 8, TFS(&tfs_reg_ip_mgmt_mode), 0x0, "", HFILL + } + }, + { + &hf_reg_ip_version, + { + "IP version", "wimax.reg.ip_version", + FT_UINT8, BASE_HEX, VALS(vals_reg_ip_version), 0x0, "", HFILL + } + }, + { + &hf_reg_mac_address, + { + "MAC Address of the SS", "wimax.reg.mac_address", + FT_ETHER, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_mac_crc_support, + { + "MAC CRC", "wimax.reg.mac_crc_support", + FT_BOOLEAN, 8, TFS(&tfs_mac_crc_support), 0x0, "", HFILL + } + }, + { + &hf_reg_max_classifiers, + { + "Maximum number of classification rules", "wimax.reg.max_classifiers", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_23_max_num_bursts_concurrently_to_the_ms, + { + "Maximum number of bursts transmitted concurrently to the MS", "wimax.reg.max_num_bursts_to_ms", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_mca_flow_control, + { + "MCA flow control", "wimax.reg.mca_flow_control", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_mcast_polling_cids, + { + "Multicast polling group CID support", "wimax.reg.mcast_polling_cids", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_27_handover_mdho_ul_multiple, + { + "MDHO UL Multiple transmission", "wimax.reg.mdh_ul_multiple", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_reg_tlv_t_27_handover_mdho_dl_monitoring_maps, + { + "MDHO DL soft combining with monitoring MAPs from active BSs", "wimax.reg.mdho_dl_monitor_maps", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x08, "", HFILL + } + }, + { + &hf_reg_tlv_t_27_handover_mdho_dl_monitoring_single_map, + { + "MDHO DL soft Combining with monitoring single MAP from anchor BS", "wimax.reg.mdho_dl_monitor_single_map", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x04, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_mimo_mode_feedback_extended_subheader, + { + "MIMO mode feedback request extended subheader", "wimax.reg.mimo_mode_feedback_request_extended_subheader", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x2000, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_mini_feedback_extended_subheader, + { + "Mini-feedback extended subheader", "wimax.reg.mini_feedback_extended_subheader", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x8000, "", HFILL + } + }, + { + &hf_reg_tlv_t_31_mobility_handover, + { + "Mobility (handover)", "wimax.reg.mobility_handover", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x01, "", HFILL + } + }, + { + &hf_reg_tlv_t_31_mobility_idle_mode, + { + "Idle mode", "wimax.reg.mobility_idle_mode", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x04, "", HFILL + } + }, + { + &hf_reg_tlv_t_31_mobility_sleep_mode, + { + "Sleep mode", "wimax.reg.mobility_sleep_mode", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x02, "", HFILL + } + }, + { + &hf_reg_num_dl_trans_cid, + { + "Number of Downlink transport CIDs the SS can support", "wimax.reg.dl_cids_supported", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_21_packing_support, + { + "Packing support", "wimax.reg.packing.support", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x01, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_pdu_sn_long_extended_subheader, + { + "PDU SN (long) extended subheader", "wimax.reg.pdu_sn_long_extended_subheader", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x40000, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_pdu_sn_short_extended_subheader, + { + "PDU SN (short) extended subheader", "wimax.reg.pdu_sn_short_extended_subheader", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x20000, "", HFILL + } + }, + { + &hf_reg_phs, + { + "PHS support", "wimax.reg.phs", + FT_UINT8, BASE_DEC, VALS(vals_reg_phs_support), 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_phy_channel_report_header_support, + { + "PHY channel report header support", "wimax.reg.phy_channel_report_header_support", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x8, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_reserved, + { + "Reserved", "wimax.reg.reserved", + FT_UINT24, BASE_DEC, NULL, 0xf80000, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_sdu_sn_extended_subheader_support_and_parameter, + { + "SDU_SN extended subheader support", "wimax.reg.sdu_sn_extended_subheader_support", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x80, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_sdu_sn_parameter, + { + "SDU_SN parameter", "wimax.reg.sdu_sn_parameter", + FT_UINT24, BASE_DEC, NULL, 0x700, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_sn_report_header_support, + { + "SN report header support", "wimax.reg.sn_report_header_support", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x20, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_sn_request_extended_subheader, + { + "SN request extended subheader", "wimax.reg.sn_request_extended_subheader", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x10000, "", HFILL + } + }, + { + &hf_reg_ss_mgmt_support, + { + "SS management support", "wimax.reg.ss_mgmt_support", + FT_BOOLEAN, 8, TFS(&tfs_reg_ss_mgmt_support), 0x0, "", HFILL + } + }, + { + &hf_reg_ul_cids, + { + "Number of Uplink transport CIDs the SS can support", "wimax.reg.ul_cids_supported", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_43_ul_tx_power_report_extended_subheader, + { + "UL Tx power report extended subheader", "wimax.reg.ul_tx_power_report_extended_subheader", + FT_UINT24, BASE_DEC, VALS(tfs_support), 0x4000, "", HFILL + } + }, + { + &hf_tlv_type, + { + "Unknown TLV Type", "wimax.reg.unknown_tlv_type", + FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL + } + }, + { + &hf_reg_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.reg_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_invalid_tlv, + { + "Invalid TLV", "wimax.reg_req.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_reg_tlv_t_20_1_max_mac_level_data_per_dl_frame, + { + "Maximum MAC level DL data per frame", "wimax.reg_req.max_mac_dl_data", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_tlv_t_20_2_max_mac_level_data_per_ul_frame, + { + "Maximum MAC level UL data per frame", "wimax.reg_req.max_mac_ul_data", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_req_min_time_for_inter_fa, + { + "Minimum time for inter-FA HO, default=3", "wimax.reg_req.min_time_for_inter_fa", + FT_UINT8, BASE_HEX, NULL, 0xF0, "", HFILL + } + }, + { + &hf_reg_req_min_time_for_intra_fa, + { + "Minimum time for intra-FA HO, default=2", "wimax.reg_req.min_time_for_intra_fa", + FT_UINT8, BASE_HEX, NULL, 0x0F, "", HFILL + } + }, + { + &hf_reg_req_tlv_t_45_ms_periodic_ranging_timer, + { + "MS periodic ranging timer information", "wimax.reg_req.ms_periodic_ranging_timer_info", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { /* IPv4 Mask */ + &hf_ms_previous_ip_address_v4, + { + "MS Previous IP address", "wimax.reg_req.ms_prev_ip_addr_v4", + FT_IPv4, BASE_NONE, NULL, 0x0, "", HFILL + } + }, + { /* IPv6 Source Address */ + &hf_ms_previous_ip_address_v6, + { + "MS Previous IP address", "wimax.reg_req.ms_prev_ip_addr_v6", + FT_IPv6, BASE_NONE, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_req_secondary_mgmt_cid, + { + "Secondary Management CID", "wimax.reg_req.secondary_mgmt_cid", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_req_tlv_t_32_sleep_mode_recovery_time, + { + "Frames required for the MS to switch from sleep to awake-mode", "wimax.reg_req.sleep_recovery", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + } +}; + +/* Decode REG-REQ sub-TLV's. */ +void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb, guint tlv_offset, guint tlv_len, packet_info *pinfo, guint offset, gint proto_registry) +{ + proto_item *tlv_item = NULL; + proto_tree *tlv_tree = NULL; + proto_tree *sub_tree = NULL; + guint tvb_len; + tlv_info_t tlv_info; + guint tlv_end; + guint length; + guint nblocks; + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + +#ifdef WIMAX_16E_2005 + switch (tlv_type) { + case REG_ARQ_PARAMETERS: + /* display ARQ Service Flow Encodings info */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "ARQ Service Flow Encodings (%u byte(s))", tlv_len); + /* decode and display the DL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case REG_SS_MGMT_SUPPORT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_ss_mgmt_support, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_ss_mgmt_support, tvb, tlv_offset, 1, FALSE); + break; + case REG_IP_MGMT_MODE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_ip_mgmt_mode, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_ip_mgmt_mode, tvb, tlv_offset, 1, FALSE); + break; + case REG_IP_VERSION: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_ip_version, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_ip_version, tvb, tlv_offset, 1, FALSE); + break; + case REG_UL_TRANSPORT_CIDS_SUPPORTED: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_ul_cids, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_ul_cids, tvb, tlv_offset, tlv_len, FALSE); + break; + case REG_IP_PHS_SDU_ENCAP: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "Classification/PHS options and SDU encapsulation support 0x%04x", tvb_get_ntohs(tvb, tlv_offset)); + +#ifdef WIMAX_16E_2005 + if (tlv_len == 2){ + proto_tree_add_item(tlv_tree, hf_reg_encap_atm_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv4_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv6_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_802_3_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_802_1q_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv4_802_3_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv6_802_3_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv4_802_1q_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv6_802_1q_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_packet_ip_rohc_header_compression_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_packet_ip_ecrtp_header_compression_2, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_rsvd_2, tvb, tlv_offset, tlv_len, FALSE); + } else if(tlv_len == 4){ + proto_tree_add_item(tlv_tree, hf_reg_encap_atm_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv4_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv6_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_802_3_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_802_1q_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv4_802_3_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv6_802_3_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv4_802_1q_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_ipv6_802_1q_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_packet_ip_rohc_header_compression_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_packet_ip_ecrtp_header_compression_4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_encap_rsvd_4, tvb, tlv_offset, tlv_len, FALSE); + } +#endif + break; + case REG_MAX_CLASSIFIERS_SUPPORTED: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_max_classifiers, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_max_classifiers, tvb, tlv_offset, 2, FALSE); + break; + case REG_PHS_SUPPORT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_phs, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_phs, tvb, tlv_offset, 1, FALSE); + break; + case REG_ARQ_SUPPORT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_arq, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_arq, tvb, tlv_offset, 1, FALSE); + break; + case REG_DSX_FLOW_CONTROL: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_dsx_flow_control, tvb, tlv_offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_reg_dsx_flow_control, tvb, tlv_offset, 1, FALSE); + if (tvb_get_guint8(tvb, tlv_offset) == 0) { + proto_item_append_text(tlv_item, " (no limit)"); + } + break; + case REG_MAC_CRC_SUPPORT: + if (!include_cor2_changes) { + proto_tree_add_item(reg_req_tree, hf_reg_mac_crc_support, tvb, tlv_offset, 1, FALSE); + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_mac_crc_support, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_mac_crc_support, tvb, tlv_offset, 1, FALSE); + } else { + /* Unknown TLV Type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, (tvb_len - tlv_offset), FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, (tvb_len - tlv_offset), FALSE); + } + break; + case REG_MCA_FLOW_CONTROL: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_mca_flow_control, tvb, tlv_offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_reg_mca_flow_control, tvb, tlv_offset, 1, FALSE); + if (tvb_get_guint8(tvb, tlv_offset) == 0) { + proto_item_append_text(tlv_item, " (no limit)"); + } + break; + case REG_MCAST_POLLING_CIDS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_mcast_polling_cids, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_mcast_polling_cids, tvb, tlv_offset, 1, FALSE); + break; + case REG_NUM_DL_TRANS_CID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_num_dl_trans_cid, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_num_dl_trans_cid, tvb, tlv_offset, 2, FALSE); + break; + case REG_MAC_ADDRESS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_mac_address, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_mac_address, tvb, tlv_offset, 6, FALSE); + break; + case REG_TLV_T_20_MAX_MAC_DATA_PER_FRAME_SUPPORT: + /* display Maximum MAC level data per frame info */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "Maximum MAC level data per frame (%u byte(s))", tlv_len); + /* decode and display Maximum MAC level data per frame for UL & DL */ + /* Set endpoint of the subTLVs (tlv_offset + length) */ + tlv_end = tlv_offset + tlv_len; + /* process subTLVs */ + while ( tlv_offset < tlv_end ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, tlv_offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REG-REQ TLV error"); + } + proto_tree_add_item(reg_req_tree, hf_reg_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + nblocks = tvb_get_ntohs(tvb, tlv_offset); + switch (tlv_type) + { + case REG_TLV_T_20_1_MAX_MAC_LEVEL_DATA_PER_DL_FRAME: + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, tlv_tree, hf_reg_tlv_t_20_1_max_mac_level_data_per_dl_frame, tvb, tlv_offset, length, FALSE); + tlv_item = proto_tree_add_item(sub_tree, hf_reg_tlv_t_20_1_max_mac_level_data_per_dl_frame, tvb, tlv_offset, 2, FALSE); + if ( nblocks == 0 ) + { + proto_item_append_text(tlv_item, " (Unlimited bytes)"); + } else { + proto_item_append_text(tlv_item, " (%d bytes)", 256 * nblocks); + } + break; + case REG_TLV_T_20_2_MAX_MAC_LEVEL_DATA_PER_UL_FRAME: + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, tlv_tree, hf_reg_tlv_t_20_2_max_mac_level_data_per_ul_frame, tvb, tlv_offset, length, FALSE); + tlv_item = proto_tree_add_item(sub_tree, hf_reg_tlv_t_20_2_max_mac_level_data_per_ul_frame, tvb, tlv_offset, 2, FALSE); + if ( nblocks == 0 ) + { + proto_item_append_text(tlv_item, " (Unlimited bytes)"); + } else { + proto_item_append_text(tlv_item, " (%d bytes)", 256 * nblocks); + } + break; + default: + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, tlv_tree, hf_reg_invalid_tlv, tvb, tlv_offset, (tlv_end - tlv_offset), FALSE); + proto_tree_add_item(sub_tree, hf_reg_invalid_tlv, tvb, tlv_offset, (tlv_end - tlv_offset), FALSE); + break; + } + tlv_offset += length; + } + break; + + case REG_TLV_T_21_PACKING_SUPPORT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_tlv_t_21_packing_support, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_21_packing_support, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_22_MAC_EXTENDED_RTPS_SUPPORT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_tlv_t_22_mac_extended_rtps_support, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_22_mac_extended_rtps_support, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_23_MAX_NUM_BURSTS_TRANSMITTED_CONCURRENTLY_TO_THE_MS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_tlv_t_23_max_num_bursts_concurrently_to_the_ms, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_23_max_num_bursts_concurrently_to_the_ms, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_26_METHOD_FOR_ALLOCATING_IP_ADDR_SECONDARY_MGMNT_CONNECTION: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "Method for allocating IP address for the secondary management connection (%d)", tvb_get_guint8(tvb, tlv_offset)); + proto_tree_add_item(tlv_tree, hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcp, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_mobile_ipv4, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcpv6, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_ipv6, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_rsvd, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_27_HANDOVER_SUPPORTED: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "Handover Support (%d)", tvb_get_guint8(tvb, tlv_offset)); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_27_handover_fbss_mdho_ho_disable, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_27_handover_fbss_mdho_dl_rf_monitoring_maps, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_27_handover_mdho_dl_monitoring_single_map, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_27_handover_mdho_dl_monitoring_maps, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_27_handover_mdho_ul_multiple, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_27_handover_reserved, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_29_HO_PROCESS_OPTIMIZATION_MS_TIMER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_tlv_t_29_ho_process_opt_ms_timer, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_29_ho_process_opt_ms_timer, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_31_MOBILITY_FEATURES_SUPPORTED: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "Mobility Features Supported (%d)", tvb_get_guint8(tvb, tlv_offset)); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_31_mobility_handover, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_31_mobility_sleep_mode, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_31_mobility_idle_mode, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_40_ARQ_ACK_TYPE: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "ARQ ACK Type 0x%02x", tvb_get_guint8(tvb, tlv_offset)); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_40_arq_ack_type_selective_ack_entry, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_entry, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_40_arq_ack_type_cumulative_with_selective_ack_entry, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_with_block_sequence_ack, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_40_arq_ack_type_reserved, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_41_MS_HO_CONNECTIONS_PARAM_PROCESSING_TIME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_tlv_t_41_ho_connections_param_processing_time, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_41_ho_connections_param_processing_time, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_42_MS_HO_TEK_PROCESSING_TIME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_tlv_t_42_ho_tek_processing_time, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_42_ho_tek_processing_time, tvb, tlv_offset, 1, FALSE); + break; + case REG_TLV_T_43_MAC_HEADER_AND_EXTENDED_SUBHEADER_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "MAC header and extended subheader support %d", tvb_get_ntoh24(tvb, tlv_offset)); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_bandwidth_request_ul_tx_power_report_header_support, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_bandwidth_request_cinr_report_header_support, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_cqich_allocation_request_header_support, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_phy_channel_report_header_support, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_bandwidth_request_ul_sleep_control_header_support, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_sn_report_header_support, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_feedback_header_support, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_sdu_sn_extended_subheader_support_and_parameter, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_sdu_sn_parameter, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_dl_sleep_control_extended_subheader, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_feedback_request_extended_subheader, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_mimo_mode_feedback_extended_subheader, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_ul_tx_power_report_extended_subheader, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_mini_feedback_extended_subheader, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_sn_request_extended_subheader, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_pdu_sn_short_extended_subheader, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_pdu_sn_long_extended_subheader, tvb, tlv_offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_43_reserved, tvb, tlv_offset, 3, FALSE); + break; + case REG_REQ_BS_SWITCHING_TIMER: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, tlv_len, "BS switching timer (%d)", tvb_get_guint8(tvb, tlv_offset)); + proto_tree_add_item(tlv_tree, hf_reg_req_min_time_for_intra_fa, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_req_min_time_for_inter_fa, tvb, tlv_offset, 1, FALSE); + break; + case VENDOR_SPECIFIC_INFO: + case VENDOR_ID_ENCODING: + case CURRENT_TX_POWER: + case MAC_VERSION_ENCODING: + case CMAC_TUPLE: /* Table 348b */ + wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, reg_req_tree); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_registry, tvb, tlv_offset, (tvb_len - tlv_offset), FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, (tvb_len - tlv_offset), FALSE); + break; + } +#endif +} + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_reg_req(void) +{ + if (proto_mac_mgmt_msg_reg_req_decoder == -1) + { + proto_mac_mgmt_msg_reg_req_decoder = proto_register_protocol ( + "WiMax REG-REQ/RSP Messages", /* name */ + "WiMax REG-REQ/RSP (reg)", /* short name */ + "reg" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_reg_req_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode REG-REQ messages. */ +void dissect_mac_mgmt_msg_reg_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tlv_offset; + guint tvb_len, payload_type; + proto_item *reg_req_item = NULL; + proto_tree *reg_req_tree = NULL; + proto_tree *tlv_tree = NULL; + gboolean hmac_found = FALSE; + tlv_info_t tlv_info; + gint tlv_type; + gint tlv_len; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if (payload_type != MAC_MGMT_MSG_REG_REQ) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type REG-REQ */ + reg_req_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_reg_req_decoder, tvb, offset, tvb_len, "MAC Management Message, REG-REQ (6)"); + /* add MAC REG-REQ subtree */ + reg_req_tree = proto_item_add_subtree(reg_req_item, ett_mac_mgmt_msg_reg_req_decoder); + /* display the Message Type */ + proto_tree_add_item(reg_req_tree, hf_reg_req_message_type, tvb, offset, 1, FALSE); + offset += 1; + + while(offset < tvb_len) + { + /* Get the TLV data. */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REG-REQ TLV error"); + } + proto_tree_add_item(reg_req_tree, hf_reg_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the offset to the TLV data */ + tlv_offset = offset + get_tlv_value_offset(&tlv_info); + + switch (tlv_type) { + case REG_ARQ_PARAMETERS: + case REG_SS_MGMT_SUPPORT: + case REG_IP_MGMT_MODE: + case REG_IP_VERSION: + case REG_UL_TRANSPORT_CIDS_SUPPORTED: + case REG_IP_PHS_SDU_ENCAP: + case REG_MAX_CLASSIFIERS_SUPPORTED: + case REG_PHS_SUPPORT: + case REG_ARQ_SUPPORT: + case REG_DSX_FLOW_CONTROL: + case REG_MAC_CRC_SUPPORT: + case REG_MCA_FLOW_CONTROL: + case REG_MCAST_POLLING_CIDS: + case REG_NUM_DL_TRANS_CID: + case REG_MAC_ADDRESS: +#ifdef WIMAX_16E_2005 + case REG_TLV_T_20_MAX_MAC_DATA_PER_FRAME_SUPPORT: + case REG_TLV_T_21_PACKING_SUPPORT: + case REG_TLV_T_22_MAC_EXTENDED_RTPS_SUPPORT: + case REG_TLV_T_23_MAX_NUM_BURSTS_TRANSMITTED_CONCURRENTLY_TO_THE_MS: + case REG_TLV_T_26_METHOD_FOR_ALLOCATING_IP_ADDR_SECONDARY_MGMNT_CONNECTION: + case REG_TLV_T_27_HANDOVER_SUPPORTED: + case REG_TLV_T_29_HO_PROCESS_OPTIMIZATION_MS_TIMER: + case REG_TLV_T_31_MOBILITY_FEATURES_SUPPORTED: + case REG_TLV_T_40_ARQ_ACK_TYPE: + case REG_TLV_T_41_MS_HO_CONNECTIONS_PARAM_PROCESSING_TIME: + case REG_TLV_T_42_MS_HO_TEK_PROCESSING_TIME: + case REG_TLV_T_43_MAC_HEADER_AND_EXTENDED_SUBHEADER_SUPPORT: + case REG_REQ_BS_SWITCHING_TIMER: + /* Decode REG-REQ sub-TLV's. */ + dissect_extended_tlv(reg_req_tree, tlv_type, tvb, tlv_offset, tlv_len, pinfo, offset, proto_mac_mgmt_msg_reg_req_decoder); + break; +#endif + case REG_REQ_SECONDARY_MGMT_CID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_req_secondary_mgmt_cid, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_req_secondary_mgmt_cid, tvb, tlv_offset, 2, FALSE); + break; + case REG_REQ_TLV_T_32_SLEEP_MODE_RECOVERY_TIME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_req_tlv_t_32_sleep_mode_recovery_time, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_req_tlv_t_32_sleep_mode_recovery_time, tvb, tlv_offset, 1, FALSE); + break; + case REG_REQ_TLV_T_33_MS_PREV_IP_ADDR: + if ( tlv_len == 4 ) { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_ms_previous_ip_address_v4, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_ms_previous_ip_address_v4, tvb, tlv_offset, tlv_len, FALSE); + } else if ( tlv_len == 16 ) { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_ms_previous_ip_address_v6, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_ms_previous_ip_address_v6, tvb, tlv_offset, tlv_len, FALSE); + } + break; + case REG_TLV_T_37_IDLE_MODE_TIMEOUT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_idle_mode_timeout, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_idle_mode_timeout, tvb, tlv_offset, tlv_len, FALSE); + break; + case REG_REQ_TLV_T_45_MS_PERIODIC_RANGING_TIMER_INFO: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_req_tlv_t_45_ms_periodic_ranging_timer, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_req_tlv_t_45_ms_periodic_ranging_timer, tvb, tlv_offset, tlv_len, FALSE); + break; + case REG_HANDOVER_INDICATION_READINESS_TIMER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_reg_tlv_t_46_handover_indication_readiness_timer, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_tlv_t_46_handover_indication_readiness_timer, tvb, tlv_offset, tlv_len, FALSE); + break; + + case DSx_UPLINK_FLOW: + /* display Uplink Service Flow Encodings info */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_mac_mgmt_msg_reg_req_decoder, tvb, tlv_offset, tlv_len, "Uplink Service Flow Encodings (%u byte(s))", tlv_len); + /* decode and display the DL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case DSx_DOWNLINK_FLOW: + /* display Downlink Service Flow Encodings info */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_mac_mgmt_msg_reg_req_decoder, tvb, tlv_offset, tlv_len, "Downlink Service Flow Encodings (%u byte(s))", tlv_len); + /* decode and display the DL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case HMAC_TUPLE: /* Table 348d */ + /* decode and display the HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_mac_mgmt_msg_reg_req_decoder, tvb, tlv_offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + wimax_hmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tlv_len); + hmac_found = TRUE; + break; + case CMAC_TUPLE: /* Table 348b */ + /* decode and display the CMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, proto_mac_mgmt_msg_reg_req_decoder, tvb, tlv_offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len); + wimax_cmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tlv_len); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_reg_req_decoder, reg_req_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + break; + } + /* update the offset */ + offset = tlv_len + tlv_offset; + } /* End while() looping through the tvb. */ + if (!hmac_found) + proto_item_append_text(reg_req_tree, " (HMAC Tuple is missing !)"); + } +} diff --git a/plugins/wimax/msg_reg_rsp.c b/plugins/wimax/msg_reg_rsp.c new file mode 100644 index 0000000000..aad834ce46 --- /dev/null +++ b/plugins/wimax/msg_reg_rsp.c @@ -0,0 +1,380 @@ +/* msg_reg_rsp.c + * WiMax MAC Management REG-RSP Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define WIMAX_16E_2005 + +#define FRAG_LAST 0x1 + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint proto_mac_mgmt_msg_reg_req_decoder; +extern gboolean include_cor2_changes; + +extern gint man_ofdma; + +extern void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb, guint tlv_offset, guint tlv_len, packet_info *pinfo, guint offset, gint proto_registry); +extern void dissect_mac_mgmt_msg_dsc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +/* forward reference */ +void dissect_mac_mgmt_msg_reg_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + + +static gint proto_mac_mgmt_msg_reg_rsp_decoder = -1; +static gint ett_mac_mgmt_msg_reg_rsp_decoder = -1; +static gint ett_reg_rsp_message_tree = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_reg_rsp_decoder, + &ett_reg_rsp_message_tree +}; + +/* NCT messages */ + +/* REG-RSP fields */ +static gint hf_reg_rsp_message_type = -1; +static gint hf_reg_rsp_status = -1; +static gint hf_tlv_type = -1; +static gint hf_tlv_value = -1; +static gint hf_reg_rsp_secondary_mgmt_cid = -1; +static gint hf_reg_invalid_tlv = -1; +static gint hf_reg_rsp_new_cid_after_ho = -1; +static gint hf_reg_rsp_service_flow_id = -1; +static gint hf_reg_rsp_system_resource_retain_time = -1; + +/* STRING RESOURCES */ + +static const value_string vals_reg_rsp_status [] = { + {0, "OK"}, + {1, "Message authentication failure"}, + {0, NULL} +}; + + +/* REG-RSP fields display */ +static hf_register_info hf[] = +{ + { + &hf_reg_rsp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.reg_rsp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_invalid_tlv, + { + "Invalid TLV", "wimax.reg_rsp.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_reg_rsp_new_cid_after_ho, + { + "New CID after handover to new BS", "wimax.reg_rsp.new_cid_after_ho", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_rsp_status, + { + "Response", "wimax.reg_rsp.response", + FT_UINT8, BASE_HEX, VALS(vals_reg_rsp_status), 0x0, "", HFILL + } + }, + { + &hf_reg_rsp_secondary_mgmt_cid, + { + "Secondary Management CID", "wimax.reg_rsp.secondary_mgmt_cid", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_rsp_service_flow_id, + { + "Service flow ID", "wimax.reg_rsp.service_flow_id", + FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_reg_rsp_system_resource_retain_time, + { + "System Resource Retain Time", "wimax.reg_rsp.system_resource_retain_time", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_tlv_type, + { + "Unknown TLV Type", "wimax.reg_rsp.unknown_tlv_type", + FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL + } + }, + { + &hf_tlv_value, + { + "Value", "wimax.reg_rsp.tlv_value", + FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_reg_rsp(void) +{ + if (proto_mac_mgmt_msg_reg_rsp_decoder == -1) + { + proto_mac_mgmt_msg_reg_rsp_decoder = proto_mac_mgmt_msg_reg_req_decoder; + + proto_register_field_array(proto_mac_mgmt_msg_reg_rsp_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode REG-RSP messages. */ +void dissect_mac_mgmt_msg_reg_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tlv_offset; + guint tvb_len, payload_type; + proto_item *reg_rsp_item = NULL; + proto_tree *reg_rsp_tree = NULL; + proto_item *tlv_item = NULL; + proto_tree *tlv_tree = NULL; + proto_tree *sub_tree = NULL; + gboolean hmac_found = FALSE; + tlv_info_t tlv_info; + gint tlv_type; + guint tlv_len; + guint this_offset = 0; + tlv_info_t sub_tlv_info; + gint sub_tlv_type; + gint sub_tlv_len; + guint sub_tlv_offset; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if (payload_type != MAC_MGMT_MSG_REG_RSP) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type REG-RSP */ + reg_rsp_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, offset, tvb_len, "MAC Management Message, REG-RSP (7)"); + /* add MAC REG-RSP subtree */ + reg_rsp_tree = proto_item_add_subtree(reg_rsp_item, ett_mac_mgmt_msg_reg_rsp_decoder); + /* display the Message Type */ + proto_tree_add_item(reg_rsp_tree, hf_reg_rsp_message_type, tvb, offset, 1, FALSE); + proto_tree_add_item(reg_rsp_tree, hf_reg_rsp_status, tvb, offset + 1, 1, FALSE); + offset += 2; + + while (offset < tvb_len) + { + /* Get the TLV data. */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if (tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REG-RSP TLV error"); + } + proto_tree_add_item(reg_rsp_tree, hf_reg_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the offset to the TLV data */ + tlv_offset = offset + get_tlv_value_offset(&tlv_info); + + switch (tlv_type) { + case REG_ARQ_PARAMETERS: + case REG_SS_MGMT_SUPPORT: + case REG_IP_MGMT_MODE: + case REG_IP_VERSION: + case REG_UL_TRANSPORT_CIDS_SUPPORTED: + case REG_IP_PHS_SDU_ENCAP: + case REG_MAX_CLASSIFIERS_SUPPORTED: + case REG_PHS_SUPPORT: + case REG_ARQ_SUPPORT: + case REG_DSX_FLOW_CONTROL: + case REG_MCA_FLOW_CONTROL: + case REG_MCAST_POLLING_CIDS: + case REG_NUM_DL_TRANS_CID: + case REG_MAC_ADDRESS: +#ifdef WIMAX_16E_2005 + case REG_TLV_T_20_MAX_MAC_DATA_PER_FRAME_SUPPORT: + case REG_TLV_T_21_PACKING_SUPPORT: + case REG_TLV_T_22_MAC_EXTENDED_RTPS_SUPPORT: + case REG_TLV_T_23_MAX_NUM_BURSTS_TRANSMITTED_CONCURRENTLY_TO_THE_MS: + case REG_TLV_T_26_METHOD_FOR_ALLOCATING_IP_ADDR_SECONDARY_MGMNT_CONNECTION: + case REG_TLV_T_27_HANDOVER_SUPPORTED: + case REG_TLV_T_29_HO_PROCESS_OPTIMIZATION_MS_TIMER: + case REG_TLV_T_31_MOBILITY_FEATURES_SUPPORTED: + case REG_TLV_T_40_ARQ_ACK_TYPE: + case REG_TLV_T_41_MS_HO_CONNECTIONS_PARAM_PROCESSING_TIME: + case REG_TLV_T_42_MS_HO_TEK_PROCESSING_TIME: + case REG_TLV_T_43_MAC_HEADER_AND_EXTENDED_SUBHEADER_SUPPORT: + dissect_extended_tlv(reg_rsp_tree, tlv_type, tvb, tlv_offset, tlv_len, pinfo, offset, proto_mac_mgmt_msg_reg_rsp_decoder); + break; +#endif + case REG_RSP_SECONDARY_MGMT_CID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, hf_reg_rsp_secondary_mgmt_cid, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_rsp_secondary_mgmt_cid, tvb, tlv_offset, tlv_len, FALSE); + break; + + case REG_RSP_TLV_T_24_CID_UPDATE_ENCODINGS: + /* Display CID update encodings */ + /* add subtree */ + sub_tree = add_protocol_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "CID update encodings (%u byte(s))", tlv_len); + /* Use a local copy of tlv_offset */ + this_offset = tlv_offset; + while(this_offset < tlv_len) { + /* Get the sub TLV data. */ + init_tlv_info(&sub_tlv_info, tvb, this_offset); + /* get the sub TLV type */ + sub_tlv_type = get_tlv_type(&sub_tlv_info); + /* get the TLV length */ + sub_tlv_len = get_tlv_length(&sub_tlv_info); + if (tlv_type == -1 || sub_tlv_len > MAX_TLV_LEN || sub_tlv_len < 1) + { /* invalid tlv info */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REG-RSP TLV error"); + } + proto_tree_add_item(reg_rsp_tree, hf_reg_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the offset to the sub TLV data */ + sub_tlv_offset = this_offset + get_tlv_value_offset(&sub_tlv_info); + switch (sub_tlv_type) { + case REG_RSP_TLV_T_24_1_CID_UPDATE_ENCODINGS_NEW_CID: + tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_reg_rsp_message_tree, sub_tree, hf_reg_rsp_new_cid_after_ho, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_rsp_new_cid_after_ho, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + break; + case REG_RSP_TLV_T_24_2_CID_UPDATE_ENCODINGS_SFID: + tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_reg_rsp_message_tree, sub_tree, hf_reg_rsp_service_flow_id, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_reg_rsp_service_flow_id, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + break; + case REG_RSP_TLV_T_24_3_CID_UPDATE_ENCODINGS_CONNECTION_INFO: + tlv_tree = add_protocol_subtree(&sub_tlv_info, ett_reg_rsp_message_tree, sub_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, sub_tlv_offset, sub_tlv_len, "CID Update Encodings Connection Info (%u byte(s))", tlv_len); + /* Decode the DSC_RSP subTLV's */ + dissect_mac_mgmt_msg_dsc_rsp_decoder(tvb_new_subset(tvb, sub_tlv_offset, sub_tlv_len, sub_tlv_len), pinfo, tlv_tree); + break; + default: + tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_reg_rsp_message_tree, sub_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + break; + } + this_offset = sub_tlv_len + sub_tlv_offset; + } + break; + case REG_RSP_TLV_T_28_HO_SYSTEM_RESOURCE_RETAIN_TIME: + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "System Resource Retain Time (%u byte(s))", tlv_len); + tlv_item = proto_tree_add_item(tlv_tree, hf_reg_rsp_system_resource_retain_time, tvb, tlv_offset, tlv_len, FALSE); + if (include_cor2_changes) { + proto_item_append_text(tlv_item, " (in units of 100 milliseconds)"); + } else { + proto_item_append_text(tlv_item, " (multiple of 100 milliseconds)"); + } + case DSx_UPLINK_FLOW: + /* display Uplink Service Flow Encodings info */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "Uplink Service Flow Encodings (%u byte(s))", tlv_len); + /* decode and display the DL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case DSx_DOWNLINK_FLOW: + /* display Downlink Service Flow Encodings info */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "Downlink Service Flow Encodings (%u byte(s))", tlv_len); + /* decode and display the DL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case HMAC_TUPLE: /* Table 348d */ + /* decode and display the HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + wimax_hmac_tuple_decoder(tlv_tree, tvb, offset+2, tlv_len); + hmac_found = TRUE; + break; + case CMAC_TUPLE: /* Table 348b */ + /* decode and display the CMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len); + wimax_cmac_tuple_decoder(tlv_tree, tvb, offset+2, tlv_len); + break; + case SHORT_HMAC_TUPLE: + case SHORT_HMAC_TUPLE_COR2: + if ((!include_cor2_changes && (tlv_type == SHORT_HMAC_TUPLE)) || + (include_cor2_changes && (tlv_type == SHORT_HMAC_TUPLE_COR2))) { + /* decode and display the Short HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "Short HMAC Tuple (%u byte(s))", tlv_len); + wimax_short_hmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tlv_len); + } else { + /* Unknown TLV Type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + } + break; + case VENDOR_SPECIFIC_INFO: + case VENDOR_ID_ENCODING: + case MAC_VERSION_ENCODING: + wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, reg_rsp_tree); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + break; + } + + offset = tlv_len + tlv_offset; + } /* end of TLV process while loop */ + if (!hmac_found) + proto_item_append_text(reg_rsp_tree, " (HMAC Tuple is missing !)"); + } +} + diff --git a/plugins/wimax/msg_rep.c b/plugins/wimax/msg_rep.c new file mode 100644 index 0000000000..a06f13b1e9 --- /dev/null +++ b/plugins/wimax/msg_rep.c @@ -0,0 +1,1618 @@ +/* msg_rep.c + * WiMax MAC Management REP-REQ/RSP Messages decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* +#define DEBUG // for debug only +*/ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +/* forward reference */ +void proto_register_mac_mgmt_msg_rep(void); +void dissect_mac_mgmt_msg_rep_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_rep_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_rep_decoder = -1; +static gint ett_mac_mgmt_msg_rep_req_decoder = -1; +static gint ett_mac_mgmt_msg_rep_rsp_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett_rep[] = +{ + &ett_mac_mgmt_msg_rep_req_decoder, + &ett_mac_mgmt_msg_rep_rsp_decoder, +}; + +static const value_string vals_channel_types[] = +{ + { 0, "Normal Subchannel"}, + { 1, "Band AMC Channel"}, + { 2, "Safety Channel"}, + { 3, "Sounding"}, + { 0, NULL} +}; + +static const value_string vals_type_of_zones[] = +{ + { 0, "PUSC Zone with 'use all SC=0'"}, + { 1, "PUSC Zone with 'use all SC=1'/PUSC AAS Zone"}, + { 2, "FUSC Zone"}, + { 3, "Optional FUSC Zone"}, + { 4, "Safety Channel Region"}, + { 5, "AMC Zone (only applicable to AAS zone)"}, + { 6, "Reserved"}, + { 7, "Reserved"}, + { 0, NULL} +}; + +static const value_string vals_data_cinr_measurements[] = +{ + { 0, "From Pilot Subcarriers"}, + { 1, "From Data Subcarriers"}, + { 0, NULL} +}; + +static const value_string vals_cinr_report_types[] = +{ + { 0, "Mean Of CINR Only"}, + { 1, "Both Mean And Standard Deviation Of CINR"}, + { 0, NULL} +}; + +static const value_string vals_type_of_measurements[] = +{ + { 0, "From Preamble For Frequency Reuse Configuration 1"}, + { 1, "From Preamble For Frequency Reuse Configuration 3"}, + { 2, "From Preamble For Band AMC"}, + { 3, "Reserved"}, + { 0, NULL} +}; + +/* fix fields */ +static gint hf_rep_req_message_type = -1; +static gint hf_rep_rsp_message_type = -1; +static gint hf_rep_unknown_type = -1; +static gint hf_rep_invalid_tlv = -1; + +static gint hf_rep_req_report_request = -1; +static gint hf_rep_req_report_type = -1; +static gint hf_rep_req_rep_type_bit0 = -1; +static gint hf_rep_req_rep_type_bit1 = -1; +static gint hf_rep_req_rep_type_bit2 = -1; +static gint hf_rep_req_rep_type_bit3_6 = -1; +static gint hf_rep_req_rep_type_bit7 = -1; +static gint hf_rep_req_channel_number = -1; +static gint hf_rep_req_channel_type_request = -1; +static gint hf_rep_req_channel_type_reserved = -1; +static gint hf_rep_req_zone_spec_phy_cinr_request = -1; +static gint hf_rep_req_preamble_phy_cinr_request = -1; +static gint hf_rep_req_zone_spec_effective_cinr_request = -1; +static gint hf_rep_req_preamble_effective_cinr_request = -1; +static gint hf_rep_req_channel_selectivity_report = -1; + +static gint hf_rep_req_zone_spec_phy_cinr_req_bit0_2 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit3 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit4 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit5_6 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit7 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit8_13 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit14_17 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit18 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit19_23 = -1; + +static gint hf_rep_req_zone_spec_effective_cinr_req_bit0_2 = -1; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit3 = -1; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit4 = -1; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit5_6 = -1; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit7 = -1; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit8_13 = -1; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit14_15 = -1; + +static gint hf_rep_req_preamble_phy_cinr_req_bit0_1 = -1; +static gint hf_rep_req_preamble_phy_cinr_req_bit2_5 = -1; +static gint hf_rep_req_preamble_phy_cinr_req_bit6 = -1; +static gint hf_rep_req_preamble_phy_cinr_req_bit7 = -1; + +static gint hf_rep_req_preamble_effective_cinr_req_bit0_1 = -1; +static gint hf_rep_req_preamble_effective_cinr_req_bit2_7 = -1; + +static gint hf_rep_req_channel_selectivity_rep_bit0 = -1; +static gint hf_rep_req_channel_selectivity_rep_bit1_7 = -1; + +static gint hf_rep_rsp_report_type = -1; +static gint hf_rep_rsp_report_type_channel_number = -1; +static gint hf_rep_rsp_report_type_frame_number = -1; +static gint hf_rep_rsp_report_type_duration = -1; +static gint hf_rep_rsp_report_type_basic_report = -1; +static gint hf_rep_rsp_report_type_basic_report_bit0 = -1; +static gint hf_rep_rsp_report_type_basic_report_bit1 = -1; +static gint hf_rep_rsp_report_type_basic_report_bit2 = -1; +static gint hf_rep_rsp_report_type_basic_report_bit3 = -1; +static gint hf_rep_rsp_report_type_basic_report_reserved = -1; +static gint hf_rep_rsp_report_type_cinr_report = -1; +static gint hf_rep_rsp_report_type_cinr_report_mean = -1; +static gint hf_rep_rsp_report_type_cinr_report_deviation = -1; +static gint hf_rep_rsp_report_type_rssi_report = -1; +static gint hf_rep_rsp_report_type_rssi_report_mean = -1; +static gint hf_rep_rsp_report_type_rssi_report_deviation = -1; +static gint hf_rep_rsp_current_transmitted_power = -1; +static gint hf_rep_rsp_channel_type_report = -1; +static gint hf_rep_rsp_channel_type_subchannel = -1; +static gint hf_rep_rsp_channel_type_band_amc = -1; +static gint hf_rep_rsp_channel_type_safety_channel = -1; +static gint hf_rep_rsp_channel_type_enhanced_band_amc = -1; +static gint hf_rep_rsp_channel_type_sounding = -1; + +static gint hf_rep_rsp_zone_spec_phy_cinr_report = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_mean = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_report_type = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1 = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_deviation = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2 = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc0 = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc1 = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_fusc = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_optional_fusc = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_safety_channel = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_amc = -1; +static gint hf_rep_rsp_preamble_phy_cinr_report = -1; +static gint hf_rep_rsp_preamble_phy_cinr_rep_configuration_1 = -1; +static gint hf_rep_rsp_preamble_phy_cinr_rep_configuration_3 = -1; +static gint hf_rep_rsp_preamble_phy_cinr_rep_band_amc_zone = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_report = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_report_type = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id = -1; +static gint hf_rep_rsp_preamble_effective_cinr_report = -1; +static gint hf_rep_rsp_preamble_effective_cinr_rep_cqich_id = -1; +static gint hf_rep_rsp_channel_selectivity_report = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc0 = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc1 = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_fusc = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_optional_fusc = -1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_amc_aas = -1; +static gint hf_rep_rsp_preamble_effective_cinr_rep_configuration_1 = -1; +static gint hf_rep_rsp_preamble_effective_cinr_rep_configuration_3 = -1; +static gint hf_rep_rsp_channel_selectivity_rep_frequency_a = -1; +static gint hf_rep_rsp_channel_selectivity_rep_frequency_b = -1; +static gint hf_rep_rsp_channel_selectivity_rep_frequency_c = -1; + +/* bit masks */ +#define REP_REQ_REPORT_TYPE_BIT0 0x01 +#define REP_REQ_REPORT_TYPE_BIT1 0x02 +#define REP_REQ_REPORT_TYPE_BIT2 0x04 +#define REP_REQ_REPORT_TYPE_BIT3_6 0x78 +#define REP_REQ_REPORT_TYPE_BIT7 0x80 + +#define REP_REQ_CHANNEL_TYPE_REQUEST 0x03 +#define REP_REQ_CHANNEL_TYPE_RESERVED 0xFC + +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT0_2 0x000007 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT3 0x000008 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT4 0x000010 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT5_6 0x000060 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT7 0x000080 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT8_13 0x003F00 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT14_17 0x03C000 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT18 0x040000 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_BIT19_23 0xF80000 + +#define REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT0_2 0x0007 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT3 0x0008 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT4 0x0010 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT5_6 0x0060 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT7 0x0080 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT8_13 0x3F00 +#define REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT14_15 0xC000 + +#define REP_REQ_PREAMBLE_PHY_CINR_REQUEST_BIT0_1 0x03 +#define REP_REQ_PREAMBLE_PHY_CINR_REQUEST_BIT2_5 0x3C +#define REP_REQ_PREAMBLE_PHY_CINR_REQUEST_BIT6 0x40 +#define REP_REQ_PREAMBLE_PHY_CINR_REQUEST_BIT7 0x80 + +#define REP_REQ_PREAMBLE_EFFECTIVE_CINR_REQUEST_BIT0_1 0x03 +#define REP_REQ_PREAMBLE_EFFECTIVE_CINR_REQUEST_BIT2_7 0xFC + +#define REP_REQ_CHANNEL_SELECTIVITY_REPORT_BIT0 0x01 +#define REP_REQ_CHANNEL_SELECTIVITY_REPORT_BIT1_7 0xFE + +#define REP_RSP_REPORT_TYPE_BASIC_REPORT_BIT0 0x01 +#define REP_RSP_REPORT_TYPE_BASIC_REPORT_BIT1 0x02 +#define REP_RSP_REPORT_TYPE_BASIC_REPORT_BIT2 0x04 +#define REP_RSP_REPORT_TYPE_BASIC_REPORT_BIT3 0x08 +#define REP_RSP_REPORT_TYPE_BASIC_REPORT_RSV 0xF0 + +#define REP_RSP_ZONE_SPEC_PHY_CINR_MEAN_MASK 0x1F +#define REP_RSP_ZONE_SPEC_PHY_CINR_REP_TYPE_MASK 0x20 +#define REP_RSP_ZONE_SPEC_PHY_CINR_RSV1_MASK 0xC0 +#define REP_RSP_ZONE_SPEC_PHY_CINR_DEVIATION_MASK 0x1F +#define REP_RSP_ZONE_SPEC_PHY_CINR_RSV2_MASK 0xE0 + +#define REP_RSP_ZONE_SPEC_EFFECTIVE_CINR_EFFECTIVE_CINR_MASK 0x0F +#define REP_RSP_ZONE_SPEC_EFFECTIVE_CINR_REPORT_TYPE_MASK 0x10 +#define REP_RSP_ZONE_SPEC_EFFECTIVE_CINR_CQICH_ID_MASK 0xE0 +#define REP_RSP_ZONE_SPEC_EFFECTIVE_CINR_CQICH_ID_4_MASK 0xF0 + +/* report display */ +static hf_register_info hf_rep[] = +{ + { + &hf_rep_invalid_tlv, + { + "Invalid TLV", "wimax.rep.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_rep_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.rep_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { /* type 1.2 */ + &hf_rep_req_channel_number, + { + "Channel Number", "wimax.rep_req.channel_number", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { /* type 1.8 */ + &hf_rep_req_channel_selectivity_report, + { + "Channel Selectivity Report", "wimax.rep_req.channel_selectivity_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_req_channel_selectivity_rep_bit0, + { + "Include Frequency Selectivity Report", "wimax.rep_req.channel_selectivity_report.bit0", + FT_BOOLEAN, 8, NULL, REP_REQ_CHANNEL_SELECTIVITY_REPORT_BIT0, "", HFILL + } + }, + { + &hf_rep_req_channel_selectivity_rep_bit1_7, + { + "Reserved", "wimax.rep_req.channel_selectivity_report.bit1_7", + FT_UINT8, BASE_HEX, NULL, REP_REQ_CHANNEL_SELECTIVITY_REPORT_BIT1_7, "", HFILL + } + }, + { /* type 1.3 */ + &hf_rep_req_channel_type_request, + { + "Channel Type Request", "wimax.rep_req.channel_type.request", + FT_UINT8, BASE_DEC, VALS(vals_channel_types), 0x03, "", HFILL + } + }, + { + &hf_rep_req_channel_type_reserved, + { + "Reserved", "wimax.rep_req.channel_type.reserved", + FT_UINT8, BASE_HEX, NULL, 0xFC, "", HFILL + } + }, + { /* type 1.7 */ + &hf_rep_req_preamble_effective_cinr_request, + { + "Preamble Effective CINR Request", "wimax.rep_req.preamble_effective_cinr_request", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_req_preamble_effective_cinr_req_bit0_1, + { + "Type Of Preamble Physical CINR Measurement", "wimax.rep_req.preamble_effective_cinr_request.bit0_1", + FT_UINT8, BASE_DEC, VALS(vals_type_of_measurements), REP_REQ_PREAMBLE_EFFECTIVE_CINR_REQUEST_BIT0_1, "", HFILL + } + }, + { + &hf_rep_req_preamble_effective_cinr_req_bit2_7, + { + "Reserved", "wimax.rep_req.preamble_effective_cinr_request.bit2_7", + FT_UINT8, BASE_HEX, NULL, REP_REQ_PREAMBLE_EFFECTIVE_CINR_REQUEST_BIT2_7, "", HFILL + } + }, + { /* type 1.5 */ + &hf_rep_req_preamble_phy_cinr_request, + { + "Preamble Physical CINR Request", "wimax.rep_req.preamble_phy_cinr_request", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_req_preamble_phy_cinr_req_bit0_1, + { + "Type Of Preamble Physical CINR Measurement", "wimax.rep_req.preamble_phy_cinr_request.bit0_1", + FT_UINT8, BASE_DEC, VALS(vals_type_of_measurements), REP_REQ_PREAMBLE_PHY_CINR_REQUEST_BIT0_1, "", HFILL + } + }, + { + &hf_rep_req_preamble_phy_cinr_req_bit2_5, + { + "Alpha (ave) in multiples of 1/16", "wimax.rep_req.preamble_phy_cinr_request.bit2_5", + FT_UINT8, BASE_DEC, NULL, REP_REQ_PREAMBLE_PHY_CINR_REQUEST_BIT2_5, "", HFILL + } + }, + { + &hf_rep_req_preamble_phy_cinr_req_bit6, + { + "CINR Report Type", "wimax.rep_req.preamble_phy_cinr_request.bit6", + FT_UINT8, BASE_DEC, VALS(vals_cinr_report_types), REP_REQ_PREAMBLE_PHY_CINR_REQUEST_BIT6, "", HFILL + } + }, + { + &hf_rep_req_preamble_phy_cinr_req_bit7, + { + "Reserved", "wimax.rep_req.preamble_phy_cinr_request.bit7", + FT_UINT8, BASE_HEX, NULL, REP_REQ_PREAMBLE_PHY_CINR_REQUEST_BIT7, "", HFILL + } + }, + { /* report request */ + &hf_rep_req_report_request, + { + "Report Request", "wimax.rep_req.report_request", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* type 1.1 */ + &hf_rep_req_report_type, + { + "Report Type", "wimax.rep_req.report_type", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_req_rep_type_bit0, + { + "Include DFS Basic Report", "wimax.rep_req.report_type.bit0", + FT_BOOLEAN, 8, NULL, REP_REQ_REPORT_TYPE_BIT0, "", HFILL + } + }, + { + &hf_rep_req_rep_type_bit1, + { + "Include CINR Report", "wimax.rep_req.report_type.bit1", + FT_BOOLEAN, 8, NULL, REP_REQ_REPORT_TYPE_BIT1, "", HFILL + } + }, + { + &hf_rep_req_rep_type_bit2, + { + "Include RSSI Report", "wimax.rep_req.report_type.bit2", + FT_BOOLEAN, 8, NULL, REP_REQ_REPORT_TYPE_BIT2, "", HFILL + } + }, + { + &hf_rep_req_rep_type_bit3_6, + { + "Alpha (ave) in multiples of 1/32", "wimax.rep_req.report_type.bit3_6", + FT_UINT8, BASE_DEC, NULL, REP_REQ_REPORT_TYPE_BIT3_6, "", HFILL + } + }, + { + &hf_rep_req_rep_type_bit7, + { + "Include Current Transmit Power Report", "wimax.rep_req.report_type.bit7", + FT_BOOLEAN, 8, NULL, REP_REQ_REPORT_TYPE_BIT7, "", HFILL + } + }, + { + &hf_rep_rsp_preamble_effective_cinr_rep_cqich_id, + { + "The 4 least significant bits of CQICH_ID", "wimax.rep_req.zone_spec_effective_cinr_report.cqich_id_4", + FT_UINT8, BASE_HEX, NULL, REP_RSP_ZONE_SPEC_EFFECTIVE_CINR_CQICH_ID_4_MASK, "", HFILL + } + }, + { + &hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id, + { + "The 3 least significant bits of CQICH_ID", "wimax.rep_req.zone_spec_effective_cinr_report.cqich_id", + FT_UINT8, BASE_HEX, NULL, REP_RSP_ZONE_SPEC_EFFECTIVE_CINR_CQICH_ID_MASK, "", HFILL + } + }, + { + &hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr, + { + "Effective CINR", "wimax.rep_req.zone_spec_effective_cinr_report.effective_cinr", + FT_UINT8, BASE_DEC, NULL, REP_RSP_ZONE_SPEC_EFFECTIVE_CINR_EFFECTIVE_CINR_MASK, "", HFILL + } + }, + { + &hf_rep_rsp_zone_spec_effective_cinr_rep_report_type, + { + "Effective CINR Report", "wimax.rep_req.zone_spec_effective_cinr_report.report_type", + FT_UINT8, BASE_DEC, VALS(vals_data_cinr_measurements), REP_RSP_ZONE_SPEC_EFFECTIVE_CINR_REPORT_TYPE_MASK, "", HFILL + } + }, + { /* type 1.6 */ + &hf_rep_req_zone_spec_effective_cinr_request, + { + "Zone-specific Effective CINR Request", "wimax.rep_req.zone_spec_effective_cinr_request", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_effective_cinr_req_bit0_2, + { + "Type Of Zone On Which CINR Is To Be Reported", "wimax.rep_req.zone_spec_effective_cinr_request.bit0_2", + FT_UINT16, BASE_HEX, VALS(vals_type_of_zones), REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT0_2, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_effective_cinr_req_bit3, + { + "STC Zone", "wimax.rep_req.zone_spec_effective_cinr_request.bit3", + FT_BOOLEAN, 16, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT3, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_effective_cinr_req_bit4, + { + "AAS Zone", "wimax.rep_req.zone_spec_effective_cinr_request.bit4", + FT_BOOLEAN, 16, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT4, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_effective_cinr_req_bit5_6, + { + "PRBS ID", "wimax.rep_req.zone_spec_effective_cinr_request.bit5_6", + FT_UINT16, BASE_HEX, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT5_6, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_effective_cinr_req_bit7, + { + "CINR Measurement Report", "wimax.rep_req.zone_spec_effective_cinr_request.bit7", + FT_UINT16, BASE_HEX, VALS(vals_data_cinr_measurements), REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT7, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_effective_cinr_req_bit8_13, + { + "PUSC Major Group Map", "wimax.rep_req.zone_spec_effective_cinr_request.bit8_13", + FT_UINT16, BASE_HEX, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT8_13, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_effective_cinr_req_bit14_15, + { + "Reserved", "wimax.rep_req.zone_spec_effective_cinr_request.bit14_15", + FT_UINT16, BASE_HEX, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_16_BIT14_15, "", HFILL + } + }, + { /* second byte */ + &hf_rep_rsp_zone_spec_phy_cinr_rep_deviation, + { + "Standard Deviation of CINR", "wimax.rep_req.zone_spec_phy_cinr_report.deviation", + FT_UINT8, BASE_DEC, NULL, REP_RSP_ZONE_SPEC_PHY_CINR_DEVIATION_MASK, "", HFILL + } + }, + { /* first byte */ + &hf_rep_rsp_zone_spec_phy_cinr_rep_mean, + { + "Mean of Physical CINR", "wimax.rep_req.zone_spec_phy_cinr_report.mean", + FT_UINT8, BASE_DEC, NULL, REP_RSP_ZONE_SPEC_PHY_CINR_MEAN_MASK, "", HFILL + } + }, + { + &hf_rep_rsp_zone_spec_phy_cinr_rep_report_type, + { + "CINR Report Type", "wimax.rep_req.zone_spec_phy_cinr_report.report_type", + FT_UINT8, BASE_DEC, VALS(vals_data_cinr_measurements), REP_RSP_ZONE_SPEC_PHY_CINR_REP_TYPE_MASK, "", HFILL + } + }, + { + &hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1, + { + "Reserved", "wimax.rep_req.zone_spec_phy_cinr_report.reserved1", + FT_UINT8, BASE_HEX, NULL, REP_RSP_ZONE_SPEC_PHY_CINR_RSV1_MASK, "", HFILL + } + }, + { + &hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2, + { + "Reserved", "wimax.rep_req.zone_spec_phy_cinr_report.reserved2", + FT_UINT8, BASE_HEX, NULL, REP_RSP_ZONE_SPEC_PHY_CINR_RSV2_MASK, "", HFILL + } + }, + { /* type 1.4 */ + &hf_rep_req_zone_spec_phy_cinr_request, + { + "Zone-specific Physical CINR Request", "wimax.rep_req.zone_spec_phy_cinr_request", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit0_2, + { + "Type Of Zone On Which CINR Is To Be Reported", "wimax.rep_req.zone_spec_phy_cinr_request.bit0_2", + FT_UINT24, BASE_HEX, VALS(vals_type_of_zones), REP_REQ_TYPE_OF_ZONE_REQUEST_BIT0_2, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit3, + { + "STC Zone", "wimax.rep_req.zone_spec_phy_cinr_request.bit3", + FT_BOOLEAN, 24, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_BIT3, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit4, + { + "AAS Zone", "wimax.rep_req.zone_spec_phy_cinr_request.bit4", + FT_BOOLEAN, 24, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_BIT4, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit5_6, + { + "PRBS ID", "wimax.rep_req.zone_spec_phy_cinr_request.bit5_6", + FT_UINT24, BASE_HEX, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_BIT5_6, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit7, + { + "CINR Measurement Report", "wimax.rep_req.zone_spec_phy_cinr_request.bit7", + FT_UINT24, BASE_HEX, VALS(vals_data_cinr_measurements), REP_REQ_TYPE_OF_ZONE_REQUEST_BIT7, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit8_13, + { + "PUSC Major Group Map", "wimax.rep_req.zone_spec_phy_cinr_request.bit8_13", + FT_UINT24, BASE_HEX, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_BIT8_13, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit14_17, + { + "Alpha (ave) in multiples of 1/16", "wimax.rep_req.zone_spec_phy_cinr_request.bit14_17", + FT_UINT24, BASE_DEC, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_BIT14_17, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit18, + { + "CINR Report Type", "wimax.rep_req.zone_spec_phy_cinr_request.bit18", + FT_UINT24, BASE_HEX, VALS(vals_cinr_report_types), REP_REQ_TYPE_OF_ZONE_REQUEST_BIT18, "", HFILL + } + }, + { + &hf_rep_req_zone_spec_phy_cinr_req_bit19_23, + { + "Reserved", "wimax.rep_req.zone_spec_phy_cinr_request.bit19_23", + FT_UINT24, BASE_HEX, NULL, REP_REQ_TYPE_OF_ZONE_REQUEST_BIT19_23, "", HFILL + } + }, + { + &hf_rep_rsp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.rep_rsp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { /* 6.3 */ + &hf_rep_rsp_channel_selectivity_report, + { + "Channel Selectivity Report", "wimax.rep_rsp.channel_selectivity_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_selectivity_rep_frequency_a, + { + "Frequency Selectivity Report a", "wimax.rep_rsp.channel_selectivity_report.frequency_a", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_selectivity_rep_frequency_b, + { + "Frequency Selectivity Report b", "wimax.rep_rsp.channel_selectivity_report.frequency_b", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_selectivity_rep_frequency_c, + { + "Frequency Selectivity Report c", "wimax.rep_rsp.channel_selectivity_report.frequency_c", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_type_report, + { + "Channel Type Report", "wimax.rep_rsp.channel_type_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_type_band_amc, + { + "Band AMC", "wimax.rep_rsp.channel_type_report.band_amc", + FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_type_enhanced_band_amc, + { + "Enhanced Band AMC", "wimax.rep_rsp.channel_type_report.enhanced_band_amc", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_type_safety_channel, + { + "Safety Channel", "wimax.rep_rsp.channel_type_report.safety_channel", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_type_sounding, + { + "Sounding", "wimax.rep_rsp.channel_type_report.sounding", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_channel_type_subchannel, + { + "Normal Subchannel", "wimax.rep_rsp.channel_type_report.subchannel", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_preamble_effective_cinr_report, + { + "Preamble Effective CINR Report", "wimax.rep_rsp.preamble_effective_cinr_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 6.1 */ + &hf_rep_rsp_preamble_effective_cinr_rep_configuration_1, + { + "The Estimation Of Effective CINR Measured From Preamble For Frequency Reuse Configuration=1", "wimax.rep_rsp.preamble_effective_cinr_report.configuration_1", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 6.2 */ + &hf_rep_rsp_preamble_effective_cinr_rep_configuration_3, + { + "The Estimation Of Effective CINR Measured From Preamble For Frequency Reuse Configuration=3", "wimax.rep_rsp.preamble_effective_cinr_report.configuration_3", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_preamble_phy_cinr_report, + { + "Preamble Physical CINR Report", "wimax.rep_rsp.preamble_phy_cinr_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 4.3 */ + &hf_rep_rsp_preamble_phy_cinr_rep_band_amc_zone, + { + "The Estimation Of Physical CINR Measured From Preamble For Band AMC Zone", "wimax.rep_rsp.preamble_phy_cinr_report.band_amc_zone", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 4.1 */ + &hf_rep_rsp_preamble_phy_cinr_rep_configuration_1, + { + "The Estimation Of Physical CINR Measured From Preamble For Frequency Reuse Configuration=1", "wimax.rep_rsp.preamble_phy_cinr_report.configuration_1", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 4.2 */ + &hf_rep_rsp_preamble_phy_cinr_rep_configuration_3, + { + "The Estimation Of Physical CINR Measured From Preamble For Frequency Reuse Configuration=3", "wimax.rep_rsp.preamble_phy_cinr_report.configuration_3", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, +/* Report Response */ + { + &hf_rep_rsp_report_type, + { + "Report Type", "wimax.rep_rsp.report_type", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_basic_report, + { + "Basic Report", "wimax.rep_rsp.report_type.basic_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_basic_report_bit0, + { + "Wireless HUMAN Detected", "wimax.rep_rsp.report_type.basic_report.bit0", + FT_BOOLEAN, 8, NULL, REP_RSP_REPORT_TYPE_BASIC_REPORT_BIT0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_basic_report_bit1, + { + "Unknown Transmission Detected", "wimax.rep_rsp.report_type.basic_report.bit1", + FT_BOOLEAN, 8, NULL, REP_RSP_REPORT_TYPE_BASIC_REPORT_BIT1, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_basic_report_bit2, + { + "Specific Spectrum User Detected", "wimax.rep_rsp.report_type.basic_report.bit2", + FT_BOOLEAN, 8, NULL, REP_RSP_REPORT_TYPE_BASIC_REPORT_BIT2, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_basic_report_bit3, + { + "Channel Not Measured", "wimax.rep_rsp.report_type.basic_report.bit3", + FT_BOOLEAN, 8, NULL, REP_RSP_REPORT_TYPE_BASIC_REPORT_BIT3, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_basic_report_reserved, + { + "Reserved", "wimax.rep_rsp.report_type.basic_report.reserved", + FT_UINT8, BASE_HEX, NULL, REP_RSP_REPORT_TYPE_BASIC_REPORT_RSV, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_channel_number, + { + "Channel Number", "wimax.rep_rsp.report_type.channel_number", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_cinr_report, + { + "CINR Report", "wimax.rep_rsp.report_type.cinr_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_cinr_report_deviation, + { + "CINR Standard Deviation", "wimax.rep_rsp.report_type.cinr_report_deviation", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_cinr_report_mean, + { + "CINR Mean", "wimax.rep_rsp.report_type.cinr_report_mean", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_duration, + { + "Duration", "wimax.rep_rsp.report_type.duration", + FT_UINT24, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_frame_number, + { + "Start Frame", "wimax.rep_rsp.report_type.frame_number", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_rssi_report, + { + "RSSI Report", "wimax.rep_rsp.report_type.rssi_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_rssi_report_deviation, + { + "RSSI Standard Deviation", "wimax.rep_rsp.report_type.rssi_report_deviation", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_current_transmitted_power, + { + "Current Transmitted Power", "wimax.rep_rsp.current_transmitted_power", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_report_type_rssi_report_mean, + { + "RSSI Mean", "wimax.rep_rsp.report_type.rssi_report_mean", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_zone_spec_effective_cinr_report, + { + "Zone-specific Effective CINR Report", "wimax.rep_rsp.zone_spec_effective_cinr_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 5.5 */ + &hf_rep_rsp_zone_spec_effective_cinr_rep_amc_aas, + { + "AMC AAS Zone", "wimax.rep_rsp.zone_spec_effective_cinr_report.amc_aas", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 5.3 */ + &hf_rep_rsp_zone_spec_effective_cinr_rep_fusc, + { + "FUSC Zone", "wimax.rep_rsp.zone_spec_effective_cinr_report.fusc", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 5.4 */ + &hf_rep_rsp_zone_spec_effective_cinr_rep_optional_fusc, + { + "Optional FUSC Zone", "wimax.rep_rsp.zone_spec_effective_cinr_report.optional_fusc", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 5.1 */ + &hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc0, + { + "PUSC Zone (use all SC=0)", "wimax.rep_rsp.zone_spec_effective_cinr_report.pusc_sc0", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 5.2 */ + &hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc1, + { + "PUSC Zone (use all SC=1)", "wimax.rep_rsp.zone_spec_effective_cinr_report.pusc_sc1", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_rsp_zone_spec_phy_cinr_report, + { + "Zone-specific Physical CINR Report", "wimax.rep_rsp.zone_spec_phy_cinr_report", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 3.6 */ + &hf_rep_rsp_zone_spec_phy_cinr_rep_amc, + { + "AMC Zone", "wimax.rep_rsp.zone_spec_phy_cinr_report.amc", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 3.3 */ + &hf_rep_rsp_zone_spec_phy_cinr_rep_fusc, + { + "FUSC Zone", "wimax.rep_rsp.zone_spec_phy_cinr_report.fusc", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 3.4 */ + &hf_rep_rsp_zone_spec_phy_cinr_rep_optional_fusc, + { + "Optional FUSC Zone", "wimax.rep_rsp.zone_spec_phy_cinr_report.optional_fusc", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 3.1 */ + &hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc0, + { + "PUSC Zone (use all SC=0)", "wimax.rep_rsp.zone_spec_phy_cinr_report.pusc_sc0", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 3.2 */ + &hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc1, + { + "PUSC Zone (use all SC=1)", "wimax.rep_rsp.zone_spec_phy_cinr_report.pusc_sc1", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 3.5 */ + &hf_rep_rsp_zone_spec_phy_cinr_rep_safety_channel, + { + "Safety Channel", "wimax.rep_rsp.zone_spec_phy_cinr_report.safety_channel", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_rep_unknown_type, + { + "Unknown TLV type", "wimax.rep.unknown_tlv_type", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + } +}; + +/* Register Wimax Mac REP-REQ Messages Dissectors */ +void proto_register_mac_mgmt_msg_rep(void) +{ + if (proto_mac_mgmt_msg_rep_decoder == -1) + { + proto_mac_mgmt_msg_rep_decoder = proto_register_protocol ( + "WiMax REP-REQ/RSP Messages", /* name */ + "WiMax REP-REQ/RSP (rep)", /* short name */ + "rep" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_rep_decoder, hf_rep, array_length(hf_rep)); + proto_register_subtree_array(ett_rep, array_length(ett_rep)); + } +} + +/* Wimax Mac REP-REQ Message Dissector */ +void dissect_mac_mgmt_msg_rep_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + gint tlv_type, tlv_len, tlv_value_offset, length, tlv_offset; + proto_item *rep_item = NULL; + proto_tree *rep_tree = NULL; + proto_tree *tlv_tree = NULL; + proto_tree *ti_tree = NULL; + tlv_info_t tlv_info; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_REP_REQ) + { + return; + } + + if(tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type REP-REQ */ + rep_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_rep_decoder, tvb, offset, tvb_len, "Report Request (REP-REQ) (%u bytes)", tvb_len); + /* add MAC REP-REQ subtree */ + rep_tree = proto_item_add_subtree(rep_item, ett_mac_mgmt_msg_rep_req_decoder); + /* Decode and display the Report Request message (REP-REQ) */ + /* display the Message Type */ + proto_tree_add_item(rep_tree, hf_rep_req_message_type, tvb, offset, 1, FALSE); + /* set the offset for the TLV Encoded info */ + offset++; + /* process the REP-REQ TLVs */ + while(offset < tvb_len) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-REQ TLV error"); + } + proto_tree_add_item(rep_tree, hf_rep_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(rep_tree, proto_mac_mgmt_msg_rep_decoder, tvb, offset, (tlv_len + tlv_value_offset), "REP-REQ Type: %u (%u bytes, offset=%u, length=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tlv_len, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* process REP-REQ TLV Encoded information (11.11) */ + switch (tlv_type) + { + case REP_REQ_REPORT_REQUEST: + /* process the REP-REQ report request TLVs */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, rep_tree, hf_rep_req_report_request, tvb, offset, tlv_len, FALSE); + for( tlv_offset = 0; tlv_offset < tlv_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset + tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-REQ Report Request TLV error"); + } + proto_tree_add_item(tlv_tree, hf_rep_invalid_tlv, tvb, (offset + tlv_offset), (tlv_len - offset - tlv_offset), FALSE); + break; + } +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(rep_tree, proto_mac_mgmt_msg_rep_decoder, tvb, offset, (length + tlv_value_offset), "REP-REQ Report Request Type: %u (%u bytes, offset=%u, length=%u, tvb_len=%u)", tlv_type, (length + tlv_value_offset), offset, length, tvb_len); +#endif + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case REP_REQ_REPORT_TYPE: + /* decode and display the Report type */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, hf_rep_req_report_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_rep_type_bit0, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_rep_type_bit1, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_rep_type_bit2, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_rep_type_bit3_6, tvb, (offset + tlv_offset), length, FALSE); +// proto_item_append_text(ti, " dB"); + proto_tree_add_item(ti_tree, hf_rep_req_rep_type_bit7, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_REQ_CHANNEL_NUMBER: + /* decode and display the Channel Number */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, hf_rep_req_channel_number, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_channel_number, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_REQ_CHANNEL_TYPE: + /* decode and display the Channel Type */ + ti_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, proto_mac_mgmt_msg_rep_decoder, tvb, (offset + tlv_offset), length, "Channel Type (%u byte(s))", length); + proto_tree_add_item(ti_tree, hf_rep_req_channel_type_request, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_channel_type_reserved, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_REQ_ZONE_SPEC_PHY_CINR_REQ: + /* decode and display the zone specific physical cinr request */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, hf_rep_req_zone_spec_phy_cinr_request, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit0_2, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit3, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit4, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit5_6, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit7, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit8_13, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit14_17, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit18, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_phy_cinr_req_bit19_23, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_REQ_PREAMBLE_PHY_CINR_REQ: + /* decode and display the preamble phy cinr request */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, hf_rep_req_preamble_phy_cinr_request, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_preamble_phy_cinr_req_bit0_1, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_preamble_phy_cinr_req_bit2_5, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_preamble_phy_cinr_req_bit6, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_preamble_phy_cinr_req_bit7, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_REQ_ZONE_SPEC_EFF_CINR_REQ: + /* decode and display the zone specific effective cinr request */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, hf_rep_req_zone_spec_effective_cinr_request, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_effective_cinr_req_bit0_2, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_effective_cinr_req_bit3, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_effective_cinr_req_bit4, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_effective_cinr_req_bit5_6, tvb, (offset + tlv_offset), length, FALSE); + // proto_item_append_text(ti, " dB"); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_effective_cinr_req_bit7, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_effective_cinr_req_bit8_13, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_zone_spec_effective_cinr_req_bit14_15, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_REQ_PREAMBLE_EFF_CINR_REQ: + /* decode and display the preamble effective cinr request */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, hf_rep_req_preamble_effective_cinr_request, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_preamble_effective_cinr_req_bit0_1, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_preamble_effective_cinr_req_bit2_7, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_REQ_CHANNEL_SELECTIVITY_REPORT: + /* decode and display the channel selectivity report */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, hf_rep_req_channel_selectivity_report, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_channel_selectivity_rep_bit0, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_req_channel_selectivity_rep_bit1_7, tvb, (offset + tlv_offset), length, FALSE); + break; + default: + /* display the unknown tlv in hex */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + break; + } + tlv_offset += length; + } /* end of TLV process for loop */ + break; + default: + /* display the unknown tlv in hex */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_req_decoder, rep_tree, hf_rep_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_rep_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ + } +} + +/* Wimax Mac REP-RSP Message Dissector */ +void dissect_mac_mgmt_msg_rep_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, length, value; + gint tlv_type, tlv_len, tlv_value_offset, tlv_offset; + gint db_val; + proto_item *rep_item = NULL; + proto_tree *rep_tree = NULL; + proto_tree *tlv_tree = NULL; + proto_item *ti = NULL; + proto_tree *ti_tree = NULL; + tlv_info_t tlv_info; + gfloat current_power; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_REP_RSP) + { + return; + } + + if(tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type REP-RSP */ + rep_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_rep_decoder, tvb, offset, tvb_len, "Report Response (REP-RSP) (%u bytes)", tvb_len); + /* add MAC REP-RSP subtree */ + rep_tree = proto_item_add_subtree(rep_item, ett_mac_mgmt_msg_rep_rsp_decoder); + /* Decode and display the Report Response message (REP-RSP) */ + /* display the Message Type */ + proto_tree_add_item(rep_tree, hf_rep_rsp_message_type, tvb, offset, 1, FALSE); + /* set the offset for the TLV Encoded info */ + offset++; + /* process the REP-RSP TLVs */ + while(offset < tvb_len) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-RSP TLV error"); + } + proto_tree_add_item(rep_tree, hf_rep_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(rep_tree, proto_mac_mgmt_msg_rep_decoder, tvb, offset, (tlv_len + tlv_value_offset), "REP-RSP Type: %u (%u bytes, offset=%u, tlv_len=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tlv_len, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* process REP-RSP TLV Encoded information (11.12) */ + switch (tlv_type) + { + case REP_RSP_REPORT_TYPE: + /* decode and display the Report type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_rsp_report_type, tvb, offset, tlv_len, FALSE); + for( tlv_offset = 0; tlv_offset < tlv_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset + tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-RSP report subtype TLV error"); + } + proto_tree_add_item(tlv_tree, hf_rep_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case REP_RSP_REPORT_CHANNEL_NUMBER: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_report_type_channel_number, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_channel_number, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_REPORT_START_FRAME: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_report_type_frame_number, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_frame_number, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_REPORT_DURATION: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_report_type_duration, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_duration, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_REPORT_BASIC_REPORT: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_report_type_basic_report, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_basic_report_bit0, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_basic_report_bit1, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_basic_report_bit2, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_basic_report_bit3, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_basic_report_reserved, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_REPORT_CINR_REPORT: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_report_type_cinr_report, tvb, (offset + tlv_offset), length, FALSE); + ti = proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_cinr_report_mean, tvb, (offset + tlv_offset), 1, FALSE); + db_val = tvb_get_guint8(tvb, offset + tlv_offset) - 20; + if (db_val > 37) + db_val = 37; + proto_item_append_text(ti, " (%d dBm)", db_val); + ti = proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_cinr_report_deviation, tvb, (offset + tlv_offset +1), 1, FALSE); + db_val = tvb_get_guint8(tvb, offset + tlv_offset + 1) - 20; + if (db_val > 37) + db_val = 37; + proto_item_append_text(ti, " (%d dBm)", db_val); + break; + case REP_RSP_REPORT_RSSI_REPORT: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_report_type_rssi_report, tvb, (offset + tlv_offset), length, FALSE); + ti = proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_rssi_report_mean, tvb, (offset + tlv_offset), 1, FALSE); + db_val = tvb_get_guint8(tvb, offset + tlv_offset) - 123; + if (db_val > -40) + db_val = -40; + proto_item_append_text(ti, " (%d dBm)", db_val); + ti = proto_tree_add_item(ti_tree, hf_rep_rsp_report_type_rssi_report_deviation, tvb, (offset + tlv_offset +1), 1, FALSE); + db_val = tvb_get_guint8(tvb, offset + tlv_offset + 1) - 123; + if (db_val > -40) + db_val = -40; + proto_item_append_text(ti, " (%d dBm)", db_val); + break; + default: + /* display the unknown tlv in hex */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + break; + } + tlv_offset += length; + } + break; + case REP_RSP_CHANNEL_TYPE: + /* decode and display the Channel Type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_rsp_channel_type_report, tvb, offset, tlv_len, FALSE); + for( tlv_offset = 0; tlv_offset < tlv_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset + tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-RSP channel subtype TLV error"); + } + proto_tree_add_item(tlv_tree, hf_rep_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case REP_RSP_CHANNEL_TYPE_SUBCHANNEL: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_channel_type_subchannel, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_channel_type_subchannel, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_CHANNEL_TYPE_BAND_AMC: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_channel_type_band_amc, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_channel_type_band_amc, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_CHANNEL_TYPE_SAFETY_CHANNEL: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_channel_type_safety_channel, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_channel_type_safety_channel, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_CHANNEL_TYPE_ENHANCED_BAND_AMC: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_channel_type_enhanced_band_amc, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_channel_type_enhanced_band_amc, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_CHANNEL_TYPE_SOUNDING: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_channel_type_sounding, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_channel_type_sounding, tvb, (offset + tlv_offset), length, FALSE); + break; + default: + /* display the unknown tlv in hex */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + break; + } + tlv_offset += length; + } + break; + case REP_RSP_ZONE_SPECIFIC_PHY_CINR: + /* decode and display the zone-specific physical CINR report type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_rsp_zone_spec_phy_cinr_report, tvb, offset, tlv_len, FALSE); + for( tlv_offset = 0; tlv_offset < tlv_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset + tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-RSP zone-specific phy CINR report subtype TLV error"); + } + proto_tree_add_item(tlv_tree, hf_rep_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case REP_RSP_ZONE_SPECIFIC_PHY_CINR_PUSC_SC0: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc0, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_mean, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_report_type, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1, tvb, (offset + tlv_offset), 1, FALSE); + if (length == 2) + { + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_deviation, tvb, (offset + tlv_offset + 1), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2, tvb, (offset + tlv_offset + 1), 1, FALSE); + } + break; + case REP_RSP_ZONE_SPECIFIC_PHY_CINR_PUSC_SC1: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc1, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_mean, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_report_type, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1, tvb, (offset + tlv_offset), 1, FALSE); + if (length == 2) + { + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_deviation, tvb, (offset + tlv_offset + 1), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2, tvb, (offset + tlv_offset + 1), 1, FALSE); + } + break; + case REP_RSP_ZONE_SPECIFIC_PHY_CINR_FUSC: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_fusc, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_mean, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_report_type, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1, tvb, (offset + tlv_offset), 1, FALSE); + if (length == 2) + { + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_deviation, tvb, (offset + tlv_offset + 1), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2, tvb, (offset + tlv_offset + 1), 1, FALSE); + } + break; + case REP_RSP_ZONE_SPECIFIC_PHY_CINR_OPTIONAL_FUSC: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_optional_fusc, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_mean, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_report_type, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1, tvb, (offset + tlv_offset), 1, FALSE); + if (length == 2) + { + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_deviation, tvb, (offset + tlv_offset + 1), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2, tvb, (offset + tlv_offset + 1), 1, FALSE); + } + break; + case REP_RSP_ZONE_SPECIFIC_PHY_CINR_SAFETY_CHANNEL: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_safety_channel, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_safety_channel, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_ZONE_SPECIFIC_PHY_CINR_AMC: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_amc, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_mean, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_report_type, tvb, (offset + tlv_offset), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1, tvb, (offset + tlv_offset), 1, FALSE); + if (length == 2) + { + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_deviation, tvb, (offset + tlv_offset + 1), 1, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2, tvb, (offset + tlv_offset + 1), 1, FALSE); + } + break; + default: + /* display the unknown tlv in hex */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + break; + } + tlv_offset += length; + } + break; + case REP_RSP_PREAMBLE_PHY_CINR: + /* decode and display the preamble physical CINR report type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_rsp_preamble_phy_cinr_report, tvb, offset, tlv_len, FALSE); + for( tlv_offset = 0; tlv_offset < tlv_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset + tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-RSP preamble physical CINR report subtype TLV error"); + } + proto_tree_add_item(tlv_tree, hf_rep_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case REP_RSP_PREAMBLE_PHY_CINR_CONFIGURATION1: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_preamble_phy_cinr_rep_configuration_1, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_mean, tvb, (offset + tlv_offset), 1, FALSE); + if (length == 2) + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_deviation, tvb, (offset + tlv_offset + 1), 1, FALSE); + break; + case REP_RSP_PREAMBLE_PHY_CINR_CONFIGURATION3: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_preamble_phy_cinr_rep_configuration_3, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_mean, tvb, (offset + tlv_offset), 1, FALSE); + if (length == 2) + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_phy_cinr_rep_deviation, tvb, (offset + tlv_offset + 1), 1, FALSE); + break; + case REP_RSP_PREAMBLE_PHY_CINR_BAND_AMC: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_preamble_phy_cinr_rep_band_amc_zone, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_preamble_phy_cinr_rep_band_amc_zone, tvb, (offset + tlv_offset), length, FALSE); + break; + default: + /* display the unknown tlv in hex */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + break; + } + tlv_offset += length; + } + break; + case REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR: + /* decode and display the zone-specific effective CINR report type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_rsp_zone_spec_effective_cinr_report, tvb, offset, tlv_len, FALSE); + for( tlv_offset = 0; tlv_offset < tlv_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset + tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-RSP zone-specific effective CINR report subtype TLV error"); + } + proto_tree_add_item(tlv_tree, hf_rep_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_PUSC_SC0: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc0, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_report_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_PUSC_SC1: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc1, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_report_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_FUSC: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_fusc, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_report_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_OPTIONAL_FUSC: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_optional_fusc, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_report_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_AMC_AAS: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_amc_aas, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_report_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id, tvb, (offset + tlv_offset), length, FALSE); + break; + default: + /* display the unknown tlv in hex */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + break; + } + tlv_offset += length; + } + break; + case REP_RSP_PREAMBLE_EFFECTIVE_CINR: + /* decode and display the preamble effective CINR report type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_rsp_preamble_effective_cinr_report, tvb, offset, tlv_len, FALSE); + for( tlv_offset = 0; tlv_offset < tlv_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset + tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REP-RSP preamble effective CINR report subtype TLV error"); + } + proto_tree_add_item(tlv_tree, hf_rep_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case REP_RSP_PREAMBLE_EFFECTIVE_CINR_CONFIGURATION1: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_preamble_effective_cinr_rep_configuration_1, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_preamble_effective_cinr_rep_cqich_id, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_PREAMBLE_EFFECTIVE_CINR_CONFIGURATION3: + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_rsp_preamble_effective_cinr_rep_configuration_3, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(ti_tree, hf_rep_rsp_preamble_effective_cinr_rep_cqich_id, tvb, (offset + tlv_offset), length, FALSE); + break; + case REP_RSP_CHANNEL_SELECTIVITY: + /* decode and display the channel selectivity report type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_rsp_channel_selectivity_report, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_rep_rsp_channel_selectivity_rep_frequency_a, tvb, (offset + tlv_offset + 2), 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rep_rsp_channel_selectivity_rep_frequency_b, tvb, (offset + tlv_offset + 1), 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rep_rsp_channel_selectivity_rep_frequency_c, tvb, (offset + tlv_offset), 1, FALSE); + break; + default: + /* display the unknown tlv in hex */ + ti_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + proto_tree_add_item(tlv_tree, hf_rep_unknown_type, tvb, (offset + tlv_offset), length, FALSE); + break; + } + tlv_offset += length; + } + break; + case CURRENT_TX_POWER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_unknown_type, tvb, offset, tlv_len, FALSE); + value = tvb_get_guint8(tvb, offset); + current_power = ((gfloat)value - 128) / 2; + ti = proto_tree_add_item(tlv_tree, hf_rep_rsp_current_transmitted_power, tvb, offset, tlv_len, FALSE); + proto_item_append_text(ti, " (%.1f dBm)", current_power); + break; + default: + /* display the unknown tlv in hex */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rep_rsp_decoder, rep_tree, hf_rep_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_rep_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ + } +} diff --git a/plugins/wimax/msg_res_cmd.c b/plugins/wimax/msg_res_cmd.c new file mode 100644 index 0000000000..3d8660af43 --- /dev/null +++ b/plugins/wimax/msg_res_cmd.c @@ -0,0 +1,177 @@ +/* msg_res_cmd.c + * WiMax MAC Management RES-CMD Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* +#define DEBUG // for debug only +*/ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +/* forward reference */ +void proto_register_mac_mgmt_msg_res_cmd(void); +void dissect_mac_mgmt_msg_res_cmd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_res_cmd_decoder = -1; +static gint ett_mac_mgmt_msg_res_cmd_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett_res_cmd[] = +{ + &ett_mac_mgmt_msg_res_cmd_decoder, +}; + +/* fix fields */ +static gint hf_res_cmd_message_type = -1; +static gint hf_res_cmd_unknown_type = -1; +static gint hf_res_cmd_invalid_tlv = -1; + +/* DSx display */ +static hf_register_info hf_res_cmd[] = +{ + { + &hf_res_cmd_message_type, + {"MAC Management Message Type", "wimax.macmgtmsgtype.res_cmd", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_res_cmd_invalid_tlv, + {"Invalid TLV", "wimax.res_cmd.invalid_tlv", FT_BYTES, BASE_HEX, NULL, 0, "", HFILL} + }, + { + &hf_res_cmd_unknown_type, + {"Unknown TLV type", "wimax.res_cmd.unknown_tlv_type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* Register Wimax Mac RES-CMD Message Dissector */ +void proto_register_mac_mgmt_msg_res_cmd(void) +{ + if (proto_mac_mgmt_msg_res_cmd_decoder == -1) + { + proto_mac_mgmt_msg_res_cmd_decoder = proto_register_protocol ( + "WiMax RES-CMD Message", /* name */ + "WiMax RES-CMD (res)", /* short name */ + "res" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_res_cmd_decoder, hf_res_cmd, array_length(hf_res_cmd)); + proto_register_subtree_array(ett_res_cmd, array_length(ett_res_cmd)); + } +} + +/* Wimax Mac RES-CMD Message Dissector */ +void dissect_mac_mgmt_msg_res_cmd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type; + gint tlv_type, tlv_len, tlv_value_offset; + proto_item *res_cmd_item = NULL; + proto_tree *res_cmd_tree = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_RES_CMD) + { + return; + } + + if(tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type RES-CMD */ + res_cmd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_res_cmd_decoder, tvb, offset, tvb_len, "Reset Command (RES-CMD) (%u bytes)", tvb_len); + /* add MAC RES-CMD subtree */ + res_cmd_tree = proto_item_add_subtree(res_cmd_item, ett_mac_mgmt_msg_res_cmd_decoder); + /* Decode and display the Reset Command (RES-CMD) */ + /* display the Message Type */ + proto_tree_add_item(res_cmd_tree, hf_res_cmd_message_type, tvb, offset, 1, FALSE); + /* set the offset for the TLV Encoded info */ + offset++; + /* process the RES-CMD TLVs */ + while(offset < tvb_len) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RES-CMD TLV error"); + } + proto_tree_add_item(res_cmd_tree, hf_res_cmd_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(res_cmd_tree, proto_mac_mgmt_msg_res_cmd_decoder, tvb, offset, (tlv_len + tlv_value_offset), "RES-CMD Type: %u (%u bytes, offset=%u, tlv_len=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tlv_len, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* process RES-CMD TLV Encoded information */ + switch (tlv_type) + { + case HMAC_TUPLE: /* Table 348d */ + /* decode and display the HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_res_cmd_decoder, res_cmd_tree, proto_mac_mgmt_msg_res_cmd_decoder, tvb, offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + wimax_hmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); + break; + case CMAC_TUPLE: /* Table 348b */ + /* decode and display the CMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_res_cmd_decoder, res_cmd_tree, proto_mac_mgmt_msg_res_cmd_decoder, tvb, offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len); + wimax_cmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); + break; + default: + /* display the unknown tlv in hex */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_res_cmd_decoder, res_cmd_tree, hf_res_cmd_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(res_cmd_tree, hf_res_cmd_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ + } +} diff --git a/plugins/wimax/msg_rng_req.c b/plugins/wimax/msg_rng_req.c new file mode 100644 index 0000000000..8ff68595d0 --- /dev/null +++ b/plugins/wimax/msg_rng_req.c @@ -0,0 +1,636 @@ +/* msg_rng_req.c + * WiMax MAC Management RNG-REQ Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint proto_wimax; +extern gboolean include_cor2_changes; + +extern gint man_ofdma; + +/* Forward reference */ +void dissect_mac_mgmt_msg_rng_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +gint proto_mac_mgmt_msg_rng_req_decoder = -1; +static gint ett_mac_mgmt_msg_rng_req_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_rng_req_decoder, +}; + +/* RNG-REQ fields */ +static gint hf_rng_req_message_type = -1; +static gint hf_rng_req_reserved = -1; +static gint hf_rng_req_dl_burst_profile_diuc = -1; +static gint hf_rng_req_dl_burst_profile_lsb_ccc = -1; +static gint hf_rng_req_ss_mac_address = -1; +static gint hf_rng_req_ranging_anomalies_max_power = -1; +static gint hf_rng_req_ranging_anomalies_min_power = -1; +static gint hf_rng_req_ranging_anomalies_timing_adj = -1; +static gint hf_rng_req_aas_broadcast = -1; +static gint hf_rng_req_serving_bs_id = -1; +static gint hf_rng_req_ranging_purpose_ho_indication = -1; +static gint hf_rng_req_ranging_purpose_location_update_request = -1; +static gint hf_rng_req_ranging_purpose_reserved = -1; +static gint hf_rng_req_ho_id = -1; +static gint hf_rng_req_power_down_indicator = -1; +static gint hf_rng_req_repetition_coding_level = -1; +static gint hf_rng_req_requested_downlink_repetition_coding_level_reserved = -1; +static gint hf_rng_req_cmac_key_count = -1; +static gint hf_rng_definition_of_power_saving_class_present = -1; +static gint hf_rng_activation_of_power_saving_class = -1; +static gint hf_rng_trf_ind_required = -1; +static gint hf_rng_power_saving_class_reserved = -1; +static gint hf_rng_power_saving_class_id = -1; +static gint hf_rng_power_saving_class_type = -1; +static gint hf_rng_power_saving_first_sleep_window_frame = -1; +static gint hf_rng_power_saving_initial_sleep_window = -1; +static gint hf_rng_power_saving_listening_window = -1; +static gint hf_rng_power_saving_final_sleep_window_base = -1; +static gint hf_rng_power_saving_final_sleep_window_exp = -1; +static gint hf_rng_power_saving_slpid = -1; +static gint hf_rng_power_saving_included_cid = -1; +static gint hf_rng_power_saving_mgmt_connection_direction = -1; +static gint hf_tlv_type = -1; +static gint hf_rng_invalid_tlv = -1; + +/* STRING RESOURCES */ + +static const true_false_string tfs_rng_req_aas_broadcast = { + "SS cannot receive broadcast messages", + "SS can receive broadcast messages" +}; + +static const value_string vals_rng_req_ranging_purpose_location_update_request[] = { + {1, "MS action of Idle Mode Location Update Process"}, + {0, NULL} +}; + +static const value_string vals_rng_req_repetition_coding_level[] = { + {0, "No repetition"}, + {1, "Repetition coding of 2"}, + {2, "Repetition coding of 4"}, + {3, "Repetition coding of 6"}, + {0, NULL} +}; + +static const true_false_string tfs_rng_activate = { + "Activate", + "Deactivate" +}; + +static const true_false_string tfs_rng_max_power = { + "SS is already at maximum power", + "SS is not at maximum power" +}; + +static const true_false_string tfs_rng_min_power = { + "SS is already at minimum power", + "SS is not at minimum power" +}; + +static const true_false_string tfs_rng_timing_adj = { + "Sum of commanded timing adjustments is too large", + "Sum of commanded timing adjustments is within bounds" +}; + +/* RNG-REQ fields display */ +static hf_register_info hf[] = +{ + { + &hf_rng_activation_of_power_saving_class, + { + "Activation of Power Saving Class (Types 1 and 2 only)", "wimax.rng.power_save.activate", + FT_BOOLEAN, 8, TFS(&tfs_rng_activate), 0x02, "", HFILL + } + }, + { + &hf_rng_power_saving_class_id, + { + "Power Saving Class ID", "wimax.rng.power_save.class_id", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_power_saving_class_type, + { + "Power Saving Class Type", "wimax.rng.power_save.class_type", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_definition_of_power_saving_class_present, + { + "Definition of Power Saving Class present", "wimax.rng.power_save.definition_present", + FT_UINT8, BASE_DEC, NULL, 0x01, "", HFILL + } + }, + { + &hf_rng_power_saving_final_sleep_window_base, + { + "Final-sleep window base (measured in frames)", "wimax.rng.power_save.final_sleep_window_base", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_power_saving_final_sleep_window_exp, + { + "Final-sleep window exponent (measured in frames)", "wimax.rng.power_save.final_sleep_window_exp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_power_saving_first_sleep_window_frame, + { + "Start frame number for first sleep window", "wimax.rng.power_save.first_sleep_window_frame", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_power_saving_included_cid, + { + "CID of connection to be included into the Power Saving Class.", "wimax.rng.power_save.included_cid", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_power_saving_initial_sleep_window, + { + "Initial-sleep window", "wimax.rng.power_save.initial_sleep_window", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_power_saving_listening_window, + { + "Listening window duration (measured in frames)", "wimax.rng.power_save.listening_window", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_power_saving_mgmt_connection_direction, + { + "Direction for management connection added to Power Saving Class", "wimax.rng.power_save.mgmt_connection_direction", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_power_saving_class_reserved, + { + "Reserved", "wimax.rng.power_save.reserved", + FT_UINT8, BASE_DEC, NULL, 0xF8, "", HFILL + } + }, + { + &hf_rng_power_saving_slpid, + { + "SLPID assigned by the BS whenever an MS is instructed to enter sleep mode", "wimax.rng.power_save.slpid", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_trf_ind_required, + { + "BS shall transmit at least one TRF-IND message during each listening window of the Power Saving Class", "wimax.rng.power_save.trf_ind_required", + FT_BOOLEAN, 8, TFS(&tfs_rng_activate), 0x04, "", HFILL + } + }, + { + &hf_rng_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.rng_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_req_aas_broadcast, + { + "AAS broadcast capability", "wimax.rng_req.aas_broadcast", + FT_BOOLEAN, 8, TFS(&tfs_rng_req_aas_broadcast), 0x00, "", HFILL + } + }, + { + &hf_rng_req_ranging_anomalies_max_power, + { + "Meaning", "wimax.rng_req.anomalies.max_power", + FT_BOOLEAN, 8, TFS(&tfs_rng_max_power), 0x04, "", HFILL + } + }, + { + &hf_rng_req_ranging_anomalies_min_power, + { + "Meaning", "wimax.rng_req.anomalies.min_power", + FT_BOOLEAN, 8, TFS(&tfs_rng_min_power), 0x02, "", HFILL + } + }, + { + &hf_rng_req_ranging_anomalies_timing_adj, + { + "Meaning", "wimax.rng_req.anomalies.timing_adj", + FT_BOOLEAN, 8, TFS(&tfs_rng_timing_adj), 0x01, "", HFILL + } + }, + { + &hf_rng_req_cmac_key_count, + { + "CMAC Key Count", "wimax.rng_req.cmac_key_count", + FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_req_dl_burst_profile_lsb_ccc, + { + "LSB of CCC of DCD associated with DIUC", "wimax.rng_req.dl_burst_profile.ccc", + FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL + } + }, + { + &hf_rng_req_dl_burst_profile_diuc, + { + "DIUC", "wimax.rng_req.dl_burst_profile.diuc", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, + { + &hf_tlv_type, + { + "Unknown TLV Type", "wimax.rng_req.unknown_tlv_type", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_rng_invalid_tlv, + { + "Invalid TLV", "wimax.rng_req.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_rng_req_ho_id, + { + "ID from the target BS for use in initial ranging during MS handover to it", "wimax.rng_req.ho_id", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_req_power_down_indicator, + { + "Power down Indicator", "wimax.rng_req.power_down_indicator", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_req_ranging_purpose_ho_indication, + { + "MS HO indication", "wimax.rng_req.ranging_purpose.ho_indication", + FT_UINT8, BASE_DEC, NULL, 0x01, "", HFILL + } + }, + { + &hf_rng_req_ranging_purpose_reserved, + { + "Reserved", "wimax.rng_req.ranging_purpose.reserved", + FT_UINT8, BASE_DEC, NULL, 0xFC, "", HFILL + } + }, + { + &hf_rng_req_ranging_purpose_location_update_request, + { + "Location Update Request", "wimax.rng_req.ranging_purpose.loc_update_req", + FT_UINT8, BASE_DEC, VALS(vals_rng_req_ranging_purpose_location_update_request), 0x02, "", HFILL + } + }, + { + &hf_rng_req_repetition_coding_level, + { + "Repetition coding level", "wimax.rng_req.repetition_coding_level", + FT_UINT8, BASE_DEC, VALS(vals_rng_req_repetition_coding_level), 0x03, "", HFILL + } + }, + { + &hf_rng_req_requested_downlink_repetition_coding_level_reserved, + { + "Reserved", "wimax.rng_req.reserved", + FT_UINT8, BASE_DEC, NULL, 0xFC, "", HFILL + } + }, + { + &hf_rng_req_reserved, + { + "Reserved", "wimax.rng_req.reserved", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_req_serving_bs_id, + { + "Former serving BS ID", "wimax.rng_req.serving_bs_id", + FT_ETHER, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_req_ss_mac_address, + { + "SS MAC Address", "wimax.rng_req.ss_mac_address", + FT_ETHER, BASE_HEX, NULL, 0x00, "", HFILL + } + } +}; + +/* Decode RNG Power Saving Class parameters (Sub TLV's). */ +void dissect_power_saving_class(proto_tree *rng_req_tree, gint tlv_type, tvbuff_t *tvb, guint compound_tlv_len, packet_info *pinfo, guint offset) +{ + proto_item *tlv_item = NULL; + proto_tree *tlv_tree = NULL; + proto_tree *power_saving_class_tree = NULL; + guint tlv_len; + guint tlv_offset; + tlv_info_t tlv_info; + + /* Add a subtree for the power saving class parameters */ + tlv_item = proto_tree_add_protocol_format(rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, offset, compound_tlv_len, "Power saving class parameters (%u bytes)", compound_tlv_len); + power_saving_class_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_rng_req_decoder); + + /* Update the compound_tlv_len to include the offset */ + compound_tlv_len += offset; + + while(offset < compound_tlv_len) + { + /* Get the TLV data. */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-REQ TLV error"); + } + proto_tree_add_item(power_saving_class_tree, hf_rng_invalid_tlv, tvb, offset, (compound_tlv_len - offset), FALSE); + break; + } + /* get the offset to the TLV data */ + tlv_offset = offset + get_tlv_value_offset(&tlv_info); + + switch (tlv_type) { + case RNG_POWER_SAVING_CLASS_FLAGS: + /* display Power Saving Class Flags */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, tlv_offset, tlv_len, "Power Saving Class (%u byte)", tlv_len); + proto_tree_add_item(tlv_tree, hf_rng_definition_of_power_saving_class_present, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_activation_of_power_saving_class, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_trf_ind_required, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_class_reserved, tvb, tlv_offset, 1, FALSE); + break; + case RNG_POWER_SAVING_CLASS_ID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_class_id, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_class_id, tvb, tlv_offset, 1, FALSE); + break; + case RNG_POWER_SAVING_CLASS_TYPE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_class_type, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_class_type, tvb, tlv_offset, 1, FALSE); + break; + case RNG_START_FRAME_NUMBER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_first_sleep_window_frame, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_first_sleep_window_frame, tvb, tlv_offset, 1, FALSE); + break; + case RNG_INITIAL_SLEEP_WINDOW: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_initial_sleep_window, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_initial_sleep_window, tvb, tlv_offset, 1, FALSE); + break; + case RNG_LISTENING_WINDOW: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_listening_window, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_listening_window, tvb, tlv_offset, 1, FALSE); + break; + case RNG_FINAL_SLEEP_WINDOW_BASE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_final_sleep_window_base, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_final_sleep_window_base, tvb, tlv_offset, 1, FALSE); + break; + case RNG_FINAL_SLEEP_WINDOW_EXPONENT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_final_sleep_window_exp, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_final_sleep_window_exp, tvb, tlv_offset, 1, FALSE); + break; + case RNG_SLPID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_slpid, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_slpid, tvb, tlv_offset, 1, FALSE); + break; + case RNG_CID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_included_cid, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_included_cid, tvb, tlv_offset, 2, FALSE); + break; + case RNG_DIRECTION: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_rng_power_saving_mgmt_connection_direction, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_power_saving_mgmt_connection_direction, tvb, tlv_offset, 1, FALSE); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, power_saving_class_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + break; + } + /* update the offset */ + offset = tlv_len + tlv_offset; + } /* end of TLV process while loop */ +} + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_rng_req(void) +{ + if (proto_mac_mgmt_msg_rng_req_decoder == -1) + { + proto_mac_mgmt_msg_rng_req_decoder = proto_register_protocol ( + "WiMax RNG-REQ/RSP Messages", /* name */ + "WiMax RNG-REQ/RSP (rng)", /* short name */ + "rng" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_rng_req_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode RNG-REQ messages. */ +void dissect_mac_mgmt_msg_rng_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tlv_offset; + guint tvb_len, payload_type; + proto_item *rng_req_item = NULL; + proto_tree *rng_req_tree = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + gint tlv_type; + gint tlv_len; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_RNG_REQ) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type RNG-REQ */ + rng_req_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, offset, tvb_len, "MAC Management Message, RNG-REQ (4)"); + /* add MAC RNG-REQ subtree */ + rng_req_tree = proto_item_add_subtree(rng_req_item, ett_mac_mgmt_msg_rng_req_decoder); + /* display the Message Type */ + proto_tree_add_item(rng_req_tree, hf_rng_req_message_type, tvb, offset, 1, FALSE); + proto_tree_add_item(rng_req_tree, hf_rng_req_reserved, tvb, 1, 1, FALSE); + offset += 2; + + while(offset < tvb_len) + { + /* Get the TLV data. */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-REQ TLV error"); + } + proto_tree_add_item(rng_req_tree, hf_rng_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the offset to the TLV data */ + tlv_offset = offset + get_tlv_value_offset(&tlv_info); + + switch (tlv_type) { + case RNG_REQ_DL_BURST_PROFILE: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, tlv_offset, tlv_len, "Requested Downlink Burst Profile 0x%02x", tvb_get_guint8(tvb, tlv_offset)); + proto_tree_add_item(tlv_tree, hf_rng_req_dl_burst_profile_diuc, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_dl_burst_profile_lsb_ccc, tvb, tlv_offset, 1, FALSE); + break; + case RNG_REQ_SS_MAC_ADDRESS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_rng_req_ss_mac_address, tvb, tlv_offset, 6, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_ss_mac_address, tvb, tlv_offset, 6, FALSE); + break; + case RNG_REQ_RANGING_ANOMALIES: + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, tlv_offset, tlv_len, "Ranging Anomalies %d", tvb_get_guint8(tvb, tlv_offset)); + proto_tree_add_item(tlv_tree, hf_rng_req_ranging_anomalies_max_power, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_ranging_anomalies_min_power, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_ranging_anomalies_timing_adj, tvb, tlv_offset, 1, FALSE); + break; + case RNG_REQ_AAS_BROADCAST: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_rng_req_aas_broadcast, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_aas_broadcast, tvb, tlv_offset, 1, FALSE); + break; + case RNG_REQ_SERVING_BS_ID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_rng_req_serving_bs_id, tvb, tlv_offset, 6, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_serving_bs_id, tvb, tlv_offset, 6, FALSE); + break; + case RNG_REQ_RANGING_PURPOSE_INDICATION: + /* display the Ranging Purpose Flags */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, tlv_offset, tlv_len, "Ranging Purpose Flags (%u byte(s))", tlv_len); + proto_tree_add_item(tlv_tree, hf_rng_req_ranging_purpose_ho_indication, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_ranging_purpose_location_update_request, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_ranging_purpose_reserved, tvb, tlv_offset, 1, FALSE); + break; + case RNG_REQ_HO_ID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_rng_req_ho_id, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_ho_id, tvb, tlv_offset, 1, FALSE); + break; + case RNG_REQ_POWER_DOWN_INDICATOR: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_rng_req_power_down_indicator, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_power_down_indicator, tvb, tlv_offset, 1, FALSE); + break; + case RNG_REQ_REQUESTED_DNLK_REP_CODING_LEVEL: + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, tlv_offset, tlv_len, "Requested downlink repetition coding level (%u byte(s))", tlv_len); + proto_tree_add_item(tlv_tree, hf_rng_req_repetition_coding_level, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_requested_downlink_repetition_coding_level_reserved, tvb, tlv_offset, 1, FALSE); + break; + case RNG_REQ_CMAC_KEY_COUNT: + if (include_cor2_changes) { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_rng_req_cmac_key_count, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_req_cmac_key_count, tvb, tlv_offset, 2, FALSE); + } else { + /* Unknown TLV type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + } + break; + case SHORT_HMAC_TUPLE: + case SHORT_HMAC_TUPLE_COR2: + if ((!include_cor2_changes && (tlv_type == SHORT_HMAC_TUPLE)) || + (include_cor2_changes && (tlv_type == SHORT_HMAC_TUPLE_COR2))) { + /* decode and display the Short HMAC Tuple */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, tlv_offset, tlv_len, "Short HMAC Tuple (%u byte(s))", tlv_len); + wimax_short_hmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tvb_len - offset); + } else { + /* Unknown TLV Type */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + } + break; + case MAC_VERSION_ENCODING: + offset += wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, rng_req_tree); + continue; + break; + case RNG_REQ_POWER_SAVING_CLASS_PARAMETERS: + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, tlv_offset, tlv_len, "Power Saving Class Parameters (%u byte(s))", tlv_len); + dissect_power_saving_class(tlv_tree, tlv_type, tvb, tlv_len, pinfo, tlv_offset); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + break; + } + /* update the offset */ + offset = tlv_len + tlv_offset; + } /* end of TLV process while loop */ + } +} diff --git a/plugins/wimax/msg_rng_rsp.c b/plugins/wimax/msg_rng_rsp.c new file mode 100644 index 0000000000..517ff83804 --- /dev/null +++ b/plugins/wimax/msg_rng_rsp.c @@ -0,0 +1,995 @@ +/* msg_rng_rsp.c + * WiMax MAC Management RNG-RSP Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: John R. Underwood <junderx@yahoo.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +extern gint proto_mac_mgmt_msg_rng_req_decoder; +extern gboolean include_cor2_changes; + +/* forward reference */ +void dissect_mac_mgmt_msg_rng_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +/* external reference */ +extern void dissect_power_saving_class(proto_tree *rng_req_tree, gint tlv_type, tvbuff_t *tvb, guint compound_tlv_len, packet_info *pinfo, guint offset); +extern void dissect_mac_mgmt_msg_sbc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_mgmt_msg_reg_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_rng_rsp_decoder = -1; +static gint ett_mac_mgmt_msg_rng_rsp_decoder = -1; +static gint ett_rng_rsp_message_tree = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_rng_rsp_decoder, + &ett_rng_rsp_message_tree +}; + +/* RNG-RSP fields */ +static gint hf_rng_rsp_message_type = -1; +static gint hf_rng_req_reserved = -1; +static gint hf_rng_rsp_ul_channel_id = -1; +static gint hf_rng_rsp_timing_adjust = -1; +static gint hf_rng_rsp_power_level_adjust = -1; +static gint hf_rng_rsp_offset_freq_adjust = -1; +static gint hf_rng_rsp_ranging_status = -1; +static gint hf_rng_rsp_dl_freq_override = -1; +static gint hf_rng_rsp_ul_chan_id_override = -1; +static gint hf_rng_rsp_dl_operational_burst_profile = -1; +static gint hf_rng_rsp_dl_operational_burst_profile_diuc = -1; +static gint hf_rng_rsp_dl_operational_burst_profile_ccc = -1; +static gint hf_rng_rsp_ss_mac_address = -1; +static gint hf_rng_rsp_basic_cid = -1; +static gint hf_rng_rsp_primary_mgmt_cid = -1; +static gint hf_rng_rsp_broadcast = -1; +static gint hf_rng_rsp_frame_number = -1; +static gint hf_rng_rsp_opportunity_number = -1; +static gint hf_rng_rsp_service_level_prediction = -1; +static gint hf_rng_rsp_resource_retain_flag = -1; +static gint hf_rng_rsp_ho_process_optimization = -1; +static gint hf_rng_rsp_ho_process_optimization_0 = -1; +static gint hf_rng_rsp_ho_process_optimization_1_2 = -1; +static gint hf_rng_rsp_ho_process_optimization_3 = -1; +static gint hf_rng_rsp_ho_process_optimization_4 = -1; +static gint hf_rng_rsp_ho_process_optimization_5 = -1; +static gint hf_rng_rsp_ho_process_optimization_6 = -1; +static gint hf_rng_rsp_ho_process_optimization_7 = -1; +static gint hf_rng_rsp_ho_process_optimization_8 = -1; +static gint hf_rng_rsp_ho_process_optimization_9 = -1; +static gint hf_rng_rsp_ho_process_optimization_10 = -1; +static gint hf_rng_rsp_ho_process_optimization_11 = -1; +static gint hf_rng_rsp_ho_process_optimization_12 = -1; +static gint hf_rng_rsp_ho_process_optimization_13 = -1; +static gint hf_rng_rsp_ho_process_optimization_14 = -1; +static gint hf_rng_rsp_ho_process_optimization_15 = -1; +/* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */ +static gint hf_rng_rsp_dl_op_burst_profile_ofdma = -1; +static gint hf_rng_rsp_least_robust_diuc = -1; +static gint hf_rng_rsp_repetition_coding_indication = -1; +static gint hf_rng_rsp_config_change_count_of_dcd = -1; +/* Added the following to help implement RNG-RSP message encoding 22 (Table 367 in IEEE 802.16e-2007) */ +static gint hf_rng_rsp_ho_id = -1; +static gint hf_rng_rsp_location_update_response = -1; +/* Added the following to help implement RNG-RSP message encoding 24 (Table 367 in IEEE 802.16e-2007) */ +static gint hf_rng_rsp_paging_information = -1; +static gint hf_rng_rsp_paging_cycle = -1; +static gint hf_rng_rsp_paging_offset = -1; +static gint hf_rng_rsp_paging_group_id = -1; +static gint hf_rng_rsp_bs_random = -1; +static gint hf_rng_rsp_akid = -1; +static gint hf_rng_rsp_ranging_subchan = -1; +static gint hf_rng_rsp_time_symbol_reference = -1; +static gint hf_rng_rsp_subchannel_reference = -1; +static gint hf_rng_rsp_ranging_code_index = -1; +static gint hf_rng_rsp_frame_number2 = -1; +static gint hf_tlv_type = -1; +static gint hf_tlv_value = -1; +static gint hf_rng_invalid_tlv = -1; + +/* STRING RESOURCES */ + +static const true_false_string tfs_rng_rsp_aas_broadcast = { + "SS shall not issue contention-based Bandwidth Request", + "SS may issue contention-based Bandwidth Request" +}; + +static const true_false_string tfs_rng_rsp_resource_retain_flag = { + "Retained by the BS", + "Deleted by the BS" +}; + +static const value_string vals_rng_rsp_ranging_status[] = { + {1, "continue"}, + {2, "abort"}, + {3, "success"}, + {4, "rerange"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_level_of_service[] = { + {0, "No service possible for this MS"}, + {1, "Some service is available for one or" + " several service flows authorized for the MS"}, + {2, "For each authorized service flow, a MAC" + " connection can be established with QoS" + " specified by the AuthorizedQoSParamSet"}, + {3, "No service level prediction available"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_0[] = { + {0, "SBC-REQ management messages during current re-entry" + " processing required"}, + {1, "Omit SBC-REQ management messages during current" + " re-entry processing"}, + {0, NULL}, +}; + +static const value_string vals_rng_rsp_ho_process_optimization_1_2[] = { + {0, "Perform re-authentication and SA-TEK 3-way handshake." + " BS should include SA-TEK-Update TLV in the" + " SA-TEK-Response message. In addition, the RNG-RSP" + " message does not include SA-TEK-Update TLV or SA" + " Challenge Tuple TLV."}, + {1, "SA-TEK-Update TLV is included in the RNG-RSP message." + " In this case, SA-TEK 3-way handshake is avoided and" + " SA Challenge Tuple TLV shall not be included in the" + " RNG-RSP message."}, + {2, "Reserved"}, + {3, "Re-authentication and SA-TEK 3-way handshake is not" + " performed. The RNG-RSP message does not include" + " SA-TEK-Update TLV nor SA Challenge Tuple TLV. All the" + " TEKs received from the serving BS are reused"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_3[] = { + {0, "Network Address Acquisition management messages during" + " current reentry processing required"}, + {1, "Omit Network Address Acquisition management messages" + " during current reentry processing"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_4[] = { + {0, "Time of Day Acquisition management messages during" + " current reentry processing required"}, + {1, "Omit Time of Day Acquisition management messages" + " during current reentry processing"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_5[] = { + {0, "TFTP management messages during current re-entry" + " processing required"}, + {1, "Omit TFTP management messages during current re-entry" + " processing"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_6[] = { + {0, "Full service and operational state transfer or sharing" + " between Serving BS and Target BS required"}, + {1, "Omit Full service and operational state transfer or" + " sharing between Serving BS and Target BS"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_7[] = { + {0, "REG-REQ management message during current re-entry" + " processing required"}, + {1, "Omit REG-REQ management message during current re-entry" + " processing"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_8[] = { + {0, "BS shall send not send an unsolicited SBC-RSP" + " management message"}, + {1, "BS shall send an unsolicited SBC-RSP management message"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_9[] = { + {0, "No post-HO re-entry MS DL data pending at target BS"}, + {1, "post-HO re-entry MS DL data pending at target BS"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_10[] = { + {0, "BS shall not send an unsolicited REG-RSP management" + " message"}, + {1, "BS shall send an unsolicited REG-RSP management message"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_11[] = { + {0, "(Target) BS does not support virtual SDU SN"}, + {1, "(Target} BS supports virtual SDU SN"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_12[] = { + {0, "MS shall not send a notification of MS's successful" + " re-entry registration"}, + {1, "MS shall send a notification of MS's successful" + " re-entry registration"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_ho_process_optimization_13[] = { + {0, "MS shall not trigger a higher layer protocol required" + " to refresh its traffic IP address"}, + {1, "MS shall trigger a higher layer protocol required to" + " refresh its traffic IP address"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_repetition_coding_indication[] = { + {0, "No repetition coding"}, + {1, "Repetition coding of 2"}, + {2, "Repetition coding of 4"}, + {3, "Repetition coding of 6"}, + {0, NULL} +}; + +static const value_string vals_rng_rsp_location_update_response[] = { + {0, "Success of Location Update"}, + {1, "Failure of Location Update"}, + {3, "Success of location update and DL traffic pending"}, + {4, "Reserved"}, + {0, NULL} +}; + +/* RNG-RSP fields display */ +static hf_register_info hf[] = +{ + { + &hf_rng_rsp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.rng_rsp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_rsp_broadcast, + { + "AAS broadcast permission", "wimax.rng_rsp.aas_broadcast", + FT_BOOLEAN, 8, TFS(&tfs_rng_rsp_aas_broadcast), 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_akid, + { + "AKId", "wimax.rng_rsp.akid", + FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_basic_cid, + { + "Basic CID", "wimax.rng_rsp.basic_cid", + FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_bs_random, + { + "BS_Random", "wimax.rng_rsp.bs_random", + FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_config_change_count_of_dcd, + { + "Configuration Change Count value of DCD defining DIUC associated burst profile", "wimax.rng_rsp.config_change_count_of_dcd", + FT_UINT16, BASE_HEX, NULL, 0xFF00, "", HFILL + } + }, + { + &hf_rng_rsp_dl_freq_override, + { + "Downlink Frequency Override", "wimax.rng_rsp.dl_freq_override", + FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_dl_operational_burst_profile_ccc, + { + "CCC value of DCD defining the burst profile associated with DIUC", "wimax.rng_rsp.dl_op_burst_prof.ccc", + FT_UINT16, BASE_DEC, NULL, 0x00FF, "", HFILL + } + }, + { + &hf_rng_rsp_dl_operational_burst_profile_diuc, + { + "The least robust DIUC that may be used by the BS for transmissions to the SS", "wimax.rng_rsp.dl_op_burst_prof.diuc", + FT_UINT16, BASE_DEC, NULL, 0xFF00, "", HFILL + } + }, + { + &hf_rng_rsp_dl_operational_burst_profile, + { + "Downlink Operational Burst Profile", "wimax.rng_rsp.dl_op_burst_profile", + FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + /* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */ + { + &hf_rng_rsp_dl_op_burst_profile_ofdma, + { + "Downlink Operational Burst Profile for OFDMA", "wimax.rng_rsp.dl_op_burst_profile_ofdma", + FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_frame_number2, + { + "The 8 least significant bits of the frame number of the OFDMA frame where the SS sent the ranging code", "wimax.rng_rsp.eight_bit_frame_num", + FT_UINT32, BASE_DEC, NULL, 0x000000FF, "", HFILL + } + }, + { + &hf_rng_rsp_frame_number, + { + "Frame number", "wimax.rng_rsp.frame_number", + FT_UINT24, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + /* Added the following to help implement RNG-RSP message encoding 22 (IEEE 802.16e-2007) */ + { + &hf_rng_rsp_ho_id, + { + "HO ID", "wimax.rng_rsp.ho_id", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization, + { + "HO Process Optimization", "wimax.rng_rsp.ho_process_optimization", + FT_UINT16, BASE_HEX, NULL, 0x0000, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_0, + { + "Bit #0", "wimax.rng_rsp.ho_process_optimization.omit_sbc_req", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_0), 0x0001, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_1_2, + { + "Bits #1-2", "wimax.rng_rsp.ho_process_optimization.perform_reauthentication", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_1_2), 0x0006, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_3, + { + "Bit #3", "wimax.rng_rsp.ho_process_optimization.omit_network_address", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_3), 0x0008, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_4, + { + "Bit #4", "wimax.rng_rsp.ho_process_optimization.omit_time_of_day", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_4), 0x0010, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_5, + { + "Bit #5", "wimax.rng_rsp.ho_process_optimization.omit_tftp", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_5), 0x0020, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_6, + { + "Bit #6", "wimax.rng_rsp.ho_process_optimization.transfer_or_sharing", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_6), 0x0040, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_7, + { + "Bit #7", "wimax.rng_rsp.ho_process_optimization.omit_reg_req", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_7), 0x0080, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_8, + { + "Bit #8", "wimax.rng_rsp.ho_process_optimization.unsolicited_sbc_rsp", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_8), 0x0100, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_9, + { + "Bit #9", "wimax.rng_rsp.ho_process_optimization.post_ho_reentry", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_9), 0x0200, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_10, + { + "Bit #10", "wimax.rng_rsp.ho_process_optimization.unsolicited_reg_rsp", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_10), 0x0400, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_11, + { + "Bit #11", "wimax.rng_rsp.ho_process_optimization.virtual_sdu_sn", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_11), 0x0800, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_12, + { + "Bit #12", "wimax.rng_rsp.ho_process_optimization.send_notification", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_12), 0x1000, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_13, + { + "Bit #13", "wimax.rng_rsp.ho_process_optimization.trigger_higher_layer_protocol", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_13), 0x2000, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_14, + { + "Bit #14: Reserved", "wimax.rng_rsp.ho_process_optimization.reserved", + FT_UINT16, BASE_HEX, NULL, 0x4000, "", HFILL + } + }, + { + &hf_rng_rsp_ho_process_optimization_15, + { + "Bit #15: Reserved", "wimax.rng_rsp.ho_process_optimization.reserved", + FT_UINT16, BASE_HEX, NULL, 0x8000, "", HFILL + } + }, + { + &hf_rng_invalid_tlv, + { + "Invalid TLV", "wimax.rng_rsp.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_rng_rsp_least_robust_diuc, + { + "Least Robust DIUC that may be used by the BS for transmissions to the MS", "wimax.rng_rsp.least_robust_diuc", + FT_UINT16, BASE_HEX, NULL, 0x000F, "", HFILL + } + }, + { + &hf_rng_rsp_location_update_response, + { + "Location Update Response", "wimax.rng_rsp.location_update_response", + FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_location_update_response), 0xFF, "", HFILL + } + }, + { + &hf_rng_rsp_offset_freq_adjust, + { + "Offset Frequency Adjust", "wimax.rng_rsp.offset_freq_adjust", + FT_INT32, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_opportunity_number, + { + "Initial ranging opportunity number", "wimax.rng_rsp.opportunity_number", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_paging_cycle, + { + "Paging Cycle", "wimax.rng_rsp.paging_cycle", + FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_paging_group_id, + { + "Paging Group ID", "wimax.rng_rsp.paging_group_id", + FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_paging_information, + { + "Paging Information", "wimax.rng_rsp.paging_information", + FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_paging_offset, + { + "Paging Offset", "wimax.rng_rsp.paging_offset", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_power_level_adjust, + { + "Power Level Adjust", "wimax.rng_rsp.power_level_adjust", + FT_FLOAT, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_primary_mgmt_cid, + { + "Primary Management CID", "wimax.rng_rsp.primary_mgmt_cid", + FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_ranging_code_index, + { + "The ranging code index that was sent by the SS", "wimax.rng_rsp.ranging_code_index", + FT_UINT32, BASE_DEC, NULL, 0x0000FF00, "", HFILL + } + }, + { + &hf_rng_rsp_ranging_status, + { + "Ranging status", "wimax.rng_rsp.ranging_status", + FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_ranging_status), 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_ranging_subchan, + { + "Ranging code attributes", "wimax.rng_rsp.ranging_subchannel", + FT_UINT32, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_repetition_coding_indication, + { + "Repetition Coding Indication", "wimax.rng_rsp.repetition_coding_indication", + FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_repetition_coding_indication), 0x00F0, "", HFILL + } + }, + { + &hf_rng_req_reserved, + { + "Reserved", "wimax.rng_rsp.reserved", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_rng_rsp_resource_retain_flag, + { + "The connection information for the MS is", "wimax.rng_rsp.resource_retain_flag", + FT_BOOLEAN, 8, TFS(&tfs_rng_rsp_resource_retain_flag), 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_service_level_prediction, + { + "Service Level Prediction", "wimax.rng_rsp.service_level_prediction", + FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_level_of_service), 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_ss_mac_address, + { + "SS MAC Address", "wimax.rng_rsp.ss_mac_address", + FT_ETHER, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_subchannel_reference, + { + "OFDMA subchannel reference used to transmit the ranging code", "wimax.rng_rsp.subchannel_reference", + FT_UINT32, BASE_DEC, NULL, 0x003f0000, "", HFILL + } + }, + { + &hf_rng_rsp_time_symbol_reference, + { + "OFDM time symbol reference used to transmit the ranging code", "wimax.rng_rsp.time_symbol_reference", + FT_UINT32, BASE_DEC, NULL, 0xFFC00000, "", HFILL + } + }, + { + &hf_rng_rsp_timing_adjust, + { + "Timing Adjust", "wimax.rng_rsp.timing_adjust", + FT_FLOAT, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_ul_channel_id, + { + "Uplink Channel ID", "wimax.rng_rsp.ul_chan_id", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_rng_rsp_ul_chan_id_override, + { + "Uplink channel ID Override", "wimax.rng_rsp.ul_chan_id_override", + FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + } + }, + { + &hf_tlv_type, + { + "Unknown TLV Type", "wimax.rng_rsp.unknown_tlv_type", + FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL + } + }, + { + &hf_tlv_value, + { + "Value", "wimax.rng_rsp.tlv_value", + FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_rng_rsp(void) +{ + if (proto_mac_mgmt_msg_rng_rsp_decoder == -1) + { + proto_mac_mgmt_msg_rng_rsp_decoder = proto_mac_mgmt_msg_rng_req_decoder; + + proto_register_field_array(proto_mac_mgmt_msg_rng_rsp_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* Decode RNG-RSP messages. */ +void dissect_mac_mgmt_msg_rng_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_item *ranging_status_item = NULL; + proto_item *dl_freq_override_item = NULL; + proto_item *ss_mac_address_item = NULL; + proto_item *frame_number_item = NULL; + proto_item *opportunity_number_item = NULL; + + guint offset = 0; + guint tlv_offset; + guint tvb_len, payload_type; + proto_item *rng_rsp_item = NULL; + proto_item *tlv_item = NULL; + proto_tree *rng_rsp_tree = NULL; + proto_tree *sub_tree = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + gint tlv_type; + guint tlv_len; + guint this_offset = 0; + tlv_info_t sub_tlv_info; + gint sub_tlv_type; + gint sub_tlv_len; + guint sub_tlv_offset; + float timing_adjust; + float power_level_adjust; + gint offset_freq_adjust; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_RNG_RSP) + { + return; + } + + if (tree) + { /* we are being asked for details */ + + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type RNG-RSP */ + rng_rsp_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, offset, tvb_len, "MAC Management Message, RNG-RSP (5)"); + /* add MAC RNG-RSP subtree */ + rng_rsp_tree = proto_item_add_subtree(rng_rsp_item, ett_mac_mgmt_msg_rng_rsp_decoder); + /* display the Message Type */ + proto_tree_add_item(rng_rsp_tree, hf_rng_rsp_message_type, tvb, offset, 1, FALSE); + proto_tree_add_item(rng_rsp_tree, hf_rng_req_reserved, tvb, 1, 1, FALSE); + offset += 2; + + while(offset < tvb_len) + { + /* Get the TLV data. */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-RSP TLV error"); + } + proto_tree_add_item(rng_rsp_tree, hf_rng_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the offset to the TLV data */ + tlv_offset = offset + get_tlv_value_offset(&tlv_info); + + switch (tlv_type) { + case RNG_RSP_TIMING_ADJUST: { + sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Timing Adjust (%u byte(s))", tlv_len); + timing_adjust = (float)(gint32)tvb_get_ntohl(tvb, tlv_offset) / 4; + tlv_item = proto_tree_add_float_format_value(sub_tree, hf_rng_rsp_timing_adjust, tvb, + tlv_offset, 4, timing_adjust, " %.2f modulation symbols", timing_adjust); + if ((timing_adjust < -2) || (timing_adjust > 2)) + proto_item_append_text(tlv_item, " (during periodic ranging shall not exceed +- 2)"); + break; + } + case RNG_RSP_POWER_LEVEL_ADJUST: { + sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Power Level Adjust (%u byte(s))", tlv_len); + power_level_adjust = (float)(gint8)tvb_get_guint8(tvb, tlv_offset) / 4; + proto_tree_add_float_format_value(sub_tree, hf_rng_rsp_power_level_adjust, tvb, tlv_offset, 1, + power_level_adjust, " %.2f dB", power_level_adjust); + break; + } + case RNG_RSP_OFFSET_FREQ_ADJUST: { + sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Offset Frequency Adjust (%u byte(s))", tlv_len); + offset_freq_adjust = tvb_get_ntohl(tvb, tlv_offset); + proto_tree_add_int_format_value(sub_tree, hf_rng_rsp_offset_freq_adjust, tvb, tlv_offset, 4, + offset_freq_adjust, " %d Hz", offset_freq_adjust); + break; + } + case RNG_RSP_RANGING_STATUS: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ranging_status, tvb, tlv_offset, 1, FALSE); + ranging_status_item = proto_tree_add_item(sub_tree, hf_rng_rsp_ranging_status, tvb, tlv_offset, 1, FALSE); + break; + case RNG_RSP_DL_FREQ_OVERRIDE: { + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_dl_freq_override, tvb, tlv_offset, 4, FALSE); + dl_freq_override_item = proto_tree_add_item(sub_tree, hf_rng_rsp_dl_freq_override, tvb, tlv_offset, 4, FALSE); + proto_item_append_text(dl_freq_override_item, " kHz"); + break; + } + case RNG_RSP_UL_CHANNEL_ID_OVERRIDE: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ul_chan_id_override, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ul_chan_id_override, tvb, tlv_offset, 1, FALSE); + break; + case RNG_RSP_DL_OPERATIONAL_BURST_PROFILE: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_dl_operational_burst_profile, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_dl_operational_burst_profile_diuc, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_dl_operational_burst_profile_ccc, tvb, tlv_offset, 2, FALSE); + break; + case RNG_RSP_SS_MAC_ADDRESS: + if (tlv_len == 6) + { + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ss_mac_address, tvb, tlv_offset, 6, FALSE); + ss_mac_address_item = proto_tree_add_item(sub_tree, hf_rng_rsp_ss_mac_address, tvb, tlv_offset, 6, FALSE); + } else { + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_invalid_tlv, tvb, tlv_offset, tlv_len, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ss_mac_address, tvb, tlv_offset, 6, FALSE); + } + break; + case RNG_RSP_BASIC_CID: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_basic_cid, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_basic_cid, tvb, tlv_offset, 2, FALSE); + break; + case RNG_RSP_PRIMARY_MGMT_CID: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_primary_mgmt_cid, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_primary_mgmt_cid, tvb, tlv_offset, 2, FALSE); + break; + case RNG_RSP_AAS_BROADCAST_PERMISSION: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_broadcast, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_broadcast, tvb, tlv_offset, 1, FALSE); + break; + case RNG_RSP_FRAME_NUMBER: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_frame_number, tvb, tlv_offset, 3, FALSE); + frame_number_item = proto_tree_add_item(sub_tree, hf_rng_rsp_frame_number, tvb, tlv_offset, 3, FALSE); + break; + case RNG_RSP_OPPORTUNITY_NUMBER: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_opportunity_number, tvb, tlv_offset, 1, FALSE); + opportunity_number_item = proto_tree_add_item(sub_tree, hf_rng_rsp_opportunity_number, tvb, tlv_offset, 1, FALSE); + if (tvb_get_ntohl(tvb, tlv_offset) == 0) + proto_item_append_text(opportunity_number_item, " (may not be 0!)"); + break; + case RNG_RSP_SERVICE_LEVEL_PREDICTION: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_service_level_prediction, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_service_level_prediction, tvb, tlv_offset, 1, FALSE); + break; + case RNG_RSP_RESOURCE_RETAIN_FLAG: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_resource_retain_flag, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_resource_retain_flag, tvb, tlv_offset, 1, FALSE); + break; + case RNG_RSP_HO_PROCESS_OPTIMIZATION: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ho_process_optimization, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_0, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_1_2, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_3, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_4, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_5, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_6, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_7, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_8, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_9, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_10, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_11, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_12, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_13, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_14, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_15, tvb, tlv_offset, 2, FALSE); + break; + case RNG_RSP_SBC_RSP_ENCODINGS: + sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "SBC-RSP Encodings (%u byte(s))", tlv_len); + dissect_mac_mgmt_msg_sbc_rsp_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree); + break; + case RNG_RSP_REG_RSP_ENCODINGS: + sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "REG-RSP Encodings (%u byte(s))", tlv_len); + dissect_mac_mgmt_msg_reg_rsp_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree); + break; + /* Implemented message encoding 33 (Table 367 in IEEE 802.16e-2007) */ + case RNG_RSP_DL_OP_BURST_PROFILE_OFDMA: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_dl_op_burst_profile_ofdma, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_least_robust_diuc, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_repetition_coding_indication, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_config_change_count_of_dcd, tvb, tlv_offset, 2, FALSE); + break; + case RNG_RSP_HO_ID: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ho_id, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ho_id, tvb, tlv_offset, 1, FALSE); + break; + case RNG_RSP_LOCATION_UPDATE_RESPONSE: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_location_update_response, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_location_update_response, tvb, tlv_offset, 1, FALSE); + break; + case RNG_RSP_PAGING_INFORMATION: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_paging_information, tvb, tlv_offset, 5, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_paging_cycle, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_paging_offset, tvb, tlv_offset+2, 1, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_paging_group_id, tvb, tlv_offset+3, 2, FALSE); + break; + case RNG_RSP_POWER_SAVING_CLASS_PARAMETERS: + sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Power Saving Class Parameters (%u byte(s))", tlv_len); + dissect_power_saving_class(sub_tree, tlv_type, tvb, tlv_len, pinfo, tlv_offset); + break; + case RNG_RSP_SA_CHALLENGE_TUPLE: + /* Display SA Challenge Tuple header */ + sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "SA Challenge Tuple (%u byte(s))", tlv_len); + /* add subtree */ + /* Use a local copy of tlv_offset */ + this_offset = tlv_offset; + while(this_offset < tlv_len) { + /* Get the sub TLV data. */ + init_tlv_info(&sub_tlv_info, tvb, this_offset); + /* get the sub TLV type */ + sub_tlv_type = get_tlv_type(&sub_tlv_info); + /* get the TLV length */ + sub_tlv_len = get_tlv_length(&sub_tlv_info); + if(tlv_type == -1 || sub_tlv_len > MAX_TLV_LEN || sub_tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-RSP TLV error"); + } + proto_tree_add_item(rng_rsp_tree, hf_rng_invalid_tlv, tvb, tlv_offset, (tvb_len - offset), FALSE); + break; + } + /* get the offset to the sub TLV data */ + sub_tlv_offset = this_offset + get_tlv_value_offset(&sub_tlv_info); + switch (sub_tlv_type) { + case RNG_RSP_SA_CHALLENGE_BS_RANDOM: + tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_rng_rsp_message_tree, sub_tree, hf_rng_rsp_bs_random, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_rsp_bs_random, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + break; + case RNG_RSP_SA_CHALLENGE_AKID: + tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_rng_rsp_message_tree, sub_tree, hf_rng_rsp_akid, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_rng_rsp_akid, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + break; + default: + tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_rng_rsp_message_tree, sub_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, FALSE); + break; + } + this_offset = sub_tlv_len + sub_tlv_offset; + } + break; + case DSx_UPLINK_FLOW: + /* display Uplink Service Flow Encodings info */ + /* add subtree */ + sub_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_rsp_decoder, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Uplink QOS Parameters (%u bytes)", tlv_len); + /* decode and display the DL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree); + break; + case DSx_DOWNLINK_FLOW: + /* display Downlink Service Flow Encodings info */ + /* add subtree */ + sub_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_rsp_decoder, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Downlink QOS Parameters (%u bytes)", tlv_len); + /* decode and display the DL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree); + break; + case RNG_RSP_RANGING_CODE_ATTRIBUTES: + /* case SHORT_HMAC_TUPLE: */ + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ranging_subchan, tvb, tlv_offset, 4, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_time_symbol_reference, tvb, tlv_offset, 4, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_subchannel_reference, tvb, tlv_offset, 4, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_ranging_code_index, tvb, tlv_offset, 4, FALSE); + proto_tree_add_item(sub_tree, hf_rng_rsp_frame_number2, tvb, tlv_offset, 4, FALSE); + break; + case SHORT_HMAC_TUPLE_COR2: + if (include_cor2_changes) { + sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Short HMAC Tuple (%u byte(s))", tlv_len); + wimax_short_hmac_tuple_decoder(sub_tree, tvb, tlv_offset, tvb_len - offset); + } else { + /* Unknown TLV type */ + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_tlv_type, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + } + break; + + default: + sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_tlv_type, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(sub_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE); + break; + + } + offset = tlv_len + tlv_offset; + } /* end of TLV process while loop */ + if (ranging_status_item && dl_freq_override_item) + proto_item_append_text(ranging_status_item, " (shall be set to 2 because Downlink Frequency Override is present)"); + if (ss_mac_address_item && frame_number_item) { + proto_item_append_text(frame_number_item, " (mutually exclusive with SS MAC Address!)"); + proto_item_append_text(ss_mac_address_item, " (mutually exclusive with Frame Number!)"); + } + if (ss_mac_address_item && opportunity_number_item) { + proto_item_append_text(opportunity_number_item, " (mutually exclusive with SS MAC Address!)"); + proto_item_append_text(ss_mac_address_item, " (mutually exclusive with Initial Ranging Opportunity Number!)"); + } + if (!ranging_status_item) + proto_item_append_text(rng_rsp_tree, " (Ranging status is missing!)"); + + } +} + diff --git a/plugins/wimax/msg_sbc.c b/plugins/wimax/msg_sbc.c new file mode 100644 index 0000000000..69f709f0ea --- /dev/null +++ b/plugins/wimax/msg_sbc.c @@ -0,0 +1,3277 @@ +/* msg_sbc.c + * WiMax MAC Management SBC-REQ/RSP Messages decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* +#define DEBUG // for debug only +*/ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" +#include "wimax_utils.h" + +/* This is a global variable declared in mac_hd_generic_decoder.c, which determines whether + * or not cor2 changes are included */ +extern guint include_cor2_changes; + +/* forward reference */ +void proto_register_mac_mgmt_msg_sbc(void); +void dissect_mac_mgmt_msg_sbc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_mac_mgmt_msg_sbc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_sbc_decoder = -1; +static gint ett_mac_mgmt_msg_sbc_decoder = -1; +static gint ett_sbc_req_tlv_subtree = -1; +static gint ett_sbc_rsp_tlv_subtree = -1; + +/* Setup protocol subtree array */ +static gint *ett_sbc[] = +{ + &ett_mac_mgmt_msg_sbc_decoder, + &ett_sbc_req_tlv_subtree, + &ett_sbc_rsp_tlv_subtree, +}; + +/* fix fields */ +static gint hf_sbc_req_message_type = -1; +static gint hf_sbc_rsp_message_type = -1; +static gint hf_sbc_unknown_type = -1; + +static gint hf_sbc_bw_alloc_support = -1; +static gint hf_sbc_bw_alloc_support_rsvd0 = -1; +static gint hf_sbc_bw_alloc_support_duplex = -1; +static gint hf_sbc_bw_alloc_support_rsvd1 = -1; +static gint hf_sbc_curr_transmit_power = -1; +static gint hf_sbc_transition_gaps = -1; +static gint hf_sbc_ssttg = -1; +static gint hf_sbc_ssrtg = -1; +static gint hf_sbc_mac_pdu = -1; +static gint hf_sbc_mac_pdu_piggybacked = -1; +static gint hf_sbc_mac_pdu_fsn = -1; +static gint hf_sbc_mac_pdu_rsvd = -1; +static gint hf_sbc_max_transmit_power = -1; +static gint hf_sbc_ss_fft_sizes = -1; +static gint hf_sbc_ss_fft_256 = -1; +static gint hf_sbc_ss_fft_2048 = -1; +static gint hf_sbc_ss_fft_128 = -1; +static gint hf_sbc_ss_fft_512 = -1; +static gint hf_sbc_ss_fft_1024 = -1; +static gint hf_sbc_ss_cinr_measure_capability = -1; +static gint hf_sbc_ss_phy_cinr_measurement_preamble = -1; +static gint hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_pilot_subcarriers = -1; +static gint hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_data_subcarriers = -1; +static gint hf_sbc_ss_effective_cinr_measurement_preamble = -1; +static gint hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_pilot_subcarriers = -1; +static gint hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_data_subcarriers = -1; +static gint hf_sbc_ss_support_2_concurrent_cqi_channels = -1; +static gint hf_sbc_ss_frequency_selectivity_characterization_report = -1; + +static gint hf_sbc_ss_fft_rsvd1 = -1; +static gint hf_sbc_ss_fft_rsvd2 = -1; +static gint hf_sbc_ss_demodulator = -1; +static gint hf_sbc_ss_demodulator_64qam = -1; +static gint hf_sbc_ss_demodulator_btc = -1; +static gint hf_sbc_ss_demodulator_ctc = -1; +static gint hf_sbc_ss_demodulator_stc = -1; +static gint hf_sbc_ss_demodulator_cc_with_optional_interleaver = -1; +static gint hf_sbc_ss_demodulator_harq_chase = -1; +static gint hf_sbc_ss_demodulator_harq_ctc_ir = -1; +static gint hf_sbc_ss_demodulator_reserved = -1; +static gint hf_sbc_ss_demodulator_reserved1 = -1; +static gint hf_sbc_ss_demodulator_64qam_2 = -1; +static gint hf_sbc_ss_demodulator_btc_2 = -1; +static gint hf_sbc_ss_demodulator_ctc_2 = -1; +static gint hf_sbc_ss_demodulator_stc_2 = -1; +static gint hf_sbc_ss_demodulator_cc_with_optional_interleaver_2 = -1; +static gint hf_sbc_ss_demodulator_harq_chase_2 = -1; +static gint hf_sbc_ss_demodulator_harq_ctc_ir_2 = -1; +static gint hf_sbc_ss_demodulator_reserved_2 = -1; +static gint hf_sbc_ss_demodulator_harq_cc_ir_2 = -1; +static gint hf_sbc_ss_demodulator_ldpc_2 = -1; +static gint hf_sbc_ss_demodulator_dedicated_pilots_2 = -1; +static gint hf_sbc_ss_demodulator_reserved1_2 = -1; + +static gint hf_sbc_ss_modulator = -1; +static gint hf_sbc_ss_modulator_64qam = -1; +static gint hf_sbc_ss_modulator_btc = -1; +static gint hf_sbc_ss_modulator_ctc = -1; +static gint hf_sbc_ss_modulator_stc = -1; +static gint hf_sbc_ss_modulator_harq_chase = -1; +static gint hf_sbc_ss_modulator_ctc_ir = -1; +static gint hf_sbc_ss_modulator_cc_ir = -1; +static gint hf_sbc_ss_modulator_ldpc = -1; + +static gint hf_sbc_number_ul_arq_ack_channel = -1; +static gint hf_sbc_number_dl_arq_ack_channel = -1; +static gint hf_sbc_ss_permutation_support = -1; +static gint hf_sbc_ss_optimal_pusc = -1; +static gint hf_sbc_ss_optimal_fusc = -1; +static gint hf_sbc_ss_amc_1x6 = -1; +static gint hf_sbc_ss_amc_2x3 = -1; +static gint hf_sbc_ss_amc_3x2 = -1; +static gint hf_sbc_ss_amc_with_harq_map = -1; +static gint hf_sbc_ss_tusc1_support = -1; +static gint hf_sbc_ss_tusc2_support = -1; +static gint hf_sbc_ss_ofdma_aas_private = -1; +static gint hf_sbc_ofdma_aas_harq_map_capability = -1; +static gint hf_sbc_ofdma_aas_private_map_support = -1; +static gint hf_sbc_ofdma_aas_reduced_private_map_support = -1; +static gint hf_sbc_ofdma_aas_private_chain_enable = -1; +static gint hf_sbc_ofdma_aas_private_map_dl_frame_offset = -1; +static gint hf_sbc_ofdma_aas_private_ul_frame_offset = -1; +static gint hf_sbc_ofdma_aas_private_map_concurrency = -1; +static gint hf_sbc_ofdma_aas_capabilities = -1; +static gint hf_sbc_ss_ofdma_aas_zone = -1; +static gint hf_sbc_ss_ofdma_aas_diversity_map_scan = -1; +static gint hf_sbc_ss_ofdma_aas_fbck_rsp_support = -1; +static gint hf_sbc_ss_ofdma_downlink_aas_preamble = -1; +static gint hf_sbc_ss_ofdma_uplink_aas_preamble = -1; +static gint hf_sbc_ss_ofdma_aas_capabilities_rsvd = -1; + +static gint hf_sbc_tlv_t_167_association_type_support = -1; +static gint hf_sbc_tlv_t_167_association_type_support_bit0 = -1; +static gint hf_sbc_tlv_t_167_association_type_support_bit1 = -1; +static gint hf_sbc_tlv_t_167_association_type_support_bit2 = -1; +static gint hf_sbc_tlv_t_167_association_type_support_bit3 = -1; +static gint hf_sbc_tlv_t_167_association_type_support_bit4 = -1; +static gint hf_sbc_tlv_t_167_association_type_support_reserved = -1; +static gint hf_sbc_ofdma_ss_uplink_power_control_support = -1; +static gint hf_sbc_ofdma_ss_uplink_power_control_support_open_loop = -1; +static gint hf_sbc_ofdma_ss_uplink_power_control_support_aas_preamble = -1; +static gint hf_sbc_ofdma_ss_uplink_power_control_support_rsvd = -1; +static gint hf_sbc_ofdm_ss_minimum_num_of_frames = -1; +static gint hf_sbc_tlv_t_27_extension_capability = -1; +static gint hf_sbc_tlv_t_27_extension_capability_bit0 = -1; +static gint hf_sbc_tlv_t_27_extension_capability_reserved = -1; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support = -1; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit0 = -1; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit1 = -1; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit2 = -1; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit3 = -1; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_reserved = -1; +static gint hf_sbc_tlv_t_171_minimum_num_of_frames = -1; +static gint hf_sbc_tlv_t_172_harq_map_capability = -1; +static gint hf_sbc_tlv_t_172_extended_harq_ie_capability = -1; +static gint hf_sbc_tlv_t_172_sub_map_capability_first_zone = -1; +static gint hf_sbc_tlv_t_172_sub_map_capability_other_zones = -1; +static gint hf_sbc_tlv_t_172_dl_region_definition_support = -1; +static gint hf_sbc_tlv_t_172_reserved = -1; +static gint hf_sbc_tlv_t_172 = -1; +static gint hf_sbc_tlv_t_173_ul_ctl_channel_support = -1; +static gint hf_sbc_tlv_t_173_3_bit_mimo_fast_feedback = -1; +static gint hf_sbc_tlv_t_173_enhanced_fast_feedback = -1; +static gint hf_sbc_tlv_t_173_ul_ack = -1; +static gint hf_sbc_tlv_t_173_reserved = -1; +static gint hf_sbc_tlv_t_173_uep_fast_feedback = -1; +static gint hf_sbc_tlv_t_173_measurement_report = -1; +static gint hf_sbc_tlv_t_173_primary_secondary_fast_feedback = -1; +static gint hf_sbc_tlv_t_173_diuc_cqi_fast_feedback = -1; +static gint hf_sbc_tlv_t_174_ofdma_ms_csit_capability = -1; +static gint hf_sbc_tlv_t_174_csit_compatibility_type_a = -1; +static gint hf_sbc_tlv_t_174_csit_compatibility_type_b = -1; +static gint hf_sbc_tlv_t_174_power_assignment_capability = -1; +static gint hf_sbc_tlv_t_174_sounding_rsp_time_capability = -1; +static gint hf_sbc_tlv_t_174_max_num_simultanous_sounding_instructions = -1; +static gint hf_sbc_tlv_t_174_ss_csit_type_a_support = -1; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets = -1; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_a = -1; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_b = -1; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_harq_parameters_set = -1; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_a = -1; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_b = -1; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_reserved = -1; +static gint hf_sbc_tlv_t_174_ss_csit_reserved = -1; +static gint hf_sbc_tlv_t_175_max_num_bst_per_frm_capability_harq = -1; +static gint hf_sbc_tlv_t_175_max_num_ul_harq_bst = -1; +static gint hf_sbc_tlv_t_175_max_num_ul_harq_per_frm_include_one_non_harq_bst = -1; +static gint hf_sbc_tlv_t_175_max_num_dl_harq_bst_per_harq_per_frm = -1; +static gint hf_sbc_tlv_t_176 = -1; +static gint hf_sbc_tlv_t_176_bit0 = -1; +static gint hf_sbc_tlv_t_176_bit1 = -1; +static gint hf_sbc_tlv_t_176_bit2 = -1; +static gint hf_sbc_tlv_t_176_bit2_cor2 = -1; +static gint hf_sbc_tlv_t_176_bit3 = -1; +static gint hf_sbc_tlv_t_176_bit4 = -1; +static gint hf_sbc_tlv_t_176_bit5 = -1; +static gint hf_sbc_tlv_t_176_bit6 = -1; +static gint hf_sbc_tlv_t_176_bit7 = -1; +static gint hf_sbc_tlv_t_176_bit8 = -1; +static gint hf_sbc_tlv_t_176_bit9 = -1; +static gint hf_sbc_tlv_t_176_bit10 = -1; +static gint hf_sbc_tlv_t_176_bit11 = -1; +static gint hf_sbc_tlv_t_176_bit12 = -1; +static gint hf_sbc_tlv_t_176_bit13 = -1; +static gint hf_sbc_tlv_t_176_bit14 = -1; +static gint hf_sbc_tlv_t_176_bit15 = -1; +static gint hf_sbc_tlv_t_176_bit16 = -1; +static gint hf_sbc_tlv_t_176_bit17 = -1; +static gint hf_sbc_tlv_t_176_bit18 = -1; +static gint hf_sbc_tlv_t_176_bit19 = -1; +static gint hf_sbc_tlv_t_176_reserved = -1; +static gint hf_sbc_tlv_t_177_ofdma_ss_modulator_for_mimo_support = -1; +static gint hf_sbc_tlv_t_177_stc_matrix_a = -1; +static gint hf_sbc_tlv_t_177_stc_matrix_b_vertical = -1; +static gint hf_sbc_tlv_t_177_stc_matrix_b_horizontal = -1; +static gint hf_sbc_tlv_t_177_two_transmit_antennas = -1; +static gint hf_sbc_tlv_t_177_capable_of_transmit_diversity = -1; +static gint hf_sbc_tlv_t_177_capable_of_spacial_multiplexing = -1; +static gint hf_sbc_tlv_t_177_beamforming = -1; +static gint hf_sbc_tlv_t_177_adaptive_rate_ctl = -1; +static gint hf_sbc_tlv_t_177_single_antenna = -1; +static gint hf_sbc_tlv_t_177_collaborative_sm_with_one_antenna = -1; +static gint hf_sbc_tlv_t_177_collaborative_sm_with_two_antennas = -1; +static gint hf_sbc_tlv_t_177_capable_of_two_antenna = -1; +static gint hf_sbc_tlv_t_177_rsvd = -1; +static gint hf_sbc_tlv_t_178_sdma_pilot_capability = -1; +static gint hf_sbc_tlv_t_178_sdma_pilot_pattern_support_for_amc_zone = -1; +static gint hf_sbc_tlv_t_178_reserved = -1; +static gint hf_sbc_tlv_t_179_ofdma_multiple_dl_burst_profile_support = -1; +static gint hf_sbc_tlv_t_179_dl_bst_profile_for_multiple_fec = -1; +static gint hf_sbc_tlv_t_179_ul_bst_profile_for_multiple_fec = -1; +static gint hf_sbc_tlv_t_179_reserved = -1; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability = -1; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_NEP = -1; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_dl = -1; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_ul = -1; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved1 = -1; +static gint hf_sbc_tlv_t_162_ul_harq_incremental_redundancy_buffer_capability_NEP = -1; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved2 = -1; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability = -1; +static gint hf_sbc_tlv_t_163_dl_harq_buffering_capability_for_chase_combining = -1; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_dl = -1; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved1 = -1; +static gint hf_sbc_tlv_t_163_ul_harq_buffering_capability_for_chase_combining = -1; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_ul = -1; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved2 = -1; + +static gint hf_sbc_ss_demodulator_mimo_support = -1; +static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_a = -1; +static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_vertical = -1; +static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_horizontal = -1; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_a = -1; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_vertical = -1; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_horizontal = -1; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_vertical = -1; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_horizontal = -1; +static gint hf_sbc_ss_demodulator_mimo_rsvd = -1; +static gint hf_sbc_ss_mimo_uplink_support = -1; +static gint hf_sbc_ss_mimo_uplink_support_2_ann_sttd = -1; +static gint hf_sbc_ss_mimo_uplink_support_2_ann_sm_vertical = -1; +static gint hf_sbc_ss_mimo_uplink_support_1_ann_coop_sm = -1; +static gint hf_sbc_ss_mimo_uplink_support_rsvd = -1; + +static gint hf_sbc_power_save_class_types_capability = -1; +static gint hf_sbc_power_save_class_types_capability_bit0 = -1; +static gint hf_sbc_power_save_class_types_capability_bit1 = -1; +static gint hf_sbc_power_save_class_types_capability_bit2 = -1; +static gint hf_sbc_power_save_class_types_capability_bits34 = -1; +static gint hf_sbc_power_save_class_types_capability_bits567 = -1; + +static gint hf_sbc_pkm_flow_control = -1; +static gint hf_sbc_auth_policy = -1; +static gint hf_sbc_privacy_802_16 = -1; +static gint hf_sbc_privacy_rsvd = -1; +static gint hf_sbc_max_security_associations = -1; + +static gint hf_sbc_invalid_tlv = -1; + +static const value_string vals_sbc_bw_alloc_support_duplex[] = +{ + {0, "Half-Duplex"}, + {1, "Full-Duplex"}, + {0, NULL} +}; + +static const value_string vals_sbc_mac_pdu_fsn[] = +{ + {0, "Only 11-bit FSN values are supported"}, + {1, "Only 3-bit FSN values are supported"}, + {0, NULL} +}; +static const true_false_string tfs_sbc_mac_pdu_fsn = +{ + "Only 3-bit FSN values are supported", + "Only 11-bit FSN values are supported" +}; + +/* DCD DIUC messages (table 143) */ +static const value_string diuc_msgs[] = +{ + { 0, "Downlink Burst Profile 1" }, + { 1, "Downlink Burst Profile 2" }, + { 2, "Downlink Burst Profile 3" }, + { 3, "Downlink Burst Profile 4" }, + { 4, "Downlink Burst Profile 5" }, + { 5, "Downlink Burst Profile 6" }, + { 6, "Downlink Burst Profile 7" }, + { 7, "Downlink Burst Profile 8" }, + { 8, "Downlink Burst Profile 9" }, + { 9, "Downlink Burst Profile 10" }, + { 10, "Downlink Burst Profile 11" }, + { 11, "Downlink Burst Profile 12" }, + { 12, "Downlink Burst Profile 13" }, + { 13, "Reserved" }, + { 14, "Gap" }, + { 15, "End of DL-MAP" }, + {0, NULL} +}; + +static const value_string vals_sbc_type[] = +{ + {0, "CINR metric"}, + {1, "RSSI metric"}, + {2, "RTD metric"}, + {3, "Reserved"}, + {0, NULL} +}; + +static const value_string vals_sbc_function[] = +{ + {0, "Reserved"}, + {1, "Metric of neighbor BS is greater than absolute value"}, + {2, "Metric of neighbor BS is less than absolute value"}, + {3, "Metric of neighbor BS is greater than serving BS metric by relative value"}, + {4, "Metric of neighbor BS is less than serving BS metric by relative value"}, + {5, "Metric of serving BS greater than absolute value"}, + {6, "Metric of serving BS less than absolute value"}, + {7, "Reserved"}, + {0, NULL} +}; + +static const value_string vals_sbc_action[] = +{ + {0, "Reserved"}, + {1, "Respond on trigger with MOB_SCN-REP after the end of each scanning interval"}, + {2, "Respond on trigger with MOB_MSH-REQ"}, + {3, "On trigger, MS starts neighbor BS scanning process by sending MOB_SCN-REQ"}, + {4, "Reserved"}, + {0, NULL} +}; + +static const value_string vals_sbc_power_adjustmnt[] = +{ + {0, "Preserve Peak Power"}, + {1, "Preserve Mean Power"}, + {0, NULL} +}; + +static const true_false_string tfs_sbc_power_adjustment = +{ + "Preserve Mean Power", + "Preserve Peak Power" +}; + +static const value_string vals_reg_rsp_status[] = +{ + {0, "OK"}, + {1, "Message authentication failure"}, + {0, NULL} +}; + +static const value_string vals_sbc_burst_tcs[] = +{ + {0, "TCS disabled"}, + {1, "TCS enabled"}, + {0, NULL} +}; + +static const true_false_string tfs_sbc_burst_tcs = +{ + "TCS enabled", + "TCS disabled" +}; + +static const value_string vals_sbc_frame_duration[] = +{ + {0, "2.5"}, + {1, "4"}, + {2, "5"}, + {3, "8"}, + {4, "10"}, + {5, "12.5"}, + {6, "20"}, + {0, NULL} +}; + +static const value_string vals_sbc_mac_version[] = +{ + {1, "Conformance with IEEE Std 802.16-2001"}, + {2, "Conformance with IEEE Std 802.16c-2002 and its predecessors"}, + {3, "Conformance with IEEE Std 802.16a-2003 and its predecessors"}, + {4, "Conformance with IEEE Std 802.16-2004"}, + {5, "Conformance with IEEE Std 802.16-2004 and IEEE Std 802.16e-2005"}, + {6, "reserved"}, + {0, NULL} +}; + +static const value_string vals_sbc_burst_fec[] = +{ + {0, "QPSK (CC) 1/2"}, + {1, "QPSK (CC) 3/4"}, + {2, "16-QAM (CC) 1/2"}, + {3, "16-QAM (CC) 3/4"}, + {4, "64-QAM (CC) 1/2"}, + {5, "64-QAM (CC) 2/3"}, + {6, "64-QAM (CC) 3/4"}, + {7, "QPSK (BTC) 1/2"}, + {8, "QPSK (BTC) 3/4 or 2/3"}, + {9, "16-QAM (BTC) 3/5"}, + {10, "16-QAM (BTC) 4/5"}, + {11, "64-QAM (BTC) 2/3 or 5/8"}, + {12, "64-QAM (BTC) 5/6 or 4/5"}, + {13, "QPSK (CTC) 1/2"}, + {14, "Reserved"}, + {15, "QPSK (CTC) 3/4"}, + {16, "16-QAM (CTC) 1/2"}, + {17, "16-QAM (CTC) 3/4"}, + {18, "64-QAM (CTC) 1/2"}, + {19, "64-QAM (CTC) 2/3"}, + {20, "64-QAM (CTC) 3/4"}, + {21, "64-QAM (CTC) 5/6"}, + {22, "QPSK (ZT CC) 1/2"}, + {23, "QPSK (ZT CC) 3/4"}, + {24, "16-QAM (ZT CC) 1/2"}, + {25, "16-QAM (ZT CC) 3/4"}, + {26, "64-QAM (ZT CC) 1/2"}, + {27, "64-QAM (ZT CC) 2/3"}, + {28, "64-QAM (ZT CC) 3/4"}, + {29, "QPSK (LDPC) 1/2"}, + {30, "QPSK (LDPC) 2/3 A code"}, + {31, "16-QAM (LDPC) 3/4 A code"}, + {32, "16-QAM (LDPC) 1/2"}, + {33, "16-QAM (LDPC) 2/3 A code"}, + {34, "16-QAM (LDPC) 3/4 A code"}, + {35, "64-QAM (LDPC) 1/2"}, + {36, "64-QAM (LDPC) 2/3 A code"}, + {37, "64-QAM (LDPC) 3/4 A code"}, + {38, "QPSK (LDPC) 2/3 B code"}, + {39, "QPSK (LDPC) 3/4 B code"}, + {40, "16-QAM (LDPC) 2/3 B code"}, + {41, "16-QAM (LDPC) 3/4 B code"}, + {42, "64-QAM (LDPC) 2/3 B code"}, + {43, "64-QAM (LDPC) 3/4 B code"}, + {44, "QPSK (CC with optional interleaver) 1/2"}, + {45, "QPSK (CC with optional interleaver) 3/4"}, + {46, "16-QAM (CC with optional interleaver) 1/2"}, + {47, "16-QAM (CC optional interleaver) 0%00"}, + {48, "64-QAM (CC with optional interleaver) 2/3"}, + {49, "64-QAM (CC with optional interleaver) 3/4"}, + {50, "QPSK (LDPC) 5/6"}, + {51, "16-QAM (LDPC) 5/6"}, + {52, "64-QAM (LDPC) 5/6"}, + {0, NULL} +}; + +static const value_string vals_sbc_permutation_type[] = +{ + {0, "PUSC" }, + {1, "FUSC" }, + {2, "optional FUSC"}, + {3, "AMC"}, + {0, NULL} +}; + +static const value_string vals_sbc_harq_parameters_set[] = +{ + {0, "HARQ set 1"}, + {1, "HARQ set 2"}, + {2, "HARQ set 3"}, + {3, "HARQ set 4"}, + {4, "HARQ set 5"}, + {5, "Reserved"}, + {0, NULL} +}; + +static const true_false_string tfs_supported = +{ + "supported", + "not supported" +}; + +static const value_string vals_yes_no_str[] = +{ + {0, "No"}, + {1, "Yes"}, + {0, NULL} +}; + +static const value_string vals_sounding_rsp_time_cap_codings[] = +{ + {0, "0.5ms" }, + {1, "0.75ms" }, + {2, "1ms"}, + {3, "1.25ms"}, + {4, "1.5ms"}, + {5, "min(2, Next Frame)"}, + {6, "min(5, Next Frame)"}, + {7, "Next Frame"}, + {0, NULL} +}; + +static const value_string vals_sbc_sdma_str[ ] = +{ + {0, "no support"}, + {1, "support SDMA pilot patterns #A and #B"}, + {2, "support all SDMA pilot patterns"}, + {3, "reserved"}, + {0, NULL} +}; + +/* SBC display */ +static hf_register_info hf_sbc[] = +{ + { /* 11.8.8 */ + &hf_sbc_tlv_t_167_association_type_support, + { + "Association Type Support", "wimax.sbc.association_type_support", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_167_association_type_support_bit0, + { + "Scanning Without Association: association not supported", "wimax.sbc.association_type_support.bit0", + FT_BOOLEAN, 8, VALS(vals_yes_no_str), 0x1, "", HFILL + } + }, + { + &hf_sbc_tlv_t_167_association_type_support_bit1, + { + "Association Level 0: scanning or association without coordination", "wimax.sbc.association_type_support.bit1", + FT_BOOLEAN, 8, VALS(vals_yes_no_str), 0x2, "", HFILL + } + }, + { + &hf_sbc_tlv_t_167_association_type_support_bit2, + { + "Association Level 1: association with coordination", "wimax.sbc.association_type_support.bit2", + FT_BOOLEAN, 8, VALS(vals_yes_no_str), 0x4, "", HFILL + } + }, + { + &hf_sbc_tlv_t_167_association_type_support_bit3, + { + "Association Level 2: network assisted association", "wimax.sbc.association_type_support.bit3", + FT_BOOLEAN, 8, VALS(vals_yes_no_str), 0x8, "", HFILL + } + }, + { + &hf_sbc_tlv_t_167_association_type_support_bit4, + { + "Desired Association Support", "wimax.sbc.association_type_support.bit4", + FT_BOOLEAN, 8, VALS(vals_yes_no_str), 0x10, "", HFILL + } + }, + { + &hf_sbc_tlv_t_167_association_type_support_reserved, + { + "Reserved", "wimax.sbc.association_type_support.reserved", + FT_UINT8, BASE_HEX, NULL, 0xE0, "", HFILL + } + }, + { /* 11.7.8.7 */ + &hf_sbc_auth_policy, + { + "Authorization Policy Support", "wimax.sbc.auth_policy", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_privacy_802_16, + { + "IEEE 802.16 Privacy", "wimax.sbc.auth_policy.802_16", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_privacy_rsvd, + { + "Reserved", "wimax.sbc.auth_policy.rsvd", + FT_UINT8, BASE_HEX, NULL, 0xFE, "", HFILL + } + }, + { /* 11.8.1 */ + &hf_sbc_bw_alloc_support, + { + "Bandwidth Allocation Support", "wimax.sbc.bw_alloc_support", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_sbc_bw_alloc_support_duplex, + { + "Duplex", "wimax.sbc.bw_alloc_support.duplex", + FT_BOOLEAN, 8, VALS(vals_sbc_bw_alloc_support_duplex), 0x2, "", HFILL + } + }, + { + &hf_sbc_bw_alloc_support_rsvd0, + { + "Reserved", "wimax.sbc.bw_alloc_support.rsvd0", + FT_UINT8, BASE_HEX, NULL, 0x1, "", HFILL + } + }, + { + &hf_sbc_bw_alloc_support_rsvd1, + { + "Reserved", "wimax.sbc.bw_alloc_support.rsvd1", + FT_UINT8, BASE_HEX, NULL, 0xFC, "", HFILL + } + }, + { + &hf_sbc_curr_transmit_power, + { + "Current transmitted power", "wimax.sbc.curr_transmit_power", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_sbc_ss_effective_cinr_measurement_preamble, + { + "Effective CINR Measurement For A Permutation Zone From Preamble", "wimax.sbc.effective_cinr_measure_permutation_zone_preamble", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_pilot_subcarriers, + { + "Effective CINR Measurement For A Permutation Zone From Pilot Subcarriers", "wimax.sbc.effective_cinr_measure_permutation_zone.pilot_subcarriers", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_data_subcarriers, + { + "Effective CINR Measurement For A Permutation Zone From Data Subcarriers", "wimax.sbc.effective_cinr_measure_permutation_zone.data_subcarriers", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { /* 11.8.6 */ + &hf_sbc_tlv_t_27_extension_capability, + { + "Extension Capability", "wimax.sbc.extension_capability", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_27_extension_capability_bit0, + { + "Supported Extended Subheader Format", "wimax.sbc.extension_capability.bit0", + FT_BOOLEAN, 8, VALS(vals_yes_no_str), 0x1, "", HFILL + } + }, + { + &hf_sbc_tlv_t_27_extension_capability_reserved, + { + "Reserved", "wimax.sbc.extension_capability.reserved", + FT_UINT8, BASE_HEX, NULL, 0xFE, "", HFILL + } + }, + { + &hf_sbc_ss_frequency_selectivity_characterization_report, + { + "Frequency Selectivity Characterization Report", "wimax.sbc.frequency_selectivity_characterization_report", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x80, "", HFILL + } + }, + { /* 11.8.3.7.19.2 */ + &hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability, + { + "HARQ Chase Combining And CC-IR Buffer Capability", "wimax.sbc.harq_chase_combining_and_cc_ir_buffer_capability", + FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_dl, + { + "Aggregation Flag For DL", "wimax.sbc.harq_chase_combining_and_cc_ir_buffer_capability.aggregation_flag_dl", + FT_UINT16, BASE_HEX, NULL, 0x40, "", HFILL + } + }, + { + &hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_ul, + { + "Aggregation Flag for UL", "wimax.sbc.harq_chase_combining_and_cc_ir_buffer_capability.aggregation_flag_ul", + FT_UINT16, BASE_HEX, NULL, 0x4000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_163_dl_harq_buffering_capability_for_chase_combining, + { + "Downlink HARQ Buffering Capability For Chase Combining (K)", "wimax.sbc.harq_chase_combining_and_cc_ir_buffer_capability.dl_harq_buffering_capability_for_chase_combining", + FT_UINT16, BASE_HEX, NULL, 0x3F, "", HFILL + } + }, + { + &hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved1, + { + "Reserved", "wimax.sbc.harq_chase_combining_and_cc_ir_buffer_capability.reserved1", + FT_UINT16, BASE_HEX, NULL, 0x80, "", HFILL + } + }, + { + &hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved2, + { + "Reserved", "wimax.sbc.harq_chase_combining_and_cc_ir_buffer_capability.reserved2", + FT_UINT16, BASE_HEX, NULL, 0x8000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_163_ul_harq_buffering_capability_for_chase_combining, + { + "Uplink HARQ buffering capability for chase combining (K)", "wimax.sbc.harq_chase_combining_and_cc_ir_buffer_capability.ul_harq_buffering_capability_for_chase_combining", + FT_UINT16, BASE_HEX, NULL, 0x3F00, "", HFILL + } + }, + { /* 11.8.3.7.19.1 */ + &hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability, + { + "HARQ Incremental Buffer Capability", "wimax.sbc.harq_incremental_redundancy_buffer_capability", + FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_dl, + { + "Aggregation Flag for DL", "wimax.sbc.harq_incremental_redundancy_buffer_capability.aggregation_flag_for_dl", + FT_UINT16, BASE_HEX, NULL, 0x10, "", HFILL + } + }, + { + &hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_ul, + { + "Aggregation Flag For UL", "wimax.sbc.harq_incremental_redundancy_buffer_capability.aggregation_flag_for_ul", + FT_UINT16, BASE_HEX, NULL, 0x1000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_NEP, + { + "NEP Value Indicating Downlink HARQ Buffering Capability For Incremental Redundancy CTC", "wimax.sbc.harq_incremental_redundancy_buffer_capability.dl_incremental_redundancy_ctc", + FT_UINT16, BASE_HEX, NULL, 0xF, "", HFILL + } + }, + { + &hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved1, + { + "Reserved", "wimax.sbc.harq_incremental_redundancy_buffer_capability.reserved", + FT_UINT16, BASE_HEX, NULL, 0xE0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved2, + { + "Reserved", "wimax.sbc.harq_incremental_redundancy_buffer_capability.reserved2", + FT_UINT16, BASE_HEX, NULL, 0xE000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_162_ul_harq_incremental_redundancy_buffer_capability_NEP, + { + "NEP Value Indicating Uplink HARQ Buffering Capability For Incremental Redundancy CTC", "wimax.sbc.harq_incremental_redundancy_buffer_capability.ul_incremental_redundancy_ctc", + FT_UINT16,BASE_HEX, NULL, 0xF00, "", HFILL + } + }, + { + &hf_sbc_ofdma_aas_harq_map_capability, + { + "H-ARQ MAP Capability", "wimax.sbc.harq_map_capability", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { /* 11.8.7 */ + &hf_sbc_tlv_t_28_ho_trigger_metric_support, + { + "HO Trigger Metric Support", "wimax.sbc.ho_trigger_metric_support", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_28_ho_trigger_metric_support_bit0, + { + "BS CINR Mean", "wimax.sbc.ho_trigger_metric_support.bit0", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_tlv_t_28_ho_trigger_metric_support_bit1, + { + "BS RSSI Mean", "wimax.sbc.ho_trigger_metric_support.bit1", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_tlv_t_28_ho_trigger_metric_support_bit2, + { + "BS Relative Delay", "wimax.sbc.ho_trigger_metric_support.bit2", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_tlv_t_28_ho_trigger_metric_support_bit3, + { + "BS RTD", "wimax.sbc.ho_trigger_metric_support.bit3", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_tlv_t_28_ho_trigger_metric_support_reserved, + { + "Reserved", "wimax.sbc.ho_trigger_metric_support.reserved", + FT_UINT8, BASE_HEX, NULL, 0xF0, "", HFILL + } + }, + { + &hf_sbc_invalid_tlv, + { + "Invalid TLV", "wimax.sbc.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 11.8.2 */ + &hf_sbc_mac_pdu, + { + "Capabilities For Construction And Transmission Of MAC PDUs", "wimax.sbc.mac_pdu", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_mac_pdu_piggybacked, + { + "Ability To Receive Requests Piggybacked With Data", "wimax.sbc.mac_pdu.bit0", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_mac_pdu_fsn, + { + "Ability To Use 3-bit FSN Values Used When Forming MAC PDUs On Non-ARQ Connections", "wimax.sbc.mac_pdu.bit1", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { /* 11.8.3.7.15 */ + &hf_sbc_tlv_t_175_max_num_bst_per_frm_capability_harq, + { + "Maximum Number Of Burst Per Frame Capability In HARQ", "wimax.sbc.max_num_bst_per_frm_capability_harq", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_175_max_num_dl_harq_bst_per_harq_per_frm, + { + "Maximum Numbers Of DL HARQ Bursts Per HARQ Enabled Of MS Per Frame (default(0)=1)", "wimax.sbc.max_num_bst_per_frm_capability_harq.max_num_dl_harq_bst_per_harq_per_frm", + FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_175_max_num_ul_harq_bst, + { + "Maximum Number Of UL HARQ Burst Per HARQ Enabled MS Per Frame (default(0)=1)", "wimax.sbc.max_num_bst_per_frm_capability_harq.max_num_ul_harq_bst", + FT_UINT8, BASE_DEC, NULL, 0x7, "", HFILL + } + }, + { + &hf_sbc_tlv_t_175_max_num_ul_harq_per_frm_include_one_non_harq_bst, + { + "Whether The Maximum Number Of UL HARQ Bursts Per Frame (i.e. Bits# 2-0) Includes The One Non-HARQ Burst", "wimax.sbc.max_num_bst_per_frm_capability_harq.max_num_ul_harq_per_frm_include_one_non_harq_bst", + FT_BOOLEAN, 8, VALS(vals_yes_no_str), 0x8, "", HFILL + } + }, + { /* 11.7.8.8 */ + &hf_sbc_max_security_associations, + { + "Maximum Number Of Security Association Supported By The SS", "wimax.sbc.max_security_associations", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { /* 11.8.3.7.2 - type 161 */ + &hf_sbc_number_dl_arq_ack_channel, + { + "The Number Of DL HARQ ACK Channel", "wimax.sbc.number_dl_arq_ack_channel", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { /* 11.8.3.7.3 - type 153 */ + &hf_sbc_number_ul_arq_ack_channel, + { + "The Number Of UL HARQ ACK Channel", "wimax.sbc.number_ul_arq_ack_channel", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { /* 11.8.3.7.8 */ + &hf_sbc_ofdma_aas_capabilities, + { + "OFDMA AAS Capability", "wimax.sbc.ofdma_aas_capability", + FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ss_ofdma_aas_capabilities_rsvd, + { + "Reserved", "wimax.sbc.ofdma_aas_capabilities.rsvd", + FT_UINT16, BASE_HEX, NULL, 0xFFE0, "", HFILL + } + }, + { + &hf_sbc_ss_ofdma_aas_diversity_map_scan, + { + "AAS Diversity Map Scan (AAS DLFP)", "wimax.sbc.ofdma_aas_diversity_map_scan", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_ofdma_aas_fbck_rsp_support, + { + "AAS-FBCK-RSP Support", "wimax.sbc.ofdma_aas_fbck_rsp_support", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_ss_ofdma_aas_zone, + { + "AAS Zone", "wimax.sbc.ofdma_aas_zone", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_ss_ofdma_downlink_aas_preamble, + { + "Downlink AAS Preamble", "wimax.sbc.ofdma_downlink_aas_preamble", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { /* 11.8.3.7.5 - 3 bytes */ + &hf_sbc_tlv_t_176, + { + "OFDMA MS Demodulator For MIMO Support In DL", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit0, + { + "2-antenna STC Matrix A", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit0", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit1, + { + "2-antenna STC Matrix B, vertical coding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit1", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit2, + { + "Four Receive Antennas", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit2", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit2_cor2, + { + "2-antenna STC matrix B, horizontal coding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit2", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit3, + { + "4-antenna STC Matrix A", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit3", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit4, + { + "4-antenna STC Matrix B, vertical coding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit4", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit5, + { + "4-antenna STC Matrix B, horizontal coding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit5", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit6, + { + "4-antenna STC Matrix C, vertical coding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit6", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit7, + { + "4-antenna STC Matrix C, horizontal coding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit7", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x80, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit8, + { + "3-antenna STC Matrix A", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit8", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x100, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit9, + { + "3-antenna STC Matrix B", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit9", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x200, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit10, + { + "3-antenna STC Matrix C, vertical coding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit10", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x400, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit11, + { + "3-antenna STC Matrix C, horizontal coding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit11", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x800, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit12, + { + "Capable Of Calculating Precoding Weight", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit12", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x1000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit13, + { + "Capable Of Adaptive Rate Control", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit13", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x2000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit14, + { + "Capable Of Calculating Channel Matrix", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit14", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x4000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit15, + { + "Capable Of Antenna Grouping", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit15", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x8000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit16, + { + "Capable Of Antenna Selection", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit16", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x10000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit17, + { + "Capable Of Codebook Based Precoding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit17", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x20000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit18, + { + "Capable Of Long-term Precoding", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit18", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x40000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_bit19, + { + "Capable Of MIMO Midamble", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.bit19", + FT_BOOLEAN, 24, TFS(&tfs_supported), 0x80000, "", HFILL + } + }, + { + &hf_sbc_tlv_t_176_reserved, + { + "Reserved", "wimax.sbc.ofdma_ms_demodulator_for_mimo_support_in_dl.reserved", + FT_UINT24, BASE_HEX, NULL, 0xF00000, "", HFILL + } + }, + { /* 11.8.3.7.18 */ + &hf_sbc_tlv_t_179_ofdma_multiple_dl_burst_profile_support, + { + "OFDMA Multiple Downlink Burst Profile Capability", "wimax.sbc.ofdma_multiple_dl_burst_profile_support", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_179_dl_bst_profile_for_multiple_fec, + { + "Downlink burst profile for multiple FEC types", "wimax.sbc.ofdma_multiple_dl_burst_profile_support.dl_bst_profile_for_multiple_fec", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_tlv_t_179_reserved, + { + "Reserved", "wimax.sbc.ofdma_multiple_dl_burst_profile_support.reserved", + FT_UINT8, BASE_HEX, NULL, 0xFC, "", HFILL + } + }, + { + &hf_sbc_tlv_t_179_ul_bst_profile_for_multiple_fec, + { + "Uplink burst profile for multiple FEC types", "wimax.sbc.ofdma_multiple_dl_burst_profile_support.ul_burst_profile_for_multiple_fec_types", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { /* 11.8.3.7.9 */ + &hf_sbc_ss_cinr_measure_capability, + { + "OFDMA SS CINR Measurement Capability", "wimax.sbc.ofdma_ss_cinr_measure_capability", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { /* 11.8.3.7.6 */ + &hf_sbc_ss_mimo_uplink_support, + { + "OFDMA SS MIMO uplink support", "wimax.sbc.ofdma_ss_mimo_uplink_support", + FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { + &hf_sbc_ss_mimo_uplink_support_2_ann_sttd, + { + "2-antenna STTD", "wimax.sbc.ofdma_ss_mimo_uplink_support.2_antenna_sttd", + FT_UINT8, BASE_HEX, NULL, 0x01, "", HFILL + } + }, + { + &hf_sbc_ss_mimo_uplink_support_2_ann_sm_vertical, + { + "2-antenna SM with vertical coding", "wimax.sbc.ofdma_ss_mimo_uplink_support.2_antenna_sm_with_vertical_coding", + FT_UINT8, BASE_HEX, NULL, 0x02, "", HFILL + } + }, + { + &hf_sbc_ss_mimo_uplink_support_1_ann_coop_sm, + { + "Single-antenna cooperative SM", "wimax.sbc.ofdma_ss_mimo_uplink_support.single_antenna_coop_sm", + FT_UINT8, BASE_HEX, NULL, 0x04, "", HFILL + } + }, + { + &hf_sbc_ss_ofdma_uplink_aas_preamble, + { + "Uplink AAS Preamble", "wimax.sbc.ofdma_uplink_aas_preamble", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ss_phy_cinr_measurement_preamble, + { + "Physical CINR Measurement From The Preamble", "wimax.sbc.phy_cinr_measure_preamble", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_pilot_subcarriers, + { + "Physical CINR Measurement For A Permutation Zone From Pilot Subcarriers", "wimax.sbc.phy_cinr_measure_permutation_zone.pilot_subcarriers", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_data_subcarriers, + { + "Physical CINR Measurement For A Permutation Zone From Data Subcarriers", "wimax.sbc.phy_cinr_measure_permutation_zone.data_subcarriers", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { /* 11.7.8.6 */ + &hf_sbc_pkm_flow_control, + { + "PKM Flow Control", "wimax.sbc.pkm_flow_control", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { /* 11.8.5 */ + &hf_sbc_power_save_class_types_capability, + { + "Power Save Class Types Capability", "wimax.sbc.power_save_class_types_capability", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_power_save_class_types_capability_bit0, + { + "Power Save Class Type I", "wimax.sbc.power_save_class_types_capability.bit0", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_power_save_class_types_capability_bit1, + { + "Power Save Class Type II", "wimax.sbc.power_save_class_types_capability.bit1", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_power_save_class_types_capability_bit2, + { + "Power Save Class Type III", "wimax.sbc.power_save_class_types_capability.bit2", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_power_save_class_types_capability_bits34, + { + "Number Of Power Save Class Type Instances Supported From Class Type I and II", "wimax.sbc.power_save_class_types_capability.bits34", + FT_UINT8, BASE_DEC, NULL, 0x18, "", HFILL + } + }, + { + &hf_sbc_power_save_class_types_capability_bits567, + { + "Number Of Power Save Class Type Instances Supported From Class Type III", "wimax.sbc.power_save_class_types_capability.bits567", + FT_UINT8, BASE_DEC, NULL, 0xE0, "", HFILL + } + }, + { /* 11.8.3.7.7 */ + &hf_sbc_ofdma_aas_private_chain_enable, + { + "Private Map Chain Enable", "wimax.sbc.private_chain_enable", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_ofdma_aas_private_map_concurrency, + { + "Private Map Chain Concurrency", "wimax.sbc.private_map_concurrency", + FT_UINT8, BASE_HEX, NULL, 0xC0, "", HFILL + } + }, + { + &hf_sbc_ofdma_aas_private_map_dl_frame_offset, + { + "Private Map DL Frame Offset", "wimax.sbc.private_map_dl_frame_offset", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ofdma_aas_private_map_support, + { + "Private Map Support", "wimax.sbc.private_map_support", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_ofdma_aas_private, + { + "OFDMA AAS Private Map Support", "wimax.sbc.private_map_support.ofdma_aas", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ofdma_aas_reduced_private_map_support, + { + "Reduced Private Map Support", "wimax.sbc.private_map_support.reduced", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_ofdma_aas_private_ul_frame_offset, + { + "Private Map UL Frame Offset", "wimax.sbc.private_ul_frame_offset", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_mac_pdu_rsvd, + { + "Reserved", "wimax.sbc.mac_pdu.rsvd", + FT_UINT8, BASE_HEX, NULL, 0xFC, "", HFILL + } + }, + { /* 11.8.3.2 */ + &hf_sbc_max_transmit_power, + { + "Maximum Transmit Power", "wimax.sbc.max_transmit_power", + FT_UINT32, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { /* 11.8.3.7.5 - 2 bytes */ + &hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_a, + { + "2-antenna STC Matrix A", "wimax.sbc.ss_demodulator.mimo.2.antenna.stc.matrix.a", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_horizontal, + { + "2-antenna STC Matrix B, horizontal coding", "wimax.sbc.ss_demodulator.mimo.2.antenna.stc.matrix.b.horizontal", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_vertical, + { + "2-antenna STC Matrix B, vertical coding", "wimax.sbc.ss_demodulator.mimo.2.antenna.stc.matrix.b.vertical", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_a, + { + "4-antenna STC Matrix A", "wimax.sbc.ss_demodulator.mimo.4.antenna.stc.matrix.a", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_horizontal, + { + "4-antenna STC Matrix B, horizontal coding", "wimax.sbc.ss_demodulator.mimo.4.antenna.stc.matrix.b.horizontal", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_vertical, + { + "4-antenna STC Matrix B, vertical coding", "wimax.sbc.ss_demodulator.mimo.4.antenna.stc.matrix.b.vertical", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_horizontal, + { + "4-antenna STC Matrix C, horizontal coding", "wimax.sbc.ss_demodulator.mimo.4.antenna.stc.matrix.c.horizontal", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x80, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_vertical, + { + "4-antenna STC Matrix C, vertical coding", "wimax.sbc.ss_demodulator.mimo.4.antenna.stc.matrix.c.vertical", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_rsvd, + { + "Reserved", "wimax.sbc.ss_demodulator.mimo.reserved", + FT_UINT16, BASE_HEX, NULL, 0xFF00, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_mimo_support, + { + "OFDMA SS Demodulator For MIMO Support", "wimax.sbc.ss_demodulator.mimo.support", + FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + /*11.8.3.7.11 ??? */ + { /* 11.8.3.7.12 - 170 */ + &hf_sbc_ofdma_ss_uplink_power_control_support, + { + "OFDMA SS uplink power control support", "wimax.sbc.ofdma_ss_uplink_power_control_support", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ofdma_ss_uplink_power_control_support_open_loop, + { + "Open loop", "wimax.sbc.ofdma_ss_uplink_power_control_support.open_loop", + FT_UINT8, BASE_HEX, NULL, 0x01, "", HFILL + } + }, + { + &hf_sbc_ofdma_ss_uplink_power_control_support_aas_preamble, + { + "AAS preamble", "wimax.sbc.ofdma_ss_uplink_power_control_support.aas_preamble", + FT_UINT8, BASE_HEX, NULL, 0x02, "", HFILL + } + }, + { + &hf_sbc_ofdma_ss_uplink_power_control_support_rsvd, + { + "Reserved", "wimax.sbc.ofdma_ss_uplink_power_control_support.rsvd", + FT_UINT8, BASE_HEX, NULL, 0xFC, "", HFILL + } + }, + { + &hf_sbc_tlv_t_172_dl_region_definition_support, + { + "DL Region Definition Support", "wimax.sbc.ofdma_map_capability.dl_region_definition_support", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { /* 11.8.3.7.12 - 172 */ + &hf_sbc_tlv_t_172, + { + "Support For Extended HARQ", "wimax.sbc.ofdma_map_capability.extended_harq", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_172_extended_harq_ie_capability, + { + "Extended HARQ IE Capability", "wimax.sbc.ofdma_map_capability.extended_harq_ie_capability", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_tlv_t_172_harq_map_capability, + { + "HARQ MAP Capability", "wimax.sbc.ofdma_map_capability.harq_map_capability", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { /* 11.8.3.7.12 - 171 */ + &hf_sbc_tlv_t_171_minimum_num_of_frames, + { + "The Minimum Number Of Frames That SS Takes To Switch From The Open Loop Power Control Scheme To The Closed Loop Power Control Scheme Or Vice Versa", "wimax.sbc.ofdma_ss_uplink_power_control_support.minimum_num_of_frames", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_172_reserved, + { + "Reserved", "wimax.sbc.ofdma_map_capability.reserved", + FT_UINT8, BASE_HEX, NULL, 0xE0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_172_sub_map_capability_first_zone, + { + "Sub MAP Capability For First Zone", "wimax.sbc.ofdma_map_capability.sub_map_capability_first_zone", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_tlv_t_172_sub_map_capability_other_zones, + { + "Sub MAP Capability For Other Zones", "wimax.sbc.ofdma_map_capability.sub_map_capability_other_zones", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { /* 11.8.3.7.14 */ + &hf_sbc_tlv_t_174_ofdma_ms_csit_capability, + { + "OFDMA MS CSIT Capability", "wimax.sbc.ofdma_ms_csit_capability", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_174_csit_compatibility_type_a, + { + "CSIT Compatibility Type A", "wimax.sbc.ofdma_ms_csit_capability.csit_compatibility_type_a", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_tlv_t_174_csit_compatibility_type_b, + { + "CSIT Compatibility Type B", "wimax.sbc.ofdma_ms_csit_capability.csit_compatibility_type_b", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_tlv_t_174_max_num_simultanous_sounding_instructions, + { + "Max Number Of Simultaneous Sounding Instructions", "wimax.sbc.ofdma_ms_csit_capability.max_num_simultaneous_sounding_instructions", + FT_UINT16, BASE_DEC, NULL, 0x03C0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_174_power_assignment_capability, + { + "Power Assignment Capability", "wimax.sbc.ofdma_ms_csit_capability.power_assignment_capability", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_tlv_t_174_ss_csit_reserved, + { + "Reserved", "wimax.sbc.ofdma_ms_csit_capability.reserved", + FT_UINT16, BASE_HEX, NULL, 0xF800, "", HFILL + } + }, + { + &hf_sbc_tlv_t_174_sounding_rsp_time_capability, + { + "Sounding Response Time Capability", "wimax.sbc.ofdma_ms_csit_capability.sounding_response_time_capability", + FT_BOOLEAN, 16, VALS(vals_sounding_rsp_time_cap_codings), 0x0038, "", HFILL + } + }, + { + &hf_sbc_tlv_t_174_ss_csit_type_a_support, + { + "SS Does Not Support P Values Of 9 And 18 When Supporting CSIT Type A", "wimax.sbc.ofdma_ms_csit_capability.type_a_support", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x0400, "", HFILL + } + }, + { + /* 11.8.3.7.20 */ + &hf_sbc_tlv_t_204_ofdma_parameters_sets, + { + "OFDMA parameters sets", "wimax.sbc.ofdma_parameters_sets", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_a, + { + "Support OFDMA PHY parameter set A", "wimax.sbc.ofdma_parameters_sets.phy_set_a", + FT_UINT8, BASE_HEX, NULL, 0x01, "", HFILL + } + }, + { + &hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_b, + { + "Support OFDMA PHY parameter set B", "wimax.sbc.ofdma_parameters_sets.phy_set_b", + FT_UINT8, BASE_HEX, NULL, 0x02, "", HFILL + } + }, + { + &hf_sbc_tlv_t_204_ofdma_parameters_sets_harq_parameters_set, + { + "HARQ parameters set", "wimax.sbc.ofdma_parameters_sets.harq_parameters_set", + FT_UINT8, BASE_HEX, VALS(vals_sbc_harq_parameters_set), 0x1C, "", HFILL + } + }, + { + &hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_a, + { + "Support OFDMA MAC parameters set A", "wimax.sbc.ofdma_parameters_sets.mac_set_a", + FT_UINT8, BASE_HEX, NULL, 0x20, "", HFILL + } + }, + { + &hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_b, + { + "Support OFDMA MAC parameters set B", "wimax.sbc.ofdma_parameters_sets.mac_set_b", + FT_UINT8, BASE_HEX, NULL, 0x40, "", HFILL + } + }, + { + &hf_sbc_tlv_t_204_ofdma_parameters_sets_reserved, + { + "Reserved", "wimax.sbc.ofdma_parameters_sets.reserved", + FT_UINT8, BASE_HEX, NULL, 0x80, "", HFILL + } + }, + { /* 11.8.3.7.16 */ + &hf_sbc_tlv_t_177_ofdma_ss_modulator_for_mimo_support, + { + "OFDMA SS Modulator For MIMO Support", "wimax.sbc.ofdma_ss_modulator_for_mimo_support", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_adaptive_rate_ctl, + { + "Capable Of Adaptive Rate Control", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.capable_adaptive_rate_control", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_beamforming, + { + "Capable Of Beamforming", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.capable_beamforming", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_single_antenna, + { + "Capable of single antenna transmission", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.capable_single_antenna", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_stc_matrix_b_horizontal, + { + "Capable of 2-antenna STC Matrix B, Horizontal coding", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.stc_matrix_b_horizontal", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_two_transmit_antennas, + { + "Two transmit antennas", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.two_transmit_antennas", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_capable_of_transmit_diversity, + { + "Capable of transmit diversity", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.capable_of_transmit_diversity", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_capable_of_spacial_multiplexing, + { + "Capable of spatial multiplexing", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.capable_of_spatial_multiplexing", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_stc_matrix_b_vertical, + { + "Capable of 2-antenna STC Matrix B, Vertical coding", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.stc_matrix_b_vertical", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_collaborative_sm_with_one_antenna, + { + "Capable of collaborative SM with one antenna", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.collaborative_sm_with_one_antenna", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_collaborative_sm_with_two_antennas, + { + "Collaborative SM with two antennas", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.collaborative_sm_with_two_antennas", + FT_UINT8, BASE_HEX, NULL, 0x80, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_capable_of_two_antenna, + { + "Capable of two antenna", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.capable_of_two_antenna", + FT_UINT8, BASE_HEX, NULL, 0x40, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_rsvd, + { + "Reserved", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.rsvd", + FT_UINT8, BASE_HEX, NULL, 0x80, "", HFILL + } + }, + { + &hf_sbc_tlv_t_177_stc_matrix_a, + { + "Capable of 2-antenna STC Matrix A", "wimax.sbc.ofdma_ss_modulator_for_mimo_support.stc_matrix_a", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { /* 11.8.3.7.17 */ + &hf_sbc_tlv_t_178_sdma_pilot_capability, + { + "SDMA Pilot Capability", "wimax.sbc.sdma_pilot_capability", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_178_reserved, + { + "Reserved", "wimax.sbc.sdma_pilot_capability.reserved", + FT_UINT8, BASE_HEX, NULL, 0xFC, "", HFILL + } + }, + { + &hf_sbc_tlv_t_178_sdma_pilot_pattern_support_for_amc_zone, + { + "SDMA Pilot Patterns Support For AMC Zone", "wimax.sbc.sdma_pilot_capability.sdma_pilot_pattern_support_for_amc_zone", + FT_BOOLEAN, 8, VALS(vals_sbc_sdma_str), 0x03, "", HFILL + } + }, + { /* 11.8.3.7.2 - type 151 */ + &hf_sbc_ss_demodulator, + { + "OFDMA SS Demodulator", "wimax.sbc.ss_demodulator", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + /* tlv length = 1 byte */ + { + &hf_sbc_ss_demodulator_64qam, + { + "64-QAM", "wimax.sbc.ss_demodulator.64qam", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_btc, + { + "BTC", "wimax.sbc.ss_demodulator.btc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_cc_with_optional_interleaver, + { + "CC with Optional Interleaver", "wimax.sbc.ss_demodulator.cc_with_optional_interleaver", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_ctc, + { + "CTC", "wimax.sbc.ss_demodulator.ctc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + /* tlv length = 2 bytes */ + { + &hf_sbc_ss_demodulator_64qam_2, + { + "64-QAM", "wimax.sbc.ss_demodulator.64qam", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_btc_2, + { + "BTC", "wimax.sbc.ss_demodulator.btc", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_cc_with_optional_interleaver_2, + { + "CC with Optional Interleaver", "wimax.sbc.ss_demodulator.cc_with_optional_interleaver", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_ctc_2, + { + "CTC", "wimax.sbc.ss_demodulator.ctc", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_dedicated_pilots_2, + { + "Dedicated Pilots", "wimax.sbc.ss_demodulator.dedicated_pilots", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x400, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_harq_cc_ir_2, + { + "HARQ CC_IR", "wimax.sbc.ss_demodulator.harq.cc.ir", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x100, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_harq_chase, + { + "HARQ Chase", "wimax.sbc.ss_demodulator.harq.chase", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_harq_chase_2, + { + "HARQ Chase", "wimax.sbc.ss_demodulator.harq.chase", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_harq_ctc_ir, + { + "HARQ CTC_IR", "wimax.sbc.ss_demodulator.harq.ctc.ir", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_harq_ctc_ir_2, + { + "HARQ CTC_IR", "wimax.sbc.ss_demodulator.harq.ctc.ir", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_ldpc_2, + { + "LDPC", "wimax.sbc.ss_demodulator.ldpc", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x200, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_reserved, + { + "Reserved", "wimax.sbc.ss_demodulator.reserved1", + FT_UINT8, BASE_HEX, NULL, 0x80, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_reserved_2, + { + "Reserved", "wimax.sbc.ss_demodulator.reserved2", + FT_UINT16, BASE_HEX, NULL, 0x80, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_reserved1_2, + { + "Reserved", "wimax.sbc.ss_demodulator.reserved2", + FT_UINT16, BASE_HEX, NULL, 0x800, "", HFILL + } + }, + { /* if the number of DL H-ARQ channels > 7 but tlv length = 1 */ + &hf_sbc_ss_demodulator_reserved1, + { + "Reserved", "wimax.sbc.ss_demodulator.reserved1", + FT_UINT16, BASE_HEX, NULL, 0xFFFF, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_stc, + { + "STC", "wimax.sbc.ss_demodulator.stc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_ss_demodulator_stc_2, + { + "STC", "wimax.sbc.ss_demodulator.stc", + FT_BOOLEAN, 16, TFS(&tfs_supported), 0x8, "", HFILL + } + }, +/* 11.8.3.4 - 11.8.3.6 are not supported for now */ + { /* 11.8.3.7.1 */ + &hf_sbc_ss_fft_sizes, + { + "OFDMA SS FFT Sizes", "wimax.sbc.ss_fft_sizes", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ss_fft_128, + { + "FFT-128", "wimax.sbc.ss_fft_sizes.128", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_ss_fft_256, + { + "FFT-256", "wimax.sbc.ss_fft_sizes.256", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_ss_fft_512, + { + "FFT-512", "wimax.sbc.ss_fft_sizes.512", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_ss_fft_1024, + { + "FFT-1024", "wimax.sbc.ss_fft_sizes.1024", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ss_fft_2048, + { + "FFT-2048", "wimax.sbc.ss_fft_sizes.2048", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_fft_rsvd1, + { + "Reserved", "wimax.sbc_ss_fft_sizes_rsvd1", + FT_UINT8, BASE_HEX, NULL, 0x01, "", HFILL + } + }, + { + &hf_sbc_ss_fft_rsvd2, + { + "Reserved", "wimax.sbc.ss_fft_sizes.rsvd2", + FT_UINT8, BASE_HEX, NULL, 0xE0, "", HFILL + } + }, + { + &hf_sbc_ofdm_ss_minimum_num_of_frames, + { + "SS minimum number of frames", "wimax.sbc.ss_minimum_num_of_frames", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ss_mimo_uplink_support_rsvd, + { + "Reserved", "wimax.sbc.ss_mimo_ul_support.rsvd", + FT_UINT8, BASE_HEX, NULL, 0xF8, "", HFILL + } + }, + { /* 11.8.3.7.3 - type 152 */ + &hf_sbc_ss_modulator, + { + "OFDMA SS Modulator", "wimax.sbc.ss_modulator", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ss_modulator_64qam, + { + "64-QAM", "wimax.sbc.ss_modulator.64qam", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_ss_modulator_btc, + { + "BTC", "wimax.sbc.ss_modulator.btc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_modulator_cc_ir, + { + "CC_IR", "wimax.sbc.ss_modulator.cc_ir", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { + &hf_sbc_ss_modulator_ctc, + { + "CTC", "wimax.sbc.ss_modulator.ctc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_ss_modulator_ctc_ir, + { + "CTC_IR", "wimax.sbc.ss_modulator.ctc_ir", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_ss_modulator_harq_chase, + { + "HARQ Chase", "wimax.sbc.ss_modulator.harq_chase", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ss_modulator_ldpc, + { + "LDPC", "wimax.sbc.ss_modulator.ldpc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x80, "", HFILL + } + }, + { + &hf_sbc_ss_modulator_stc, + { + "STC", "wimax.sbc.ss_modulator.stc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { /* 11.8.3.7.4 */ + &hf_sbc_ss_permutation_support, + { + "OFMDA SS Permutation Support", "wimax.sbc.ss_permutation_support", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ss_amc_1x6, + { + "AMC 1x6 ", "wimax.sbc.ss_permutation_support.amc_1x6", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_ss_amc_2x3, + { + "AMC 2x3 ", "wimax.sbc.ss_permutation_support.amc_2x3", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x8, "", HFILL + } + }, + { + &hf_sbc_ss_amc_3x2, + { + "AMC 3x2 ", "wimax.sbc.ss_permutation_support.amc_3x2", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_ss_amc_with_harq_map, + { + "AMC Support With H-ARQ Map ", "wimax.sbc.ss_permutation_support.amc_support_harq_map", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_ss_optimal_fusc, + { + "Optional FUSC", "wimax.sbc.ss_permutation_support.optimal_fusc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_ss_optimal_pusc, + { + "Optional PUSC", "wimax.sbc.ss_permutation_support.optimal_pusc", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_ss_tusc1_support, + { + "TUSC1", "wimax.sbc.ss_permutation_support.tusc1_support", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { + &hf_sbc_ss_tusc2_support, + { + "TUSC2", "wimax.sbc.ss_permutation_support.tusc2_support", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x80, "", HFILL + } + }, + { + &hf_sbc_ssrtg, + { + "SSRTG", "wimax.sbc.ssrtg", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ssttg, + { + "SSTTG", "wimax.sbc.ssttg", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_ss_support_2_concurrent_cqi_channels, + { + "Support for 2 Concurrent CQI Channels", "wimax.sbc.support_2_concurrent_cqi_channels", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { /* 11.8.3.1 */ + &hf_sbc_transition_gaps, + { + "Subscriber Transition Gaps", "wimax.sbc.transition_gaps", + FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL + } + }, + { /* 11.8.3.7.13 */ + &hf_sbc_tlv_t_173_ul_ctl_channel_support, + { + "Uplink Control Channel Support", "wimax.sbc.ul_ctl_channel_support", + FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_tlv_t_173_3_bit_mimo_fast_feedback, + { + "3-bit MIMO Fast-feedback", "wimax.sbc.ul_ctl_channel_support.3bit_mimo_fast_feedback", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x1, "", HFILL + } + }, + { + &hf_sbc_tlv_t_173_diuc_cqi_fast_feedback, + { + "DIUC-CQI Fast-feedback", "wimax.sbc.ul_ctl_channel_support.diuc_cqi_fast_feedback", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x80, "", HFILL + } + }, + { + &hf_sbc_tlv_t_173_enhanced_fast_feedback, + { + "Enhanced Fast_feedback", "wimax.sbc.ul_ctl_channel_support.enhanced_fast_feedback", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x2, "", HFILL + } + }, + { + &hf_sbc_tlv_t_173_measurement_report, + { + "A Measurement Report Shall Be Performed On The Last DL Burst", "wimax.sbc.ul_ctl_channel_support.measurement_report", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x20, "", HFILL + } + }, + { + &hf_sbc_tlv_t_173_primary_secondary_fast_feedback, + { + "Primary/Secondary FAST_FEEDBACK", "wimax.sbc.ul_ctl_channel_support.primary_secondary_fast_feedback", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x40, "", HFILL + } + }, + { + &hf_sbc_tlv_t_173_reserved, + { + "Reserved", "wimax.sbc.ul_ctl_channel_support.reserved", + FT_UINT8, BASE_HEX, NULL, 0x8, "", HFILL + } + }, + { + &hf_sbc_tlv_t_173_uep_fast_feedback, + { + "UEP Fast-feedback", "wimax.sbc.ul_ctl_channel_support.uep_fast_feedback", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x10, "", HFILL + } + }, + { + &hf_sbc_tlv_t_173_ul_ack, + { + "UL ACK", "wimax.sbc.ul_ctl_channel_support.ul_ack", + FT_BOOLEAN, 8, TFS(&tfs_supported), 0x4, "", HFILL + } + }, + { + &hf_sbc_req_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.sbc_req", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { &hf_sbc_rsp_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.sbc_rsp", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_sbc_unknown_type, + { + "Unknown SBC type", "wimax.sbc.unknown_tlv_type", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + } +}; + +/* Register Wimax Mac SBC-REQ/RSP Messages Dissectors */ +void proto_register_mac_mgmt_msg_sbc(void) +{ + if (proto_mac_mgmt_msg_sbc_decoder == -1) + { + proto_mac_mgmt_msg_sbc_decoder = proto_register_protocol ( + "WiMax SBC-REQ/RSP Messages", /* name */ + "WiMax SBC-REQ/RSP (sbc)", /* short name */ + "sbc" /* abbrev */ + ); + + proto_register_field_array(proto_mac_mgmt_msg_sbc_decoder, hf_sbc, array_length(hf_sbc)); + proto_register_subtree_array(ett_sbc, array_length(ett_sbc)); + } +} + +/* Wimax Mac SBC-REQ Message Dissector */ +void dissect_mac_mgmt_msg_sbc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, value; + gint tlv_type, tlv_len, tlv_value_offset; + guint num_dl_harq_chans; + proto_item *sbc_item = NULL; + proto_tree *sbc_tree = NULL; + proto_item *tlv_item = NULL; + proto_tree *tlv_tree = NULL; + proto_item *ti = NULL; + tlv_info_t tlv_info; + gfloat power_bpsk; + gfloat power_qpsk; + gfloat power_qam16; + gfloat power_qam64; + gfloat current_power; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if (payload_type != MAC_MGMT_MSG_SBC_REQ) + { + return; + } + + if (tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type SBC-REQ */ + sbc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_sbc_decoder, tvb, offset, tvb_len, "SS Basic Capability Request (SBC-REQ) (%u bytes)", tvb_len); + /* add MAC SBC subtree */ + sbc_tree = proto_item_add_subtree(sbc_item, ett_mac_mgmt_msg_sbc_decoder); + /* Decode and display the SS Basic Capability Request (SBC-REQ) */ + /* display the Message Type */ + proto_tree_add_item(sbc_tree, hf_sbc_req_message_type, tvb, offset, 1, FALSE); + /* set the offset for the TLV Encoded info */ + offset++; + /* process the SBC TLVs */ + while(offset < tvb_len) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if (tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "SBC-REQ TLV error"); + } + proto_tree_add_item(sbc_tree, hf_sbc_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + if (tlv_type == 0) + { /* invalid tlv type */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid SBC TLV type"); + } + proto_tree_add_item(sbc_tree, hf_sbc_unknown_type, tvb, offset, 1, FALSE); + offset++; + continue; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(sbc_tree, proto_mac_mgmt_msg_sbc_decoder, tvb, offset, (tlv_len + tlv_value_offset), "SBC-REQ Type: %u (%u bytes, offset=%u, tlv_len=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tlv_len, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* process SBC TLV Encoded information */ + switch (tlv_type) + { + case SBC_BW_ALLOC_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_bw_alloc_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_bw_alloc_support_rsvd0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_bw_alloc_support_duplex, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_bw_alloc_support_rsvd1, tvb, offset, 1, FALSE); + break; + case SBC_TRANSITION_GAPS: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_transition_gaps, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + ti = proto_tree_add_item(tlv_tree, hf_sbc_ssttg, tvb, offset, 1, FALSE); + proto_item_append_text(ti, " us (ranges: TDD 0-50; H-FDD 0-100)"); + ti = proto_tree_add_item(tlv_tree, hf_sbc_ssrtg, tvb, (offset + 1), 1, FALSE); + proto_item_append_text(ti, " us (ranges: TDD 0-50; H-FDD 0-100)"); + break; + case SBC_MAC_PDU: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_mac_pdu, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_mac_pdu_piggybacked, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_mac_pdu_fsn, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_mac_pdu_rsvd, tvb, offset, 1, FALSE); + break; + case SBC_REQ_MAX_TRANSMIT_POWER: /* TODO: This TLV comes up as INVALID in wireshark... why? */ + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_max_transmit_power, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + power_bpsk = (gfloat)(tvb_get_guint8(tvb, offset) - 128) / 2; + power_qpsk = (gfloat)(tvb_get_guint8(tvb, (offset + 1)) - 128) / 2; + power_qam16 = (gfloat)(tvb_get_guint8(tvb, (offset + 2)) - 128) / 2; + power_qam64 = (gfloat)(tvb_get_guint8(tvb, (offset + 3)) - 128) / 2; + proto_tree_add_text(tlv_tree, tvb, offset, 1, "BPSK: %.2f dBm", (gdouble)power_bpsk); + proto_tree_add_text(tlv_tree, tvb, (offset + 1), 1, "QPSK: %.2f dBm", (gdouble)power_qpsk); + proto_tree_add_text(tlv_tree, tvb, (offset + 2), 1, "QAM16: %.2f dBm", (gdouble)power_qam16); + proto_tree_add_text(tlv_tree, tvb, (offset + 3), 1, "QAM64: %.2f dBm", (gdouble)power_qam64); + break; + case SBC_REQ_CURR_TRANSMITTED_POWER: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_curr_transmit_power, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + value = tvb_get_guint8(tvb, offset); + current_power = (gfloat)(value - 128) / 2; + proto_tree_add_text(tlv_tree, tvb, offset, 1, "Current Transmitted Power: %.2f dBm (Value: 0x%x)", (gdouble)current_power, value); + break; + case SBC_SS_FFT_SIZES: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_fft_sizes, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + if (include_cor2_changes) + { + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_rsvd1, tvb, offset, 1, FALSE); + } else { + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_256, tvb, offset, 1, FALSE); + } + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_2048, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_128, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_512, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_1024, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_rsvd2, tvb, offset, 1, FALSE); + break; + case SBC_SS_DEMODULATOR: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_demodulator, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + if (tlv_len == 1) /* && (num_dl_harq_chans < 8)) */ + { + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_64qam, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_btc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_ctc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_stc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_cc_with_optional_interleaver, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_chase, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_ctc_ir, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_reserved, tvb, offset, 1, FALSE); + } + else + { + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_64qam_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_btc_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_ctc_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_stc_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_cc_with_optional_interleaver_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_chase_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_ctc_ir_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_reserved_2, tvb, offset, 2, FALSE); +#if 0 + if (tlv_len == 1) + { + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_reserved1, tvb, offset, 2, FALSE); + } + else +#endif + { + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_cc_ir_2, tvb, offset , 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_ldpc_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_dedicated_pilots_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_reserved1_2, tvb, offset, 2, FALSE); + } + } + break; + case SBC_SS_MODULATOR: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_modulator, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_64qam, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_btc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_ctc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_stc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_harq_chase, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_ctc_ir, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_cc_ir, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_ldpc, tvb, offset, 1, FALSE); + break; + case SBC_SS_NUM_UL_ARQ_ACK_CHANNEL: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_number_ul_arq_ack_channel, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_number_ul_arq_ack_channel, tvb, offset, tlv_len, FALSE); + break; + case SBC_SS_NUM_DL_ARQ_ACK_CHANNEL: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_number_dl_arq_ack_channel, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + /* get and save the value */ + num_dl_harq_chans = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tlv_tree, hf_sbc_number_dl_arq_ack_channel, tvb, offset, tlv_len, FALSE); + break; + case SBC_SS_PERMUTATION_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_permutation_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_optimal_pusc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_optimal_fusc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_amc_1x6, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_amc_2x3, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_amc_3x2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_amc_with_harq_map, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_tusc1_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_tusc2_support, tvb, offset, 1, FALSE); + break; + case SBC_SS_DEMODULATOR_MIMO_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_demodulator_mimo_support, tvb, offset, 2, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_a, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_vertical, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_horizontal, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_a, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_vertical, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_horizontal, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_vertical, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_horizontal, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_rsvd, tvb, offset, 2, FALSE); + break; + case SBC_SS_MIMO_UPLINK_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_mimo_uplink_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_mimo_uplink_support_2_ann_sttd, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_mimo_uplink_support_2_ann_sm_vertical, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_mimo_uplink_support_1_ann_coop_sm, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_mimo_uplink_support_rsvd, tvb, offset, 1, FALSE); + break; + case SBC_SS_OFDMA_AAS_PRIVATE_MAP_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_ofdma_aas_private, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_harq_map_capability, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_map_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_reduced_private_map_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_chain_enable, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_map_dl_frame_offset, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_ul_frame_offset, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_map_concurrency, tvb, offset, 1, FALSE); + break; + case SBC_SS_OFDMA_AAS_CAPABILITIES: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ofdma_aas_capabilities, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_aas_zone, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_aas_diversity_map_scan, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_aas_fbck_rsp_support, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_downlink_aas_preamble, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_uplink_aas_preamble, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_aas_capabilities_rsvd, tvb, offset, 2, FALSE); + break; + case SBC_SS_CINR_MEASUREMENT_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_cinr_measure_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_phy_cinr_measurement_preamble, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_pilot_subcarriers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_data_subcarriers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_effective_cinr_measurement_preamble, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_pilot_subcarriers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_data_subcarriers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_support_2_concurrent_cqi_channels,tvb,offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_frequency_selectivity_characterization_report,tvb,offset, 1, FALSE); + break; + case SBC_PKM_FLOW_CONTROL: + if (!include_cor2_changes) + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_pkm_flow_control, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + tlv_item = proto_tree_add_item(tlv_tree, hf_sbc_pkm_flow_control, tvb, offset, tlv_len, FALSE); + if(tvb_get_guint8(tvb, offset) == 0) + proto_item_append_text(tlv_item, " (default - no limit)"); + } + else + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_power_save_class_types_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_unknown_type, tvb, offset, tlv_len, FALSE); + } + break; + case SBC_AUTH_POLICY_SUPPORT: + /* display the TLV name and display the value in hex */ + tlv_item = proto_tree_add_item(sbc_tree, hf_sbc_auth_policy, tvb, offset, tlv_len, FALSE); + /* add TLV subtree */ + tlv_tree = proto_item_add_subtree(tlv_item, ett_sbc_req_tlv_subtree); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_privacy_802_16, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_privacy_rsvd, tvb, offset, 1, FALSE); + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_auth_policy, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_privacy_802_16, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_privacy_rsvd, tvb, offset, 1, FALSE); + if (!include_cor2_changes) + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_auth_policy, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_privacy_802_16, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_privacy_rsvd, tvb, offset, 1, FALSE); + } + else + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_power_save_class_types_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_unknown_type, tvb, offset, tlv_len, FALSE); + } + break; + case SBC_MAX_SECURITY_ASSOCIATIONS: + if (!include_cor2_changes) + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_max_security_associations, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_max_security_associations, tvb, offset, tlv_len, FALSE); + } + else + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_power_save_class_types_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_unknown_type, tvb, offset, tlv_len, FALSE); + } + break; + case SBC_TLV_T_27_EXTENSION_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_27_extension_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_27_extension_capability_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_27_extension_capability_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_28_HO_TRIGGER_METRIC_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_bit1, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_bit2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_bit3, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_167_ASSOCIATION_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_167_association_type_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit1, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit3, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit4, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_170_UPLINK_POWER_CONTROL_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ofdma_ss_uplink_power_control_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_ss_uplink_power_control_support_open_loop, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_ss_uplink_power_control_support_aas_preamble, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_ss_uplink_power_control_support_rsvd, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_171_MINIMUM_NUM_OF_FRAMES: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_171_minimum_num_of_frames, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_171_minimum_num_of_frames, tvb, offset, tlv_len, FALSE); + break; + case SBC_TLV_T_172: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_172, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_harq_map_capability, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_extended_harq_ie_capability, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_sub_map_capability_first_zone, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_sub_map_capability_other_zones, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_dl_region_definition_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_173_UL_CONTROL_CHANNEL_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_173_ul_ctl_channel_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_3_bit_mimo_fast_feedback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_enhanced_fast_feedback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_ul_ack, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_reserved, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_uep_fast_feedback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_measurement_report, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_primary_secondary_fast_feedback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_diuc_cqi_fast_feedback, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_174_OFDMA_MS_CSIT_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_174_ofdma_ms_csit_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_csit_compatibility_type_a, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_csit_compatibility_type_b, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_power_assignment_capability, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_sounding_rsp_time_capability, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_max_num_simultanous_sounding_instructions, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_ss_csit_type_a_support, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_ss_csit_reserved, tvb, offset, 2, FALSE); + break; + case SBC_TLV_T_175_MAX_NUM_BST_PER_FRM_CAPABILITY_HARQ: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_175_max_num_bst_per_frm_capability_harq, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_175_max_num_ul_harq_bst, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_175_max_num_ul_harq_per_frm_include_one_non_harq_bst, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_175_max_num_dl_harq_bst_per_harq_per_frm, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_176: /* TODO: Get an invalid TLV whenever this TLV is used. Could it be + that lengths above 2 cause this problem? */ + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_176, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit0, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit1, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit2, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit3, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit4, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit5, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit6, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit7, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit8, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit9, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit10, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit11, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit12, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit13, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit14, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit15, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit16, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit17, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit18, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit19, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_reserved, tvb, offset, 3, FALSE); + break; + case SBC_TLV_T_177_OFDMA_SS_MODULATOR_FOR_MIMO_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_177_ofdma_ss_modulator_for_mimo_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + if (include_cor2_changes) + { + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_stc_matrix_a, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_stc_matrix_b_vertical, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_stc_matrix_b_horizontal, tvb, offset, 1, FALSE); + } else { + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_two_transmit_antennas, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_capable_of_transmit_diversity, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_capable_of_spacial_multiplexing, tvb, offset, 1, FALSE); + } + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_beamforming, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_adaptive_rate_ctl, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_single_antenna, tvb, offset, 1, FALSE); + if (include_cor2_changes) + { + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_collaborative_sm_with_one_antenna, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_collaborative_sm_with_two_antennas, tvb, offset, 1, FALSE); + } else { + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_capable_of_two_antenna, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_rsvd, tvb, offset, 1, FALSE); + } + break; + case SBC_TLV_T_178_SDMA_PILOT_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_178_sdma_pilot_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_178_sdma_pilot_pattern_support_for_amc_zone, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_178_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_179_OFDMA_MULTIPLE_DL_BURST_PROFILE_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_179_ofdma_multiple_dl_burst_profile_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_179_dl_bst_profile_for_multiple_fec, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_179_ul_bst_profile_for_multiple_fec, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_179_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_204_OFDMA_PARAMETERS_SETS: + if (include_cor2_changes) + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_a, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_b, tvb, offset, 1, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_harq_parameters_set, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_a, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_b, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_reserved, tvb, offset, 1, FALSE); + } + break; + case SBC_TLV_T_162_HARQ_INCREMENTAL_REDUNDANCY_BUFFER_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_NEP, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_dl, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved1, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_ul_harq_incremental_redundancy_buffer_capability_NEP, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_ul, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved2, tvb, offset, 2, FALSE); + break; + case SBC_TLV_T_163_HARQ_CHASE_COMBINING_AND_CC_IR_BUFFER_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_dl_harq_buffering_capability_for_chase_combining, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_dl, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved1, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_ul_harq_buffering_capability_for_chase_combining, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_ul, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved2, tvb, offset, 2, FALSE); + break; + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETERS: + /* display Security Negotiation Parameters Title */ + /* add Security Negotiation Parameters subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, proto_mac_mgmt_msg_sbc_decoder, tvb, offset, tlv_len, "Security Negotiation Parameters (%u bytes)", tlv_len); + /* call the Security Negotiation Parameters decoder */ + wimax_security_negotiation_parameters_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case SBC_TLV_T_26_POWER_SAVE_CLASS_TYPES_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_power_save_class_types_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bit1, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bit2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bits34, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bits567, tvb, offset, 1, FALSE); + break; + default: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_power_save_class_types_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ + } +} + +/* Wimax Mac SBC-RSP Message Dissector */ +void dissect_mac_mgmt_msg_sbc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, value; + gint tlv_type, tlv_len, tlv_value_offset; +/* guint ssttg, ssrtg;*/ + guint num_dl_harq_chans; /*, num_ul_harq_chans;*/ + proto_item *sbc_item = NULL; + proto_tree *sbc_tree = NULL; + proto_item *tlv_item = NULL; + proto_tree *tlv_tree = NULL; + proto_item *ti = NULL; + tlv_info_t tlv_info; + gfloat power_bpsk; + gfloat power_qpsk; + gfloat power_qam16; + gfloat power_qam64; + gfloat current_power; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if (payload_type != MAC_MGMT_MSG_SBC_RSP) + { + return; + } + + if (tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type SBC-RSP */ + sbc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_sbc_decoder, tvb, offset, tvb_len, "SS Basic Capability Response (SBC-RSP) (%u bytes)", tvb_len); + /* add MAC SBC subtree */ + sbc_tree = proto_item_add_subtree(sbc_item, ett_mac_mgmt_msg_sbc_decoder); + /* Decode and display the SS Basic Capability Response (SBC-RSP) */ + /* display the Message Type */ + proto_tree_add_item(sbc_tree, hf_sbc_rsp_message_type, tvb, offset, 1, FALSE); + /* set the offset for the TLV Encoded info */ + offset++; + /* process the SBC TLVs */ + while(offset < tvb_len) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if (tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "SBC-RSP TLV error"); + } + proto_tree_add_item(sbc_tree, hf_sbc_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + if (tlv_type == 0) + { /* invalid tlv type */ + if (pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid SBC TLV type"); + } + proto_tree_add_item(sbc_tree, hf_sbc_unknown_type, tvb, offset, 1, FALSE); + offset++; + continue; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(sbc_tree, proto_mac_mgmt_msg_sbc_decoder, tvb, offset, (tlv_len + tlv_value_offset), "SBC-RSP Type: %u (%u bytes, offset=%u, tlv_len=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tlv_len, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* process SBC TLV Encoded information */ + switch (tlv_type) + { + case SBC_BW_ALLOC_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_bw_alloc_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_bw_alloc_support_rsvd0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_bw_alloc_support_duplex, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_bw_alloc_support_rsvd1, tvb, offset, 1, FALSE); + break; + case SBC_TRANSITION_GAPS: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_transition_gaps, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + ti = proto_tree_add_item(tlv_tree, hf_sbc_ssttg, tvb, offset, 1, FALSE); + proto_item_append_text(ti, " us (ranges: TDD 0-50; H-FDD 0-100)"); + ti = proto_tree_add_item(tlv_tree, hf_sbc_ssrtg, tvb, (offset + 1), 1, FALSE); + proto_item_append_text(ti, " us (ranges: TDD 0-50; H-FDD 0-100)"); + break; + case SBC_MAC_PDU: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_mac_pdu, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_mac_pdu_piggybacked, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_mac_pdu_fsn, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_mac_pdu_rsvd, tvb, offset, 1, FALSE); + break; + case SBC_REQ_MAX_TRANSMIT_POWER: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_max_transmit_power, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + power_bpsk = (gfloat)(tvb_get_guint8(tvb, offset) - 128) / 2; + power_qpsk = (gfloat)(tvb_get_guint8(tvb, (offset + 1)) - 128) / 2; + power_qam16 = (gfloat)(tvb_get_guint8(tvb, (offset + 2)) - 128) / 2; + power_qam64 = (gfloat)(tvb_get_guint8(tvb, (offset + 3)) - 128) / 2; + proto_tree_add_text(tlv_tree, tvb, offset, 1, "BPSK: %.2f dBm", (gdouble)power_bpsk); + proto_tree_add_text(tlv_tree, tvb, (offset + 1), 1, "QPSK: %.2f dBm", (gdouble)power_qpsk); + proto_tree_add_text(tlv_tree, tvb, (offset + 2), 1, "QAM16: %.2f dBm", (gdouble)power_qam16); + proto_tree_add_text(tlv_tree, tvb, (offset + 3), 1, "QAM64: %.2f dBm", (gdouble)power_qam64); + break; + case SBC_REQ_CURR_TRANSMITTED_POWER: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_curr_transmit_power, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + value = tvb_get_guint8(tvb, offset); + current_power = (gfloat)(value - 128) / 2; + proto_tree_add_text(tlv_tree, tvb, offset, 1, "Current Transmitted Power: %.2f dBm (Value: 0x%x)", (gdouble)current_power, value); + break; + case SBC_SS_FFT_SIZES: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ss_fft_sizes, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + if (include_cor2_changes) + { + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_rsvd1, tvb, offset, 1, FALSE); + } else { + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_256, tvb, offset, 1, FALSE); + } + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_2048, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_128, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_512, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_1024, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_fft_rsvd2, tvb, offset, 1, FALSE); + break; + case SBC_SS_DEMODULATOR: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ss_demodulator, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + if (tlv_len == 1) /* && (num_dl_harq_chans < 8)) */ + { + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_64qam, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_btc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_ctc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_stc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_cc_with_optional_interleaver, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_chase, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_ctc_ir, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_reserved, tvb, offset, 1, FALSE); + } + else + { + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_64qam_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_btc_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_ctc_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_stc_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_cc_with_optional_interleaver_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_chase_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_ctc_ir_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_reserved_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_harq_cc_ir_2, tvb, offset , 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_ldpc_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_dedicated_pilots_2, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_reserved1_2, tvb, offset, 2, FALSE); + } + break; + case SBC_SS_MODULATOR: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_req_tlv_subtree, sbc_tree, hf_sbc_ss_modulator, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_64qam, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_btc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_ctc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_stc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_harq_chase, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_ctc_ir, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_cc_ir, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_modulator_ldpc, tvb, offset, 1, FALSE); + break; + case SBC_SS_NUM_UL_ARQ_ACK_CHANNEL: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_number_ul_arq_ack_channel, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_number_ul_arq_ack_channel, tvb, offset, tlv_len, FALSE); + break; + case SBC_SS_NUM_DL_ARQ_ACK_CHANNEL: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_number_dl_arq_ack_channel, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + /* get and save the value */ + num_dl_harq_chans = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tlv_tree, hf_sbc_number_dl_arq_ack_channel, tvb, offset, tlv_len, FALSE); + break; + case SBC_SS_PERMUTATION_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ss_permutation_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_optimal_pusc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_optimal_fusc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_amc_1x6, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_amc_2x3, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_amc_3x2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_amc_with_harq_map, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_tusc1_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_tusc2_support, tvb, offset, 1, FALSE); + break; + case SBC_SS_DEMODULATOR_MIMO_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ss_demodulator_mimo_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_a, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_vertical, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_horizontal, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_a, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_vertical, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_horizontal, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_vertical, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_horizontal, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_demodulator_mimo_rsvd, tvb, offset, 2, FALSE); + break; + case SBC_SS_MIMO_UPLINK_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ss_mimo_uplink_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_mimo_uplink_support_2_ann_sttd, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_mimo_uplink_support_2_ann_sm_vertical, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_mimo_uplink_support_1_ann_coop_sm, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_mimo_uplink_support_rsvd, tvb, offset, 1, FALSE); + break; + case SBC_SS_OFDMA_AAS_PRIVATE_MAP_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ss_ofdma_aas_private, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_harq_map_capability, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_map_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_reduced_private_map_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_chain_enable, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_map_dl_frame_offset, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_ul_frame_offset, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_aas_private_map_concurrency, tvb, offset, 1, FALSE); + break; + case SBC_SS_OFDMA_AAS_CAPABILITIES: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ofdma_aas_capabilities, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_aas_zone, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_aas_diversity_map_scan, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_aas_fbck_rsp_support, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_downlink_aas_preamble, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_uplink_aas_preamble, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_ofdma_aas_capabilities_rsvd, tvb, offset, 2, FALSE); + break; + case SBC_SS_CINR_MEASUREMENT_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ss_cinr_measure_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ss_phy_cinr_measurement_preamble, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_pilot_subcarriers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_data_subcarriers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_effective_cinr_measurement_preamble, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_pilot_subcarriers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_data_subcarriers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_support_2_concurrent_cqi_channels,tvb,offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ss_frequency_selectivity_characterization_report,tvb,offset, 1, FALSE); + break; + case SBC_PKM_FLOW_CONTROL: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_pkm_flow_control, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + tlv_item = proto_tree_add_item(tlv_tree, hf_sbc_pkm_flow_control, tvb, offset, tlv_len, FALSE); + if (tvb_get_guint8(tvb, offset) == 0) + { + proto_item_append_text(tlv_item, " (default - no limit)"); + } + break; + case SBC_AUTH_POLICY_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_auth_policy, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_privacy_802_16, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_privacy_rsvd, tvb, offset, 1, FALSE); + break; + case SBC_MAX_SECURITY_ASSOCIATIONS: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_max_security_associations, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_max_security_associations, tvb, offset, tlv_len, FALSE); + break; + case SBC_TLV_T_27_EXTENSION_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_27_extension_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_27_extension_capability_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_27_extension_capability_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_28_HO_TRIGGER_METRIC_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_bit1, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_bit2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_bit3, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_28_ho_trigger_metric_support_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_167_ASSOCIATION_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_167_association_type_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit1, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit3, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_bit4, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_167_association_type_support_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_170_UPLINK_POWER_CONTROL_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_ofdma_ss_uplink_power_control_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_ss_uplink_power_control_support_open_loop, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_ss_uplink_power_control_support_aas_preamble, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_ofdma_ss_uplink_power_control_support_rsvd, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_171_MINIMUM_NUM_OF_FRAMES: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_171_minimum_num_of_frames, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_171_minimum_num_of_frames, tvb, offset, tlv_len, FALSE); + break; + case SBC_TLV_T_172: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_172, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_harq_map_capability, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_extended_harq_ie_capability, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_sub_map_capability_first_zone, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_sub_map_capability_other_zones, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_dl_region_definition_support, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_172_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_173_UL_CONTROL_CHANNEL_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_173_ul_ctl_channel_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_3_bit_mimo_fast_feedback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_enhanced_fast_feedback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_ul_ack, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_reserved, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_uep_fast_feedback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_measurement_report, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_primary_secondary_fast_feedback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_173_diuc_cqi_fast_feedback, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_174_OFDMA_MS_CSIT_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_174_ofdma_ms_csit_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_csit_compatibility_type_a, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_csit_compatibility_type_b, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_power_assignment_capability, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_sounding_rsp_time_capability, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_max_num_simultanous_sounding_instructions, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_ss_csit_type_a_support, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_174_ss_csit_reserved, tvb, offset, 2, FALSE); + break; + case SBC_TLV_T_175_MAX_NUM_BST_PER_FRM_CAPABILITY_HARQ: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_175_max_num_bst_per_frm_capability_harq, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_175_max_num_ul_harq_bst, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_175_max_num_ul_harq_per_frm_include_one_non_harq_bst, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_175_max_num_dl_harq_bst_per_harq_per_frm, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_176: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_176, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit0, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit1, tvb, offset, 3, FALSE); + if (include_cor2_changes) + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit2_cor2, tvb, offset, 3, FALSE); + else + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit2, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit3, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit4, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit5, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit6, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit7, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit8, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit9, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit10, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit11, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit12, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit13, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit14, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit15, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit16, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit17, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit18, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_bit19, tvb, offset, 3, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_176_reserved, tvb, offset, 3, FALSE); + break; + case SBC_TLV_T_177_OFDMA_SS_MODULATOR_FOR_MIMO_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_177_ofdma_ss_modulator_for_mimo_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + if (include_cor2_changes) + { + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_stc_matrix_a, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_stc_matrix_b_vertical, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_stc_matrix_b_horizontal, tvb, offset, 1, FALSE); + } else { + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_two_transmit_antennas, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_capable_of_transmit_diversity, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_capable_of_spacial_multiplexing, tvb, offset, 1, FALSE); + } + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_beamforming, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_adaptive_rate_ctl, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_single_antenna, tvb, offset, 1, FALSE); + if (include_cor2_changes) + { + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_collaborative_sm_with_one_antenna, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_collaborative_sm_with_two_antennas, tvb, offset, 1, FALSE); + } else { + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_capable_of_two_antenna, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_177_rsvd, tvb, offset, 1, FALSE); + } + break; + case SBC_TLV_T_178_SDMA_PILOT_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_178_sdma_pilot_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_178_sdma_pilot_pattern_support_for_amc_zone, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_178_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_179_OFDMA_MULTIPLE_DL_BURST_PROFILE_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_179_ofdma_multiple_dl_burst_profile_support, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_179_dl_bst_profile_for_multiple_fec, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_179_ul_bst_profile_for_multiple_fec, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_179_reserved, tvb, offset, 1, FALSE); + break; + case SBC_TLV_T_204_OFDMA_PARAMETERS_SETS: + if (include_cor2_changes) + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_a, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_b, tvb, offset, 1, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_harq_parameters_set, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_a, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_b, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_204_ofdma_parameters_sets_reserved, tvb, offset, 1, FALSE); + } + break; + case SBC_TLV_T_162_HARQ_INCREMENTAL_REDUNDANCY_BUFFER_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_NEP, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_dl, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved1, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_ul_harq_incremental_redundancy_buffer_capability_NEP, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_ul, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved2, tvb, offset, 2, FALSE); + break; + case SBC_TLV_T_163_HARQ_CHASE_COMBINING_AND_CC_IR_BUFFER_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_dl_harq_buffering_capability_for_chase_combining, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_dl, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved1, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_ul_harq_buffering_capability_for_chase_combining, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_ul, tvb, offset, 2, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved2, tvb, offset, 2, FALSE); + break; + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETERS: + /* display Security Negotiation Parameters Title */ + tlv_item = proto_tree_add_protocol_format(sbc_tree, proto_mac_mgmt_msg_sbc_decoder, tvb, offset, tvb_len, "Security Negotiation Parameters (%u bytes)", tvb_len); + /* add Security Negotiation Parameters subtree */ + tlv_tree = proto_item_add_subtree(tlv_item, ett_sbc_rsp_tlv_subtree); + /* call the Security Negotiation Parameters decoder */ + wimax_security_negotiation_parameters_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case SBC_TLV_T_26_POWER_SAVE_CLASS_TYPES_CAPABILITY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_power_save_class_types_capability, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bit1, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bit2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bits34, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sbc_power_save_class_types_capability_bits567, tvb, offset, 1, FALSE); + break; + default: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sbc_rsp_tlv_subtree, sbc_tree, hf_sbc_unknown_type, tvb, offset, tlv_len, FALSE); + /* display the detail meanings of the TLV value */ + proto_tree_add_item(tlv_tree, hf_sbc_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ + } +} diff --git a/plugins/wimax/msg_ucd.c b/plugins/wimax/msg_ucd.c new file mode 100644 index 0000000000..b725fd4221 --- /dev/null +++ b/plugins/wimax/msg_ucd.c @@ -0,0 +1,1216 @@ +/* msg_ucd.c + * WiMax MAC Management UCD Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* +#define DEBUG +*/ + +#include <gmodule.h> +#include <epan/packet.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" + +extern gint proto_mac_mgmt_msg_dcd_decoder; +extern gboolean include_cor2_changes; + +guint cqich_id_size; /* Set for CQICH_Alloc_IE */ + +/* forward reference */ +void proto_register_mac_mgmt_msg_ucd(void); +void dissect_mac_mgmt_msg_ucd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_ucd_decoder = -1; +static gint ett_mac_mgmt_msg_ucd_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_mac_mgmt_msg_ucd_decoder, +}; + +/* fix fields */ +static gint hf_ucd_message_type = -1; +static gint hf_ucd_res_timeout = -1; +static gint hf_ucd_bw_req_size = -1; +static gint hf_ucd_ranging_req_size = -1; +static gint hf_ucd_freq = -1; +static gint hf_ucd_subchan_params_num_chan = -1; +static gint hf_ucd_ul_allocated_subchannles_bitmap = -1; +static gint hf_ucd_subchan_params_num_sym = -1; +static gint hf_ucd_subchan_codes = -1; + +static gint hf_ucd_ul_burst_reserved = -1; +static gint hf_ucd_ul_burst_uiuc = -1; +static gint hf_ucd_burst_fec = -1; +static gint hf_ucd_burst_ranging_data_ratio = -1; +//static gint hf_ucd_burst_power_boost = -1; +//static gint hf_ucd_burst_tcs_enable = -1; + +static gint hf_ucd_tlv_t_159_band_amc_allocation_threshold = -1; +static gint hf_ucd_tlv_t_158_optional_permutation_ul_allocated_subchannels_bitmap = -1; +static gint hf_ucd_tlv_t_160_band_amc_release_threshold = -1; +static gint hf_ucd_tlv_t_161_band_amc_allocation_timer = -1; +static gint hf_ucd_tlv_t_162_band_amc_release_timer = -1; +static gint hf_ucd_tlv_t_163_band_status_report_max_period = -1; +static gint hf_ucd_tlv_t_164_band_amc_retry_timer = -1; +static gint hf_ucd_tlv_t_171_harq_ack_delay_dl_burst = -1; +static gint hf_ucd_tlv_t_170_safety_channel_retry_timer = -1; +static gint hf_ucd_tlv_t_172_cqich_band_amc_transition_delay = -1; +static gint hf_ucd_tlv_t_174_maximum_retransmission = -1; +static gint hf_ucd_tlv_t_177_normalized_cn_override2 = -1; +static gint hf_ucd_tlv_t_177_normalized_cn_override2_first_line = -1; +static gint hf_ucd_tlv_t_177_normalized_cn_override2_list = -1; +static gint hf_ucd_tlv_t_176_size_of_cqich_id_field = -1; +static gint hf_ucd_tlv_t_186_upper_bound_aas_preamble = -1; +static gint hf_ucd_tlv_t_187_lower_bound_aas_preamble = -1; +static gint hf_ucd_tlv_t_188_allow_aas_beam_select_message = -1; +static gint hf_ucd_tlv_t_189_use_cqich_indication_flag = -1; +static gint hf_ucd_tlv_t_190_ms_specific_up_power_addjustment_step = -1; +static gint hf_ucd_tlv_t_191_ms_specific_down_power_addjustment_step = -1; +static gint hf_ucd_tlv_t_192_min_level_power_offset_adjustment = -1; +static gint hf_ucd_tlv_t_193_max_level_power_offset_adjustment = -1; +static gint hf_ucd_tlv_t_194_handover_ranging_codes = -1; +static gint hf_ucd_tlv_t_195_initial_ranging_interval = -1; +static gint hf_ucd_tlv_t_196_tx_power_report = -1; +static gint hf_ucd_tlv_t_196_tx_power_report_threshold = -1; +static gint hf_ucd_tlv_t_196_tx_power_report_interval = -1; +static gint hf_ucd_tlv_t_196_tx_power_report_a_p_avg = -1; +static gint hf_ucd_tlv_t_196_tx_power_report_threshold_icqch = -1; +static gint hf_ucd_tlv_t_196_tx_power_report_interval_icqch = -1; +static gint hf_ucd_tlv_t_196_tx_power_report_a_p_avg_icqch = -1; +static gint hf_ucd_tlv_t_197_normalized_cn_channel_sounding = -1; +static gint hf_ucd_tlv_t_202_uplink_burst_profile_for_multiple_fec_types = -1; +static gint hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation = -1; +static gint hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst = -1; +static gint hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg = -1; +static gint hf_ucd_tlv_t_207_ul_initial_transmit_timing = -1; +static gint hf_ucd_tlv_t_210_fast_feedback_region = -1; +static gint hf_ucd_tlv_t_211_harq_ack_region = -1; +static gint hf_ucd_tlv_t_212_ranging_region = -1; +static gint hf_ucd_tlv_t_213_sounding_region = -1; +static gint hf_ucd_tlv_t_150_initial_ranging_codes = -1; +static gint hf_ucd_tlv_t_151_periodic_ranging_codes = -1; +static gint hf_ucd_tlv_t_152_bandwidth_request_codes = -1; +static gint hf_ucd_tlv_t_155_start_of_ranging_codes_group = -1; +static gint hf_ucd_tlv_t_156_permutation_base = -1; + +static gint hf_ucd_unknown_type = -1; +static gint hf_ucd_invalid_tlv = -1; + +static const value_string vals_dcd_burst_tcs[] = +{ + {0, "TCS disabled"}, + {1, "TCS enabled"}, + {0, NULL} +}; + +static const value_string vals_dcd_burst_fec[] = +{ + {0, "QPSK (CC) 1/2"}, + {1, "QPSK (CC) 3/4"}, + {2, "16-QAM (CC) 1/2"}, + {3, "16-QAM (CC) 3/4"}, + {4, "64-QAM (CC) 1/2"}, + {5, "64-QAM (CC) 2/3"}, + {6, "64-QAM (CC) 3/4"}, + {7, "QPSK (BTC) 1/2"}, + {8, "QPSK (BTC) 3/4 or 2/3"}, + {9, "16-QAM (BTC) 3/5"}, + {10, "16-QAM (BTC) 4/5"}, + {11, "64-QAM (BTC) 2/3 or 5/8"}, + {12, "64-QAM (BTC) 5/6 or 4/5"}, + {13, "QPSK (CTC) 1/2"}, + {14, "Reserved"}, + {15, "QPSK (CTC) 3/4"}, + {16, "16-QAM (CTC) 1/2"}, + {17, "16-QAM (CTC) 3/4"}, + {18, "64-QAM (CTC) 1/2"}, + {19, "64-QAM (CTC) 2/3"}, + {20, "64-QAM (CTC) 3/4"}, + {21, "64-QAM (CTC) 5/6"}, + {22, "QPSK (ZT CC) 1/2"}, + {23, "QPSK (ZT CC) 3/4"}, + {24, "16-QAM (ZT CC) 1/2"}, + {25, "16-QAM (ZT CC) 3/4"}, + {26, "64-QAM (ZT CC) 1/2"}, + {27, "64-QAM (ZT CC) 2/3"}, + {28, "64-QAM (ZT CC) 3/4"}, + {29, "QPSK (LDPC) 1/2"}, + {30, "QPSK (LDPC) 2/3 A code"}, + {31, "16-QAM (LDPC) 3/4 A code"}, + {32, "16-QAM (LDPC) 1/2"}, + {33, "16-QAM (LDPC) 2/3 A code"}, + {34, "16-QAM (LDPC) 3/4 A code"}, + {35, "64-QAM (LDPC) 1/2"}, + {36, "64-QAM (LDPC) 2/3 A code"}, + {37, "64-QAM (LDPC) 3/4 A code"}, + {38, "QPSK (LDPC) 2/3 B code"}, + {39, "QPSK (LDPC) 3/4 B code"}, + {40, "16-QAM (LDPC) 2/3 B code"}, + {41, "16-QAM (LDPC) 3/4 B code"}, + {42, "64-QAM (LDPC) 2/3 B code"}, + {43, "64-QAM (LDPC) 3/4 B code"}, + {44, "QPSK (CC with optional interleaver) 1/2"}, + {45, "QPSK (CC with optional interleaver) 3/4"}, + {46, "16-QAM (CC with optional interleaver) 1/2"}, + {47, "16-QAM (CC optional interleaver) 0%00"}, + {48, "64-QAM (CC with optional interleaver) 2/3"}, + {49, "64-QAM (CC with optional interleaver) 3/4"}, + {50, "QPSK (LDPC) 5/6"}, + {51, "16-QAM (LDPC) 5/6"}, + {52, "64-QAM (LDPC) 5/6"}, + {0, NULL} +}; + +static const value_string vals_ucd_cqich_size[] = +{ + {0, "0 bits"}, + {1, "3 bits"}, + {2, "4 bits"}, + {3, "5 bits"}, + {4, "6 bits"}, + {5, "7 bits"}, + {6, "8 bits"}, + {7, "9 bits"}, + {0, NULL} +}; + +static const value_string vals_yes_no_str[] = +{ + {0, "No"}, + {1, "Yes"}, + {0, NULL} +}; + +/* UCD display */ +static hf_register_info hf[] = +{ + { + &hf_ucd_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.ucd", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_188_allow_aas_beam_select_message, + { + "Allow AAS Beam Select Message", "wimax.ucd.allow_aas_beam_select_message", + FT_INT8, BASE_DEC, VALS(vals_yes_no_str), 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_159_band_amc_allocation_threshold, + { + "Band AMC Allocation Threshold ", "wimax.ucd.band_amc.allocation_threshold", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_161_band_amc_allocation_timer, + { + "Band AMC Allocation Timer", "wimax.ucd.band_amc.allocation_timer", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_160_band_amc_release_threshold, + { + "Band AMC Release Threshold", "wimax.ucd.band_amc.release_threshold", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_162_band_amc_release_timer, + { + "Band AMC Release Timer", "wimax.ucd.band_amc.release_timer", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_164_band_amc_retry_timer, + { + "Band AMC Retry Timer", "wimax.ucd.band_amc.retry_timer", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_163_band_status_report_max_period, + { + "Band Status Report MAC Period", "wimax.ucd.band_status.report_max_period", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_152_bandwidth_request_codes, + { + "Bandwidth Request Codes", "wimax.ucd.bandwidth_request", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_burst_fec, + { + "FEC Code Type", "wimax.ucd.burst.fec", + FT_UINT8, BASE_HEX, VALS(vals_dcd_burst_fec), 0, "", HFILL + } + }, + { + &hf_ucd_burst_ranging_data_ratio, + { + "Ranging Data Ratio", "wimax.ucd.burst.ranging_data_ratio", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_ul_burst_reserved, + { + "Reserved", "wimax.ucd.burst.reserved", + FT_UINT8, BASE_HEX, NULL, 0xF0, "", HFILL + } + }, + { + &hf_ucd_ul_burst_uiuc, + { + "UIUC", "wimax.ucd.burst.uiuc", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, +#if 0 + { + &hf_ucd_burst_power_boost, + {"Focused Contention Power Boost", "wimax.ucd.burst.power_boost", FT_UINT8, BASE_HEX, NULL, 0, "", HFILL} + }, + { + &hf_ucd_burst_tcs_enable, + {"TCS", "wimax.ucd.burst.tcs", FT_UINT8, BASE_DEC, VALS(vals_dcd_burst_tcs), 0, "", HFILL} + }, +#endif + { + &hf_ucd_bw_req_size, + { + "Bandwidth Request Opportunity Size", "wimax.ucd.bw_req_size", + FT_UINT16, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_172_cqich_band_amc_transition_delay, + { + "CQICH Band AMC-Transition Delay", "wimax.ucd.cqich_band_amc_transition_delay", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_freq, + { + "Frequency", "wimax.ucd.frequency", + FT_UINT32, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_194_handover_ranging_codes, + { + "Handover Ranging Codes", "wimax.ucd.handover_ranging_codes", + FT_INT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_171_harq_ack_delay_dl_burst, + { + "HARQ ACK Delay for DL Burst", "wimax.ucd.harq_ack_delay_dl_burst", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_150_initial_ranging_codes, + { + "Initial Ranging Codes", "wimax.ucd.initial_ranging_codes", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_195_initial_ranging_interval, + { + "Number of Frames Between Initial Ranging Interval Allocation", "wimax.ucd.initial_ranging_interval", + FT_INT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_invalid_tlv, + { + "Invalid TLV", "wimax.ucd.invalid_tlv", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_187_lower_bound_aas_preamble, + { + "Lower Bound AAS Preamble (in units of 0.25 dB)", "wimax.ucd.lower_bound_aas_preamble", + FT_INT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_192_min_level_power_offset_adjustment, + { + "Minimum Level of Power Offset Adjustment (in units of 0.1 dB)", "wimax.ucd.min_level_power_offset_adjustment", + FT_INT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_193_max_level_power_offset_adjustment, + { + "Maximum Level of Power Offset Adjustment (in units of 0.1 dB)", "wimax.ucd.max_level_power_offset_adjustment", + FT_INT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_174_maximum_retransmission, + { + "Maximum Number of Retransmission in UL-HARQ", "wimax.ucd.max_number_of_retransmission_in_ul_harq", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_191_ms_specific_down_power_addjustment_step, + { + "MS-specific Down Power Offset Adjustment Step (in units of 0.01 dB)", "wimax.ucd.ms_specific_down_power_offset_adjustment_step", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_190_ms_specific_up_power_addjustment_step, + { + "MS-specific Up Power Offset Adjustment Step (in units of 0.01 dB)", "wimax.ucd.ms_specific_up_power_offset_adjustment_step", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_197_normalized_cn_channel_sounding, + { + "Normalized C/N for Channel Sounding", "wimax.ucd.normalized_cn.channel_sounding", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_177_normalized_cn_override2, + { + "Normalized C/N Override 2", "wimax.ucd.normalized_cn.override_2", + FT_STRING, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_177_normalized_cn_override2_first_line, + { + "Normalized C/N Value", "wimax.ucd.normalized_cn.override_first_line", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_177_normalized_cn_override2_list, + { + "Normalized C/N Value List", "wimax.ucd.normalized_cn.override_list", + FT_STRING, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_158_optional_permutation_ul_allocated_subchannels_bitmap, + { + "Optional permutation UL allocated subchannels bitmap ", "wimax.ucd.optional_permutation_ul_allocated_subchannels_bitmap", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_151_periodic_ranging_codes, + { + "Periodic Ranging Codes", "wimax.ucd.periodic_ranging_codes", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_156_permutation_base, + { + "Permutation Base", "wimax.ucd.permutation_base", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_ranging_req_size, + { + "Ranging Request Opportunity Size", "wimax.ucd.ranging_req_size", + FT_UINT16, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_res_timeout, + { + "Contention-based Reservation Timeout", "wimax.ucd.res_timeout", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_170_safety_channel_retry_timer, + { + "Safety Channel Release Timer", "wimax.ucd.safety_channel_release_timer", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_176_size_of_cqich_id_field, + { + "Size of CQICH_ID Field", "wimax.ucd.size_of_cqich_id_field", + FT_UINT8, BASE_DEC, VALS(vals_ucd_cqich_size), 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_155_start_of_ranging_codes_group, + { + "Start of Ranging Codes Group", "wimax.ucd.start_of_ranging_codes_group", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_ul_allocated_subchannles_bitmap, + { + "UL Allocated Subchannels Bitmap", "wimax.ucd.subchan.bitmap", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_subchan_codes, + { + "Periodic Ranging Codes", "wimax.ucd.subchan.codes", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_subchan_params_num_chan, + { + "Number of Subchannels", "wimax.ucd.subchan.num_chan", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_subchan_params_num_sym, + { + "Number of OFDMA Symbols", "wimax.ucd.subchan.num_sym", + FT_UINT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_196_tx_power_report, + { + "Tx Power Report", "wimax.ucd.tx_power_report", + FT_UINT24, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_196_tx_power_report_a_p_avg, + { + "A p_avg (in multiples of 1/16)", "wimax.ucd.tx_power_report.a_p_avg", + FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_196_tx_power_report_a_p_avg_icqch, + { + "A p_avg (in multiples of 1/16) when ICQCH is allocated", "wimax.ucd.tx_power_report.a_p_avg_icqch", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, + { + &hf_ucd_tlv_t_196_tx_power_report_interval, + { + "Interval (expressed as power of 2)", "wimax.ucd.tx_power_report.interval", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, + { + &hf_ucd_tlv_t_196_tx_power_report_interval_icqch, + { + "Interval When ICQCH is Allocated (expressed as power of 2)", "wimax.ucd.tx_power_report.interval_icqch", + FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_196_tx_power_report_threshold, + { + "Threshold", "wimax.ucd.tx_power_report.threshold", + FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_196_tx_power_report_threshold_icqch, + { + "Threshold When ICQCH is Allocated to SS (in dB)", "wimax.ucd.tx_power_report.threshold_icqch", + FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL + } + }, + { + &hf_ucd_unknown_type, + { + "Unknown UCD Type", "wimax.ucd.unknown_tlv_type", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_202_uplink_burst_profile_for_multiple_fec_types, + { + "Uplink Burst Profile for Multiple FEC Types", "wimax.ucd.uplink_burst_profile.multiple_fec_types", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation, + { + "Uplink PUSC Subchannel Rotation", "wimax.ucd.uplink_burst_profile.ul_pusc_subchannel_rotation", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst, + { + "Relative Power Offset UL HARQ Burst", "wimax.ucd.uplink_burst_profile.relative_power_offset_ul_harq_burst", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg, + { + "Relative Power Offset UL Burst Containing MAC Mgmt Msg", "wimax.ucd.uplink_burst_profile.relative_power_offset_ul_burst_mac_mgmt_msg", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_207_ul_initial_transmit_timing, + { + "UL Initial Transmit Timing", "wimax.ucd.uplink_burst_profile.ul_initial_transmit_timing", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_210_fast_feedback_region, + { + "Fast Feedback Region", "wimax.ucd.uplink_burst_profile.fast_feedback_region", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_211_harq_ack_region, + { + "HARQ ACK Region", "wimax.ucd.uplink_burst_profile.harq_ack_region", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_212_ranging_region, + { + "Ranging Region", "wimax.ucd.uplink_burst_profile.ranging_region", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_213_sounding_region, + { + "Sounding Region", "wimax.ucd.uplink_burst_profile.sounding_region", + FT_BYTES, BASE_HEX, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_186_upper_bound_aas_preamble, + { + "Upper Bound AAS Preamble (in units of 0.25 dB)", "wimax.ucd.upper_bound_aas_preamble", + FT_INT8, BASE_DEC, NULL, 0, "", HFILL + } + }, + { + &hf_ucd_tlv_t_189_use_cqich_indication_flag, + { + "Use CQICH Indication Flag", "wimax.ucd.use_cqich_indication_flag", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL + } + } +}; + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_ucd(void) +{ + if (proto_mac_mgmt_msg_ucd_decoder == -1) + { + proto_mac_mgmt_msg_ucd_decoder = proto_mac_mgmt_msg_dcd_decoder; + + proto_register_field_array(proto_mac_mgmt_msg_ucd_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +/* UCD dissector */ +void dissect_mac_mgmt_msg_ucd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len, payload_type, length; + guint ucd_config_change_count; + guint ucd_ranging_backoff_start; + guint ucd_ranging_backoff_end; + guint ucd_request_backoff_start; + guint ucd_request_backoff_end; + gint tlv_type, tlv_len, tlv_offset, tlv_value_offset; + guint ul_burst_uiuc, utemp; + proto_item *ucd_item = NULL; + proto_tree *ucd_tree = NULL; + proto_item *tlv_item = NULL; + proto_tree *tlv_tree = NULL; + proto_tree *sub_tree = NULL; + tlv_info_t tlv_info; + + /* Ensure the right payload type */ + payload_type = tvb_get_guint8(tvb, offset); + if(payload_type != MAC_MGMT_MSG_UCD) + { + return; + } + + if(tree) + { /* we are being asked for details */ + /* Get the tvb length */ + tvb_len = tvb_length(tvb); + /* display MAC payload type UCD */ + ucd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tvb_len, "Uplink Channel Descriptor (UCD) (%u bytes)", tvb_len); + /* add MAC UCD subtree */ + ucd_tree = proto_item_add_subtree(ucd_item, ett_mac_mgmt_msg_ucd_decoder); + /* Decode and display the Uplink Channel Descriptor (UCD) */ + /* display the Message Type */ + proto_tree_add_item(ucd_tree, hf_ucd_message_type, tvb, offset, 1, FALSE); + /* move to next field */ + offset++; + /* get the Configuration Change Count */ + ucd_config_change_count = tvb_get_guint8(tvb, offset); + /* display the Configuration Change Count */ + proto_tree_add_text(ucd_tree, tvb, offset, 1, "Configuration Change Count: %u", ucd_config_change_count); + /* move to next field */ + offset++; + /* get the ranging backoff start */ + ucd_ranging_backoff_start = tvb_get_guint8(tvb, offset); + /* display the ranging backoff start */ + proto_tree_add_text(ucd_tree, tvb, offset, 1, "Ranging Backoff Start: 2^%u = %u", ucd_ranging_backoff_start, (1 << ucd_ranging_backoff_start)); + /* move to next field */ + offset++; + /* get the ranging backoff end */ + ucd_ranging_backoff_end = tvb_get_guint8(tvb, offset); + /* display the ranging backoff end */ + proto_tree_add_text(ucd_tree, tvb, offset, 1, "Ranging Backoff End: 2^%u = %u", ucd_ranging_backoff_end, (1 << ucd_ranging_backoff_end)); + /* move to next field */ + offset++; + /* get the request backoff start */ + ucd_request_backoff_start = tvb_get_guint8(tvb, offset); + /* display the request backoff start */ + proto_tree_add_text(ucd_tree, tvb, offset, 1, "Request Backoff Start: 2^%u = %u", ucd_request_backoff_start, (1 << ucd_request_backoff_start)); + /* move to next field */ + offset++; + /* get the request backoff end */ + ucd_request_backoff_end = tvb_get_guint8(tvb, offset); + /* display the request backoff end */ + proto_tree_add_text(ucd_tree, tvb, offset, 1, "Request Backoff End: 2^%u = %u", ucd_request_backoff_end, (1 << ucd_request_backoff_end)); + /* move to next field */ + offset++; + while(offset < tvb_len) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "UCD TLV error"); + } + proto_tree_add_item(ucd_tree,hf_ucd_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + tlv_item = proto_tree_add_protocol_format(ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, (tlv_len + tlv_value_offset), "UCD Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len, offset, tvb_len); +#endif + /* update the offset */ + offset += tlv_value_offset; + /* process UCD TLV Encoded information */ + if (include_cor2_changes) + { + switch (tlv_type) + { + case UCD_TLV_T_203_UL_PUSC_SUBCHANNEL_ROTATION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_205_RELATIVE_POWER_OFFSET_UL_HARQ_BURST: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_206_RELATIVE_POWER_OFFSET_UL_BURST_CONTAINING_MAC_MGMT_MSG: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_207_UL_INITIAL_TRANSMIT_TIMING: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_207_ul_initial_transmit_timing, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_207_ul_initial_transmit_timing, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_210_FAST_FEEDBACK_REGION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_210_fast_feedback_region, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_210_fast_feedback_region, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_211_HARQ_ACK_REGION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_211_harq_ack_region, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_211_harq_ack_region, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_212_RANGING_REGION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_212_ranging_region, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_212_ranging_region, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_213_SOUNDING_REGION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_213_sounding_region, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_213_sounding_region, tvb, offset, tlv_len, FALSE); + break; + } + } + } + switch (tlv_type) + { + case UCD_UPLINK_BURST_PROFILE: + { + /* get the UIUC */ + ul_burst_uiuc = tvb_get_guint8(tvb, offset) & 0x0F; + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Uplink Burst Profile (UIUC = %u) (%u bytes)", ul_burst_uiuc, tlv_len); + proto_tree_add_item(tlv_tree, hf_ucd_ul_burst_reserved, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_ul_burst_uiuc, tvb, offset, 1, FALSE); + for (tlv_offset = 1; tlv_offset < tlv_len;) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, (offset+tlv_offset)); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + if(tlv_type == -1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "UL Burst Profile error"); + } + proto_tree_add_item(tlv_tree, hf_ucd_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE); + break; + } + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case UCD_BURST_FEC: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, tlv_tree, hf_ucd_burst_fec, tvb, (offset+tlv_offset), 1, FALSE); + tlv_item = proto_tree_add_item(sub_tree, hf_ucd_burst_fec, tvb, (offset+tlv_offset), 1, FALSE); + break; + } + case UCD_BURST_RANGING_DATA_RATIO: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, tlv_tree, hf_ucd_burst_ranging_data_ratio, tvb, (offset+tlv_offset), 1, FALSE); + tlv_item = proto_tree_add_item(sub_tree, hf_ucd_burst_ranging_data_ratio, tvb, (offset+tlv_offset), 1, FALSE); + proto_item_append_text(tlv_item, " dB"); + break; + } +#if 0 /* for OFDM */ + case UCD_BURST_POWER_BOOST: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, tlv_tree, hf_ucd_burst_power_boost, tvb, (offset+tlv_offset), 1, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_burst_power_boost, tvb, (offset+tlv_offset), length, FALSE); + proto_item_append_text(tlv_item, " dB"); + break; + } + case UCD_BURST_TCS_ENABLE: + { + sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, tlv_tree, hf_ucd_burst_tcs_enable, tvb, (offset+tlv_offset), 1, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_burst_tcs_enable, tvb, (offset+tlv_offset), 1, FALSE); + break; + } +#endif + default: + /* ??? */ + break; + } + tlv_offset += length; + } + break; + } + case UCD_RESERVATION_TIMEOUT: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_res_timeout, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_res_timeout, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_BW_REQ_SIZE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_bw_req_size, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_bw_req_size, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " PS"); + break; + } + case UCD_RANGING_REQ_SIZE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_ranging_req_size, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_ranging_req_size, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " PS"); + break; + } + case UCD_FREQUENCY: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_freq, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_freq, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " kHz"); + break; + } + case UCD_TLV_T_7_HO_RANGING_START: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "HO ranging start (SCa, OFDM, OFDMA (mobile only)) (%u byte(s))", tlv_len); + utemp = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tlv_tree, tvb, offset, tvb_len, "Initial Backoff Window Size for MS Performing Initial During Handover Process: 2^%u = %u", utemp, (1 << utemp)); + break; + } + case UCD_TLV_T_8_RANGING_HO_END: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "HO ranging end (SCa, OFDM, OFDMA (mobile only)) (%u byte(s))", tlv_len); + utemp = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tlv_tree, tvb, offset, tvb_len, "Final Backoff Window Size for MS Performing Initial During Handover Process: 2^%u = %u", utemp, (1 << utemp)); + break; + } + case UCD_TLV_T_158_OPTIONAL_PERMUTATION_UL_ALLOCATED_SUBCHANNELS_BITMAP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_158_optional_permutation_ul_allocated_subchannels_bitmap, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_158_optional_permutation_ul_allocated_subchannels_bitmap, tvb, offset, tlv_len, FALSE); + + break; + } + case UCD_TLV_T_159_BAND_AMC_ALLOCATION_THRESHHOLD: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_159_band_amc_allocation_threshold, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_159_band_amc_allocation_threshold, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " dB"); + break; + } + case UCD_TLV_T_160_BAND_AMC_RELEASE_THRESHOLD: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_160_band_amc_release_threshold, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_160_band_amc_release_threshold, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " dB"); + break; + } + case UCD_TLV_T_161_BAND_AMC_ALLOCATION_TIMER: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_161_band_amc_allocation_timer, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_161_band_amc_allocation_timer, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " frames"); + break; + } + case UCD_TLV_T_162_BAND_AMC_RELEASE_TIMER: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_161_band_amc_allocation_timer, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_162_band_amc_release_timer, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " frames"); + break; + } + case UCD_TLV_T_163_BAND_STATUS_REPORT_MAX_PERIOD: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_163_band_status_report_max_period, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_163_band_status_report_max_period, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " frames"); + break; + } + case UCD_TLV_T_164_BAND_AMC_RETRY_TIMER: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_164_band_amc_retry_timer, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_164_band_amc_retry_timer, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " frames"); + break; + } + case UCD_TLV_T_170_SAFETY_CHANNEL_RETRY_TIMER: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_170_safety_channel_retry_timer, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_170_safety_channel_retry_timer, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " frames"); + break; + } + case UCD_TLV_T_171_HARQ_ACK_DELAY_FOR_DL_BURST: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_171_harq_ack_delay_dl_burst, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_171_harq_ack_delay_dl_burst, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " frames offset"); + break; + } + case UCD_TLV_T_172_CQICH_BAND_AMC_TRANSITION_DELAY: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_172_cqich_band_amc_transition_delay, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_172_cqich_band_amc_transition_delay, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " frames"); + break; + } + case UCD_TLV_T_174_MAXIMUM_RETRANSMISSION: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_174_maximum_retransmission, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_174_maximum_retransmission, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_176_SIZE_OF_CQICH_ID_FIELD: + { + utemp = tvb_get_guint8(tvb, offset); + cqich_id_size = 0; /* Default is 0 */ + if (utemp && utemp < 8) { + /* Set for CQICH_Alloc_IE */ + cqich_id_size = utemp + 2; + } + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_176_size_of_cqich_id_field, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_176_size_of_cqich_id_field, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_177_NORMALIZED_CN_OVERRIDE_2: + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_177_normalized_cn_override2, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_177_normalized_cn_override2_first_line, tvb, offset + 2, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_177_normalized_cn_override2_list, tvb, offset + 3, 7, FALSE); + break; + } + case UCD_TLV_T_186_UPPER_BOUND__AAS_PREAMBLE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_186_upper_bound_aas_preamble, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_186_upper_bound_aas_preamble, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_187_LOWER_BOUND_AAS_PREAMBLE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_187_lower_bound_aas_preamble, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_187_lower_bound_aas_preamble, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_188_ALLOW_AAS_BEAM_SELECT_MESSAGE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_188_allow_aas_beam_select_message, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_188_allow_aas_beam_select_message, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_189_USE_CQICH_INDICATION_FLAG: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_189_use_cqich_indication_flag, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_189_use_cqich_indication_flag, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_190_MS_SPECIFIC_UP_POWER_OFFSET_ADJUSTMENT_STEP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_190_ms_specific_up_power_addjustment_step, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_190_ms_specific_up_power_addjustment_step, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_191_MS_SPECIFIC_DOWN_POWER_OFSET_ADJUSTMENT_STEP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_191_ms_specific_down_power_addjustment_step, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_191_ms_specific_down_power_addjustment_step, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_192_MIN_LEVEL_POWER_OFFSET_ADJUSTMENT: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_192_min_level_power_offset_adjustment, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_192_min_level_power_offset_adjustment, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_193_MAX_LEVEL_POWER_OFFSETR_ADJUSTMENT: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_193_max_level_power_offset_adjustment, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_193_max_level_power_offset_adjustment, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_194_HANDOVER_RANGING_CODES: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_194_handover_ranging_codes, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_194_handover_ranging_codes, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_195_INITIAL_RANGING_INTERVAL: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_195_initial_ranging_interval, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_195_initial_ranging_interval, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_196_TX_POWER_REPORT: + { + /* add TLV subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Tx Power Report (%u bytes)", tlv_len); + proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_196_tx_power_report_threshold, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_196_tx_power_report_interval, tvb , offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_196_tx_power_report_a_p_avg, tvb, (offset + 1), 1, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_196_tx_power_report_threshold_icqch, tvb, (offset + 1), 1, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_196_tx_power_report_interval_icqch, tvb, (offset + 2), 1, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_196_tx_power_report_a_p_avg_icqch, tvb, (offset + 2), 1, FALSE); + break; + } + case UCD_TLV_T_197_NORMALIZED_CN_FOR_CHANNEL_SOUNDING: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_195_initial_ranging_interval, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_197_normalized_cn_channel_sounding, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_198_INTIAL_RANGING_BACKOFF_START: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Initial ranging backoff start (%u byte(s))", tlv_len); + utemp = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tlv_tree, tvb, offset, tvb_len, "Initial Ranging Backoff Start: 2^%u = %u", utemp, (1 << utemp)); + break; + } + case UCD_TLV_T_199_INITIAL_RANGING_BACKOFF_END: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Initial ranging backoff end (%u byte(s))", tlv_len); + utemp = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tlv_tree, tvb, offset, tvb_len, "Initial Ranging Backoff End: 2^%u = %u", utemp, (1 << utemp)); + break; + } + case UCD_TLV_T_200_BANDWIDTH_REQUESET_BACKOFF_START: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Bandwidth request backoff start (%u byte(s))", tlv_len); + utemp = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tlv_tree, tvb, offset, tvb_len, "Bandwidth Request Backoff Start: 2^%u = %u", utemp, (1 << utemp)); + break; + } + case UCD_TLV_T_201_BANDWIDTH_REQUEST_BACKOFF_END: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Bandwidth request backoff end (%u byte(s))", tlv_len); + utemp = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tlv_tree, tvb, offset, tvb_len, "Bandwidth Request Backoff End: 2^%u = %u", utemp, (1 << utemp)); + break; + } + case UCD_TLV_T_202_UPLINK_BURST_PROFILE_FOR_MULTIPLE_FEC_TYPES: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_202_uplink_burst_profile_for_multiple_fec_types, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_202_uplink_burst_profile_for_multiple_fec_types, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_INITIAL_RANGING_CODES: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_150_initial_ranging_codes, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree,hf_ucd_tlv_t_150_initial_ranging_codes, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_PERIODIC_RANGING_CODES: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_151_periodic_ranging_codes, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree,hf_ucd_tlv_t_151_periodic_ranging_codes, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_BANDWIDTH_REQUEST_CODES: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_152_bandwidth_request_codes, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree,hf_ucd_tlv_t_152_bandwidth_request_codes, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_PERIODIC_RANGING_BACKOFF_START: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Periodic ranging backoff start (%u byte(s))", tlv_len); + utemp = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tlv_tree, tvb, offset, tlv_len, "Periodic Ranging Backoff Start: 2^%u = %u", utemp, (1 << utemp)); + break; + + } + case UCD_PERIODIC_RANGING_BACKOFF_END: + { + tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Periodic ranging backoff end (%u bytes(s))", tlv_len); + utemp = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tlv_tree, tvb, offset, tlv_len, "Periodic Ranging Backoff End: 2^%u = %u", utemp, (1 << utemp)); + break; + } + case UCD_START_OF_RANGING_CODES_GROUP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_155_start_of_ranging_codes_group, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree,hf_ucd_tlv_t_155_start_of_ranging_codes_group, tvb, offset, tlv_len, FALSE); + break; + + } + case UCD_PERMUTATION_BASE: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_156_permutation_base, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree,hf_ucd_tlv_t_156_permutation_base, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_UL_ALLOCATED_SUBCHANNELS_BITMAP: + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_ul_allocated_subchannles_bitmap, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_ucd_ul_allocated_subchannles_bitmap, tvb, offset, tlv_len, FALSE); + break; + } + case UCD_TLV_T_203_UL_PUSC_SUBCHANNEL_ROTATION: + case UCD_TLV_T_205_RELATIVE_POWER_OFFSET_UL_HARQ_BURST: + case UCD_TLV_T_206_RELATIVE_POWER_OFFSET_UL_BURST_CONTAINING_MAC_MGMT_MSG: + case UCD_TLV_T_207_UL_INITIAL_TRANSMIT_TIMING: + case UCD_TLV_T_210_FAST_FEEDBACK_REGION: + case UCD_TLV_T_211_HARQ_ACK_REGION: + case UCD_TLV_T_212_RANGING_REGION: + case UCD_TLV_T_213_SOUNDING_REGION: + { + /* Unknown TLV type if cor2 not enabled. */ + if (!include_cor2_changes) + { + proto_tree_add_protocol_format(ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Unknown TLV Type"); + } + break; + } + default: + { + proto_tree_add_protocol_format(ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Unknown TLV Type"); + } + } /* end of switch */ + offset += tlv_len; + } /* end of TLV process while loop */ + } +} diff --git a/plugins/wimax/msg_ulmap.c b/plugins/wimax/msg_ulmap.c new file mode 100644 index 0000000000..aa112a2708 --- /dev/null +++ b/plugins/wimax/msg_ulmap.c @@ -0,0 +1,2427 @@ +/* msg_ulmap.c + * WiMax MAC Management UL-MAP Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Mike Harvey <michael.harvey@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_bits.h" + +extern gint proto_mac_mgmt_msg_dlmap_decoder; +extern gboolean include_cor2_changes; + +#define MAC_MGMT_MSG_ULMAP 3 + +#define XBIT(var, bits, desc) \ + do { \ + var = BIT_BITS(bit, bufptr, bits); \ + proto_tree_add_text(tree, tvb, BITHI(bit, bits), desc ": %d", var); \ + bit += bits; \ + } while(0) + +#define XNIB(var, nibs, desc) \ + do { \ + var = NIB_NIBS(nib, bufptr, nibs); \ + proto_tree_add_text(tree, tvb, NIBHI(nib, nibs), desc ": %d", var); \ + nib += nibs; \ + } while(0) + +extern gint man_ofdma; + +/* from msg_ucd.c */ +extern guint cqich_id_size; /* Set for CQICH_Alloc_IE */ + +/* from msg_dlmap.c */ +extern gint harq; +extern gint ir_type; +extern gint N_layer; +extern gint RCID_Type; +extern gint RCID_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb, gint RCID_Type); + + +/* forward reference */ +void dissect_mac_mgmt_msg_ulmap_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_mac_mgmt_msg_ulmap_decoder = -1; + +static gint ett_ulmap = -1; +static gint ett_ulmap_ie = -1; +static gint ett_ulmap_ffb = -1; +static gint ett_ulmap_c = -1; +static gint ett_ulmap_c_ie = -1; +static gint ett_ulmap_s = -1; +static gint ett_ulmap_s_ie = -1; +static gint ett_287_1 = -1; +static gint ett_287_2 = -1; +static gint ett_289 = -1; +static gint ett_290 = -1; +static gint ett_290b = -1; +static gint ett_291 = -1; +static gint ett_292 = -1; +static gint ett_293 = -1; +static gint ett_294 = -1; +static gint ett_295 = -1; +static gint ett_299 = -1; +static gint ett_300 = -1; +static gint ett_302 = -1; +static gint ett_302a = -1; +static gint ett_302b = -1; +static gint ett_302c = -1; +static gint ett_302d = -1; +static gint ett_302e = -1; +static gint ett_302f = -1; +static gint ett_302g = -1; +static gint ett_302h = -1; +static gint ett_302i = -1; +static gint ett_302j = -1; +static gint ett_302k = -1; +static gint ett_302l = -1; +static gint ett_302m = -1; +static gint ett_302n = -1; +static gint ett_302o = -1; +static gint ett_302p = -1; +static gint ett_302q = -1; +static gint ett_302r = -1; +static gint ett_302s = -1; +static gint ett_302t = -1; +static gint ett_302u = -1; +static gint ett_302v = -1; +static gint ett_306 = -1; +static gint ett_306_ul = -1; +static gint ett_308b = -1; +static gint ett_315d = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_ulmap, + &ett_ulmap_ie, + &ett_ulmap_ffb, + &ett_ulmap_c, + &ett_ulmap_c_ie, + &ett_ulmap_s, + &ett_ulmap_s_ie, + &ett_287_1, + &ett_287_2, + &ett_289, + &ett_290, + &ett_290b, + &ett_291, + &ett_292, + &ett_293, + &ett_294, + &ett_295, + &ett_299, + &ett_300, + &ett_302, + &ett_302a, + &ett_302b, + &ett_302c, + &ett_302d, + &ett_302e, + &ett_302f, + &ett_302h, + &ett_302g, + &ett_302i, + &ett_302j, + &ett_302k, + &ett_302l, + &ett_302m, + &ett_302n, + &ett_302o, + &ett_302p, + &ett_302q, + &ett_302r, + &ett_302s, + &ett_302t, + &ett_302u, + &ett_302v, + &ett_306, + &ett_306_ul, + &ett_308b, + &ett_315d, +}; + +#define DCD_DOWNLINK_BURST_PROFILE 1 +#define DCD_BS_EIRP 2 +#define DCD_FRAME_DURATION 3 +#define DCD_PHY_TYPE 4 +#define DCD_POWER_ADJUSTMENT 5 +#define DCD_CHANNEL_NR 6 +#define DCD_TTG 7 +#define DCD_RTG 8 +#define DCD_RSS 9 +#define DCD_CHANNEL_SWITCH_FRAME_NR 10 +#define DCD_FREQUENCY 12 +#define DCD_BS_ID 13 +#define DCD_FRAME_DURATION_CODE 14 +#define DCD_FRAME_NR 15 +#define DCD_SIZE_CQICH_ID 16 +#define DCD_H_ARQ_ACK_DELAY 17 +#define DCD_MAC_VERSION 148 +#define DCD_RESTART_COUNT 154 + +#define DCD_BURST_FREQUENCY 1 +#define DCD_BURST_FEC_CODE_TYPE 150 +#define DCD_BURST_DIUC_EXIT_THRESHOLD 151 +#define DCD_BURST_DIUC_ENTRY_THRESHOLD 152 +#define DCD_BURST_TCS_ENABLE 153 + +#define DCD_TLV_T_541_TYPE_FUNCTION_ACTION 1 +#define DCD_TLV_T542_TRIGGER_VALUE 2 +#define DCD_TLV_T_543_TRIGGER_AVERAGING_DURATION 3 +#define DCD_TLV_T_19_PERMUTATION_TYPE_FOR_BROADCAST_REGION_IN_HARQ_ZONE 19 +#define DCD_TLV_T_20_MAXIMUM_RETRANSMISSION 20 +#define DCD_TLV_T_21_DEFAULT_RSSI_AND_CINR_AVERAGING_PARAMETER 21 +#define DCD_TLV_T_22_DL_AMC_ALLOCATED_PHYSICAL_BANDS_BITMAP 22 +#define DCD_TLV_T_31_H_ADD_THRESHOLD 31 +#define DCD_TLV_T_32_H_DELETE_THRESHOLD 32 +#define DCD_TLV_T_33_ASR 33 +#define DCD_TLV_T_34_DL_REGION_DEFINITION 34 +#define DCD_TLV_T_35_PAGING_GROUP_ID 35 +#define DCD_TLV_T_36_TUSC1_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP 36 +#define DCD_TLV_T_37_TUSC2_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP 37 +#define DCD_TLV_T_45_PAGING_INTERVAL_LENGTH 45 +#define DCD_TLV_T_50_HO_TYPE_SUPPORT 50 +#define DCD_TLV_T_51_HYSTERSIS_MARGIN 51 +#define DCD_TLV_T_52_TIME_TO_TRIGGER_DURATION 52 +#define DCD_TLV_T_54_TRIGGER 54 +#define DCD_TLV_T_153_DOWNLINK_BURST_PROFILE_FOR_MULTIPLE_FEC_TYPES 153 + +#define UL_MAP_NCT_PMP 0 +#define UL_MAP_NCT_DM 1 +#define UL_MAP_NCT_PTP 2 + +/* NCT messages */ +static const value_string nct_msgs[] = +{ + { UL_MAP_NCT_PMP, "PMP" }, + { UL_MAP_NCT_PMP, "DM" }, + { UL_MAP_NCT_PMP, "PTP" }, + { 0, NULL } +}; + +/* Repetition Coding Indications */ +static const value_string rep_msgs[] = +{ + { 0, "No Repetition Coding" }, + { 1, "Repetition Coding of 2 Used" }, + { 2, "Repetition Coding of 4 Used" }, + { 3, "Repetition Coding of 6 Used" }, + { 0, NULL } +}; + +/* DL Frame Prefix Coding Indications */ +static const value_string boost_msgs[] = +{ + { 0, "Normal (not boosted)" }, + { 1, "+6dB" }, + { 2, "-6dB" }, + { 3, "+9dB" }, + { 4, "+3dB" }, + { 5, "-3dB" }, + { 6, "-9dB" }, + { 7, "-12dB" }, + { 0, NULL } +}; + +/* ul-map fields */ +static gint hf_ulmap_message_type = -1; +static gint hf_ulmap_reserved = -1; +static gint hf_ulmap_ucd_count = -1; +static gint hf_ulmap_alloc_start_time = -1; +static gint hf_ulmap_ofdma_sym = -1; +static gint hf_ulmap_fch_expected = -1; + +static gint hf_ulmap_ie = -1; + +static gint hf_ulmap_ie_cid = -1; +static gint hf_ulmap_ie_uiuc = -1; +static gint hf_ulmap_uiuc12_symofs = -1; +static gint hf_ulmap_uiuc12_subofs = -1; +static gint hf_ulmap_uiuc12_numsym = -1; +static gint hf_ulmap_uiuc12_numsub = -1; +static gint hf_ulmap_uiuc12_method = -1; +static gint hf_ulmap_uiuc12_dri = -1; +static gint hf_ulmap_uiuc10_dur = -1; +static gint hf_ulmap_uiuc10_rep = -1; + +static gint hf_ulmap_uiuc14_dur = -1; +static gint hf_ulmap_uiuc14_uiuc = -1; +static gint hf_ulmap_uiuc14_rep = -1; +static gint hf_ulmap_uiuc14_idx = -1; +static gint hf_ulmap_uiuc14_code = -1; +static gint hf_ulmap_uiuc14_sym = -1; +static gint hf_ulmap_uiuc14_sub = -1; +static gint hf_ulmap_uiuc14_bwr = -1; + +static gint hf_ulmap_uiuc11_ext = -1; +static gint hf_ulmap_uiuc11_len = -1; +static gint hf_ulmap_uiuc11_data = -1; +static gint hf_ulmap_uiuc15_ext = -1; +static gint hf_ulmap_uiuc15_len = -1; +static gint hf_ulmap_uiuc15_data = -1; + +static gint hf_ulmap_uiuc0_symofs = -1; +static gint hf_ulmap_uiuc0_subofs = -1; +static gint hf_ulmap_uiuc0_numsym = -1; +static gint hf_ulmap_uiuc0_numsub = -1; +static gint hf_ulmap_uiuc0_rsv = -1; + +static gint hf_ulmap_uiuc13_symofs = -1; +static gint hf_ulmap_uiuc13_subofs = -1; +static gint hf_ulmap_uiuc13_numsym = -1; +static gint hf_ulmap_uiuc13_numsub = -1; +static gint hf_ulmap_uiuc13_papr = -1; +static gint hf_ulmap_uiuc13_zone = -1; +static gint hf_ulmap_uiuc13_rsv = -1; + +/* UL-MAP fields display */ +static hf_register_info hf[] = +{ + { + &hf_ulmap_message_type, + { + "MAC Management Message Type", "wimax.macmgtmsgtype.ulmap", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_fch_expected, + { + "FCH Expected", "wimax.ulmap.fch.expected", + FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_ie, + { + "UL-MAP IE", "wimax.ulmap.ie", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_ie_cid, + { + "CID", "wimax.ulmap.ie.cid", + FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_ie_uiuc, + { + "UIUC", "wimax.ulmap.ie.uiuc", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_ofdma_sym, + { + "Num OFDMA Symbols", "wimax.ulmap.ofdma.sym", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_reserved, + { + "Reserved", "wimax.ulmap.rsv", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_alloc_start_time, + { + "Uplink Channel ID", "wimax.ulmap.start", + FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_ucd_count, + { + "UCD Count", "wimax.ulmap.ucd", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_uiuc0_numsub, + { + "No. subchannels", "wimax.ulmap.uiuc0.numsub", + FT_UINT32, BASE_DEC, NULL, 0x000003f8, "", HFILL + } + }, + { + &hf_ulmap_uiuc0_numsym, + { + "No. OFDMA symbols", "wimax.ulmap.uiuc0.numsym", + FT_UINT32, BASE_DEC, NULL, 0x0001fc00, "", HFILL + } + }, + { + &hf_ulmap_uiuc0_rsv, + { + "Reserved", "wimax.ulmap.uiuc0.rsv", + FT_UINT32, BASE_DEC, NULL, 0x00000007, "", HFILL + } + }, + { + &hf_ulmap_uiuc0_subofs, + { + "Subchannel offset", "wimax.ulmap.uiuc0.subofs", + FT_UINT32, BASE_DEC, NULL, 0x00fe0000, "", HFILL + } + }, + { + &hf_ulmap_uiuc0_symofs, + { + "OFDMA symbol offset", "wimax.ulmap.uiuc0.symofs", + FT_UINT32, BASE_DEC, NULL, 0xff000000, "", HFILL + } + }, + { + &hf_ulmap_uiuc11_data, + { + "Data", "wimax.ulmap.uiuc11.data", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_uiuc11_ext, + { + "Extended 2 UIUC", "wimax.ulmap.uiuc11.ext", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_uiuc11_len, + { + "Length", "wimax.ulmap.uiuc11.len", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_uiuc12_dri, + { + "Dedicated ranging indicator", "wimax.ulmap.uiuc12.dri", + FT_UINT32, BASE_DEC, NULL, 0x00000001, "", HFILL + } + }, + { + &hf_ulmap_uiuc10_dur, + { + "Duration", "wimax.ulmap.uiuc12.dur", + FT_UINT16, BASE_DEC, NULL, 0xFFc0, "", HFILL + } + }, + { + &hf_ulmap_uiuc12_method, + { + "Ranging Method", "wimax.ulmap.uiuc12.method", + FT_UINT32, BASE_DEC, NULL, 0x00000006, "", HFILL + } + }, + { + &hf_ulmap_uiuc12_numsub, + { + "No. Subchannels", "wimax.ulmap.uiuc12.numsub", + FT_UINT32, BASE_DEC, NULL, 0x000003F8, "", HFILL + } + }, + { + &hf_ulmap_uiuc12_numsym, + { + "No. OFDMA Symbols", "wimax.ulmap.uiuc12.numsym", + FT_UINT32, BASE_DEC, NULL, 0x0001Fc00, "", HFILL + } + }, + { + &hf_ulmap_uiuc10_rep, + { + "Repetition Coding indication", "wimax.ulmap.uiuc12.rep", + FT_UINT16, BASE_DEC, NULL, 0x0030, "", HFILL + } + }, + { + &hf_ulmap_uiuc12_subofs, + { + "Subchannel Offset", "wimax.ulmap.uiuc12.subofs", + FT_UINT32, BASE_DEC, NULL, 0x00Fe0000, "", HFILL + } + }, + { + &hf_ulmap_uiuc12_symofs, + { + "OFDMA Symbol Offset", "wimax.ulmap.uiuc12.symofs", + FT_UINT32, BASE_DEC, NULL, 0xFF000000, "", HFILL + } + }, + { + &hf_ulmap_uiuc13_numsub, + { + "No. Subchannels/SZ Shift Value", "wimax.ulmap.uiuc13.numsub", + FT_UINT32, BASE_DEC, NULL, 0x000003f8, "", HFILL + } + }, + { + &hf_ulmap_uiuc13_numsym, + { + "No. OFDMA symbols", "wimax.ulmap.uiuc13.numsym", + FT_UINT32, BASE_DEC, NULL, 0x0001fc00, "", HFILL + } + }, + { + &hf_ulmap_uiuc13_papr, + { + "PAPR Reduction/Safety Zone", "wimax.ulmap.uiuc13.papr", + FT_UINT32, BASE_DEC, NULL, 0x00000004, "", HFILL + } + }, + { + &hf_ulmap_uiuc13_rsv, + { + "Reserved", "wimax.ulmap.uiuc13.rsv", + FT_UINT32, BASE_DEC, NULL, 0x00000001, "", HFILL + } + }, + { + &hf_ulmap_uiuc13_subofs, + { + "Subchannel offset", "wimax.ulmap.uiuc13.subofs", + FT_UINT32, BASE_DEC, NULL, 0x00fe0000, "", HFILL + } + }, + { + &hf_ulmap_uiuc13_symofs, + { + "OFDMA symbol offset", "wimax.ulmap.uiuc13.symofs", + FT_UINT32, BASE_DEC, NULL, 0xff000000, "", HFILL + } + }, + { + &hf_ulmap_uiuc13_zone, + { + "Sounding Zone", "wimax.ulmap.uiuc13.zone", + FT_UINT32, BASE_DEC, NULL, 0x00000002, "", HFILL + } + }, + { + &hf_ulmap_uiuc14_bwr, + { + "BW request mandatory", "wimax.ulmap.uiuc14.bwr", + FT_UINT8, BASE_DEC, NULL, 0x01, "", HFILL + } + }, + { + &hf_ulmap_uiuc14_code, + { + "Ranging code", "wimax.ulmap.uiuc14.code", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_uiuc14_dur, + { + "Duration", "wimax.ulmap.uiuc14.dur", + FT_UINT16, BASE_DEC, NULL, 0xfc00, "", HFILL + } + }, + { + &hf_ulmap_uiuc14_idx, + { + "Frame Number Index", "wimax.ulmap.uiuc14.idx", + FT_UINT16, BASE_DEC, NULL, 0x000F, "", HFILL + } + }, + { + &hf_ulmap_uiuc14_rep, + { + "Repetition Coding Indication", "wimax.ulmap.uiuc14.rep", + FT_UINT16, BASE_DEC, NULL, 0x0030, "", HFILL + } + }, + { + &hf_ulmap_uiuc14_sub, + { + "Ranging subchannel", "wimax.ulmap.uiuc14.sub", + FT_UINT8, BASE_DEC, NULL, 0xfe, "", HFILL + } + }, + { + &hf_ulmap_uiuc14_sym, + { + "Ranging symbol", "wimax.ulmap.uiuc14.sym", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_uiuc14_uiuc, + { + "UIUC", "wimax.ulmap.uiuc14.uiuc", + FT_UINT16, BASE_DEC, NULL, 0x03c0, "", HFILL + } + }, + { + &hf_ulmap_uiuc15_data, + { + "Data", "wimax.ulmap.uiuc15.data", + FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_uiuc15_ext, + { + "Extended UIUC", "wimax.ulmap.uiuc15.ext", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + }, + { + &hf_ulmap_uiuc15_len, + { + "Length", "wimax.ulmap.uiuc15.len", + FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL + } + } +}; + +/* This gets called each time a capture file is loaded. */ +void init_wimax_globals() +{ + cqich_id_size = 0; + harq = 0; + ir_type = 0; + N_layer = 0; + RCID_Type = 0; +} + +/******************************************************************** + * UL-MAP HARQ Sub-Burst IEs + * 8.4.5.4.24 table 302j + * these functions take offset/length in bits + *******************************************************************/ + +gint Dedicated_UL_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24.1 Dedicated_UL_Control_IE -- table 302r */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint sdma; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Dedicated_UL_Control_IE"); + tree = proto_item_add_subtree(ti, ett_302r); + + XBIT(data, 4, "Length"); + XBIT(sdma, 4, "Control Header"); + if ((sdma & 1) == 1) { + XBIT(data, 2, "Num SDMA layers"); + XBIT(data, 2, "Pilot Pattern"); + } + return (bit - offset); /* length in bits */ +} + +gint Dedicated_MIMO_UL_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24.2 Dedicated_MIMO_UL_Control_IE -- table 302s */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Dedicated_MIMO_UL_Control_IE"); + tree = proto_item_add_subtree(ti, ett_302s); + + XBIT(data, 2, "Matrix"); + XBIT(N_layer, 2, "N_layer"); + + return (bit - offset); /* length in bits */ +} + +/* begin Sub-Burst IEs */ + +gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24 UL_HARQ_Chase_sub_burst_IE -- table 302k */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + proto_item *generic_item = NULL; + gint duci; + guint16 calculated_crc; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, BITHI(offset,length), "UL_HARQ_Chase_Sub_Burst_IE"); + tree = proto_item_add_subtree(ti, ett_302k); + + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + XBIT(duci, 1, "Dedicated UL Control Indicator"); + if (duci == 1) { + bit += Dedicated_UL_Control_IE(tree, bufptr, bit, length, tvb); + } + XBIT(data, 4, "UIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data,10, "Duration"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 1, "ACK_disable"); + XBIT(data, 1, "Reserved"); + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (bit - offset); /* length in bits */ +} + +gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24 UL_HARQ_IR_CTC_sub_burst_IE -- table 302l */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + proto_item *generic_item = NULL; + gint duci; + guint16 calculated_crc; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_HARQ_IR_CTC_Sub_Burst_IE"); + tree = proto_item_add_subtree(ti, ett_302l); + + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + XBIT(duci, 1, "Dedicated UL Control Indicator"); + if (duci == 1) { + bit += Dedicated_UL_Control_IE(tree, bufptr, bit, length, tvb); + } + XBIT(data, 4, "N(EP)"); + XBIT(data, 4, "N(SCH)"); + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACIN"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 1, "ACK_disable"); + XBIT(data, 3, "Reserved"); + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (bit - offset); /* length in bits */ +} + +gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24 UL_HARQ_IR_CC_sub_burst_IE -- table 302m */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + proto_item *generic_item = NULL; + gint duci; + guint16 calculated_crc; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_HARQ_IR_CC_Sub_Burst_IE"); + tree = proto_item_add_subtree(ti, ett_302m); + + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + XBIT(duci, 1, "Dedicated UL Control Indicator"); + if (duci == 1) { + bit += Dedicated_UL_Control_IE(tree, bufptr, bit, length, tvb); + } + XBIT(data, 4, "UIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data,10, "Duration"); + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 1, "ACK_disable"); + XBIT(data, 3, "Reserved"); + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (bit - offset); /* length in bits */ +} + +gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24 MIMO_UL_Chase_HARQ_Sub_Burst_IE -- table 302n */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + proto_item *generic_item = NULL; + gint muin,dmci,ackd,i; + guint16 calculated_crc; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_Chase_HARQ_Sub_Burst_IE"); + tree = proto_item_add_subtree(ti, ett_302n); + + XBIT(muin, 1, "MU indicator"); + XBIT(dmci, 1, "Dedicated MIMO ULControl Indicator"); + XBIT(ackd, 1, "ACK Disable"); + if (muin == 0) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + if (dmci) { + bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb); + } + } else { + XBIT(data, 1, "Matrix"); + } + XBIT(data, 10, "Duration"); + for (i = 0; i < N_layer; i++) { + if (muin == 1) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + XBIT(data, 4, "UIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + if (ackd == 0) { + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + } + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (bit - offset); /* length in bits */ +} + +gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24 MIMO_UL_IR_HARQ__Sub_Burst_IE -- table 302o */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + proto_item *generic_item = NULL; + gint muin,dmci,ackd,i; + guint16 calculated_crc; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_IR_HARQ__Sub_Burst_IE"); + tree = proto_item_add_subtree(ti, ett_302o); + + XBIT(muin, 1, "MU indicator"); + XBIT(dmci, 1, "Dedicated MIMO UL Control Indicator"); + XBIT(ackd, 1, "ACK Disable"); + if (muin == 0) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + if (dmci) { + bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb); + } + } else { + XBIT(data, 1, "Matrix"); + } + XBIT(data, 4, "N(SCH)"); + for (i = 0; i < N_layer; i++) { + if (muin == 1) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + XBIT(data, 4, "N(EP)"); + if (ackd == 0) { + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + } + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (bit - offset); /* length in bits */ +} + +gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24 MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE -- table 302p */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + proto_item *generic_item = NULL; + gint muin,dmci,ackd,i; + guint16 calculated_crc; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE"); + tree = proto_item_add_subtree(ti, ett_302p); + + XBIT(muin, 1, "MU indicator"); + XBIT(dmci, 1, "Dedicated MIMO UL Control Indicator"); + XBIT(ackd, 1, "ACK Disable"); + if (muin == 0) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + if (dmci) { + bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb); + } + } else { + XBIT(data, 1, "Matrix"); + } + XBIT(data, 10, "Duration"); + for (i = 0; i < N_layer; i++) { + if (muin == 1) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + } + XBIT(data, 4, "UIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + if (ackd == 0) { + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 2, "SPID"); + } + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (bit - offset); /* length in bits */ +} + +gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.4.24 MIMO_UL_STC_HARQ_Sub_Burst_IE -- table 302q */ + /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + proto_item *generic_item = NULL; + gint ackd,txct,sboi; + guint16 calculated_crc; + + bit = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_STC_HARQ_Sub_Burst_IE"); + tree = proto_item_add_subtree(ti, ett_302q); + + XBIT(txct, 2, "Tx count"); + XBIT(data, 10, "Duration"); + XBIT(sboi, 1, "Sub-burst offset indication"); + /*XBIT(muin, 1, "Reserved");*/ + if (sboi == 1) { + XBIT(data, 8, "Sub-burst offset"); + } + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + XBIT(ackd, 1, "ACK Disable"); + if (txct == 0) { + XBIT(data, 4, "UIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + } + if (ackd == 0) { + XBIT(data, 4, "ACID"); + } + + if (include_cor2_changes) + { + /* CRC-16 is always appended */ + data = BIT_BITS(bit, bufptr, 16); + generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); + /* calculate the CRC */ + calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); + if (data != calculated_crc) + { + proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); + } + bit += 16; + } + + return (bit - offset); /* length in bits */ +} + +/******************************************************************** + * UL-MAP Extended IEs + * table 290a + *******************************************************************/ + +gint Power_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 0 */ + /* 8.4.5.4.5 Power_Control_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Power_Control_IE"); + tree = proto_item_add_subtree(ti, ett_292); + + XNIB(data, 1, "Extended UIUC"); + XNIB(data, 1, "Length"); + + XNIB(data, 2, "Power Control"); + XNIB(data, 2, "Power measurement frame"); + return nib; +} + +gint Mini_Subchannel_allocation_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 1 */ + /* 8.4.5.4.8 [2] Mini-Subchannel_allocation_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint j, M; + const gint m_table[4] = { 2, 2, 3, 6 }; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Mini_subchannel_allocation_IE"); + tree = proto_item_add_subtree(ti, ett_295); + + XBIT(data, 4, "Extended-2 UIUC"); + XBIT(data, 8, "Length"); + + XBIT(data, 2, "Ctype"); + M = m_table[data]; + XBIT(data, 6, "Duration"); + + for (j = 0; j < M; j++) { + data = BIT_BITS(bit, bufptr, 16); + proto_tree_add_text(tree, tvb, BITHI(bit, 16), "CID(%d): %d", j, data); + bit += 16; + data = BIT_BITS(bit, bufptr, 4); + proto_tree_add_text(tree, tvb, BITHI(bit, 4), "UIUC(%d): %d", j, data); + bit += 4; + data = BIT_BITS(bit, bufptr, 2); + proto_tree_add_text(tree, tvb, BITHI(bit, 2), "Repetition(%d): %d", j, data); + bit += 2; + } + if (M == 3) { + XBIT(data, 4, "Padding"); + } + return BIT_TO_NIB(bit); +} + +gint AAS_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 2 */ + /* 8.4.5.4.6 [2] AAS_UL_IE*/ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "AAS_UL_IE"); + tree = proto_item_add_subtree(ti, ett_293); + + XBIT(data, 4, "Extended UIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 2, "Permutation"); + XBIT(data, 7, "UL_PermBase"); + XBIT(data, 8, "OFDMA symbol offset"); + XBIT(data, 8, "AAS zone length"); + XBIT(data, 2, "Uplink peramble config"); + XBIT(data, 1, "Preamble type"); + XBIT(data, 4, "Reserved"); + return BIT_TO_NIB(bit); +} + +gint CQICH_Alloc_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 3 */ + /* 8.4.5.4.12 [2] CQICH_Alloc_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint rci, rtype, ftype, zperm, mgi, api, pad; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_ZONE_IE"); + tree = proto_item_add_subtree(ti, ett_300); + + XBIT(data, 4, "Extended UIUC"); + XBIT(data, 4, "Length"); + + if (cqich_id_size == 0) { + proto_tree_add_text(tree, tvb, BITHI(bit, 1), "CQICH_ID: n/a (size == 0 bits)"); + } else { + /* variable from 0-9 bits */ + data = BIT_BITS16(bit, bufptr, cqich_id_size); + proto_tree_add_text(tree, tvb, BITHI(bit, cqich_id_size), "CQICH_ID: %d (%d bits)", data, cqich_id_size); + bit += cqich_id_size; + } + + XBIT(data, 6, "Allocation offset"); + XBIT(data, 2, "Period (p)"); + XBIT(data, 3, "Frame offset"); + XBIT(data, 3, "Duration (d)"); + XBIT(rci, 1, "Report configuration included"); + if (rci) + { + XBIT(ftype, 2, "Feedback Type"); + XBIT(rtype, 1, "Report type"); + if (rtype == 0) { + XBIT(data, 1, "CINR preamble report type"); + } + else { + XBIT(zperm, 3, "Zone permutation"); + XBIT(data, 2, "Zone type"); + XBIT(data, 2, "Zone PRBS_ID"); + if (zperm == 0 || zperm == 1) { + XBIT(mgi, 1, "Major group indicatioon"); + if (mgi == 1) { + /* PUSC major group bitmap*/ + XBIT(data, 6, "PUSC Major group bitmap"); + } + } + XBIT(data, 1, "CINR zone measurement type"); + } + if (ftype == 0) { + XBIT(api, 1, "Averaging parameter included"); + if (api == 1) { + XBIT(data, 4, "Averaging parameter"); + } + } + } + XBIT(data, 2, "MIMO_permutation_feedback_cycle"); + + pad = BIT_PADDING(bit,8); + if (pad) { + proto_tree_add_text(tree, tvb, BITHI(bit, pad), "Padding: %d bits", pad); + bit += pad; + } + return BIT_TO_NIB(bit); /* Return position in nibbles. */ +} + +gint UL_Zone_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 4 */ + /* 8.4.5.4.7 [2] UL_Zone_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_ZONE_IE"); + tree = proto_item_add_subtree(ti, ett_294); + + XBIT(data, 4, "Extended UIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 7, "OFDMA symbol offset"); + XBIT(data, 2, "Permutation"); + XBIT(data, 7, "UL_PermBase"); + XBIT(data, 2, "AMC type"); + XBIT(data, 1, "Use All SC indicator"); + XBIT(data, 1, "Disable subchannel rotation"); + XBIT(data, 4, "Reserved"); + return BIT_TO_NIB(bit); +} + +gint PHYMOD_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 5 */ + /* 8.4.5.4.14 [2] PHYMOD_UL_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint pmt; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "PHYMOD_UL_IE"); + tree = proto_item_add_subtree(ti, ett_302); + + XBIT(data, 4, "Extended UIUC"); + XBIT(data, 4, "Length"); + + XBIT(pmt, 1, "Preamble Modifier Type"); + if (pmt == 0) { + XBIT(data, 4, "Preamble frequency shift index"); + } else { + XBIT(data, 4, "Preamble Time Shift index"); + } + XBIT(data, 1, "Pilot Pattern Modifier"); + XBIT(data, 2, "Pilot Pattern Index"); + return BIT_TO_NIB(bit); +} + +gint MIMO_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 6 */ + /* 8.4.5.4.11 MIMO_UL_Basic_IE (not implemented) */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_Basic_IE"); + tree = proto_item_add_subtree(ti, ett_299); + + XNIB(data, 1, "Extended UIUC"); + XNIB(data, 1, "Length"); + proto_tree_add_text(tree, tvb, NIBHI(nib,length-2), "(not implemented)"); + return nib; +} + +gint ULMAP_Fast_Tracking_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 7 */ + /* 8.4.5.4.22 [2] ULMAP_Fast_Tracking_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Fast_Tracking_IE"); + tree = proto_item_add_subtree(ti, ett_302h); + + length = NIB_TO_BIT(length); + + XBIT(data, 4, "Extended UIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 2, "Map Index"); + XBIT(data, 6, "Reserved"); + while (bit < (length-7)) { + XBIT(data, 3, "Power correction"); + XBIT(data, 3, "Frequency correction"); + XBIT(data, 2, "Time correction"); + } + return BIT_TO_NIB(bit); +} + +gint UL_PUSC_Burst_Allocation_in_other_segment_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 8 */ + /* 8.4.5.4.17 [2] UL_PUSC_Burst_Allocation_in_other_segment_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_PUSC_Burst_Allocation_in_Other_Segment_IE"); + tree = proto_item_add_subtree(ti, ett_302c); + + XBIT(data, 4, "Extended UIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 4, "UIUC"); + XBIT(data, 2, "Segment"); + XBIT(data, 7, "UL_PermBase"); + XBIT(data, 8, "OFDMA symbol offset"); + XBIT(data, 6, "Subchannel offset"); + XBIT(data,10, "Duration"); + XBIT(data, 2, "Repetition coding indication"); + XBIT(data, 1, "Reserved"); + return BIT_TO_NIB(bit); +} + +gint Fast_Ranging_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 9 */ + /* 8.4.5.4.21 [2] Fast_Ranging_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint hidi; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Fast_Ranging_IE"); + tree = proto_item_add_subtree(ti, ett_302g); + + XBIT(data, 4, "Extended UIUC"); + XBIT(data, 4, "Length"); + + XBIT(hidi, 1, "HO_ID indicator"); + XBIT(data, 7, "Reserved"); + if (hidi == 1) { + XBIT(data, 8, "HO_ID"); + /* XBIT(data, 40, "Reserved"); TODO */ + } else { + /* XBIT(data, 48, "MAC address"); TODO */ + proto_tree_add_text(tree, tvb, BITHI(bit, 48), "MAC address"); + bit += 48; + } + XBIT(data, 4, "UIUC"); + XBIT(data,10, "Duration"); + XBIT(data, 2, "Repetition coding indication"); + return BIT_TO_NIB(bit); +} + +gint UL_Allocation_Start_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended IE = 0xA */ + /* 8.4.5.4.15 [2] UL_Allocation_Start_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_Allocation_start_IE"); + tree = proto_item_add_subtree(ti, ett_302a); + + XBIT(data, 4, "Extended UIUC"); + XBIT(data, 4, "Length"); + + XBIT(data, 8, "OFDMA symbol offset"); + XBIT(data, 7, "Subchannel offset"); + XBIT(data, 1, "Reserved"); + return BIT_TO_NIB(bit); +} + + +/******************************************************************** + * UL-MAP Extended-2 IEs + * table 290c + *******************************************************************/ + +gint CQICH_Enhanced_Allocation_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 0 */ + /* 8.4.5.4.16 [2] CQICH_Enhanced_Allocation_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint i, cnum, bapm; + guint pad; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "CQICH_Enhanced_Alloc_IE"); + tree = proto_item_add_subtree(ti, ett_302b); + + XBIT(data, 4, "Extended-2 UIUC"); + XBIT(data, 8, "Length"); + + if (cqich_id_size == 0) { + proto_tree_add_text(tree, tvb, BITHI(bit, 1), "CQICH_ID: n/a (size == 0 bits)"); + } else { + /* variable from 0-9 bits */ + data = BIT_BITS16(bit, bufptr, cqich_id_size); + proto_tree_add_text(tree, tvb, BITHI(bit, cqich_id_size), "CQICH_ID: %d (%d bits)", data, cqich_id_size); + bit += cqich_id_size; + } + + XBIT(data, 3, "Period (p)"); + XBIT(data, 3, "Frame offset"); + XBIT(data, 3, "Duration (d)"); + XBIT(cnum, 4, "CQICH_Num"); + cnum += 1; + for (i = 0; i < cnum; i++) { + XBIT(data, 3, "Feedback Type"); + XBIT(data, 6, "Allocation Index"); + XBIT(data, 3, "CQICH Type"); + XBIT(data, 1, "STTD indication"); + } + XBIT(bapm, 1, "Band_AMC_Precoding_Mode"); + if (bapm == 1) { + XBIT(data, 3, "Nr_Precoders_Feedback (=N)"); + } + + pad = BIT_PADDING(bit,8); + if (pad) { + proto_tree_add_text(tree, tvb, BITHI(bit, pad), "Padding: %d bits", pad); + bit += pad; + } + return BIT_TO_NIB(bit); +} + +gint HO_Anchor_Active_UL_MAP_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 1 */ + /* 8.4.5.4.18 [2] HO_Anchor_Active_UL_MAP_IE (not implemented) */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "HO_Anchor_Active_UL_MAP_IE"); + tree = proto_item_add_subtree(ti, ett_302d); + + XNIB(data, 1, "Extended-2 UIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(tree, tvb, NIBHI(nib,length-3), "(not implemented)"); + return nib; +} + +gint HO_Active_Anchor_UL_MAP_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 2 */ + /* 8.4.5.4.19 [2] HO_Active_Anchor_UL_MAP_IE (not implemented) */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "HO_Active_Anchor_UL_MAP_IE"); + tree = proto_item_add_subtree(ti, ett_302e); + + XNIB(data, 1, "Extended-2 UIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(tree, tvb, NIBHI(nib,length-3), "(not implemented)"); + return nib; +} + +gint Anchor_BS_switch_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 3 */ + /* 8.4.5.4.23 [2] Anchor_BS_switch_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint nbss, acod, cqai, pad; + gint i; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Anchor_BS_switch_IE"); + tree = proto_item_add_subtree(ti, ett_302i); + + XBIT(data, 4, "Extended-2 UIUC"); + XBIT(data, 8, "Length"); + + XBIT(nbss, 4, "N_Anchor_BS_switch"); + for (i = 0; i < nbss; i++) { + XBIT(data,12, "Reduced CID"); + XBIT(acod, 2, "Action Code"); + if (acod == 1) { + XBIT(data, 3, "Action Time (A)"); + XBIT(data, 3, "TEMP_BS_ID"); + XBIT(data, 2, "Reserved"); + } + if (acod == 0 || acod == 1) { + XBIT(data, 1, "AK Change Indicator"); + XBIT(cqai, 1, "CQICH Allocation Indicator"); + if (cqai == 1) { + /* variable bits from 0-9 */ + if (cqich_id_size == 0) { + proto_tree_add_text(tree, tvb, BITHI(bit, 1), "CQICH_ID: n/a (size == 0 bits)"); + } else { + data = BIT_BITS16(bit, bufptr, cqich_id_size); + proto_tree_add_text(tree, tvb, BITHI(bit, cqich_id_size), + "CQICH_ID: %d (%d bits)", data, cqich_id_size); + bit += cqich_id_size; + } + XBIT(data, 6, "Feedback channel offset"); + XBIT(data, 2, "Period (=p)"); + XBIT(data, 3, "Frame offset"); + XBIT(data, 3, "Duration (=d)"); + XBIT(data, 2, "MIMO_permutation_feedback_code"); + pad = BIT_PADDING(bit,8); + if (pad) { + proto_tree_add_text(tree, tvb, BITHI(bit,pad), "Reserved: %d bits", pad); + } + } + } else { + XBIT(data, 2, "Reserved"); + } + } + XBIT(data, 4, "Reserved"); + return BIT_TO_NIB(bit); +} + +gint UL_sounding_command_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 4 */ + /* 8.4.5.4.26 [2] UL_sounding_command_IE */ + /* see 8.4.6.2.7.1 */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint stype, ssrf, srlf, iafb, pad, sept, nssym, ncid, amod; + gint i, j; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_Sounding_Command_IE"); + tree = proto_item_add_subtree(ti, ett_315d); + + XBIT(data, 4, "Extended-2 UIUC"); + XBIT(data, 8, "Length"); + + XBIT(stype, 1, "Sounding_Type"); + XBIT(ssrf, 1, "Send Sounding Report Flag"); + XBIT(srlf, 1, "Sounding Relevance Flag"); + if (srlf == 0) { + XBIT(data, 1, "Sounding_Relevance"); + XBIT(data, 2, "Reserved"); + } else { + XBIT(data, 3, "Reserved"); + } + XBIT(iafb, 2, "Include additional feedback"); + if (stype == 0) { + XBIT(nssym, 3, "Num_Sounding_Symbols"); + XBIT(data, 1, "Reserved"); + for (i = 0; i < nssym; i++) { + XBIT(sept, 1, "Separability Type"); + if (sept == 0) { + XBIT(data, 3, "Max Cyclic Shift Index P"); + XBIT(data, 1, "Reserved"); + } else { + XBIT(data, 3, "Decimation Value D"); + XBIT(data, 1, "Decimation offset randomization"); + } + XBIT(data, 3, "Sounding symbol index"); + XBIT(ncid, 7, "Number of CIDs"); + XBIT(data, 1, "Reserved"); + for (j = 0; j < ncid; j++) { + XBIT(data,12, "Shorted Basic CID"); + XBIT(data, 2, "Power Assignment Method"); + XBIT(data, 1, "Power boost"); + XBIT(data, 1, "Multi-Antenna Flag"); + XBIT(amod, 1, "Allocation Mode"); + if (amod == 1) { + XBIT(data,12, "Band bit map"); + XBIT(data, 2, "Reserved"); + } else { + XBIT(data, 7, "Starting frequency band"); + XBIT(data, 7, "Number of frequency bands"); + } + if (srlf == 1) { + XBIT(data, 1, "Sounding_Relevance"); + } else { + XBIT(data, 1, "Reserved"); + } + if (sept == 0) { + XBIT(data, 5, "Cyclic time shift index m"); + } else { + XBIT(data, 6, "Decimation offset d"); + if (iafb == 1) { + XBIT(data, 1, "Use same symbol for additional feedback"); + XBIT(data, 2, "Reserved"); + } else { + XBIT(data, 3, "Reserved"); + } + } + XBIT(data, 3, "Periodicity"); + } + } + } else { + XBIT(data, 3, "Permutation"); + XBIT(data, 6, "DL_PermBase"); + XBIT(nssym, 3, "Num_Sounding_symbols"); + for (i = 0; i < nssym; i++) { + XBIT(ncid, 7, "Number of CIDs"); + XBIT(data, 1, "Reserved"); + for (j = 0; j < ncid; j++) { + XBIT(data, 12, "Shortened basic CID"); + if (srlf) { + XBIT(data, 1, "Sounding_Relevance"); + XBIT(data, 3, "Reserved"); + } + XBIT(data, 7, "Subchannel offset"); + XBIT(data, 1, "Power boost"); + XBIT(data, 3, "Number of subchannels"); + XBIT(data, 3, "Periodicity"); + XBIT(data, 2, "Power assignment method"); + } + } + } + pad = BIT_PADDING(bit,8); + if (pad) { + proto_tree_add_text(tree, tvb, BITHI(bit,pad), "Padding: %d bits",pad); + bit += pad; + } + return BIT_TO_NIB(bit); +} + +gint MIMO_UL_Enhanced_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 6 */ + /* 8.4.5.4.20 [2] MIMO_UL_Enhanced_IE (not implemented) */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint nib; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + nib = offset; + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_Enhanced_IE"); + tree = proto_item_add_subtree(ti, ett_302f); + + XNIB(data, 1, "Extended-2 UIUC"); + XNIB(data, 2, "Length"); + proto_tree_add_text(tree, tvb, NIBHI(nib,length-3), "(not implemented)"); + return nib; +} + +gint HARQ_ULMAP_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 7 */ + /* 8.4.5.4.24 HARQ_ULMAP_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint bitlength; + gint lastbit; + gint pad, mode, alsi, nsub; + gint i; + + bit = NIB_TO_BIT(offset); + bitlength = NIB_TO_BIT(length); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "HARQ_ULMAP_IE"); + tree = proto_item_add_subtree(ti, ett_302j); + + XBIT(data, 4, "Extended-2 UIUC"); + XBIT(data, 8, "Length"); + + XBIT(RCID_Type, 2, "RCID_Type"); + XBIT(data, 2, "Reserved"); + lastbit = bit + bitlength -16 - 4; + while (bit < lastbit) { + XBIT(mode, 3, "Mode"); + XBIT(alsi, 1, "Allocation Start Indication"); + if (alsi == 1) { + XBIT(data, 8, "OFDMA Symbol offset"); + XBIT(data, 7, "Subchannel offset"); + XBIT(data, 1, "Reserved"); + } + XBIT(nsub, 4, "N sub Burst"); + for (i = 0; i < nsub; i++) { + if (mode == 0) { + bit += UL_HARQ_Chase_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + } else if (mode == 1) { + bit += UL_HARQ_IR_CTC_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + } else if (mode == 2) { + bit += UL_HARQ_IR_CC_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + } else if (mode == 3) { + bit += MIMO_UL_Chase_HARQ_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + } else if (mode == 4) { + bit += MIMO_UL_IR_HARQ__Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + } else if (mode == 5) { + bit += MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(tree, bufptr, bit, bitlength, tvb); + } else if (mode == 6) { + bit += MIMO_UL_STC_HARQ_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + } + } + } + + pad = NIB_TO_BIT(offset) + bitlength - bit; + if (pad) { + proto_tree_add_text(tree, tvb, BITHI(bit,pad), "Padding: %d bits",pad); + bit += pad; + } + return BIT_TO_NIB(bit); +} + +gint HARQ_ACKCH_Region_Allocation_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 8 */ + /* 8.4.5.4.25 [2] HARQ_ACKCH_Region_Allocation_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "HARQ_ACKCH_Region_IE"); + tree = proto_item_add_subtree(ti, ett_302t); + + XBIT(data, 4, "Extended-2 UIUC"); + XBIT(data, 8, "Length"); + + XBIT(data, 8, "OFDMA Symbol Offset"); + XBIT(data, 7, "Subchannel Offset"); + XBIT(data, 5, "No. OFDMA Symbols"); + XBIT(data, 4, "No. Subchannels"); + return BIT_TO_NIB(bit); +} + +gint AAS_SDMA_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 0xE */ + /* 8.4.5.4.27 [2] AAS_SDMA_UL_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint nreg, pad, user, encm, ppmd, padj; + gint aasp = 0; /* TODO AAS UL preamble used */ + gint ii, jj; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "AAS_SDMA_UL_IE"); + tree = proto_item_add_subtree(ti, ett_302u); + + XBIT(data, 4, "Extended-2 UIUC"); + XBIT(data, 8, "Length"); + + XBIT(RCID_Type, 2, "RCID_Type"); + XBIT(nreg, 4, "Num Burst Region"); + XBIT(data, 2, "Reserved"); + for (ii = 0; ii < nreg; ii++) { + XBIT(data,12, "Slot offset"); + XBIT(data,10, "Slot duration"); + XBIT(user, 3, "Number of users"); + XBIT(data, 3, "Reserved"); + for (jj = 0; jj < user; jj++) { + bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + XBIT(encm, 2, "Encoding Mode"); + XBIT(padj, 1, "Power Adjust"); + XBIT(ppmd, 1, "Pilot Pattern Modifier"); + if (aasp) { + XBIT(data, 4, "Preamble Modifier Index"); + } + if (ppmd) { + XBIT(data, 2, "Pilot Pattern"); + XBIT(data, 2, "Reserved"); + } + if (encm == 0) { + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 2, "Reserved"); + } + if (encm == 1) { + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 1, "Reserved"); + } + if (encm == 2) { + XBIT(data, 4, "N(EP)"); + XBIT(data, 4, "N(SCH)"); + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 1, "Reserved"); + } + if (encm == 3) { + XBIT(data, 4, "DIUC"); + XBIT(data, 2, "Repetition Coding Indication"); + XBIT(data, 2, "SPID"); + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 3, "Reserved"); + } + if (padj) { + XBIT(data, 8, "Power Adjustment"); + + } + } + } + + pad = BIT_PADDING(bit,8); + if (pad) { + proto_tree_add_text(tree, tvb, BITHI(bit, pad), "Padding: %d bits", pad); + bit += pad; + } + return BIT_TO_NIB(bit); +} + +gint Feedback_Polling_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* UL-MAP Extended-2 IE = 0xF */ + /* 8.4.5.4.28 [2] Feedback_Polling_IE */ + /* offset of TLV in nibbles, length of TLV in nibbles */ + gint bit; + gint data; + proto_item *ti = NULL; + proto_item *tree = NULL; + gint nalloc, dula, pad, adur; + gint i; + + bit = NIB_TO_BIT(offset); + + ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Feedback_Polling_IE"); + tree = proto_item_add_subtree(ti, ett_302v); + + XBIT(data, 4, "Extended-2 UIUC"); + XBIT(data, 8, "Length"); + + XBIT(nalloc, 4, "Num_Allocation"); + XBIT(dula, 1, "Dedicated UL Allocation included"); + XBIT(data, 3, "Reserved"); + for (i = 0; i < nalloc; i++) { + XBIT(data,16, "Basic CID"); + XBIT(adur, 3, "Allocation Duration (d)"); + if (adur != 0) { + XBIT(data, 4, "Feedback type"); + XBIT(data, 3, "Frame Offset"); + XBIT(data, 2, "Period (p)"); + if (dula == 1) { + XBIT(data, 4, "UIUC"); + XBIT(data, 8, "OFDMA Symbol Offset"); + XBIT(data, 7, "Subchannel offset"); + XBIT(data, 3, "Duration"); + XBIT(data, 2, "Repetition coding indication"); + } + } + } + pad = BIT_PADDING(bit,8); + if (pad) { + proto_tree_add_text(tree, tvb, BITHI(bit, pad), "Padding: %d bits", pad); + bit += pad; + } + return BIT_TO_NIB(bit); +} + + +/******************************************************************** + * UL-MAP Miscellany + *******************************************************************/ + + +void lshift_bits(guint8 *buffer, gint bytes, gint bits) +{ + /* left shift a buffer by specified number of bits */ + /* used for ULMAP ExtIE CQICH alloc IE */ + gint i; + gint xbits; + + while (bits >= 8) { + for (i=1; i<bytes; i++) + buffer[i-1] = buffer[i]; + bits -= 8; + bytes--; + } + if (bits > 0) + { + xbits = 8 - bits; + for (i = 0; i < (bytes-1); i++) { + buffer[i] <<= bits; + buffer[i] |= (buffer[i+1] >> xbits); + } + buffer[bytes-1] <<= bits; + } +} + + +/* Register Wimax Mac Payload Protocol and Dissector */ +void proto_register_mac_mgmt_msg_ulmap(void) +{ + if (proto_mac_mgmt_msg_ulmap_decoder == -1) + { + proto_mac_mgmt_msg_ulmap_decoder = proto_mac_mgmt_msg_dlmap_decoder; + + proto_register_field_array(proto_mac_mgmt_msg_ulmap_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + + +gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* decode a single UL-MAP IE and return the + * length of the IE in nibbles + * offset = start of IE (nibbles) + * length = total length of bufptr (nibbles) */ + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint nibble; + gint uiuc, ext_uiuc, ext2_uiuc, len, aas_or_amc; + guint cid; + guint data; + guint32 data32; + + nibble = offset; + + UNREFERENCED_PARAMETER(length); + + /* 8.4.5.4 UL-MAP IE format - table 287 */ + cid = NIB_WORD(nibble, bufptr); + uiuc = NIB_NIBBLE(nibble + 4, bufptr); + + if (uiuc == 0) + { + /* 8.4.5.4.9 FAST-FEEDBACK channel */ + ti = proto_tree_add_text(ie_tree, tvb, NIBHI(nibble, 5+8), "FAST FEEDBACK Allocation IE"); + tree = proto_item_add_subtree(ti, ett_ulmap_ffb); + + proto_tree_add_uint(tree, hf_ulmap_ie_cid, tvb, NIBHI(nibble, 4), cid); + nibble += 4; + proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); + nibble += 1; + + data = NIB_LONG(nibble, bufptr); + proto_tree_add_uint(tree, hf_ulmap_uiuc0_symofs, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc0_subofs, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc0_numsym, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc0_numsub, tvb, NIBHI(nibble, 8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc0_rsv, tvb, NIBHI(nibble, 8), data); + nibble += 8; + } + else if (uiuc == 11) + { + /* 8.4.5.4.4.2 [2] extended-2 UIUC IE table 290b */ + ext2_uiuc = NIB_NIBBLE(5+nibble, bufptr); + len = NIB_BYTE(5+nibble+1, bufptr); + + ti = proto_tree_add_text(ie_tree, tvb, NIBHI(nibble, 5+3+len*2), "UIUC: %d (Extended-2 IE)", uiuc); + tree = proto_item_add_subtree(ti, ett_290b); + + proto_tree_add_uint(tree, hf_ulmap_ie_cid, tvb, NIBHI(nibble, 4), cid); + nibble += 4; + proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); + nibble += 1; + + /* + proto_tree_add_uint(tree, hf_ulmap_uiuc11_ext, tvb, NIBHI(nibble, 1), ext2_uiuc); + nibble += 1; + proto_tree_add_uint(tree, hf_ulmap_uiuc11_len, tvb, NIBHI(nibble, 2), len); + nibble += 2; + */ + + len = 4 + BYTE_TO_NIB(len); /* length in nibbles */ + + /* data table 290c 8.4.5.4.4.2 */ + switch (ext2_uiuc) { + case 0x00: + /* 8.4.5.4.16 CQICH_Enhanced_Allocation_IE */ + nibble = CQICH_Enhanced_Allocation_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x01: + /* 8.4.5.4.18 HO_Anchor_Active_UL_MAP_IE */ + nibble = HO_Anchor_Active_UL_MAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x02: + /* 8.4.5.4.19 HO_Active_Anchor_UL_MAP_IE */ + nibble = HO_Active_Anchor_UL_MAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x03: + /* 8.4.5.4.23 Anchor_BS_switch_IE */ + nibble = Anchor_BS_switch_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x04: + /* 8.4.5.4.26 UL_sounding_command_IE */ + nibble = UL_sounding_command_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x06: + /* 8.4.5.4.20 MIMO_UL_Enhanced_IE */ + nibble = MIMO_UL_Enhanced_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x07: + /* 8.4.5.4.24 HARQ_ULMAP_IE */ + nibble = HARQ_ULMAP_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x08: + /* 8.4.5.4.25 HARQ_ACKCH_Region_Allocation_IE */ + nibble = HARQ_ACKCH_Region_Allocation_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x0e: + /* 8.4.5.4.27 AAS_SDMA_UL_IE */ + nibble = AAS_SDMA_UL_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x0f: + /* 8.4.5.4.28 Feedback_Polling_IE */ + nibble = Feedback_Polling_IE(tree, bufptr, nibble, len, tvb); + break; + + default: + proto_tree_add_text(tree, tvb, NIBHI(nibble, len), "(reserved Extended-2 UIUC: %d)", ext2_uiuc); + nibble += len; + break; + + } + } + else if (uiuc == 12) + { + /* 8.4.5.4 [2] CDMA bandwidth request, CDMA ranging */ + ti = proto_tree_add_text(ie_tree, tvb, NIBHI(nibble, 5+8), "CDMA Bandwidth/Ranging Request IE"); + tree = proto_item_add_subtree(ti, ett_287_1); + + proto_tree_add_uint(tree, hf_ulmap_ie_cid, tvb, NIBHI(nibble, 4), cid); + nibble += 4; + proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); + nibble += 1; + + data32 = NIB_LONG(nibble, bufptr); + proto_tree_add_uint(tree, hf_ulmap_uiuc12_symofs, tvb, NIBHI(nibble,8), data32); + proto_tree_add_uint(tree, hf_ulmap_uiuc12_subofs, tvb, NIBHI(nibble,8), data32); + proto_tree_add_uint(tree, hf_ulmap_uiuc12_numsym, tvb, NIBHI(nibble,8), data32); + proto_tree_add_uint(tree, hf_ulmap_uiuc12_numsub, tvb, NIBHI(nibble,8), data32); + proto_tree_add_uint(tree, hf_ulmap_uiuc12_method, tvb, NIBHI(nibble,8), data32); + proto_tree_add_uint(tree, hf_ulmap_uiuc12_dri, tvb, NIBHI(nibble,8), data32); + nibble += 8; + } + else if (uiuc == 13) + { + /* 8.4.5.4.2 [2] PAPR reduction allocation, safety zone - table 289 */ + ti = proto_tree_add_text(ie_tree, tvb, NIBHI(nibble,5+8), "PAPR/Safety/Sounding Zone IE"); + tree = proto_item_add_subtree(ti, ett_289); + + + proto_tree_add_uint(tree, hf_ulmap_ie_cid, tvb, NIBHI(nibble, 4), cid); + nibble += 4; + proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); + nibble += 1; + + data = NIB_LONG(nibble, bufptr); + proto_tree_add_uint(tree, hf_ulmap_uiuc13_symofs, tvb, NIBHI(nibble,8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc13_subofs, tvb, NIBHI(nibble,8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc13_numsym, tvb, NIBHI(nibble,8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc13_numsub, tvb, NIBHI(nibble,8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc13_papr, tvb, NIBHI(nibble,8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc13_zone, tvb, NIBHI(nibble,8), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc13_rsv, tvb, NIBHI(nibble,8), data); + nibble += 8; + } + else if (uiuc == 14) + { + /* 8.4.5.4.3 [2] CDMA allocation IE */ + ti = proto_tree_add_text(ie_tree, tvb, NIBHI(nibble,5+10), "CDMA allocation IE"); + tree = proto_item_add_subtree(ti, ett_290); + + proto_tree_add_uint(tree, hf_ulmap_ie_cid, tvb, NIBHI(nibble, 4), cid); + nibble += 4; + proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); + nibble += 1; + + data = NIB_WORD(nibble, bufptr); + proto_tree_add_uint(tree, hf_ulmap_uiuc14_dur, tvb, NIBHI(nibble,2), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc14_uiuc, tvb, NIBHI(nibble+1,2), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc14_rep, tvb, NIBHI(nibble+2,1), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc14_idx, tvb, NIBHI(nibble+3,1), data); + nibble += 4; + + data = NIB_BYTE(nibble, bufptr); + proto_tree_add_uint(tree, hf_ulmap_uiuc14_code, tvb, NIBHI(nibble,2), data); + proto_item_append_text(ti, " (0x%02x)", data); + nibble += 2; + + data = NIB_BYTE(nibble, bufptr); + proto_tree_add_uint(tree, hf_ulmap_uiuc14_sym, tvb, NIBHI(nibble,2), data); + proto_item_append_text(ti, " (0x%02x)", data); + nibble += 2; + + data = NIB_BYTE(nibble, bufptr); + proto_tree_add_uint(tree, hf_ulmap_uiuc14_sub, tvb, NIBHI(nibble,2), data); + proto_item_append_text(ti, " (0x%02x)", data >> 1); + proto_tree_add_uint(tree, hf_ulmap_uiuc14_bwr, tvb, NIBHI(nibble+1,1), data); + nibble += 2; + } + else if (uiuc == 15) + { + /* 8.4.5.4.4 [1] Extended UIUC dependent IE table 291 */ + ext_uiuc = NIB_NIBBLE(5+nibble, bufptr); + len = NIB_NIBBLE(5+nibble+1, bufptr); + + ti = proto_tree_add_text(ie_tree, tvb, NIBHI(nibble, 5+2+len*2), "UIUC: %d (Extended IE)", uiuc); + tree = proto_item_add_subtree(ti, ett_291); + + proto_tree_add_uint(tree, hf_ulmap_ie_cid, tvb, NIBHI(nibble,4), cid); + nibble += 4; + proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble,1), uiuc); + nibble += 1; + + /* + ti = proto_tree_add_uint(tree, hf_ulmap_uiuc11_ext, tvb, NIBHI(nibble,1), ext_uiuc); + nibble += 1; + proto_tree_add_uint(tree, hf_ulmap_uiuc11_len, tvb, NIBHI(nibble,1), len); + nibble += 1; + */ + + len = 2 + BYTE_TO_NIB(len); /* length in nibbles */ + + /* data table 290a 8.4.5.4.4.1 */ + switch (ext_uiuc) { + case 0x00: + /* 8.4.5.4.5 Power_Control_IE */ + nibble = Power_Control_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x01: + /* 8.4.5.4.8 Mini-Subchannel_allocation_IE*/ + nibble = Mini_Subchannel_allocation_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x02: + /* 8.4.5.4.6 AAS_UL_IE*/ + nibble = AAS_UL_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x03: + /* 8.4.5.4.12 CQICH_Alloc_IE */ + nibble = CQICH_Alloc_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x04: + /* 8.4.5.4.7 UL_Zone_IE */ + nibble = UL_Zone_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x05: + /* 8.4.5.4.14 PHYMOD_UL_IE */ + nibble = PHYMOD_UL_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x06: + /* 8.4.5.4.11 MIMO_UL_IE */ + nibble = MIMO_UL_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x07: + /* 8.4.5.4.22 ULMAP_Fast_Tracking_IE */ + nibble = ULMAP_Fast_Tracking_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x08: + /* 8.4.5.4.17 UL_PUSC_Burst_Allocation_in_other_segment_IE */ + nibble = UL_PUSC_Burst_Allocation_in_other_segment_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x09: + /* 8.4.5.4.21 Fast_Ranging_IE */ + nibble = Fast_Ranging_IE(tree, bufptr, nibble, len, tvb); + break; + case 0x0a: + /* 8.4.5.4.15 UL_Allocation_Start_IE */ + nibble = UL_Allocation_Start_IE(tree, bufptr, nibble, len, tvb); + break; + default: + proto_tree_add_text(tree, tvb, NIBHI(nibble,len), "(reserved Extended UIUC: %d)", ext_uiuc); + nibble += len; + break; + } + } + else + { + /* 8.4.5.4 [2] regular IE 1-10, data grant burst type */ + aas_or_amc = 0; /* TODO */ + len = 3; + + if (aas_or_amc) len += 3; + + ti = proto_tree_add_text(ie_tree, tvb, NIBHI(nibble, 5+len), "Data Grant Burst Profile"); + tree = proto_item_add_subtree(ti, ett_287_2); + + proto_tree_add_uint(tree, hf_ulmap_ie_cid, tvb, NIBHI(nibble, 4), cid); + nibble += 4; + proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); + nibble += 1; + + data = NIB_WORD(nibble, bufptr); + proto_tree_add_uint(tree, hf_ulmap_uiuc10_dur, tvb, NIBHI(nibble,3), data); + proto_tree_add_uint(tree, hf_ulmap_uiuc10_rep, tvb, NIBHI(nibble+2,1), data); + nibble += 3; + + if (aas_or_amc) { + data = NIB_BITS12(nibble, bufptr); + proto_tree_add_text(tree, tvb, NIBHI(nibble,3), "Slot offset: %d", data); + nibble += 3; + } + } + + /* length in nibbles */ + return (nibble - offset); +} + +void dissect_mac_mgmt_msg_ulmap_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + /* 6.3.2.3.4 [2] UL-MAP table 18 */ + guint offset = 0; + guint length; + guint nib, pad; + proto_item *ti = NULL; + proto_tree *ulmap_tree = NULL; + proto_tree *ie_tree = NULL; + guint tvb_len; + const guint8 *bufptr; + + tvb_len = tvb_length(tvb); + bufptr = tvb_get_ptr(tvb, offset, tvb_len); + + UNREFERENCED_PARAMETER(pinfo); + + /* display MAC UL-MAP */ + ti = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_ulmap_decoder, tvb, offset, tvb_len, "UL-MAP (%u bytes)", tvb_len); + ulmap_tree = proto_item_add_subtree(ti, ett_ulmap); + + /* Decode and display the UL-MAP */ + proto_tree_add_item(ulmap_tree, hf_ulmap_message_type, tvb, offset, 1, FALSE); + offset++; + + proto_tree_add_item(ulmap_tree, hf_ulmap_reserved, tvb, offset, 1, FALSE); + offset++; + proto_tree_add_item(ulmap_tree, hf_ulmap_ucd_count, tvb, offset, 1, FALSE); + offset++; + proto_tree_add_item(ulmap_tree, hf_ulmap_alloc_start_time, tvb, offset, 4, FALSE); + offset += 4; + proto_tree_add_item(ulmap_tree, hf_ulmap_ofdma_sym, tvb, offset, 1, FALSE); + offset++; + + /* UL-MAP IEs */ + length = tvb_len - offset; /* remaining length in bytes */ + ti = proto_tree_add_text(ulmap_tree, tvb, offset, length, "UL-MAP IEs (%u bytes)", length); + ie_tree = proto_item_add_subtree(ti, ett_ulmap_ie); + + length = BYTE_TO_NIB(length); /* convert length to nibbles */ + nib = BYTE_TO_NIB(offset); + while (nib < ((tvb_len*2)-1)) { + nib += dissect_ulmap_ie(ie_tree, bufptr, nib, tvb_len*2, tvb); + } + pad = NIB_PADDING(nib); + if (pad) { + proto_tree_add_text(ulmap_tree, tvb, NIBHI(nib,1), "Padding nibble"); + nib++; + } +} + +/*gint wimax_decode_ulmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)*/ +gint wimax_decode_ulmapc(proto_tree *base_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.6.2 [2] Compressed UL-MAP */ + /* returns length in nibbles */ + gint nib; + guint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + proto_tree *ie_tree = NULL; + + nib = offset; + + /* display MAC UL-MAP */ + ti = proto_tree_add_protocol_format(base_tree, proto_mac_mgmt_msg_ulmap_decoder, tvb, NIBHI(offset,length), "Compressed UL-MAP"); + tree = proto_item_add_subtree(ti, ett_306); + + /* Decode and display the UL-MAP */ + data = NIB_BYTE(nib, bufptr); + proto_tree_add_uint(tree, hf_ulmap_ucd_count, tvb, NIBHI(nib,2), data); + nib += 2; + data = NIB_LONG(nib, bufptr); + proto_tree_add_uint(tree, hf_ulmap_alloc_start_time, tvb, NIBHI(nib,8), data); + nib += 8; + data = NIB_BYTE(nib, bufptr); + proto_tree_add_uint(tree, hf_ulmap_ofdma_sym, tvb, NIBHI(nib,2), data); /* added 2005 */ + nib += 2; + + ti = proto_tree_add_text(tree, tvb, NIBHI(nib,length-nib), "UL-MAP IEs"); + ie_tree = proto_item_add_subtree(ti, ett_306_ul); + while (nib < length-1) { + nib += dissect_ulmap_ie(ie_tree, bufptr, nib, length-nib, tvb); + } + + /* padding */ + if (nib & 1) { + proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Padding Nibble"); + nib++; + } + + + return length; +} + + +gint wimax_decode_ulmap_reduced_aas(proto_tree *base_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +{ + /* 8.4.5.8.2 Reduced AAS private UL-MAP */ + /* offset and length are in bits since this is called from within + * the Reduced AAS private DL-MAP + * return length in bits */ + gint bit; + guint data; + proto_item *ti = NULL; + proto_tree *tree = NULL; + gint azci, azpi, umii, phmi, powi, fbck; + + bit = offset; + + ti = proto_tree_add_text(base_tree, tvb, BITHI(bit,length), "Reduced_AAS_Private_UL_MAP"); + tree = proto_item_add_subtree(ti, ett_308b); + + /* Decode and display the Reduced AAS private UL-MAP */ + XBIT(azci, 1, "AAS zone configuration included"); + XBIT(azpi, 1, "AAS zone position included"); + XBIT(umii, 1, "UL-MAP information included"); + XBIT(phmi, 1, "PHY modification included"); + XBIT(powi, 1, "Power Control included"); + XBIT(fbck, 2, "Include Feedback Header"); + XBIT(data, 2, "Encoding Mode"); + + if (azci) { + XBIT(data, 2, "Permutation"); + XBIT(data, 7, "UL_PermBase"); + XBIT(data, 2, "Preamble Indication"); + XBIT(data, 5, "Padding"); + } + if (azpi) { + XBIT(data, 8, "Zone Symbol Offset"); + XBIT(data, 8, "Zone Length"); + } + if (umii) { + XBIT(data, 8, "UCD Count"); + data = BIT_BITS64(bit,bufptr,32); + proto_tree_add_text(tree, tvb, BITHI(bit,32), "Private Map Allocation Start Time: %u",data); + bit += 32; + } + if (phmi) { + XBIT(data, 1, "Preamble Select"); + XBIT(data, 4, "Preamble Shift Index"); + XBIT(data, 1, "Pilot Pattern Modifier"); + data = BIT_BITS32(bit,bufptr,22); + proto_tree_add_text(tree, tvb, BITHI(bit,22), "Pilot Pattern Index: %u",data); + bit += 22; + } + if (powi) { + XBIT(data, 8, "Power Control"); + } + XBIT(data, 3, "UL Frame Offset"); + XBIT(data,12, "Slot Offset"); + XBIT(data,10, "Slot Duration"); + XBIT(data, 4, "UIUC / N(EP)"); + if (harq) { + XBIT(data, 4, "ACID"); + XBIT(data, 1, "AI_SN"); + XBIT(data, 3, "Reserved"); + if (ir_type) { + XBIT(data, 4, "N(SCH)"); + XBIT(data, 2, "SPID"); + XBIT(data, 2, "Reserved"); + } + } + XBIT(data, 2, "Repetition Coding Indication"); + + return (bit - offset); /* length in bits */ +} + diff --git a/plugins/wimax/packet-wmx.c b/plugins/wimax/packet-wmx.c new file mode 100644 index 0000000000..cb2c218d8e --- /dev/null +++ b/plugins/wimax/packet-wmx.c @@ -0,0 +1,941 @@ +/* packet-wmx.c + * WiMax Protocol and dissectors + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "moduleinfo.h" + +#include <string.h> +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include <epan/address.h> +#include <epan/reassemble.h> +#include <epan/emem.h> +#include "wimax_tlv.h" +#include "wimax_bits.h" + +/* Define version if we are not building Wireshark statically */ +#ifndef ENABLE_STATIC +G_MODULE_EXPORT const gchar version[] = VERSION; +#endif + +/* WiMax dissector function prototypes */ +extern void proto_register_wimax_cdma(void); +extern void proto_register_wimax_fch(void); +extern void proto_register_wimax_pdu(void); +extern void proto_register_wimax_ffb(void); +extern void proto_register_wimax_hack(void); +extern void proto_register_wimax_harq_map(void); +extern void proto_register_wimax_phy_attributes(void); +extern void proto_register_wimax_compact_dlmap_ie(void); +extern void proto_register_wimax_compact_ulmap_ie(void); + +extern void wimax_defragment_init(void); + +/* Global functions */ +void proto_register_wimax(); +void proto_reg_wimax(void); +void proto_reg_handoff_wimax(void); +gboolean is_down_link(address *src_address); + +/* forward reference */ +static void dissect_wimax(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +/* Global variables */ +gint proto_wimax = -1; +gint8 arq_enabled = 0; +gint scheduling_service_type = 0; +gint mac_sdu_length = 49; /* default SDU size is 49 bytes (11.13.16) */ +extern guint global_cid_max_basic; +extern gboolean include_cor2_changes; + +gint man_ofdma = 1; + +address bs_address = {0,0,0}; + +/* The following variables are local to the function, but serve as + elements for the global ett_tlv[] array */ +static gint ett_tlv_0 = -1; +static gint ett_tlv_1 = -1; +static gint ett_tlv_2 = -1; +static gint ett_tlv_3 = -1; +static gint ett_tlv_4 = -1; +static gint ett_tlv_5 = -1; +static gint ett_tlv_6 = -1; +static gint ett_tlv_7 = -1; +static gint ett_tlv_8 = -1; +static gint ett_tlv_9 = -1; +static gint ett_tlv_10 = -1; +static gint ett_tlv_11 = -1; +static gint ett_tlv_12 = -1; +static gint ett_tlv_13 = -1; +static gint ett_tlv_14 = -1; +static gint ett_tlv_15 = -1; +static gint ett_tlv_16 = -1; +static gint ett_tlv_17 = -1; +static gint ett_tlv_18 = -1; +static gint ett_tlv_19 = -1; +static gint ett_tlv_20 = -1; +static gint ett_tlv_21 = -1; +static gint ett_tlv_22 = -1; +static gint ett_tlv_23 = -1; +static gint ett_tlv_24 = -1; +static gint ett_tlv_25 = -1; +static gint ett_tlv_26 = -1; +static gint ett_tlv_27 = -1; +static gint ett_tlv_28 = -1; +static gint ett_tlv_29 = -1; +static gint ett_tlv_30 = -1; +static gint ett_tlv_31 = -1; +static gint ett_tlv_32 = -1; +static gint ett_tlv_33 = -1; +static gint ett_tlv_34 = -1; +static gint ett_tlv_35 = -1; +static gint ett_tlv_36 = -1; +static gint ett_tlv_37 = -1; +static gint ett_tlv_38 = -1; +static gint ett_tlv_39 = -1; +static gint ett_tlv_40 = -1; +static gint ett_tlv_41 = -1; +static gint ett_tlv_42 = -1; +static gint ett_tlv_43 = -1; +static gint ett_tlv_44 = -1; +static gint ett_tlv_45 = -1; +static gint ett_tlv_46 = -1; +static gint ett_tlv_47 = -1; +static gint ett_tlv_48 = -1; +static gint ett_tlv_49 = -1; +static gint ett_tlv_50 = -1; +static gint ett_tlv_51 = -1; +static gint ett_tlv_52 = -1; +static gint ett_tlv_53 = -1; +static gint ett_tlv_54 = -1; +static gint ett_tlv_55 = -1; +static gint ett_tlv_56 = -1; +static gint ett_tlv_57 = -1; +static gint ett_tlv_58 = -1; +static gint ett_tlv_59 = -1; +static gint ett_tlv_60 = -1; +static gint ett_tlv_61 = -1; +static gint ett_tlv_62 = -1; +static gint ett_tlv_63 = -1; +static gint ett_tlv_64 = -1; +static gint ett_tlv_65 = -1; +static gint ett_tlv_66 = -1; +static gint ett_tlv_67 = -1; +static gint ett_tlv_68 = -1; +static gint ett_tlv_69 = -1; +static gint ett_tlv_70 = -1; +static gint ett_tlv_71 = -1; +static gint ett_tlv_72 = -1; +static gint ett_tlv_73 = -1; +static gint ett_tlv_74 = -1; +static gint ett_tlv_75 = -1; +static gint ett_tlv_76 = -1; +static gint ett_tlv_77 = -1; +static gint ett_tlv_78 = -1; +static gint ett_tlv_79 = -1; +static gint ett_tlv_80 = -1; +static gint ett_tlv_81 = -1; +static gint ett_tlv_82 = -1; +static gint ett_tlv_83 = -1; +static gint ett_tlv_84 = -1; +static gint ett_tlv_85 = -1; +static gint ett_tlv_86 = -1; +static gint ett_tlv_87 = -1; +static gint ett_tlv_88 = -1; +static gint ett_tlv_89 = -1; +static gint ett_tlv_90 = -1; +static gint ett_tlv_91 = -1; +static gint ett_tlv_92 = -1; +static gint ett_tlv_93 = -1; +static gint ett_tlv_94 = -1; +static gint ett_tlv_95 = -1; +static gint ett_tlv_96 = -1; +static gint ett_tlv_97 = -1; +static gint ett_tlv_98 = -1; +static gint ett_tlv_99 = -1; +static gint ett_tlv_100 = -1; +static gint ett_tlv_101 = -1; +static gint ett_tlv_102 = -1; +static gint ett_tlv_103 = -1; +static gint ett_tlv_104 = -1; +static gint ett_tlv_105 = -1; +static gint ett_tlv_106 = -1; +static gint ett_tlv_107 = -1; +static gint ett_tlv_108 = -1; +static gint ett_tlv_109 = -1; +static gint ett_tlv_110 = -1; +static gint ett_tlv_111 = -1; +static gint ett_tlv_112 = -1; +static gint ett_tlv_113 = -1; +static gint ett_tlv_114 = -1; +static gint ett_tlv_115 = -1; +static gint ett_tlv_116 = -1; +static gint ett_tlv_117 = -1; +static gint ett_tlv_118 = -1; +static gint ett_tlv_119 = -1; +static gint ett_tlv_120 = -1; +static gint ett_tlv_121 = -1; +static gint ett_tlv_122 = -1; +static gint ett_tlv_123 = -1; +static gint ett_tlv_124 = -1; +static gint ett_tlv_125 = -1; +static gint ett_tlv_126 = -1; +static gint ett_tlv_127 = -1; +static gint ett_tlv_128 = -1; +static gint ett_tlv_129 = -1; +static gint ett_tlv_130 = -1; +static gint ett_tlv_131 = -1; +static gint ett_tlv_132 = -1; +static gint ett_tlv_133 = -1; +static gint ett_tlv_134 = -1; +static gint ett_tlv_135 = -1; +static gint ett_tlv_136 = -1; +static gint ett_tlv_137 = -1; +static gint ett_tlv_138 = -1; +static gint ett_tlv_139 = -1; +static gint ett_tlv_140 = -1; +static gint ett_tlv_141 = -1; +static gint ett_tlv_142 = -1; +static gint ett_tlv_143 = -1; +static gint ett_tlv_144 = -1; +static gint ett_tlv_145 = -1; +static gint ett_tlv_146 = -1; +static gint ett_tlv_147 = -1; +static gint ett_tlv_148 = -1; +static gint ett_tlv_149 = -1; +static gint ett_tlv_150 = -1; +static gint ett_tlv_151 = -1; +static gint ett_tlv_152 = -1; +static gint ett_tlv_153 = -1; +static gint ett_tlv_154 = -1; +static gint ett_tlv_155 = -1; +static gint ett_tlv_156 = -1; +static gint ett_tlv_157 = -1; +static gint ett_tlv_158 = -1; +static gint ett_tlv_159 = -1; +static gint ett_tlv_160 = -1; +static gint ett_tlv_161 = -1; +static gint ett_tlv_162 = -1; +static gint ett_tlv_163 = -1; +static gint ett_tlv_164 = -1; +static gint ett_tlv_165 = -1; +static gint ett_tlv_166 = -1; +static gint ett_tlv_167 = -1; +static gint ett_tlv_168 = -1; +static gint ett_tlv_169 = -1; +static gint ett_tlv_170 = -1; +static gint ett_tlv_171 = -1; +static gint ett_tlv_172 = -1; +static gint ett_tlv_173 = -1; +static gint ett_tlv_174 = -1; +static gint ett_tlv_175 = -1; +static gint ett_tlv_176 = -1; +static gint ett_tlv_177 = -1; +static gint ett_tlv_178 = -1; +static gint ett_tlv_179 = -1; +static gint ett_tlv_180 = -1; +static gint ett_tlv_181 = -1; +static gint ett_tlv_182 = -1; +static gint ett_tlv_183 = -1; +static gint ett_tlv_184 = -1; +static gint ett_tlv_185 = -1; +static gint ett_tlv_186 = -1; +static gint ett_tlv_187 = -1; +static gint ett_tlv_188 = -1; +static gint ett_tlv_189 = -1; +static gint ett_tlv_190 = -1; +static gint ett_tlv_191 = -1; +static gint ett_tlv_192 = -1; +static gint ett_tlv_193 = -1; +static gint ett_tlv_194 = -1; +static gint ett_tlv_195 = -1; +static gint ett_tlv_196 = -1; +static gint ett_tlv_197 = -1; +static gint ett_tlv_198 = -1; +static gint ett_tlv_199 = -1; +static gint ett_tlv_200 = -1; +static gint ett_tlv_201 = -1; +static gint ett_tlv_202 = -1; +static gint ett_tlv_203 = -1; +static gint ett_tlv_204 = -1; +static gint ett_tlv_205 = -1; +static gint ett_tlv_206 = -1; +static gint ett_tlv_207 = -1; +static gint ett_tlv_208 = -1; +static gint ett_tlv_209 = -1; +static gint ett_tlv_210 = -1; +static gint ett_tlv_211 = -1; +static gint ett_tlv_212 = -1; +static gint ett_tlv_213 = -1; +static gint ett_tlv_214 = -1; +static gint ett_tlv_215 = -1; +static gint ett_tlv_216 = -1; +static gint ett_tlv_217 = -1; +static gint ett_tlv_218 = -1; +static gint ett_tlv_219 = -1; +static gint ett_tlv_220 = -1; +static gint ett_tlv_221 = -1; +static gint ett_tlv_222 = -1; +static gint ett_tlv_223 = -1; +static gint ett_tlv_224 = -1; +static gint ett_tlv_225 = -1; +static gint ett_tlv_226 = -1; +static gint ett_tlv_227 = -1; +static gint ett_tlv_228 = -1; +static gint ett_tlv_229 = -1; +static gint ett_tlv_230 = -1; +static gint ett_tlv_231 = -1; +static gint ett_tlv_232 = -1; +static gint ett_tlv_233 = -1; +static gint ett_tlv_234 = -1; +static gint ett_tlv_235 = -1; +static gint ett_tlv_236 = -1; +static gint ett_tlv_237 = -1; +static gint ett_tlv_238 = -1; +static gint ett_tlv_239 = -1; +static gint ett_tlv_240 = -1; +static gint ett_tlv_241 = -1; +static gint ett_tlv_242 = -1; +static gint ett_tlv_243 = -1; +static gint ett_tlv_244 = -1; +static gint ett_tlv_245 = -1; +static gint ett_tlv_246 = -1; +static gint ett_tlv_247 = -1; +static gint ett_tlv_248 = -1; +static gint ett_tlv_249 = -1; +static gint ett_tlv_250 = -1; +static gint ett_tlv_251 = -1; +static gint ett_tlv_252 = -1; +static gint ett_tlv_253 = -1; +static gint ett_tlv_254 = -1; +static gint ett_tlv_255 = -1; + +/* Global TLV array to retrieve unique subtree identifiers */ +/* Note: ett_tlv_0 is a placeholder so the TLV number will + correlate directly with the index number */ +gint *ett_tlv[] = +{ + &ett_tlv_0, + &ett_tlv_1, + &ett_tlv_2, + &ett_tlv_3, + &ett_tlv_4, + &ett_tlv_5, + &ett_tlv_6, + &ett_tlv_7, + &ett_tlv_8, + &ett_tlv_9, + &ett_tlv_10, + &ett_tlv_11, + &ett_tlv_12, + &ett_tlv_13, + &ett_tlv_14, + &ett_tlv_15, + &ett_tlv_16, + &ett_tlv_17, + &ett_tlv_18, + &ett_tlv_19, + &ett_tlv_20, + &ett_tlv_21, + &ett_tlv_22, + &ett_tlv_23, + &ett_tlv_24, + &ett_tlv_25, + &ett_tlv_26, + &ett_tlv_27, + &ett_tlv_28, + &ett_tlv_29, + &ett_tlv_30, + &ett_tlv_31, + &ett_tlv_32, + &ett_tlv_33, + &ett_tlv_34, + &ett_tlv_35, + &ett_tlv_36, + &ett_tlv_37, + &ett_tlv_38, + &ett_tlv_39, + &ett_tlv_40, + &ett_tlv_41, + &ett_tlv_42, + &ett_tlv_43, + &ett_tlv_44, + &ett_tlv_45, + &ett_tlv_46, + &ett_tlv_47, + &ett_tlv_48, + &ett_tlv_49, + &ett_tlv_50, + &ett_tlv_51, + &ett_tlv_52, + &ett_tlv_53, + &ett_tlv_54, + &ett_tlv_55, + &ett_tlv_56, + &ett_tlv_57, + &ett_tlv_58, + &ett_tlv_59, + &ett_tlv_60, + &ett_tlv_61, + &ett_tlv_62, + &ett_tlv_63, + &ett_tlv_64, + &ett_tlv_65, + &ett_tlv_66, + &ett_tlv_67, + &ett_tlv_68, + &ett_tlv_69, + &ett_tlv_70, + &ett_tlv_71, + &ett_tlv_72, + &ett_tlv_73, + &ett_tlv_74, + &ett_tlv_75, + &ett_tlv_76, + &ett_tlv_77, + &ett_tlv_78, + &ett_tlv_79, + &ett_tlv_80, + &ett_tlv_81, + &ett_tlv_82, + &ett_tlv_83, + &ett_tlv_84, + &ett_tlv_85, + &ett_tlv_86, + &ett_tlv_87, + &ett_tlv_88, + &ett_tlv_89, + &ett_tlv_90, + &ett_tlv_91, + &ett_tlv_92, + &ett_tlv_93, + &ett_tlv_94, + &ett_tlv_95, + &ett_tlv_96, + &ett_tlv_97, + &ett_tlv_98, + &ett_tlv_99, + &ett_tlv_100, + &ett_tlv_101, + &ett_tlv_102, + &ett_tlv_103, + &ett_tlv_104, + &ett_tlv_105, + &ett_tlv_106, + &ett_tlv_107, + &ett_tlv_108, + &ett_tlv_109, + &ett_tlv_110, + &ett_tlv_111, + &ett_tlv_112, + &ett_tlv_113, + &ett_tlv_114, + &ett_tlv_115, + &ett_tlv_116, + &ett_tlv_117, + &ett_tlv_118, + &ett_tlv_119, + &ett_tlv_120, + &ett_tlv_121, + &ett_tlv_122, + &ett_tlv_123, + &ett_tlv_124, + &ett_tlv_125, + &ett_tlv_126, + &ett_tlv_127, + &ett_tlv_128, + &ett_tlv_129, + &ett_tlv_130, + &ett_tlv_131, + &ett_tlv_132, + &ett_tlv_133, + &ett_tlv_134, + &ett_tlv_135, + &ett_tlv_136, + &ett_tlv_137, + &ett_tlv_138, + &ett_tlv_139, + &ett_tlv_140, + &ett_tlv_141, + &ett_tlv_142, + &ett_tlv_143, + &ett_tlv_144, + &ett_tlv_145, + &ett_tlv_146, + &ett_tlv_147, + &ett_tlv_148, + &ett_tlv_149, + &ett_tlv_150, + &ett_tlv_151, + &ett_tlv_152, + &ett_tlv_153, + &ett_tlv_154, + &ett_tlv_155, + &ett_tlv_156, + &ett_tlv_157, + &ett_tlv_158, + &ett_tlv_159, + &ett_tlv_160, + &ett_tlv_161, + &ett_tlv_162, + &ett_tlv_163, + &ett_tlv_164, + &ett_tlv_165, + &ett_tlv_166, + &ett_tlv_167, + &ett_tlv_168, + &ett_tlv_169, + &ett_tlv_170, + &ett_tlv_171, + &ett_tlv_172, + &ett_tlv_173, + &ett_tlv_174, + &ett_tlv_175, + &ett_tlv_176, + &ett_tlv_177, + &ett_tlv_178, + &ett_tlv_179, + &ett_tlv_180, + &ett_tlv_181, + &ett_tlv_182, + &ett_tlv_183, + &ett_tlv_184, + &ett_tlv_185, + &ett_tlv_186, + &ett_tlv_187, + &ett_tlv_188, + &ett_tlv_189, + &ett_tlv_190, + &ett_tlv_191, + &ett_tlv_192, + &ett_tlv_193, + &ett_tlv_194, + &ett_tlv_195, + &ett_tlv_196, + &ett_tlv_197, + &ett_tlv_198, + &ett_tlv_199, + &ett_tlv_200, + &ett_tlv_201, + &ett_tlv_202, + &ett_tlv_203, + &ett_tlv_204, + &ett_tlv_205, + &ett_tlv_206, + &ett_tlv_207, + &ett_tlv_208, + &ett_tlv_209, + &ett_tlv_210, + &ett_tlv_211, + &ett_tlv_212, + &ett_tlv_213, + &ett_tlv_214, + &ett_tlv_215, + &ett_tlv_216, + &ett_tlv_217, + &ett_tlv_218, + &ett_tlv_219, + &ett_tlv_220, + &ett_tlv_221, + &ett_tlv_222, + &ett_tlv_223, + &ett_tlv_224, + &ett_tlv_225, + &ett_tlv_226, + &ett_tlv_227, + &ett_tlv_228, + &ett_tlv_229, + &ett_tlv_230, + &ett_tlv_231, + &ett_tlv_232, + &ett_tlv_233, + &ett_tlv_234, + &ett_tlv_235, + &ett_tlv_236, + &ett_tlv_237, + &ett_tlv_238, + &ett_tlv_239, + &ett_tlv_240, + &ett_tlv_241, + &ett_tlv_242, + &ett_tlv_243, + &ett_tlv_244, + &ett_tlv_245, + &ett_tlv_246, + &ett_tlv_247, + &ett_tlv_248, + &ett_tlv_249, + &ett_tlv_250, + &ett_tlv_251, + &ett_tlv_252, + &ett_tlv_253, + &ett_tlv_254, + &ett_tlv_255 +}; + +/* Local Variables */ +static gint ett_wimax = -1; +static gint ett_wimax_tlv = -1; +static gint ett_wimax_fch = -1; +static gint ett_wimax_cdma = -1; +static gint ett_wimax_ffb = -1; + +static gchar *tlv_val_1byte = "TLV value: %s (0x%02x)"; +static gchar *tlv_val_2byte = "TLV value: %s (0x%04x)"; +static gchar *tlv_val_3byte = "TLV value: %s (0x%06x)"; +static gchar *tlv_val_4byte = "TLV value: %s (0x%08x)"; +static gchar *tlv_val_5byte = "TLV value: %s (0x%08x...)"; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax, + &ett_wimax_tlv, + &ett_wimax_fch, + &ett_wimax_cdma, + &ett_wimax_ffb, +}; + +/*************************************************************/ +/* add_tlv_subtree() */ +/* Return a pointer to a proto_tree that already contains */ +/* the type and length of a given TLV. */ +/* tree - the parent to which the new tree will */ +/* be attached */ +/* hfindex - the index of the item to be attached */ +/* tvb - a pointer to the packet data */ +/* start - offset within the packet */ +/* length - length of this item */ +/* little_endian - endian indicator */ +/* return: */ +/* pointer to a proto_tree */ +/*************************************************************/ +proto_tree *add_tlv_subtree(tlv_info_t *this, gint idx, proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, gboolean little_endian) +{ + /* Declare local variables */ + proto_tree *tlv_tree; + proto_item *tlv_item; + guint start_of_tlv; + gint tlv_value_length, tlv_val_offset; + guint8 size_of_tlv_length_field; + guint8 tlv_type; + guint32 tlv_value; + gchar *hex_fmt; + + UNREFERENCED_PARAMETER(length); + + /* Retrieve the necessary TLV information */ + tlv_val_offset = get_tlv_value_offset(this); + start_of_tlv = start - tlv_val_offset; + tlv_value_length = get_tlv_length(this); + size_of_tlv_length_field = get_tlv_size_of_length(this); + tlv_type = get_tlv_type(this); + + /* display the TLV name and display the value in hex. Highlight type, length, and value. */ + tlv_item = proto_tree_add_item(tree, hfindex, tvb, start, tlv_value_length, little_endian); + /* Correct the highlighting. */ + tlv_item->finfo->start -= tlv_val_offset; + tlv_item->finfo->length += tlv_val_offset; + /* add TLV subtree to contain the type, length, and value */ + tlv_tree = proto_item_add_subtree(tlv_item, *ett_tlv[tlv_type]); + /* display the TLV type */ + proto_tree_add_text(tlv_tree, tvb, start_of_tlv, 1, "TLV type: %u", tlv_type); + /* check if this is an extended TLV */ + if (size_of_tlv_length_field > 0) /* It is */ + { + /* display the length of the length field TLV */ + proto_tree_add_text(tlv_tree, tvb, start_of_tlv+1, 1, "Size of TLV length field: %u", size_of_tlv_length_field); + /* display the TLV length */ + proto_tree_add_text(tlv_tree, tvb, start_of_tlv+2, size_of_tlv_length_field, "TLV length: %u", tlv_value_length); + } else { /* It is not */ + /* display the TLV length */ + proto_tree_add_text(tlv_tree, tvb, start_of_tlv+1, 1, "TLV length: %u", tlv_value_length); + } + /* display the TLV value and make it a subtree */ + switch (tlv_value_length) + { + case 1: + tlv_value = tvb_get_guint8(tvb, start); + hex_fmt = tlv_val_1byte; + break; + case 2: + tlv_value = tvb_get_ntohs(tvb, start); + hex_fmt = tlv_val_2byte; + break; + case 3: + tlv_value = tvb_get_ntoh24(tvb, start); + hex_fmt = tlv_val_3byte; + break; + case 4: + tlv_value = tvb_get_ntohl(tvb, start); + hex_fmt = tlv_val_4byte; + break; + default: + tlv_value = tvb_get_ntohl(tvb, start); + hex_fmt = tlv_val_5byte; + break; + } + /* Show "TLV value: " */ + tlv_item = proto_tree_add_text(tlv_tree, tvb, start, tlv_value_length, hex_fmt, tlv_item->finfo->hfinfo->name, tlv_value); + tlv_tree = proto_item_add_subtree(tlv_item, idx); + + /* Return a pointer to the value level */ + return tlv_tree; +} + +/*************************************************************/ +/* add_protocol_subtree() */ +/* Return a pointer to a proto_tree that already contains */ +/* the type and length of a given TLV. */ +/* tree - the parent to which the new tree will */ +/* be attached */ +/* hfindex - the index of the item to be attached */ +/* tvb - a pointer to the packet data */ +/* start - offset within the packet */ +/* length - length of this item */ +/* format - printf style formatting string */ +/* ... - arguments to format */ +/* return: */ +/* pointer to a proto_tree */ +/*************************************************************/ +proto_tree *add_protocol_subtree(tlv_info_t *this, gint idx, proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, const char *format, ...) +{ + /* Declare local variables */ + proto_tree *tlv_tree; + proto_item *tlv_item; + guint start_of_tlv; + gint tlv_value_length, tlv_val_offset; + guint8 size_of_tlv_length_field; + guint8 tlv_type; + guint32 tlv_value; + va_list ap; /* points to each unnamed arg in turn */ + gchar *message = NULL; + gchar *hex_fmt; + + /* Retrieve the necessary TLV information */ + tlv_val_offset = get_tlv_value_offset(this); + start_of_tlv = start - tlv_val_offset; + tlv_value_length = get_tlv_length(this); + size_of_tlv_length_field = get_tlv_size_of_length(this); + tlv_type = get_tlv_type(this); + + /* display the TLV name and display the value in hex. Highlight type, length, and value. */ + if( (message = se_alloc_array(gchar, 255)) ){ + va_start(ap, format); + vsprintf(message, format, ap); + va_end(ap); + } else { + message = "Memory error"; + } + tlv_item = proto_tree_add_protocol_format(tree, hfindex, tvb, start, length, "%s", message); + /* Correct the highlighting. */ + tlv_item->finfo->start -= tlv_val_offset; + tlv_item->finfo->length += tlv_val_offset; + /* add TLV subtree to contain the type, length, and value */ + tlv_tree = proto_item_add_subtree(tlv_item, *ett_tlv[tlv_type]); + /* display the TLV type */ + proto_tree_add_text(tlv_tree, tvb, start_of_tlv, 1, "TLV type: %u", tlv_type); + /* check if this is an extended TLV */ + if (size_of_tlv_length_field > 0) /* It is */ + { + /* display the length of the length field TLV */ + proto_tree_add_text(tlv_tree, tvb, start_of_tlv+1, 1, "Size of TLV length field: %u", size_of_tlv_length_field); + /* display the TLV length */ + proto_tree_add_text(tlv_tree, tvb, start_of_tlv+2, size_of_tlv_length_field, "TLV length: %u", tlv_value_length); + } else { /* It is not */ + /* display the TLV length */ + proto_tree_add_text(tlv_tree, tvb, start_of_tlv+1, 1, "TLV length: %u", tlv_value_length); + } + /* display the TLV value and make it a subtree */ + switch (tlv_value_length) + { + case 1: + tlv_value = tvb_get_guint8(tvb, start); + hex_fmt = tlv_val_1byte; + break; + case 2: + tlv_value = tvb_get_ntohs(tvb, start); + hex_fmt = tlv_val_2byte; + break; + case 3: + tlv_value = tvb_get_ntoh24(tvb, start); + hex_fmt = tlv_val_3byte; + break; + case 4: + tlv_value = tvb_get_ntohl(tvb, start); + hex_fmt = tlv_val_4byte; + break; + default: + tlv_value = tvb_get_ntohl(tvb, start); + hex_fmt = tlv_val_5byte; + break; + } + /* Show "TLV value: " */ + tlv_item = proto_tree_add_text(tlv_tree, tvb, start, length, hex_fmt, message, tlv_value); + tlv_tree = proto_item_add_subtree(tlv_item, idx); + + /* Return a pointer to the value level */ + return tlv_tree; +} + + +#ifndef ENABLE_STATIC +/* for plugins only */ +G_MODULE_EXPORT void plugin_register(void) +{ + /* register the new protocol, protocol fields, and subtrees */ + if (proto_wimax == -1) + { /* execute protocol initialization only once */ + proto_register_wimax(); + } +} + +G_MODULE_EXPORT void plugin_reg_handoff(void) +{ + proto_reg_wimax(); +} +#endif + +/* Register Wimax Protocol */ +void proto_register_wimax(void) +{ + module_t *wimax_module; + + if (proto_wimax == -1) + { + /* Register the WiMax protocols here */ + proto_wimax = proto_register_protocol ( + "WiMax Protocol", /* name */ + "WiMax (wmx)", /* short name */ + "wmx" /* abbrev */ + ); + /* Register the WiMax protocol subtree array */ + proto_register_subtree_array(ett, array_length(ett)); + /* Register the WiMax dissector */ + register_dissector("wmx", dissect_wimax, proto_wimax); + + /* Register other WiMax dissectors */ + proto_register_wimax_cdma(); + proto_register_wimax_fch(); + proto_register_wimax_pdu(); + proto_register_wimax_ffb(); + proto_register_wimax_hack(); + proto_register_wimax_harq_map(); + proto_register_wimax_phy_attributes(); + proto_register_wimax_compact_dlmap_ie(); + proto_register_wimax_compact_ulmap_ie(); + + wimax_module = prefs_register_protocol(proto_wimax, proto_reg_handoff_wimax); + + prefs_register_uint_preference(wimax_module, "wimax.basic_cid_max", + "Maximum Basic CID", + "Set the maximum Basic CID" + " used in the Wimax decoder" + " (if other than the default of 320)." + " Note: The maximum Primary CID is" + " double the maximum Basic CID.", + 10, &global_cid_max_basic); + + prefs_register_bool_preference(wimax_module, "wimax.corrigendum_2_version", + "Corrigendum 2 Version", + "Set to TRUE to use the Corrigendum" + " 2 version of Wimax message decoding." + " Set to FALSE to use the 802.16e-2005" + " version.", + &include_cor2_changes); + + register_dissector_table("wimax.max_basic_cid", "Max Basic CID", FT_UINT16, BASE_DEC); + register_dissector_table("wimax.corrigendum_2_version", "Corrigendum 2 Version", FT_UINT16, BASE_DEC); + proto_register_subtree_array(ett_tlv, array_length(ett_tlv)); + } +} + +/* Register Wimax Protocol handler */ +void proto_reg_wimax(void) +{ + if (find_dissector("wmx") == NULL) + { + /* Register the WiMax dissector */ + register_dissector("wimax_dissector", dissect_wimax, proto_wimax); + } +} + +/* WiMax protocol dissector */ +static void dissect_wimax(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + UNREFERENCED_PARAMETER(tvb); + UNREFERENCED_PARAMETER(tree); + + /* display the WiMax protocol name */ + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + { + col_set_str(pinfo->cinfo, COL_PROTOCOL, "WiMax"); + } + /* Clear out stuff in the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_clear(pinfo->cinfo, COL_INFO); + } +} + +gboolean is_down_link(address *src_address) +{ + if(bs_address.len && !CMP_ADDRESS(&bs_address, src_address)) + return TRUE; + + return FALSE; +} + +/* The registration hand-off routine for the max_basic_cid pref */ +void +proto_reg_handoff_wimax(void) +{ + static int wimax_prefs_initialized = FALSE; + static dissector_handle_t wimax_handle; + + if(!wimax_prefs_initialized) + { + wimax_handle = create_dissector_handle(dissect_wimax, proto_wimax); + wimax_prefs_initialized = TRUE; + } else { + dissector_delete("wimax.max_basic_cid", global_cid_max_basic, wimax_handle); + dissector_delete("wimax.corrigendum_2_version", include_cor2_changes, wimax_handle); + + } + + dissector_add("wimax.max_basic_cid", global_cid_max_basic, wimax_handle); + dissector_add("wimax.corrigendum_2_version", include_cor2_changes, wimax_handle); +} + diff --git a/plugins/wimax/wimax_bits.h b/plugins/wimax/wimax_bits.h new file mode 100644 index 0000000000..f38897a860 --- /dev/null +++ b/plugins/wimax/wimax_bits.h @@ -0,0 +1,237 @@ +/* wimax_bits.h + * WiMax MAC Management UL-MAP Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Mike Harvey <michael.harvey@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __wimax_bits_h__ +#define __wimax_bits_h__ + +/******************************************************************** + * Functions for working with nibbles and bits + */ + +#define AS16(x) g_htons(*((guint16*)(x))) +#define AS32(x) g_htonl(*((guint32*)(x))) + +/* SWAR functions */ +#define _BITS(n,hi,lo) (((n)>>(lo))&((1<<(((hi)-(lo))+1))-1)) +#define _ADD_SWAP(x,y) { (x) = (x) + (y); (y) = (x) - (y); (x) = (x) - (y); } +#define _XOR_SWAP(x,y) { (x) ^= (y); (y) ^= (x); (x) ^= (y); } +#define _SWAP(x,y) do { int t = (x); (x) = (y); (y) = t; } while(0) + + +/******************************************************************** + * Functions for working with nibbles + * + */ + +#define NIBBLE_MASK 0x0F +#define BYTE_MASK 0xFF + +/* extract the nibble at the given nibble address 'n' of buffer 'b' */ +#define NIB_NIBBLE(n,b) \ + (((n) & 1) \ + ? (b)[(n)/2] & NIBBLE_MASK \ + : ((b)[(n)/2] >> 4) & NIBBLE_MASK) + +/* extract the byte at the given nibble address 'n' of buffer 'b' */ +#define NIB_BYTE(n,b) \ + (n) & 1 \ + ? (g_ntohs( *(guint16 *)((b)+(n)/2) ) >> 4) & BYTE_MASK \ + : (b)[(n)/2] + /* + ? (AS16((b)+(n)/2) >> 4) & BYTE_MASK \ + */ + +/* extract 12 bits at the given nibble address */ +#define NIB_BITS12(n,b) \ + (NIB_NIBBLE(n,b+1) | (NIB_BYTE(n,b) << 4)) + +#define AS16(x) g_htons(*((guint16*)(x))) +#define AS32(x) g_htonl(*((guint32*)(x))) + +/* extract the word at the given nibble address 'n' of buffer 'b' */ +#define NIB_WORD(n,b) \ + (n) & 1 \ + ? (g_ntohl(*(guint32 *)((b) + (n)/2)) >> 12) & 0x0000FFFF \ + : g_ntohs(*(guint16 *)((b) + (n)/2)) + /* + : AS16((b) + (n)/2) + ? (AS32((b)+(n)/2) >> 12) & 0x0000FFFF \ + */ + +/* extract the word at the given nibble address 'n' of buffer 'b' */ +#define NIB_LONG(n,b) \ + (n) & 1 \ + ? (g_ntohl(*(guint32 *)((b) + (n)/2)) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \ + : g_ntohl(*(guint32 *)((b) + (n)/2)) + /* + ? (AS32((b) + (n)/2) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \ + : AS32((b) + (n)/2) + */ + +#define NIB_NIBS(nib, buf, num) \ + ((num) == 1 ? NIB_NIBBLE(nib,buf) : \ + ((num) == 2 ? NIB_BYTE(nib,buf) : \ + ((num) == 3 ? NIB_BITS12(nib,buf) : \ + ((num) == 4 ? NIB_WORD(nib,buf) : \ + NIB_LONG(nib,buf) )))) + + +/* to highlight nibfields correctly in wireshark + * AddItem(..., WSADDR(buf,bit), WSLEN(bit), ...) */ + +/* determine starting byte to highlight a series of nibbles */ +#define NIB_ADDR(nib) ((nib)/2) +/* determine number of bytes to highlight a series of nibbles */ +#define NIB_LEN(nib,len) ((1 + ((nib) &1) + (len))/2) + +#define NIBHI(nib,len) NIB_ADDR(nib),NIB_LEN(nib,len) + +/******************************************************************** + * bitfield functions - for extracting bitfields from a buffer + * + * TODO: 64 bit functions use two 32-bit values; + * would be better to use 32+8 bits to avoid overrunning buffers + * + */ + +/* find the byte-address for the bitfield */ +#define ADDR(bit) ((bit) / 8) +#define ADDR16(bit) ((bit) / 8) +#define ADDR32(bit) ((bit) / 8) + +/* find the offset (from the MSB) to the start of the bitfield */ +#define OFFSET(bit) ((bit) % 8) +#define OFFSET16(bit) ((bit) % 8) +#define OFFSET32(bit) ((bit) % 8) + +/* find the number of bits to shift right (SHIFT64 is upper dword) */ +#define SHIFT(bit,num) ( 8 - ((bit)%8) - (num)) +#define SHIFT16(bit,num) (16 - ((bit)%8) - (num)) +#define SHIFT32(bit,num) (32 - ((bit)%8) - (num)) +#define SHIFT64a(bit,num) (num - (32 - OFFSET32(bit))) +#define SHIFT64b(bit,num) (32 - ((num) - (32 - OFFSET32(bit)))) + +/* create a mask to mask off the bitfield */ +#define MASK8(num) (0xFF >> (8 - (num))) +#define MASK16(num) (0xFFFF >> (16 - (num))) +#define MASK32(num) (0xFFFFFFFF >> (32 - (num))) +#define MASK64a(bit) (MASK32(32 - OFFSET32(bit))) +#define MASK64b(bit,num) (MASK32(num - (32 - OFFSET32(bit)))) + +/* note that if you have a bitfield of length 2 or more, it may cross a + * byte boundary so you should use BIT_BITS16 */ + +/* extract a single bit + * bit ... bit address + * buf ... buffer + */ +#define BIT_BIT(bit, buf) \ + (( (buf)[ADDR(bit)] >> SHIFT(bit,1) ) & 0x1) + +/* extract bitfield up to 9 bits + * bit ... bit address + * buf ... buffer + * num ... length of bitfield + */ +#define BIT_BITS16(bit, buf, num) \ + (( AS16(buf+ADDR16(bit)) >> SHIFT16(bit,num) ) & MASK16(num)) + +/* extract bitfield up to 24 bits + * bit ... bit address + * buf ... buffer + * num ... length of bitfield + */ + +#define BIT_BITS32(bit, buf, num) \ + ((AS32(buf+ADDR32(bit)) >> SHIFT32(bit,num) ) & MASK32(num)) + +/* bitfield up to 32 bits */ +#define BIT_BITS64a(bit, buf, num) \ + ((AS32(buf+ADDR32(bit)) & MASK64a(bit)) << SHIFT64a(bit,num)) + +#define BIT_BITS64b(bit, buf, num) \ + ((AS32(buf+ADDR32(bit)+4) >> SHIFT64b(bit,num) ) & MASK64b(bit,num)) + +#define BIT_BITS64(bit, buf, num) \ + ( (OFFSET32(bit)+(num)) <= 32 \ + ? BIT_BITS32(bit,buf,num) \ + : BIT_BITS64a(bit,buf,num) \ + | BIT_BITS64b(bit,buf,num) ) + +#define BIT_BITS(bit, buf, num) \ + ((num) == 1 ? BIT_BIT(bit,buf) : \ + ((num) <= 9 ? BIT_BITS16(bit,buf,num) : \ + ((num) <= 24 ? BIT_BITS32(bit,buf,num) : \ + ((num) <= 32 ? BIT_BITS64(bit,buf,num) : \ + 0 )))) + +/* to highlight bitfields correctly in wireshark + * AddItem(..., WSADDR(buf,bit), WSLEN(bit), ...) */ + +/* determine starting byte to highlight a series of nibbles */ +#define BIT_ADDR(bit) (ADDR(bit)) +/* determine number of bytes to highlight */ +#define BIT_LEN(bit,len) (1 + ((OFFSET(bit) + len - 1) / 8)) + +#define BITHI(bit,len) BIT_ADDR(bit),BIT_LEN(bit,len) + +/* CONVENIENCE FUNCTIONS */ + +#define BIT_NIBBLE(bit,buf) BIT_BITS16(bit,buf,4) +#define BIT_BYTE(bit,buf) BIT_BITS16(bit,buf,8) +#define BIT_WORD(bit,buf) BIT_BITS32(bit,buf,16) +#define BIT_WORD24(bit,buf) BIT_BITS32(bit,buf,24) +#define BIT_LONG(bit,buf) BIT_BITS64(bit,buf,32) + +/******************************************************************** + * padding functions - return number of nibbles/bits needed to + * pad to a byte boundary */ + +#define BIT_PADDING(bit, bits) ((bit) % (bits)) ? ((bits) - ((bit) % (bits))) : 0 +#define NIB_PADDING(nib) ((nib) & 0x1) + +/******************************************************************** + * conversion functions - between bytes, nibbles, and bits */ + +#define BYTE_TO_BIT(n) ((n) * 8) +#define BYTE_TO_NIB(n) ((n) * 2) + +#define BIT_TO_BYTE(n) ((n) / 8) +#define BIT_TO_NIB(n) ((n) / 4) + +#define NIB_TO_BYTE(n) ((n) / 2) +#define NIB_TO_BIT(n) ((n) * 4) + + + +#ifndef UNREFERENCED_PARAMETER +#define UNREFERENCED_PARAMETER(x) (x) = (x) +#endif + +#endif + diff --git a/plugins/wimax/wimax_cdma_code_decoder.c b/plugins/wimax/wimax_cdma_code_decoder.c new file mode 100644 index 0000000000..6f49bb6688 --- /dev/null +++ b/plugins/wimax/wimax_cdma_code_decoder.c @@ -0,0 +1,128 @@ +/* wimax_cdma_code_decoder.c + * WiMax CDMA CODE Attribute decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> + +extern gint proto_wimax; + +/* forward reference */ +void proto_register_wimax_cdma(void); +static void dissect_wimax_cdma_code_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static int proto_wimax_cdma_code_decoder = -1; +static gint ett_wimax_cdma_code_decoder = -1; + +static int hf_wimax_ranging_code = -1; +static int hf_wimax_ranging_symbol_offset = -1; +static int hf_wimax_ranging_subchannel_offset = -1; + +/* TLV display */ +static hf_register_info hf[] = +{ + { + &hf_wimax_ranging_code, + { + "Ranging Code", "wimax.cdma.ranging_code", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_wimax_ranging_symbol_offset, + { + "Ranging Symbol Offset", "wimax.cdma.ranging_symbol_offset", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_wimax_ranging_subchannel_offset, + { + "Ranging Sub-Channel Offset", "wimax.cdma.ranging_subchannel_offset", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + } +}; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_cdma_code_decoder, +}; + +/* Register Wimax CDMA Protocol */ +void proto_register_wimax_cdma(void) +{ + if (proto_wimax_cdma_code_decoder == -1) + { + proto_wimax_cdma_code_decoder = proto_wimax; + + /* register the field display messages */ + proto_register_field_array(proto_wimax_cdma_code_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } + register_dissector("wimax_cdma_code_burst_handler", dissect_wimax_cdma_code_decoder, -1); +} + +static void dissect_wimax_cdma_code_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + gint offset = 0; + guint length; + proto_item *cdma_item = NULL; + proto_tree *cdma_tree = NULL; + + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "CDMA Code Attribute"); + } + if (tree) + { /* we are being asked for details */ + /* get the tvb length */ + length = tvb_length(tvb); + /* display CDMA dissector info */ + cdma_item = proto_tree_add_protocol_format(tree, proto_wimax_cdma_code_decoder, tvb, offset, length, "CDMA Code Attribute (%u bytes)", length); + /* add CDMA Code subtree */ + cdma_tree = proto_item_add_subtree(cdma_item, ett_wimax_cdma_code_decoder); + /* display the first CDMA Code */ + proto_tree_add_item(cdma_tree, hf_wimax_ranging_code, tvb, offset, 1, FALSE); + /* display the 2nd CDMA Code */ + proto_tree_add_item(cdma_tree, hf_wimax_ranging_symbol_offset, tvb, offset+1, 1, FALSE); + /* display the 3rd CDMA Code */ + proto_tree_add_item(cdma_tree, hf_wimax_ranging_subchannel_offset, tvb, offset+2, 1, FALSE); + } +} diff --git a/plugins/wimax/wimax_compact_dlmap_ie_decoder.c b/plugins/wimax/wimax_compact_dlmap_ie_decoder.c new file mode 100644 index 0000000000..769eb971cb --- /dev/null +++ b/plugins/wimax/wimax_compact_dlmap_ie_decoder.c @@ -0,0 +1,2142 @@ +/* wimax_compact_dlmap_ie_decoder.c + * WiMax HARQ Map Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" +#include "wimax_tlv.h" + +extern gint proto_wimax; + +/* MASKs */ +#define MSB_NIBBLE_MASK 0xF0 +#define LSB_NIBBLE_MASK 0x0F + +#define CID_TYPE_NORMAL 0 +#define CID_TYPE_RCID11 1 +#define CID_TYPE_RCID7 2 +#define CID_TYPE_RCID3 3 + +/* Global Variables */ +guint cid_type = 0; +guint band_amc_subchannel_type = 0; +guint max_logical_bands = 12; +guint num_of_broadcast_symbols = 0; +guint num_of_dl_band_amc_symbols = 0; +guint num_of_ul_band_amc_symbols = 0; +/* from switch HARQ mode extension IE */ +guint harq_mode = 0; + +/* forward reference */ +static guint wimax_compact_dlmap_format_configuration_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +static guint wimax_compact_dlmap_rcid_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +static guint wimax_compact_dlmap_harq_control_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +static guint wimax_compact_dlmap_cqich_control_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +static guint wimax_cdlmap_extension_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +guint wimax_extended_diuc_dependent_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); + +static gint proto_wimax_compact_dlmap_ie_decoder = -1; +static gint ett_wimax_compact_dlmap_ie_decoder = -1; +static gint ett_wimax_format_configuration_ie_decoder = -1; +static gint ett_wimax_rcid_ie_decoder = -1; +static gint ett_wimax_harq_control_ie_decoder = -1; +static gint ett_wimax_extended_diuc_dependent_ie_decoder = -1; +static gint ett_wimax_cqich_control_ie_decoder = -1; +static gint ett_wimax_extension_type_ie_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_compact_dlmap_ie_decoder, + &ett_wimax_format_configuration_ie_decoder, + &ett_wimax_rcid_ie_decoder, + &ett_wimax_harq_control_ie_decoder, + &ett_wimax_extended_diuc_dependent_ie_decoder, + &ett_wimax_cqich_control_ie_decoder, + &ett_wimax_extension_type_ie_decoder, +}; + +/* New Format Indications */ +static const true_false_string tfs_indication = +{ + "New format", + "No new format" +}; + +/* Prefixes */ +static const true_false_string tfs_prefix = +{ + "Enable HARQ", + "Temporary Disable HARQ" +}; + +/* CQICH Indicator */ +static const true_false_string tfs_cqich_ind = +{ + "With CQICH Control IE", + "No CQICH Control IE" +}; + +/* CID types */ +static const value_string vals_cid_types[] = +{ + { 0, "Normal CID" }, + { 1, "RCID11 (default)" }, + { 2, "RCID7" }, + { 3, "RCID3" }, + { 0, NULL } +}; + +/* Subchannel Types */ +static const value_string vals_subchannel_types[] = +{ + { 0, "Default Type" }, + { 1, "1 bin x 6 symbols Type" }, + { 2, "2 bin x 3 symbols Type" }, + { 3, "3 bin x 2 symbols Type" }, + { 0, NULL } +}; + +/* Max Logical Bands */ +static const value_string vals_max_logical_bands[] = +{ + { 0, "3 Bands" }, + { 1, "6 Bands" }, + { 2, "12 Bands (default)" }, + { 3, "24 Bands" }, + { 0, NULL } +}; + +/* Repetition Coding Indications */ +static const value_string rep_msgs[] = +{ + { 0, "No Repetition Coding" }, + { 1, "Repetition Coding of 2 Used" }, + { 2, "Repetition Coding of 4 Used" }, + { 3, "Repetition Coding of 6 Used" }, + { 0, NULL } +}; + +/* Repetition Coding Indications */ +static const value_string vals_allocation_modes[] = +{ + { 0, "Same Number Of Subchannels For The Selected Bands" }, + { 1, "Different Same Number Of Subchannels For The Selected Bands" }, + { 2, "Total Number Of Subchannels For The Selected Bands Determined by Nsch Code and Nep Code" }, + { 3, "Reserved" }, + { 0, NULL } +}; + +/* Masks */ +#define DL_MAP_TYPE_MASK 0xE0 +#define UL_MAP_APPEND_MASK 0x10 +#define SHORTENED_DIUC_MASK 0xE0 +#define COMPANDED_SC_MASK 0x1F +#define DL_MAP_TYPE_MASK_1 0x0E +#define UL_MAP_APPEND_MASK_1 0x01 +#define SHORTENED_DIUC_MASK_1 0x0E00 +#define COMPANDED_SC_MASK_1 0x01F0 + +/* display indexies */ +static gint hf_cdlmap_dl_map_type = -1; +static gint hf_cdlmap_ul_map_append = -1; +static gint hf_cdlmap_reserved = -1; +static gint hf_cdlmap_nep_code = -1; +static gint hf_cdlmap_nsch_code = -1; +static gint hf_cdlmap_num_bands = -1; +static gint hf_cdlmap_band_index = -1; +static gint hf_cdlmap_nb_bitmap = -1; +static gint hf_cdlmap_dl_map_type_1 = -1; +static gint hf_cdlmap_ul_map_append_1 = -1; +static gint hf_cdlmap_reserved_1 = -1; +static gint hf_cdlmap_nep_code_1 = -1; +static gint hf_cdlmap_nsch_code_1 = -1; +static gint hf_cdlmap_num_bands_1 = -1; +//static gint hf_cdlmap_band_index_1 = -1; +static gint hf_cdlmap_nb_bitmap_1 = -1; + +static gint hf_cdlmap_shortened_diuc = -1; +static gint hf_cdlmap_companded_sc = -1; +static gint hf_cdlmap_shortened_uiuc = -1; +static gint hf_cdlmap_shortened_diuc_1 = -1; +static gint hf_cdlmap_companded_sc_1 = -1; +static gint hf_cdlmap_shortened_uiuc_1 = -1; + +static gint hf_cdlmap_bin_offset = -1; +static gint hf_cdlmap_bin_offset_1 = -1; + +static gint hf_cdlmap_diuc_num_of_subchannels = -1; +static gint hf_cdlmap_diuc_num_of_subchannels_1 = -1; +static gint hf_cdlmap_diuc_repetition_coding_indication = -1; +static gint hf_cdlmap_diuc_repetition_coding_indication_1 = -1; +static gint hf_cdlmap_diuc_reserved = -1; +static gint hf_cdlmap_diuc_reserved_1 = -1; + +static gint hf_cdlmap_bit_map_length = -1; +static gint hf_cdlmap_bit_map_length_1 = -1; +static gint hf_cdlmap_bit_map = -1; + +static gint hf_cdlmap_diuc = -1; +static gint hf_cdlmap_diuc_1 = -1; + +static gint hf_cdlmap_allocation_mode = -1; +static gint hf_cdlmap_allocation_mode_rsvd = -1; +static gint hf_cdlmap_num_subchannels = -1; +static gint hf_cdlmap_allocation_mode_1 = -1; +static gint hf_cdlmap_allocation_mode_rsvd_1 = -1; +static gint hf_cdlmap_num_subchannels_1 = -1; + +static gint hf_cdlmap_reserved_type = -1; +static gint hf_cdlmap_reserved_type_1 = -1; + +/* Compact DL-MAP IE display */ +static hf_register_info hf_compact_dlmap[] = +{ + { + &hf_cdlmap_dl_map_type, + {"DL-MAP Type", "wimax.compact_dlmap.dl_map_type", FT_UINT8, BASE_DEC, NULL, DL_MAP_TYPE_MASK, "", HFILL} + }, + { + &hf_cdlmap_dl_map_type_1, + {"DL-MAP Type", "wimax.compact_dlmap.dl_map_type", FT_UINT8, BASE_DEC, NULL, DL_MAP_TYPE_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_ul_map_append, + {"UL-MAP Append", "wimax.compact_dlmap.ul_map_append", FT_UINT8, BASE_HEX, NULL, UL_MAP_APPEND_MASK, "", HFILL} + }, + { + &hf_cdlmap_ul_map_append_1, + {"UL-MAP Append", "wimax.compact_dlmap.ul_map_append", FT_UINT8, BASE_HEX, NULL, UL_MAP_APPEND_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_reserved, + {"Reserved", "wimax.compact_dlmap.reserved", FT_UINT8, BASE_HEX, NULL, UL_MAP_APPEND_MASK, "", HFILL} + }, + { + &hf_cdlmap_reserved_1, + {"Reserved", "wimax.compact_dlmap.reserved", FT_UINT8, BASE_HEX, NULL, UL_MAP_APPEND_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_nep_code, + {"Nep Code", "wimax.compact_dlmap.nep_code", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_nep_code_1, + {"Nep Code", "wimax.compact_dlmap.nep_code", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_nsch_code, + {"Nsch Code", "wimax.compact_dlmap.nsch_code", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_nsch_code_1, + {"Nsch Code", "wimax.compact_dlmap.nsch_code", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_num_bands, + {"Number Of Bands", "wimax.compact_dlmap.num_bands", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_num_bands_1, + {"Number Of Bands", "wimax.compact_dlmap.num_bands", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_band_index, + {"Band Index", "wimax.compact_dlmap.band_index", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#if 0 + { + &hf_cdlmap_band_index_1, + {"Band Index", "wimax.compact_dlmap.band_index", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { + &hf_cdlmap_nb_bitmap, + {"Number Of Bits For Band BITMAP", "wimax.compact_dlmap.nb_bitmap", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_nb_bitmap_1, + {"Number Of Bits For Band BITMAP", "wimax.compact_dlmap.nb_bitmap", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_shortened_uiuc, + {"Shortened UIUC", "wimax.compact_dlmap.shortened_uiuc", FT_UINT8, BASE_HEX, NULL, SHORTENED_DIUC_MASK, "", HFILL} + }, + { + &hf_cdlmap_shortened_uiuc_1, + {"Shortened UIUC", "wimax.compact_dlmap.shortened_uiuc", FT_UINT16, BASE_HEX, NULL, SHORTENED_DIUC_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_shortened_diuc, + {"Shortened DIUC", "wimax.compact_dlmap.shortened_diuc", FT_UINT8, BASE_HEX, NULL, SHORTENED_DIUC_MASK, "", HFILL} + }, + { + &hf_cdlmap_shortened_diuc_1, + {"Shortened DIUC", "wimax.compact_dlmap.shortened_diuc", FT_UINT16, BASE_HEX, NULL, SHORTENED_DIUC_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_companded_sc, + {"Companded SC", "wimax.compact_dlmap.companded_sc", FT_UINT8, BASE_HEX, NULL, COMPANDED_SC_MASK, "", HFILL} + }, + { + &hf_cdlmap_companded_sc_1, + {"Companded SC", "wimax.compact_dlmap.companded_sc", FT_UINT16, BASE_HEX, NULL, COMPANDED_SC_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_bin_offset, + {"BIN Offset", "wimax.compact_dlmap.bin_offset", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cdlmap_bin_offset_1, + {"BIN Offset", "wimax.compact_dlmap.bin_offset", FT_UINT16, BASE_HEX, NULL, 0x0FF0, "", HFILL} + }, + { + &hf_cdlmap_diuc_num_of_subchannels, + {"Number Of Subchannels", "wimax.compact_dlmap.diuc_num_of_subchannels", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_cdlmap_diuc_num_of_subchannels_1, + {"Number Of Subchannels", "wimax.compact_dlmap.diuc_num_of_subchannels", FT_UINT16, BASE_DEC, NULL, 0x0FF0, "", HFILL} + }, + { + &hf_cdlmap_diuc_repetition_coding_indication, + {"Repetition Coding Indication", "wimax.compact_dlmap.diuc_repetition_coding_indication", FT_UINT8, BASE_DEC, VALS(rep_msgs), 0xC0, "", HFILL} + }, + { + &hf_cdlmap_diuc_repetition_coding_indication_1, + {"Repetition Coding Indication", "wimax.compact_dlmap.diuc_repetition_coding_indication", FT_UINT8, BASE_DEC, VALS(rep_msgs), 0x0C, "", HFILL} + }, + { + &hf_cdlmap_diuc_reserved, + {"Reserved", "wimax.compact_dlmap.diuc_reserved", FT_UINT8, BASE_HEX, NULL, 0x30, "", HFILL} + }, + { + &hf_cdlmap_diuc_reserved_1, + {"Reserved", "wimax.compact_dlmap.diuc_reserved", FT_UINT8, BASE_HEX, NULL, 0x03, "", HFILL} + }, + { + &hf_cdlmap_bit_map_length, + {"BIT MAP Length", "wimax.compact_dlmap.bit_map_length", FT_UINT8, BASE_DEC, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_bit_map_length_1, + {"BIT MAP Length", "wimax.compact_dlmap.bit_map_length", FT_UINT8, BASE_DEC, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_bit_map, + {"BIT MAP", "wimax.compact_dlmap.bit_map", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cdlmap_diuc, + {"DIUC", "wimax.compact_dlmap.diuc", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_diuc_1, + {"DIUC", "wimax.compact_dlmap.diuc", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_allocation_mode, + {"Allocation Mode", "wimax.compact_dlmap.allocation_mode", FT_UINT8, BASE_DEC, VALS(vals_allocation_modes), 0xC0, "", HFILL} + }, + { + &hf_cdlmap_allocation_mode_1, + {"Allocation Mode", "wimax.compact_dlmap.allocation_mode", FT_UINT8, BASE_DEC, VALS(vals_allocation_modes), 0x0C, "", HFILL} + }, + { + &hf_cdlmap_allocation_mode_rsvd, + {"Reserved", "wimax.compact_dlmap.allocation_mode_rsvd", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL} + }, + { + &hf_cdlmap_allocation_mode_rsvd_1, + {"Reserved", "wimax.compact_dlmap.allocation_mode_rsvd", FT_UINT8, BASE_DEC, NULL, 0x03, "", HFILL} + }, + { + &hf_cdlmap_num_subchannels, + {"Number Of Subchannels", "wimax.compact_dlmap.num_subchannels", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_cdlmap_num_subchannels_1, + {"Number Of Subchannels", "wimax.compact_dlmap.num_subchannels", FT_UINT16, BASE_DEC, NULL, 0x0FF0, "", HFILL} + }, + { + &hf_cdlmap_reserved_type, + {"DL-MAP Reserved Type", "wimax.compact_dlmap.reserved_type", FT_UINT8, BASE_DEC, NULL, DL_MAP_TYPE_MASK, "", HFILL} + }, + { + &hf_cdlmap_reserved_type_1, + {"DL-MAP Reserved Type", "wimax.compact_dlmap.reserved_type", FT_UINT8, BASE_DEC, NULL, DL_MAP_TYPE_MASK_1, "", HFILL} + } +}; + +/* display indexies */ +static gint hf_format_config_ie_dl_map_type = -1; +static gint hf_format_config_ie_dl_map_type_1 = -1; +static gint hf_format_config_ie_dl_map_type_32 = -1; +static gint hf_format_config_ie_new_format_indication = -1; +static gint hf_format_config_ie_new_format_indication_1 = -1; +static gint hf_format_config_ie_new_format_indication_32 = -1; +static gint hf_format_config_ie_cid_type = -1; +static gint hf_format_config_ie_cid_type_1 = -1; +static gint hf_format_config_ie_safety_pattern = -1; +static gint hf_format_config_ie_safety_pattern_1 = -1; +static gint hf_format_config_ie_subchannel_type = -1; +static gint hf_format_config_ie_subchannel_type_1 = -1; +static gint hf_format_config_ie_max_logical_bands = -1; +static gint hf_format_config_ie_max_logical_bands_1 = -1; +static gint hf_format_config_ie_num_of_broadcast_symbol = -1; +static gint hf_format_config_ie_num_of_broadcast_symbol_1 = -1; +static gint hf_format_config_ie_num_of_dl_band_amc_symbol = -1; +static gint hf_format_config_ie_num_of_dl_band_amc_symbol_1 = -1; +static gint hf_format_config_ie_num_of_ul_band_amc_symbol = -1; +static gint hf_format_config_ie_num_of_ul_band_amc_symbol_1 = -1; + +/* Format Configuration IE Masks */ +#define FORMAT_CONFIG_IE_DL_MAP_TYPE_MASK 0xE0000000 +#define FORMAT_CONFIG_IE_NEW_FORMAT_IND_MASK 0x10000000 +#define CID_TYPE_MASK_1 0x0C000000 +#define SAFETY_PATTERN_MASK_1 0x03E00000 +#define BAND_AMC_SUBCHANNEL_TYPE_MASK_1 0x00180000 +#define MAX_LOGICAL_BANDS_MASK_1 0x00060000 +#define NUM_BROADCAST_SYMBOLS_MASK_1 0x0001F000 +#define NUM_DL_AMC_SYMBOLS_MASK_1 0x00000FC0 +#define NUM_UL_AMC_SYMBOLS_MASK_1 0x0000003F +#define CID_TYPE_MASK 0xC0000000 +#define SAFETY_PATTERN_MASK 0x3E000000 +#define BAND_AMC_SUBCHANNEL_TYPE_MASK 0x01800000 +#define MAX_LOGICAL_BANDS_MASK 0x00600000 +#define NUM_BROADCAST_SYMBOLS_MASK 0x001F0000 +#define NUM_DL_AMC_SYMBOLS_MASK 0x0000FC00 +#define NUM_UL_AMC_SYMBOLS_MASK 0x000003F0 + +/* HARQ MAP Format Configuration IE display */ +static hf_register_info hf_format_config[] = +{ + { + &hf_format_config_ie_dl_map_type, + {"DL-MAP Type", "wimax.format_config_ie.dl_map_type", FT_UINT8, BASE_DEC, NULL, DL_MAP_TYPE_MASK, "", HFILL} + }, + { + &hf_format_config_ie_dl_map_type_1, + {"DL-MAP Type", "wimax.format_config_ie.dl_map_type", FT_UINT8, BASE_DEC, NULL, DL_MAP_TYPE_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_dl_map_type_32, + {"DL-MAP Type", "wimax.format_config_ie.dl_map_type", FT_UINT32, BASE_DEC, NULL, FORMAT_CONFIG_IE_DL_MAP_TYPE_MASK, "", HFILL} + }, + { + &hf_format_config_ie_new_format_indication, + {"New Format Indication", "wimax.format_config_ie.new_format_indication", FT_BOOLEAN, 8, TFS(&tfs_indication), UL_MAP_APPEND_MASK, "", HFILL} + }, + { + &hf_format_config_ie_new_format_indication_1, + {"New Format Indication", "wimax.format_config_ie.new_format_indication", FT_BOOLEAN, 8, TFS(&tfs_indication), UL_MAP_APPEND_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_new_format_indication_32, + {"New Format Indication", "wimax.format_config_ie.new_format_indication", FT_BOOLEAN, 32, TFS(&tfs_indication), FORMAT_CONFIG_IE_NEW_FORMAT_IND_MASK, "", HFILL} + }, + { + &hf_format_config_ie_cid_type, + {"HARQ MAP Indicator", "wimax.harq_map.format_config_ie.indicator", FT_UINT32, BASE_HEX, VALS(vals_cid_types), CID_TYPE_MASK, "", HFILL} + }, + { + &hf_format_config_ie_cid_type_1, + {"CID Type", "wimax.harq_map.format_config_ie.cid_type", FT_UINT32, BASE_HEX, VALS(vals_cid_types), CID_TYPE_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_safety_pattern, + {"Safety Pattern", "wimax.harq_map.format_config_ie.safety_pattern", FT_UINT32, BASE_HEX, NULL, SAFETY_PATTERN_MASK, "", HFILL} + }, + { + &hf_format_config_ie_safety_pattern_1, + {"Safety Pattern", "wimax.harq_map.format_config_ie.safety_pattern", FT_UINT32, BASE_HEX, NULL, SAFETY_PATTERN_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_subchannel_type, + {"Subchannel Type For Band AMC", "wimax.harq_map.format_config_ie.subchannel_type", FT_UINT32, BASE_HEX, VALS(vals_subchannel_types), BAND_AMC_SUBCHANNEL_TYPE_MASK, "", HFILL} + }, + { + &hf_format_config_ie_subchannel_type_1, + {"Subchannel Type For Band AMC", "wimax.harq_map.format_config_ie.subchannel_type", FT_UINT32, BASE_HEX, VALS(vals_subchannel_types), BAND_AMC_SUBCHANNEL_TYPE_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_max_logical_bands, + {"Max Logical Bands", "wimax.harq_map.format_config_ie.max_logical_bands", FT_UINT32, BASE_HEX, VALS(vals_max_logical_bands), MAX_LOGICAL_BANDS_MASK, "", HFILL} + }, + { + &hf_format_config_ie_max_logical_bands_1, + {"Max Logical Bands", "wimax.harq_map.format_config_ie.max_logical_bands", FT_UINT32, BASE_HEX, VALS(vals_max_logical_bands), MAX_LOGICAL_BANDS_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_num_of_broadcast_symbol, + {"Number Of Symbols for Broadcast", "wimax.harq_map.format_config_ie.num_of_broadcast_symbol", FT_UINT32, BASE_HEX, NULL, NUM_BROADCAST_SYMBOLS_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_num_of_broadcast_symbol_1, + {"Number Of Symbols for Broadcast", "wimax.harq_map.num_of_broadcast_symbol", FT_UINT32, BASE_HEX, NULL, NUM_BROADCAST_SYMBOLS_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_num_of_dl_band_amc_symbol, + {"Number Of Symbols for Broadcast", "wimax.harq_map.format_config_ie.num_of_dl_band_amc_symbol", FT_UINT32, BASE_HEX, NULL, NUM_DL_AMC_SYMBOLS_MASK, "", HFILL} + }, + { + &hf_format_config_ie_num_of_dl_band_amc_symbol_1, + {"Number Of Symbols for Broadcast", "wimax.harq_map.num_of_dl_band_amc_symbol", FT_UINT32, BASE_HEX, NULL, NUM_DL_AMC_SYMBOLS_MASK_1, "", HFILL} + }, + { + &hf_format_config_ie_num_of_ul_band_amc_symbol, + {"Number Of Symbols for Broadcast", "wimax.harq_map.format_config_ie.num_of_ul_band_amc_symbol", FT_UINT32, BASE_HEX, NULL, NUM_UL_AMC_SYMBOLS_MASK, "", HFILL} + }, + { + &hf_format_config_ie_num_of_ul_band_amc_symbol_1, + {"Number Of Symbols for Broadcast", "wimax.harq_map.num_of_ul_band_amc_symbol", FT_UINT32, BASE_HEX, NULL, NUM_UL_AMC_SYMBOLS_MASK_1, "", HFILL} + } +}; + +/* display indexies */ +static gint hf_harq_rcid_ie_prefix = -1; +static gint hf_harq_rcid_ie_prefix_1 = -1; +static gint hf_harq_rcid_ie_normal_cid = -1; +static gint hf_harq_rcid_ie_normal_cid_1 = -1; +static gint hf_harq_rcid_ie_cid3 = -1; +static gint hf_harq_rcid_ie_cid3_1 = -1; +static gint hf_harq_rcid_ie_cid7 = -1; +static gint hf_harq_rcid_ie_cid7_1 = -1; +static gint hf_harq_rcid_ie_cid11 = -1; +static gint hf_harq_rcid_ie_cid11_1 = -1; +static gint hf_harq_rcid_ie_cid11_2 = -1; +static gint hf_harq_rcid_ie_cid11_3 = -1; + +/* Masks */ +#define WIMAX_RCID_IE_NORMAL_CID_MASK_1 0x0FFFF0 +#define WIMAX_RCID_IE_PREFIX_MASK 0x8000 +#define WIMAX_RCID_IE_PREFIX_MASK_1 0x0800 +#define WIMAX_RCID_IE_CID3_MASK 0x7000 +#define WIMAX_RCID_IE_CID3_MASK_1 0x0700 +#define WIMAX_RCID_IE_CID7_MASK 0x7F00 +#define WIMAX_RCID_IE_CID7_MASK_1 0x07F0 +#define WIMAX_RCID_IE_CID11_MASK 0x7FF0 +#define WIMAX_RCID_IE_CID11_MASK_1 0x07FF + +/* HARQ MAP Reduced CID IE display */ +static hf_register_info hf_rcid[] = +{ + { + &hf_harq_rcid_ie_normal_cid, + {"Normal CID", "wimax.harq_map.rcid_ie.normal_cid", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_harq_rcid_ie_normal_cid_1, + {"Normal CID", "wimax.harq_map.rcid_ie.normal_cid", FT_UINT24, BASE_HEX, NULL, WIMAX_RCID_IE_NORMAL_CID_MASK_1, "", HFILL} + }, + { + &hf_harq_rcid_ie_prefix, + {"Prefix", "wimax.harq_map.rcid_ie.prefix", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_PREFIX_MASK, "", HFILL} + }, + { + &hf_harq_rcid_ie_prefix_1, + {"Prefix", "wimax.harq_map.rcid_ie.prefix", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_PREFIX_MASK_1, "", HFILL} + }, + { + &hf_harq_rcid_ie_cid3, + {"3 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid3", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID3_MASK, "", HFILL} + }, + { + &hf_harq_rcid_ie_cid3_1, + {"3 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid3", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID3_MASK_1, "", HFILL} + }, + { + &hf_harq_rcid_ie_cid7, + {"7 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid7", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID7_MASK, "", HFILL} + }, + { + &hf_harq_rcid_ie_cid7_1, + {"7 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid7", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID7_MASK_1, "", HFILL} + }, + { + &hf_harq_rcid_ie_cid11, + {"11 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid11", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID11_MASK, "", HFILL} + }, + { + &hf_harq_rcid_ie_cid11_1, + {"11 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid11", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID11_MASK_1, "", HFILL} + }, + { + &hf_harq_rcid_ie_cid11_2, + {"11 LSB Of Multicast, AAS or Broadcast CID", "wimax.harq_map.rcid_ie.cid11", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID11_MASK, "", HFILL} + }, + { + &hf_harq_rcid_ie_cid11_3, + {"11 LSB Of Multicast, AAS or Broadcast CID", "wimax.harq_map.rcid_ie.cid11", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID11_MASK_1, "", HFILL} + } +}; + +/* HARQ MAP HARQ Control IE display indexies */ +static gint hf_harq_control_ie_prefix = -1; +static gint hf_harq_control_ie_ai_sn = -1; +static gint hf_harq_control_ie_spid = -1; +static gint hf_harq_control_ie_acid = -1; +static gint hf_harq_control_ie_reserved = -1; +static gint hf_harq_control_ie_prefix_1 = -1; +static gint hf_harq_control_ie_ai_sn_1 = -1; +static gint hf_harq_control_ie_spid_1 = -1; +static gint hf_harq_control_ie_acid_1 = -1; +static gint hf_harq_control_ie_reserved_1 = -1; + +/* Masks */ +#define WIMAX_HARQ_CONTROL_IE_PREFIX_MASK 0x80 +#define WIMAX_HARQ_CONTROL_IE_AI_SN_MASK 0x40 +#define WIMAX_HARQ_CONTROL_IE_SPID_MASK 0x30 +#define WIMAX_HARQ_CONTROL_IE_ACID_MASK 0x0F +#define WIMAX_HARQ_CONTROL_IE_RESERVED_MASK 0x70 +#define WIMAX_HARQ_CONTROL_IE_PREFIX_MASK_1 0x0800 +#define WIMAX_HARQ_CONTROL_IE_AI_SN_MASK_1 0x0400 +#define WIMAX_HARQ_CONTROL_IE_SPID_MASK_1 0x0300 +#define WIMAX_HARQ_CONTROL_IE_ACID_MASK_1 0x00F0 +#define WIMAX_HARQ_CONTROL_IE_RESERVED_MASK_1 0x0700 + +/* HARQ MAP HARQ Control IE display */ +static hf_register_info hf_harq_control[] = +{ + { + &hf_harq_control_ie_prefix, + {"Prefix", "wimax.harq_map.harq_control_ie.prefix", FT_BOOLEAN, 8, TFS(&tfs_prefix), WIMAX_HARQ_CONTROL_IE_PREFIX_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_ai_sn, + {"HARQ ID Sequence Number(AI_SN)", "wimax.harq_map.harq_control_ie.ai_sn", FT_UINT8, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_AI_SN_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_spid, + {"Subpacket ID (SPID)", "wimax.harq_map.harq_control_ie.spid", FT_UINT8, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_SPID_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_acid, + {"HARQ CH ID (ACID)", "wimax.harq_map.harq_control_ie.acid", FT_UINT8, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_ACID_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_reserved, + {"Reserved", "wimax.harq_map.harq_control_ie.reserved", FT_UINT8, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_RESERVED_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_prefix_1, + {"Prefix", "wimax.harq_map.harq_control_ie.prefix", FT_BOOLEAN, 16, TFS(&tfs_prefix), WIMAX_HARQ_CONTROL_IE_PREFIX_MASK_1, "", HFILL} + }, + { + &hf_harq_control_ie_ai_sn_1, + {"HARQ ID Sequence Number(AI_SN)", "wimax.harq_map.harq_control_ie.ai_sn", FT_UINT16, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_AI_SN_MASK_1, "", HFILL} + }, + { + &hf_harq_control_ie_spid_1, + {"Subpacket ID (SPID)", "wimax.harq_map.harq_control_ie.spid", FT_UINT16, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_SPID_MASK_1, "", HFILL} + }, + { + &hf_harq_control_ie_acid_1, + {"HARQ CH ID (ACID)", "wimax.harq_map.harq_control_ie.acid", FT_UINT16, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_ACID_MASK_1, "", HFILL} + }, + { + &hf_harq_control_ie_reserved_1, + {"Reserved", "wimax.harq_map.harq_control_ie.reserved", FT_UINT16, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_RESERVED_MASK_1, "", HFILL} + } +}; + +/* HARQ MAP CQICH Control IE display indexies */ +static gint hf_cqich_control_ie_indicator = -1; +static gint hf_cqich_control_ie_alloc_id = -1; +static gint hf_cqich_control_ie_period = -1; +static gint hf_cqich_control_ie_frame_offset = -1; +static gint hf_cqich_control_ie_duration = -1; +static gint hf_cqich_control_ie_cqi_rep_threshold = -1; +static gint hf_cqich_control_ie_indicator_1 = -1; +static gint hf_cqich_control_ie_alloc_id_1 = -1; +static gint hf_cqich_control_ie_period_1 = -1; +static gint hf_cqich_control_ie_frame_offset_1 = -1; +static gint hf_cqich_control_ie_duration_1 = -1; +static gint hf_cqich_control_ie_cqi_rep_threshold_1 = -1; + +/* Masks */ +#define WIMAX_CQICH_CONTROL_IE_INDICATOR_MASK 0x8000 +#define WIMAX_CQICH_CONTROL_IE_ALLOCATION_INDEX_MASK 0x7E00 +#define WIMAX_CQICH_CONTROL_IE_PERIOD_MASK 0x0180 +#define WIMAX_CQICH_CONTROL_IE_FRAME_OFFSET_MASK 0x0070 +#define WIMAX_CQICH_CONTROL_IE_DURATION_MASK 0x000F +#define WIMAX_CQICH_CONTROL_IE_CQI_REP_THRESHOLD_MASK 0x7000 +#define WIMAX_CQICH_CONTROL_IE_INDICATOR_MASK_1 0x080000 +#define WIMAX_CQICH_CONTROL_IE_ALLOCATION_INDEX_MASK_1 0x07E000 +#define WIMAX_CQICH_CONTROL_IE_PERIOD_MASK_1 0x001800 +#define WIMAX_CQICH_CONTROL_IE_FRAME_OFFSET_MASK_1 0x000700 +#define WIMAX_CQICH_CONTROL_IE_DURATION_MASK_1 0x0000F0 +#define WIMAX_CQICH_CONTROL_IE_CQI_REP_THRESHOLD_MASK_1 0x070000 + +/* HARQ MAP CQICH Control IE display */ +static hf_register_info hf_cqich_control[] = +{ + { + &hf_cqich_control_ie_indicator, + {"CQICH Indicator", "wimax.harq_map.cqich_control_ie.cqich_indicator", FT_BOOLEAN, 16, TFS(&tfs_cqich_ind), WIMAX_CQICH_CONTROL_IE_INDICATOR_MASK, "", HFILL} + }, + { + &hf_cqich_control_ie_alloc_id, + {"Allocation Index", "wimax.harq_map.cqich_control_ie.alloc_id", FT_UINT16, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_ALLOCATION_INDEX_MASK, "", HFILL} + }, + { + &hf_cqich_control_ie_period, + {"PERIOD", "wimax.harq_map.cqich_control_ie.period", FT_UINT16, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_PERIOD_MASK, "", HFILL} + }, + { + &hf_cqich_control_ie_frame_offset, + {"Frame Offset", "wimax.harq_map.cqich_control_ie.frame_offset", FT_UINT16, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_FRAME_OFFSET_MASK, "", HFILL} + }, + { + &hf_cqich_control_ie_duration, + {"Duration", "wimax.harq_map.cqich_control_ie.duration", FT_UINT16, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_DURATION_MASK, "", HFILL} + }, + { + &hf_cqich_control_ie_cqi_rep_threshold, + {"CQI Reporting Threshold", "wimax.harq_map.cqich_control_ie.cqi_rep_threshold", FT_UINT16, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_CQI_REP_THRESHOLD_MASK, "", HFILL} + }, + { + &hf_cqich_control_ie_indicator_1, + {"CQICH Indicator", "wimax.harq_map.cqich_control_ie.cqich_indicator", FT_BOOLEAN, 24, TFS(&tfs_cqich_ind), WIMAX_CQICH_CONTROL_IE_INDICATOR_MASK_1, "", HFILL} + }, + { + &hf_cqich_control_ie_alloc_id_1, + {"Allocation Index", "wimax.harq_map.cqich_control_ie.alloc_id", FT_UINT24, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_ALLOCATION_INDEX_MASK_1, "", HFILL} + }, + { + &hf_cqich_control_ie_period_1, + {"PERIOD", "wimax.harq_map.cqich_control_ie.period", FT_UINT24, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_PERIOD_MASK_1, "", HFILL} + }, + { + &hf_cqich_control_ie_frame_offset_1, + {"Frame Offset", "wimax.harq_map.cqich_control_ie.frame_offset", FT_UINT24, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_FRAME_OFFSET_MASK_1, "", HFILL} + }, + { + &hf_cqich_control_ie_duration_1, + {"Duration", "wimax.harq_map.cqich_control_ie.duration", FT_UINT24, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_DURATION_MASK_1, "", HFILL} + }, + { + &hf_cqich_control_ie_cqi_rep_threshold_1, + {"CQI Reporting Threshold", "wimax.harq_map.cqich_control_ie.cqi_rep_threshold", FT_UINT24, BASE_HEX, NULL, WIMAX_CQICH_CONTROL_IE_CQI_REP_THRESHOLD_MASK_1, "", HFILL} + } +}; + +/* Extension Type */ +#define EXTENSION_TYPE_MASK 0xE000 +#define EXTENSION_TYPE_MASK_1 0x0E00 +#define EXTENSION_SUBTYPE_MASK 0x1F00 +#define EXTENSION_SUBTYPE_MASK_1 0x01F0 +#define EXTENSION_LENGTH_MASK 0x00F0 +#define EXTENSION_LENGTH_MASK_1 0x000F + +static gint hf_cdlmap_extension_type = -1; +static gint hf_cdlmap_extension_subtype = -1; +static gint hf_cdlmap_extension_length = -1; +static gint hf_cdlmap_extension_type_1 = -1; +static gint hf_cdlmap_extension_subtype_1 = -1; +static gint hf_cdlmap_extension_length_1 = -1; + +static gint hf_cdlmap_extension_time_diversity_mbs = -1; +static gint hf_cdlmap_extension_harq_mode = -1; +static gint hf_cdlmap_extension_unknown_sub_type = -1; +static gint hf_cdlmap_extension_time_diversity_mbs_1 = -1; +static gint hf_cdlmap_extension_harq_mode_1 = -1; +static gint hf_cdlmap_extension_unknown_sub_type_1 = -1; + +static hf_register_info hf_extension_type[] = +{ + { + &hf_cdlmap_extension_type, + {"DL-MAP Type", "wimax.extension_type.dl_map_type", FT_UINT16, BASE_DEC, NULL, EXTENSION_TYPE_MASK, "", HFILL} + }, + { + &hf_cdlmap_extension_type_1, + {"DL-MAP Type", "wimax.extension_type.dl_map_type", FT_UINT16, BASE_DEC, NULL, EXTENSION_TYPE_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_extension_subtype, + {"Extension Subtype", "wimax.extension_type.subtype", FT_UINT16, BASE_DEC, NULL, EXTENSION_SUBTYPE_MASK, "", HFILL} + }, + { + &hf_cdlmap_extension_subtype_1, + {"Extension Subtype", "wimax.extension_type.subtype", FT_UINT16, BASE_DEC, NULL, EXTENSION_SUBTYPE_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_extension_length, + {"Extension Length", "wimax.extension_type.length", FT_UINT16, BASE_DEC, NULL, EXTENSION_LENGTH_MASK, "", HFILL} + }, + { + &hf_cdlmap_extension_length_1, + {"Extension Length", "wimax.extension_type.length", FT_UINT16, BASE_DEC, NULL, EXTENSION_LENGTH_MASK_1, "", HFILL} + }, + { + &hf_cdlmap_extension_time_diversity_mbs, + {"Time Diversity MBS", "wimax.extension_type.time_diversity_mbs", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cdlmap_extension_time_diversity_mbs_1, + {"Time Diversity MBS", "wimax.extension_type.time_diversity_mbs", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cdlmap_extension_harq_mode_1, + {"HARQ Mode Switch", "wimax.extension_type.harq_mode", FT_UINT16, BASE_HEX, NULL, 0x000F, "", HFILL} + }, + { + &hf_cdlmap_extension_harq_mode, + {"HARQ Mode Switch", "wimax.extension_type.harq_mode", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_cdlmap_extension_unknown_sub_type, + {"Unknown Extension Subtype", "wimax.extension_type.unknown_sub_type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cdlmap_extension_unknown_sub_type_1, + {"Unknown Extension Subtype", "wimax.extension_type.unknown_sub_type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* Extended DIUC dependent IE display indexies */ +static gint hf_extended_diuc_dependent_ie_diuc = -1; +static gint hf_extended_diuc_dependent_ie_diuc_1 = -1; +static gint hf_extended_diuc_dependent_ie_length = -1; +static gint hf_extended_diuc_dependent_ie_length_1 = -1; +static gint hf_extended_diuc_dependent_ie_channel_measurement = -1; +static gint hf_extended_diuc_dependent_ie_stc_zone = -1; +static gint hf_extended_diuc_dependent_ie_aas_dl = -1; +static gint hf_extended_diuc_dependent_ie_data_location = -1; +static gint hf_extended_diuc_dependent_ie_cid_switch = -1; +static gint hf_extended_diuc_dependent_ie_mimo_dl_basic = -1; +static gint hf_extended_diuc_dependent_ie_mimo_dl_enhanced = -1; +static gint hf_extended_diuc_dependent_ie_harq_map_pointer = -1; +static gint hf_extended_diuc_dependent_ie_phymod_dl = -1; +static gint hf_extended_diuc_dependent_ie_dl_pusc_burst_allocation = -1; +static gint hf_extended_diuc_dependent_ie_ul_interference_and_noise_level = -1; +static gint hf_extended_diuc_dependent_ie_unknown_diuc = -1; + +/* Extended DIUC dependent IE */ +static hf_register_info hf_extended_diuc[] = +{ + { + &hf_extended_diuc_dependent_ie_diuc, + {"Extended DIUC", "wimax.extended_diuc_dependent_ie.diuc", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL } + }, + { + &hf_extended_diuc_dependent_ie_diuc_1, + {"Extended DIUC", "wimax.extended_diuc_dependent_ie.diuc", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL } + }, + { + &hf_extended_diuc_dependent_ie_length, + {"Length", "wimax.extended_diuc_dependent_ie.length", FT_UINT8, BASE_DEC, NULL, MSB_NIBBLE_MASK, "", HFILL } + }, + { + &hf_extended_diuc_dependent_ie_length_1, + {"Length", "wimax.extended_diuc_dependent_ie.length", FT_UINT8, BASE_DEC, NULL, LSB_NIBBLE_MASK, "", HFILL } + }, + { /* 8.4.5.3.? Channel_Measurement_IE */ + &hf_extended_diuc_dependent_ie_channel_measurement, + {"Channel_Measurement_IE (not implemented)", "wimax.extended_diuc_dependent_ie.channel_measurement", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.4 STC_Zone_IE */ + &hf_extended_diuc_dependent_ie_stc_zone, + {"STC_Zone_IE (not implemented)", "wimax.extended_diuc_dependent_ie.stc_zone", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.3 AAS_DL_IE */ + &hf_extended_diuc_dependent_ie_aas_dl, + {"AAS_DL_IE (not implemented)", "wimax.extended_diuc_dependent_ie.aas_dl", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.6 Data_location_in_another_BS_IE */ + &hf_extended_diuc_dependent_ie_data_location, + {"Data_location_in_another_BS_IE (not implemented)", "wimax.extended_diuc_dependent_ie.data_location", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.7 CID_Switch_IE */ + &hf_extended_diuc_dependent_ie_cid_switch, + {"CID_Switch_IE (not implemented)", "wimax.extended_diuc_dependent_ie.cid_switch", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + + { /* 8.4.5.3.8 MIMO_DL_Basic_IE */ + &hf_extended_diuc_dependent_ie_mimo_dl_basic, + {"MIMO_DL_Basic_IE (not implemented)", "wimax.extended_diuc_dependent_ie.mimo_dl_basic", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.9 MIMO_DL_Enhanced_IE */ + &hf_extended_diuc_dependent_ie_mimo_dl_enhanced, + {"MIMO_DL_Enhanced_IE (not implemented)", "wimax.extended_diuc_dependent_ie.mimo_dl_enhanced", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.10 HARQ_Map_Pointer_IE */ + &hf_extended_diuc_dependent_ie_harq_map_pointer, + {"HARQ_Map_Pointer_IE (not implemented)", "wimax.extended_diuc_dependent_ie.harq_map_pointer", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.11 PHYMOD_DL_IE */ + &hf_extended_diuc_dependent_ie_phymod_dl, + {"PHYMOD_DL_IE (not implemented)", "wimax.extended_diuc_dependent_ie.phymod_dl", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.13 DL PUSC Burst Allocation in Other Segment IE */ + &hf_extended_diuc_dependent_ie_dl_pusc_burst_allocation, + {"DL_PUSC_Burst_Allocation_in_Other_Segment_IE (not implemented)", "wimax.extended_diuc_dependent_ie.dl_pusc_burst_allocation", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.3.19 UL_interference_and_noise_level_IE */ + &hf_extended_diuc_dependent_ie_ul_interference_and_noise_level, + {"UL_interference_and_noise_level_IE (not implemented)", "wimax.extended_diuc_dependent_ie.ul_interference_and_noise_level", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* unknown DIUC */ + &hf_extended_diuc_dependent_ie_unknown_diuc, + {"Unknown Extended DIUC", "wimax.extended_diuc_dependent_ie.unknown_diuc", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + } +}; + +/* Register Wimax Compact DL-MAP IE Protocol */ +void proto_register_wimax_compact_dlmap_ie(void) +{ + if (proto_wimax_compact_dlmap_ie_decoder == -1) + { + proto_wimax_compact_dlmap_ie_decoder = proto_wimax; + + proto_register_subtree_array(ett, array_length(ett)); + proto_register_field_array(proto_wimax_compact_dlmap_ie_decoder, hf_compact_dlmap, array_length(hf_compact_dlmap)); + proto_register_field_array(proto_wimax_compact_dlmap_ie_decoder, hf_format_config, array_length(hf_format_config)); + proto_register_field_array(proto_wimax_compact_dlmap_ie_decoder, hf_rcid, array_length(hf_rcid)); + proto_register_field_array(proto_wimax_compact_dlmap_ie_decoder, hf_harq_control, array_length(hf_harq_control)); + proto_register_field_array(proto_wimax_compact_dlmap_ie_decoder, hf_cqich_control, array_length(hf_cqich_control)); + proto_register_field_array(proto_wimax_compact_dlmap_ie_decoder, hf_extension_type, array_length(hf_extension_type)); + proto_register_field_array(proto_wimax_compact_dlmap_ie_decoder, hf_extended_diuc, array_length(hf_extended_diuc)); + } +} + +/* Compact DL-MAP IE Types (table 89) */ +#define COMPACT_DL_MAP_TYPE_NORMAL_SUBCHANNEL 0 +#define COMPACT_DL_MAP_TYPE_BAND_AMC 1 +#define COMPACT_DL_MAP_TYPE_SAFETY 2 +#define COMPACT_DL_MAP_TYPE_UIUC 3 +#define COMPACT_DL_MAP_TYPE_FORMAT_CONF_IE 4 +#define COMPACT_DL_MAP_TYPE_HARQ_ACK_BITMAP_IE 5 +#define COMPACT_DL_MAP_TYPE_RESERVED 6 +#define COMPACT_DL_MAP_TYPE_EXTENSION 7 + +/* Compact DL-MAP IE decoder */ +guint wimax_compact_dlmap_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint diuc, byte, length = 0; + guint dl_map_type, ul_map_append; + guint dl_map_offset, nibble_length, bit_map_length; + guint nband, band_count, i, allocation_mode; + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Compact DL-MAP IEs"); + } +#endif + /* set the local offset */ + dl_map_offset = offset; + /* Get the first byte */ + byte = tvb_get_guint8(tvb, dl_map_offset); + if(nibble_offset & 1) + { + dl_map_type = ((byte & DL_MAP_TYPE_MASK_1) >> 1); + ul_map_append = (byte & UL_MAP_APPEND_MASK_1); + } + else + { + dl_map_type = ((byte & DL_MAP_TYPE_MASK) >> 5); + ul_map_append = (byte & UL_MAP_APPEND_MASK); + } + switch (dl_map_type) + { + case COMPACT_DL_MAP_TYPE_NORMAL_SUBCHANNEL:/* 6.3.2.3.43.6.1 */ + if(nibble_offset & 1) + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type_1, tvb, dl_map_offset, 1, FALSE); + /* display the UL-MAP append */ + proto_tree_add_item(tree, hf_cdlmap_ul_map_append_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + nibble_offset = 0; + } + else + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type, tvb, dl_map_offset, 1, FALSE); + /* display the UL-MAP append */ + proto_tree_add_item(tree, hf_cdlmap_ul_map_append, tvb, dl_map_offset, 1, FALSE); + nibble_offset = 1; + } + length = 1; + /* decode RCID IE */ + nibble_length = wimax_compact_dlmap_rcid_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + /* check harq mode */ + if(!harq_mode) + { /* display the Nep and Nsch Code */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_nep_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + proto_tree_add_item(tree, hf_cdlmap_nsch_code, tvb, dl_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_nep_code, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_nsch_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + } + length += 2; + } + else if(harq_mode == 1) + { /* display the Shortened DIUC and Companded SC */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_shortened_diuc_1, tvb, dl_map_offset, 2, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc_1, tvb, dl_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_shortened_diuc, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc, tvb, dl_map_offset, 1, FALSE); + } + /* move to next byte */ + dl_map_offset++; + length += 2; + } + /* decode HARQ Control IE */ + nibble_length = wimax_compact_dlmap_harq_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += ((nibble_offset + nibble_length) >> 1); + nibble_offset = ((nibble_offset + nibble_length) & 1); + /* decode CQICH Control IE */ + nibble_length = wimax_compact_dlmap_cqich_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += ((nibble_offset + nibble_length) >> 1); + nibble_offset = ((nibble_offset + nibble_length) & 1); + if(ul_map_append) + { /* check harq mode */ + if(harq_mode == 1) + { /* display the Shortened UIUC and Companded SC */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_shortened_uiuc_1, tvb, dl_map_offset, 2, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc_1, tvb, dl_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_shortened_uiuc, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc, tvb, dl_map_offset, 1, FALSE); + } + /* move to next byte */ + dl_map_offset++; + length += 2; + } + else if(!harq_mode) + { /* display the Nep and Nsch Code */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_nep_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + proto_tree_add_item(tree, hf_cdlmap_nsch_code, tvb, dl_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_nep_code, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_nsch_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + } + length += 2; + } + /* decode HARQ Control IE */ + nibble_length = wimax_compact_dlmap_harq_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + } + break; + case COMPACT_DL_MAP_TYPE_BAND_AMC:/* 6.3.2.3.43.6.2 */ + if(nibble_offset & 1) + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type_1, tvb, dl_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_cdlmap_reserved_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + nibble_offset = 0; + } + else + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type, tvb, dl_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_cdlmap_reserved, tvb, dl_map_offset, 1, FALSE); + nibble_offset = 1; + } + length = 1; + /* decode RCID IE */ + nibble_length = wimax_compact_dlmap_rcid_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + /* check harq mode */ + if(!harq_mode) + { /* display the Nep and Nsch Code */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_nep_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + proto_tree_add_item(tree, hf_cdlmap_nsch_code, tvb, dl_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_nep_code, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_nsch_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + } + length += 2; + } + else if(harq_mode == 1) + { /* display the Shortened DIUC and Companded SC */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_shortened_diuc_1, tvb, dl_map_offset, 2, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc_1, tvb, dl_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_shortened_diuc, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc, tvb, dl_map_offset, 1, FALSE); + } + /* move to next byte */ + dl_map_offset++; + length += 2; + } + /* get the Nband */ + if(max_logical_bands) + { /* get and display the Nband */ + nband = tvb_get_guint8(tvb, dl_map_offset); + if(nibble_offset & 1) + { + nband = (nband & LSB_NIBBLE_MASK); + /* display the Nband */ + proto_tree_add_item(tree, hf_cdlmap_num_bands_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + nibble_offset = 0; + if(max_logical_bands == 3) + { + proto_tree_add_item(tree, hf_cdlmap_band_index, tvb, dl_map_offset, nband, FALSE); + length += (nband * 2); + /* update offset */ + dl_map_offset += nband; + } + else + { + nibble_offset = (nband & 1); + proto_tree_add_item(tree, hf_cdlmap_band_index, tvb, dl_map_offset, ((nband >> 1) + nibble_offset), FALSE); + length += nband; + /* update offset */ + dl_map_offset += (nband >> 1); + } + } + else + { + nband = ((nband & MSB_NIBBLE_MASK) >> 4); + /* display the Nband */ + proto_tree_add_item(tree, hf_cdlmap_num_bands, tvb, dl_map_offset, 1, FALSE); + nibble_offset = 1; + if(max_logical_bands == 3) + { + proto_tree_add_item(tree, hf_cdlmap_band_index, tvb, dl_map_offset, (nband + nibble_offset), FALSE); + length += (nband * 2); + /* update offset */ + dl_map_offset += nband; + } + else + { + proto_tree_add_item(tree, hf_cdlmap_band_index, tvb, dl_map_offset, ((nband >> 1) + nibble_offset), FALSE); + length += nband; + /* update offset */ + dl_map_offset += ((nband + nibble_offset) >> 1); + if(nband & 1) + nibble_offset = 0; + } + } + length++; + band_count = nband; + } + else + { + nband = 0; + band_count = 1; + /* display the Nb-BITMAP */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_nb_bitmap_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + nibble_offset = 0; + } + else + { + proto_tree_add_item(tree, hf_cdlmap_nb_bitmap, tvb, dl_map_offset, 1, FALSE); + nibble_offset = 1; + } + length++; + } + /* Get the Allocation Mode */ + byte = tvb_get_guint8(tvb, dl_map_offset); + if(nibble_offset & 1) + { + allocation_mode = ((byte & 0x0C) >> 2); + proto_tree_add_item(tree, hf_cdlmap_allocation_mode_1, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_allocation_mode_rsvd_1, tvb, dl_map_offset, 1, FALSE); + nibble_offset = 0; + dl_map_offset++; + } + else + { + allocation_mode = ((byte & 0xC0) >> 6); + proto_tree_add_item(tree, hf_cdlmap_allocation_mode, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_allocation_mode_rsvd, tvb, dl_map_offset, 1, FALSE); + nibble_offset = 1; + } + /* Decode Allocation Mode - need to be done */ + if(!allocation_mode) + { + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_num_subchannels_1, tvb, dl_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_num_subchannels, tvb, dl_map_offset, 1, FALSE); + } + dl_map_offset++; + } + else if(allocation_mode == 1) + { + for(i=0; i<band_count; i++) + { + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_num_subchannels_1, tvb, dl_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_num_subchannels, tvb, dl_map_offset, 1, FALSE); + } + dl_map_offset++; + } + } + /* decode HARQ Control IE */ + nibble_length = wimax_compact_dlmap_harq_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += ((nibble_offset + nibble_length) >> 1); + nibble_offset = ((nibble_offset + nibble_length) & 1); + /* decode CQICH Control IE */ + nibble_length = wimax_compact_dlmap_cqich_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + break; + case COMPACT_DL_MAP_TYPE_SAFETY:/* 6.3.2.3.43.6.3 */ + if(nibble_offset & 1) + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type_1, tvb, dl_map_offset, 1, FALSE); + /* display the UL-MAP append */ + proto_tree_add_item(tree, hf_cdlmap_ul_map_append_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + nibble_offset = 0; + } + else + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type, tvb, dl_map_offset, 1, FALSE); + /* display the UL-MAP append */ + proto_tree_add_item(tree, hf_cdlmap_ul_map_append, tvb, dl_map_offset, 1, FALSE); + nibble_offset = 1; + } + length = 1; + /* decode RCID IE */ + nibble_length = wimax_compact_dlmap_rcid_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + /* check harq mode */ + if(!harq_mode) + { /* display the Nep and Nsch Code */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_nep_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + proto_tree_add_item(tree, hf_cdlmap_nsch_code, tvb, dl_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_nep_code, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_nsch_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + } + length += 2; + } + else if(harq_mode == 1) + { /* display the Shortened DIUC and Companded SC */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_shortened_diuc_1, tvb, dl_map_offset, 2, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc_1, tvb, dl_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_shortened_diuc, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc, tvb, dl_map_offset, 1, FALSE); + } + /* move to next byte */ + dl_map_offset++; + length += 2; + } + /* display BIN offset */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_bin_offset_1, tvb, dl_map_offset, 2, FALSE); + /* move to next byte */ + dl_map_offset++; + } + else + { + proto_tree_add_item(tree, hf_cdlmap_bin_offset, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + } + length += 2; + /* decode HARQ Control IE */ + nibble_length = wimax_compact_dlmap_harq_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += ((nibble_offset + nibble_length) >> 1); + nibble_offset = ((nibble_offset + nibble_length) & 1); + /* decode CQICH Control IE */ + nibble_length = wimax_compact_dlmap_cqich_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += ((nibble_offset + nibble_length) >> 1); + nibble_offset = ((nibble_offset + nibble_length) & 1); + if(ul_map_append) + { /* check harq mode */ + if(harq_mode == 1) + { /* display the Shortened DIUC and Companded SC */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_shortened_diuc_1, tvb, dl_map_offset, 2, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc_1, tvb, dl_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_shortened_diuc, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_companded_sc, tvb, dl_map_offset, 1, FALSE); + } + /* move to next byte */ + dl_map_offset++; + length += 2; + } + else if(!harq_mode) + { /* display the Nep and Nsch Code */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_nep_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + proto_tree_add_item(tree, hf_cdlmap_nsch_code, tvb, dl_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_nep_code, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_nsch_code_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + } + length += 2; + } + /* display BIN offset */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_bin_offset_1, tvb, dl_map_offset, 2, FALSE); + /* move to next byte */ + dl_map_offset++; + } + else + { + proto_tree_add_item(tree, hf_cdlmap_bin_offset, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + } + length += 2; + /* decode HARQ Control IE */ + nibble_length = wimax_compact_dlmap_harq_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + } + break; + case COMPACT_DL_MAP_TYPE_UIUC:/* 6.3.2.3.43.6.4 */ + if(nibble_offset & 1) + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type_1, tvb, dl_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_cdlmap_reserved_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + /* get the new byte */ + byte = tvb_get_guint8(tvb, dl_map_offset); + /* get the DIUC */ + diuc = ((byte & MSB_NIBBLE_MASK) >> 4); + /* display the DIUC */ + proto_tree_add_item(tree, hf_cdlmap_diuc, tvb, dl_map_offset, 1, FALSE); + } + else + { + /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type, tvb, dl_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_cdlmap_reserved, tvb, dl_map_offset, 1, FALSE); + /* get the DIUC */ + diuc = (tvb_get_guint8(tvb, dl_map_offset) & LSB_NIBBLE_MASK); + /* display the DIUC */ + proto_tree_add_item(tree, hf_cdlmap_diuc_1, tvb, dl_map_offset, 1, FALSE); + /* move to next byte */ + dl_map_offset++; + } + length = 2; + if(diuc == 15) + { /* Extended DIUC dependent IE */ + nibble_length = wimax_extended_diuc_dependent_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + } + else + { /* decode RCID IE */ + nibble_length = wimax_compact_dlmap_rcid_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + /* display Number of subchannels */ + if(nibble_offset & 1) + proto_tree_add_item(tree, hf_cdlmap_diuc_num_of_subchannels_1, tvb, dl_map_offset, 1, FALSE); + else + proto_tree_add_item(tree, hf_cdlmap_diuc_num_of_subchannels, tvb, dl_map_offset, 1, FALSE); + length += 2; + /* display the repetition coding indication and reserved bits */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_cdlmap_diuc_repetition_coding_indication_1, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_diuc_reserved_1, tvb, dl_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_cdlmap_diuc_repetition_coding_indication, tvb, dl_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_cdlmap_diuc_reserved, tvb, dl_map_offset, 1, FALSE); + } + length += 1; + } + /* decode HARQ Control IE */ + nibble_length = wimax_compact_dlmap_harq_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + dl_map_offset += ((nibble_offset + nibble_length) >> 1); + nibble_offset = ((nibble_offset + nibble_length) & 1); + /* decode CQICH Control IE */ + nibble_length = wimax_compact_dlmap_cqich_control_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length += nibble_length; + break; + case COMPACT_DL_MAP_TYPE_FORMAT_CONF_IE:/* 6.3.2.3.43.2 */ + /* decode the format configuration IE */ + nibble_length = wimax_compact_dlmap_format_configuration_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset); + length = nibble_length; + break; + case COMPACT_DL_MAP_TYPE_HARQ_ACK_BITMAP_IE:/* 6.3.2.3.43.6.5 */ + if(nibble_offset & 1) + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type_1, tvb, dl_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_cdlmap_reserved_1, tvb, dl_map_offset, 1, FALSE); + length = 1; + /* move to next byte */ + dl_map_offset++; + /* get the bit map length */ + byte = tvb_get_guint8(tvb, dl_map_offset); + bit_map_length = ((byte & MSB_NIBBLE_MASK) >> 4); + /* display BITMAP Length */ + proto_tree_add_item(tree, hf_cdlmap_bit_map_length, tvb, dl_map_offset, 1, FALSE); + /* display BITMAP */ + proto_tree_add_item(tree, hf_cdlmap_bit_map, tvb, dl_map_offset, bit_map_length + 1, FALSE); + length += (1 + bit_map_length * 2); + } + else + { + /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_dl_map_type, tvb, dl_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_cdlmap_reserved, tvb, dl_map_offset, 1, FALSE); + /* display BITMAP Length */ + proto_tree_add_item(tree, hf_cdlmap_bit_map_length_1, tvb, dl_map_offset, 1, FALSE); + length = 2; + /* get the bit map length */ + bit_map_length = (byte & LSB_NIBBLE_MASK); + /* move to next byte */ + dl_map_offset++; + /* display BITMAP */ + proto_tree_add_item(tree, hf_cdlmap_bit_map, tvb, dl_map_offset, bit_map_length, FALSE); + length += (bit_map_length * 2); + } + break; + case COMPACT_DL_MAP_TYPE_EXTENSION:/* 6.3.2.3.43.6.6 */ + /* decode the Compact DL-MAP externsion IE */ + nibble_length = wimax_cdlmap_extension_ie_decoder(tree, pinfo, tvb, dl_map_offset, nibble_offset);//, cqich_indicator); + length = nibble_length; + break; + default:/* Reserved Type */ + /* display the reserved type */ + proto_tree_add_item(tree, hf_cdlmap_reserved_type_1, tvb, dl_map_offset, 1, FALSE); + length = 1; + break; + } + /* Update the nibble_offset and length */ + return length; +} + +/* Format Configuration IE shifts */ +#define CID_TYPE_SHIFT 30 +#define SAFETY_PATTERN_SHIFT 25 +#define BAND_AMC_SUBCHANNEL_TYPE_SHIFT 23 +#define MAX_LOGICAL_BANDS_SHIFT 21 +#define NUM_BROADCAST_SYMBOLS_SHIFT 16 +#define NUM_DL_AMC_SYMBOLS_SHIFT 10 +#define NUM_UL_AMC_SYMBOLS_SHIFT 4 +#define CID_TYPE_SHIFT_1 (CID_TYPE_SHIFT-NUM_UL_AMC_SYMBOLS_SHIFT) +#define SAFETY_PATTERN_SHIFT_1 (SAFETY_PATTERN_SHIFT-NUM_UL_AMC_SYMBOLS_SHIFT) +#define BAND_AMC_SUBCHANNEL_TYPE_SHIFT_1 (BAND_AMC_SUBCHANNEL_TYPE_SHIFT-NUM_UL_AMC_SYMBOLS_SHIFT) +#define MAX_LOGICAL_BANDS_SHIFT_1 (MAX_LOGICAL_BANDS_SHIFT-NUM_UL_AMC_SYMBOLS_SHIFT) +#define NUM_BROADCAST_SYMBOLS_SHIFT_1 (NUM_BROADCAST_SYMBOLS_SHIFT-NUM_UL_AMC_SYMBOLS_SHIFT) +#define NUM_DL_AMC_SYMBOLS_SHIFT_1 (NUM_DL_AMC_SYMBOLS_SHIFT-NUM_UL_AMC_SYMBOLS_SHIFT) +//#define NUM_UL_AMC_SYMBOLS_SHIFT_1 0 + +/* Compact DL-MAP Format Configuration IE (6.3.2.3.43.2) decoder */ +static guint wimax_compact_dlmap_format_configuration_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint length = 0; + guint dl_map_type, new_format_ind; + guint dl_map_offset; + guint32 tvb_value; + + UNREFERENCED_PARAMETER(pinfo); + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Format Configuration IE"); + } +#endif + /* set the local offset */ + dl_map_offset = offset; + /* Get the first byte */ + tvb_value = tvb_get_guint8(tvb, dl_map_offset); + if(nibble_offset & 1) + { /* get the DL-MAP type */ + dl_map_type = ((tvb_value & DL_MAP_TYPE_MASK_1) >> 1); + /* ensure the dl-map type is Format Configuration IE */ + if(dl_map_type != COMPACT_DL_MAP_TYPE_FORMAT_CONF_IE) + return 0; + new_format_ind = (tvb_value & 0x01); + /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_format_config_ie_dl_map_type_1, tvb, dl_map_offset, 1, FALSE); + /* display the New format Indication */ + proto_tree_add_item(tree, hf_format_config_ie_new_format_indication_1, tvb, dl_map_offset, 1, FALSE); + /* update the length in nibble */ + length = 1; + /* move to next byte */ + dl_map_offset++; + if(new_format_ind) + { /* display the CID Type */ + proto_tree_add_item(tree, hf_format_config_ie_cid_type, tvb, dl_map_offset, 4, FALSE); + /* display the Safety Pattern */ + proto_tree_add_item(tree, hf_format_config_ie_safety_pattern, tvb, dl_map_offset, 4, FALSE); + /* display the Subchannel pattern */ + proto_tree_add_item(tree, hf_format_config_ie_subchannel_type, tvb, dl_map_offset, 4, FALSE); + /* display the max logical bands */ + proto_tree_add_item(tree, hf_format_config_ie_max_logical_bands, tvb, dl_map_offset, 4, FALSE); + /* display the number of broadcast symbols */ + proto_tree_add_item(tree, hf_format_config_ie_num_of_broadcast_symbol, tvb, dl_map_offset, 4, FALSE); + /* display the number of dl band AMC symbols */ + proto_tree_add_item(tree, hf_format_config_ie_num_of_dl_band_amc_symbol, tvb, dl_map_offset, 4, FALSE); + /* display the number of ul band AMC symbols */ + proto_tree_add_item(tree, hf_format_config_ie_num_of_ul_band_amc_symbol, tvb, dl_map_offset, 4, FALSE); + /* update the length in nibble */ + length += 7; + /* Get the next 32-bit word */ + tvb_value = tvb_get_ntohl(tvb, dl_map_offset); + /* get the CID type */ + cid_type = ((tvb_value & CID_TYPE_MASK) >> CID_TYPE_SHIFT); + /* get the subchannel type for band AMC */ + band_amc_subchannel_type = ((tvb_value & BAND_AMC_SUBCHANNEL_TYPE_MASK) >> BAND_AMC_SUBCHANNEL_TYPE_SHIFT); + /* get the max logical bands */ + max_logical_bands = ((tvb_value & MAX_LOGICAL_BANDS_MASK) >> MAX_LOGICAL_BANDS_SHIFT); + /* get the number of symbols for broadcast */ + num_of_broadcast_symbols = ((tvb_value & NUM_BROADCAST_SYMBOLS_MASK) >> NUM_BROADCAST_SYMBOLS_SHIFT); + /* get the number of symbols for DL band AMC */ + num_of_dl_band_amc_symbols = ((tvb_value & NUM_DL_AMC_SYMBOLS_MASK) >> NUM_DL_AMC_SYMBOLS_SHIFT); + /* get the number of symbols for UL band AMC */ + num_of_ul_band_amc_symbols = ((tvb_value & NUM_UL_AMC_SYMBOLS_MASK) >> NUM_UL_AMC_SYMBOLS_SHIFT); + } + } + else + { + dl_map_type = ((tvb_value & DL_MAP_TYPE_MASK) >> 5); + /* ensure the dl-map type is Format Configuration IE */ + if(dl_map_type != COMPACT_DL_MAP_TYPE_FORMAT_CONF_IE) + return 0; + new_format_ind = (tvb_value & 0x10); + if(new_format_ind) + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_format_config_ie_dl_map_type_32, tvb, dl_map_offset, 4, FALSE); + /* display the New format Indication */ + proto_tree_add_item(tree, hf_format_config_ie_new_format_indication_32, tvb, dl_map_offset, 4, FALSE); + /* display the CID Type */ + proto_tree_add_item(tree, hf_format_config_ie_cid_type_1, tvb, dl_map_offset, 4, FALSE); + /* display the Safety Pattern */ + proto_tree_add_item(tree, hf_format_config_ie_safety_pattern_1, tvb, dl_map_offset, 4, FALSE); + /* display the Subchannel pattern */ + proto_tree_add_item(tree, hf_format_config_ie_subchannel_type_1, tvb, dl_map_offset, 4, FALSE); + /* display the max logical bands */ + proto_tree_add_item(tree, hf_format_config_ie_max_logical_bands_1, tvb, dl_map_offset, 4, FALSE); + /* display the number of broadcast symbols */ + proto_tree_add_item(tree, hf_format_config_ie_num_of_broadcast_symbol_1, tvb, dl_map_offset, 4, FALSE); + /* display the number of dl band AMC symbols */ + proto_tree_add_item(tree, hf_format_config_ie_num_of_dl_band_amc_symbol_1, tvb, dl_map_offset, 4, FALSE); + /* display the number of ul band AMC symbols */ + proto_tree_add_item(tree, hf_format_config_ie_num_of_ul_band_amc_symbol_1, tvb, dl_map_offset, 4, FALSE); + /* update the length in nibble */ + length = 8; + /* Get the next 32-bit word */ + tvb_value = tvb_get_ntohl(tvb, dl_map_offset); + /* get the CID type */ + cid_type = ((tvb_value & CID_TYPE_MASK_1) >> CID_TYPE_SHIFT_1); + /* get the subchannel type for band AMC */ + band_amc_subchannel_type = ((tvb_value & BAND_AMC_SUBCHANNEL_TYPE_MASK_1) >> BAND_AMC_SUBCHANNEL_TYPE_SHIFT_1); + /* get the max logical bands */ + max_logical_bands = ((tvb_value & MAX_LOGICAL_BANDS_MASK_1) >> MAX_LOGICAL_BANDS_SHIFT_1); + /* get the number of symbols for broadcast */ + num_of_broadcast_symbols = ((tvb_value & NUM_BROADCAST_SYMBOLS_MASK_1) >> NUM_BROADCAST_SYMBOLS_SHIFT_1); + /* get the number of symbols for DL band AMC */ + num_of_dl_band_amc_symbols = ((tvb_value & NUM_DL_AMC_SYMBOLS_MASK_1) >> NUM_DL_AMC_SYMBOLS_SHIFT_1); + /* get the number of symbols for UL band AMC */ + num_of_ul_band_amc_symbols = (tvb_value & NUM_UL_AMC_SYMBOLS_MASK_1); + } + else + { /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_format_config_ie_dl_map_type, tvb, dl_map_offset, 1, FALSE); + /* display the New format Indication */ + proto_tree_add_item(tree, hf_format_config_ie_new_format_indication, tvb, dl_map_offset, 1, FALSE); + /* update the length in nibble */ + length = 1; + } + } + /* return the IE length in nibbles */ + return length; +} + +/* Compact DL-MAP Reduced CID IE (6.3.2.3.43.3) decoder */ +static guint wimax_compact_dlmap_rcid_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint length = 0; + guint prefix; + + UNREFERENCED_PARAMETER(pinfo); + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RCID IE"); + } +#endif + if(nibble_offset & 1) + { + if(cid_type == CID_TYPE_NORMAL) + { /* display the normal CID */ + proto_tree_add_item(tree, hf_harq_rcid_ie_normal_cid_1, tvb, offset, 3, FALSE); + length = 4; + } + else + { /* Get the prefix bit */ + prefix = (tvb_get_guint8(tvb, offset) & 0x08); + /* display the prefix */ + proto_tree_add_item(tree, hf_harq_rcid_ie_prefix_1, tvb, offset, 2, FALSE); + if(prefix) + { /* display the CID11 */ + proto_tree_add_item(tree, hf_harq_rcid_ie_cid11_3, tvb, offset, 2, FALSE); + length = 3; + } + else + { + if(cid_type == CID_TYPE_RCID11) + { /* display the CID11 */ + proto_tree_add_item(tree, hf_harq_rcid_ie_cid11_1, tvb, offset, 2, FALSE); + length = 3; + } + else if(cid_type == CID_TYPE_RCID7) + { /* display the normal CID7 */ + proto_tree_add_item(tree, hf_harq_rcid_ie_cid7_1, tvb, offset, 2, FALSE); + length = 2; + } + else if(cid_type == CID_TYPE_RCID3) + { /* display the CID3 */ + proto_tree_add_item(tree, hf_harq_rcid_ie_cid3_1, tvb, offset, 2, FALSE); + length = 1; + } + } + } + } + else + { + if(cid_type == CID_TYPE_NORMAL) + { /* display the normal CID */ + proto_tree_add_item(tree, hf_harq_rcid_ie_normal_cid, tvb, offset, 2, FALSE); + length = 4; + } + else + { /* Get the prefix bit */ + prefix = (tvb_get_guint8(tvb, offset) & 0x08); + /* display the prefix */ + proto_tree_add_item(tree, hf_harq_rcid_ie_prefix, tvb, offset, 2, FALSE); + if(prefix || (cid_type == CID_TYPE_RCID11)) + { /* display the CID11 */ + proto_tree_add_item(tree, hf_harq_rcid_ie_cid11_2, tvb, offset, 2, FALSE); + length = 3; + } + else + { + if(cid_type == CID_TYPE_RCID11) + { /* display the CID11 */ + proto_tree_add_item(tree, hf_harq_rcid_ie_cid11, tvb, offset, 2, FALSE); + length = 3; + } + else if(cid_type == CID_TYPE_RCID7) + { /* display the CID7 */ + proto_tree_add_item(tree, hf_harq_rcid_ie_cid7, tvb, offset, 2, FALSE); + length = 2; + } + else if(cid_type == CID_TYPE_RCID3) + { /* display the CID3 */ + proto_tree_add_item(tree, hf_harq_rcid_ie_cid3, tvb, offset, 2, FALSE); + length = 1; + } + } + } + } + /* return the IE length in nibbles */ + return length; +} + +/* Compact DL-MAP HARQ Control IE (6.3.2.3.43.4) decoder */ +static guint wimax_compact_dlmap_harq_control_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint byte, prefix, length = 0; + + UNREFERENCED_PARAMETER(pinfo); + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "HARQ Control IE"); + } +#endif + /* Get the first byte */ + byte = tvb_get_guint8(tvb, offset); + if(nibble_offset & 1) + { /* Get the prefix bit */ + prefix = (byte & 0x08); + /* display the prefix */ + proto_tree_add_item(tree, hf_harq_control_ie_prefix_1, tvb, offset, 2, FALSE); + if(prefix) + { /* display the ai_sn */ + proto_tree_add_item(tree, hf_harq_control_ie_ai_sn_1, tvb, offset, 2, FALSE); + /* display the spid */ + proto_tree_add_item(tree, hf_harq_control_ie_spid_1, tvb, offset, 2, FALSE); + /* display the acid */ + proto_tree_add_item(tree, hf_harq_control_ie_acid_1, tvb, offset, 2, FALSE); + length = 2; + } + else + { /* display the reserved bits */ + proto_tree_add_item(tree, hf_harq_control_ie_reserved_1, tvb, offset, 2, FALSE); + length = 1; + } + } + else + { /* Get the prefix bit */ + prefix = (byte & 0x80); + /* display the prefix */ + proto_tree_add_item(tree, hf_harq_control_ie_prefix, tvb, offset, 1, FALSE); + if(prefix) + { /* display the ai_sn */ + proto_tree_add_item(tree, hf_harq_control_ie_ai_sn, tvb, offset, 1, FALSE); + /* display the spid */ + proto_tree_add_item(tree, hf_harq_control_ie_spid, tvb, offset, 1, FALSE); + /* display the acid */ + proto_tree_add_item(tree, hf_harq_control_ie_acid, tvb, offset, 1, FALSE); + length = 2; + } + else + { /* display the reserved bits */ + proto_tree_add_item(tree, hf_harq_control_ie_reserved, tvb, offset, 1, FALSE); + length = 1; + } + } + /* return the IE length in nibbles */ + return length; +} + +/* Compact DL-MAP CQICH Control IE (6.3.2.3.43.5) decoder */ +static guint wimax_compact_dlmap_cqich_control_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint byte, cqich_indicator, length = 0; + + UNREFERENCED_PARAMETER(pinfo); + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "CQICH Control IE"); + } +#endif + /* Get the first byte */ + byte = tvb_get_guint8(tvb, offset); + if(nibble_offset & 1) + { /* Get the CQICH indicator */ + cqich_indicator = (byte & 0x08); + if(cqich_indicator) + { /* display the CQICH indicator */ + proto_tree_add_item(tree, hf_cqich_control_ie_indicator_1, tvb, offset, 3, FALSE); + /* display the allocation index */ + proto_tree_add_item(tree, hf_cqich_control_ie_alloc_id_1, tvb, offset, 3, FALSE); + /* display the period */ + proto_tree_add_item(tree, hf_cqich_control_ie_period_1, tvb, offset, 3, FALSE); + /* display the frame offset */ + proto_tree_add_item(tree, hf_cqich_control_ie_frame_offset_1, tvb, offset, 3, FALSE); + /* display the duration */ + proto_tree_add_item(tree, hf_cqich_control_ie_duration_1, tvb, offset, 3, FALSE); + length = 4; + } + else + { /* display the CQICH indicator */ + proto_tree_add_item(tree, hf_cqich_control_ie_indicator_1, tvb, offset, 1, FALSE); + /* display the CQI reporting threshold */ + proto_tree_add_item(tree, hf_cqich_control_ie_cqi_rep_threshold_1, tvb, offset, 1, FALSE); + length = 1; + } + } + else + { /* Get the CQICH indicator */ + cqich_indicator = (byte & 0x80); + if(cqich_indicator) + { /* display the CQICH indicator */ + proto_tree_add_item(tree, hf_cqich_control_ie_indicator, tvb, offset, 2, FALSE); + /* display the allocation index */ + proto_tree_add_item(tree, hf_cqich_control_ie_alloc_id, tvb, offset, 2, FALSE); + /* display the period */ + proto_tree_add_item(tree, hf_cqich_control_ie_period, tvb, offset, 2, FALSE); + /* display the frame offset */ + proto_tree_add_item(tree, hf_cqich_control_ie_frame_offset, tvb, offset, 2, FALSE); + /* display the duration */ + proto_tree_add_item(tree, hf_cqich_control_ie_duration, tvb, offset, 2, FALSE); + length = 4; + } + else + { /* display the CQICH indicator */ + proto_tree_add_item(tree, hf_cqich_control_ie_indicator, tvb, offset, 1, FALSE); + /* display the CQI reporting threshold */ + proto_tree_add_item(tree, hf_cqich_control_ie_cqi_rep_threshold, tvb, offset, 1, FALSE); + length = 1; + } + } + /* return the IE length in nibbles */ + return length; +} + +/* DL-MAP Extension IE sub-types */ +#define TIME_DIVERSITY_MBS 0 +#define HARQ_MODE_SWITCH 1 + +/* Compact DL-MAP Extension IE (6.3.2.3.43.6.6) decoder */ +static guint wimax_cdlmap_extension_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint tvb_value, dl_map_type, sub_type, length; + + UNREFERENCED_PARAMETER(pinfo); + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DL-MAP Extension IE"); + } +#endif + /* Get the first 16-bit word */ + tvb_value = tvb_get_ntohs(tvb, offset); + if(nibble_offset & 1) + { /* Get the dl-map type */ + dl_map_type = ((tvb_value & 0x0E00) >> 9); + if(dl_map_type != COMPACT_DL_MAP_TYPE_EXTENSION) + return 0; + /* Get the sub-type */ + sub_type = ((tvb_value & 0x01F0) >> 4); + /* Get the IE length */ + length = (tvb_value & 0x000F); + /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_extension_type_1, tvb, offset, 2, FALSE); + /* display the DL-MAP extension subtype */ + proto_tree_add_item(tree, hf_cdlmap_extension_subtype_1, tvb, offset, 2, FALSE); + /* display the IE length */ + proto_tree_add_item(tree, hf_cdlmap_extension_length_1, tvb, offset, 2, FALSE); + offset += 2; + switch (sub_type) + { + case TIME_DIVERSITY_MBS: + /* display the time-diversity MBS in HEX */ + proto_tree_add_item(tree, hf_cdlmap_extension_time_diversity_mbs_1, tvb, offset, (length - 2), FALSE); + break; + case HARQ_MODE_SWITCH: + /* display the HARQ mode */ + proto_tree_add_item(tree, hf_cdlmap_extension_harq_mode, tvb, offset, 1, FALSE); + /* Get the next byte */ + tvb_value = tvb_get_guint8(tvb, offset); + /* get the HARQ mode */ + harq_mode = ((tvb_value & MSB_NIBBLE_MASK) >> 4); + break; + default: + /* display the unknown sub-type in HEX */ + proto_tree_add_item(tree, hf_cdlmap_extension_unknown_sub_type_1, tvb, offset, (length - 2), FALSE); + break; + } + } + else + { /* Get the dl-map type */ + dl_map_type = ((tvb_value & 0xE000) >> 13); + if(dl_map_type != COMPACT_DL_MAP_TYPE_EXTENSION) + return 0; + /* Get the sub-type */ + sub_type = ((tvb_value & 0x1F00) >> 8); + /* Get the IE length */ + length = ((tvb_value & 0x00F0) >> 4); + /* display the DL-MAP type */ + proto_tree_add_item(tree, hf_cdlmap_extension_type, tvb, offset, 2, FALSE); + /* display the DL-MAP extension subtype */ + proto_tree_add_item(tree, hf_cdlmap_extension_subtype, tvb, offset, 2, FALSE); + /* display the IE length */ + proto_tree_add_item(tree, hf_cdlmap_extension_length, tvb, offset, 2, FALSE); + switch (sub_type) + { + case TIME_DIVERSITY_MBS: + /* display the time-diversity MBS in HEX */ + proto_tree_add_item(tree, hf_cdlmap_extension_time_diversity_mbs, tvb, (offset + 1), (length - 1), FALSE); + break; + case HARQ_MODE_SWITCH: + /* display the HARQ mode */ + proto_tree_add_item(tree, hf_cdlmap_extension_harq_mode_1, tvb, offset, 2, FALSE); + /* get the HARQ mode */ + harq_mode = (tvb_value & 0x000F); + break; + default: + /* display the unknown sub-type in HEX */ + proto_tree_add_item(tree, hf_cdlmap_extension_unknown_sub_type, tvb, (offset + 1), (length - 1), FALSE); + break; + } + } + /* return the IE length in nibbles */ + return (length * 2); +} + +/* Extended DIUCs (table 277a) */ +#define CHANNEL_MEASUREMENT_IE 0 +#define STC_ZONE_IE 1 +#define AAS_DL_IE 2 +#define DATA_LOCATION_IN_ANOTHER_BS_IE 3 +#define CID_SWITCH_IE 4 +#define MIMO_DL_BASIC_IE 5 +#define MIMO_DL_ENHANCED_IE 6 +#define HARQ_MAP_POINTER_IE 7 +#define PHYMOD_DL_IE 8 +#define DL_PUSC_BURST_ALLOCATION_IN_OTHER_SEGMENT_IE 11 +#define UL_INTERFERENCE_AND_NOISE_LEVEL_IE 15 + +/* Extended DIUC IE (8.4.5.3.2) */ +guint wimax_extended_diuc_dependent_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint ext_diuc, length; + guint8 byte; + + UNREFERENCED_PARAMETER(pinfo); + + /* get the first byte */ + byte = tvb_get_guint8(tvb, offset); + if(nibble_offset & 1) + { /* get the extended DIUC */ + ext_diuc = (byte & LSB_NIBBLE_MASK); + /* display extended DIUC */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_diuc_1, tvb, offset, 1, FALSE); + /* move to next byte */ + offset++; + /* get the 2nd byte */ + byte = tvb_get_guint8(tvb, offset); + /* get the length */ + length = ((byte & MSB_NIBBLE_MASK) >> 4); + /* display extended DIUC length */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_length, tvb, offset, 1, FALSE); + /* 8.4.5.3.2.1 (table 277a) */ + switch (ext_diuc) + { + case CHANNEL_MEASUREMENT_IE: + /* 8.4.5.3.? Channel_Measurement_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_channel_measurement, tvb, offset, (length + 1), FALSE); + break; + case STC_ZONE_IE: + /* 8.4.5.3.4 STC_Zone_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_stc_zone, tvb, offset, (length + 1), FALSE); + break; + case AAS_DL_IE: + /* 8.4.5.3.3 AAS_DL_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_aas_dl, tvb, offset, (length + 1), FALSE); + break; + case DATA_LOCATION_IN_ANOTHER_BS_IE: + /* 8.4.5.3.6 Data_location_in_another_BS_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_data_location, tvb, offset, (length + 1), FALSE); + break; + case CID_SWITCH_IE: + /* 8.4.5.3.7 CID_Switch_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_cid_switch, tvb, offset, (length + 1), FALSE); + break; + case MIMO_DL_BASIC_IE: + /* 8.4.5.3.8 MIMO_DL_Basic_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_mimo_dl_basic, tvb, offset, (length + 1), FALSE); + break; + case MIMO_DL_ENHANCED_IE: + /* 8.4.5.3.9 MIMO_DL_Enhanced_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_mimo_dl_enhanced, tvb, offset, (length + 1), FALSE); + break; + case HARQ_MAP_POINTER_IE: + /* 8.4.5.3.10 HARQ_Map_Pointer_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_harq_map_pointer, tvb, offset, (length + 1), FALSE); + break; + case PHYMOD_DL_IE: + /* 8.4.5.3.11 PHYMOD_DL_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_phymod_dl, tvb, offset, (length + 1), FALSE); + break; + case DL_PUSC_BURST_ALLOCATION_IN_OTHER_SEGMENT_IE: + /* 8.4.5.3.13 DL PUSC Burst Allocation in Other Segment IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_dl_pusc_burst_allocation, tvb, offset, (length + 1), FALSE); + break; + case UL_INTERFERENCE_AND_NOISE_LEVEL_IE: + /* 8.4.5.3.19 UL_interference_and_noise_level_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_ul_interference_and_noise_level, tvb, offset, (length + 1), FALSE); + break; + default: + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_unknown_diuc, tvb, offset, (length + 1), FALSE); + break; + } + } + else + { /* get the extended DIUC */ + ext_diuc = ((byte & MSB_NIBBLE_MASK) >> 4); + /* get the length */ + length = (byte & LSB_NIBBLE_MASK); + /* display extended DIUC */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_diuc, tvb, offset, 1, FALSE); + /* display extended DIUC length */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_length_1, tvb, offset, 1, FALSE); + /* move to next byte */ + offset++; + /* 8.4.5.3.2.1 (table 277a) */ + switch (ext_diuc) + { + case CHANNEL_MEASUREMENT_IE: + /* 8.4.5.3.? Channel_Measurement_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_channel_measurement, tvb, offset, length, FALSE); + break; + case STC_ZONE_IE: + /* 8.4.5.3.4 STC_Zone_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_stc_zone, tvb, offset, length, FALSE); + break; + case AAS_DL_IE: + /* 8.4.5.3.3 AAS_DL_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_aas_dl, tvb, offset, length, FALSE); + break; + case DATA_LOCATION_IN_ANOTHER_BS_IE: + /* 8.4.5.3.6 Data_location_in_another_BS_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_data_location, tvb, offset, length, FALSE); + break; + case CID_SWITCH_IE: + /* 8.4.5.3.7 CID_Switch_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_cid_switch, tvb, offset, length, FALSE); + break; + case MIMO_DL_BASIC_IE: + /* 8.4.5.3.8 MIMO_DL_Basic_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_mimo_dl_basic, tvb, offset, length, FALSE); + break; + case MIMO_DL_ENHANCED_IE: + /* 8.4.5.3.9 MIMO_DL_Enhanced_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_mimo_dl_enhanced, tvb, offset, length, FALSE); + break; + case HARQ_MAP_POINTER_IE: + /* 8.4.5.3.10 HARQ_Map_Pointer_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_harq_map_pointer, tvb, offset, length, FALSE); + break; + case PHYMOD_DL_IE: + /* 8.4.5.3.11 PHYMOD_DL_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_phymod_dl, tvb, offset, length, FALSE); + break; + case DL_PUSC_BURST_ALLOCATION_IN_OTHER_SEGMENT_IE: + /* 8.4.5.3.13 DL PUSC Burst Allocation in Other Segment IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_dl_pusc_burst_allocation, tvb, offset, length, FALSE); + break; + case UL_INTERFERENCE_AND_NOISE_LEVEL_IE: + /* 8.4.5.3.19 UL_interference_and_noise_level_IE */ + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_ul_interference_and_noise_level, tvb, offset, length, FALSE); + break; + default: + proto_tree_add_item(tree, hf_extended_diuc_dependent_ie_unknown_diuc, tvb, offset, length, FALSE); + break; + } + } + return ((length + 1) * 2 ); /* length in nibbles */ + +} diff --git a/plugins/wimax/wimax_compact_ulmap_ie_decoder.c b/plugins/wimax/wimax_compact_ulmap_ie_decoder.c new file mode 100644 index 0000000000..7c44b1459e --- /dev/null +++ b/plugins/wimax/wimax_compact_ulmap_ie_decoder.c @@ -0,0 +1,2140 @@ +/* wimax_compact_ulmap_ie_decoder.c + * WiMax Compact UL-MAP IE decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" + +/* MASKs */ +#define MSB_NIBBLE_MASK 0xF0 +#define LSB_NIBBLE_MASK 0x0F + +#define CID_TYPE_NORMAL 0 +#define CID_TYPE_RCID11 1 +#define CID_TYPE_RCID7 2 +#define CID_TYPE_RCID3 3 + +/* Global Variables */ +extern guint cid_type; +extern guint band_amc_subchannel_type; +extern guint max_logical_bands; +extern guint num_of_broadcast_symbols; +extern guint num_of_dl_band_amc_symbols; +extern guint num_of_ul_band_amc_symbols; +extern guint harq_mode; +extern gint proto_wimax; + +/* forward reference */ +guint wimax_cdma_allocation_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +guint wimax_extended_uiuc_dependent_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +static guint wimax_compact_ulmap_rcid_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +static guint wimax_compact_ulmap_harq_control_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +static guint wimax_culmap_extension_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); + +static gint proto_wimax_compact_ulmap_ie_decoder = -1; +static gint ett_wimax_compact_ulmap_ie_decoder = -1; +static gint ett_wimax_rcid_ie_decoder = -1; +static gint ett_wimax_harq_control_ie_decoder = -1; +static gint ett_wimax_extended_uiuc_dependent_ie_decoder = -1; +static gint ett_wimax_extension_type_ie_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_compact_ulmap_ie_decoder, + &ett_wimax_rcid_ie_decoder, + &ett_wimax_harq_control_ie_decoder, + &ett_wimax_extended_uiuc_dependent_ie_decoder, + &ett_wimax_extension_type_ie_decoder, +}; + +/* Prefixes */ +static const true_false_string tfs_prefix = +{ + "Enable HARQ", + "Temporary Disable HARQ" +}; + +/* Region Changes */ +static const true_false_string tfs_region_change = +{ + "Region Changed", + "No Region Change" +}; + +/* Region Changes */ +static const true_false_string tfs_yes_no_ie = +{ + "Yes", + "No" +}; + +/* Repetition Coding Indications */ +static const value_string vals_repetitions[] = +{ + { 0, "No Repetition Coding" }, + { 1, "Repetition Coding of 2 Used" }, + { 2, "Repetition Coding of 4 Used" }, + { 3, "Repetition Coding of 6 Used" }, + { 0, NULL } +}; + +/* Allocation Modes */ +static const value_string vals_allocation_modes[] = +{ + { 0, "Same Number Of Subchannels For The Selected Bands" }, + { 1, "Different Same Number Of Subchannels For The Selected Bands" }, + { 2, "Total Number Of Subchannels For The Selected Bands Determined by Nsch Code and Nep Code" }, + { 3, "Reserved" }, + { 0, NULL } +}; + +/* CTypes */ +static const value_string vals_ctypes[] = +{ + { 0, "2 Mini-subchannels (defines M=2)" }, + { 1, "2 Mini-subchannels (defines M=2)" }, + { 2, "3 Mini-subchannels (defines M=3)" }, + { 3, "6 Mini-subchannels (defines M=6)" }, + { 0, NULL } +}; + +/* Masks */ +#define UL_MAP_TYPE_MASK 0xE0 +#define UL_MAP_RESERVED_MASK 0x10 +#define SHORTENED_UIUC_MASK 0xE0 +#define COMPANDED_SC_MASK 0x1F +#define UL_MAP_TYPE_MASK_1 0x0E +#define UL_MAP_RESERVED_MASK_1 0x01 +#define SHORTENED_UIUC_MASK_1 0x0E00 +#define COMPANDED_SC_MASK_1 0x01F0 +#define MIDDLE_BYTE_MASK 0x0FF0 + +#define ALLOCATION_MODE_MASK 0xC0 +#define ALLOCATION_MODE_MASK_1 0x0C + +/* display indexies */ +static gint hf_culmap_ul_map_type = -1; +static gint hf_culmap_reserved = -1; +static gint hf_culmap_nep_code = -1; +static gint hf_culmap_nsch_code = -1; +static gint hf_culmap_num_bands = -1; +static gint hf_culmap_band_index = -1; +static gint hf_culmap_nb_bitmap = -1; +static gint hf_culmap_ul_map_type_1 = -1; +static gint hf_culmap_reserved_1 = -1; +static gint hf_culmap_nep_code_1 = -1; +static gint hf_culmap_nsch_code_1 = -1; +static gint hf_culmap_num_bands_1 = -1; +//static gint hf_culmap_band_index_1 = -1; +static gint hf_culmap_nb_bitmap_1 = -1; + +static gint hf_culmap_shortened_uiuc = -1; +static gint hf_culmap_companded_sc = -1; +static gint hf_culmap_shortened_uiuc_1 = -1; +static gint hf_culmap_companded_sc_1 = -1; + +static gint hf_culmap_bin_offset = -1; +static gint hf_culmap_bin_offset_1 = -1; + +static gint hf_culmap_uiuc_ofdma_symbol_offset = -1; +static gint hf_culmap_uiuc_ofdma_symbol_offset_1 = -1; +static gint hf_culmap_uiuc_subchannel_offset_7 = -1; +static gint hf_culmap_uiuc_num_of_ofdma_symbols_7 = -1; +static gint hf_culmap_uiuc_num_of_subchannels_7 = -1; +static gint hf_culmap_uiuc_ranging_method = -1; +static gint hf_culmap_uiuc_reserved = -1; +static gint hf_culmap_uiuc_subchannel_offset_7_1 = -1; +static gint hf_culmap_uiuc_num_of_ofdma_symbols_7_1 = -1; +static gint hf_culmap_uiuc_num_of_subchannels_7_1 = -1; +static gint hf_culmap_uiuc_ranging_method_1 = -1; +static gint hf_culmap_uiuc_reserved_1 = -1; +static gint hf_culmap_uiuc_repetition_coding_indication = -1; +static gint hf_culmap_uiuc_repetition_coding_indication_1 = -1; +static gint hf_culmap_uiuc_reserved1 = -1; +static gint hf_culmap_uiuc_reserved11_1 = -1; +static gint hf_culmap_uiuc_subchannel_offset = -1; +static gint hf_culmap_uiuc_subchannel_offset_1 = -1; +static gint hf_culmap_uiuc_num_of_ofdma_symbols = -1; +static gint hf_culmap_uiuc_num_of_ofdma_symbols_1 = -1; +static gint hf_culmap_uiuc_num_of_subchannels = -1; +static gint hf_culmap_uiuc_num_of_subchannels_1 = -1; + +static gint hf_culmap_harq_region_change_indication = -1; +static gint hf_culmap_harq_region_change_indication_1 = -1; +static gint hf_culmap_cqi_region_change_indication = -1; +static gint hf_culmap_cqi_region_change_indication_1 = -1; + +static gint hf_culmap_uiuc = -1; +static gint hf_culmap_uiuc_1 = -1; + +static gint hf_culmap_allocation_mode = -1; +static gint hf_culmap_allocation_mode_rsvd = -1; +static gint hf_culmap_num_subchannels = -1; +static gint hf_culmap_allocation_mode_1 = -1; +static gint hf_culmap_allocation_mode_rsvd_1 = -1; +static gint hf_culmap_num_subchannels_1 = -1; + +static gint hf_culmap_reserved_type = -1; +static gint hf_culmap_reserved_type_1 = -1; + +/* Compact UL-MAP IE display */ +static hf_register_info hf_compact_ulmap[] = +{ + { + &hf_culmap_ul_map_type, + {"UL-MAP Type", "wimax.compact_ulmap.ul_map_type", FT_UINT8, BASE_DEC, NULL, UL_MAP_TYPE_MASK, "", HFILL} + }, + { + &hf_culmap_ul_map_type_1, + {"UL-MAP Type", "wimax.compact_ulmap.ul_map_type", FT_UINT8, BASE_DEC, NULL, UL_MAP_TYPE_MASK_1, "", HFILL} + }, + { + &hf_culmap_reserved, + {"Reserved", "wimax.compact_ulmap.reserved", FT_UINT8, BASE_HEX, NULL, UL_MAP_RESERVED_MASK, "", HFILL} + }, + { + &hf_culmap_reserved_1, + {"Reserved", "wimax.compact_ulmap.reserved", FT_UINT8, BASE_HEX, NULL, UL_MAP_RESERVED_MASK_1, "", HFILL} + }, + { + &hf_culmap_nep_code, + {"Nep Code", "wimax.compact_ulmap.nep_code", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_nep_code_1, + {"Nep Code", "wimax.compact_ulmap.nep_code", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_nsch_code, + {"Nsch Code", "wimax.compact_ulmap.nsch_code", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_nsch_code_1, + {"Nsch Code", "wimax.compact_ulmap.nsch_code", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_shortened_uiuc, + {"Shortened UIUC", "wimax.compact_ulmap.shortened_uiuc", FT_UINT8, BASE_HEX, NULL, SHORTENED_UIUC_MASK, "", HFILL} + }, + { + &hf_culmap_companded_sc, + {"Companded SC", "wimax.compact_ulmap.companded_sc", FT_UINT8, BASE_HEX, NULL, COMPANDED_SC_MASK, "", HFILL} + }, + { + &hf_culmap_shortened_uiuc_1, + {"Shortened UIUC", "wimax.compact_ulmap.shortened_uiuc", FT_UINT16, BASE_HEX, NULL, SHORTENED_UIUC_MASK_1, "", HFILL} + }, + { + &hf_culmap_companded_sc_1, + {"Companded SC", "wimax.compact_ulmap.companded_sc", FT_UINT16, BASE_HEX, NULL, COMPANDED_SC_MASK_1, "", HFILL} + }, + { + &hf_culmap_num_bands, + {"Number Of Bands", "wimax.compact_ulmap.num_bands", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_num_bands_1, + {"Number Of Bands", "wimax.compact_ulmap.num_bands", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_band_index, + {"Band Index", "wimax.compact_ulmap.band_index", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_nb_bitmap, + {"Number Of Bits For Band BITMAP", "wimax.compact_ulmap.nb_bitmap", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_nb_bitmap_1, + {"Number Of Bits For Band BITMAP", "wimax.compact_ulmap.nb_bitmap", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_allocation_mode, + {"Allocation Mode", "wimax.compact_ulmap.allocation_mode", FT_UINT8, BASE_DEC, VALS(vals_allocation_modes), ALLOCATION_MODE_MASK, "", HFILL} + }, + { + &hf_culmap_allocation_mode_1, + {"Allocation Mode", "wimax.compact_ulmap.allocation_mode", FT_UINT8, BASE_DEC, VALS(vals_allocation_modes), ALLOCATION_MODE_MASK_1, "", HFILL} + }, + { + &hf_culmap_allocation_mode_rsvd, + {"Reserved", "wimax.compact_ulmap.allocation_mode_rsvd", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL} + }, + { + &hf_culmap_allocation_mode_rsvd_1, + {"Reserved", "wimax.compact_ulmap.allocation_mode_rsvd", FT_UINT8, BASE_DEC, NULL, 0x03, "", HFILL} + }, + { + &hf_culmap_num_subchannels, + {"Number Of Subchannels", "wimax.compact_ulmap.num_subchannels", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_num_subchannels_1, + {"Number Of Subchannels", "wimax.compact_ulmap.num_subchannels", FT_UINT16, BASE_DEC, NULL, MIDDLE_BYTE_MASK, "", HFILL} + }, + { + &hf_culmap_bin_offset, + {"BIN Offset", "wimax.compact_ulmap.bin_offset", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_bin_offset_1, + {"BIN Offset", "wimax.compact_ulmap.bin_offset", FT_UINT16, BASE_HEX, NULL, MIDDLE_BYTE_MASK, "", HFILL} + }, + { + &hf_culmap_uiuc, + {"UIUC", "wimax.compact_ulmap.uiuc", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_uiuc_1, + {"UIUC", "wimax.compact_ulmap.uiuc", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_uiuc_ofdma_symbol_offset, + {"OFDMA Symbol Offset", "wimax.compact_ulmap.uiuc_ofdma_symbol_offset", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_uiuc_ofdma_symbol_offset_1, + {"OFDMA Symbol Offset", "wimax.compact_ulmap.uiuc_ofdma_symbol_offset", FT_UINT16, BASE_DEC, NULL, MIDDLE_BYTE_MASK, "", HFILL} + }, + { + &hf_culmap_uiuc_subchannel_offset_7, + {"Subchannel Offset", "wimax.compact_ulmap.uiuc_subchannel_offset", FT_UINT24, BASE_DEC, NULL, 0xFE0000, "", HFILL} + }, + { + &hf_culmap_uiuc_num_of_ofdma_symbols_7, + {"Number Of OFDMA Symbols", "wimax.compact_ulmap.uiuc_num_of_ofdma_symbols", FT_UINT24, BASE_DEC, NULL, 0x01FC00, "", HFILL} + }, + { + &hf_culmap_uiuc_num_of_subchannels_7, + {"Number Of Subchannels", "wimax.compact_ulmap.uiuc_num_of_subchannels", FT_UINT24, BASE_DEC, NULL, 0x0003F8, "", HFILL} + }, + { + &hf_culmap_uiuc_ranging_method, + {"Ranging Method", "wimax.compact_ulmap.uiuc_ranging_method", FT_UINT24, BASE_DEC, NULL, 0x000006, "", HFILL} + }, + { + &hf_culmap_uiuc_reserved, + {"Reserved", "wimax.compact_ulmap.uiuc_reserved", FT_UINT24, BASE_HEX, NULL, 0x000001, "", HFILL} + }, + { + &hf_culmap_uiuc_subchannel_offset_7_1, + {"Subchannel Offset", "wimax.compact_ulmap.uiuc_subchannel_offset", FT_UINT32, BASE_DEC, NULL, 0x00FE0000, "", HFILL} + }, + { + &hf_culmap_uiuc_num_of_ofdma_symbols_7_1, + {"Number Of OFDMA Symbols", "wimax.compact_ulmap.uiuc_num_of_ofdma_symbols", FT_UINT32, BASE_DEC, NULL, 0x0001FC00, "", HFILL} + }, + { + &hf_culmap_uiuc_num_of_subchannels_7_1, + {"Number Of Subchannels", "wimax.compact_ulmap.uiuc_num_of_subchannels", FT_UINT32, BASE_DEC, NULL, 0x000003F80, "", HFILL} + }, + { + &hf_culmap_uiuc_ranging_method_1, + {"Ranging Method", "wimax.compact_ulmap.uiuc_ranging_method", FT_UINT32, BASE_DEC, NULL, 0x00000006, "", HFILL} + }, + { + &hf_culmap_uiuc_reserved_1, + {"Reserved", "wimax.compact_ulmap.uiuc_reserved", FT_UINT32, BASE_HEX, NULL, 0x00000001, "", HFILL} + }, + { + &hf_culmap_uiuc_repetition_coding_indication, + {"Repetition Coding Indication", "wimax.compact_ulmap.uiuc_repetition_coding_indication", FT_UINT8, BASE_DEC, VALS(vals_repetitions), ALLOCATION_MODE_MASK, "", HFILL} + }, + { + &hf_culmap_uiuc_repetition_coding_indication_1, + {"Repetition Coding Indication", "wimax.compact_ulmap.uiuc_repetition_coding_indication", FT_UINT8, BASE_DEC, VALS(vals_repetitions), ALLOCATION_MODE_MASK_1, "", HFILL} + }, + { + &hf_culmap_uiuc_reserved1, + {"Reserved", "wimax.compact_ulmap.uiuc_reserved1", FT_UINT8, BASE_HEX, NULL, 0x30, "", HFILL} + }, + { + &hf_culmap_uiuc_reserved11_1, + {"Reserved", "wimax.compact_ulmap.uiuc_reserved1", FT_UINT8, BASE_HEX, NULL, 0x03, "", HFILL} + }, + + { + &hf_culmap_uiuc_subchannel_offset, + {"Subchannel Offset", "wimax.compact_ulmap.uiuc_subchannel_offset", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_uiuc_subchannel_offset_1, + {"Subchannel Offset", "wimax.compact_ulmap.uiuc_subchannel_offset", FT_UINT16, BASE_DEC, NULL, MIDDLE_BYTE_MASK, "", HFILL} + }, + { + &hf_culmap_uiuc_num_of_ofdma_symbols, + {"Number Of OFDMA Symbols", "wimax.compact_ulmap.uiuc_num_of_ofdma_symbols", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_uiuc_num_of_ofdma_symbols_1, + {"Number Of OFDMA Symbols", "wimax.compact_ulmap.uiuc_num_of_ofdma_symbols", FT_UINT16, BASE_DEC, NULL, MIDDLE_BYTE_MASK, "", HFILL} + }, + { + &hf_culmap_uiuc_num_of_subchannels, + {"Number Of Subchannels", "wimax.compact_ulmap.uiuc_num_of_subchannels", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_uiuc_num_of_subchannels_1, + {"Number Of Subchannels", "wimax.compact_ulmap.uiuc_num_of_subchannels", FT_UINT16, BASE_DEC, NULL, MIDDLE_BYTE_MASK, "", HFILL} + }, + { + &hf_culmap_harq_region_change_indication, + {"HARQ Region Change Indication", "wimax.compact_ulmap.harq_region_change_indication", FT_BOOLEAN, 8, TFS(&tfs_region_change), 0x10, "", HFILL} + }, + { + &hf_culmap_harq_region_change_indication_1, + {"HARQ Region Change Indication", "wimax.compact_ulmap.harq_region_change_indication", FT_BOOLEAN, 8, TFS(&tfs_region_change), 0x01, "", HFILL} + }, + { + &hf_culmap_cqi_region_change_indication, + {"CQI Region Change Indication", "wimax.compact_ulmap.cqi_region_change_indication", FT_BOOLEAN, 8, TFS(&tfs_region_change), 0x10, "", HFILL} + }, + { + &hf_culmap_cqi_region_change_indication_1, + {"CQI Region Change Indication", "wimax.compact_ulmap.cqi_region_change_indication", FT_BOOLEAN, 8, TFS(&tfs_region_change), 0x01, "", HFILL} + }, + { + &hf_culmap_reserved_type, + {"UL-MAP Reserved Type", "wimax.compact_ulmap.reserved_type", FT_UINT8, BASE_DEC, NULL, UL_MAP_TYPE_MASK, "", HFILL} + }, + { + &hf_culmap_reserved_type_1, + {"UL-MAP Reserved Type", "wimax.compact_ulmap.reserved_type", FT_UINT8, BASE_DEC, NULL, UL_MAP_TYPE_MASK_1, "", HFILL} + } +}; + +/* display indexies */ +static gint hf_rcid_ie_prefix = -1; +static gint hf_rcid_ie_prefix_1 = -1; +static gint hf_rcid_ie_normal_cid = -1; +static gint hf_rcid_ie_normal_cid_1 = -1; +static gint hf_rcid_ie_cid3 = -1; +static gint hf_rcid_ie_cid3_1 = -1; +static gint hf_rcid_ie_cid7 = -1; +static gint hf_rcid_ie_cid7_1 = -1; +static gint hf_rcid_ie_cid11 = -1; +static gint hf_rcid_ie_cid11_1 = -1; +static gint hf_rcid_ie_cid11_2 = -1; +static gint hf_rcid_ie_cid11_3 = -1; + +/* Masks */ +#define WIMAX_RCID_IE_NORMAL_CID_MASK_1 0x0FFFF0 +#define WIMAX_RCID_IE_PREFIX_MASK 0x8000 +#define WIMAX_RCID_IE_PREFIX_MASK_1 0x0800 +#define WIMAX_RCID_IE_CID3_MASK 0x7000 +#define WIMAX_RCID_IE_CID3_MASK_1 0x0700 +#define WIMAX_RCID_IE_CID7_MASK 0x7F00 +#define WIMAX_RCID_IE_CID7_MASK_1 0x07F0 +#define WIMAX_RCID_IE_CID11_MASK 0x7FF0 +#define WIMAX_RCID_IE_CID11_MASK_1 0x07FF + +/* HARQ MAP Reduced CID IE display */ +static hf_register_info hf_rcid[] = +{ + { + &hf_rcid_ie_normal_cid, + {"Normal CID", "wimax.harq_map.rcid_ie.normal_cid", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_rcid_ie_normal_cid_1, + {"Normal CID", "wimax.harq_map.rcid_ie.normal_cid", FT_UINT24, BASE_HEX, NULL, WIMAX_RCID_IE_NORMAL_CID_MASK_1, "", HFILL} + }, + { + &hf_rcid_ie_prefix, + {"Prefix", "wimax.harq_map.rcid_ie.prefix", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_PREFIX_MASK, "", HFILL} + }, + { + &hf_rcid_ie_prefix_1, + {"Prefix", "wimax.harq_map.rcid_ie.prefix", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_PREFIX_MASK_1, "", HFILL} + }, + { + &hf_rcid_ie_cid3, + {"3 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid3", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID3_MASK, "", HFILL} + }, + { + &hf_rcid_ie_cid3_1, + {"3 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid3", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID3_MASK_1, "", HFILL} + }, + { + &hf_rcid_ie_cid7, + {"7 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid7", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID7_MASK, "", HFILL} + }, + { + &hf_rcid_ie_cid7_1, + {"7 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid7", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID7_MASK_1, "", HFILL} + }, + { + &hf_rcid_ie_cid11, + {"11 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid11", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID11_MASK, "", HFILL} + }, + { + &hf_rcid_ie_cid11_1, + {"11 LSB Of Basic CID", "wimax.harq_map.rcid_ie.cid11", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID11_MASK_1, "", HFILL} + }, + { + &hf_rcid_ie_cid11_2, + {"11 LSB Of Multicast, AAS or Broadcast CID", "wimax.harq_map.rcid_ie.cid11", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID11_MASK, "", HFILL} + }, + { + &hf_rcid_ie_cid11_3, + {"11 LSB Of Multicast, AAS or Broadcast CID", "wimax.harq_map.rcid_ie.cid11", FT_UINT16, BASE_HEX, NULL, WIMAX_RCID_IE_CID11_MASK_1, "", HFILL} + } +}; + +/* HARQ MAP HARQ Control IE display indexies */ +static gint hf_harq_control_ie_prefix = -1; +static gint hf_harq_control_ie_ai_sn = -1; +static gint hf_harq_control_ie_spid = -1; +static gint hf_harq_control_ie_acid = -1; +static gint hf_harq_control_ie_reserved = -1; +static gint hf_harq_control_ie_prefix_1 = -1; +static gint hf_harq_control_ie_ai_sn_1 = -1; +static gint hf_harq_control_ie_spid_1 = -1; +static gint hf_harq_control_ie_acid_1 = -1; +static gint hf_harq_control_ie_reserved_1 = -1; + +/* Masks */ +#define WIMAX_HARQ_CONTROL_IE_PREFIX_MASK 0x80 +#define WIMAX_HARQ_CONTROL_IE_AI_SN_MASK 0x40 +#define WIMAX_HARQ_CONTROL_IE_SPID_MASK 0x30 +#define WIMAX_HARQ_CONTROL_IE_ACID_MASK 0x0F +#define WIMAX_HARQ_CONTROL_IE_RESERVED_MASK 0x70 +#define WIMAX_HARQ_CONTROL_IE_PREFIX_MASK_1 0x0800 +#define WIMAX_HARQ_CONTROL_IE_AI_SN_MASK_1 0x0400 +#define WIMAX_HARQ_CONTROL_IE_SPID_MASK_1 0x0300 +#define WIMAX_HARQ_CONTROL_IE_ACID_MASK_1 0x00F0 +#define WIMAX_HARQ_CONTROL_IE_RESERVED_MASK_1 0x0700 + +/* HARQ MAP HARQ Control IE display */ +static hf_register_info hf_harq_control[] = +{ + { + &hf_harq_control_ie_prefix, + {"Prefix", "wimax.harq_map.harq_control_ie.prefix", FT_BOOLEAN, 8, TFS(&tfs_prefix), WIMAX_HARQ_CONTROL_IE_PREFIX_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_ai_sn, + {"HARQ ID Sequence Number(AI_SN)", "wimax.harq_map.harq_control_ie.ai_sn", FT_UINT8, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_AI_SN_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_spid, + {"Subpacket ID (SPID)", "wimax.harq_map.harq_control_ie.spid", FT_UINT8, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_SPID_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_acid, + {"HARQ CH ID (ACID)", "wimax.harq_map.harq_control_ie.acid", FT_UINT8, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_ACID_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_reserved, + {"Reserved", "wimax.harq_map.harq_control_ie.reserved", FT_UINT8, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_RESERVED_MASK, "", HFILL} + }, + { + &hf_harq_control_ie_prefix_1, + {"Prefix", "wimax.harq_map.harq_control_ie.prefix", FT_BOOLEAN, 16, TFS(&tfs_prefix), WIMAX_HARQ_CONTROL_IE_PREFIX_MASK_1, "", HFILL} + }, + { + &hf_harq_control_ie_ai_sn_1, + {"HARQ ID Sequence Number(AI_SN)", "wimax.harq_map.harq_control_ie.ai_sn", FT_UINT16, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_AI_SN_MASK_1, "", HFILL} + }, + { + &hf_harq_control_ie_spid_1, + {"Subpacket ID (SPID)", "wimax.harq_map.harq_control_ie.spid", FT_UINT16, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_SPID_MASK_1, "", HFILL} + }, + { + &hf_harq_control_ie_acid_1, + {"HARQ CH ID (ACID)", "wimax.harq_map.harq_control_ie.acid", FT_UINT16, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_ACID_MASK_1, "", HFILL} + }, + { + &hf_harq_control_ie_reserved_1, + {"Reserved", "wimax.harq_map.harq_control_ie.reserved", FT_UINT16, BASE_HEX, NULL, WIMAX_HARQ_CONTROL_IE_RESERVED_MASK_1, "", HFILL} + } +}; + +/* Extension Type */ +#define EXTENSION_TYPE_MASK 0xE000 +#define EXTENSION_TYPE_MASK_1 0x0E00 +#define EXTENSION_SUBTYPE_MASK 0x1F00 +#define EXTENSION_SUBTYPE_MASK_1 0x01F0 +#define EXTENSION_LENGTH_MASK 0x00F0 +#define EXTENSION_LENGTH_MASK_1 0x000F + +static gint hf_culmap_extension_type = -1; +static gint hf_culmap_extension_subtype = -1; +static gint hf_culmap_extension_length = -1; +static gint hf_culmap_extension_type_1 = -1; +static gint hf_culmap_extension_subtype_1 = -1; +static gint hf_culmap_extension_length_1 = -1; + +static gint hf_culmap_extension_time_diversity_mbs = -1; +static gint hf_culmap_extension_harq_mode = -1; +static gint hf_culmap_extension_unknown_sub_type = -1; +static gint hf_culmap_extension_time_diversity_mbs_1 = -1; +static gint hf_culmap_extension_harq_mode_1 = -1; +static gint hf_culmap_extension_unknown_sub_type_1 = -1; + +static hf_register_info hf_extension_type[] = +{ + { + &hf_culmap_extension_type, + {"UL-MAP Type", "wimax.extension_type.ul_map_type", FT_UINT16, BASE_DEC, NULL, EXTENSION_TYPE_MASK, "", HFILL} + }, + { + &hf_culmap_extension_type_1, + {"UL-MAP Type", "wimax.extension_type.ul_map_type", FT_UINT16, BASE_DEC, NULL, EXTENSION_TYPE_MASK_1, "", HFILL} + }, + { + &hf_culmap_extension_subtype, + {"Extension Subtype", "wimax.extension_type.subtype", FT_UINT16, BASE_DEC, NULL, EXTENSION_SUBTYPE_MASK, "", HFILL} + }, + { + &hf_culmap_extension_subtype_1, + {"Extension Subtype", "wimax.extension_type.subtype", FT_UINT16, BASE_DEC, NULL, EXTENSION_SUBTYPE_MASK_1, "", HFILL} + }, + { + &hf_culmap_extension_length, + {"Extension Length", "wimax.extension_type.length", FT_UINT16, BASE_DEC, NULL, EXTENSION_LENGTH_MASK, "", HFILL} + }, + { + &hf_culmap_extension_length_1, + {"Extension Length", "wimax.extension_type.length", FT_UINT16, BASE_DEC, NULL, EXTENSION_LENGTH_MASK_1, "", HFILL} + }, + { + &hf_culmap_extension_time_diversity_mbs, + {"Time Diversity MBS", "wimax.extension_type.time_diversity_mbs", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_extension_time_diversity_mbs_1, + {"Time Diversity MBS", "wimax.extension_type.time_diversity_mbs", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_extension_harq_mode_1, + {"HARQ Mode Switch", "wimax.extension_type.harq_mode", FT_UINT16, BASE_HEX, NULL, 0x000F, "", HFILL} + }, + { + &hf_culmap_extension_harq_mode, + {"HARQ Mode Switch", "wimax.extension_type.harq_mode", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL} + }, + { + &hf_culmap_extension_unknown_sub_type, + {"Unknown Extension Subtype", "wimax.extension_type.unknown_sub_type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_culmap_extension_unknown_sub_type_1, + {"Unknown Extension Subtype", "wimax.extension_type.unknown_sub_type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* UL-MAP CDMA Allocation IE */ +#define CDMA_ALLOCATION_DURATION_MASK 0xFC00 +#define CDMA_ALLOCATION_UIUC_MASK 0x03C0 +#define CDMA_ALLOCATION_REPETITION_CODE_MASK 0x0030 +#define CDMA_ALLOCATION_FRAME_NUMBER_INDEX_MASK 0x000F + +#define CDMA_ALLOCATION_RANGING_SUBCHANNEL_MASK 0xFE +#define CDMA_ALLOCATION_BW_REQUEST_MANDATORY_MASK 0x01 + +#define CDMA_ALLOCATION_DURATION_MASK_1 0x0FC0 +#define CDMA_ALLOCATION_UIUC_MASK_1 0x003C +#define CDMA_ALLOCATION_REPETITION_CODE_MASK_1 0x0003 +#define CDMA_ALLOCATION_FRAME_NUMBER_INDEX_MASK_1 0xF0000000 +#define CDMA_ALLOCATION_RANGING_CODE_MASK_1 0x0FF00000 +#define CDMA_ALLOCATION_RANGING_SYMBOL_MASK_1 0x000FF000 +#define CDMA_ALLOCATION_RANGING_SUBCHANNEL_MASK_1 0x00000FE0 +#define CDMA_ALLOCATION_BW_REQUEST_MANDATORY_MASK_1 0x00000010 + +static gint hf_cdma_allocation_duration = -1; +static gint hf_cdma_allocation_uiuc = -1; +static gint hf_cdma_allocation_repetition = -1; +static gint hf_cdma_allocation_frame_number_index = -1; +static gint hf_cdma_allocation_ranging_code = -1; +static gint hf_cdma_allocation_ranging_symbol = -1; +static gint hf_cdma_allocation_ranging_subchannel = -1; +static gint hf_cdma_allocation_bw_req = -1; +static gint hf_cdma_allocation_duration_1 = -1; +static gint hf_cdma_allocation_uiuc_1 = -1; +static gint hf_cdma_allocation_repetition_1 = -1; +static gint hf_cdma_allocation_frame_number_index_1 = -1; +static gint hf_cdma_allocation_ranging_code_1 = -1; +static gint hf_cdma_allocation_ranging_symbol_1 = -1; +static gint hf_cdma_allocation_ranging_subchannel_1 = -1; +static gint hf_cdma_allocation_bw_req_1 = -1; + +static hf_register_info hf_cdma_allocation[] = +{ + { /* display the Duration */ + &hf_cdma_allocation_duration, + {"Duration", "wimax.cdma_allocation.duration", FT_UINT16, BASE_DEC, NULL, CDMA_ALLOCATION_DURATION_MASK, "", HFILL} + }, + { /* display the UIUC */ + &hf_cdma_allocation_uiuc, + {"UIUC For Transmission", "wimax.cdma_allocation.uiuc", FT_UINT16, BASE_DEC, NULL, CDMA_ALLOCATION_UIUC_MASK, "", HFILL} + }, + { /* display the Repetition Coding Indication */ + &hf_cdma_allocation_repetition, + {"Repetition Coding Indication", "wimax.cdma_allocation.allocation_repetition", FT_UINT16, BASE_DEC, VALS(vals_repetitions), CDMA_ALLOCATION_REPETITION_CODE_MASK, "", HFILL} + }, + { /* display the Frame Number Index */ + &hf_cdma_allocation_frame_number_index, + {"Frame Number Index (LSBs of relevant frame number)", "wimax.cdma_allocation.frame_number_index", FT_UINT16, BASE_DEC, NULL, CDMA_ALLOCATION_FRAME_NUMBER_INDEX_MASK, "", HFILL} + }, + { /* display the Ranging Code */ + &hf_cdma_allocation_ranging_code, + {"Ranging Code", "wimax.cdma_allocation.ranging_code", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* display the Ranging Symbol */ + &hf_cdma_allocation_ranging_symbol, + {"Ranging Symbol", "wimax.cdma_allocation.ranging_symbol", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* display the Ranging Subchannel */ + &hf_cdma_allocation_ranging_subchannel, + {"Ranging Subchannel", "wimax.cdma_allocation.ranging_subchannel", FT_UINT8, BASE_DEC, NULL, CDMA_ALLOCATION_RANGING_SUBCHANNEL_MASK, "", HFILL} + }, + { /* display the BW Request Mandatory */ + &hf_cdma_allocation_bw_req, + {"BW Request Mandatory", "wimax.cdma_allocation.bw_req", FT_UINT8, BASE_DEC, TFS(&tfs_yes_no_ie), CDMA_ALLOCATION_BW_REQUEST_MANDATORY_MASK, "", HFILL} + }, + { /* display the Duration */ + &hf_cdma_allocation_duration_1, + {"Duration", "wimax.cdma_allocation.duration", FT_UINT16, BASE_DEC, NULL, CDMA_ALLOCATION_DURATION_MASK_1, "", HFILL} + }, + { /* display the UIUC */ + &hf_cdma_allocation_uiuc_1, + {"UIUC For Transmission", "wimax.cdma_allocation.uiuc", FT_UINT16, BASE_DEC, NULL, CDMA_ALLOCATION_UIUC_MASK_1, "", HFILL} + }, + { /* display the Repetition Coding Indication */ + &hf_cdma_allocation_repetition_1, + {"Repetition Coding Indication", "wimax.cdma_allocation.allocation_repetition", FT_UINT16, BASE_DEC, VALS(vals_repetitions), CDMA_ALLOCATION_REPETITION_CODE_MASK_1, "", HFILL} + }, + { /* display the Frame Number Index */ + &hf_cdma_allocation_frame_number_index_1, + {"Frame Number Index (LSBs of relevant frame number)", "wimax.cdma_allocation.frame_number_index", FT_UINT32, BASE_DEC, NULL, CDMA_ALLOCATION_FRAME_NUMBER_INDEX_MASK_1, "", HFILL} + }, + { /* display the Ranging Code */ + &hf_cdma_allocation_ranging_code_1, + {"Ranging Code", "wimax.cdma_allocation.ranging_code", FT_UINT32, BASE_DEC, NULL, CDMA_ALLOCATION_RANGING_CODE_MASK_1, "", HFILL} + }, + { /* display the Ranging Symbol */ + &hf_cdma_allocation_ranging_symbol_1, + {"Ranging Symbol", "wimax.cdma_allocation.ranging_symbol", FT_UINT32, BASE_DEC, NULL, CDMA_ALLOCATION_RANGING_SYMBOL_MASK_1, "", HFILL} + }, + { /* display the Ranging Subchannel */ + &hf_cdma_allocation_ranging_subchannel_1, + {"Ranging Subchannel", "wimax.cdma_allocation.ranging_subchannel", FT_UINT32, BASE_DEC, NULL, CDMA_ALLOCATION_RANGING_SUBCHANNEL_MASK_1, "", HFILL} + }, + { /* display the BW Request Mandatory */ + &hf_cdma_allocation_bw_req_1, + {"BW Request Mandatory", "wimax.cdma_allocation.bw_req", FT_UINT32, BASE_DEC, TFS(&tfs_yes_no_ie), CDMA_ALLOCATION_BW_REQUEST_MANDATORY_MASK_1, "", HFILL} + } +}; + + +/* UL-MAP Extended UIUCs (table 290a) */ +#define MINI_SUBCHANNEL_CTYPE_MASK 0xC0 +#define MINI_SUBCHANNEL_CTYPE_MASK_16 0x0C00 +#define MINI_SUBCHANNEL_DURATION_MASK 0x3F +#define MINI_SUBCHANNEL_DURATION_MASK_16 0x03F0 +#define MINI_SUBCHANNEL_CID_MASK 0xFFFF00 +#define MINI_SUBCHANNEL_UIUC_MASK 0x0000F0 +#define MINI_SUBCHANNEL_REPETITION_MASK 0x00000C +#define MINI_SUBCHANNEL_CID_MASK_1 0x0FFFF000 +#define MINI_SUBCHANNEL_UIUC_MASK_1 0x00000F00 +#define MINI_SUBCHANNEL_REPETITION_MASK_1 0x000000C0 +#define MINI_SUBCHANNEL_CID_MASK_2 0x03FFFF00 +#define MINI_SUBCHANNEL_UIUC_MASK_2 0x000000F0 +#define MINI_SUBCHANNEL_REPETITION_MASK_2 0x0000000C +#define MINI_SUBCHANNEL_CID_MASK_3 0x3FFFF000 +#define MINI_SUBCHANNEL_UIUC_MASK_3 0x00000F00 +#define MINI_SUBCHANNEL_REPETITION_MASK_3 0x000000C0 +#define MINI_SUBCHANNEL_PADDING_MASK 0xF0 +#define MINI_SUBCHANNEL_PADDING_MASK_1 0x0000000F + +static gint hf_extended_uiuc_ie_uiuc = -1; +static gint hf_extended_uiuc_ie_length = -1; +static gint hf_extended_uiuc_ie_uiuc_1 = -1; +static gint hf_extended_uiuc_ie_length_1 = -1; +static gint hf_extended_uiuc_ie_power_control = -1; +static gint hf_extended_uiuc_ie_power_measurement_frame = -1; +static gint hf_extended_uiuc_ie_power_control_24 = -1; +static gint hf_extended_uiuc_ie_power_measurement_frame_24 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_ctype = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_duration = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_ctype_16 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_duration_16 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_padding = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_1 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_1 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_1 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_2 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_2 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_2 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_3 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_3 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_3 = -1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_padding_1 = -1; +static gint hf_extended_uiuc_ie_aas_ul = -1; +static gint hf_extended_uiuc_ie_cqich_alloc = -1; +static gint hf_extended_uiuc_ie_ul_zone = -1; +static gint hf_extended_uiuc_ie_phymod_ul = -1; +static gint hf_extended_uiuc_ie_mimo_ul_basic = -1; +static gint hf_extended_uiuc_ie_fast_tracking = -1; +static gint hf_extended_uiuc_ie_ul_pusc_burst_allocation = -1; +static gint hf_extended_uiuc_ie_fast_ranging = -1; +static gint hf_extended_uiuc_ie_ul_allocation_start = -1; +static gint hf_extended_uiuc_ie_unknown_uiuc = -1; + +static hf_register_info hf_extended_uiuc[] = +{ + { /* 8.4.5.4.4 Extended UIUC */ + &hf_extended_uiuc_ie_uiuc, + {"Extended UIUC", "wimax.extended_uiuc_ie.uiuc", FT_UINT8, BASE_HEX, NULL, MSB_NIBBLE_MASK, "", HFILL } + }, + { /* 8.4.5.4.4 Extended UIUC */ + &hf_extended_uiuc_ie_uiuc_1, + {"Extended UIUC", "wimax.extended_uiuc_ie.uiuc", FT_UINT8, BASE_HEX, NULL, LSB_NIBBLE_MASK, "", HFILL } + }, + { /* 8.4.5.4.4 IE Length */ + &hf_extended_uiuc_ie_length, + {"Length", "wimax.extended_uiuc_ie.length", FT_UINT8, BASE_DEC, NULL, MSB_NIBBLE_MASK, "", HFILL } + }, + { /* 8.4.5.4.4 IE Length */ + &hf_extended_uiuc_ie_length_1, + {"Length", "wimax.extended_uiuc_ie.length", FT_UINT24, BASE_DEC, NULL, LSB_NIBBLE_MASK, "", HFILL } + }, + { /* 8.4.5.4.5 Power Control IE */ + &hf_extended_uiuc_ie_power_control, + {"Power Control", "wimax.extended_uiuc_ie.power_control", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.5 Power Control IE */ + &hf_extended_uiuc_ie_power_control_24, + {"Power Control", "wimax.extended_uiuc_ie.power_control", FT_UINT24, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { + &hf_extended_uiuc_ie_power_measurement_frame, + {"Power Measurement Frame", "wimax.extended_uiuc_ie.power_measurement_frame", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { + &hf_extended_uiuc_ie_power_measurement_frame_24, + {"Power Measurement Frame", "wimax.extended_uiuc_ie.power_measurement_frame", FT_UINT24, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.8 Mini Subchannel Allocation IE */ + &hf_extended_uiuc_ie_mini_subchannel_alloc_ctype, + {"C Type", "wimax.extended_uiuc_ie.mini_subchannel_alloc.ctype", FT_UINT8, BASE_HEX, VALS(vals_ctypes), MINI_SUBCHANNEL_CTYPE_MASK, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_ctype_16, + {"C Type", "wimax.extended_uiuc_ie.mini_subchannel_alloc.ctype", FT_UINT16, BASE_HEX, VALS(vals_ctypes), MINI_SUBCHANNEL_CTYPE_MASK_16, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_duration, + {"Duration", "wimax.extended_uiuc_ie.mini_subchannel_alloc.duration", FT_UINT8, BASE_DEC, NULL, MINI_SUBCHANNEL_DURATION_MASK, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_duration_16, + {"Duration", "wimax.extended_uiuc_ie.mini_subchannel_alloc.duration", FT_UINT16, BASE_DEC, NULL, MINI_SUBCHANNEL_DURATION_MASK_16, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_cid, + {"CID", "wimax.extended_uiuc_ie.mini_subchannel_alloc.cid", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_CID_MASK, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc, + {"UIUC", "wimax.extended_uiuc_ie.mini_subchannel_alloc.uiuc", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_UIUC_MASK, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_repetition, + {"Repetition", "wimax.extended_uiuc_ie.mini_subchannel_alloc.repetition", FT_UINT24, BASE_HEX, VALS(vals_repetitions), MINI_SUBCHANNEL_REPETITION_MASK, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_cid_1, + {"CID", "wimax.extended_uiuc_ie.mini_subchannel_alloc.cid", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_CID_MASK_1, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_1, + {"UIUC", "wimax.extended_uiuc_ie.mini_subchannel_alloc.uiuc", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_UIUC_MASK_1, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_1, + {"Repetition", "wimax.extended_uiuc_ie.mini_subchannel_alloc.repetition", FT_UINT24, BASE_HEX, VALS(vals_repetitions), MINI_SUBCHANNEL_REPETITION_MASK_1, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_cid_2, + {"CID", "wimax.extended_uiuc_ie.mini_subchannel_alloc.cid", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_CID_MASK_2, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_2, + {"UIUC", "wimax.extended_uiuc_ie.mini_subchannel_alloc.uiuc", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_UIUC_MASK_2, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_2, + {"Repetition", "wimax.extended_uiuc_ie.mini_subchannel_alloc.repetition", FT_UINT24, BASE_HEX, VALS(vals_repetitions), MINI_SUBCHANNEL_REPETITION_MASK_2, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_cid_3, + {"CID", "wimax.extended_uiuc_ie.mini_subchannel_alloc.cid", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_CID_MASK_3, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_3, + {"UIUC", "wimax.extended_uiuc_ie.mini_subchannel_alloc.uiuc", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_UIUC_MASK_2, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_3, + {"Repetition", "wimax.extended_uiuc_ie.mini_subchannel_alloc.repetition", FT_UINT24, BASE_HEX, VALS(vals_repetitions), MINI_SUBCHANNEL_REPETITION_MASK_3, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_padding, + {"Padding", "wimax.extended_uiuc_ie.mini_subchannel_alloc.padding", FT_UINT8, BASE_HEX, NULL, MINI_SUBCHANNEL_PADDING_MASK, "", HFILL } + }, + { + &hf_extended_uiuc_ie_mini_subchannel_alloc_padding_1, + {"Padding", "wimax.extended_uiuc_ie.mini_subchannel_alloc.padding", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_PADDING_MASK_1, "", HFILL } + }, + { /* 8.4.5.4.6 AAS_UL_IE */ + &hf_extended_uiuc_ie_aas_ul, + {"AAS_UL_IE (not implemented)", "wimax.extended_uiuc_ie.aas_ul", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.12 CQICH Allocation IE */ + &hf_extended_uiuc_ie_cqich_alloc, + {"CQICH Allocation IE (not implemented)", "wimax.extended_uiuc_ie.cqich_alloc", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.7 UL Zone IE */ + &hf_extended_uiuc_ie_ul_zone, + {"UL Zone IE (not implemented)", "wimax.extended_uiuc_ie.ul_zone", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + + { /* 8.4.5.4.14 MIMO_UL_Basic_IE */ + &hf_extended_uiuc_ie_mimo_ul_basic, + {"MIMO UL Basic IE (not implemented)", "wimax.extended_uiuc_ie.mimo_ul_basic", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.22 UL-MAP Fast Tracking IE */ + &hf_extended_uiuc_ie_fast_tracking, + {"UL-MAP Fast Tracking IE (not implemented)", "wimax.extended_uiuc_ie.fast_tracking", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.21 Fast Ranging IE */ + &hf_extended_uiuc_ie_fast_ranging, + {"Fast Ranging IE (not implemented)", "wimax.extended_uiuc_ie.fast_ranging", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.14 UL-MAP Physical Modifier IE */ + &hf_extended_uiuc_ie_phymod_ul, + {"UL-MAP Physical Modifier IE (not implemented)", "wimax.extended_uiuc_ie.phymod_ul", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.17 UL PUSC Burst Allocation in Other Segment IE */ + &hf_extended_uiuc_ie_ul_pusc_burst_allocation, + {"UL_PUSC_Burst_Allocation_in_Other_Segment_IE (not implemented)", "wimax.extended_uiuc_ie.ul_pusc_burst_allocation", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* 8.4.5.4.15 UL Allocation Start IE */ + &hf_extended_uiuc_ie_ul_allocation_start, + {"UL Allocation Start IE (not implemented)", "wimax.extended_uiuc_ie.ul_allocation_start", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + }, + { /* unknown UIUC */ + &hf_extended_uiuc_ie_unknown_uiuc, + {"Unknown Extended UIUC", "wimax.extended_uiuc.unknown_uiuc", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } + } +}; + +/* Register Wimax Compact UL-MAP IE Protocol */ +void proto_register_wimax_compact_ulmap_ie(void) +{ + if (proto_wimax_compact_ulmap_ie_decoder == -1) + { + proto_wimax_compact_ulmap_ie_decoder = proto_wimax; + + proto_register_subtree_array(ett, array_length(ett)); + proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_compact_ulmap, array_length(hf_compact_ulmap)); + proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_rcid, array_length(hf_rcid)); + proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_harq_control, array_length(hf_harq_control)); + proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_extension_type, array_length(hf_extension_type)); + proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_cdma_allocation, array_length(hf_cdma_allocation)); + proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_extended_uiuc, array_length(hf_extended_uiuc)); + } +} + +/* Compact UL-MAP IE Types (table 90) */ +#define COMPACT_UL_MAP_TYPE_NORMAL_SUBCHANNEL 0 +#define COMPACT_UL_MAP_TYPE_BAND_AMC 1 +#define COMPACT_UL_MAP_TYPE_SAFETY 2 +#define COMPACT_UL_MAP_TYPE_UIUC 3 +#define COMPACT_UL_MAP_TYPE_HARQ_REGION_IE 4 +#define COMPACT_UL_MAP_TYPE_CQICH_REGION_IE 5 +#define COMPACT_UL_MAP_TYPE_RESERVED 6 +#define COMPACT_UL_MAP_TYPE_EXTENSION 7 + +/* Compact UL-MAP IE decoder */ +guint wimax_compact_ulmap_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint uiuc, byte, length = 0; + guint ul_map_type; + guint harq_region_change_indication; + guint cqi_region_change_indication; + guint ul_map_offset, nibble_length; + guint nband, band_count, i, allocation_mode; + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Compact UL-MAP IEs"); + } +#endif + /* set the local offset */ + ul_map_offset = offset; + /* Get the first byte */ + byte = tvb_get_guint8(tvb, ul_map_offset); + /* get the ul-map type */ + if(nibble_offset & 1) + { + ul_map_type = ((byte & UL_MAP_TYPE_MASK_1) >> 1); + } + else + { + ul_map_type = ((byte & UL_MAP_TYPE_MASK) >> 5); + } + /* process the Compact UL-MAP IE (table 90) */ + switch (ul_map_type) + { + case COMPACT_UL_MAP_TYPE_NORMAL_SUBCHANNEL:/* 6.3.2.3.43.7.1 */ + /* display the UL-MAP type and reserved bit */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_ul_map_type_1, tvb, ul_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_reserved_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + nibble_offset = 0; + } + else + { + proto_tree_add_item(tree, hf_culmap_ul_map_type, tvb, ul_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_reserved, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 1; + } + length = 1; + /* decode RCID IE */ + nibble_length = wimax_compact_ulmap_rcid_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + ul_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + /* check harq mode */ + if(!harq_mode) + { /* display the Nep and Nsch Code */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_nep_code_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + proto_tree_add_item(tree, hf_culmap_nsch_code, tvb, ul_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_culmap_nep_code, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_nsch_code_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + } + length += 2; + } + else if(harq_mode == 1) + { /* display the Shortened UIUC and Companded SC */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_shortened_uiuc_1, tvb, ul_map_offset, 2, FALSE); + proto_tree_add_item(tree, hf_culmap_companded_sc_1, tvb, ul_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_culmap_shortened_uiuc, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_companded_sc, tvb, ul_map_offset, 1, FALSE); + } + /* move to next byte */ + ul_map_offset++; + length += 2; + } + /* decode HARQ Control IE */ + nibble_length = wimax_compact_ulmap_harq_control_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + break; + case COMPACT_UL_MAP_TYPE_BAND_AMC:/* 6.3.2.3.43.7.2 */ + /* display the UL-MAP type and reserved bit */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_ul_map_type_1, tvb, ul_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_reserved_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + nibble_offset = 0; + } + else + { + proto_tree_add_item(tree, hf_culmap_ul_map_type, tvb, ul_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_reserved, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 1; + } + length = 1; + /* decode RCID IE */ + nibble_length = wimax_compact_ulmap_rcid_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + ul_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + /* check harq mode */ + if(!harq_mode) + { /* display the Nep and Nsch Code */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_nep_code_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + proto_tree_add_item(tree, hf_culmap_nsch_code, tvb, ul_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_culmap_nep_code, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_nsch_code_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + } + length += 2; + } + else if(harq_mode == 1) + { /* display the Shortened UIUC and Companded SC */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_shortened_uiuc_1, tvb, ul_map_offset, 2, FALSE); + proto_tree_add_item(tree, hf_culmap_companded_sc_1, tvb, ul_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_culmap_shortened_uiuc, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_companded_sc, tvb, ul_map_offset, 1, FALSE); + } + /* move to next byte */ + ul_map_offset++; + length += 2; + } + /* get the Nband */ + if(max_logical_bands) + { /* get and display the Nband */ + nband = tvb_get_guint8(tvb, ul_map_offset); + length++; + if(nibble_offset & 1) + { + nband = (nband & LSB_NIBBLE_MASK); + /* display the Nband */ + proto_tree_add_item(tree, hf_culmap_num_bands_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + nibble_offset = 0; + if(max_logical_bands == 3) + { + proto_tree_add_item(tree, hf_culmap_band_index, tvb, ul_map_offset, nband, FALSE); + length += (nband * 2); + /* update offset */ + ul_map_offset += nband; + } + else + { + nibble_offset = (nband & 1); + proto_tree_add_item(tree, hf_culmap_band_index, tvb, ul_map_offset, ((nband >> 1) + nibble_offset), FALSE); + length += nband; + /* update offset */ + ul_map_offset += (nband >> 1); + } + } + else + { + nband = ((nband & MSB_NIBBLE_MASK) >> 4); + /* display the Nband */ + proto_tree_add_item(tree, hf_culmap_num_bands, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 1; + if(max_logical_bands == 3) + { + proto_tree_add_item(tree, hf_culmap_band_index, tvb, ul_map_offset, (nband + nibble_offset), FALSE); + length += (nband * 2); + /* update offset */ + ul_map_offset += nband; + } + else + { + proto_tree_add_item(tree, hf_culmap_band_index, tvb, ul_map_offset, ((nband >> 1) + nibble_offset), FALSE); + length += nband; + /* update offset */ + ul_map_offset += ((nband + nibble_offset) >> 1); + if(nband & 1) + nibble_offset = 0; + } + } + band_count = nband; + } + else + { + nband = 0; + band_count = 1; + /* display the Nb-BITMAP */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_nb_bitmap_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + nibble_offset = 0; + } + else + { + proto_tree_add_item(tree, hf_culmap_nb_bitmap, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 1; + } + length++; + } + /* Get the Allocation Mode */ + byte = tvb_get_guint8(tvb, ul_map_offset); + if(nibble_offset & 1) + { + allocation_mode = ((byte & ALLOCATION_MODE_MASK_1) >> 2); + proto_tree_add_item(tree, hf_culmap_allocation_mode_1, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_allocation_mode_rsvd_1, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 0; + ul_map_offset++; + } + else + { + allocation_mode = ((byte & ALLOCATION_MODE_MASK) >> 6); + proto_tree_add_item(tree, hf_culmap_allocation_mode, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_allocation_mode_rsvd, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 1; + } + length++; + /* Decode Allocation Mode - need to be done */ + if(!allocation_mode) + { + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_num_subchannels_1, tvb, ul_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_culmap_num_subchannels, tvb, ul_map_offset, 1, FALSE); + } + ul_map_offset++; + length += 2; + } + else if(allocation_mode == 1) + { + for(i=0; i<band_count; i++) + { + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_num_subchannels_1, tvb, ul_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_culmap_num_subchannels, tvb, ul_map_offset, 1, FALSE); + } + ul_map_offset++; + } + length += (band_count * 2); + } + /* decode HARQ Control IE */ + nibble_length = wimax_compact_ulmap_harq_control_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + break; + case COMPACT_UL_MAP_TYPE_SAFETY:/* 6.3.2.3.43.7.3 */ + /* display the UL-MAP type and reserved bit */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_ul_map_type_1, tvb, ul_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_reserved_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + nibble_offset = 0; + } + else + { + proto_tree_add_item(tree, hf_culmap_ul_map_type, tvb, ul_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_reserved, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 1; + } + length = 1; + /* decode RCID IE */ + nibble_length = wimax_compact_ulmap_rcid_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + ul_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + /* check harq mode */ + if(!harq_mode) + { /* display the Nep and Nsch Code */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_nep_code_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + proto_tree_add_item(tree, hf_culmap_nsch_code, tvb, ul_map_offset, 1, FALSE); + } + else + { + proto_tree_add_item(tree, hf_culmap_nep_code, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_nsch_code_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + } + length += 2; + } + else if(harq_mode == 1) + { /* display the Shortened UIUC and Companded SC */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_shortened_uiuc_1, tvb, ul_map_offset, 2, FALSE); + proto_tree_add_item(tree, hf_culmap_companded_sc_1, tvb, ul_map_offset, 2, FALSE); + } + else + { + proto_tree_add_item(tree, hf_culmap_shortened_uiuc, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_companded_sc, tvb, ul_map_offset, 1, FALSE); + } + /* move to next byte */ + ul_map_offset++; + length += 2; + } + /* display BIN offset */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_bin_offset_1, tvb, ul_map_offset, 2, FALSE); + /* move to next byte */ + ul_map_offset++; + } + else + { + proto_tree_add_item(tree, hf_culmap_bin_offset, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + } + length += 2; + /* decode HARQ Control IE */ + nibble_length = wimax_compact_ulmap_harq_control_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + break; + case COMPACT_UL_MAP_TYPE_UIUC:/* 6.3.2.3.43.7.4 */ + /* display the UL-MAP type and reserved bit */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_ul_map_type_1, tvb, ul_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_reserved_1, tvb, ul_map_offset, 1, FALSE); + /* move to next byte */ + ul_map_offset++; + /* get the new byte */ + byte = tvb_get_guint8(tvb, ul_map_offset); + /* get the UIUC */ + uiuc = ((byte & MSB_NIBBLE_MASK) >> 4); + /* display the UIUC */ + proto_tree_add_item(tree, hf_culmap_uiuc, tvb, ul_map_offset, 1, FALSE); + } + else + { + /* display the UL-MAP type */ + proto_tree_add_item(tree, hf_culmap_ul_map_type, tvb, ul_map_offset, 1, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_reserved, tvb, ul_map_offset, 1, FALSE); + /* get the UIUC */ + uiuc = (byte & LSB_NIBBLE_MASK); + /* display the UIUC */ + proto_tree_add_item(tree, hf_culmap_uiuc_1, tvb, ul_map_offset, 1, FALSE); + } + length = 2; + /* decode RCID IE */ + nibble_length = wimax_compact_ulmap_rcid_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + ul_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + if(uiuc == 15) + { /* Extended UIUC dependent IE */ + nibble_length = wimax_extended_uiuc_dependent_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + ul_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + } + else if(uiuc == 14) + { /* CDMA Allocation IE */ + nibble_length = wimax_cdma_allocation_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + ul_map_offset += (nibble_length >> 1); + nibble_offset = (nibble_length & 1); + } + else if(uiuc == 12) + { + if(nibble_offset & 1) + { + /* display the OFDMA symbol offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_ofdma_symbol_offset_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + /* display the subchannel offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_subchannel_offset_7_1, tvb, ul_map_offset, 4, FALSE); + /* display the number of OFDMA symbols */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_ofdma_symbols_7_1, tvb, ul_map_offset, 4, FALSE); + /* display the number of subchannels */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_subchannels_7_1, tvb, ul_map_offset, 4, FALSE); + /* display the ranging method */ + proto_tree_add_item(tree, hf_culmap_uiuc_ranging_method_1, tvb, ul_map_offset, 4, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_uiuc_reserved_1, tvb, ul_map_offset, 4, FALSE); + ul_map_offset += 3; + } + else + { /* display the OFDMA symbol offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_ofdma_symbol_offset, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + /* display the subchannel offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_subchannel_offset_7, tvb, ul_map_offset, 3, FALSE); + /* display the number of OFDMA symbols */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_ofdma_symbols_7, tvb, ul_map_offset, 3, FALSE); + /* display the number of subchannels */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_subchannels_7, tvb, ul_map_offset, 3, FALSE); + /* display the ranging method */ + proto_tree_add_item(tree, hf_culmap_uiuc_ranging_method, tvb, ul_map_offset, 3, FALSE); + /* display the reserved */ + proto_tree_add_item(tree, hf_culmap_uiuc_reserved, tvb, ul_map_offset, 3, FALSE); + ul_map_offset += 3; + } + length += 8; + } + else + { /* display Number of subchannels */ + if(nibble_offset & 1) + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_subchannels_1, tvb, ul_map_offset, 2, FALSE); + else + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_subchannels, tvb, ul_map_offset, 1, FALSE); + length += 2; + /* display the repetition coding indication and reserved bits */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_culmap_uiuc_repetition_coding_indication_1, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_uiuc_reserved_1, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 0; + } + else + { + proto_tree_add_item(tree, hf_culmap_uiuc_repetition_coding_indication, tvb, ul_map_offset, 1, FALSE); + proto_tree_add_item(tree, hf_culmap_uiuc_reserved, tvb, ul_map_offset, 1, FALSE); + nibble_offset = 1; + } + length += 1; + } + /* decode HARQ Control IE */ + nibble_length = wimax_compact_ulmap_harq_control_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset); + length += nibble_length; + break; + case COMPACT_UL_MAP_TYPE_HARQ_REGION_IE:/* 6.3.2.3.43.7.5 */ + if(nibble_offset & 1) + { /* display the UL-MAP type */ + proto_tree_add_item(tree, hf_culmap_ul_map_type_1, tvb, ul_map_offset, 1, FALSE); + /* display the HARQ Region Change Indication */ + proto_tree_add_item(tree, hf_culmap_harq_region_change_indication_1, tvb, ul_map_offset, 1, FALSE); + /* get the HARQ Region Change Indication */ + harq_region_change_indication = (byte & 0x01); + /* move to next byte */ + ul_map_offset++; + nibble_offset = 0; + } + else + { /* display the UL-MAP type */ + proto_tree_add_item(tree, hf_culmap_ul_map_type, tvb, ul_map_offset, 1, FALSE); + /* display the HARQ Region Change Indication */ + proto_tree_add_item(tree, hf_culmap_harq_region_change_indication, tvb, ul_map_offset, 1, FALSE); + /* get the HARQ Region Change Indication */ + harq_region_change_indication = (byte & 0x10); + nibble_offset = 1; + } + length = 1; + if(harq_region_change_indication == 1) + { + if(nibble_offset & 1) + { + /* display the OFDMA symbol offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_ofdma_symbol_offset_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + /* display the subchannel offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_subchannel_offset_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + /* display the number of OFDMA symbols */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_ofdma_symbols_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + /* display the number of subchannels */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_subchannels_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + } + else + { /* display the OFDMA symbol offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_ofdma_symbol_offset, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + /* display the subchannel offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_subchannel_offset, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + /* display the number of OFDMA symbols */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_ofdma_symbols, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + /* display the number of subchannels */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_subchannels, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + } + length += 8; + } + break; + case COMPACT_UL_MAP_TYPE_CQICH_REGION_IE:/* 6.3.2.3.43.7.6 */ + if(nibble_offset & 1) + { /* display the UL-MAP type */ + proto_tree_add_item(tree, hf_culmap_ul_map_type_1, tvb, ul_map_offset, 1, FALSE); + /* display the CQI Region Change Indication */ + proto_tree_add_item(tree, hf_culmap_cqi_region_change_indication_1, tvb, ul_map_offset, 1, FALSE); + /* get the CQI Region Change Indication */ + cqi_region_change_indication = (byte & 0x01); + /* move to next byte */ + ul_map_offset++; + nibble_offset = 0; + } + else + { /* display the UL-MAP type */ + proto_tree_add_item(tree, hf_culmap_ul_map_type, tvb, ul_map_offset, 1, FALSE); + /* display the CQI Region Change Indication */ + proto_tree_add_item(tree, hf_culmap_cqi_region_change_indication, tvb, ul_map_offset, 1, FALSE); + /* get the CQI Region Change Indication */ + cqi_region_change_indication = (byte & 0x10); + nibble_offset = 1; + } + length = 1; + if(cqi_region_change_indication == 1) + { + if(nibble_offset & 1) + { + /* display the OFDMA symbol offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_ofdma_symbol_offset_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + /* display the subchannel offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_subchannel_offset_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + /* display the number of OFDMA symbols */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_ofdma_symbols_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + /* display the number of subchannels */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_subchannels_1, tvb, ul_map_offset, 2, FALSE); + ul_map_offset++; + } + else + { /* display the OFDMA symbol offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_ofdma_symbol_offset, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + /* display the subchannel offset */ + proto_tree_add_item(tree, hf_culmap_uiuc_subchannel_offset, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + /* display the number of OFDMA symbols */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_ofdma_symbols, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + /* display the number of subchannels */ + proto_tree_add_item(tree, hf_culmap_uiuc_num_of_subchannels, tvb, ul_map_offset, 1, FALSE); + ul_map_offset++; + } + length += 8; + } + break; + case COMPACT_UL_MAP_TYPE_EXTENSION:/* 6.3.2.3.43.7.7 */ + /* decode the Compact UL-MAP externsion IE */ + nibble_length = wimax_culmap_extension_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset);//, cqich_indicator); + length = nibble_length; + break; + default:/* Reserved Type */ + /* display the reserved type */ + proto_tree_add_item(tree, hf_culmap_reserved_type_1, tvb, ul_map_offset, 1, FALSE); + length = 1; + break; + } + /* Update the nibble_offset and length */ + return length; +} + +/* Compact UL-MAP Reduced CID IE (6.3.2.3.43.3) decoder */ +static guint wimax_compact_ulmap_rcid_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint length = 0; + guint prefix; + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RCID IE"); + } +#endif + if(nibble_offset & 1) + { + if(cid_type == CID_TYPE_NORMAL) + { /* display the normal CID */ + proto_tree_add_item(tree, hf_rcid_ie_normal_cid_1, tvb, offset, 3, FALSE); + length = 4; + } + else + { /* Get the prefix bit */ + prefix = (tvb_get_guint8(tvb, offset) & 0x08); + /* display the prefix */ + proto_tree_add_item(tree, hf_rcid_ie_prefix_1, tvb, offset, 2, FALSE); + if(prefix) + { /* display the CID11 */ + proto_tree_add_item(tree, hf_rcid_ie_cid11_3, tvb, offset, 2, FALSE); + length = 3; + } + else + { + if(cid_type == CID_TYPE_RCID11) + { /* display the CID11 */ + proto_tree_add_item(tree, hf_rcid_ie_cid11_1, tvb, offset, 2, FALSE); + length = 3; + } + else if(cid_type == CID_TYPE_RCID7) + { /* display the normal CID7 */ + proto_tree_add_item(tree, hf_rcid_ie_cid7_1, tvb, offset, 2, FALSE); + length = 2; + } + else if(cid_type == CID_TYPE_RCID3) + { /* display the CID3 */ + proto_tree_add_item(tree, hf_rcid_ie_cid3_1, tvb, offset, 2, FALSE); + length = 1; + } + } + } + } + else + { + if(cid_type == CID_TYPE_NORMAL) + { /* display the normal CID */ + proto_tree_add_item(tree, hf_rcid_ie_normal_cid, tvb, offset, 2, FALSE); + length = 4; + } + else + { /* Get the prefix bit */ + prefix = (tvb_get_guint8(tvb, offset) & 0x08); + /* display the prefix */ + proto_tree_add_item(tree, hf_rcid_ie_prefix, tvb, offset, 2, FALSE); + if(prefix || (cid_type == CID_TYPE_RCID11)) + { /* display the CID11 */ + proto_tree_add_item(tree, hf_rcid_ie_cid11_2, tvb, offset, 2, FALSE); + length = 3; + } + else + { + if(cid_type == CID_TYPE_RCID11) + { /* display the CID11 */ + proto_tree_add_item(tree, hf_rcid_ie_cid11, tvb, offset, 2, FALSE); + length = 3; + } + else if(cid_type == CID_TYPE_RCID7) + { /* display the CID7 */ + proto_tree_add_item(tree, hf_rcid_ie_cid7, tvb, offset, 2, FALSE); + length = 2; + } + else if(cid_type == CID_TYPE_RCID3) + { /* display the CID3 */ + proto_tree_add_item(tree, hf_rcid_ie_cid3, tvb, offset, 2, FALSE); + length = 1; + } + } + } + } + /* return the IE length in nibbles */ + return length; +} + +/* Compact UL-MAP HARQ Control IE (6.3.2.3.43.4) decoder */ +static guint wimax_compact_ulmap_harq_control_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint byte, prefix, length = 0; + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "HARQ Control IE"); + } +#endif + /* Get the first byte */ + byte = tvb_get_guint8(tvb, offset); + if(nibble_offset & 1) + { /* Get the prefix bit */ + prefix = (byte & 0x08); + /* display the prefix */ + proto_tree_add_item(tree, hf_harq_control_ie_prefix_1, tvb, offset, 2, FALSE); + if(prefix) + { /* display the ai_sn */ + proto_tree_add_item(tree, hf_harq_control_ie_ai_sn_1, tvb, offset, 2, FALSE); + /* display the spid */ + proto_tree_add_item(tree, hf_harq_control_ie_spid_1, tvb, offset, 2, FALSE); + /* display the acid */ + proto_tree_add_item(tree, hf_harq_control_ie_acid_1, tvb, offset, 2, FALSE); + length = 2; + } + else + { /* display the reserved bits */ + proto_tree_add_item(tree, hf_harq_control_ie_reserved_1, tvb, offset, 2, FALSE); + length = 1; + } + } + else + { /* Get the prefix bit */ + prefix = (byte & 0x80); + /* display the prefix */ + proto_tree_add_item(tree, hf_harq_control_ie_prefix, tvb, offset, 1, FALSE); + if(prefix) + { /* display the ai_sn */ + proto_tree_add_item(tree, hf_harq_control_ie_ai_sn, tvb, offset, 1, FALSE); + /* display the spid */ + proto_tree_add_item(tree, hf_harq_control_ie_spid, tvb, offset, 1, FALSE); + /* display the acid */ + proto_tree_add_item(tree, hf_harq_control_ie_acid, tvb, offset, 1, FALSE); + length = 2; + } + else + { /* display the reserved bits */ + proto_tree_add_item(tree, hf_harq_control_ie_reserved, tvb, offset, 1, FALSE); + length = 1; + } + } + /* return the IE length in nibbles */ + return length; +} + +/* UL-MAP Extension IE sub-types */ +#define HARQ_MODE_SWITCH 0 +#define EXTENSION_TYPE_SHIFT 13 +#define EXTENSION_TYPE_SHIFT_1 9 +#define EXTENSION_SUBTYPE_SHIFT 8 +#define EXTENSION_SUBTYPE_SHIFT_1 4 +#define EXTENSION_LENGTH_SHIFT 4 + +/* Compact UL-MAP Extension IE (6.3.2.3.43.7.7) decoder */ +static guint wimax_culmap_extension_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint tvb_value, ul_map_type, sub_type, length; + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "UL-MAP Extension IE"); + } +#endif + /* Get the first 16-bit word */ + tvb_value = tvb_get_ntohs(tvb, offset); + if(nibble_offset & 1) + { /* Get the ul-map type */ + ul_map_type = ((tvb_value & EXTENSION_TYPE_MASK_1) >> EXTENSION_TYPE_SHIFT_1); + if(ul_map_type != COMPACT_UL_MAP_TYPE_EXTENSION) + return 0; + /* Get the sub-type */ + sub_type = ((tvb_value & EXTENSION_SUBTYPE_MASK_1) >> EXTENSION_SUBTYPE_SHIFT_1); + /* Get the IE length */ + length = (tvb_value & EXTENSION_LENGTH_MASK_1); + /* display the UL-MAP type */ + proto_tree_add_item(tree, hf_culmap_extension_type_1, tvb, offset, 2, FALSE); + /* display the UL-MAP extension subtype */ + proto_tree_add_item(tree, hf_culmap_extension_subtype_1, tvb, offset, 2, FALSE); + /* display the IE length */ + proto_tree_add_item(tree, hf_culmap_extension_length_1, tvb, offset, 2, FALSE); + offset += 2; + switch (sub_type) + { + case HARQ_MODE_SWITCH: + /* display the HARQ mode */ + proto_tree_add_item(tree, hf_culmap_extension_harq_mode, tvb, offset, 1, FALSE); + /* Get the next byte */ + tvb_value = tvb_get_guint8(tvb, offset); + /* get the HARQ mode */ + harq_mode = ((tvb_value & MSB_NIBBLE_MASK) >> 4); + break; + default: + /* display the unknown sub-type in HEX */ + proto_tree_add_item(tree, hf_culmap_extension_unknown_sub_type_1, tvb, offset, (length - 2), FALSE); + break; + } + } + else + { /* Get the UL-MAp type */ + ul_map_type = ((tvb_value & EXTENSION_TYPE_MASK) >> EXTENSION_TYPE_SHIFT); + if(ul_map_type != COMPACT_UL_MAP_TYPE_EXTENSION) + return 0; + /* Get the sub-type */ + sub_type = ((tvb_value & EXTENSION_SUBTYPE_MASK) >> EXTENSION_SUBTYPE_SHIFT); + /* Get the IE length */ + length = ((tvb_value & EXTENSION_LENGTH_MASK) >> EXTENSION_LENGTH_SHIFT); + /* display the UL-MAP type */ + proto_tree_add_item(tree, hf_culmap_extension_type, tvb, offset, 2, FALSE); + /* display the UL-MAP extension subtype */ + proto_tree_add_item(tree, hf_culmap_extension_subtype, tvb, offset, 2, FALSE); + /* display the IE length */ + proto_tree_add_item(tree, hf_culmap_extension_length, tvb, offset, 2, FALSE); + switch (sub_type) + { + case HARQ_MODE_SWITCH: + /* display the HARQ mode */ + proto_tree_add_item(tree, hf_culmap_extension_harq_mode_1, tvb, offset, 2, FALSE); + /* get the HARQ mode */ + harq_mode = (tvb_value & LSB_NIBBLE_MASK); + break; + default: + /* display the unknown sub-type in HEX */ + proto_tree_add_item(tree, hf_culmap_extension_unknown_sub_type, tvb, (offset + 1), (length - 1), FALSE); + break; + } + } + /* return the IE length in nibbles */ + return (length * 2); +} + +/* 8.4.5.4.3 (table 290) */ +guint wimax_cdma_allocation_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint byte; + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "CDMA Allocation IE"); + } +#endif + /* Get the first byte */ + byte = tvb_get_guint8(tvb, offset); + if(nibble_offset & 1) + { /* display the Duration */ + proto_tree_add_item(tree, hf_cdma_allocation_duration_1, tvb, offset, 2, FALSE); + /* display the UIUC */ + proto_tree_add_item(tree, hf_cdma_allocation_uiuc_1, tvb, offset, 2, FALSE); + /* display the Repetition Coding Indication */ + proto_tree_add_item(tree, hf_cdma_allocation_repetition_1, tvb, offset, 2, FALSE); + /* display the frame number index */ + proto_tree_add_item(tree, hf_cdma_allocation_frame_number_index_1, tvb, offset, 4, FALSE); + /* display the Ranging Code */ + proto_tree_add_item(tree, hf_cdma_allocation_ranging_code_1, tvb, offset, 4, FALSE); + /* display the Ranging Symbol */ + proto_tree_add_item(tree, hf_cdma_allocation_ranging_symbol_1, tvb, offset, 4, FALSE); + /* display the Ranging Subchannel */ + proto_tree_add_item(tree, hf_cdma_allocation_ranging_subchannel_1, tvb, offset, 4, FALSE); + /* display the BW Request Mandatory */ + proto_tree_add_item(tree, hf_cdma_allocation_bw_req_1, tvb, offset, 4, FALSE); + } + else + { /* display the Duration */ + proto_tree_add_item(tree, hf_cdma_allocation_duration, tvb, offset, 2, FALSE); + /* display the UIUC */ + proto_tree_add_item(tree, hf_cdma_allocation_uiuc, tvb, offset, 2, FALSE); + /* display the Repetition Coding Indication */ + proto_tree_add_item(tree, hf_cdma_allocation_repetition, tvb, offset, 2, FALSE); + /* display the frame number index */ + proto_tree_add_item(tree, hf_cdma_allocation_frame_number_index, tvb, offset, 2, FALSE); + /* display the Ranging Code */ + proto_tree_add_item(tree, hf_cdma_allocation_ranging_code, tvb, offset, 1, FALSE); + /* display the Ranging Symbol */ + proto_tree_add_item(tree, hf_cdma_allocation_ranging_symbol, tvb, offset, 1, FALSE); + /* display the Ranging Subchannel */ + proto_tree_add_item(tree, hf_cdma_allocation_ranging_subchannel, tvb, offset, 1, FALSE); + /* display the BW Request Mandatory */ + proto_tree_add_item(tree, hf_cdma_allocation_bw_req, tvb, offset, 1, FALSE); + } + /* return the IE length in nibbles */ + return 8; +} + +/* Extended UIUCs (table 290a) */ +#define POWER_CONTROL_IE 0 +#define MINI_SUBCHANNEL_ALLOCATION_IE 1 +#define AAS_UL_IE 2 +#define CQICH_ALLOC_IE 3 +#define UL_ZONE_IE 4 +#define PHYMOD_UL_IE 5 +#define MIMO_UL_BASIC_IE 6 +#define UL_MAP_FAST_TRACKING_IE 7 +#define UL_PUSC_BURST_ALLOCATION_IN_OTHER_SEGMENT_IE 8 +#define FAST_RANGING_IE 9 +#define UL_ALLOCATION_START_IE 10 + +/* 8.4.5.4.4.1 (table 290b) */ +guint wimax_extended_uiuc_dependent_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset) +{ + guint ext_uiuc, length, m, i; + guint8 byte; + +#ifdef DEBUG + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Extended UIUC IE"); + } +#endif + + /* get the first byte */ + byte = tvb_get_guint8(tvb, offset); + if(nibble_offset & 1) + { /* get the extended UIUC */ + ext_uiuc = (byte & LSB_NIBBLE_MASK); + /* display extended UIUC */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_uiuc_1, tvb, offset, 1, FALSE); + /* move to next byte */ + offset++; + /* get the 2nd byte */ + byte = tvb_get_guint8(tvb, offset); + /* get the length */ + length = ((byte & MSB_NIBBLE_MASK) >> 4); + /* display extended UIUC length */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_length_1, tvb, offset, 1, FALSE); + } + else + { /* get the extended UIUC */ + ext_uiuc = ((byte & MSB_NIBBLE_MASK) >> 4); + /* get the length */ + length = (byte & LSB_NIBBLE_MASK); + /* display extended UIUC */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_uiuc, tvb, offset, 1, FALSE); + /* display extended UIUC length */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_length, tvb, offset, 1, FALSE); + /* move to next byte */ + offset++; + } + /* 8.4.5.4.4.1 (table 290b) */ + switch (ext_uiuc) + { + case POWER_CONTROL_IE: + /* 8.4.5.4.5 Power Control IE */ + if(nibble_offset & 1) + { /* display power control value */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_power_control_24, tvb, offset, 3, FALSE); + /* display power measurement frame value */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_power_measurement_frame_24, tvb, offset, 3, FALSE); + } + else + { /* display power control value */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_power_control, tvb, offset, 1, FALSE); + /* display power measurement frame value */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_power_measurement_frame, tvb, (offset + 1), 1, FALSE); + } + break; + case MINI_SUBCHANNEL_ALLOCATION_IE: + /* 8.4.5.4.8 Mini Subchannel Allocation IE */ + /* set the M value */ + switch (length) + { + case 15: + m = 6; + break; + case 9: + m = 3; + break; + case 7: + default: + m = 2; + break; + } + if(nibble_offset & 1) + { + /* display MINI Subchannel Allocation CType value */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_ctype_16, tvb, offset, 2, FALSE); + /* display MINI Subchannel Allocation Duration value */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_duration_16, tvb, offset, 2, FALSE); + } + else + { /* display MINI Subchannel Allocation CType value */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_ctype, tvb, offset, 1, FALSE); + /* display MINI Subchannel Allocation Duration value */ + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_duration, tvb, offset, 1, FALSE); + } + offset++; + /* decode and display CIDs, UIUCs, and Repetitions */ + for(i=0; i<m; i+=2) + { + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_cid_1, tvb, offset, 4, FALSE); + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_1, tvb, offset, 4, FALSE); + offset += 2; + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_1, tvb, offset, 4, FALSE); + if(i < (m-2)) + { + offset += 3; + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_cid_3, tvb, offset, 4, FALSE); + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_3, tvb, offset, 4, FALSE); + offset += 2; + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_3, tvb, offset, 4, FALSE); + offset += 3; + } + else if(m == 3) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_padding_1, tvb, offset, 4, FALSE); + } + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_cid, tvb, offset, 3, FALSE); + offset += 2; + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc, tvb, offset, 3, FALSE); + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_repetition, tvb, offset, 3, FALSE); + offset += 3; + if(i < (m-2)) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_cid_2, tvb, offset, 4, FALSE); + offset += 2; + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_2, tvb, offset, 4, FALSE); + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_2, tvb, offset, 4, FALSE); + offset += 4; + } + else if(m == 3) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_mini_subchannel_alloc_padding, tvb, offset, 1, FALSE); + } + } + } + break; + case AAS_UL_IE: + /* 8.4.5.4.6 AAS UL IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_aas_ul, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_aas_ul, tvb, offset, length, FALSE); + } + break; + case CQICH_ALLOC_IE: + /* 8.4.5.4.12 CQICH_ALLOC_IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_cqich_alloc, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_cqich_alloc, tvb, offset, length, FALSE); + } + break; + case UL_ZONE_IE: + /* 8.4.5.4.7 UL Zone Switch IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_ul_zone, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_ul_zone, tvb, offset, length, FALSE); + } + break; + case PHYMOD_UL_IE: + /* 8.4.5.4.14 PHYMOD_UL_IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_phymod_ul, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_phymod_ul, tvb, offset, length, FALSE); + } + break; + case MIMO_UL_BASIC_IE: + /* 8.4.5.4.11 MIMO_UL_BASIC_IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_mimo_ul_basic, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_mimo_ul_basic, tvb, offset, length, FALSE); + } + break; + case UL_MAP_FAST_TRACKING_IE: + /* 8.4.5.4.22 UL_MAP_FAST_TRACKING_IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_fast_tracking, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_fast_tracking, tvb, offset, length, FALSE); + } + break; + case UL_PUSC_BURST_ALLOCATION_IN_OTHER_SEGMENT_IE: + /* 8.4.5.4.17 UL PUSC Burst Allocation in Other Segment IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_ul_pusc_burst_allocation, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_ul_pusc_burst_allocation, tvb, offset, length, FALSE); + } + break; + case FAST_RANGING_IE: + /* 8.4.5.4.21 FAST_RANGING_IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_fast_ranging, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_fast_ranging, tvb, offset, length, FALSE); + } + break; + case UL_ALLOCATION_START_IE: + /* 8.4.5.4.15`UL_ALLOCATION_START_IE */ + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_ul_allocation_start, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_ul_allocation_start, tvb, offset, length, FALSE); + } + break; + default: + if(nibble_offset & 1) + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_unknown_uiuc, tvb, offset, (length + 1), FALSE); + } + else + { + proto_tree_add_item(tree, hf_extended_uiuc_ie_unknown_uiuc, tvb, offset, length, FALSE); + } + break; + } + return ((length + 1) * 2 ); /* length in nibbles */ +} diff --git a/plugins/wimax/wimax_fch_decoder.c b/plugins/wimax/wimax_fch_decoder.c new file mode 100644 index 0000000000..0f63fa108e --- /dev/null +++ b/plugins/wimax/wimax_fch_decoder.c @@ -0,0 +1,257 @@ +/* wimax_fch_decoder.c + * WiMax FCH Burst decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <string.h> +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> + +extern gint proto_wimax; + +extern address bs_address; /* declared in packet-wmx.c */ + +/* forward reference */ +void proto_register_wimax_fch(void); +static void dissect_wimax_fch_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static int proto_wimax_fch_decoder = -1; +static gint ett_wimax_fch_decoder = -1; + +#define FCH_BURST_LENGTH 3 +/* FCH Burst bits */ +#define USED_SUB_CHANNEL_GROUP_0 0x800000 +#define USED_SUB_CHANNEL_GROUP_1 0x400000 +#define USED_SUB_CHANNEL_GROUP_2 0x200000 +#define USED_SUB_CHANNEL_GROUP_3 0x100000 +#define USED_SUB_CHANNEL_GROUP_4 0x080000 +#define USED_SUB_CHANNEL_GROUP_5 0x040000 +#define FCH_RESERVED_1 0x020000 +#define REPETITION_CODING_INDICATION 0x018000 +#define CODING_INDICATION 0x007000 +#define DL_MAP_LENGTH 0x000FF0 +#define FCH_RESERVED_2 0x00000F + +static int hf_fch_used_subchannel_group0 = -1; +static int hf_fch_used_subchannel_group1 = -1; +static int hf_fch_used_subchannel_group2 = -1; +static int hf_fch_used_subchannel_group3 = -1; +static int hf_fch_used_subchannel_group4 = -1; +static int hf_fch_used_subchannel_group5 = -1; +static int hf_fch_reserved_1 = -1; +static int hf_fch_repetition_coding_indication = -1; +static int hf_fch_coding_indication = -1; +static int hf_fch_dlmap_length = -1; +static int hf_fch_reserved_2 = -1; + +static const value_string used_or_not_used[] = +{ + { 0, "Is Not Used" }, + { 1, "Is Used" }, + { 0, NULL } +}; + +/* DL Frame Prefix Repetition Coding Indications */ +static const value_string repetition_coding_indications[] = +{ + { 0, "No Repetition Coding" }, + { 1, "Repetition Coding of 2 Used" }, + { 2, "Repetition Coding of 4 Used" }, + { 3, "Repetition Coding of 6 Used" }, + { 4, NULL } +}; + +/* DL Frame Prefix Coding Indications */ +static const value_string coding_indications[] = +{ + { 0, "CC Encoding Used" }, + { 1, "BTC Encoding Used" }, + { 2, "CTC Encoding Used" }, + { 3, "ZT CC Encoding Used" }, + { 4, "CC Encoding with optional interleaver" }, + { 5, "LDPC Encoding Used" }, + { 6, "Reserved" }, + { 7, "Reserved" }, + { 0, NULL } +}; + +/* TLV display */ +static hf_register_info hf[] = +{ + { + &hf_fch_used_subchannel_group0, + { + "Sub-Channel Group 0", "wimax.fch.subchannel_group0", + FT_UINT24, BASE_DEC, VALS(used_or_not_used), USED_SUB_CHANNEL_GROUP_0, + "", HFILL + } + }, + { + &hf_fch_used_subchannel_group1, + { + "Sub-Channel Group 1", "wimax.fch.subchannel_group1", + FT_UINT24, BASE_DEC, VALS(used_or_not_used), USED_SUB_CHANNEL_GROUP_1, + "", HFILL + } + }, + { + &hf_fch_used_subchannel_group2, + { + "Sub-Channel Group 2", "wimax.fch.subchannel_group2", + FT_UINT24, BASE_DEC, VALS(used_or_not_used), USED_SUB_CHANNEL_GROUP_2, + "", HFILL + } + }, + { + &hf_fch_used_subchannel_group3, + { + "Sub-Channel Group 3", "wimax.fch.subchannel_group3", + FT_UINT24, BASE_DEC, VALS(used_or_not_used), USED_SUB_CHANNEL_GROUP_3, + "", HFILL + } + }, + { + &hf_fch_used_subchannel_group4, + { + "Sub-Channel Group 4", "wimax.fch.subchannel_group4", + FT_UINT24, BASE_DEC, VALS(used_or_not_used), USED_SUB_CHANNEL_GROUP_4, + "", HFILL + } + }, + { + &hf_fch_used_subchannel_group5, + { + "Sub-Channel Group 5", "wimax.fch.subchannel_group5", + FT_UINT24, BASE_DEC, VALS(used_or_not_used), USED_SUB_CHANNEL_GROUP_5, + "", HFILL + } + }, + { + &hf_fch_reserved_1, + { + "Reserved", "wimax.fch.reserved1", + FT_UINT24, BASE_DEC, NULL, FCH_RESERVED_1, + "", HFILL + } + }, + { + &hf_fch_repetition_coding_indication, + { + "Repetition Coding Indication", "wimax.fch.repetition_coding_indication", + FT_UINT24, BASE_DEC, VALS(repetition_coding_indications), REPETITION_CODING_INDICATION, + "", HFILL + } + }, + { + &hf_fch_coding_indication, + { + "Coding Indication", "wimax.fch.coding_indication", + FT_UINT24, BASE_DEC, VALS(coding_indications), CODING_INDICATION, + "", HFILL + } + }, + { + &hf_fch_dlmap_length, + { + "DL Map Length", "wimax.fch.dl_map_length", + FT_UINT24, BASE_DEC, NULL, DL_MAP_LENGTH, + "", HFILL + } + }, + { + &hf_fch_reserved_2, + { + "Reserved", "wimax.fch.reserved2", + FT_UINT24, BASE_DEC, NULL, FCH_RESERVED_2, + "", HFILL + } + } +}; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_fch_decoder, +}; + +/* Register Wimax FCH Protocol */ +void proto_register_wimax_fch(void) +{ + if (proto_wimax_fch_decoder == -1) + { + proto_wimax_fch_decoder = proto_wimax; + + /* register the field display messages */ + proto_register_field_array(proto_wimax_fch_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } + register_dissector("wimax_fch_burst_handler", dissect_wimax_fch_decoder, -1); +} + +static void dissect_wimax_fch_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + gint offset = 0; + proto_item *fch_item = NULL; + proto_tree *fch_tree = NULL; + + /* save the base station address (once) */ + if(!bs_address.len) + COPY_ADDRESS(&bs_address, &(pinfo->src)); + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "FCH"); + } + if (tree) + { /* we are being asked for details */ + /* display FCH dissector info */ + fch_item = proto_tree_add_protocol_format(tree, proto_wimax_fch_decoder, tvb, offset, 3, "DL Frame Prefix (24 bits)"); + /* add FCH subtree */ + fch_tree = proto_item_add_subtree(fch_item, ett_wimax_fch_decoder); + /* Decode and display the used sub-channel groups */ + proto_tree_add_item(fch_tree, hf_fch_used_subchannel_group0, tvb, offset, FCH_BURST_LENGTH, FALSE); + proto_tree_add_item(fch_tree, hf_fch_used_subchannel_group1, tvb, offset, FCH_BURST_LENGTH, FALSE); + proto_tree_add_item(fch_tree, hf_fch_used_subchannel_group2, tvb, offset, FCH_BURST_LENGTH, FALSE); + proto_tree_add_item(fch_tree, hf_fch_used_subchannel_group3, tvb, offset, FCH_BURST_LENGTH, FALSE); + proto_tree_add_item(fch_tree, hf_fch_used_subchannel_group4, tvb, offset, FCH_BURST_LENGTH, FALSE); + proto_tree_add_item(fch_tree, hf_fch_used_subchannel_group5, tvb, offset, FCH_BURST_LENGTH, FALSE); + proto_tree_add_item(fch_tree, hf_fch_reserved_1, tvb, offset, FCH_BURST_LENGTH, FALSE); + /* Decode and display the repetition coding indication */ + proto_tree_add_item(fch_tree, hf_fch_repetition_coding_indication, tvb, offset, FCH_BURST_LENGTH, FALSE); + /* Decode and display the coding indication */ + proto_tree_add_item(fch_tree, hf_fch_coding_indication, tvb, offset, FCH_BURST_LENGTH, FALSE); + /* Decode and display the DL MAP length */ + proto_tree_add_item(fch_tree, hf_fch_dlmap_length, tvb, offset, FCH_BURST_LENGTH, FALSE); + proto_tree_add_item(fch_tree, hf_fch_reserved_2, tvb, offset, FCH_BURST_LENGTH, FALSE); + } +} diff --git a/plugins/wimax/wimax_ffb_decoder.c b/plugins/wimax/wimax_ffb_decoder.c new file mode 100644 index 0000000000..66244460b6 --- /dev/null +++ b/plugins/wimax/wimax_ffb_decoder.c @@ -0,0 +1,137 @@ +/* wimax_ffb_decoder.c + * WiMax Fast Feedback packet decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> + +extern gint proto_wimax; + +/* forward reference */ +static void dissect_wimax_ffb_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_wimax_ffb_decoder = -1; +static gint ett_wimax_ffb_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_ffb_decoder, +}; + +static gint hf_ffb_burst = -1; +static gint hf_ffb_num_of_ffbs = -1; +static gint hf_ffb_type = -1; +static gint hf_ffb_subchannel = -1; +static gint hf_ffb_symboloffset = -1; +static gint hf_ffb_value = -1; + +/* FFB display */ +static hf_register_info hf[] = +{ + { + &hf_ffb_burst, + {"Fast Feedback Burst", "wimax.ffb.burst", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_ffb_num_of_ffbs, + {"Number Of Fast Feedback", "wimax.ffb.num_of_ffbs", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_ffb_type, + {"Fast Feedback Type", "wimax.ffb.ffb_type", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_ffb_subchannel, + {"Physical Subchannel", "wimax.ffb.subchannel", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_ffb_symboloffset, + {"Symbol Offset", "wimax.ffb.symbol_offset", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_ffb_value, + {"Fast Feedback Value", "wimax.ffb.ffb_value", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* Register Wimax FFB Protocol */ +void proto_register_wimax_ffb(void) +{ + if (proto_wimax_ffb_decoder == -1) + { + proto_wimax_ffb_decoder = proto_wimax; + + /* register the field display messages */ + proto_register_field_array(proto_wimax_ffb_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } + register_dissector("wimax_ffb_burst_handler", dissect_wimax_ffb_decoder, -1); +} + +static void dissect_wimax_ffb_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + gint offset = 0; + guint length, num_of_ffbs, i; + proto_item *ffb_item = NULL; + proto_tree *ffb_tree = NULL; + + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Fast Feedback Burst:"); + } + if (tree) + { /* we are being asked for details */ + /* get the tvb length */ + length = tvb_length(tvb); + /* display Fast Feedback Burst dissector info */ + ffb_item = proto_tree_add_protocol_format(tree, proto_wimax_ffb_decoder, tvb, offset, length, "Fast Feedback Burst (%u bytes)", length); + /* add Fast Feedback Burst subtree */ + ffb_tree = proto_item_add_subtree(ffb_item, ett_wimax_ffb_decoder); + /* get the number of FFBs */ + num_of_ffbs = tvb_get_guint8(tvb, offset); + /* display the number of FFBs */ + proto_tree_add_item(ffb_tree, hf_ffb_num_of_ffbs, tvb, offset++, 1, FALSE); + /* display the FFB type */ + proto_tree_add_item(ffb_tree, hf_ffb_type, tvb, offset++, 1, FALSE); + /* display the FFBs */ + for(i = 0; i < num_of_ffbs; i++) + { + proto_tree_add_item(ffb_tree, hf_ffb_subchannel, tvb, offset++, 1, FALSE); + proto_tree_add_item(ffb_tree, hf_ffb_symboloffset, tvb, offset++, 1, FALSE); + proto_tree_add_item(ffb_tree, hf_ffb_value, tvb, offset++, 1, FALSE); + } + } +} diff --git a/plugins/wimax/wimax_hack_decoder.c b/plugins/wimax/wimax_hack_decoder.c new file mode 100644 index 0000000000..66b819e8a9 --- /dev/null +++ b/plugins/wimax/wimax_hack_decoder.c @@ -0,0 +1,148 @@ +/* wimax_hack_decoder.c + * WiMax HARQ ACK Burst decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> + +extern gint proto_wimax; + +/* forward reference */ +static void dissect_wimax_hack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_wimax_hack_decoder = -1; +static gint ett_wimax_hack_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_hack_decoder, +}; + +static const value_string vals_flags[] = +{ + {0, "Even Half-Slot (tiles 0,2,4)"}, + {1, "Odd Half-Slot (tiles 1,3,5)"}, + {0, NULL} +}; + +static const value_string vals_values[] = +{ + {0, "ACK"}, + {1, "NACK"} +}; + +static gint hf_hack_burst = -1; +static gint hf_hack_num_of_hacks = -1; +static gint hf_hack_half_slot_flag = -1; +static gint hf_hack_subchannel = -1; +static gint hf_hack_symboloffset = -1; +static gint hf_hack_value = -1; + +/* HARQ ACK display */ +static hf_register_info hf[] = +{ + { + &hf_hack_burst, + {"HARQ ACK Burst", "wimax.hack.burst", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_hack_num_of_hacks, + {"Number Of HARQ ACKs/NACKs", "wimax.hack.num_of_hacks", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_hack_subchannel, + {"Physical Subchannel", "wimax.hack.subchannel", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_hack_symboloffset, + {"Symbol Offset", "wimax.hack.symbol_offset", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_hack_half_slot_flag, + {"Half-Slot Flag", "wimax.hack.half_slot_flag", FT_UINT8, BASE_DEC, VALS(vals_flags), 0x0, "", HFILL} + }, + { + &hf_hack_value, + {"ACK Value", "wimax.hack.hack_value", FT_UINT8, BASE_DEC, VALS(vals_values), 0x0, "", HFILL} + } +}; + +/* Register Wimax HARQ ACK Protocol */ +void proto_register_wimax_hack(void) +{ + if (proto_wimax_hack_decoder == -1) + { + proto_wimax_hack_decoder = proto_wimax; + + register_dissector("wimax_hack_burst_handler", dissect_wimax_hack_decoder, -1); + proto_register_field_array(proto_wimax_hack_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + +static void dissect_wimax_hack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + gint offset = 0; + guint length, num_of_hacks, i; + proto_item *hack_item = NULL; + proto_tree *hack_tree = NULL; + + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "HARQ ACK Burst:"); + } + if (tree) + { /* we are being asked for details */ + /* get the tvb length */ + length = tvb_length(tvb); + /* display HARQ ACK Burst dissector info */ + hack_item = proto_tree_add_protocol_format(tree, proto_wimax_hack_decoder, tvb, offset, length, "HARQ ACK Burst (%u bytes)", length); + /* add HARQ ACK Burst subtree */ + hack_tree = proto_item_add_subtree(hack_item, ett_wimax_hack_decoder); + /* get the number of HARQ ACKs */ + num_of_hacks = tvb_get_guint8(tvb, offset); + /* display the number of HARQ ACKs */ + proto_tree_add_item(hack_tree, hf_hack_num_of_hacks, tvb, offset++, 1, FALSE); + /* display the HARQ ACKs */ + for(i = 0; i < num_of_hacks; i++) + { + proto_tree_add_item(hack_tree, hf_hack_subchannel, tvb, offset++, 1, FALSE); + proto_tree_add_item(hack_tree, hf_hack_symboloffset, tvb, offset++, 1, FALSE); + proto_tree_add_item(hack_tree, hf_hack_half_slot_flag, tvb, offset++, 1, FALSE); + proto_tree_add_item(hack_tree, hf_hack_value, tvb, offset++, 1, FALSE); + } + } +} diff --git a/plugins/wimax/wimax_harq_map_decoder.c b/plugins/wimax/wimax_harq_map_decoder.c new file mode 100644 index 0000000000..995b66b25e --- /dev/null +++ b/plugins/wimax/wimax_harq_map_decoder.c @@ -0,0 +1,226 @@ +/* wimax_harq_map_decoder.c + * WiMax HARQ Map Message decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" + +extern guint wimax_compact_dlmap_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); +extern guint wimax_compact_ulmap_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); + + +extern gint proto_wimax; + +/* forward reference */ +void dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_wimax_harq_map_decoder = -1; +static gint ett_wimax_harq_map_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_harq_map_decoder, +}; + +/* MASKs */ +#define LSB_NIBBLE_MASK 0x0F + +/* HARQ MAP masks */ +#define WIMAX_HARQ_MAP_INDICATOR_MASK 0xE00000 +#define WIMAX_HARQ_UL_MAP_APPENDED_MASK 0x100000 +#define WIMAX_HARQ_MAP_RESERVED_MASK 0x080000 +#define WIMAX_HARQ_MAP_MSG_LENGTH_MASK 0x07FC00 +#define WIMAX_HARQ_MAP_DL_IE_COUNT_MASK 0x0003F0 +#define WIMAX_HARQ_MAP_MSG_LENGTH_SHIFT 10 +#define WIMAX_HARQ_MAP_DL_IE_COUNT_SHIFT 4 + +/* HARQ MAP display indexies */ +static gint hf_harq_map_indicator = -1; +static gint hf_harq_ul_map_appended = -1; +static gint hf_harq_map_reserved = -1; +static gint hf_harq_map_msg_length = -1; +static gint hf_harq_dl_ie_count = -1; +static gint hf_harq_map_msg_crc = -1; + +/* HARQ MAP display */ +static hf_register_info hf_harq_map[] = +{ + { + &hf_harq_map_indicator, + {"HARQ MAP Indicator", "wimax.harq_map.indicator", FT_UINT24, BASE_HEX, NULL, WIMAX_HARQ_MAP_INDICATOR_MASK, "", HFILL} + }, + { + &hf_harq_ul_map_appended, + {"HARQ UL-MAP Appended", "wimax.harq_map.ul_map_appended", FT_UINT24, BASE_HEX, NULL, WIMAX_HARQ_UL_MAP_APPENDED_MASK, "", HFILL} + }, + { + &hf_harq_map_reserved, + {"Reserved", "wimax.harq_map.reserved", FT_UINT24, BASE_HEX, NULL, WIMAX_HARQ_MAP_RESERVED_MASK, "", HFILL} + }, + { + &hf_harq_map_msg_length, + {"Map Message Length", "wimax.harq_map.msg_length", FT_UINT24, BASE_DEC, NULL, WIMAX_HARQ_MAP_MSG_LENGTH_MASK, "", HFILL} + }, + { + &hf_harq_dl_ie_count, + {"DL IE Count", "wimax.harq_map.dl_ie_count", FT_UINT24, BASE_DEC, NULL, WIMAX_HARQ_MAP_DL_IE_COUNT_MASK, "", HFILL} + }, + { + &hf_harq_map_msg_crc, + {"HARQ MAP Message CRC", "wimax.harq_map.msg_crc", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* Register Wimax HARQ MAP Protocol */ +void proto_register_wimax_harq_map(void) +{ + if (proto_wimax_harq_map_decoder == -1) + { + proto_wimax_harq_map_decoder = proto_wimax; + + proto_register_subtree_array(ett, array_length(ett)); + proto_register_field_array(proto_wimax_harq_map_decoder, hf_harq_map, array_length(hf_harq_map)); + } +} + +/* HARQ MAP message decoder */ +void dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint i, offset = 0; + guint tvb_len, length, dl_ie_count; + guint ie_length; + proto_item *harq_map_item = NULL; + proto_tree *harq_map_tree = NULL; + guint nibble_offset; + proto_item *parent_item = NULL; + proto_item *it = NULL; + guint ulmap_appended; + guint32 harq_map_msg_crc, calculated_crc; + guint32 first_24bits; + + /* check the tvb length */ + tvb_len = tvb_length(tvb); + if(!tvb_len) + { /* do nothing if tvb is empty */ + return; + } + /* Ensure the right payload type */ + first_24bits = tvb_get_ntoh24(tvb, offset); + if((first_24bits & WIMAX_HARQ_MAP_INDICATOR_MASK) != WIMAX_HARQ_MAP_INDICATOR_MASK) + { /* do nothing if tvb is not a HARQ MAP message */ + return; + } + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "HARQ-MAP Message: "); + } + if (tree) + { /* we are being asked for details */ + /* get the parent */ + parent_item = proto_tree_get_parent(tree); + /* display HARQ-MAP Message and create subtree */ + harq_map_item = proto_tree_add_protocol_format(tree, proto_wimax_harq_map_decoder, tvb, offset, tvb_len, "HARQ-MAP Message (%u bytes)", tvb_len); + harq_map_tree = proto_item_add_subtree(harq_map_item, ett_wimax_harq_map_decoder); + /* display the HARQ MAP Indicator */ + proto_tree_add_item(harq_map_tree, hf_harq_map_indicator, tvb, offset, 3, FALSE); + /* display the HARQ MAp UL-MAP Appended */ + proto_tree_add_item(harq_map_tree, hf_harq_ul_map_appended, tvb, offset, 3, FALSE); + /* display the reserved bit */ + proto_tree_add_item(harq_map_tree, hf_harq_map_reserved, tvb, offset, 3, FALSE); + /* display the HARQ MAP message length */ + proto_tree_add_item(harq_map_tree, hf_harq_map_msg_length, tvb, offset, 3, FALSE); + /* display the DL IE count */ + proto_tree_add_item(harq_map_tree, hf_harq_dl_ie_count, tvb, offset, 3, FALSE); + /* get the message length */ + length = ((first_24bits & WIMAX_HARQ_MAP_MSG_LENGTH_MASK) >> WIMAX_HARQ_MAP_MSG_LENGTH_SHIFT); + /* get the DL IE count */ + dl_ie_count = ((first_24bits & WIMAX_HARQ_MAP_DL_IE_COUNT_MASK) >> WIMAX_HARQ_MAP_DL_IE_COUNT_SHIFT); + /* get the UL MAP appended */ + ulmap_appended = (first_24bits & WIMAX_HARQ_UL_MAP_APPENDED_MASK); + if (parent_item == NULL || parent_item->finfo == NULL) + { + parent_item = harq_map_item; /* Prevent crash */ + } + /* set the offsets to Compact DL-MAP IEs */ + offset += 2; + nibble_offset = 1; + /* process the compact dl_map ies */ + for(i=0; i<dl_ie_count; i++) + { /* add the DL-MAp IEs info */ + proto_item_append_text(parent_item, " - DL-MAP IEs"); + /* decode Compact DL-MAP IEs */ + ie_length = wimax_compact_dlmap_ie_decoder(harq_map_tree, pinfo, tvb, offset, nibble_offset); + offset += ((nibble_offset + ie_length) >> 1); + nibble_offset = ((nibble_offset + ie_length) & 1); + } + /* check if there exist the compact ul_map IEs */ + if (ulmap_appended) + { /* add the UL-MAp IEs info */ + proto_item_append_text(parent_item, ",UL-MAP IEs"); + /* process the compact ul_map ies */ + while(offset < (length - sizeof(harq_map_msg_crc))) + { /* decode Compact UL-MAP IEs */ + ie_length = wimax_compact_ulmap_ie_decoder(harq_map_tree, pinfo, tvb, offset, nibble_offset); + /* Prevent endless loop with erroneous data. */ + if (ie_length < 2) + ie_length = 2; + offset += ((nibble_offset + ie_length) >> 1); + nibble_offset = ((nibble_offset + ie_length) & 1); + } + } + /* handle the padding */ + if(nibble_offset) + { + /* add the Padding info */ + proto_item_append_text(parent_item, ",Padding"); + proto_tree_add_protocol_format(harq_map_tree, proto_wimax_harq_map_decoder, tvb, offset, 1, "Padding Nibble: 0x%x", (tvb_get_guint8(tvb, offset) & LSB_NIBBLE_MASK)); + } + /* add the CRC info */ + proto_item_append_text(parent_item, ",CRC"); + /* get the CRC */ + harq_map_msg_crc = tvb_get_ntohl(tvb, length - sizeof(harq_map_msg_crc)); + /* calculate the HARQ MAM Message CRC */ + calculated_crc = wimax_mac_calc_crc32((guint8 *)tvb_get_ptr(tvb, 0, length - sizeof(harq_map_msg_crc)), length - sizeof(harq_map_msg_crc)); + /* display the CRC */ + it = proto_tree_add_item(harq_map_tree, hf_harq_map_msg_crc, tvb, length - sizeof(harq_map_msg_crc), sizeof(harq_map_msg_crc), FALSE); + /* verify the CRC */ + if (harq_map_msg_crc != calculated_crc) + { + proto_item_append_text(it, " - incorrect! (should be: 0x%x)", calculated_crc); + } + } +} diff --git a/plugins/wimax/wimax_mac.h b/plugins/wimax/wimax_mac.h new file mode 100644 index 0000000000..855cf7ac94 --- /dev/null +++ b/plugins/wimax/wimax_mac.h @@ -0,0 +1,702 @@ +/* wimax_mac.h + * WiMax MAC Definitions + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef WIMAX_MAC_H +#define WIMAX_MAC_H + +#define IP_HEADER_BYTE 0x45 + +/* WiMax MAC Header/Subheader Sizes */ +#define WIMAX_MAC_HEADER_SIZE 6 +#define WIMAX_MAC_SUBHEADER_MESH_SIZE 2 +#define WIMAX_MAC_SUBHEADER_FAST_FEEDBACK_SIZE 1 +#define WIMAX_MAC_SUBHEADER_GRANT_MGMT_SIZE 2 + +#define WIMAX_MAC_SUBHEADER_FRAG_SIZE(x) (((x) & (WIMAX_MAC_TYPE_EXTENDED | WIMAX_MAC_TYPE_ARQ)) ? 3 : 2) +#define WIMAX_MAC_SUBHEADER_PACK_SIZE(x) (((x) & (WIMAX_MAC_TYPE_EXTENDED | WIMAX_MAC_TYPE_ARQ)) ? 3 : 2) + +#define WIMAX_MAC_HEADER_GENERIC 0 +#define WIMAX_MAC_CID_PADDING 0xFFFE + +/* wimax mac arq */ +#define ARQ_CUMULATIVE_ACK_ENTRY 1 +#define ARQ_CUMULATIVE_ACK_BLOCK_SEQ 3 +#define ARQ_ACK_MAP_SIZE 2 + +/* WiMax MAC Header Sub-types (Table 6) */ +#define WIMAX_MAC_TYPE_MESH (1 << 5) +#define WIMAX_MAC_TYPE_ARQ (1 << 4) +#define WIMAX_MAC_TYPE_EXTENDED (1 << 3) +#define WIMAX_MAC_TYPE_FRAGMENTATION (1 << 2) +#define WIMAX_MAC_TYPE_PACKING (1 << 1) +#define WIMAX_MAC_TYPE_FAST_FEEDBACK (1 << 0) +#define WIMAX_MAC_TYPE_GRANT_MGMT (1 << 0) + +/* wimax mac management messages (Table 14) */ +#define MAC_MGMT_MSG_UCD 0 +#define MAC_MGMT_MSG_DCD 1 +#define MAC_MGMT_MSG_DL_MAP 2 +#define MAC_MGMT_MSG_UL_MAP 3 +#define MAC_MGMT_MSG_RNG_REQ 4 +#define MAC_MGMT_MSG_RNG_RSP 5 +#define MAC_MGMT_MSG_REG_REQ 6 +#define MAC_MGMT_MSG_REG_RSP 7 + +#define MAC_MGMT_MSG_PKM_REQ 9 +#define MAC_MGMT_MSG_PKM_RSP 10 +#define MAC_MGMT_MSG_DSA_REQ 11 +#define MAC_MGMT_MSG_DSA_RSP 12 +#define MAC_MGMT_MSG_DSA_ACK 13 +#define MAC_MGMT_MSG_DSC_REQ 14 +#define MAC_MGMT_MSG_DSC_RSP 15 +#define MAC_MGMT_MSG_DSC_ACK 16 +#define MAC_MGMT_MSG_DSD_REQ 17 +#define MAC_MGMT_MSG_DSD_RSP 18 + +#define MAC_MGMT_MSG_MCA_REQ 21 +#define MAC_MGMT_MSG_MCA_RSP 22 +#define MAC_MGMT_MSG_DBPC_REQ 23 +#define MAC_MGMT_MSG_DBPC_RSP 24 +#define MAC_MGMT_MSG_RES_CMD 25 +#define MAC_MGMT_MSG_SBC_REQ 26 +#define MAC_MGMT_MSG_SBC_RSP 27 +#define MAC_MGMT_MSG_CLK_CMP 28 +#define MAC_MGMT_MSG_DREG_CMD 29 +#define MAC_MGMT_MSG_DSX_RVD 30 +#define MAC_MGMT_MSG_TFTP_CPLT 31 +#define MAC_MGMT_MSG_TFTP_RSP 32 +#define MAC_MGMT_MSG_ARQ_FEEDBACK 33 +#define MAC_MGMT_MSG_ARQ_DISCARD 34 +#define MAC_MGMT_MSG_ARQ_RESET 35 +#define MAC_MGMT_MSG_REP_REQ 36 +#define MAC_MGMT_MSG_REP_RSP 37 +#define MAC_MGMT_MSG_FPC 38 +#define MAC_MGMT_MSG_MSH_NCFG 39 +#define MAC_MGMT_MSG_MSH_NENT 40 +#define MAC_MGMT_MSG_MSH_DSCH 41 +#define MAC_MGMT_MSG_MSH_CSCH 42 +#define MAC_MGMT_MSG_MSH_CSCF 43 +#define MAC_MGMT_MSG_AAS_FBCK_REQ 44 +#define MAC_MGMT_MSG_AAS_FBCK_RSP 45 +#define MAC_MGMT_MSG_AAS_BEAM_SELECT 46 +#define MAC_MGMT_MSG_AAS_BEAM_REQ 47 +#define MAC_MGMT_MSG_AAS_BEAM_RSP 48 +#define MAC_MGMT_MSG_DREG_REQ 49 + +#define MAC_MGMT_MSG_MOB_SLP_REQ 50 +#define MAC_MGMT_MSG_MOB_SLP_RSP 51 +#define MAC_MGMT_MSG_MOB_TRF_IND 52 +#define MAC_MGMT_MSG_MOB_NBR_ADV 53 +#define MAC_MGMT_MSG_MOB_SCN_REQ 54 +#define MAC_MGMT_MSG_MOB_SCN_RSP 55 +#define MAC_MGMT_MSG_MOB_BSHO_REQ 56 +#define MAC_MGMT_MSG_MOB_MSHO_REQ 57 +#define MAC_MGMT_MSG_MOB_BSHO_RSP 58 +#define MAC_MGMT_MSG_MOB_HO_IND 59 +#define MAC_MGMT_MSG_MOB_SCN_REP 60 +#define MAC_MGMT_MSG_MOB_PAG_ADV 61 +#define MAC_MGMT_MSG_MBS_MAP 62 +#define MAC_MGMT_MSG_PMC_REQ 63 +#define MAC_MGMT_MSG_PMC_RSP 64 +#define MAC_MGMT_MSG_PRC_LT_CTRL 65 +#define MAC_MGMT_MSG_MOB_ASC_REP 66 +#define MAC_MGMT_MSG_TYPE_MAX 67 + +/* DL-MAP types (Table 276) */ +#define DL_MAP_EXTENDED_2_DIUC 14 +#define DL_MAP_EXTENDED_IE 15 +/* DL-MAP Extended UIUC Code (table 277a) */ +#define DL_MAP_AAS_IE 2 +#define DL_MAP_EXTENDED_CID_SWITCH_IE 4 +#define DL_MAP_HARQ_IE 7 +/* DL-MAP Extended-2 UIUC Code (table 277c) */ +#define DL_MAP_EXTENDED_2_HARQ 7 + +/* UL-MAP types (Table 288) */ +#define UL_MAP_FAST_FEEDBACK_CHANNEL 0 +#define UL_MAP_CDMA_BR_RANGING_IE 12 +#define UL_MAP_PAPR_RECUCTION_ALLOC_SAFETY_ZONE 13 +#define UL_MAP_CDMA_ALLOCATION_IE 14 +#define UL_MAP_EXTENDED_IE 15 +/* UL-MAP Extended UIUC Code (table 290a) */ +#define UL_MAP_CQICH_ALLOCATION_IE 3 + +/* DCD types (Table 358)*/ +#define DCD_DOWNLINK_BURST_PROFILE 1 +#define DCD_BS_EIRP 2 +#define DCD_FRAME_DURATION 3 +#define DCD_PHY_TYPE 4 +#define DCD_POWER_ADJUSTMENT 5 +#define DCD_CHANNEL_NR 6 +#define DCD_TTG 7 +#define DCD_RTG 8 +#define DCD_RSS 9 +#define DCD_EIRXP 9 +#define DCD_CHANNEL_SWITCH_FRAME_NR 10 +#define DCD_FREQUENCY 12 +#define DCD_BS_ID 13 +#define DCD_FRAME_DURATION_CODE 14 +#define DCD_FRAME_NR 15 +#define DCD_SIZE_CQICH_ID 16 +#define DCD_H_ARQ_ACK_DELAY 17 +#define DCD_MAC_VERSION 148 + +#define DCD_RESTART_COUNT 154 + +#define DCD_BURST_FREQUENCY 1 +#define DCD_BURST_FEC_CODE_TYPE 150 +#define DCD_BURST_DIUC_EXIT_THRESHOLD 151 +#define DCD_BURST_DIUC_ENTRY_THRESHOLD 152 +#define DCD_BURST_TCS_ENABLE 153 +//#define DCD_MAXIMUM_RETRANSMISSION 20 +/* TLV types */ +#define DCD_TLV_T_19_PERMUTATION_TYPE_FOR_BROADCAST_REGION_IN_HARQ_ZONE 19 +#define DCD_TLV_T_20_MAXIMUM_RETRANSMISSION 20 +#define DCD_TLV_T_21_DEFAULT_RSSI_AND_CINR_AVERAGING_PARAMETER 21 +#define DCD_TLV_T_22_DL_AMC_ALLOCATED_PHYSICAL_BANDS_BITMAP 22 +#define DCD_TLV_T_34_DL_REGION_DEFINITION 34 +#define DCD_TLV_T_50_HO_TYPE_SUPPORT 50 +#define DCD_TLV_T_31_H_ADD_THRESHOLD 31 +#define DCD_TLV_T_32_H_DELETE_THRESHOLD 32 +#define DCD_TLV_T_33_ASR 33 +#define DCD_TLV_T_34_DL_REGION_DEFINITION 34 +#define DCD_TLV_T_35_PAGING_GROUP_ID 35 +#define DCD_TLV_T_36_TUSC1_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP 36 +#define DCD_TLV_T_37_TUSC2_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP 37 +#define DCD_TLV_T_51_HYSTERSIS_MARGIN 51 +#define DCD_TLV_T_52_TIME_TO_TRIGGER_DURATION 52 +#define DCD_TLV_T_54_TRIGGER 54 +#define DCD_TLV_T_60_NOISE_AND_INTERFERENCE 60 +#define DCD_TLV_T_153_DOWNLINK_BURST_PROFILE_FOR_MULTIPLE_FEC_TYPES 153 +#define DCD_TLV_T_22_DL_AMC_ALLOCATED_PHYSICAL_BANDS_BITMAP 22 +#define DCD_TLV_T_541_TYPE_FUNCTION_ACTION 1 +#define DCD_TLV_T542_TRIGGER_VALUE 2 +#define DCD_TLV_T_543_TRIGGER_AVERAGING_DURATION 3 +#define DCD_TLV_T_45_PAGING_INTERVAL_LENGTH 45 + +/* UCD types (Table 353) */ +#define UCD_UPLINK_BURST_PROFILE 1 +#define UCD_RESERVATION_TIMEOUT 2 +#define UCD_BW_REQ_SIZE 3 +#define UCD_RANGING_REQ_SIZE 4 +#define UCD_FREQUENCY 5 + +#define UCD_TLV_T_7_HO_RANGING_START 7 +#define UCD_TLV_T_8_RANGING_HO_END 8 +#define UCD_INITIAL_RANGING_CODES 150 +#define UCD_PERIODIC_RANGING_CODES 151 +#define UCD_BANDWIDTH_REQUEST_CODES 152 +#define UCD_PERIODIC_RANGING_BACKOFF_START 153 +#define UCD_PERIODIC_RANGING_BACKOFF_END 154 +#define UCD_START_OF_RANGING_CODES_GROUP 155 +#define UCD_PERMUTATION_BASE 156 +#define UCD_UL_ALLOCATED_SUBCHANNELS_BITMAP 157 +#define UCD_TLV_T_158_OPTIONAL_PERMUTATION_UL_ALLOCATED_SUBCHANNELS_BITMAP 158 +#define UCD_TLV_T_159_BAND_AMC_ALLOCATION_THRESHHOLD 159 +#define UCD_TLV_T_160_BAND_AMC_RELEASE_THRESHOLD 160 +#define UCD_TLV_T_161_BAND_AMC_ALLOCATION_TIMER 161 +#define UCD_TLV_T_162_BAND_AMC_RELEASE_TIMER 162 +#define UCD_TLV_T_163_BAND_STATUS_REPORT_MAX_PERIOD 163 +#define UCD_TLV_T_164_BAND_AMC_RETRY_TIMER 164 +#define UCD_TLV_T_170_SAFETY_CHANNEL_RETRY_TIMER 170 +#define UCD_TLV_T_171_HARQ_ACK_DELAY_FOR_DL_BURST 171 + +#define UCD_TLV_T_172_CQICH_BAND_AMC_TRANSITION_DELAY 172 +#define UCD_TLV_T_174_MAXIMUM_RETRANSMISSION 174 +#define UCD_TLV_T_176_SIZE_OF_CQICH_ID_FIELD 176 +#define UCD_TLV_T_177_NORMALIZED_CN_OVERRIDE_2 177 +#define UCD_TLV_T_186_UPPER_BOUND__AAS_PREAMBLE 186 +#define UCD_TLV_T_187_LOWER_BOUND_AAS_PREAMBLE 187 +#define UCD_TLV_T_188_ALLOW_AAS_BEAM_SELECT_MESSAGE 188 +#define UCD_TLV_T_189_USE_CQICH_INDICATION_FLAG 189 +#define UCD_TLV_T_190_MS_SPECIFIC_UP_POWER_OFFSET_ADJUSTMENT_STEP 190 +#define UCD_TLV_T_191_MS_SPECIFIC_DOWN_POWER_OFSET_ADJUSTMENT_STEP 191 +#define UCD_TLV_T_192_MIN_LEVEL_POWER_OFFSET_ADJUSTMENT 192 +#define UCD_TLV_T_193_MAX_LEVEL_POWER_OFFSETR_ADJUSTMENT 193 +#define UCD_TLV_T_194_HANDOVER_RANGING_CODES 194 +#define UCD_TLV_T_195_INITIAL_RANGING_INTERVAL 195 +#define UCD_TLV_T_196_TX_POWER_REPORT 196 +#define UCD_TLV_T_197_NORMALIZED_CN_FOR_CHANNEL_SOUNDING 197 +#define UCD_TLV_T_198_INTIAL_RANGING_BACKOFF_START 198 +#define UCD_TLV_T_199_INITIAL_RANGING_BACKOFF_END 199 +#define UCD_TLV_T_200_BANDWIDTH_REQUESET_BACKOFF_START 200 +#define UCD_TLV_T_201_BANDWIDTH_REQUEST_BACKOFF_END 201 +#define UCD_TLV_T_202_UPLINK_BURST_PROFILE_FOR_MULTIPLE_FEC_TYPES 202 +#define UCD_TLV_T_203_UL_PUSC_SUBCHANNEL_ROTATION 203 +#define UCD_TLV_T_205_RELATIVE_POWER_OFFSET_UL_HARQ_BURST 205 +#define UCD_TLV_T_206_RELATIVE_POWER_OFFSET_UL_BURST_CONTAINING_MAC_MGMT_MSG 206 +#define UCD_TLV_T_207_UL_INITIAL_TRANSMIT_TIMING 207 +#define UCD_TLV_T_210_FAST_FEEDBACK_REGION 210 +#define UCD_TLV_T_211_HARQ_ACK_REGION 211 +#define UCD_TLV_T_212_RANGING_REGION 212 +#define UCD_TLV_T_213_SOUNDING_REGION 213 + +/* Table 357 */ +#define UCD_BURST_FEC 150 +#define UCD_BURST_RANGING_DATA_RATIO 151 +//#define UCD_BURST_POWER_BOOST 151 +//#define UCD_BURST_TCS_ENABLE 152 + +/* RNG-REQ types (Table 364) */ +/* Sorted these values */ +#define RNG_REQ_DL_BURST_PROFILE 1 +#define RNG_REQ_SS_MAC_ADDRESS 2 +#define RNG_REQ_RANGING_ANOMALIES 3 +#define RNG_REQ_AAS_BROADCAST 4 +#define RNG_REQ_SERVING_BS_ID 5 +#define RNG_REQ_RANGING_PURPOSE_INDICATION 6 +#define RNG_REQ_HO_ID 7 +#define RNG_REQ_POWER_DOWN_INDICATOR 8 +#define RNG_REQ_PAGING_CONTROLLER_ID 9 +#define RNG_REQ_MAC_HASH_SKIP_THRESHOLD 10 +#define RNG_REQ_ENABLED_ACTION_TRIGGERED 11 +#define RNG_REQ_REQUESTED_DNLK_REP_CODING_LEVEL 12 +#define RNG_REQ_CMAC_KEY_COUNT 13 +#define RNG_REQ_POWER_SAVING_CLASS_PARAMETERS 21 + +/* RNG-REQ/RSP Power Saving Class Parameter TLV's (Table 364a) */ +#define RNG_POWER_SAVING_CLASS_FLAGS 1 +#define RNG_POWER_SAVING_CLASS_ID 2 +#define RNG_POWER_SAVING_CLASS_TYPE 3 +#define RNG_START_FRAME_NUMBER 4 +#define RNG_INITIAL_SLEEP_WINDOW 5 +#define RNG_LISTENING_WINDOW 6 +#define RNG_FINAL_SLEEP_WINDOW_BASE 7 +#define RNG_FINAL_SLEEP_WINDOW_EXPONENT 8 +#define RNG_SLPID 9 +#define RNG_CID 10 +#define RNG_DIRECTION 11 + +/* RNG-RSP types (Table 367) */ +#define RNG_RSP_TIMING_ADJUST 1 +#define RNG_RSP_POWER_LEVEL_ADJUST 2 +#define RNG_RSP_OFFSET_FREQ_ADJUST 3 +#define RNG_RSP_RANGING_STATUS 4 +#define RNG_RSP_DL_FREQ_OVERRIDE 5 +#define RNG_RSP_UL_CHANNEL_ID_OVERRIDE 6 +#define RNG_RSP_DL_OPERATIONAL_BURST_PROFILE 7 +#define RNG_RSP_SS_MAC_ADDRESS 8 +#define RNG_RSP_BASIC_CID 9 +#define RNG_RSP_PRIMARY_MGMT_CID 10 +#define RNG_RSP_AAS_BROADCAST_PERMISSION 11 +#define RNG_RSP_FRAME_NUMBER 12 +#define RNG_RSP_OPPORTUNITY_NUMBER 13 +#define RNG_RSP_SERVICE_LEVEL_PREDICTION 17 +#define RNG_RSP_GLOBAL_SERVICE_CLASS_NAME 18 +#define RNG_RSP_RESOURCE_RETAIN_FLAG 20 +#define RNG_RSP_HO_PROCESS_OPTIMIZATION 21 +/* Sorted the following values (for readability) */ +#define RNG_RSP_HO_ID 22 +#define RNG_RSP_LOCATION_UPDATE_RESPONSE 23 +#define RNG_RSP_PAGING_INFORMATION 24 +#define RNG_RSP_PAGING_CONTROLLER_ID 25 +#define RNG_RSP_NEXT_PERIODIC_RANGING 26 +#define RNG_RSP_POWER_SAVING_CLASS_PARAMETERS 27 +#define RNG_RSP_MAC_HASH_SKIP_THRESHOLD 28 +#define RNG_RSP_SBC_RSP_ENCODINGS 29 +#define RNG_RSP_REG_RSP_ENCODINGS 30 +#define RNG_RSP_SA_CHALLENGE_TUPLE 31 +#define RNG_RSP_ENABLED_ACTION_TRIGGERED 32 +#define RNG_RSP_DL_OP_BURST_PROFILE_OFDMA 33 +#define RNG_RSP_RANGING_CODE_ATTRIBUTES 150 +#define RNG_RSP_SA_CHALLENGE_BS_RANDOM 1 +#define RNG_RSP_SA_CHALLENGE_AKID 2 + +/* SBC types (section 11.8) */ +#define SBC_BW_ALLOC_SUPPORT 1 +#define SBC_TRANSITION_GAPS 2 +#define SBC_REQ_MAX_TRANSMIT_POWER 3 +#define SBC_MAC_PDU 4 +#define SBC_PKM_FLOW_CONTROL 15 +#define SBC_AUTH_POLICY_SUPPORT 16 +#define SBC_MAX_SECURITY_ASSOCIATIONS 17 +#define SBC_REQ_CURR_TRANSMITTED_POWER 147 +#define SBC_SS_FFT_SIZES 150 +#define SBC_SS_DEMODULATOR 151 +#define SBC_SS_MODULATOR 152 +#define SBC_SS_NUM_UL_ARQ_ACK_CHANNEL 153 +#define SBC_SS_PERMUTATION_SUPPORT 154 +#define SBC_SS_DEMODULATOR_MIMO_SUPPORT 156 +#define SBC_SS_MIMO_UPLINK_SUPPORT 157 +#define SBC_SS_OFDMA_AAS_PRIVATE_MAP_SUPPORT 158 +#define SBC_SS_OFDMA_AAS_CAPABILITIES 159 +#define SBC_SS_CINR_MEASUREMENT_CAPABILITY 160 +#define SBC_SS_NUM_DL_ARQ_ACK_CHANNEL 161 + +#define SBC_TLV_T_26_POWER_SAVE_CLASS_TYPES_CAPABILITY 26 +#define SBC_TLV_T_28_HO_TRIGGER_METRIC_SUPPORT 28 +#define SBC_TLV_T_27_EXTENSION_CAPABILITY 27 + +#define SBC_TLV_T_162_HARQ_INCREMENTAL_REDUNDANCY_BUFFER_CAPABILITY 162 +#define SBC_TLV_T_163_HARQ_CHASE_COMBINING_AND_CC_IR_BUFFER_CAPABILITY 163 +#define SBC_TLV_T_167_ASSOCIATION_SUPPORT 167 +#define SBC_TLV_T_170_UPLINK_POWER_CONTROL_SUPPORT 170 +#define SBC_TLV_T_171_MINIMUM_NUM_OF_FRAMES 171 +#define SBC_TLV_T_172 172 +#define SBC_TLV_T_173_UL_CONTROL_CHANNEL_SUPPORT 173 +#define SBC_TLV_T_174_OFDMA_MS_CSIT_CAPABILITY 174 +#define SBC_TLV_T_175_MAX_NUM_BST_PER_FRM_CAPABILITY_HARQ 175 +#define SBC_TLV_T_176 176 +#define SBC_TLV_T_177_OFDMA_SS_MODULATOR_FOR_MIMO_SUPPORT 177 +#define SBC_TLV_T_178_SDMA_PILOT_CAPABILITY 178 +#define SBC_TLV_T_179_OFDMA_MULTIPLE_DL_BURST_PROFILE_CAPABILITY 179 +#define SBC_TLV_T_204_OFDMA_PARAMETERS_SETS 204 + +/* DREG-REQ DREG-CMD types (Sections 6.3.2.3.42 and 6.3.2.3.26) */ +#define DREG_PAGING_INFO 1 +#define DREG_REQ_DURATION 2 +#define DREG_PAGING_CONTROLLER_ID 3 +#define DREG_IDLE_MODE_RETAIN_INFO 4 +#define DREG_MAC_HASH_SKIP_THRESHOLD 5 +#define DREG_PAGING_CYCLE_REQUEST 52 + +/* REP-REQ types (Sections 11.11) */ +#define REP_REQ_REPORT_REQUEST 1 +/* REP-REQ report request subtypes */ +#define REP_REQ_REPORT_TYPE 1 +#define REP_REQ_CHANNEL_NUMBER 2 +#define REP_REQ_CHANNEL_TYPE 3 +#define REP_REQ_ZONE_SPEC_PHY_CINR_REQ 4 +#define REP_REQ_PREAMBLE_PHY_CINR_REQ 5 +#define REP_REQ_ZONE_SPEC_EFF_CINR_REQ 6 +#define REP_REQ_PREAMBLE_EFF_CINR_REQ 7 +#define REP_REQ_CHANNEL_SELECTIVITY_REPORT 8 + +/* REP-RSP types (Sections 11.12) */ +#define REP_RSP_REPORT_TYPE 1 +#define REP_RSP_CHANNEL_TYPE 2 +#define REP_RSP_ZONE_SPECIFIC_PHY_CINR 3 +#define REP_RSP_PREAMBLE_PHY_CINR 4 +#define REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR 5 +#define REP_RSP_PREAMBLE_EFFECTIVE_CINR 6 +/* REP-RSP report subtypes */ +#define REP_RSP_REPORT_CHANNEL_NUMBER 1 +#define REP_RSP_REPORT_START_FRAME 2 +#define REP_RSP_REPORT_DURATION 3 +#define REP_RSP_REPORT_BASIC_REPORT 4 +#define REP_RSP_REPORT_CINR_REPORT 5 +#define REP_RSP_REPORT_RSSI_REPORT 6 +/* REP-RSP channel type report subtypes */ +#define REP_RSP_CHANNEL_TYPE_SUBCHANNEL 1 +#define REP_RSP_CHANNEL_TYPE_BAND_AMC 2 +#define REP_RSP_CHANNEL_TYPE_SAFETY_CHANNEL 3 +#define REP_RSP_CHANNEL_TYPE_ENHANCED_BAND_AMC 4 +#define REP_RSP_CHANNEL_TYPE_SOUNDING 5 +/* REP-RSP zone-specific physical CINR report subtypes */ +#define REP_RSP_ZONE_SPECIFIC_PHY_CINR_PUSC_SC0 1 +#define REP_RSP_ZONE_SPECIFIC_PHY_CINR_PUSC_SC1 2 +#define REP_RSP_ZONE_SPECIFIC_PHY_CINR_FUSC 3 +#define REP_RSP_ZONE_SPECIFIC_PHY_CINR_OPTIONAL_FUSC 4 +#define REP_RSP_ZONE_SPECIFIC_PHY_CINR_SAFETY_CHANNEL 5 +#define REP_RSP_ZONE_SPECIFIC_PHY_CINR_AMC 6 +/* REP-RSP preamble physical CINR report subtypes */ +#define REP_RSP_PREAMBLE_PHY_CINR_CONFIGURATION1 1 +#define REP_RSP_PREAMBLE_PHY_CINR_CONFIGURATION3 2 +#define REP_RSP_PREAMBLE_PHY_CINR_BAND_AMC 3 +/* REP-RSP zone-specific effective CINR report subtypes */ +#define REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_PUSC_SC0 1 +#define REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_PUSC_SC1 2 +#define REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_FUSC 3 +#define REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_OPTIONAL_FUSC 4 +#define REP_RSP_ZONE_SPECIFIC_EFFECTIVE_CINR_AMC_AAS 5 +/* REP-RSP preamble effective CINR report subtypes */ +#define REP_RSP_PREAMBLE_EFFECTIVE_CINR_CONFIGURATION1 1 +#define REP_RSP_PREAMBLE_EFFECTIVE_CINR_CONFIGURATION3 2 +#define REP_RSP_CHANNEL_SELECTIVITY 3 +/* REP-RSP channel selectivity report subtypes */ +#define FREQUENCY_SELECTIVITY_REPORT 1 + +/* REG types (Section 11.7) */ +#define REG_ARQ_PARAMETERS 1 +#define REG_SS_MGMT_SUPPORT 2 +#define REG_IP_MGMT_MODE 3 +#define REG_IP_VERSION 4 +#define REG_REQ_SECONDARY_MGMT_CID 5 +#define REG_RSP_SECONDARY_MGMT_CID 5 +#define REG_UL_TRANSPORT_CIDS_SUPPORTED 6 +#define REG_IP_PHS_SDU_ENCAP 7 +#define REG_MAX_CLASSIFIERS_SUPPORTED 8 +#define REG_PHS_SUPPORT 9 +#define REG_ARQ_SUPPORT 10 +#define REG_DSX_FLOW_CONTROL 11 +#define REG_MAC_CRC_SUPPORT 12 +#define REG_MCA_FLOW_CONTROL 13 +#define REG_MCAST_POLLING_CIDS 14 +#define REG_NUM_DL_TRANS_CID 15 +#if 0 /* WIMAX_16E_2005 changes this to SBC scope */ +#define REG_PKM_FLOW_CONTROL 15 +#define REG_AUTH_POLICY_SUPPORT 16 +#define REG_MAX_SECURITY_ASSOCIATIONS 17 +#endif +#if 0 /* TODO: scope has been changed to SBC scope */ +#define REG_DL_TRANSPORT_CIDS_SUPPORTED 15 +#endif +#define REG_MAC_ADDRESS 18 + +#define REG_TLV_T_20_MAX_MAC_DATA_PER_FRAME_SUPPORT 20 +#define REG_TLV_T_20_1_MAX_MAC_LEVEL_DATA_PER_DL_FRAME 1 +#define REG_TLV_T_20_2_MAX_MAC_LEVEL_DATA_PER_UL_FRAME 2 +#define REG_TLV_T_21_PACKING_SUPPORT 21 +#define REG_TLV_T_22_MAC_EXTENDED_RTPS_SUPPORT 22 +#define REG_TLV_T_23_MAX_NUM_BURSTS_TRANSMITTED_CONCURRENTLY_TO_THE_MS 23 +#define REG_RSP_TLV_T_24_CID_UPDATE_ENCODINGS 24 +#define REG_RSP_TLV_T_24_1_CID_UPDATE_ENCODINGS_NEW_CID 1 +#define REG_RSP_TLV_T_24_2_CID_UPDATE_ENCODINGS_SFID 2 +#define REG_RSP_TLV_T_24_3_CID_UPDATE_ENCODINGS_CONNECTION_INFO 3 +#define REG_RSP_TLV_T_25_COMPRESSED_CID_UPDATE_ENCODINGS 25 +#define REG_TLV_T_26_METHOD_FOR_ALLOCATING_IP_ADDR_SECONDARY_MGMNT_CONNECTION 26 +#define REG_TLV_T_27_HANDOVER_SUPPORTED 27 +#define REG_RSP_TLV_T_28_HO_SYSTEM_RESOURCE_RETAIN_TIME 28 +#define REG_TLV_T_29_HO_PROCESS_OPTIMIZATION_MS_TIMER 29 +#define REG_RSP_TLV_T_30_MS_HANDOVER_RETRANSMISSION_TIMER 30 +#define REG_TLV_T_31_MOBILITY_FEATURES_SUPPORTED 31 +#define REG_REQ_TLV_T_32_SLEEP_MODE_RECOVERY_TIME 32 +#define REG_REQ_TLV_T_33_MS_PREV_IP_ADDR 33 +#define REG_RSP_TLV_T_34_SKIP_ADDR_ACQUISITION 34 +#define REG_RSP_TLV_T_35_SAID_UPDATE_ENCODINGS 35 +#define REG_RSP_TLV_T_35_1_NEW_SAID 1 +#define REG_RSP_TLV_T_35_2_OLD_SAID 2 +#define REG_RSP_TLV_T_36_TOTAL_PROVISIONED_SERVICE_FLOW_DSAs 36 +#define REG_TLV_T_37_IDLE_MODE_TIMEOUT 37 +#define REG_RSP_TLV_T_38_SA_TEK_UPDATE 38 +#define REG_RSP_TLV_T_38_1_SA_TEK_UPDATE_TYPE 1 +#define REG_RSP_TLV_T_38_2_NEW_SAID 2 +#define REG_RSP_TLV_T_38_3_OLD_SAID 3 +#define REG_RSP_TLV_T_38_4_OLD_TEK_PARAMETERS 4 +#define REG_RSP_TLV_T_38_5_NEW_TEK_GTEK_PARAMETERS 5 +#define REG_RSP_TLV_T_38_6_GKEK_PARAMETERS 6 +#define REG_RSP_TLV_T_39_GKEK_PARAMETERS 39 +#define REG_TLV_T_40_ARQ_ACK_TYPE 40 +#define REG_TLV_T_41_MS_HO_CONNECTIONS_PARAM_PROCESSING_TIME 41 +#define REG_TLV_T_42_MS_HO_TEK_PROCESSING_TIME 42 +#define REG_TLV_T_43_MAC_HEADER_AND_EXTENDED_SUBHEADER_SUPPORT 43 +#define REG_RSP_TLV_T_44_SN_REPORTING_BASE 44 +#define REG_REQ_TLV_T_45_MS_PERIODIC_RANGING_TIMER_INFO 45 +#define REG_HANDOVER_INDICATION_READINESS_TIMER 46 +#define REG_REQ_BS_SWITCHING_TIMER 47 + + + +/* PKM types (Table 370) */ +#define PKM_ATTR_DISPLAY_STRING 6 +#define PKM_ATTR_AUTH_KEY 7 +#define PKM_ATTR_TEK 8 +#define PKM_ATTR_KEY_LIFE_TIME 9 +#define PKM_ATTR_KEY_SEQ_NUM 10 +#define PKM_ATTR_HMAC_DIGEST 11 +#define PKM_ATTR_SAID 12 +#define PKM_ATTR_TEK_PARAM 13 +#define PKM_ATTR_CBC_IV 15 +#define PKM_ATTR_ERROR_CODE 16 +#define PKM_ATTR_CA_CERTIFICATE 17 +#define PKM_ATTR_SS_CERTIFICATE 18 +#define PKM_ATTR_SECURITY_CAPABILITIES 19 +#define PKM_ATTR_CRYPTO_SUITE 20 +#define PKM_ATTR_CRYPTO_LIST 21 +#define PKM_ATTR_VERSION 22 +#define PKM_ATTR_SA_DESCRIPTOR 23 +#define PKM_ATTR_SA_TYPE 24 +#define PKM_ATTR_SECURITY_NEGOTIATION_PARAMETERS 25 +#define PKM_ATTR_PKM_CONFIG_SETTINGS 27 +#define PKM_ATTR_PKM_EAP_PAYLOAD 28 +#define PKM_ATTR_PKM_NONCE 29 +#define PKM_ATTR_AUTH_RESULT_CODE 30 +#define PKM_ATTR_SA_SERVICE_TYPE 31 +#define PKM_ATTR_FRAME_NUMBER 32 +#define PKM_ATTR_SS_RANDOM 33 +#define PKM_ATTR_BS_RANDOM 34 +#define PKM_ATTR_PRE_PAK 35 +#define PKM_ATTR_PAK_AK_SEQ_NUMBER 36 +#define PKM_ATTR_BS_CERTIFICATE 37 +#define PKM_ATTR_SIG_BS 38 +#define PKM_ATTR_MS_MAC_ADDRESS 39 +#define PKM_ATTR_CMAC_DIGEST 40 +#define PKM_ATTR_KEY_PUSH_MODES 41 +#define PKM_ATTR_KEY_PUSH_COUNTER 42 +#define PKM_ATTR_GKEK 43 +#define PKM_ATTR_SIG_SS 44 +#define PKM_ATTR_AKID 45 +#define PKM_ATTR_ASSOCIATED_GKEK_SEQ_NUM 46 +#define PKM_ATTR_GKEK_PARAMETERS 47 + +#define PKM_ATTR_PKM_CONFIG_SETTINGS_AUTHORIZE_WAIT_TIMEOUT 1 +#define PKM_ATTR_PKM_CONFIG_SETTINGS_REAUTHORIZE_WAIT_TIMEOUT 2 +#define PKM_ATTR_PKM_CONFIG_SETTINGS_AUTHORIZATION_GRACE_TIME 3 +#define PKM_ATTR_PKM_CONFIG_SETTINGS_OPERATIONAL_WAIT_TIMEOUT 4 +#define PKM_ATTR_PKM_CONFIG_SETTINGS_REKEY_WAIT_TIMEOUT 5 +#define PKM_ATTR_PKM_CONFIG_SETTINGS_TEK_GRACE_TIME 6 +#define PKM_ATTR_PKM_CONFIG_SETTINGS_AUTHORIZE_REJECT_WAIT_TIMEOUT 7 + +#define PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_PKM_VERSION_SUPPORT 1 +#define PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_AUTHORIZATION_POLICY_SUPPORT 2 +#define PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_MESSAGE_AUTHENTICATION_CODE 3 +#define PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_PN_WINDOW_SIZE 4 +#define PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_PKM_FLOW_CONTROL 5 +#define PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_MAX_SUPPT_SECURITY_ASSNS 6 + +/* Common TLV Encoding types (Table 346) */ +#define SHORT_HMAC_TUPLE_COR2 140 +#define CMAC_TUPLE 141 +#define VENDOR_SPECIFIC_INFO 143 +#define VENDOR_ID_ENCODING 144 +#define DSx_UPLINK_FLOW 145 +#define DSx_DOWNLINK_FLOW 146 +#define CURRENT_TX_POWER 147 +#define MAC_VERSION_ENCODING 148 +#define HMAC_TUPLE 149 +#define SHORT_HMAC_TUPLE 150 + +/* Section 11.13.18 */ +#define ARQ_ENABLE 18 +#define ARQ_WINDOW_SIZE 19 +#define ARQ_TRANSMITTER_DELAY 20 +#define ARQ_RECEIVER_DELAY 21 +#define ARQ_BLOCK_LIFETIME 22 +#define ARQ_SYNC_LOSS_TIMEOUT 23 +#define ARQ_DELIVER_IN_ORDER 24 +#define ARQ_RX_PURGE_TIMEOUT 25 +#define ARQ_BLOCK_SIZE 26 + +/* Section 6.2.3.2.26 */ + +/* Service Flow Encodings (SFE) (Table 383) */ +#define SFE_SF_ID 1 +#define SFE_CID 2 +#define SFE_SERVICE_CLASS_NAME 3 +#define SFE_MBS_SERVICE 4 +#define SFE_QOS_PARAMS_SET 5 +#define SFE_TRAFFIC_PRIORITY 6 +#define SFE_MAX_STR 7 +#define SFE_MAX_TRAFFIC_BURST 8 +#define SFE_MIN_RTR 9 +#define SFE_RESERVED_10 10 +#define SFE_UL_SCHEDULING 11 +#define SFE_TX_POLICY 12 +#define SFE_TOLERATED_JITTER 13 +#define SFE_MAX_LATENCY 14 +#define SFE_FIXED_LEN_SDU 15 +#define SFE_SDU_SIZE 16 +#define SFE_TARGET_SAID 17 +#define SFE_ARQ_ENABLE 18 +#define SFE_ARQ_WINDOW_SIZE 19 +#define SFE_ARQ_TRANSMITTER_DELAY 20 +#define SFE_ARQ_RECEIVER_DELAY 21 +#define SFE_ARQ_BLOCK_LIFETIME 22 +#define SFE_ARQ_SYNC_LOSS_TIMEOUT 23 +#define SFE_ARQ_DELIVER_IN_ORDER 24 +#define SFE_ARQ_RX_PURGE_TIMEOUT 25 +#define SFE_ARQ_BLOCK_SIZE 26 +#define SFE_RESERVED_27 27 +#define SFE_CS_SPECIFICATION 28 +#define SFE_TYPE_OF_DATA_DELIVERY_SERVICES 29 +#define SFE_SDU_INTER_ARRIVAL_INTERVAL 30 +#define SFE_TIME_BASE 31 +#define SFE_PAGING_PREFERENCE 32 +#define SFE_MBS_ZONE_IDENTIFIER_ASSIGNMENT 33 +#define SFE_RESERVED_34 34 +#define SFE_GLOBAL_SERVICE_CLASS_NAME 35 +#define SFE_RESERVED_36 36 +#define SFE_SN_FEEDBACK_ENABLED 37 +#define SFE_FSN_SIZE 38 +#define SFE_CID_ALLOCATION_FOR_ACTIVE_BS 39 +#define SFE_UNSOLICITED_GRANT_INTERVAL 40 +#define SFE_UNSOLOCITED_POLLING_INTERVAL 41 +#define SFE_PDU_SN_EXT_SUBHEADER_HARQ_REORDER 42 +#define SFE_MBS_CONTENTS_ID 43 +#define SFE_HARQ_SERVICE_FLOWS 44 +#define SFE_AUTHORIZATION_TOKEN 45 +#define SFE_HARQ_CHANNEL_MAPPING 46 + +/* Convergence Servicerameter Encoding Rules (Section 11.13.19.2) */ +#define SFE_CSPER_ATM 99 +#define SFE_CSPER_PACKET_IPV4 100 +#define SFE_CSPER_PACKET_IPV6 101 +#define SFE_CSPER_PACKET_802_3 102 +#define SFE_CSPER_PACKET_802_1Q 103 +#define SFE_CSPER_PACKET_IPV4_802_3 104 +#define SFE_CSPER_PACKET_IPV6_802_3 105 +#define SFE_CSPER_PACKET_IPV4_802_1Q 106 +#define SFE_CSPER_PACKET_IPV6_802_1Q 107 +#define SFE_CSPER_PACKET_IP_ROCH_COMPRESSION 108 +#define SFE_CSPER_PACKET_IP_ECRTP_COMPRESSION 109 +#define SFE_CSPER_PACKET_IP_802_3_ROCH_COMPRESSION 110 +#define SFE_CSPER_PACKET_IP_802_3_ECRTP_COMPRESSION 111 + +/* Section 11.13.19.3 */ +#define CST_CLASSIFIER_ACTION 1 +#define CST_CLASSIFIER_ERROR_PARAM_SET 2 +#define CST_PACKET_CLASSIFICATION_RULE 3 +#define CST_PHS_DSC_ACTION 4 +#define CST_PHS_ERROR_PARAM_SET 5 +#define CST_PHS_RULE 6 + +/* Section 11.13.19.3.3 */ +#define CST_ERROR_SET_ERRORED_PARAM 1 +#define CST_ERROR_SET_ERROR_CODE 2 +#define CST_ERROR_SET_ERROR_MSG 3 + +/* Section 11.13.19.4 */ +#define CST_ATM_SWITCHING 1 +#define CST_ATM_CLASSIFIER 2 +#define CST_ATM_CLASSIFIER_DSC_ACTION 3 +#define CST_ATM_CLASSIFIER_ERROR_PARAMETER_SET 4 + +#define ATM_VPI_CLASSIFIER 1 +#define ATM_VCI_CLASSIFIER 2 +#define ATM_CLASSIFIER_ID 3 + +/* Section 11.13.19.3.4 */ +#define CST_PKT_CLASS_RULE_PRIORITY 1 +#define CST_PKT_CLASS_RULE_RANGE_MASK 2 +#define CST_PKT_CLASS_RULE_PROTOCOL 3 +#define CST_PKT_CLASS_RULE_SRC_IP 4 +#define CST_PKT_CLASS_RULE_DST_IP 5 +#define CST_PKT_CLASS_RULE_SRCPORT_RANGE 6 +#define CST_PKT_CLASS_RULE_DSTPORT_RANGE 7 +#define CST_PKT_CLASS_RULE_DST_MAC 8 +#define CST_PKT_CLASS_RULE_SRC_MAC 9 +#define CST_PKT_CLASS_RULE_ETHERTYPE 10 +#define CST_PKT_CLASS_RULE_USER_PRIORITY 11 +#define CST_PKT_CLASS_RULE_VLAN_ID 12 +#define CST_PKT_CLASS_RULE_PHSI 13 +#define CST_PKT_CLASS_RULE_INDEX 14 +#define CST_PKT_CLASS_RULE_IPv6_FLOW_LABEL 15 +#define CST_PKT_CLASS_RULE_LARGE_CONTEXT_ID 16 +#define CST_PKT_CLASS_RULE_SHORT_FORMAT_CONTEXT_ID 18 +#define CST_CLASSIFIER_ACTION_RULE 19 +#define CST_PKT_CLASS_RULE_VENDOR_SPEC 143 + +/* Section 11.13.19.3.7 */ +#define CST_PHS_PHSI 1 +#define CST_PHS_PHSF 2 +#define CST_PHS_PHSM 3 +#define CST_PHS_PHSS 4 +#define CST_PHS_PHSV 5 +#define CST_PHS_VENDOR_SPEC 143 + +#endif /* WIMAX_MAC_H */ diff --git a/plugins/wimax/wimax_pdu_decoder.c b/plugins/wimax/wimax_pdu_decoder.c new file mode 100644 index 0000000000..4dc5e9f1b4 --- /dev/null +++ b/plugins/wimax/wimax_pdu_decoder.c @@ -0,0 +1,271 @@ +/* wimax_pdu_decoder.c + * WiMax PDU Burst decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include "crc.h" + +extern gint proto_wimax; + +extern void proto_register_mac_header_generic(void); +extern void proto_register_mac_header_type_1(void); +extern void proto_register_mac_header_type_2(void); + + +/* MAC Header dissector prototypes */ +extern void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_header_type_1_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissect_mac_header_type_2_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern gboolean is_down_link(address *src_address); +extern gint wimax_decode_dlmap_reduced_aas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tree); +extern gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdu_tree); + +#define WIMAX_PDU_PADDING_MASK 0xFF +#define WIMAX_INVALID_PDU_MASK 0xF0 +#define WIMAX_MAP_TYPE_MASK 0xE0 /* 0b111 */ +#define WIMAX_HARQ_MAP_MSG_IND 0xE0 /* 0b111 */ +#define WIMAX_COMPRESSED_DL_MAP_IND 0xC0 /* 0b110 */ +#define REDUCED_PRIVATE_MAP_MASK 0x0C /* 0b11 */ + +#define WIMAX_MAC_HEADER_SIZE 6 +#define WIMAX_MAC_HEADER_INFO_FIELDS 5 +#define WIMAX_MAC_HEADER_HT_FIELD 0x80 +#define WIMAX_MAC_HEADER_EC_FIELD 0x40 +#define WIMAX_MAC_HEADER_LENGTH_MSB_MASK 0x07 + +#define WIMAX_HARQ_MAP_MSG_LENGTH_MASK1 0x07FC +/* Global Variables. */ +gboolean first_gmh; + +/* forward reference */ +static void dissect_wimax_pdu_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_wimax_pdu_decoder = -1; +static gint ett_wimax_pdu_decoder = -1; + +static int hf_wimax_value_bytes = -1; + +/* PDU display */ +static hf_register_info hf[] = +{ + { + &hf_wimax_value_bytes, + { + "Values", "wimax.pdu.value", + FT_BYTES, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, +}; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_pdu_decoder, +}; + +/* Register Wimax PDU Burst Protocol */ +void proto_register_wimax_pdu(void) +{ + if (proto_wimax_pdu_decoder == -1) + { + proto_wimax_pdu_decoder = proto_wimax; + + register_dissector("wimax_pdu_burst_handler", dissect_wimax_pdu_decoder, -1); + proto_register_field_array(proto_wimax_pdu_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + proto_register_mac_header_generic(); + proto_register_mac_header_type_1(); + proto_register_mac_header_type_2(); + } +} + +static void dissect_wimax_pdu_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint mac_ht, mac_ec; + guint first_byte, length; + guint mac_hcs, mac_hcs_calculated; + proto_item *pdu_item = NULL; + proto_tree *pdu_tree = NULL; + +#ifndef STATIC_DATA + /* generate the table of CRC32 remainders for all possible bytes */ + wimax_mac_gen_crc32_table(); + /* generate the table of CRC8 remainders for all possible bytes */ + wimax_mac_gen_crc8_table(); +#endif + + /* parsing the PDU burst */ + for(offset = 0; offset < tvb_length(tvb); ) + { + if (offset == 0) + { + first_gmh = TRUE; + } + else + { + first_gmh = FALSE; + } + /* get the length of the remainder */ + length = tvb_length_remaining(tvb, offset); + /* get the first byte at offset */ + first_byte = tvb_get_guint8(tvb, offset); + /* check for padding */ + if(first_byte == WIMAX_PDU_PADDING_MASK) + { /* Padding */ + /* display message */ + pdu_item = proto_tree_add_protocol_format(tree, proto_wimax_pdu_decoder, tvb, offset, length, "Padding (%u bytes)", length); + /* add subtree */ + pdu_tree = proto_item_add_subtree(pdu_item, ett_wimax_pdu_decoder); + /* display the padding in Hex */ + proto_tree_add_item(pdu_tree, hf_wimax_value_bytes, tvb, offset, length, FALSE); + break; + } + else if((first_byte & WIMAX_MAP_TYPE_MASK) == WIMAX_HARQ_MAP_MSG_IND) + { /* HARQ MAP message (no mac header) */ + /* get the HARQ MAp Message Length */ + length = ((tvb_get_ntohs(tvb, offset) & WIMAX_HARQ_MAP_MSG_LENGTH_MASK1) >> 2); + if (length == 0) + { + length = 3; /* At least 3 bytes. This prevents endless loop */ + } + dissector_wimax_harq_map_decoder(tvb_new_subset(tvb,offset,length,length), pinfo, tree); + offset += length; + continue; + } + else if((first_byte & WIMAX_MAP_TYPE_MASK) == WIMAX_COMPRESSED_DL_MAP_IND) + { + if(is_down_link(&pinfo->src)) + { /* decode compressed dl-map without mac header */ + if ((first_byte & REDUCED_PRIVATE_MAP_MASK) == REDUCED_PRIVATE_MAP_MASK) + { + length = wimax_decode_dlmap_reduced_aas(tvb, pinfo, tree); + } + else + { + length = wimax_decode_dlmapc(tvb, pinfo, tree); + } + offset += length; + continue; + } + } + else if((first_byte & WIMAX_INVALID_PDU_MASK) == WIMAX_INVALID_PDU_MASK) + { /* Invalid PDU */ + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid PDU"); + } + /* display message */ + pdu_item = proto_tree_add_protocol_format(tree, proto_wimax_pdu_decoder, tvb, offset, length, "Invalid PDU (%u bytes)", length); + /* add subtree */ + pdu_tree = proto_item_add_subtree(pdu_item, ett_wimax_pdu_decoder); + /* display the invalid MAC Header in Hex */ + proto_tree_add_item(pdu_tree, hf_wimax_value_bytes, tvb, offset, length, FALSE); + break; + } + /* calculate the MAC header HCS */ + mac_hcs_calculated = wimax_mac_calc_crc8((guint8 *)tvb_get_ptr(tvb, offset, WIMAX_MAC_HEADER_INFO_FIELDS), WIMAX_MAC_HEADER_INFO_FIELDS); + /* get the Header Check Sequence (HCS) in the header */ + mac_hcs = tvb_get_guint8(tvb, offset + WIMAX_MAC_HEADER_SIZE - 1); + /* verify the HCS */ + if(mac_hcs != mac_hcs_calculated) + { + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "MAC Header CRC error"); + } + /* display message */ + pdu_item = proto_tree_add_protocol_format(tree, proto_wimax_pdu_decoder, tvb, offset, WIMAX_MAC_HEADER_SIZE, "MAC Header CRC error %X (in header) and %X (calculated)", mac_hcs, mac_hcs_calculated); + /* add subtree */ + pdu_tree = proto_item_add_subtree(pdu_item, ett_wimax_pdu_decoder); + /* display the bad MAC Header in Hex */ + proto_tree_add_item(pdu_tree, hf_wimax_value_bytes, tvb, offset, length, FALSE); + break; + } + /* get the Header Type (HT) */ + mac_ht = ((first_byte & WIMAX_MAC_HEADER_HT_FIELD)?1:0); + /* get the Encryption Control (EC) */ + mac_ec = ((first_byte & WIMAX_MAC_HEADER_EC_FIELD)?1:0); + /* update the MAC length for Generic MAC frame */ + if(!mac_ht) + { /* Generic MAC Header with payload */ + /* get the MAC length */ + length = (tvb_get_guint8(tvb, offset+1) & WIMAX_MAC_HEADER_LENGTH_MSB_MASK); + length = ((length<<8) | tvb_get_guint8(tvb, offset+2)); + } + else /* MAC signaling Headers or Bandwidth Request Headers */ + { /* set the mac length */ + length = WIMAX_MAC_HEADER_SIZE; + } + /* display PDU frame info */ + /* + pdu_item = proto_tree_add_protocol_format(tree, proto_wimax_pdu_decoder, tvb, offset, length, "PDU Frame (%u bytes)", length); + */ + pdu_item = proto_tree_add_protocol_format(tree, proto_wimax_pdu_decoder, tvb, offset, length, "PDU (%u bytes)", length); + /* add PDU subtree */ + pdu_tree = proto_item_add_subtree(pdu_item, ett_wimax_pdu_decoder); + if (length == 0) { + offset += 6; /* Add header size. */ + /* Must skip the code below or tvb_new_subset() + * keeps allocating memory until it runs out. */ + continue; + } + /* process the valid MAC header */ + if(mac_ht) + { /* MAC signaling Headers or Bandwidth Request Headers */ + /* check the header type */ + if(mac_ec) + { /* MAC Signaling Header Type II Header */ + proto_item_append_text(pdu_item, " - Mac Type II Header: "); + dissect_mac_header_type_2_decoder(tvb_new_subset(tvb,offset,length,length), pinfo, pdu_tree); + } + else + { /* MAC Signaling Header Type I Header */ + proto_item_append_text(pdu_item, " - Mac Type I Header: "); + dissect_mac_header_type_1_decoder(tvb_new_subset(tvb,offset,length,length), pinfo, pdu_tree); + } + } + else /* Generic MAC Header with payload */ + { + dissect_mac_header_generic_decoder(tvb_new_subset(tvb,offset,length,length), pinfo, pdu_tree); + } + offset += length; + } +} diff --git a/plugins/wimax/wimax_phy_attributes_decoder.c b/plugins/wimax/wimax_phy_attributes_decoder.c new file mode 100644 index 0000000000..5fe9817741 --- /dev/null +++ b/plugins/wimax/wimax_phy_attributes_decoder.c @@ -0,0 +1,189 @@ +/* wimax_phy_attributes_decoder.c + * WiMax PDU Burst Physical Attributes decoder + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include files */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> + +extern gint proto_wimax; + +/* forward reference */ +static void dissect_wimax_phy_attributes_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_wimax_phy_attributes_decoder = -1; +static gint ett_wimax_phy_attributes_decoder = -1; + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_phy_attributes_decoder +}; + +static const value_string vals_subchannel_types[] = +{ + {0, "DL PUSC"}, + {1, "DL FUSC"}, + {16, "UL PUSC"}, + {0, NULL} +}; + +static const value_string vals_modulation_rates[] = +{ + {0, "BPSK R=1/2"}, + {1, "QPSK R=1/2"}, + {2, "QPSK R=3/4"}, + {3, "16-QAM R=1/2"}, + {4, "16-QAM R=3/4"}, + {5, "64-QAM R=1/2"}, + {6, "64-QAM R=2/3"}, + {7, "64-QAM R=3/4"}, + {8, "64-QAM R=5/6"}, + {0, NULL} +}; + +static const value_string vals_encoding_types[] = +{ + {0, "Tail biting convolutional coding (CCTB)"}, + {1, "Convolutional turbo coding (CTC)"}, + {0, NULL} +}; + +static gint hf_phy_attributes_subchannelization_type = -1; +static gint hf_phy_attributes_permbase = -1; +static gint hf_phy_attributes_modulation_rate = -1; +static gint hf_phy_attributes_encoding_type = -1; +static gint hf_phy_attributes_num_repeat = -1; +static gint hf_phy_attributes_symbol_offset = -1; +static gint hf_phy_attributes_num_of_slots = -1; +static gint hf_phy_attributes_subchannel = -1; + +/* Physical Attributes display */ +static hf_register_info hf[] = +{ + { + &hf_phy_attributes_subchannelization_type, + {"Subchannelization Type", "wimax.phy_attributes.subchannelization_type", FT_UINT8, BASE_DEC, VALS(vals_subchannel_types), 0x0, "", HFILL} + }, + { + &hf_phy_attributes_permbase, + {"Permbase", "wimax.phy_attributes.permbase", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_phy_attributes_modulation_rate, + {"Modulation Rate", "wimax.phy_attributes.modulation_rate", FT_UINT8, BASE_DEC, VALS(vals_modulation_rates), 0x0, "", HFILL} + }, + { + &hf_phy_attributes_encoding_type, + {"Encoding Type", "wimax.phy_attributes.encoding_type", FT_UINT8, BASE_DEC, VALS(vals_encoding_types), 0x0, "", HFILL} + }, + { + &hf_phy_attributes_num_repeat, + {"numRepeat", "wimax.phy_attributes.num_repeat", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_phy_attributes_symbol_offset, + {"Symbol Offset", "wimax.phy_attributes.symbol_offset", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_phy_attributes_num_of_slots, + {"Number Of Slots", "wimax.phy_attributes.num_of_slots", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_phy_attributes_subchannel, + {"Subchannel", "wimax.phy_attributes.subchannel", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* Register Wimax PDU Burst Physical Attributes Protocol */ +void proto_register_wimax_phy_attributes(void) +{ + if (proto_wimax_phy_attributes_decoder == -1) + { + proto_wimax_phy_attributes_decoder = proto_wimax; + + register_dissector("wimax_phy_attributes_burst_handler", dissect_wimax_phy_attributes_decoder, -1); + + proto_register_field_array(proto_wimax_phy_attributes_decoder, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } +} + + +static void dissect_wimax_phy_attributes_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset = 0; + guint tvb_len; +// guint num_of_slots; + proto_item *phy_item = NULL; + proto_tree *phy_tree = NULL; + + /* update the info column */ + if (check_col(pinfo->cinfo, COL_INFO)) + { + //col_append_str(pinfo->cinfo, COL_INFO, "PDU Burst Physical Attributes:"); + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "PHY-attr"); + } + if (tree) + { /* we are being asked for details */ + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* display PDU Burst Physical Attributes dissector info */ + phy_item = proto_tree_add_protocol_format(tree, proto_wimax_phy_attributes_decoder, tvb, offset, tvb_len, "PDU Burst Physical Attributes (%u bytes)", tvb_len); + /* add PDU Burst Physical Attributes subtree */ + phy_tree = proto_item_add_subtree(phy_item, ett_wimax_phy_attributes_decoder); + /* display the subchannelization type */ + proto_tree_add_item(phy_tree, hf_phy_attributes_subchannelization_type, tvb, offset++, 1, FALSE); + /* display the permbase */ + proto_tree_add_item(phy_tree, hf_phy_attributes_permbase, tvb, offset++, 1, FALSE); + /* display the modulation rate */ + proto_tree_add_item(phy_tree, hf_phy_attributes_modulation_rate, tvb, offset++, 1, FALSE); + /* display the encoding type */ + proto_tree_add_item(phy_tree, hf_phy_attributes_encoding_type, tvb, offset++, 1, FALSE); + /* display the numRepeat */ + proto_tree_add_item(phy_tree, hf_phy_attributes_num_repeat, tvb, offset++, 1, FALSE); + /* display the symbol offset */ + proto_tree_add_item(phy_tree, hf_phy_attributes_symbol_offset, tvb, offset++, 1, FALSE); + /* display the number of slots */ + proto_tree_add_item(phy_tree, hf_phy_attributes_num_of_slots, tvb, offset, 2, FALSE); + /* get the number of slots */ +// num_of_slots = tvb_get_guint16(tvb, offset); + /* move to next field */ + offset += 2; + /* display the physical subchannel list */ + while(offset < tvb_len) + { + proto_tree_add_item(phy_tree, hf_phy_attributes_subchannel, tvb, offset++, 1, FALSE); + } + } +} diff --git a/plugins/wimax/wimax_tlv.c b/plugins/wimax/wimax_tlv.c new file mode 100644 index 0000000000..a37a653637 --- /dev/null +++ b/plugins/wimax/wimax_tlv.c @@ -0,0 +1,188 @@ +/* wimax_tlv.c + * WiMax TLV handling functions + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/*************************************************************/ +/* ----------------------- NOTE ------------------------- */ +/* There is an identical copy of this file, wimax_tlv.c, in */ +/* both .../plugins/m2m and .../plugins/wimax. If either */ +/* one needs to be modified, please be sure to copy the file */ +/* to the sister directory and check it in there also. */ +/* This prevents having to generate a complicated */ +/* Makefile.nmake in .../plugins/m2m. */ +/*************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "wimax_tlv.h" + +/*************************************************************/ +/* init_tlv_info() */ +/* retrive the tlv information from specified tvb and offset */ +/* parameter: */ +/* this - pointer of a tlv information data structure */ +/* return: */ +/* 0-success */ +/* !=0-the invalid size of the TLV length (failed) */ +/*************************************************************/ +gint init_tlv_info(tlv_info_t *this, tvbuff_t *tvb, gint offset) +{ + guint tlv_len; + + /* get TLV type */ + this->type = (guint8)tvb_get_guint8( tvb, offset ); + /* get TLV length */ + tlv_len = (guint)tvb_get_guint8( tvb, (offset + 1) ); + /* set the TLV value offset */ + this->value_offset = 2; + /* adjust for multiple-byte TLV length */ + if((tlv_len & WIMAX_TLV_EXTENDED_LENGTH_MASK) != 0) + { /* multiple bytes TLV length */ + this->length_type = 1; + /* get the size of the TLV length */ + tlv_len = (tlv_len & WIMAX_TLV_LENGTH_MASK); + this->size_of_length = tlv_len; + /* update the TLV value offset */ + this->value_offset += tlv_len; + switch (tlv_len) + { + case 0: + this->length = 0; /* no length */ + break; + case 1: + this->length = (gint32)tvb_get_guint8( tvb, (offset + 2) ); /* 8 bit */ + break; + case 2: + this->length = (gint32)tvb_get_ntohs( tvb, (offset + 2) ); /* 16 bit */ + break; + case 3: + this->length = (gint32)tvb_get_ntoh24( tvb, (offset + 2) ); /* 24 bit */ + break; + case 4: + this->length = (gint32)tvb_get_ntohl( tvb, (offset + 2) ); /* 32 bit */ + break; + default: + /* mark invalid tlv */ + this->valid = 0; + /* failed, return the invalid size of the tlv length */ + return (gint)tlv_len; + break; + } + } + else /* single byte length */ + { + this->length_type = 0; + this->size_of_length = 0; + this->length = (gint32)tlv_len; + } + /* mark valid tlv */ + this->valid = 1; + /* success */ + return 0; +} + +/*************************************************************/ +/* get_tlv_type() */ +/* get the tlv type of the specified tlv information */ +/* parameter: */ +/* this - pointer of a tlv information data structure */ +/* return: */ +/* >=0 - TLV type */ +/* =-1 - invalid tlv info */ +/*************************************************************/ +gint get_tlv_type(tlv_info_t *this) +{ + if(this->valid) + return (gint)this->type; + return -1; +} + +/**************************************************************/ +/* get_tlv_size_of_length() */ +/* get the size of tlv length of the specified tlv information*/ +/* parameter: */ +/* this - pointer of a tlv information data structure */ +/* return: */ +/* >=0 - the size of TLV length */ +/* =-1 - invalid tlv info */ +/**************************************************************/ +gint get_tlv_size_of_length(tlv_info_t *this) +{ + if(this->valid) + return (gint)this->size_of_length; + return -1; +} + +/*************************************************************/ +/* get_tlv_length() */ +/* get the tlv length of the specified tlv information */ +/* parameter: */ +/* this - pointer of a tlv information data structure */ +/* return: */ +/* >=0 - TLV length */ +/* =-1 - invalid tlv info */ +/*************************************************************/ +gint32 get_tlv_length(tlv_info_t *this) +{ + if(this->valid) + return (gint32)this->length; + return -1; +} + +/*************************************************************/ +/* get_tlv_value_offset() */ +/* get the tlv value offset of the specified tlv information */ +/* parameter: */ +/* this - pointer of a tlv information data structure */ +/* return: */ +/* >0 - TLV value offset in byte */ +/* =-1 - invalid tlv info */ +/*************************************************************/ +gint get_tlv_value_offset(tlv_info_t *this) +{ + if(this->valid) + return (gint)this->value_offset; + return -1; +} + +/*************************************************************/ +/* get_tlv_length_type() */ +/* get the tlv length type of the specified tlv information */ +/* parameter: */ +/* this - pointer of a tlv information data structure */ +/* return: */ +/* 0 - single byte TLV length */ +/* 1 - multiple bytes TLV length */ +/*************************************************************/ +gint get_tlv_length_type(tlv_info_t *this) +{ + if(this->valid) + return (gint)this->length_type; + return -1; +} diff --git a/plugins/wimax/wimax_tlv.h b/plugins/wimax/wimax_tlv.h new file mode 100644 index 0000000000..9377c57b1f --- /dev/null +++ b/plugins/wimax/wimax_tlv.h @@ -0,0 +1,63 @@ +/* wimax_tlv.h + * WiMax TLV handling function header file + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in t/he 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#ifndef _WIMAX_TLV_H_ +#define _WIMAX_TLV_H_ + +#include <gmodule.h> +#include <epan/packet.h> + +#define WIMAX_TLV_EXTENDED_LENGTH_MASK 0x80 +#define WIMAX_TLV_LENGTH_MASK 0x7F + +#define MAX_TLV_LEN 64000 + +#ifndef UNREFERENCED_PARAMETER +#define UNREFERENCED_PARAMETER(x) (x) = (x) +#endif + +typedef struct +{ + guint8 valid; /* TLV info status: 0=invalid; 1=valid */ + guint8 type; /* TLV type */ + guint8 length_type; /* length type: 0=single byte; 1=multiple bytes */ + guint8 size_of_length; /* size of the TLV length */ + guint value_offset; /* the offset of TLV value field */ + gint32 length; /* length of TLV value field */ +} tlv_info_t; + +gint init_tlv_info(tlv_info_t *this, tvbuff_t *tvb, gint offset); +gint valid_tlv_info(tlv_info_t *this); +gint get_tlv_type(tlv_info_t *this); +gint get_tlv_length_type(tlv_info_t *this); +gint get_tlv_size_of_length(tlv_info_t *this); +gint get_tlv_value_offset(tlv_info_t *this); +gint32 get_tlv_length(tlv_info_t *this); +proto_tree *add_tlv_subtree(tlv_info_t *this, gint idx, proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, gboolean little_endian); +proto_tree *add_protocol_subtree(tlv_info_t *this, gint idx, proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, const char *format, ...); + +#endif /* WIMAX_TLV_H */ diff --git a/plugins/wimax/wimax_utils.c b/plugins/wimax/wimax_utils.c new file mode 100644 index 0000000000..4080c4c5ac --- /dev/null +++ b/plugins/wimax/wimax_utils.c @@ -0,0 +1,3573 @@ +/* wimax_utils.c + * WiMax Utility Decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* +#define DEBUG +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gmodule.h> +#include <epan/packet.h> +#include "wimax_tlv.h" +#include "wimax_mac.h" + +#include "wimax_bits.h" + +extern gint proto_mac_mgmt_msg_rng_req_decoder; +extern gint proto_mac_mgmt_msg_reg_req_decoder; + +extern gint mac_sdu_length; /* declared in packet-wmx.c */ +extern gboolean include_cor2_changes; + +/* forward reference */ +void wimax_service_flow_encodings_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_error_parameter_set_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_security_negotiation_parameters_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_tek_parameters_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_pkm_configuration_settings_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_sa_descriptor_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_pkm_tlv_encoded_attributes_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_cryptographic_suite_list_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_security_capabilities_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void wimax_vendor_specific_information_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +guint wimax_common_tlv_encoding_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +static gint proto_wimax_utility_decoders = -1; +static gint ett_wimax_service_flow_encodings = -1; +static gint ett_wimax_cst_encoding_rules = -1; +static gint ett_wimax_error_parameter_set = -1; +static gint ett_wimax_hmac_tuple = -1; +static gint ett_wimax_cmac_tuple = -1; +static gint ett_wimax_short_hmac_tuple = -1; +static gint ett_security_negotiation_parameters = -1; +static gint ett_pkm_tlv_encoded_attributes_decoder = -1; +static gint ett_sa_descriptor_decoder = -1; +static gint ett_cryptographic_suite_list_decoder = -1; +static gint ett_security_capabilities_decoder = -1; +static gint ett_vendor_specific_info_decoder = -1; +static gint ett_vendor_id_encoding_decoder = -1; +static gint ett_ul_service_flow_decoder = -1; +static gint ett_dl_service_flow_decoder = -1; + +/* The following two variables save the Scheduling Service type for + the Grant Management subheader dissector and track whether or not + one has been seen. + */ +static guint scheduling_service_type = -1; +gint seen_a_service_type = 0; + +/* The following two functions set and access the variables above */ +guint get_service_type( void ) +{ + return scheduling_service_type; +} + +void set_service_type( guint set_to ) +{ + if( seen_a_service_type == 0 ){ + scheduling_service_type = set_to; + seen_a_service_type = 1; + } +} + +/* Setup protocol subtree array */ +static gint *ett[] = +{ + &ett_wimax_service_flow_encodings, + &ett_wimax_cst_encoding_rules, + &ett_wimax_error_parameter_set, + &ett_wimax_hmac_tuple, + &ett_wimax_cmac_tuple, + &ett_wimax_short_hmac_tuple, + &ett_security_negotiation_parameters, + &ett_pkm_tlv_encoded_attributes_decoder, + &ett_sa_descriptor_decoder, + &ett_cryptographic_suite_list_decoder, + &ett_security_capabilities_decoder, + &ett_vendor_specific_info_decoder, + &ett_vendor_id_encoding_decoder, + &ett_ul_service_flow_decoder, + &ett_dl_service_flow_decoder, +}; + +static const value_string vals_mbs_service[] = +{ + {0, "No available MBS"}, + {1, "Single-BS-MBS"}, + {2, "Multi-BS-MBS"}, + {0, NULL} +}; + +static const value_string vals_ul_grant_scheduling[] = +{ + {0, "Reserved"}, + {1, "Undefined (BS implementation-dependent)"}, + {2, "BE (default)"}, + {3, "nrtPS"}, + {4, "rtPS"}, + {5, "Extended rtPS"}, + {6, "UGS"}, + {0, NULL} +}; + +static const value_string vals_fixed_len_sdu[] = +{ + {0, "Variable-length SDUs (default)"}, + {1, "Fixed-length SDUs"}, + {0, NULL} +}; + +static const value_string vals_arq_enable[] = +{ + {0, "ARQ not requested/accepted"}, + {1, "ARQ requested/accepted"}, + {0, NULL} +}; +static const value_string vals_arq_block_lifetime[] = +{ + {0, "Infinite"}, + {0, NULL} +}; +static const value_string vals_arq_sync_loss_timeout[] = +{ + {0, "Infinite"}, + {0, NULL} +}; + +static const value_string vals_arq_deliver_in_order[] = +{ + {0, "Order of delivery is not preserved"}, + {1, "Order of delivery is preserved"}, + {0, NULL} +}; +static const value_string vals_arq_rx_purge_timeout[] = +{ + {0, "Infinite"}, + {0, NULL} +}; + +static const value_string vals_fsn_size[] = +{ + {0, "3-bit FSN"}, + {1, "11-bit FSN (default)"}, + {0, NULL} +}; + +static const value_string vals_sn_fb_enable[] = +{ + {0, "Is disabled (default)"}, + {1, "Is enabled"}, + {0, NULL} +}; + +static const value_string vals_harq[] = +{ + {0, "Non HARQ (default)"}, + {1, "HARQ connection" }, + {0, NULL} +}; + +static const value_string vals_cs_specification[] = +{ + {0, "Reserved"}, + {1, "Packet, IPv4"}, + {2, "Packet, IPv6"}, + {3, "Packet, IEEE 802.3/Ethernet"}, + {4, "Packet, IEEE 802.1Q VLAN"}, + {5, "Packet, IPv4 over IEEE 802.3/Ethernet"}, + {6, "Packet, IPv6 over IEEE 802.3/Ethernet"}, + {7, "Packet, IPv4 over IEEE 802.1Q VLAN"}, + {8, "Packet, IPv6 over IEEE 802.1Q VLAN"}, + {9, "ATM"}, + {10, "Packet, IEEE 802.3/Ethernet with ROCH header compression"}, + {11, "Packet, IEEE 802.3/Ethernet with ECRTP header compression"}, + {12, "Packet, IP2 with ROCH header compression"}, + {13, "Packet, IP2 with ECRTP header compression"}, + {0, NULL} +}; + +static const value_string vals_type_of_data_delivery_services[] = +{ + {0, "Continuing grant service"}, + {1, "Real time variable rate service"}, + {2, "Non-real time variable rate service"}, + {3, "Best-efforts service"}, + {4, "Extended real-time variable rate service"}, + {0, NULL} +}; + +static const value_string vals_paging_preference[] = +{ + {0, "No paging generation"}, + {1, "Paging generation"}, + {0, NULL} +}; +static const value_string vals_pdu_sn_ext_subheader[] = +{ + {0, "No support for PDU SN in this connection (default)"}, + {1, "PDU SN (short) extended Subheader"}, + {2, "PDU SN (long) extended Subheader"}, + {0, NULL} +}; + +static const value_string vals_cst_classifier_action[] = +{ + {0, "DSC Add Classifier"}, + {1, "DSC Replace Classifier"}, + {2, "DSC Delete Classifier"}, + {0, NULL} +}; + +static const value_string vals_cst_phs_dsc_action[] = +{ + {0, "Add PHS rule"}, + {1, "Set PHS rule"}, + {2, "Delete PHS rule"}, + {3, "Delete all PHS rules"}, + {0, NULL} +}; + +static const value_string vals_verify[] = +{ + {0, "Verify"}, + {1, "Don't verify"}, + {0, NULL} +}; + +static const value_string vals_atm_switching_encodings[] = +{ + {0, "No switching methodology applied"}, + {1, "VP switching"}, + {2, "VC switching"}, + {0, NULL} +}; + +static const value_string vals_cc[] = +{ + {0, "OK/success"}, + {1, "Reject-other"}, + {2, "Reject-unrecognized-configuration-setting"}, + {3, "Reject-temporary / reject-resource"}, + {4, "Reject-permanent / reject-admin"}, + {5, "Reject-not-owner"}, + {6, "Reject-service-flow-not-found"}, + {7, "Reject-service-flow-exists"}, + {8, "Reject-required-parameter-not-present"}, + {9, "Reject-header-suppression"}, + {10, "Reject-unknown-transaction-id"}, + {11, "Reject-authentication-failure"}, + {12, "Reject-add-aborted"}, + {13, "Reject-exceeded-dynamic-service-limit"}, + {14, "Reject-not-authorized-for-the-request-SAID"}, + {15, "Reject-fail-to-establish-the-requested-SA"}, + {16, "Reject-not-supported-parameter"}, + {17, "Reject-not-supported-parameter-value"}, + {0, NULL} +}; + +static const value_string vals_classification_action_rule[] = +{ + {0, "None"}, + {1, "Discarded packet"}, + {0, NULL} +}; + +static const true_false_string tfs_supported = +{ + "supported", + "not supported" +}; + +static const true_false_string disabled_enabled = +{ + "enabled", + "disabled" +}; + +static const true_false_string default_enabled = +{ + "enabled", + "use default action" +}; + +static const value_string vals_pkm_attr_error_codes[] = +{ /* table 373 */ + {0, "All (no information)"}, + {1, "Auth Reject Auth Invalid (unauthorized SS)"}, + {2, "Auth Reject, Key Reject (unauthorized SAID)"}, + {3, "Auth Invalid (unsolicited)"}, + {4, "Auth Invalid, TEK Invalid (invalid key sequence number)"}, + {5, "Auth Invalid (message (key request) authorization failure)"}, + {6, "Auth Reject (permanent authorization failure)"}, + {0, NULL} +}; + +static const value_string vs_sa_type[] = +{ + {0, "Primary"}, + {1, "Static"}, + {2, "Dynamic"}, + {0, NULL} +}; + +static const value_string va_key_push_modes[] = +{ + {0, "GKEK update mode"}, + {1, "GTEK update mode"}, + {0, NULL} +}; + +static const value_string vals_pkm_version[] = +{ + {0, "Reserved"}, + {1, "PKM (Initial standard release"}, + {0, NULL} +}; + +static const value_string vs_success_reject[] = +{ + {0, "Success"}, + {1, "Reject"}, + {0, NULL} +}; + +static const value_string vs_sa_service_type[] = +{ + {0, "Unicast service"}, + {1, "Group multicast service"}, + {2, "MBS service"}, + {0, NULL} +}; + +static const value_string vals_data_encryption_ids[] = +{ /* table 375 */ + {0, "No data encryption"}, + {1, "CBC-Mode, 56-bit DES"}, + {2, "CCM-Mode, 128-bit AES"}, + {3, "CBC-Mode, 128-bit AES"}, + {128, "CTR-Mode, 128-bit AES for MBS with 8 bit ROC"}, + {0, NULL} +}; + +static const value_string vals_data_authentication_ids[] = +{ /* table 376 */ + {0, "No data authentication"}, + {1, "CCM-Mode, 128-bit AES"}, + {0, NULL} +}; + +static const value_string vals_tek_encryption_ids[] = +{ /* table 377 */ + {0, "Reserved"}, + {1, "3-DES EDE with 128-bit key"}, + {2, "RSA with 1024-bit key"}, + {3, "ECB mode AES with 128-bit key"}, + {3, "AES key wrap with 128-bit key"}, + {0, NULL} +}; + +static const value_string vals_dcd_mac_version[] = +{ + {1, "Conformance with IEEE Std 802.16-2001"}, + {2, "Conformance with IEEE Std 802.16c-2002 and its predecessors"}, + {3, "Conformance with IEEE Std 802.16a-2003 and its predecessors"}, + {4, "Conformance with IEEE Std 802.16-2004"}, + {5, "Conformance with IEEE Std 802.16-2004 and IEEE Std 802.16e-2005"}, + {6, "reserved"}, + {0, NULL} +}; + +/* fix fields */ +static gint hf_sfe_unknown_type = -1; +static gint hf_sfe_sf_id = -1; +static gint hf_sfe_cid = -1; +static gint hf_sfe_service_class_name = -1; +static gint hf_sfe_mbs_service = -1; +static gint hf_sfe_qos_params_set = -1; +static gint hf_sfe_set_provisioned = -1; +static gint hf_sfe_set_admitted = -1; +static gint hf_sfe_set_active = -1; +static gint hf_sfe_set_rsvd = -1; +static gint hf_sfe_traffic_priority = -1; +static gint hf_sfe_max_str = -1; +static gint hf_sfe_max_traffic_burst = -1; +static gint hf_sfe_min_rtr = -1; +static gint hf_sfe_reserved_10 = -1; +static gint hf_sfe_ul_grant_scheduling = -1; +static gint hf_sfe_req_tx_policy = -1; +static gint hf_sfe_policy_broadcast_bwr = -1; +static gint hf_sfe_policy_multicast_bwr = -1; +static gint hf_sfe_policy_piggyback = -1; +static gint hf_sfe_policy_fragment = -1; +static gint hf_sfe_policy_headers = -1; +static gint hf_sfe_policy_packing = -1; +static gint hf_sfe_policy_crc = -1; +static gint hf_sfe_policy_rsvd1 = -1; +static gint hf_sfe_jitter = -1; +static gint hf_sfe_max_latency = -1; +static gint hf_sfe_fixed_len_sdu = -1; +static gint hf_sfe_sdu_size = -1; +static gint hf_sfe_target_said = -1; +static gint hf_sfe_cs_specification = -1; +static gint hf_sfe_type_of_data_delivery_services = -1; +static gint hf_sfe_sdu_inter_arrival_interval = -1; +static gint hf_sfe_time_base = -1; +static gint hf_sfe_paging_preference = -1; +static gint hf_sfe_mbs_zone_identifier_assignment = -1; +static gint hf_sfe_sn_feedback_enabled = -1; +static gint hf_sfe_harq_service_flows = -1; +static gint hf_sfe_harq_channel_mapping_index = -1; +static gint hf_sfe_fsn_size = -1; +static gint hf_sfe_unsolicited_grant_interval = -1; +static gint hf_sfe_unsolicited_polling_interval = -1; +static gint hf_sfe_harq_channel_mapping = -1; +static gint hf_sfe_global_service_class_name = -1; +static gint hf_sfe_reserved_36 = -1; +static gint hf_sfe_reserved_34 = -1; + +static gint hf_sfe_arq_enable = -1; +static gint hf_sfe_arq_transmitter_delay = -1; +static gint hf_sfe_arq_receiver_delay = -1; +static gint hf_sfe_arq_block_lifetime = -1; +static gint hf_sfe_arq_sync_loss_timeout = -1; +static gint hf_sfe_arq_transmitter_delay_cor2 = -1; +static gint hf_sfe_arq_receiver_delay_cor2 = -1; +static gint hf_sfe_arq_block_lifetime_cor2 = -1; +static gint hf_sfe_arq_sync_loss_timeout_cor2 = -1; +static gint hf_sfe_arq_deliver_in_order = -1; +static gint hf_sfe_arq_rx_purge_timeout = -1; +static gint hf_sfe_arq_window_size = -1; +static gint hf_sfe_arq_block_size = -1; +static gint hf_sfe_arq_block_size_cor2 = -1; +static gint hf_sfe_arq_min_block_size = -1; +static gint hf_sfe_arq_max_block_size = -1; + +static gint hf_sfe_cid_alloc_for_active_bs = -1; +static gint hf_sfe_cid_alloc_for_active_bs_cid = -1; +static gint hf_sfe_pdu_sn_ext_subheader_reorder = -1; +static gint hf_sfe_mbs_contents_ids = -1; +static gint hf_sfe_mbs_contents_ids_id = -1; +static gint hf_sfe_authorization_token = -1; + +static gint hf_cst_classifier_dsc_action = -1; +static gint hf_cst_error_set_errored_param = -1; +static gint hf_cst_error_set_error_code = -1; +static gint hf_cst_error_set_error_msg = -1; + +static gint hf_cst_pkt_class_rule = -1; + +static gint hf_cst_pkt_class_rule_priority = -1; +static gint hf_cst_pkt_class_rule_range_mask = -1; +static gint hf_cst_pkt_class_rule_tos_low = -1; +static gint hf_cst_pkt_class_rule_tos_high = -1; +static gint hf_cst_pkt_class_rule_tos_mask = -1; +static gint hf_cst_pkt_class_rule_protocol = -1; +//static gint hf_cst_pkt_class_rule_protocol_number = -1; +static gint hf_cst_pkt_class_rule_ip_masked_src_address = -1; +static gint hf_cst_pkt_class_rule_ip_masked_dest_address = -1; +static gint hf_cst_pkt_class_rule_src_ipv4 = -1; +static gint hf_cst_pkt_class_rule_dest_ipv4 = -1; +static gint hf_cst_pkt_class_rule_mask_ipv4 = -1; +static gint hf_cst_pkt_class_rule_src_ipv6 = -1; +static gint hf_cst_pkt_class_rule_dest_ipv6 = -1; +static gint hf_cst_pkt_class_rule_mask_ipv6 = -1; +static gint hf_cst_pkt_class_rule_prot_src_port_range = -1; +static gint hf_cst_pkt_class_rule_src_port_low = -1; +static gint hf_cst_pkt_class_rule_src_port_high = -1; +static gint hf_cst_pkt_class_rule_prot_dest_port_range = -1; +static gint hf_cst_pkt_class_rule_dest_port_low = -1; +static gint hf_cst_pkt_class_rule_dest_port_high = -1; +static gint hf_cst_pkt_class_rule_dest_mac_address = -1; +static gint hf_cst_pkt_class_rule_dest_mac = -1; +static gint hf_cst_pkt_class_rule_src_mac_address = -1; +static gint hf_cst_pkt_class_rule_src_mac = -1; +static gint hf_cst_pkt_class_rule_mask_mac = -1; +static gint hf_cst_pkt_class_rule_ethertype = -1; +static gint hf_cst_pkt_class_rule_etype = -1; +static gint hf_cst_pkt_class_rule_eprot1 = -1; +static gint hf_cst_pkt_class_rule_eprot2 = -1; +static gint hf_cst_pkt_class_rule_user_priority = -1; +static gint hf_cst_pkt_class_rule_pri_low = -1; +static gint hf_cst_pkt_class_rule_pri_high = -1; +static gint hf_cst_pkt_class_rule_vlan_id = -1; +static gint hf_cst_pkt_class_rule_vlan_id1 = -1; +static gint hf_cst_pkt_class_rule_vlan_id2 = -1; +static gint hf_cst_pkt_class_rule_phsi = -1; +static gint hf_cst_pkt_class_rule_index = -1; +static gint hf_cst_pkt_class_rule_ipv6_flow_label = -1; +static gint hf_cst_pkt_class_rule_vendor_spec = -1; +static gint hf_cst_pkt_class_rule_classifier_action_rule = -1; +static gint hf_cst_pkt_class_rule_classifier_action_rule_bit0 = -1; +static gint hf_cst_pkt_class_rule_classifier_action_rule_bit1 = -1; + +static gint hf_cst_large_context_id = -1; +static gint hf_cst_short_format_context_id = -1; + +static gint hf_cst_phs_dsc_action = -1; +static gint hf_cst_phs_rule = -1; +static gint hf_cst_phs_phsi = -1; +static gint hf_cst_phs_phsf = -1; +static gint hf_cst_phs_phsm = -1; +static gint hf_cst_phs_phss = -1; +static gint hf_cst_phs_phsv = -1; +static gint hf_cst_phs_vendor_spec = -1; +static gint hf_cst_invalid_tlv = -1; + +static gint hf_csper_atm_switching_encoding = -1; +static gint hf_csper_atm_classifier = -1; +static gint hf_csper_atm_classifier_vpi = -1; +static gint hf_csper_atm_classifier_vci = -1; +static gint hf_csper_atm_classifier_id = -1; +//static gint hf_csper_atm_classifier_dsc_action = -1; +static gint hf_csper_unknown_type = -1; + +static gint hf_xmac_tuple_rsvd = -1; +static gint hf_xmac_tuple_key_seq_num = -1; +static gint hf_hmac_tuple_hmac_digest = -1; +static gint hf_packet_number_counter = -1; +static gint hf_cmac_tuple_cmac_value = -1; +static gint hf_cmac_tuple_bsid = -1; + +/* bit masks */ +/* 11.13.4 */ +#define SFE_QOS_PARAMS_SET_PROVISIONED_SET 0x01 +#define SFE_QOS_PARAMS_SET_ADMITTED_SET 0x02 +#define SFE_QOS_PARAMS_SET_ACTIVE_SET 0x04 +#define SFE_QOS_PARAMS_SET_RESERVED 0xF8 +/* 11.13.12 */ +#define SFE_REQ_TX_POLICY_BROADCAST_BWR 0x01 +#define SFE_REQ_TX_POLICY_MULTICAST_BWR 0x02 +#define SFE_REQ_TX_POLICY_PIGGYBACK 0x04 +#define SFE_REQ_TX_POLICY_FRAGMENT_DATA 0x08 +#define SFE_REQ_TX_POLICY_PAYLOAD_HEADER 0x10 +#define SFE_REQ_TX_POLICY_PACKINGS 0x20 +#define SFE_REQ_TX_POLICY_CRC 0x40 +#define SFE_REQ_TX_POLICY_RESERVED 0x80 + +/* WiMax Service Flow Encodings display */ +static hf_register_info hf_sfe[] = +{ + { /* 1 Service Flow ID */ + &hf_sfe_sf_id, + {"Service Flow ID", "wimax.sfe.sf_id", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 2 CID */ + &hf_sfe_cid, + {"CID", "wimax.sfe.cid", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 3 Service Class Name */ + &hf_sfe_service_class_name, + {"Service Class Name", "wimax.sfe.service_class_name", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* 4 MBS Service */ + &hf_sfe_mbs_service, + {"MBS Service", "wimax.sfe.mbs_service", FT_UINT8, BASE_DEC, VALS(vals_mbs_service), 0x0, "", HFILL} + }, + { /* 5 QoS Parameter Set Type */ + &hf_sfe_qos_params_set, + {"QoS Parameter Set Type", "wimax.sfe.qos_params_set", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 5.1 */ + &hf_sfe_set_provisioned, + {"Provisioned Set", "wimax.sfe.qos_params_set.provisioned", FT_BOOLEAN, 8, NULL, SFE_QOS_PARAMS_SET_PROVISIONED_SET, "", HFILL} + }, + { /* 5.2 */ + &hf_sfe_set_admitted, + {"Admitted Set", "wimax.sfe.qos_params_set.admitted", FT_BOOLEAN, 8, NULL, SFE_QOS_PARAMS_SET_ADMITTED_SET, "", HFILL} + }, + { /* 5.3 */ + &hf_sfe_set_active, + {"Active Set", "wimax.sfe.qos_params_set.active", FT_BOOLEAN, 8, NULL, SFE_QOS_PARAMS_SET_ACTIVE_SET, "", HFILL} + }, + { /* 5.4 */ + &hf_sfe_set_rsvd, + {"Reserved", "wimax.sfe.qos_params_set.rsvd", FT_UINT8, BASE_HEX, NULL, SFE_QOS_PARAMS_SET_RESERVED, "", HFILL} + }, + { /* 6 Traffic Priority */ + &hf_sfe_traffic_priority, + {"Traffic Priority", "wimax.sfe.traffic_priority", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 7 Maximum Sustained Traffic Rate */ + &hf_sfe_max_str, + {"Maximum Sustained Traffic Rate", "wimax.sfe.msr", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 8 Maximum Traffic Burst */ + &hf_sfe_max_traffic_burst, + {"Maximum Traffic Burst", "wimax.sfe.max_traffic_burst", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 9 Minimum Reserved Traffic Rate */ + &hf_sfe_min_rtr, + {"Minimum Reserved Traffic Rate", "wimax.sfe.mrr", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + /* 10 Reserved */ + &hf_sfe_reserved_10, + {"Reserved", "wimax.sfe.reserved_10", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, +#if 0 + { /* 10 reserved by 16E */ + &hf_sfe_mtr, + {"Minimum tolerable traffic rate", "wimax.sfe.mtr", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { /* 11 Service Flow Scheduling Type */ + &hf_sfe_ul_grant_scheduling, + {"Uplink Grant Scheduling Type", "wimax.sfe.uplink_grant_scheduling", FT_UINT8, BASE_DEC, VALS(vals_ul_grant_scheduling), 0x0, "", HFILL} + }, + { /* 12 Request/Transmission Policy */ + &hf_sfe_req_tx_policy, + {"Request/Transmission Policy", "wimax.sfe.req_tx_policy", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 12.1 */ + &hf_sfe_policy_broadcast_bwr, + {"The Service Flow Shall Not Use Broadcast Bandwidth Request Opportunities", "wimax.sfe.policy.broadcast_bwr", FT_BOOLEAN, 8, NULL, SFE_REQ_TX_POLICY_BROADCAST_BWR, "", HFILL} + }, + { /* 12.2 */ + &hf_sfe_policy_multicast_bwr, + {"The Service Flow Shall Not Use Multicast Bandwidth Request Opportunities", "wimax.sfe.policy.bit1", FT_BOOLEAN, 8, NULL, SFE_REQ_TX_POLICY_MULTICAST_BWR, "", HFILL} + }, + { /* 12.3 */ + &hf_sfe_policy_piggyback, + {"The Service Flow Shall Not Piggyback Requests With Data", "wimax.sfe.policy.piggyback", FT_BOOLEAN, 8, NULL, SFE_REQ_TX_POLICY_PIGGYBACK, "", HFILL} + }, + { /* 12.4 */ + &hf_sfe_policy_fragment, + {"The Service Flow Shall Not Fragment Data", "wimax.sfe.policy.fragment", FT_BOOLEAN, 8, NULL, SFE_REQ_TX_POLICY_FRAGMENT_DATA, "", HFILL} + }, + { /* 12.5 */ + &hf_sfe_policy_headers, + {"The Service Flow Shall Not Suppress Payload Headers", "wimax.sfe.policy.headers", FT_BOOLEAN, 8, NULL, SFE_REQ_TX_POLICY_PAYLOAD_HEADER, "", HFILL} + }, + { /* 12.6 */ + &hf_sfe_policy_packing, + {"The Service Flow Shall Not Pack Multiple SDUs (Or Fragments) Into Single MAC PDUs", "wimax.sfe.policy.packing", FT_BOOLEAN, 8, NULL, SFE_REQ_TX_POLICY_PACKINGS, "", HFILL} + }, + { /* 12.7 */ + &hf_sfe_policy_crc, + {"The Service Flow Shall Not Include CRC In The MAC PDU", "wimax.sfe.policy.crc", FT_BOOLEAN, 8, NULL, SFE_REQ_TX_POLICY_CRC, "", HFILL} + }, + { /* 12.8 */ + &hf_sfe_policy_rsvd1, + {"Reserved", "wimax.sfe.policy.rsvd1", FT_UINT8, BASE_HEX, NULL, SFE_REQ_TX_POLICY_RESERVED, "", HFILL} + }, + { /* 13 Tolerated Jitter */ + &hf_sfe_jitter, + {"Tolerated Jitter", "wimax.sfe.jitter", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 14 Maximum Latency */ + &hf_sfe_max_latency, + {"Maximum Latency", "wimax.sfe.max_latency", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 15 Fixed/Variable Length SDU */ + &hf_sfe_fixed_len_sdu, + {"Fixed/Variable Length SDU", "wimax.sfe.fixed_len_sdu", FT_UINT8, BASE_DEC, VALS(vals_fixed_len_sdu), 0x0, "", HFILL} + }, + { /* 16 SDU Size */ + &hf_sfe_sdu_size, + {"SDU Size", "wimax.sfe.sdu_size", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 17 SAID Onto Which SF Is Mapped */ + &hf_sfe_target_said, + {"SAID Onto Which SF Is Mapped", "wimax.sfe.target_said", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 18 ARQ Enable */ + &hf_sfe_arq_enable, + {"ARQ Enable", "wimax.arq.enable", FT_UINT8, BASE_DEC, VALS(vals_arq_enable), 0x0, "", HFILL} + }, + { /* 19 ARQ Window Size */ + &hf_sfe_arq_window_size, + {"ARQ Window Size", "wimax.arq.window_size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 20 ARQ Transmitter Delay */ + &hf_sfe_arq_transmitter_delay, + {"ARQ Transmitter Delay (10us granularity)", "wimax.arq.transmitter_delay", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 21 ARQ Receiver Delay */ + &hf_sfe_arq_receiver_delay, + {"ARQ Receiver Delay (10us granularity)", "wimax.arq.receiver_delay", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 22 ARQ Block Lifetime */ + &hf_sfe_arq_block_lifetime, + {"ARQ Block Lifetime (10us granularity)", "wimax.arq.block_lifetime", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 23 ARQ Sync Loss Timeout */ + &hf_sfe_arq_sync_loss_timeout, + {"ARQ Sync Loss Timeout (10us granularity)", "wimax.arq.sync_loss_timeout", FT_UINT16, BASE_DEC, VALS(&vals_arq_sync_loss_timeout), 0x0, "", HFILL} + }, + { /* 20 ARQ Transmitter Delay */ + &hf_sfe_arq_transmitter_delay_cor2, + {"ARQ Transmitter Delay (100us granularity)", "wimax.arq.transmitter_delay", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 21 ARQ Receiver Delay */ + &hf_sfe_arq_receiver_delay_cor2, + {"ARQ Receiver Delay (100us granularity)", "wimax.arq.receiver_delay", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 22 ARQ Block Lifetime */ + &hf_sfe_arq_block_lifetime_cor2, + {"ARQ Block Lifetime (100us granularity)", "wimax.arq.block_lifetime", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 23 ARQ Sync Loss Timeout */ + &hf_sfe_arq_sync_loss_timeout_cor2, + {"ARQ Sync Loss Timeout (100us granularity)", "wimax.arq.sync_loss_timeout", FT_UINT16, BASE_DEC, VALS(&vals_arq_sync_loss_timeout), 0x0, "", HFILL} + }, + { /* 24 ARQ Deliver In Order */ + &hf_sfe_arq_deliver_in_order, + {"ARQ Deliver In Order", "wimax.arq.deliver_in_order", FT_UINT8, BASE_DEC, VALS(&vals_arq_deliver_in_order), 0x0, "", HFILL} + }, + { /* 25 ARQ Purge Timeout */ + &hf_sfe_arq_rx_purge_timeout, + {"ARQ RX Purge Timeout (100us granularity)", "wimax.arq.rx_purge_timeout", FT_UINT16, BASE_DEC, VALS(&vals_arq_rx_purge_timeout), 0x0, "", HFILL} + }, + { /* 26 ARQ Block Size */ + &hf_sfe_arq_block_size, + {"ARQ Block Size", "wimax.arq.block_size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 26 ARQ Block Size */ + &hf_sfe_arq_block_size_cor2, + {"ARQ Block Size", "wimax.arq.block_size", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 26 ARQ Block Size for Corrigendum 2 */ + &hf_sfe_arq_min_block_size, + {"ARQ Minumum Block Size", "wimax.arq.min_block_size", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL} + }, + { /* 26 ARQ Block Size for Corrigendum 2 */ + &hf_sfe_arq_max_block_size, + {"ARQ Maximum Block Size", "wimax.arq.max_block_size", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL} + }, +/* 27 reserved */ + { /* 28 CS Specification */ + &hf_sfe_cs_specification, + {"CS Specification", "wimax.sfe.cs_specification", FT_UINT8, BASE_DEC, VALS(vals_cs_specification), 0x0, "", HFILL} + }, + { /* 29 Type of Data Delivery Services */ + &hf_sfe_type_of_data_delivery_services, + {"Type of Data Delivery Services", "wimax.sfe.type_of_data_delivery_services", FT_UINT8, BASE_DEC, VALS(vals_type_of_data_delivery_services), 0x0, "", HFILL} + }, + { /* 30 SDU Inter-Arrival Interval */ + &hf_sfe_sdu_inter_arrival_interval, + {"SDU Inter-Arrival Interval (in the resolution of 0.5 ms)", "wimax.sfe.sdu_inter_arrival_interval", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 31 Time Base */ + &hf_sfe_time_base, + {"Time Base", "wimax.sfe.time_base", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 32 Paging Preference */ + &hf_sfe_paging_preference, + {"Paging Preference", "wimax.sfe.paging_preference", FT_UINT8, BASE_DEC, VALS(vals_paging_preference), 0x0, "", HFILL} + }, + { /* 33 MBS Zone Identifier */ + &hf_sfe_mbs_zone_identifier_assignment, + {"MBS Zone Identifier", "wimax.sfe.mbs_zone_identifier", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 34 Traffic Indication Preference */ + &hf_sfe_reserved_34, + {"Reserved", "wimax.sfe.reserved_34", FT_UINT8, BASE_DEC, NULL /*VALS(vals_traffic_indication_preference)*/, 0x0, "", HFILL} + }, + { /* 35 Global Service Class Name */ + &hf_sfe_global_service_class_name, + {"Global Service Class Name", "wimax.sfe.global_service_class_name", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL} + }, +/* 36 reserved by 16E */ + /* 36 Reserved */ + { + &hf_sfe_reserved_36, + {"Reserved", "wimax.sfe.reserved_36", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 37 SN Feedback Enable */ + &hf_sfe_sn_feedback_enabled, + {"SN Feedback", "wimax.sfe.sn_feedback_enabled", FT_UINT8, BASE_DEC, VALS(vals_sn_fb_enable), 0x0, "", HFILL} + }, + { /* 38 FSN Size */ + &hf_sfe_fsn_size, + {"FSN Size", "wimax.sfe.fsn_size", FT_UINT8, BASE_DEC, VALS(vals_fsn_size), 0x0, "", HFILL} + }, + { /* 39 CID allocation for Active BSs */ + &hf_sfe_cid_alloc_for_active_bs, + {"CID Allocation For Active BSs", "wimax.sfe.cid_alloc_for_active_bs", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 39.1 */ + &hf_sfe_cid_alloc_for_active_bs_cid, + {"CID", "wimax.sfe.cid_alloc_for_active_bs_cid", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 40 Unsolicited Grant Interval */ + &hf_sfe_unsolicited_grant_interval, + {"Unsolicited Grant Interval", "wimax.sfe.unsolicited_grant_interval", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 41 Unsolicited Polling Interval */ + &hf_sfe_unsolicited_polling_interval, + {"Unsolicited Polling Interval", "wimax.sfe.unsolicited_polling_interval", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 42 PDU SN extended subheader for HARQ reordering */ + &hf_sfe_pdu_sn_ext_subheader_reorder, + {"PDU SN Extended Subheader For HARQ Reordering", "wimax.sfe.pdu_sn_ext_subheader_reorder", FT_UINT8, BASE_DEC, VALS(vals_pdu_sn_ext_subheader), 0x0, "", HFILL} + }, + { /* 43 MBS contents ID */ + &hf_sfe_mbs_contents_ids, + {"MBS contents IDs", "wimax.sfe.mbs_contents_ids", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 43.1 */ + &hf_sfe_mbs_contents_ids_id, + {"MBS Contents ID", "wimax.sfe.mbs_contents_ids_id", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 44 HARQ Service Flows */ + &hf_sfe_harq_service_flows, + {"HARQ Service Flows", "wimax.sfe.harq_service_flows", FT_UINT8, BASE_DEC, VALS(vals_harq), 0x0, "", HFILL} + }, + { /* 45 Authorization Token */ + &hf_sfe_authorization_token, + {"Authorization Token", "wimax.sfe.authorization_token", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 46 HARQ Channel Mapping */ + &hf_sfe_harq_channel_mapping, + {"HARQ Channel Mapping", "wimax.sfe.harq_channel_mapping", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 46.1 HARQ Channel Index*/ + &hf_sfe_harq_channel_mapping_index, + {"HARQ Channel Index", "wimax.sfe.harq_channel_mapping.index", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, +/* unknown types */ + { /* unknown SFE types */ + &hf_sfe_unknown_type, + {"Unknown SFE TLV type", "wimax.sfe.unknown_type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* bit masks */ +/* 11.13.19.3.4.17 */ +#define CST_PKT_CLASS_RULE_CLASSIFIER_ACTION_RULE_BIT0 0x80 +#define CST_PKT_CLASS_RULE_CLASSIFIER_ACTION_RULE_RSV 0x7F + +/* WiMax Convergence Service Parameter Encoding Rules display */ +static hf_register_info hf_csper[] = +{ /* 99 - 111 CS parameter encoding rules */ + { /* Classifier DSC Action */ + &hf_cst_classifier_dsc_action, + {"Classifier DSC Action", "wimax.cst.classifier_action", FT_UINT8, BASE_DEC, VALS(vals_cst_classifier_action), 0x0, "", HFILL} + }, + { /* Errored Parameter */ + &hf_cst_error_set_errored_param, + {"Errored Parameter", "wimax.cst.error_set.errored_param", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Error Code */ + &hf_cst_error_set_error_code, + {"Error Code", "wimax.cst.error_set.error_code", FT_UINT8, BASE_HEX, VALS(vals_cc), 0x0, "", HFILL} + }, + { /* Error Message */ + &hf_cst_error_set_error_msg, + {"Error Message", "wimax.cst.error_set.error_msg", FT_STRINGZ, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* Packet Classification Rule */ + &hf_cst_pkt_class_rule, + {"Packet Classification Rule", "wimax.cst.pkt_class_rule", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Classification Rule Priority */ + &hf_cst_pkt_class_rule_priority, + {"Classification Rule Priority", "wimax.cst.pkt_class_rule.priority", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* ToS/Differentiated Services Codepoint (DSCP) Range And Mask */ + &hf_cst_pkt_class_rule_range_mask, + {"ToS/Differentiated Services Codepoint (DSCP) Range And Mask", "wimax.cst.pkt_class_rule.range_mask", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* ToS-Low */ + &hf_cst_pkt_class_rule_tos_low, + {"ToS-Low", "wimax.cst.pkt_class_rule.tos-low", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* ToS-High */ + &hf_cst_pkt_class_rule_tos_high, + {"ToS-High", "wimax.cst.pkt_class_rule.tos-high", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* ToS-Mask */ + &hf_cst_pkt_class_rule_tos_mask, + {"ToS-Mask", "wimax.cst.pkt_class_rule.tos-mask", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Protocol */ + &hf_cst_pkt_class_rule_protocol, + {"Protocol", "wimax.cst.pkt_class_rule.protocol", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#if 0 /* Removed by the changes of 802.16E 2005 */ + { /* Protocol */ + &hf_cst_pkt_class_rule_protocol, + {"Protocol", "wimax.cst.pkt_class_rule.protocol", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Protocol Number */ + &hf_cst_pkt_class_rule_protocol_number, + {"Protocol Number", "wimax.cst.pkt_class_rule.protocol.number", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, +#endif + { /* IP Masked Source Address */ + &hf_cst_pkt_class_rule_ip_masked_src_address, + {"IP Masked Source Address", "wimax.cst.pkt_class_rule.ip_masked_src_address", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* IP Masked Destination Address */ + &hf_cst_pkt_class_rule_ip_masked_dest_address, + {"IP Masked Destination Address", "wimax.cst.pkt_class_rule.ip_masked_dest_address", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* IPv4 Source Address */ + &hf_cst_pkt_class_rule_src_ipv4, + {"IPv4 Source Address", "wimax.cst.pkt_class_rule.src_ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* IPv4 Destination Address */ + &hf_cst_pkt_class_rule_dest_ipv4, + {"IPv4 Destination Address", "wimax.cst.pkt_class_rule.dst_ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* IPv4 Mask */ + &hf_cst_pkt_class_rule_mask_ipv4, + {"IPv4 Mask", "wimax.cst.pkt_class_rule.mask_ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* IPv6 Source Address */ + &hf_cst_pkt_class_rule_src_ipv6, + {"IPv6 Source Address", "wimax.cst.pkt_class_rule.src_ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* IPv6 Destination Address */ + &hf_cst_pkt_class_rule_dest_ipv6, + {"IPv6 Destination Address", "wimax.cst.pkt_class_rule.dst_ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* IPv6 Mask */ + &hf_cst_pkt_class_rule_mask_ipv6, + {"IPv6 Mask", "wimax.cst.pkt_class_rule.mask_ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* Protocol Source Port Range */ + &hf_cst_pkt_class_rule_prot_src_port_range, + {"Protocol Source Port Range", "wimax.cst.pkt_class_rule.prot_src_port_range", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Src-Port Low */ + &hf_cst_pkt_class_rule_src_port_low, + {"Src-Port Low", "wimax.cst.pkt_class_rule.src_port_low", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* Src-Port High */ + &hf_cst_pkt_class_rule_src_port_high, + {"Src-Port High", "wimax.cst.pkt_class_rule.src_port_high", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* Protocol Destination Port Range */ + &hf_cst_pkt_class_rule_prot_dest_port_range, + {"Protocol Destination Port Range", "wimax.cst.pkt_class_rule.prot_dest_port_range", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Dst-Port Low */ + &hf_cst_pkt_class_rule_dest_port_low, + {"Dst-Port Low", "wimax.cst.pkt_class_rule.dst_port_low", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* Dst-Port High */ + &hf_cst_pkt_class_rule_dest_port_high, + {"Dst-Port High", "wimax.cst.pkt_class_rule.dst_port_high", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 802.3/Ethernet Destination MAC Address */ + &hf_cst_pkt_class_rule_dest_mac_address, + {"802.3/Ethernet Destination MAC Address", "wimax.cst.pkt_class_rule.dest_mac_address", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Destination MAC Address */ + &hf_cst_pkt_class_rule_dest_mac, + {"Destination MAC Address", "wimax.cst.pkt_class_rule.dst_mac", FT_ETHER, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* 802.3/Ethernet Source MAC Address */ + &hf_cst_pkt_class_rule_src_mac_address, + {"802.3/Ethernet Source MAC Address", "wimax.cst.pkt_class_rule.src_mac_address", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Source MAC Address */ + &hf_cst_pkt_class_rule_src_mac, + {"Source MAC Address", "wimax.cst.pkt_class_rule.src_mac", FT_ETHER, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* MAC Address Mask */ + &hf_cst_pkt_class_rule_mask_mac, + {"MAC Address Mask", "wimax.cst.pkt_class_rule.mask_mac", FT_ETHER, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* Ethertype/IEEE Std 802.2-1998 SAP */ + &hf_cst_pkt_class_rule_ethertype, + {"Ethertype/IEEE Std 802.2-1998 SAP", "wimax.cst.pkt_class_rule.ethertype", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Ethertype */ + &hf_cst_pkt_class_rule_etype, + {"Ethertype", "wimax.cst.pkt_class_rule.ethertype", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* Eprot1 */ + &hf_cst_pkt_class_rule_eprot1, + {"Eprot1", "wimax.cst.pkt_class_rule.eprot1", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Eprot2 */ + &hf_cst_pkt_class_rule_eprot2, + {"Eprot2", "wimax.cst.pkt_class_rule.eprot2", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* IEEE Std 802.1D-1998 User_Priority */ + &hf_cst_pkt_class_rule_user_priority, + {"IEEE Std 802.1D-1998 User_Priority", "wimax.cst.pkt_class_rule.user_priority", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cst_pkt_class_rule_pri_low, + {"Pri-Low", "wimax.cst.pkt_class_rule.pri-low", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_cst_pkt_class_rule_pri_high, + {"Pri-High", "wimax.cst.pkt_class_rule.pri-high", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* IEEE Std 802.1Q-1998 VLAN_ID */ + &hf_cst_pkt_class_rule_vlan_id, + {"IEEE Std 802.1Q-1998 VLAN_ID", "wimax.cst.pkt_class_rule.vlan_id", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Vlan_Id1 */ + &hf_cst_pkt_class_rule_vlan_id1, + {"Vlan_Id1", "wimax.cst.pkt_class_rule.vlan_id1", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Vlan_Id2 */ + &hf_cst_pkt_class_rule_vlan_id2, + {"Vlan_Id2", "wimax.cst.pkt_class_rule.vlan_id2", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Associated PHSI */ + &hf_cst_pkt_class_rule_phsi, + {"Associated PHSI", "wimax.cst.pkt_class_rule.phsi", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* Packet Classifier Rule Index */ + &hf_cst_pkt_class_rule_index, + {"Packet Classifier Rule Index (PCRI)", "wimax.cst.pkt_class_rule.index", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* Large Context ID for ROHC/ECRTP Compressed Packet or ROHC Feedback Packet */ + &hf_cst_large_context_id, + {"Large Context ID", "wimax.cst.large_context_id", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* Short-Format Context ID for ROHC/ECRTP Compressed Packet or ROHC Feedback Packet */ + &hf_cst_short_format_context_id, + {"Short-Format Context ID", "wimax.cst.short_format_context_id", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* Vendor-Specific Classifier Parameters */ + &hf_cst_pkt_class_rule_vendor_spec, + {"Vendor-Specific Classifier Parameters", "wimax.cst.pkt_class_rule.vendor_spec", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* Classifier Action Rule */ + &hf_cst_pkt_class_rule_classifier_action_rule, + {"Classifier Action Rule", "wimax.cst.pkt_class_rule.classifier.action.rule", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cst_pkt_class_rule_classifier_action_rule_bit0, + {"Bit #0", "wimax.cst.pkt_class_rule.classifier.action.rule.bit0", FT_UINT8, BASE_HEX, VALS(vals_classification_action_rule), CST_PKT_CLASS_RULE_CLASSIFIER_ACTION_RULE_BIT0, "", HFILL} + }, + { + &hf_cst_pkt_class_rule_classifier_action_rule_bit1, + {"Reserved", "wimax.cst.pkt_class_rule.classifier.action.rule.reserved", FT_UINT8, BASE_HEX, NULL, CST_PKT_CLASS_RULE_CLASSIFIER_ACTION_RULE_RSV, "", HFILL} + }, + { /* PHS DSC action */ + &hf_cst_phs_dsc_action, + {"PHS DSC action", "wimax.cst.phs_dsc_action", FT_UINT8, BASE_DEC, VALS(vals_cst_phs_dsc_action), 0x0, "", HFILL} + }, + { /* PHS Rule */ + &hf_cst_phs_rule, + {"PHS Rule", "wimax.cst.phs_rule", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* PHS Rule 1 */ + &hf_cst_phs_phsi, + {"PHSI", "wimax.cst.phs_rule.phsi", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* PHS Rule 2 */ + &hf_cst_phs_phsf, + {"PHSF", "wimax.cst.phs_rule.phsf", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* PHS Rule 3 */ + &hf_cst_phs_phsm, + {"PHSM (bit x: 0-don't suppress the (x+1) byte; 1-suppress the (x+1) byte)", "wimax.cst.phs_rule.phsm", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* PHS Rule 4 */ + &hf_cst_phs_phss, + {"PHSS", "wimax.cst.phs_rule.phss", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* PHS Rule 5 */ + &hf_cst_phs_phsv, + {"PHSV", "wimax.cst.phs_rule.phsv", FT_UINT8, BASE_DEC, VALS(vals_verify), 0x0, "", HFILL} + }, + { /* PHS Rule 143 */ + &hf_cst_phs_vendor_spec, + {"Vendor-Specific PHS Parameters", "wimax.cst.phs.vendor_spec", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* IPv6 Flow Label */ + &hf_cst_pkt_class_rule_ipv6_flow_label, + {"IPv6 Flow Label", "wimax.cst.pkt_class_rule.ipv6_flow_label", FT_UINT24, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* ATM Switching Encoding */ + &hf_csper_atm_switching_encoding, + {"ATM Switching Encoding", "wimax.csper.atm_switching_encoding", FT_UINT8, BASE_DEC, VALS(vals_atm_switching_encodings), 0x0, "", HFILL} + }, + { /* ATM Classifier TLV */ + &hf_csper_atm_classifier, + {"ATM Classifier TLV", "wimax.csper.atm_classifier", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* ATM VPI Classifier */ + &hf_csper_atm_classifier_vpi, + {"VPI Classifier", "wimax.csper.atm_classifier_vpi", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* ATM VCI Classifier */ + &hf_csper_atm_classifier_vci, + {"VCI Classifier", "wimax.csper.atm_classifier_vci", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* ATM Classifier ID */ + &hf_csper_atm_classifier_id, + {"Classifier ID", "wimax.csper.atm_classifier_tlv", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, +/* unknown types */ + { /* unknown CSPER types */ + &hf_csper_unknown_type, + {"Unknown CSPER TLV type", "wimax.csper.unknown_type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cst_invalid_tlv, + {"Invalid TLV", "wimax.cst.invalid_tlv", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* bit masks */ +/* 11.1.2 (table 348) */ +#define XMAC_TUPLE_RESERVED 0xF0 +#define XMAC_TUPLE_KEY_SEQ_NUM 0x0F + +/* WiMax HMAC/CMAC/Short-HMAC Tuples display */ +static hf_register_info hf_xmac[] = +{ + { + &hf_xmac_tuple_rsvd, + {"Reserved", "wimax.xmac_tuple.reserved", FT_UINT8, BASE_HEX, NULL, XMAC_TUPLE_RESERVED, "", HFILL} + }, + { + &hf_xmac_tuple_key_seq_num, + {"Key Sequence Number", "wimax.xmac_tuple.key_sn", FT_UINT8, BASE_DEC, NULL, XMAC_TUPLE_KEY_SEQ_NUM, "", HFILL} + }, + { + &hf_hmac_tuple_hmac_digest, + {"HMAC Digest", "wimax.xmac_tuple.hmac_digest", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cmac_tuple_bsid, + {"BSID", "wimax.cmac_tuple.bsid", FT_ETHER, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_cmac_tuple_cmac_value, + {"CMAC Value", "wimax.cmac_tuple.cmac.value", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_packet_number_counter, + {"Packet Number Counter", "wimax.xmac_tuple.packet_number_count", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + } +}; + +/* WiMax Security Negotiation Parameters display */ +static gint hf_snp_pkm_version_support = -1; +static gint hf_snp_pkm_version_support_bit0 = -1; +static gint hf_snp_pkm_version_support_bit1 = -1; +static gint hf_snp_pkm_version_support_reserved = -1; +static gint hf_snp_auth_policy_support = -1; +static gint hf_snp_auth_policy_support_bit0 = -1; +static gint hf_snp_auth_policy_support_bit1 = -1; +static gint hf_snp_auth_policy_support_bit2 = -1; +static gint hf_snp_auth_policy_support_bit3 = -1; +static gint hf_snp_auth_policy_support_bit4 = -1; +static gint hf_snp_auth_policy_support_bit5 = -1; +static gint hf_snp_auth_policy_support_bit6 = -1; +static gint hf_snp_auth_policy_support_bit7 = -1; +static gint hf_snp_mac_mode = -1; +static gint hf_snp_mac_mode_bit0 = -1; +static gint hf_snp_mac_mode_bit1 = -1; +static gint hf_snp_mac_mode_bit1_rsvd = -1; +static gint hf_snp_mac_mode_bit2 = -1; +static gint hf_snp_mac_mode_bit3 = -1; +static gint hf_snp_mac_mode_bit4 = -1; +static gint hf_snp_mac_mode_bit5 = -1; +static gint hf_snp_mac_mode_reserved = -1; +static gint hf_snp_mac_mode_reserved1 = -1; +static gint hf_snp_pn_window_size = -1; +static gint hf_snp_max_conc_transactions = -1; +static gint hf_snp_max_suppt_sec_assns = -1; +static gint hf_snp_unknown_type = -1; + +/* bit masks */ +/* 11.8.4.1 */ +#define SNP_PKM_VERSION_SUPPORT_BIT0 0x01 +#define SNP_PKM_VERSION_SUPPORT_BIT1 0x02 +#define SNP_PKM_VERSION_SUPPORT_RSV 0xFC +/* 11.8.4.2 */ +#define SNP_AUTH_POLICY_SUPPORT_BIT0 0x01 +#define SNP_AUTH_POLICY_SUPPORT_BIT1 0x02 +#define SNP_AUTH_POLICY_SUPPORT_BIT2 0x04 +#define SNP_AUTH_POLICY_SUPPORT_BIT3 0x08 +#define SNP_AUTH_POLICY_SUPPORT_BIT4 0x10 +#define SNP_AUTH_POLICY_SUPPORT_BIT5 0x20 +#define SNP_AUTH_POLICY_SUPPORT_BIT6 0x40 +#define SNP_AUTH_POLICY_SUPPORT_BIT7 0x80 +/* 11.8.4.3 */ +#define SNP_MAC_MODE_BIT0 0x01 +#define SNP_MAC_MODE_BIT1 0x02 +#define SNP_MAC_MODE_BIT2 0x04 +#define SNP_MAC_MODE_BIT3 0x08 +#define SNP_MAC_MODE_BIT4 0x10 +#define SNP_MAC_MODE_BIT5 0x20 +#define SNP_MAC_MODE_RSV 0xE0 +#define SNP_MAC_MODE_RSV1 0xC0 + +static hf_register_info hf_snp[] = +{ + { /* 11.8.4.1 */ + &hf_snp_pkm_version_support, + {"PKM Version Support", "wimax.security_negotiation_parameters.pkm_version_support",FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_snp_pkm_version_support_bit0, + {"PKM version 1", "wimax.security_negotiation_parameters.pkm_version_support.bit0",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_PKM_VERSION_SUPPORT_BIT0, "", HFILL} + }, + { + &hf_snp_pkm_version_support_bit1, + {"PKM version 2", "wimax.security_negotiation_parameters.pkm_version_support.bit1",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_PKM_VERSION_SUPPORT_BIT1, "", HFILL} + }, + { + &hf_snp_pkm_version_support_reserved, + {"Reserved", "wimax.security_negotiation_parameters.pkm_version_support.reserved",FT_UINT8, BASE_HEX, NULL, SNP_PKM_VERSION_SUPPORT_RSV, "", HFILL} + }, + { /* 11.8.4.2 */ + &hf_snp_auth_policy_support, + {"Authorization Policy Support", "wimax.security_negotiation_parameters.auth_policy_support",FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_snp_auth_policy_support_bit0, + {"RSA-based Authorization At The Initial Network Entry", "wimax.security_negotiation_parameters.auth_policy_support.bit0",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_AUTH_POLICY_SUPPORT_BIT0, "", HFILL} + }, + { + &hf_snp_auth_policy_support_bit1, + {"EAP-based Authorization At The Initial Network Entry", "wimax.security_negotiation_parameters.auth_policy_support.bit1",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_AUTH_POLICY_SUPPORT_BIT1, "", HFILL} + }, + { + &hf_snp_auth_policy_support_bit2, + {"Authenticated EAP-based Authorization At The Initial Network Entry", "wimax.security_negotiation_parameters.auth_policy_support.bit2",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_AUTH_POLICY_SUPPORT_BIT2, "", HFILL} + }, + { + &hf_snp_auth_policy_support_bit3, + {"Reserved", "wimax.security_negotiation_parameters.auth_policy_support.bit3",FT_UINT8, BASE_HEX, NULL, SNP_AUTH_POLICY_SUPPORT_BIT3, "", HFILL} + }, + { + &hf_snp_auth_policy_support_bit4, + {"RSA-based Authorization At Re-entry", "wimax.security_negotiation_parameters.auth_policy_support.bit4",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_AUTH_POLICY_SUPPORT_BIT4, "", HFILL} + }, + { + &hf_snp_auth_policy_support_bit5, + {"EAP-based Authorization At Re-entry", "wimax.security_negotiation_parameters.auth_policy_support.bit5",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_AUTH_POLICY_SUPPORT_BIT5, "", HFILL} + }, + { + &hf_snp_auth_policy_support_bit6, + {"Authenticated EAP-based Authorization At Re-entry", "wimax.security_negotiation_parameters.auth_policy_support.bit6",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_AUTH_POLICY_SUPPORT_BIT6, "", HFILL} + }, + { + &hf_snp_auth_policy_support_bit7, + {"Reserved", "wimax.security_negotiation_parameters.auth_policy_support.bit7",FT_UINT8, BASE_HEX, NULL, SNP_AUTH_POLICY_SUPPORT_BIT7, "", HFILL} + }, + { /* 11.8.4.3 */ + &hf_snp_mac_mode, + {"MAC (Message Authentication Code) Mode", "wimax.security_negotiation_parameters.mac_mode",FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_snp_mac_mode_bit0, + {"HMAC", "wimax.security_negotiation_parameters.mac_mode.bit0",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_MAC_MODE_BIT0, "", HFILL} + }, + { + &hf_snp_mac_mode_bit1, + {"CMAC", "wimax.security_negotiation_parameters.mac_mode.bit1",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_MAC_MODE_BIT1, "", HFILL} + }, + { + &hf_snp_mac_mode_bit1_rsvd, + {"Reserved", "wimax.security_negotiation_parameters.mac_mode.bit1_rsvd",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_MAC_MODE_BIT1, "", HFILL} + }, + { + &hf_snp_mac_mode_bit2, + {"64-bit Short-HMAC", "wimax.security_negotiation_parameters.mac_mode.bit2",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_MAC_MODE_BIT2, "", HFILL} + }, + { + &hf_snp_mac_mode_bit3, + {"80-bit Short-HMAC", "wimax.security_negotiation_parameters.mac_mode.bit3",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_MAC_MODE_BIT3, "", HFILL} + }, + { + &hf_snp_mac_mode_bit4, + {"96-bit Short-HMAC", "wimax.security_negotiation_parameters.mac_mode.bit4",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_MAC_MODE_BIT4, "", HFILL} + }, + { + &hf_snp_mac_mode_bit5, + {"CMAC", "wimax.security_negotiation_parameters.mac_mode.bit5",FT_BOOLEAN, 8, TFS(&tfs_supported), SNP_MAC_MODE_BIT5, "", HFILL} + }, + { + &hf_snp_mac_mode_reserved, + {"Reserved", "wimax.security_negotiation_parameters.mac_mode.reserved",FT_UINT8, BASE_HEX, NULL, SNP_MAC_MODE_RSV, "", HFILL} + }, + { + &hf_snp_mac_mode_reserved1, + {"Reserved", "wimax.security_negotiation_parameters.mac_mode.reserved",FT_UINT8, BASE_HEX, NULL, SNP_MAC_MODE_RSV1, "", HFILL} + }, + { /* 11.8.4.4 */ + &hf_snp_pn_window_size, + {"PN Window Size", "wimax.security_negotiation_parameters.pn_window_size",FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.8.4.5 */ + &hf_snp_max_conc_transactions, + {"Maximum concurrent transactions (0 indicates no limit)", "wimax.security_negotiation_parameters.max_conc_transactions",FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.8.4.6 */ + &hf_snp_max_suppt_sec_assns, + {"Maximum number of security associations supported by the SS", "wimax.security_negotiation_parameters.max_suppt_sec_assns",FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_snp_unknown_type, + {"Unknown Security Negotiation Parameter type", "wimax.security_negotiation_parameters.unknown.type",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* PKM display */ +static gint hf_pkm_msg_unknown_type = -1; +static gint hf_pkm_msg_attr_display = -1; +static gint hf_pkm_config_settings_authorize_waitout = -1; +static gint hf_pkm_config_settings_reauthorize_waitout = -1; +static gint hf_pkm_config_settings_grace_time = -1; +static gint hf_pkm_config_settings_operational_waittime = -1; +static gint hf_pkm_msg_attr_auth_key = -1; +static gint hf_pkm_msg_attr_tek = -1; +static gint hf_pkm_msg_attr_key_life_time = -1; +static gint hf_pkm_msg_attr_key_seq_num = -1; +static gint hf_pkm_msg_attr_hmac_digest = -1; +static gint hf_pkm_msg_attr_said = -1; +static gint hf_pkm_msg_attr_cbc_iv = -1; +static gint hf_pkm_msg_attr_error_code = -1; +static gint hf_pkm_msg_attr_ca_certificate = -1; +static gint hf_pkm_msg_attr_ss_certificate = -1; +static gint hf_pkm_attr_auth_result_code = -1; +static gint hf_pkm_attr_sa_service_type = -1; +static gint hf_pkm_attr_frame_number = -1; +static gint hf_pkm_attr_ss_random = -1; +static gint hf_pkm_attr_bs_random = -1; +static gint hf_pkm_attr_pre_pak = -1; +static gint hf_pkm_attr_bs_certificate = -1; +static gint hf_pkm_attr_sig_bs = -1; +static gint hf_pkm_attr_ms_mac_address = -1; +static gint hf_pkm_attr_cmac_digest = -1; +static gint hf_pkm_attr_cmac_digest_pn = -1; +static gint hf_pkm_attr_cmac_digest_value = -1; +static gint hf_pkm_attr_eap_payload = -1; +static gint hf_pkm_attr_nonce = -1; +static gint hf_pkm_sa_type = -1; +static gint hf_pkm_msg_crypto_suite = -1; +static gint hf_pkm_msg_crypto_suite_msb = -1; +static gint hf_pkm_msg_crypto_suite_middle = -1; +static gint hf_pkm_msg_crypto_suite_lsb = -1; +//static gint hf_pkm_msg_version = -1; +static gint hf_pkm_attr_push_modes = -1; +static gint hf_pkm_attr_key_push_counter = -1; +static gint hf_pkm_attr_gkek = -1; +static gint hf_pkm_attr_sig_ss = -1; +static gint hf_pkm_attr_akid = -1; +static gint hf_pkm_config_settings_rekey_wait_timeout = -1; +static gint hf_pkm_config_settings_tek_grace_time = -1; +static gint hf_pkm_config_settings_authorize_reject_wait_timeout = -1; + +static gint hf_pkm_attr_pak_ak_seq_number = -1; +static gint hf_pkm_attr_associated_gkek_seq_number = -1; +static gint hf_pkm_attr_gkek_params = -1; + +static hf_register_info hf_pkm[] = +{ + { /* 11.9.1 - type 6 */ + &hf_pkm_msg_attr_display, + {"Display String", "wimax.pkm_msg.pkm_attr.display_string", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL} + }, + { /* 11.9.2 - type 7 */ + &hf_pkm_msg_attr_auth_key, + {"Auth Key", "wimax.pkm_msg.pkm_attr.auth_key", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.3 - type 8 */ + &hf_pkm_msg_attr_tek, + {"TEK", "wimax.pkm_msg.pkm_attr.tek", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.4 - type 9 */ + &hf_pkm_msg_attr_key_life_time, + {"Key Lifetime", "wimax.pkm_msg.pkm_attr.key_life_time", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.5 - type 10 */ + &hf_pkm_msg_attr_key_seq_num, + {"Key Sequence Number", "wimax.pkm_msg.pkm_attr.key_seq_num", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.6 - type 11 */ + &hf_pkm_msg_attr_hmac_digest, + {"HMAC-Digest", "wimax.pkm_msg.pkm_attr.hmac_digest", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.7 - type 12 */ + &hf_pkm_msg_attr_said, + {"SAID", "wimax.pkm_msg.pkm_attr.said", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#if 0 /* not been used */ + { /* 11.9.8 - type 13 */ + &hf_pkm_msg_attr_tek_param, + {"TEK Parameters", "wimax.pkm_msg.pkm_attr.tek_parameters", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { /* 11.9.9 - type 15 */ + &hf_pkm_msg_attr_cbc_iv, + {"CBC IV", "wimax.pkm_msg.pkm_attr.cbc_iv", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.10 - type 16 */ + &hf_pkm_msg_attr_error_code, + {"Error Code", "wimax.pkm_msg.pkm_attr.error_code", FT_UINT8, BASE_DEC, VALS(vals_pkm_attr_error_codes), 0x0, "", HFILL} + }, + { /* 11.9.11 - type 17 */ + &hf_pkm_msg_attr_ca_certificate, + {"CA Certificate", "wimax.pkm_msg.pkm_attr.ca_certificate", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.12 - type 18 */ + &hf_pkm_msg_attr_ss_certificate, + {"SS Certificate", "wimax.pkm_msg.pkm_attr.ss_certificate", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#if 0 /* not been used */ + { /* 11.9.13 - type 19 */ + &hf_pkm_msg_attr_security_capabilities, + {"Security Capabilities", "wimax.pkm_msg.pkm_attr.security_capabilities", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { /* 11.9.14 - type 20 */ + &hf_pkm_msg_crypto_suite, + {"Cryptography", "wimax.pkm_msg.pkm_attr.crypto_suite", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_pkm_msg_crypto_suite_msb, + {"Data Encryption Algorithm Identifiers", "wimax.pkm_msg.pkm_attr.crypto_suite.msb", FT_UINT8, BASE_DEC, VALS(vals_data_encryption_ids), 0x0, "", HFILL} + }, + { + &hf_pkm_msg_crypto_suite_middle, + {"Data Authentication Algorithm Identifiers", "wimax.pkm_msg.pkm_attr.crypto_suite.middle", FT_UINT8, BASE_DEC, VALS(vals_data_authentication_ids), 0x0, "", HFILL} + }, + { + &hf_pkm_msg_crypto_suite_lsb, + {"TEK Encryption Algorithm Identifiers", "wimax.pkm_msg.pkm_attr.crypto_suite.lsb", FT_UINT8, BASE_DEC, VALS(vals_tek_encryption_ids), 0x0, "", HFILL} + }, +#if 0 /* not been used */ + { /* 11.9.15 - type 21 */ + &hf_pkm_msg_crypto_list, + {"Cryptographic-Suite List", "wimax.pkm_msg.pkm_attr.crypto_suite_list", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif +#if 0 /* deleted by 802.16E */ + { /* 11.9.16 - type 22 */ + &hf_pkm_msg_version, + {"Reserved ", "wimax.pkm_msg.pkm_attr.version", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif +#if 0 /* not been used */ + { /* 11.9.17 - type 23 */ + &hf_pkm_msg_sa_descriptor, + {"SA Descriptor", "wimax.pkm_msg.pkm_attr.sa_descriptor", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { /* 11.9.18 - type 24 */ + &hf_pkm_sa_type, + {"SA Type", "wimax.pkm_msg.pkm_attr.sa_type", FT_UINT8, BASE_DEC, VALS(vs_sa_type), 0x0, "", HFILL} + }, +#if 0 /* not been used */ + { /* 11.9.?? - type 25 */ + &hf_pkm_attr_security_negotiation_parameters, + {"Security Negotiation Parameters", "wimax.pkm_msg.pkm_attr.security_negotiation_parameters", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif +#if 0 /* not been used */ + { /* 11.9.19 - type 27 */ + &hf_pkm_attr_config_settings, + {"PKM Configuration Settings", "wimax.pkm_msg.pkm_attr.config_settings", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { /* 11.9.19.1 */ + &hf_pkm_config_settings_authorize_waitout, + {"Authorize Wait Timeout (in seconds)", "wimax.pkm_msg.pkm_attr.config_settings.authorize_waitout", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.19.2 */ + &hf_pkm_config_settings_reauthorize_waitout, + {"Reauthorize Wait Timeout (in seconds)", "wimax.pkm_msg.pkm_attr.config_settings.reauthorize_waitout", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.19.3 */ + &hf_pkm_config_settings_grace_time, + {"Authorization Grace Time (in seconds)", "wimax.pkm_msg.pkm_attr.config_settings.grace_time", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.19.4 */ + &hf_pkm_config_settings_operational_waittime, + {"Operational Wait Timeout (in seconds)", "wimax.pkm_msg.pkm_attr.config_settings.operational_wait_timeout", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.19.5 */ + &hf_pkm_config_settings_rekey_wait_timeout, + {"Rekey Wait Timeout (in seconds)", "wimax.pkm_msg.pkm_attr.config_settings.rekey_wait_timeout", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.19.6 */ + &hf_pkm_config_settings_tek_grace_time, + {"TEK Grace Time (in seconds)", "wimax.pkm_msg.pkm_attr.config_settings.tek_grace_time", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.19.7 */ + &hf_pkm_config_settings_authorize_reject_wait_timeout, + {"Authorize Reject Wait Timeout(in seconds)", "wimax.pkm_msg.pkm_attr.config_settings.authorize_reject_wait_timeout", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.20 - type 29 */ + &hf_pkm_attr_nonce, + {"Nonce", "wimax.pkm_msg.pkm_attr.nonce", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.21 - type 33 */ + &hf_pkm_attr_ss_random, + {"SS_RANDOM", "wimax.pkm_msg.pkm_attr.ss_random", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.22 - type 34 */ + &hf_pkm_attr_bs_random, + {"BS_RANDOM", "wimax.pkm_msg.pkm_attr.bs_random", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.23 - type 35 */ + &hf_pkm_attr_pre_pak, + {"Pre-PAK", "wimax.pkm_msg.pkm_attr.pre_pak", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#if 1 /* no definition */ + { /* 11.9.?? - type 36 */ + &hf_pkm_attr_pak_ak_seq_number, + {"PAK/AK Sequence Number", "wimax.pkm_msg.pkm_attr.pak_ak_seq_number", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { /* 11.9.24 - type 37 */ + &hf_pkm_attr_bs_certificate, + {"BS Certificate", "wimax.pkm_msg.pkm_attr.bs_certificate", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.25 - type 38 */ + &hf_pkm_attr_sig_bs, + {"SigBS", "wimax.pkm_msg.pkm_attr.sig_bs",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.26 - type 39 */ + &hf_pkm_attr_ms_mac_address, + {"MS-MAC Address", "wimax.pkm_msg.pkm_attr.ms_mac_address",FT_ETHER, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.27 - type 40 */ + &hf_pkm_attr_cmac_digest, + {"CMAC Digest", "wimax.pkm_msg.pkm_attr.cmac_digest",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_pkm_attr_cmac_digest_pn, + {"CMAC Packet Number counter, CMAC_PN_*", "wimax.pkm_msg.pkm_attr.cmac_digest.pn",FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_pkm_attr_cmac_digest_value, + {"CMAC Value", "wimax.pkm_msg.pkm_attr.cmac_digest.value",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.28 - type 41 */ + &hf_pkm_attr_push_modes, + {"Key Push Modes", "wimax.pkm_msg.pkm_attr.key_push_modes",FT_UINT8, BASE_DEC, VALS(va_key_push_modes), 0x0, "", HFILL} + }, + { /* 11.9.29 - type 42 */ + &hf_pkm_attr_key_push_counter, + {"Key Push Counter", "wimax.pkm_msg.pkm_attr.key_push_counter",FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { /* 11.9.30 - type 43 */ + &hf_pkm_attr_gkek, + {"GKEK", "wimax.pkm_msg.pkm_attr.gkek",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.31 - type 44 */ + &hf_pkm_attr_sig_ss, + {"SigSS", "wimax.pkm_msg.pkm_attr.sig_ss",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.32 - type 45 */ + &hf_pkm_attr_akid, + {"AKID", "wimax.pkm_msg.pkm_attr.akid",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.33 - type 28 */ + &hf_pkm_attr_eap_payload, + {"EAP Payload", "wimax.pkm_msg.pkm_attr.eap_payload", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.34 - type 30 */ + &hf_pkm_attr_auth_result_code, + {"Auth Result Code", "wimax.pkm_msg.pkm_attr.auth_result_code", FT_UINT8, BASE_DEC, VALS(vs_success_reject), 0x0, "", HFILL} + }, + { /* 11.9.35 - type 31 */ + &hf_pkm_attr_sa_service_type, + {"SA Service Type", "wimax.pkm_msg.pkm_attr.sa_service_type", FT_UINT8, BASE_DEC, VALS(vs_sa_service_type), 0x0, "", HFILL} + }, +#if 0 /* same as 11.9.19 */ + { /* 11.9.36 - type 27 */ + &hf_pkm_attr_config_settings, + {"PKMv2 Configuration Settings", "wimax.pkm_msg.pkm_attr.config_settings", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { /* 11.9.37 - type 32 */ + &hf_pkm_attr_frame_number, + {"Frame Number", "wimax.pkm_msg.pkm_attr.frame_number", FT_UINT24, BASE_DEC, NULL, 0x0, "", HFILL} + }, +#if 1 /* no definitions */ + { /* 11.9.?? - type 46 */ + &hf_pkm_attr_associated_gkek_seq_number, + {"Associated GKEK Sequence Number", "wimax.pkm_msg.pkm_attr.associated_gkek_seq_number",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { /* 11.9.?? - type 47 */ + &hf_pkm_attr_gkek_params, + {"GKEK Parameters", "wimax.pkm_msg.pkm_attr.gkek_params",FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, +#endif + { + &hf_pkm_msg_unknown_type, + {"Unknown Type", "wimax.pkm.unknown.type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +static gint hf_common_tlv_unknown_type = -1; +static gint hf_common_tlv_mac_version = -1; +static gint hf_common_tlv_vendor_id = -1; +static gint hf_common_tlv_vendor_specific_type = -1; +static gint hf_common_tlv_vendor_specific_length = -1; +static gint hf_common_tlv_vendor_specific_length_size = -1; +static gint hf_common_tlv_vendor_specific_value = -1; + +/* WiMax Common TLV Encoding display */ +static hf_register_info hf_common_tlv[] = +{ + { + &hf_common_tlv_mac_version, + { "MAC Version", "wimax.common_tlv.mac_version", FT_UINT8, BASE_DEC, VALS(vals_dcd_mac_version), 0x0, "", HFILL} + }, + { + &hf_common_tlv_vendor_id, + { "Vendor ID Encoding", "wimax.common_tlv.vendor_id_encoding", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_common_tlv_vendor_specific_type, + { "Vendor Specific Type", "wimax.common_tlv.vendor_specific_type", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_common_tlv_vendor_specific_length_size, + { + "Vendor Specific Length Size", "wimax.common_tlv.vendor_specific_length_size", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL + } + }, + { + &hf_common_tlv_vendor_specific_length, + { "Vendor Specific Length", "wimax.common_tlv.vendor_specific_length", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL} + }, + { + &hf_common_tlv_vendor_specific_value, + { "Vendor Specific Value", "wimax.common_tlv.vendor_specific_value", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + }, + { + &hf_common_tlv_unknown_type, + {"Unknown Common TLV Type", "wimax.common_tlv.unknown_type", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} + } +}; + +/* Register WiMax Utility Routines */ +void proto_register_wimax_utility_decoders(void) +{ + if(proto_wimax_utility_decoders == -1) + { + proto_wimax_utility_decoders = proto_register_protocol ( + "WiMax Sub-TLV Messages", /* name */ + "WiMax Sub-TLV (sub)", /* short name */ + "sub" /* abbrev */ + ); + + proto_register_subtree_array(ett, array_length(ett)); + proto_register_field_array(proto_mac_mgmt_msg_reg_req_decoder, hf_sfe, array_length(hf_sfe)); + proto_register_field_array(proto_wimax_utility_decoders, hf_csper, array_length(hf_csper)); + proto_register_field_array(proto_wimax_utility_decoders, hf_xmac, array_length(hf_xmac)); + proto_register_field_array(proto_wimax_utility_decoders, hf_snp, array_length(hf_snp)); + proto_register_field_array(proto_wimax_utility_decoders, hf_pkm, array_length(hf_pkm)); + proto_register_field_array(proto_wimax_utility_decoders, hf_common_tlv, array_length(hf_common_tlv)); + } +} + +/**************************************************************/ +/* wimax_error_parameter_set_decoder() */ +/* decode and display the WiMax Error Parameter Set */ +/* parameter: */ +/* tvb - pointer of the tvb of error_parameter_set */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure*/ +/**************************************************************/ +void wimax_error_parameter_set_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint tvb_len, tlv_len; + gint tlv_type; + proto_item *ceps_item = NULL; + proto_tree *ceps_tree = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + offset = 0; + /* display error parameter information */ + ceps_item = proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, tvb_len, "Error Parameter Set (%u bytes)", tvb_len); + /* add CS Parameter Encoding Rules subtree */ + ceps_tree = proto_item_add_subtree(ceps_item, ett_wimax_error_parameter_set); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Error Parameter Set"); + } + return; + } + /* process the classifier error parameter set */ + while(offset < tvb_len) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "EPS TLV error"); + } + proto_tree_add_item(ceps_tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(ceps_tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len+2+get_tlv_size_of_length(&tlv_info)), "EPS TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len, offset, tvb_len); +#endif + /* update the offset */ + offset += get_tlv_value_offset(&tlv_info); + /* parse the Classifier Error Parameter Set */ + switch (tlv_type) + { + case CST_ERROR_SET_ERRORED_PARAM: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_error_parameter_set, ceps_tree, hf_cst_error_set_errored_param, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_cst_error_set_errored_param, tvb, offset, tlv_len, FALSE); + break; + case CST_ERROR_SET_ERROR_CODE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_error_parameter_set, ceps_tree, hf_cst_error_set_error_code, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_cst_error_set_error_code, tvb, offset, tlv_len, FALSE); + break; + case CST_ERROR_SET_ERROR_MSG: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_error_parameter_set, ceps_tree, hf_cst_error_set_error_msg, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_cst_error_set_error_msg, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } +} + +/****************************************************************/ +/* wimax_convengence_service_parameter_encoding_rules_decoder() */ +/* decode and display the WiMax Convergence Service Parameter */ +/* Encoding Rules */ +/* parameter: */ +/* sfe_type - Service Flow Encodings type */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/****************************************************************/ +/* CS Parameter Encoding Rules handling function */ +void wimax_convengence_service_parameter_encoding_rules_decoder(guint sfe_type, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset, tlv_offset; + guint tvb_len, tlv_len, length; + gint tlv_type; + proto_item *csper_item = NULL; + proto_tree *csper_tree = NULL; + proto_tree *tlv_tree = NULL; + proto_tree *ti_tree = NULL; + tlv_info_t tlv_info; + gboolean ipv6 = ((sfe_type == SFE_CSPER_PACKET_IPV6) || (sfe_type == SFE_CSPER_PACKET_IPV6_802_3) || (sfe_type == SFE_CSPER_PACKET_IPV6_802_1Q)); + + /* sanity check */ + if((sfe_type < SFE_CSPER_ATM) || (sfe_type > SFE_CSPER_PACKET_IP_802_3_ECRTP_COMPRESSION)) + return; /* invalid CS Parameter Encodings */ + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + offset = 0; + /* display SFE information */ + csper_item = proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, tvb_len, "Convergence Service Parameter Encoding Rules (%u bytes)", tvb_len); + /* add CS Parameter Encoding Rules subtree */ + csper_tree = proto_item_add_subtree(csper_item, ett_wimax_cst_encoding_rules); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Convergence Service Parameter Encoding Rules"); + } + return; + } + /* process WiMax Service Flow Encodings */ + while(offset < tvb_len) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "CSPER TLV error"); + } + proto_tree_add_item(csper_tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(csper_tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len+2+get_tlv_size_of_length(&tlv_info)), "CSPER TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len, offset, tvb_len); +#endif + /* update the offset */ + offset += get_tlv_value_offset(&tlv_info); + /* parse the CS parameter Encoding Rule TLV */ + if(sfe_type == SFE_CSPER_ATM) + { /* ATM CS Encodings */ + switch (tlv_type) + { + case CST_ATM_SWITCHING: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, hf_csper_atm_switching_encoding, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_csper_atm_switching_encoding, tvb, offset, tlv_len, FALSE); + break; + case CST_ATM_CLASSIFIER: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, hf_csper_atm_classifier, tvb, offset, tlv_len, FALSE); + tlv_offset = offset; + while(tlv_offset < (tlv_len + offset)) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, tlv_offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "ATM Classifier TLV error"); + } + proto_tree_add_item(tlv_tree, hf_cst_invalid_tlv, tvb, offset, (tlv_len - tlv_offset), FALSE); + break; + } +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(csper_tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len+2+get_tlv_size_of_length(&tlv_info)), "ATM Classifier TLV Type: %u (%u bytes, offset=%u, tlv_len=%u)", tlv_type, length, offset, tlv_len); +#endif + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case ATM_VPI_CLASSIFIER: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_csper_atm_classifier_vpi, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_csper_atm_classifier_vpi, tvb, tlv_offset, length, FALSE); + break; + case ATM_VCI_CLASSIFIER: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_csper_atm_classifier_vci, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_csper_atm_classifier_vci, tvb, tlv_offset, length, FALSE); + break; + case ATM_CLASSIFIER_ID: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_csper_atm_classifier_id, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_csper_atm_classifier_id, tvb, tlv_offset, length, FALSE); + break; + default: + break; + } + tlv_offset += length; + } /* end of while loop */ + break; + case CST_ATM_CLASSIFIER_DSC_ACTION: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, hf_cst_classifier_dsc_action, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_cst_classifier_dsc_action, tvb, offset, tlv_len, FALSE); + break; + case CST_ATM_CLASSIFIER_ERROR_PARAMETER_SET: + /* call the error parameter set function */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Classifier Error Parameter Set (%u byte(s))", tlv_len); + wimax_error_parameter_set_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + default: + /* display the unknown ATM CS encoding in hex */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, hf_csper_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_csper_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + } + else + { + switch (tlv_type) + { + case CST_CLASSIFIER_ACTION: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, hf_cst_classifier_dsc_action, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_cst_classifier_dsc_action, tvb, offset, tlv_len, FALSE); + break; + case CST_CLASSIFIER_ERROR_PARAM_SET: + case CST_PHS_ERROR_PARAM_SET: + tlv_tree = add_protocol_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Classifier Error Parameter Set (%u byte(s))", tlv_len); + /* call the error parameter set function */ + wimax_error_parameter_set_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case CST_PACKET_CLASSIFICATION_RULE: + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, hf_cst_pkt_class_rule, tvb, offset, tlv_len, FALSE); + tlv_offset = offset; + while(tlv_offset < (tlv_len + offset)) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, tlv_offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Packet Classification Rule TLV error"); + } + proto_tree_add_item(tlv_tree, hf_cst_invalid_tlv, tvb, offset, (tlv_len - tlv_offset), FALSE); + break; + } +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(csper_tree, proto_wimax_utility_decoders, tvb, tlv_offset, (length + get_tlv_value_offset(&tlv_info)), "Packet Classification Rule TLV Type: %u (%u bytes, offset=%u, tlv_len=%u)", tlv_type, length, tlv_offset, tlv_len); +#endif + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case CST_PKT_CLASS_RULE_PRIORITY: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_priority, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_priority, tvb, tlv_offset, length, FALSE); + break; + case CST_PKT_CLASS_RULE_RANGE_MASK: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_range_mask, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_tos_low, tvb, + tlv_offset, 1, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_tos_high, tvb, + tlv_offset + 1, 1, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_tos_mask, tvb, + tlv_offset + 2, 1, FALSE); + break; + case CST_PKT_CLASS_RULE_PROTOCOL: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_protocol, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_protocol, tvb, tlv_offset, length, FALSE); + break; + case CST_PKT_CLASS_RULE_SRC_IP: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_ip_masked_src_address, tvb, tlv_offset, length, FALSE); + if(ipv6) + { + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_src_ipv6, tvb, tlv_offset, 16, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_mask_ipv6, tvb, tlv_offset + 16, 16, FALSE); + } + else + { + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_src_ipv4, tvb, tlv_offset, 4, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_mask_ipv4, tvb, tlv_offset + 4, 4, FALSE); + } + break; + case CST_PKT_CLASS_RULE_DST_IP: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_ip_masked_dest_address, tvb, tlv_offset, length, FALSE); + if(ipv6) + { + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_dest_ipv6, tvb, tlv_offset, 16, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_mask_ipv6, tvb, tlv_offset + 16, 16, FALSE); + } + else + { + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_dest_ipv4, tvb, tlv_offset, 4, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_mask_ipv4, tvb, tlv_offset + 4, 4, FALSE); + } + break; + case CST_PKT_CLASS_RULE_SRCPORT_RANGE: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_prot_src_port_range, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_src_port_low, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_src_port_high, tvb, tlv_offset + 2, 2, FALSE); + break; + case CST_PKT_CLASS_RULE_DSTPORT_RANGE: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_prot_dest_port_range, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_dest_port_low, tvb, tlv_offset, 2, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_dest_port_high, tvb, tlv_offset + 2, 2, FALSE); + break; + case CST_PKT_CLASS_RULE_DST_MAC: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_dest_mac_address, tvb, tlv_offset, length, FALSE); + /* add TLV subtree */ + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_dest_mac, tvb, tlv_offset, 6, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_mask_mac, tvb, tlv_offset + 6, 6, FALSE); + break; + case CST_PKT_CLASS_RULE_SRC_MAC: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_src_mac_address, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_src_mac, tvb, tlv_offset, 6, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_mask_mac, tvb, tlv_offset + 6, 6, FALSE); + break; + case CST_PKT_CLASS_RULE_ETHERTYPE: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_ethertype, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_etype, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_eprot1, tvb, tlv_offset + 1, 1, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_eprot2, tvb, tlv_offset + 2, 1, FALSE); + break; + case CST_PKT_CLASS_RULE_USER_PRIORITY: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_user_priority, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_pri_low, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_pri_high, tvb, tlv_offset + 1, 1, FALSE); + break; + case CST_PKT_CLASS_RULE_VLAN_ID: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_vlan_id, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_vlan_id1, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_vlan_id2, tvb, tlv_offset + 1, 1, FALSE); + break; + case CST_PKT_CLASS_RULE_PHSI: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_phsi, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_phsi, tvb, tlv_offset, length, FALSE); + break; + case CST_PKT_CLASS_RULE_INDEX: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_index, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_index, tvb, tlv_offset, length, FALSE); + break; + case CST_PKT_CLASS_RULE_IPv6_FLOW_LABEL: +//??? if(ipv6) + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_ipv6_flow_label, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_ipv6_flow_label, tvb, tlv_offset, length, FALSE); + break; + case CST_PKT_CLASS_RULE_VENDOR_SPEC: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_vendor_spec, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_vendor_spec, tvb, tlv_offset, length, FALSE); + break; + case CST_CLASSIFIER_ACTION_RULE: + /* add TLV subtree */ + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_pkt_class_rule_classifier_action_rule, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_classifier_action_rule_bit0, tvb, tlv_offset, 1, FALSE); + proto_tree_add_item(ti_tree, hf_cst_pkt_class_rule_classifier_action_rule_bit1, tvb, tlv_offset, 1, FALSE); + break; + case CST_PKT_CLASS_RULE_LARGE_CONTEXT_ID: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_large_context_id, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_large_context_id, tvb, tlv_offset, length, FALSE); + break; + case CST_PKT_CLASS_RULE_SHORT_FORMAT_CONTEXT_ID: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_short_format_context_id, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_short_format_context_id, tvb, tlv_offset, length, FALSE); + break; + default: + break; + } /* end of switch */ + tlv_offset += length; + } /* end of while loop */ + break; + } + case CST_PHS_DSC_ACTION: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, hf_cst_phs_dsc_action, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_cst_phs_dsc_action, tvb, offset, tlv_len, FALSE); + break; + case CST_PHS_RULE: + { + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, csper_tree, hf_cst_phs_rule, tvb, offset, tlv_len, FALSE); + tlv_offset = offset; + while(tlv_offset < (tlv_len + offset)) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, tlv_offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + length = get_tlv_length(&tlv_info); + if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "PHS n Rule TLV error"); + } + proto_tree_add_item(tlv_tree, hf_cst_invalid_tlv, tvb, offset, (tlv_len - tlv_offset), FALSE); + break; + } +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(csper_tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len+2+get_tlv_size_of_length(&tlv_info)), "PHS Rule TLV Type: %u (%u bytes, offset=%u, tlv_len=%u)", tlv_type, length, offset, tlv_len); +#endif + /* update the offset */ + tlv_offset += get_tlv_value_offset(&tlv_info); + switch (tlv_type) + { + case CST_PHS_PHSI: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_phs_phsi, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_phs_phsi, tvb, tlv_offset, length, FALSE); + break; + case CST_PHS_PHSF: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_phs_phsf, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_phs_phsf, tvb, tlv_offset, length, FALSE); + break; + case CST_PHS_PHSM: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_phs_phsm, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_phs_phsm, tvb, tlv_offset, length, FALSE); + break; + case CST_PHS_PHSS: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_phs_phss, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_phs_phss, tvb, tlv_offset, length, FALSE); + break; + case CST_PHS_PHSV: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_phs_phsv, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_phs_phsv, tvb, tlv_offset, length, FALSE); + break; + case CST_PHS_VENDOR_SPEC: + ti_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tlv_tree, hf_cst_phs_vendor_spec, tvb, tlv_offset, length, FALSE); + proto_tree_add_item(ti_tree, hf_cst_phs_vendor_spec, tvb, tlv_offset, length, FALSE); + break; + } + tlv_offset += length; + } + break; + } + default: + /* display the unknown csper type in hex */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_cst_encoding_rules, tree, hf_csper_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_csper_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } /* end of switch */ + } /* end of if */ + offset += tlv_len; + } /* end of while loop */ +} + +/**************************************************************/ +/* wimax_service_flow_encodings_decoder() */ +/* decode and display the WiMax Service Flow Encodings */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure*/ +/**************************************************************/ +void wimax_service_flow_encodings_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset, i; + guint tvb_len, tlv_len, tlv_value_offset, tlv_value; + gint tlv_type; + guint value; + proto_item *tlv_item = NULL; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); +#ifdef DEBUG /* for debug only */ + /* display dissector information */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, 0, tvb_len, "WiMax Service Flow Encodings (%u bytes)", tvb_len); +#endif + /* process WiMax Service Flow Encodings */ + offset = 0; + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Service Flow Encodings"); + } + return; + } + while(offset < tvb_len) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Service Flow Encodings TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "Service Flow Encodings TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len, offset, tvb_len); +#endif + /* update the offset */ + offset += tlv_value_offset; + /* parse the Service Flow Encodings TLV */ + switch (tlv_type) + { + case SFE_SF_ID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_sf_id, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_sf_id, tvb, offset, tlv_len, FALSE); + break; + case SFE_CID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_cid, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_cid, tvb, offset, tlv_len, FALSE); + break; + case SFE_SERVICE_CLASS_NAME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_service_class_name, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_service_class_name, tvb, offset, tlv_len, FALSE); + break; + case SFE_MBS_SERVICE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_mbs_service, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_mbs_service, tvb, offset, tlv_len, FALSE); + break; + case SFE_QOS_PARAMS_SET: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_qos_params_set, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_set_provisioned, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_set_admitted, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_set_active, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_set_rsvd, tvb, offset, 1, FALSE); + break; + case SFE_TRAFFIC_PRIORITY: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_traffic_priority, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_traffic_priority, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " (allowed values are 0-7)"); + break; + case SFE_MAX_STR: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_max_str, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_max_str, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " bps"); + break; + case SFE_MAX_TRAFFIC_BURST: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_max_traffic_burst, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_max_traffic_burst, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " bytes"); + break; + case SFE_MIN_RTR: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_min_rtr, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_min_rtr, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " bps"); + break; + case SFE_RESERVED_10: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_reserved_10, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_reserved_10, tvb, offset, tlv_len, FALSE); + break; + case SFE_UL_SCHEDULING: + /* TODO: Find a way to get the correct service type from the TLV */ + tlv_value = tvb_get_guint8(tvb, offset); + set_service_type( tlv_value ); + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_ul_grant_scheduling, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_ul_grant_scheduling, tvb, offset, tlv_len, FALSE); + break; + case SFE_TX_POLICY: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_req_tx_policy, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_policy_broadcast_bwr, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_policy_multicast_bwr, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_policy_piggyback, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_policy_fragment, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_policy_headers, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_policy_packing, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_policy_crc, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_policy_rsvd1, tvb, offset, 1, FALSE); + break; + case SFE_TOLERATED_JITTER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_jitter, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_jitter, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " ms"); + break; + case SFE_MAX_LATENCY: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_max_latency, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_max_latency, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " ms"); + break; + case SFE_FIXED_LEN_SDU: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_fixed_len_sdu, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_fixed_len_sdu, tvb, offset, tlv_len, FALSE); + break; + case SFE_SDU_SIZE: + /* save the SDU size */ + mac_sdu_length = tvb_get_guint8(tvb, offset); + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_sdu_size, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_sdu_size, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " bytes"); + break; + case SFE_TARGET_SAID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_target_said, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_target_said, tvb, offset, tlv_len, FALSE); + break; + case SFE_ARQ_ENABLE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_enable, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_enable, tvb, offset, tlv_len, FALSE); + break; + case SFE_ARQ_WINDOW_SIZE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_window_size, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_window_size, tvb, offset, tlv_len, FALSE); + break; + case SFE_ARQ_TRANSMITTER_DELAY: + if (include_cor2_changes) + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_transmitter_delay_cor2, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_transmitter_delay_cor2, tvb, offset, tlv_len, FALSE); + } + else + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_transmitter_delay, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_transmitter_delay, tvb, offset, tlv_len, FALSE); + } + break; + case SFE_ARQ_RECEIVER_DELAY: + if (include_cor2_changes) + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_receiver_delay_cor2, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_receiver_delay_cor2, tvb, offset, tlv_len, FALSE); + } + else + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_receiver_delay, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_receiver_delay, tvb, offset, tlv_len, FALSE); + } + break; + case SFE_ARQ_BLOCK_LIFETIME: + if (include_cor2_changes) + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_block_lifetime_cor2, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_block_lifetime_cor2, tvb, offset, tlv_len, FALSE); + } + else + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_block_lifetime, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_block_lifetime, tvb, offset, tlv_len, FALSE); + } + break; + case SFE_ARQ_SYNC_LOSS_TIMEOUT: + if (include_cor2_changes) + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_sync_loss_timeout_cor2, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_sync_loss_timeout_cor2, tvb, offset, tlv_len, FALSE); + } + else + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_sync_loss_timeout, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_sync_loss_timeout, tvb, offset, tlv_len, FALSE); + } + break; + case SFE_ARQ_DELIVER_IN_ORDER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_deliver_in_order, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_deliver_in_order, tvb, offset, tlv_len, FALSE); + break; + case SFE_ARQ_RX_PURGE_TIMEOUT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_rx_purge_timeout, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_rx_purge_timeout, tvb, offset, tlv_len, FALSE); + break; + case SFE_ARQ_BLOCK_SIZE: + if (include_cor2_changes) + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_block_size_cor2, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_arq_block_size_cor2, tvb, offset, tlv_len, FALSE); + /* add TLV subtree */ + tlv_tree = proto_item_add_subtree(tlv_item, ett_wimax_service_flow_encodings); + value = tvb_get_guint8(tvb, offset); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_arq_min_block_size, tvb, offset, 1, FALSE); + /* Size is 2^((value & 0x0F) + 4)) */ + proto_item_append_text(tlv_item, " ( %d bytes )", 0x10 << (value & 0x0F)); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_arq_max_block_size, tvb, offset, 1, FALSE); + if (value & 0xF0) + /* Size is 2^(((value & 0xF0) >> 4) + 4)) */ + proto_item_append_text(tlv_item, " ( %d bytes )", 0x10 << ((value & 0xF0) >> 4)); + } + else + { + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_arq_block_size, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_arq_block_size, tvb, offset, tlv_len, FALSE); + } + break; + case SFE_CS_SPECIFICATION: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_cs_specification, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_cs_specification, tvb, offset, tlv_len, FALSE); + break; + case SFE_TYPE_OF_DATA_DELIVERY_SERVICES: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_type_of_data_delivery_services, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_type_of_data_delivery_services, tvb, offset, tlv_len, FALSE); + break; + case SFE_SDU_INTER_ARRIVAL_INTERVAL: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_sdu_inter_arrival_interval, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_sdu_inter_arrival_interval, tvb, offset, tlv_len, FALSE); + break; + case SFE_TIME_BASE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_time_base, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_time_base, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " ms"); + break; + case SFE_PAGING_PREFERENCE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_paging_preference, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_paging_preference, tvb, offset, tlv_len, FALSE); + break; + case SFE_MBS_ZONE_IDENTIFIER_ASSIGNMENT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_mbs_zone_identifier_assignment, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_mbs_zone_identifier_assignment, tvb, offset, tlv_len, FALSE); + break; + case SFE_RESERVED_34: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_reserved_34, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_reserved_34, tvb, offset, tlv_len, FALSE); + break; + case SFE_GLOBAL_SERVICE_CLASS_NAME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_global_service_class_name, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_global_service_class_name, tvb, offset, tlv_len, FALSE); + break; +/* 36 reserved */ + case SFE_RESERVED_36: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_reserved_36, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_reserved_36, tvb, offset, tlv_len, FALSE); + break; + + case SFE_SN_FEEDBACK_ENABLED: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_sn_feedback_enabled, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_sn_feedback_enabled, tvb, offset, tlv_len, FALSE); + break; + case SFE_FSN_SIZE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_fsn_size, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_fsn_size, tvb, offset, tlv_len, FALSE); + break; + case SFE_CID_ALLOCATION_FOR_ACTIVE_BS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_cid_alloc_for_active_bs_cid, tvb, offset, tlv_len, FALSE); + for(i = 0; i < tlv_len; i+=2) + proto_tree_add_item(tlv_tree, hf_sfe_cid_alloc_for_active_bs_cid, tvb, (offset+i), 2, FALSE); + break; + case SFE_UNSOLICITED_GRANT_INTERVAL: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_unsolicited_grant_interval, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_unsolicited_grant_interval, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " ms"); + break; + case SFE_UNSOLOCITED_POLLING_INTERVAL: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_unsolicited_polling_interval, tvb, offset, tlv_len, FALSE); + tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_unsolicited_polling_interval, tvb, offset, tlv_len, FALSE); + proto_item_append_text(tlv_item, " ms"); + break; + case SFE_PDU_SN_EXT_SUBHEADER_HARQ_REORDER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_pdu_sn_ext_subheader_reorder, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_pdu_sn_ext_subheader_reorder, tvb, offset, tlv_len, FALSE); + break; + case SFE_MBS_CONTENTS_ID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_mbs_contents_ids, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_mbs_contents_ids, tvb, offset, tlv_len, FALSE); + for(i = 0; i < tlv_len; i+=2) + proto_tree_add_item(tlv_tree, hf_sfe_mbs_contents_ids_id, tvb, (offset+i), 2, FALSE); + break; + case SFE_HARQ_SERVICE_FLOWS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_harq_service_flows, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_harq_service_flows, tvb, offset, tlv_len, FALSE); + break; + case SFE_AUTHORIZATION_TOKEN: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_authorization_token, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_sfe_authorization_token, tvb, offset, tlv_len, FALSE); + break; + case SFE_HARQ_CHANNEL_MAPPING: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_harq_channel_mapping_index, tvb, offset, tlv_len, FALSE); + for(i = 0; i < tlv_len; i++) + proto_tree_add_item(tlv_tree, hf_sfe_harq_channel_mapping_index, tvb, (offset+i), 1, FALSE); + break; +/* 99 - 111 CS parameter encodings */ + case SFE_CSPER_ATM: + case SFE_CSPER_PACKET_IPV4: + case SFE_CSPER_PACKET_IPV6: + case SFE_CSPER_PACKET_802_3: + case SFE_CSPER_PACKET_802_1Q: + case SFE_CSPER_PACKET_IPV4_802_3: + case SFE_CSPER_PACKET_IPV6_802_3: + case SFE_CSPER_PACKET_IPV4_802_1Q: + case SFE_CSPER_PACKET_IPV6_802_1Q: + case SFE_CSPER_PACKET_IP_ROCH_COMPRESSION: + case SFE_CSPER_PACKET_IP_ECRTP_COMPRESSION: + case SFE_CSPER_PACKET_IP_802_3_ROCH_COMPRESSION: + case SFE_CSPER_PACKET_IP_802_3_ECRTP_COMPRESSION: + /* call CS Parameter Encoding Rules handling function */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "CS Parameter Encoding Rules (%u byte(s))", tlv_len); + wimax_convengence_service_parameter_encoding_rules_decoder(tlv_type, tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_unknown_type, tvb, offset, tlv_len, FALSE); + /* display the unknown sfe type in hex */ + proto_tree_add_item(tlv_tree, hf_sfe_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } /* end of switch */ + offset += tlv_len; + } /* end of while loop */ +} + +/**************************************************************/ +/* wimax_hmac_tuple_decoder() */ +/* decode and display the WiMax HMAC Tuple (Table 348) */ +/* parameter: */ +/* tree - pointer of Wireshark display tree */ +/* tvb - pointer of the tvb which contains the HMAC Tuple */ +/* offset - the HMAC Tuple offset in the tvb */ +/* length - length of the HMAC Tuple */ +/**************************************************************/ +void wimax_hmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length) +{ + guint hmac_offset; + proto_item *hmac_item = NULL; + proto_tree *hmac_tree = NULL; + + /* display decoder info (length should be 21 bytes) */ + hmac_item = proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, length, "HMAC Tuple (%u bytes)", length); + /* add HMAC subtree */ + hmac_tree = proto_item_add_subtree(hmac_item, ett_wimax_hmac_tuple); + /* init the local offset */ + hmac_offset = offset; + /* decode and display HMAC Tuple */ + proto_tree_add_item(hmac_tree, hf_xmac_tuple_rsvd, tvb, hmac_offset, 1, FALSE); + proto_tree_add_item(hmac_tree, hf_xmac_tuple_key_seq_num, tvb, hmac_offset, 1, FALSE); + hmac_offset++; + proto_tree_add_item(hmac_tree, hf_hmac_tuple_hmac_digest, tvb, hmac_offset, (length-1), FALSE); +} + +/**************************************************************/ +/* wimax_cmac_tuple_decoder() */ +/* decode and display the WiMax CMAC Tuple (Table 348b) */ +/* parameter: */ +/* tree - pointer of Wireshark display tree */ +/* tvb - pointer of the tvb which contains the CMAC Tuple */ +/* offset - the CMAC Tuple offset in the tvb */ +/* length - length of the CMAC Tuple */ +/**************************************************************/ +void wimax_cmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length) +{ + guint cmac_offset; + proto_item *cmac_item = NULL; + proto_tree *cmac_tree = NULL; + + /* display decoder info (length should be 13 or 19 bytes) */ + cmac_item = proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, length, "CMAC Tuple (%u bytes)", length); + /* add CMAC subtree */ + cmac_tree = proto_item_add_subtree(cmac_item, ett_wimax_cmac_tuple); + /* init the local offset */ + cmac_offset = offset; + /* decode and display CMAC Tuple */ + proto_tree_add_item(cmac_tree, hf_xmac_tuple_rsvd, tvb, cmac_offset, 1, FALSE); + proto_tree_add_item(cmac_tree, hf_xmac_tuple_key_seq_num, tvb, cmac_offset, 1, FALSE); + cmac_offset++; + if(length > 13) + { + proto_tree_add_item(cmac_tree, hf_cmac_tuple_bsid, tvb, cmac_offset, 6, FALSE); + cmac_offset += 6; + } + proto_tree_add_item(cmac_tree, hf_packet_number_counter, tvb, cmac_offset, 4, FALSE); + cmac_offset += 4; + proto_tree_add_item(cmac_tree, hf_cmac_tuple_cmac_value, tvb, cmac_offset, 8, FALSE); +} + +/******************************************************************/ +/* wimax_short_hmac_tuple_decoder() */ +/* decode and display the WiMax Short-HMAC Tuple (Table 348d) */ +/* parameter: */ +/* tree - pointer of Wireshark display tree */ +/* tvb - pointer of the tvb which contains the Short-HMAC Tuple */ +/* offset - the Short-HMAC Tuple offset in the tvb */ +/* length - length of the Short-HMAC Tuple */ +/******************************************************************/ +void wimax_short_hmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length) +{ + guint hmac_offset; + proto_item *hmac_item = NULL; + proto_tree *hmac_tree = NULL; + + /* display decoder info (length should be at least 13 bytes ???) */ + hmac_item = proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, length, "Short-HMAC Tuple (%u bytes)", length); + /* add Short-HMAC subtree */ + hmac_tree = proto_item_add_subtree(hmac_item, ett_wimax_short_hmac_tuple); + /* init the local offset */ + hmac_offset = offset; + /* decode and display Short-HMAC Tuple */ + proto_tree_add_item(hmac_tree, hf_xmac_tuple_rsvd, tvb, hmac_offset, 1, FALSE); + proto_tree_add_item(hmac_tree, hf_xmac_tuple_key_seq_num, tvb, hmac_offset, 1, FALSE); + hmac_offset++; + proto_tree_add_item(hmac_tree, hf_packet_number_counter, tvb, hmac_offset, 4, FALSE); + hmac_offset += 4; + proto_tree_add_item(hmac_tree, hf_hmac_tuple_hmac_digest, tvb, hmac_offset, length - offset - 3, FALSE); +} + +/******************************************************************/ +/* wimax_security_negotiation_parameters_decoder() */ +/* decode and display the WiMax Security Negotiation Parameters */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +void wimax_security_negotiation_parameters_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Security Negotiation Parameters"); + } + return; + } + /* process Security Negotiation Parameter TLVs */ + for(offset = 0; offset < tvb_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Security Negotiation Params TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "Security Negotiation Parameters Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* update the offset */ + offset += tlv_value_offset; + /* parse Security Negotiation Parameters TLVs */ + switch (tlv_type) + { + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_PKM_VERSION_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_security_negotiation_parameters, tree, hf_snp_pkm_version_support, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_pkm_version_support_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_pkm_version_support_bit1, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_pkm_version_support_reserved, tvb, offset, 1, FALSE); + break; + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_AUTHORIZATION_POLICY_SUPPORT: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_security_negotiation_parameters, tree, hf_snp_pkm_version_support, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_auth_policy_support_bit0, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_auth_policy_support_bit1, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_auth_policy_support_bit2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_auth_policy_support_bit3, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_auth_policy_support_bit4, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_auth_policy_support_bit5, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_auth_policy_support_bit6, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_auth_policy_support_bit7, tvb, offset, 1, FALSE); + break; + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_MESSAGE_AUTHENTICATION_CODE: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_security_negotiation_parameters, tree, hf_snp_mac_mode, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_bit0, tvb, offset, 1, FALSE); + if (include_cor2_changes) + { + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_bit1_rsvd, tvb, offset, 1, FALSE); + } + else + { + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_bit1, tvb, offset, 1, FALSE); + } + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_bit2, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_bit3, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_bit4, tvb, offset, 1, FALSE); + if (include_cor2_changes) + { + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_bit5, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_reserved1, tvb, offset, 1, FALSE); + } + else + { + proto_tree_add_item(tlv_tree, hf_snp_mac_mode_reserved, tvb, offset, 1, FALSE); + } + break; + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_PN_WINDOW_SIZE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_security_negotiation_parameters, tree, hf_snp_pn_window_size, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_pn_window_size, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_PKM_FLOW_CONTROL: + proto_tree_add_item(tlv_tree, hf_snp_max_conc_transactions, tvb, offset, 1, FALSE); + break; + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETER_SUB_MAX_SUPPT_SECURITY_ASSNS: + proto_tree_add_item(tlv_tree, hf_snp_max_suppt_sec_assns, tvb, offset, 1, FALSE); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_security_negotiation_parameters, tree, hf_snp_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_snp_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } +} + +/******************************************************************/ +/* wimax_cryptographic_suite_list_decoder() */ +/* decode and display the WiMax Cryptographic Suite List */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +void wimax_cryptographic_suite_list_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Crypto Suite List"); + } + return; + } + /* process Cryptographic Suite List (11.9.15) */ + for(offset = 0; offset < tvb_len; ) + { /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Crypto Suite List TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "Cryptographic Suite List TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* parse Cryptographic Suite List */ + switch (tlv_type) + { + case PKM_ATTR_CRYPTO_SUITE: + /* add subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_cryptographic_suite_list_decoder, tree, hf_pkm_msg_crypto_suite, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_msb, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_middle, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_lsb, tvb, offset, 1, FALSE); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_cryptographic_suite_list_decoder, tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ +} + +/******************************************************************/ +/* wimax_pkm_tlv_encoded_attributes_decoder() */ +/* decode and display the WiMax PKM message TLV Encoded Attributes*/ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +void wimax_pkm_tlv_encoded_attributes_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid PKM TLV"); + } + return; + } + /* process PKM message TLV Encoded Attributes (11.9) */ + for(offset = 0; offset < tvb_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "PKM TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "PKM TLV Encoded Attributes TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* parse PKM TLV Encoded Attributes (table 370) */ + switch (tlv_type) + { + case PKM_ATTR_DISPLAY_STRING: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_display, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_display, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_AUTH_KEY: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_auth_key, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_auth_key, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_TEK: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_tek, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_tek, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_KEY_LIFE_TIME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_key_life_time, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_key_life_time, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_KEY_SEQ_NUM: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_key_seq_num, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_key_seq_num, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_HMAC_DIGEST: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_hmac_digest, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_hmac_digest, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SAID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_said, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_said, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_TEK_PARAM: + tlv_tree = add_protocol_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "TEK Parameters (%u bytes)", tlv_len); + /* add subtree */ + wimax_tek_parameters_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case PKM_ATTR_CBC_IV: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_cbc_iv, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_cbc_iv, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_ERROR_CODE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_error_code, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_error_code, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_CA_CERTIFICATE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_ca_certificate, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_ca_certificate, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SS_CERTIFICATE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_ss_certificate, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_ss_certificate, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SECURITY_CAPABILITIES: + tlv_tree = add_protocol_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Security Capabilities (%u bytes)", tlv_len); + /* add subtree */ + wimax_security_capabilities_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case PKM_ATTR_CRYPTO_SUITE: + /* add subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_crypto_suite, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_msb, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_middle, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_lsb, tvb, offset, 1, FALSE); + break; + case PKM_ATTR_CRYPTO_LIST: + tlv_tree = add_protocol_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Cryptographic-Suite List (%u bytes)", tlv_len); + /* add subtree */ + wimax_cryptographic_suite_list_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; +#if 0 /* rserved by IEE 802.16E */ + case PKM_ATTR_VERSION: + proto_tree_add_item(tree, hf_pkm_msg_version, tvb, offset, tlv_len, FALSE); + break; +#endif + case PKM_ATTR_SA_DESCRIPTOR: + tlv_tree = add_protocol_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "SA-Descriptor (%u bytes)", tlv_len); + /* add subtree */ + wimax_sa_descriptor_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case PKM_ATTR_SA_TYPE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_sa_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_sa_type, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SECURITY_NEGOTIATION_PARAMETERS: + tlv_tree = add_protocol_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Security Negotiation Parameters (%u bytes)", tlv_len); + /* add subtree */ + wimax_security_negotiation_parameters_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case PKM_ATTR_PKM_CONFIG_SETTINGS: + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "PKM Configuration Settings (%u bytes)", tlv_len); + wimax_pkm_configuration_settings_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case PKM_ATTR_PKM_EAP_PAYLOAD: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_eap_payload, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_eap_payload, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_PKM_NONCE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_nonce, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_nonce, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_AUTH_RESULT_CODE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_auth_result_code, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_auth_result_code, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SA_SERVICE_TYPE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_sa_service_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_sa_service_type, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_FRAME_NUMBER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_frame_number, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_frame_number, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SS_RANDOM: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_ss_random, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_ss_random, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_BS_RANDOM: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_bs_random, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_bs_random, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_PRE_PAK: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_pre_pak, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_pre_pak, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_BS_CERTIFICATE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_bs_certificate, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_bs_certificate, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SIG_BS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_sig_bs, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_sig_bs, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_MS_MAC_ADDRESS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_ms_mac_address, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_ms_mac_address, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_CMAC_DIGEST: + /* add TLV subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_cmac_digest, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_cmac_digest_pn, tvb, offset, 4, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_cmac_digest_value, tvb, (offset + 4), 8, FALSE); + break; + case PKM_ATTR_KEY_PUSH_MODES: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_push_modes, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_push_modes, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_KEY_PUSH_COUNTER: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_key_push_counter, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_key_push_counter, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_GKEK: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_gkek, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_gkek, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SIG_SS: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_sig_ss, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_sig_ss, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_AKID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_akid, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_akid, tvb, offset, tlv_len, FALSE); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ +} + +/******************************************************************/ +/* wimax_tek_parameters_decoder() */ +/* decode and display the WiMax TEK Parameters subattributes */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +void wimax_tek_parameters_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid TEK Params"); + } + return; + } + /* process PKM Message TEK Parameters (11.9.8) */ + for(offset = 0; offset < tvb_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "TEK Param TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "TEK Parameters Subattributes TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* parse TEK Parameters Subattributes (table 372) */ + switch (tlv_type) + { + case PKM_ATTR_TEK: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_tek, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_tek, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_KEY_LIFE_TIME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_key_life_time, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_key_life_time, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_KEY_SEQ_NUM: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_key_seq_num, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_key_seq_num, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_CBC_IV: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_attr_cbc_iv, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_cbc_iv, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_ASSOCIATED_GKEK_SEQ_NUM: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_attr_associated_gkek_seq_number, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_associated_gkek_seq_number, tvb, offset, tlv_len, FALSE); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ +} + +/******************************************************************/ +/* wimax_pkm_configuration_settings_decoder() */ +/* decode and display the WiMax PKM Configuration Settings */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +void wimax_pkm_configuration_settings_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + proto_tree *tlv_tree; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid PKM Config Settings"); + } + return; + } + /* process PKM Configuration Settings (11.9.19) */ + for(offset = 0; offset < tvb_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "PKM Config Settings TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "PKM Configuration Settings TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* parse PKM Configuration Settings (11.9.19.1 - 11.9.19.7 */ + switch (tlv_type) + { + case PKM_ATTR_PKM_CONFIG_SETTINGS_AUTHORIZE_WAIT_TIMEOUT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_config_settings_authorize_waitout, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_config_settings_authorize_waitout, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_PKM_CONFIG_SETTINGS_REAUTHORIZE_WAIT_TIMEOUT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_config_settings_reauthorize_waitout, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_config_settings_reauthorize_waitout, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_PKM_CONFIG_SETTINGS_AUTHORIZATION_GRACE_TIME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_config_settings_grace_time, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_config_settings_grace_time, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_PKM_CONFIG_SETTINGS_OPERATIONAL_WAIT_TIMEOUT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_config_settings_operational_waittime, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_config_settings_operational_waittime, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_PKM_CONFIG_SETTINGS_REKEY_WAIT_TIMEOUT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_config_settings_rekey_wait_timeout, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_config_settings_rekey_wait_timeout, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_PKM_CONFIG_SETTINGS_TEK_GRACE_TIME: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_config_settings_tek_grace_time, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_config_settings_tek_grace_time, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_PKM_CONFIG_SETTINGS_AUTHORIZE_REJECT_WAIT_TIMEOUT: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_config_settings_authorize_reject_wait_timeout, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_config_settings_authorize_reject_wait_timeout, tvb, offset, tlv_len, FALSE); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_pkm_tlv_encoded_attributes_decoder, tree, hf_pkm_config_settings_authorize_reject_wait_timeout, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ +} + +/******************************************************************/ +/* wimax_sa_descriptor_decoder() */ +/* decode and display the WiMax PKM message SA-Descriptor */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +void wimax_sa_descriptor_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid SA-Descriptor"); + } + return; + } + /* process SA-Descriptor (11.9.17) */ + for(offset = 0; offset < tvb_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "SA-Descriptor TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "SA-Descriptor TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* parse SA-Descriptor (table 380) */ + switch (tlv_type) + { + case PKM_ATTR_SAID: + tlv_tree = add_tlv_subtree(&tlv_info, ett_sa_descriptor_decoder, tree, hf_pkm_msg_attr_said, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_attr_said, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SA_TYPE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_sa_descriptor_decoder, tree, hf_pkm_sa_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_sa_type, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_SA_SERVICE_TYPE: + tlv_tree = add_tlv_subtree(&tlv_info, ett_sa_descriptor_decoder, tree, hf_pkm_attr_sa_service_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_attr_sa_service_type, tvb, offset, tlv_len, FALSE); + break; + case PKM_ATTR_CRYPTO_SUITE: + /* add subtree */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_sa_descriptor_decoder, tree, hf_pkm_msg_crypto_suite, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_msb, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_middle, tvb, offset, 1, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_crypto_suite_lsb, tvb, offset, 1, FALSE); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_sa_descriptor_decoder, tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ +} + +/******************************************************************/ +/* wimax_security_capabilities_decoder() */ +/* decode and display the WiMax Security Capabilities */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +void wimax_security_capabilities_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Security Capabilities"); + } + return; + } + /* process Security Capabilities (11.9.13) */ + for(offset = 0; offset < tvb_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Security Capabilities TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "Security Capabilities TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* parse Security Capabilities (table 374) */ + switch (tlv_type) + { + case PKM_ATTR_CRYPTO_LIST: + tlv_tree = add_protocol_subtree(&tlv_info, ett_security_capabilities_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Cryptographic-Suite List (%u bytes)", tlv_len); + /* add subtree */ + wimax_cryptographic_suite_list_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + default: + tlv_tree = add_tlv_subtree(&tlv_info, ett_security_capabilities_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_pkm_msg_unknown_type, tvb, offset, tlv_len, FALSE); + break; + } + offset += tlv_len; + } /* end of TLV process while loop */ +} + +/******************************************************************/ +/* wimax_vendor_specific_information_decoder() */ +/* decode and display the WiMax Vendor-Specific Information */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +void wimax_vendor_specific_information_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *tlv_tree = NULL; + guint offset; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + tlv_info_t tlv_info; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Vendor Specific Info"); + } + proto_tree_add_text(tree, tvb, 0, tvb_len, "Invalid TLV info"); + return; + } + /* process Vendor Specific Information (11.1.6) */ + for(offset = 0; offset < tvb_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Vendor Specific Info TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "Vendor Specific Info TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* parse Vendor Specific Information (11.1.6) */ + if(tlv_type == VENDOR_ID_ENCODING) + { + /* decode and display the Vendor ID Encoding */ + tlv_tree = add_tlv_subtree(&tlv_info, ett_vendor_id_encoding_decoder, tree, hf_common_tlv_vendor_id, tvb, (offset + tlv_value_offset), tlv_len, FALSE); + proto_tree_add_item(tlv_tree, hf_common_tlv_vendor_id, tvb, (offset + tlv_value_offset), tlv_len, FALSE); + } + else + { + /* decode and display the Vendor Specific Info */ + proto_tree_add_item(tree, hf_common_tlv_vendor_specific_type, tvb, offset, 1, FALSE); + if(get_tlv_length_type(&tlv_info) == 0) + { /* single byte TLV length */ + proto_tree_add_item(tree, hf_common_tlv_vendor_specific_length, tvb, (offset + 1), 1, FALSE); + } + else + { /* multiple bytes TLV length */ + /* display the length of the TLV length with MSB */ + proto_tree_add_item(tree, hf_common_tlv_vendor_specific_length_size, tvb, (offset + 1), 1, FALSE); + if(get_tlv_size_of_length(&tlv_info)) + { /* display the multiple byte TLV length */ + proto_tree_add_text(tree, tvb, (offset + 2), get_tlv_size_of_length(&tlv_info), "Vendor Specific Length: %u", get_tlv_size_of_length(&tlv_info)); + } + else + { /* length = 0 */ + continue; + } + } + proto_tree_add_item(tree, hf_common_tlv_vendor_specific_value, tvb, (offset + tlv_value_offset), tlv_len, FALSE); + } + /* update the offset */ + offset += tlv_value_offset + tlv_len; + } +} + +/******************************************************************/ +/* wimax_common_tlv_encoding_decoder() */ +/* decode and display the WiMax Common TLV Encoding (Table 346) */ +/* parameter: */ +/* tvb - pointer of the tvb of service flow encodings */ +/* tree - pointer of Wireshark display tree */ +/* pinfo - pointer of Wireshark packet information structure */ +/******************************************************************/ +guint wimax_common_tlv_encoding_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint offset, value; + guint tvb_len, tlv_len, tlv_value_offset; + gint tlv_type; + proto_tree *tlv_tree = NULL; + tlv_info_t tlv_info; + gfloat current_power; + + /* get the tvb length */ + tvb_len = tvb_length(tvb); + /* do nothing if the TLV fields is not exist */ + if(!tvb_len) + return 0; + /* report error if the packet size is less than 2 bytes (type+length) */ + if(tvb_len < 2) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Common TLV encoding"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, 0, tvb_len, FALSE); + return 0; + } + /* process Common TLV Encoding (11.1) */ + for(offset = 0; offset < tvb_len; ) + { + /* get the TLV information */ + init_tlv_info(&tlv_info, tvb, offset); + /* get the TLV type */ + tlv_type = get_tlv_type(&tlv_info); + /* get the TLV length */ + tlv_len = get_tlv_length(&tlv_info); + if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) + { /* invalid tlv info */ + if(pinfo->cinfo) + { + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Common TLV encoding TLV error"); + } + proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); + break; + } + /* get the TLV value offset */ + tlv_value_offset = get_tlv_value_offset(&tlv_info); +#ifdef DEBUG /* for debug only */ + proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "Common TLV Encoding TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len); +#endif + /* update the offset for the TLV value */ + offset += tlv_value_offset; + /* parse Common TLV Encoding (table 346) */ + switch (tlv_type) + { + case VENDOR_SPECIFIC_INFO: + /* display Vendor-Specific Information */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Vendor-Specific Information (%u bytes)", tlv_len); + /* decode and display the Vendor-Specific Information */ + wimax_vendor_specific_information_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case VENDOR_ID_ENCODING: + /* display Vendor ID Encoding */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Vendor ID Encoding (%u bytes)", tlv_len); + /* decode and display the Vendor ID Encoding */ + proto_tree_add_item(tlv_tree, hf_common_tlv_vendor_id, tvb, offset, tlv_len, FALSE); + break; + case DSx_UPLINK_FLOW: + /* display Uplink Service Flow Encodings info */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_ul_service_flow_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Uplink Service Flow Encodings (%u bytes)", tlv_len); + /* decode and display the UL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case DSx_DOWNLINK_FLOW: + /* display Downlink Service Flow Encodings info */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_dl_service_flow_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Downlink Service Flow Encodings (%u bytes)", tlv_len); + /* decode and display the DL Service Flow Encodings */ + wimax_service_flow_encodings_decoder(tvb_new_subset(tvb,offset, tlv_len, tlv_len), pinfo, tlv_tree); + break; + case CURRENT_TX_POWER: + tlv_tree = add_protocol_subtree(&tlv_info, ett_dl_service_flow_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Current Transmitted Power (%u byte(s))", tlv_len); + value = tvb_get_guint8(tvb, offset); + current_power = (gfloat)(value - 128) / 2; + proto_tree_add_text(tlv_tree, tvb, offset, 1, "Current Transmitted Power: %.2f dBm (Value: 0x%x)", (gdouble)current_power, value); + break; + case MAC_VERSION_ENCODING: + /* display MAC Version Encoding */ + /* add subtree */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "MAC Version Encoding (%u byte)", tlv_len); + /* decode and display the MAC Version Encoding */ + proto_tree_add_item(tlv_tree, hf_common_tlv_mac_version, tvb, offset, tlv_len, FALSE); + break; + case HMAC_TUPLE: /* Table 348d */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + /* decode and display the HMAC Tuple */ + wimax_hmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); + break; + case CMAC_TUPLE: /* Table 348b */ + tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); + /* decode and display the CMAC Tuple */ + wimax_cmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); + break; + default: + /* Back to calling routine to finish decoding. */ + return offset - tlv_value_offset; /* Ret amount decoded. */ + break; + } + offset += tlv_len; + } /* end of while loop */ + return offset; +} diff --git a/plugins/wimax/wimax_utils.h b/plugins/wimax/wimax_utils.h new file mode 100644 index 0000000000..8ea7528fa6 --- /dev/null +++ b/plugins/wimax/wimax_utils.h @@ -0,0 +1,51 @@ +/* wimax_utils.h + * Header file of WiMax Utility Decoders + * + * Copyright (c) 2007 by Intel Corporation. + * + * Author: Lu Pan <lu.pan@intel.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1999 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#ifndef WIMAX_UTILS_H +#define WIMAX_UTILS_H + +#include <gmodule.h> +#include <epan/packet.h> + +extern void proto_register_wimax_utility_decoders(void); +extern void wimax_service_flow_encodings_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_convengence_service_parameter_encoding_rules_decoder(guint sfe_type, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_error_parameter_set_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_hmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length); +extern void wimax_cmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length); +extern void wimax_short_hmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length); +extern void wimax_security_negotiation_parameters_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_tek_parameters_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_pkm_configuration_settings_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_sa_descriptor_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_pkm_tlv_encoded_attributes_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_cryptographic_suite_list_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_security_capabilities_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern void wimax_vendor_specific_information_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +extern guint wimax_common_tlv_encoding_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +#endif /* WIMAX_UTILS_H */ |