2011-04-28 05:36:26 +00:00
/* packet-mux27010.c
2011-04-28 13:14:36 +00:00
* Dissects a variant of 3 GPP TS 27.010 multiplexing protocol
* Copyright 2011 , Hans - Christoph Schemmel < hans - christoph . schemmel [ AT ] cinterion . com >
*
* $ Id $
*
2011-04-28 14:59:31 +00:00
* Wireshark - Network traffic analyzer
* By Gerald Combs < gerald @ wireshark . org >
* Copyright 1998 Gerald Combs
*
2011-04-28 13:14:36 +00:00
* 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
2012-06-28 22:56:06 +00:00
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA .
2011-04-28 13:14:36 +00:00
*/
2011-04-28 05:36:26 +00:00
2012-09-20 02:03:38 +00:00
# include "config.h"
2011-04-28 05:36:26 +00:00
# include <glib.h>
# include <epan/packet.h>
# include <epan/reassemble.h>
2011-08-31 09:00:54 +00:00
# include <epan/crc8-tvb.h>
2011-05-02 14:27:48 +00:00
# include <expert.h>
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
# define PROTO_TAG_MUX27010 "MUX27010"
2011-04-28 05:36:26 +00:00
/*Extended Header*/
2011-04-28 14:48:39 +00:00
# define MUX27010_EXTENDED_HEADER_NOT_ENDED 0x01
2011-04-28 05:36:26 +00:00
/*Address flags*/
2011-04-28 14:38:29 +00:00
# define MUX27010_DLCI_ADDRESS_FLAG 0xFC
# define MUX27010_EA_ADDRESS_FLAG 0x01
# define MUX27010_CR_ADDRESS_FLAG 0x02
2011-04-28 05:36:26 +00:00
/*Control flags*/
2011-04-28 14:38:29 +00:00
# define MUX27010_FRAMETYPE_CONTROL_FLAG 0xEF
# define MUX27010_FRAMETYPE_CONTROL_FLAG_SABM 0x2F
# define MUX27010_FRAMETYPE_CONTROL_FLAG_UA 0x63
# define MUX27010_FRAMETYPE_CONTROL_FLAG_DM 0x0F
# define MUX27010_FRAMETYPE_CONTROL_FLAG_DISC 0x43
# define MUX27010_FRAMETYPE_CONTROL_FLAG_UIH 0xEF
# define MUX27010_PF_CONTROL_FLAG 0x10
# define MUX27010_FRAMETYPE_CONTROL_FLAG_UIH_E 0x00
# define MUX27010_FRAMETYPE_CONTROL_FLAG_RR 0x01
# define MUX27010_FRAMETYPE_CONTROL_FLAG_RNR 0x05
# define MUX27010_FRAMETYPE_CONTROL_FLAG_REJ 0x09
# define MUX27010_FRAMETYPE_CONTROL_FLAG_NS 0x0E
# define MUX27010_FRAMETYPE_CONTROL_FLAG_NR 0xE0
# define MUX27010_FRAMETYPE_CONTROL_FLAG_NOT_GREATER_THEN_7 0x07
2011-04-28 05:36:26 +00:00
/*Length*/
2011-04-28 14:38:29 +00:00
# define MUX27010_EA_LENGTH_FLAG 0x01
# define MUX27010_FRAMESIZE_LENGTH_FLAG 0xFE
# define MUX27010_FRAMESIZE_LENGTH_FLAG_EA 0xFFFE
2011-04-28 05:36:26 +00:00
/*Control Channel*/
2011-04-28 14:38:29 +00:00
# define MUX27010_EA_CONTROLCHANNEL_FRAMETYPE_FLAG 0x01
# define MUX27010_CR_CONTROLCHANNEL_FRAMETYPE_FLAG 0x02
# define MUX27010_COMMAND_CONTROLCHANNEL_FRAMETYPE_FLAG 0xFC
# define MUX27010_EA_CONTROLCHANNEL_LENGTH_FLAG 0x01
# define MUX27010_LENGTHFIELD_CONTROLCHANNEL_LENGTH_FLAG 0xFE
# define MUX27010_VALUE_CONTROLCHANNEL_TEST_VERSION 0xFF
# define MUX27010_VALUE_CONTROLCHANNEL_TEST_IEI_TE 0x04
# define MUX27010_VALUE_CONTROLCHANNEL_TEST_IEI_MS 0x08
# define MUX27010_VALUE_CONTROLCHANNEL_MSC_DCLI 0xFC
# define MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_FC 0x02
# define MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_RTC 0x04
# define MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_RTR 0x08
# define MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_RING 0x40
# define MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_DCD 0x80
# define MUX27010_VALUE_CONTROLCHANNEL_PN_DLCI 0x3F
# define MUX27010_VALUE_CONTROLCHANNEL_PN_FRAMETYPE 0x0F
# define MUX27010_VALUE_CONTROLCHANNEL_PN_CL 0xF0
# define MUX27010_VALUE_CONTROLCHANNEL_PN_PRIO 0x3F
# define MUX27010_VALUE_CONTROLCHANNEL_PN_WINSIZE 0x07
2011-04-28 05:36:26 +00:00
/*Command pattern - set C/R bit to 1*/
2011-04-28 14:38:29 +00:00
# define MUX27010_COMMAND_MULTIPLEXER_CLOSEDOWN 0xC3 /*11000011*/
# define MUX27010_COMMAND_TEST_COMMAND 0x23 /*00100011*/
# define MUX27010_COMMAND_POWER_SAVING_CONTROL 0x43 /*01000011*/
2013-06-02 13:45:51 +00:00
# define MUX27010_COMMAND_NON_SUPPORTED_COMMAND_RESPONSE 0x13 /*00010011*/
2011-04-28 14:38:29 +00:00
# define MUX27010_COMMAND_MODEM_STATUS_COMMAND 0xE3 /*00010011*/
# define MUX27010_COMMAND_PARAMETER_NEGOTIATION 0x83 /*10000011*/
2011-04-28 05:36:26 +00:00
/* Wireshark ID of the MUX27010 protocol */
static int proto_mux27010 = - 1 ;
/* Handles of subdissectors */
2011-04-28 14:38:29 +00:00
static dissector_handle_t ppp_handle ;
2011-04-28 05:36:26 +00:00
static const value_string packettypenames [ ] = {
2011-04-28 14:48:39 +00:00
{ 0 , " TEXT " } ,
{ 1 , " SOMETHING_ELSE " } ,
{ 0 , NULL }
2011-04-28 13:14:36 +00:00
} ;
2011-04-28 05:36:26 +00:00
2013-06-02 13:45:51 +00:00
static const value_string direction_vals [ ] = {
{ 0 , " Direction: Application => Module " } ,
{ 1 , " Module => Application " } ,
{ 2 , " Not valid " } ,
{ 3 , " Not valid " } ,
{ 0 , NULL }
} ;
static const value_string detailedvalue_response_vals [ ] = {
{ 0 , " Failure " } ,
{ 1 , " Success " } ,
{ 0 , NULL }
} ;
static const value_string frame_type_vals [ ] = {
{ MUX27010_FRAMETYPE_CONTROL_FLAG_SABM , " SABM " } ,
{ MUX27010_FRAMETYPE_CONTROL_FLAG_UA , " UA " } ,
{ MUX27010_FRAMETYPE_CONTROL_FLAG_DM , " DM " } ,
{ MUX27010_FRAMETYPE_CONTROL_FLAG_DISC , " DISC " } ,
{ MUX27010_FRAMETYPE_CONTROL_FLAG_UIH , " UIH " } ,
{ MUX27010_FRAMETYPE_CONTROL_FLAG_UIH_E , " UIH_E " } ,
{ MUX27010_FRAMETYPE_CONTROL_FLAG_RR , " Receive Ready " } ,
{ MUX27010_FRAMETYPE_CONTROL_FLAG_RNR , " Receive Not Ready " } ,
{ MUX27010_FRAMETYPE_CONTROL_FLAG_REJ , " Reject " } ,
{ 0 , NULL }
} ;
static const value_string command_vals [ ] = {
{ ( MUX27010_COMMAND_MULTIPLEXER_CLOSEDOWN > > 2 ) , " Multiplexer Close Down " } ,
{ ( MUX27010_COMMAND_TEST_COMMAND > > 2 ) , " Test Command " } ,
{ ( MUX27010_COMMAND_POWER_SAVING_CONTROL > > 2 ) , " Power Saving Control " } ,
{ ( MUX27010_COMMAND_NON_SUPPORTED_COMMAND_RESPONSE > > 2 ) , " Non-supported Command Response " } ,
{ ( MUX27010_COMMAND_MODEM_STATUS_COMMAND > > 2 ) , " Modem Status Command " } ,
{ ( MUX27010_COMMAND_PARAMETER_NEGOTIATION > > 2 ) , " Parameter Negotiation " } ,
{ 0 , NULL }
} ;
static const value_string iei_coding_vals [ ] = {
{ MUX27010_VALUE_CONTROLCHANNEL_TEST_IEI_TE , " TEMUX_VERSION " } ,
{ MUX27010_VALUE_CONTROLCHANNEL_TEST_IEI_MS , " MSMUX_VERSION " } ,
{ 0 , NULL }
} ;
/*Control channel*/
struct controlchannel_type
{
guint8 cr ;
guint8 command ;
gint number_of_type_frames ;
} ;
struct controlchannel
{
guint8 length_value ;
gint number_of_length_frames ;
} ;
2011-04-28 05:36:26 +00:00
/* The following hf_* variables are used to hold the Wireshark IDs of
* the header fields ; they are filled out when call
* proto_register_field_array ( ) in proto_register_mux27010 ( )
*/
static gint hf_mux27010_extended_header = - 1 ;
static gint hf_mux27010_direction = - 1 ;
static gint hf_mux27010 = - 1 ;
static gint hf_mux27010_address = - 1 ;
static gint hf_mux27010_control = - 1 ;
static gint hf_mux27010_length = - 1 ;
static gint hf_mux27010_controlchannel = - 1 ;
/*Extended Header*/
static int hf_mux27010_extended_header_size = - 1 ;
static int hf_mux27010_extended_header_msg_number_I = - 1 ;
static int hf_mux27010_extended_header_freq_number_I = - 1 ;
static int hf_mux27010_extended_header_start_pos_I = - 1 ;
static int hf_mux27010_extended_header_start_byte_I = - 1 ;
static int hf_mux27010_extended_header_end_pos_I = - 1 ;
static int hf_mux27010_extended_header_end_byte_I = - 1 ;
static int hf_mux27010_extended_header_flag_ended_I = - 1 ;
static int hf_mux27010_extended_header_msg_number_II = - 1 ;
static int hf_mux27010_extended_header_freq_number_II = - 1 ;
static int hf_mux27010_extended_header_start_pos_II = - 1 ;
static int hf_mux27010_extended_header_start_byte_II = - 1 ;
static int hf_mux27010_extended_header_end_pos_II = - 1 ;
static int hf_mux27010_extended_header_end_byte_II = - 1 ;
static int hf_mux27010_extended_header_flag_ended_II = - 1 ;
static int hf_mux27010_extended_header_msg_number_III = - 1 ;
static int hf_mux27010_extended_header_freq_number_III = - 1 ;
static int hf_mux27010_extended_header_start_pos_III = - 1 ;
static int hf_mux27010_extended_header_start_byte_III = - 1 ;
static int hf_mux27010_extended_header_end_pos_III = - 1 ;
static int hf_mux27010_extended_header_end_byte_III = - 1 ;
static int hf_mux27010_extended_header_flag_ended_III = - 1 ;
/*Address*/
static int hf_mux27010_dlciaddressflag = - 1 ;
static int hf_mux27010_eaaddressflag = - 1 ;
static int hf_mux27010_craddressflag = - 1 ;
2013-01-26 22:43:34 +00:00
/* static int hf_mux27010_addressdirection = -1; */
2011-04-28 05:36:26 +00:00
/*Control*/
static int hf_mux27010_controlframetype = - 1 ;
static int hf_mux27010_controlframetypens = - 1 ;
static int hf_mux27010_controlframetypenr = - 1 ;
static int hf_mux27010_pfcontrolflag = - 1 ;
/*Length*/
static int hf_mux27010_ealengthflag = - 1 ;
static int hf_mux27010_lengthframesize = - 1 ;
static int hf_mux27010_lengthframesize_ea = - 1 ;
/*Control channel dlci = 0*/
static int hf_mux27010_controlchannelframetype = - 1 ;
static int hf_mux27010_controlchanneleaframetype = - 1 ;
static int hf_mux27010_controlchannelcrframetype = - 1 ;
static int hf_mux27010_controlchannelframetypecommand = - 1 ;
static int hf_mux27010_controlchannellength = - 1 ;
static int hf_mux27010_controlchannelealength = - 1 ;
static int hf_mux27010_controlchannellengthfield = - 1 ;
static int hf_mux27010_controlchannelvalue = - 1 ;
2013-06-02 13:45:51 +00:00
static int hf_mux27010_controlchannel_iei_coding = - 1 ;
2011-04-28 05:36:26 +00:00
static int hf_mux27010_controlchanneldetailedvalue = - 1 ;
2013-06-02 13:45:51 +00:00
static int hf_mux27010_controlchannel_detailedvalue_response = - 1 ;
2011-04-28 05:36:26 +00:00
static int hf_mux27010_controlchanneldetailedvaluetestcommandversion = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluemscdlci = - 1 ;
2013-01-26 22:43:34 +00:00
/* static int hf_mux27010_controlchanneldetailedvaluemscv24 = -1; */
2011-04-28 05:36:26 +00:00
static int hf_mux27010_controlchanneldetailedvaluemscv24fc = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluemscv24rtc = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluemscv24rtr = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluemscv24ring = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluemscv24dcd = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluemscbreak = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluepndlci = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluepnframetype = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluepncl = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluepnprio = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluepntimer = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluepnframesize = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluepnna = - 1 ;
static int hf_mux27010_controlchanneldetailedvaluepnwinsize = - 1 ;
/*Information*/
static int hf_mux27010_information = - 1 ;
2013-06-02 13:45:51 +00:00
static int hf_mux27010_information_str = - 1 ;
2011-04-28 05:36:26 +00:00
/*Checksum*/
static int hf_mux27010_checksum = - 1 ;
2013-06-02 13:45:51 +00:00
static int hf_mux27010_checksum_correct = - 1 ;
2011-04-28 05:36:26 +00:00
/* These are the ids of the subtrees that we may be creating */
static gint ett_mux27010_extended_header = - 1 ;
static gint ett_mux27010 = - 1 ;
static gint ett_mux27010_address = - 1 ;
static gint ett_mux27010_control = - 1 ;
static gint ett_mux27010_length = - 1 ;
static gint ett_mux27010_controlchannel = - 1 ;
static gint ett_mux27010_controlchannelframetype = - 1 ;
static gint ett_mux27010_controlchannellength = - 1 ;
static gint ett_mux27010_controlchannelvalue = - 1 ;
static gint ett_mux27010_information = - 1 ;
static gint ett_mux27010_checksum = - 1 ;
2013-05-27 17:30:43 +00:00
static expert_field ei_mux27010_message_illogical = EI_INIT ;
2013-06-02 13:45:51 +00:00
static expert_field ei_mux27010_checksum_incorrect = EI_INIT ;
2011-04-28 05:36:26 +00:00
static int hf_msg_fragments = - 1 ;
static int hf_msg_fragment = - 1 ;
static int hf_msg_fragment_overlap = - 1 ;
static int hf_msg_fragment_overlap_conflicts = - 1 ;
static int hf_msg_fragment_multiple_tails = - 1 ;
static int hf_msg_fragment_too_long_fragment = - 1 ;
static int hf_msg_fragment_error = - 1 ;
static int hf_msg_fragment_count = - 1 ;
static int hf_msg_reassembled_in = - 1 ;
static int hf_msg_reassembled_length = - 1 ;
static gint ett_msg_fragment = - 1 ;
static gint ett_msg_fragments = - 1 ;
2013-08-05 19:09:44 +00:00
static dissector_handle_t mux27010_handle ;
2013-06-02 13:45:51 +00:00
static const fragment_items msg_frag_items = {
2011-04-28 14:48:39 +00:00
/* Fragment subtrees */
& ett_msg_fragment ,
& ett_msg_fragments ,
/* Fragment fields */
& hf_msg_fragments ,
& hf_msg_fragment ,
& hf_msg_fragment_overlap ,
& hf_msg_fragment_overlap_conflicts ,
& hf_msg_fragment_multiple_tails ,
& hf_msg_fragment_too_long_fragment ,
& hf_msg_fragment_error ,
& hf_msg_fragment_count ,
/* Reassembled in field */
& hf_msg_reassembled_in ,
/* Reassembled length field */
& hf_msg_reassembled_length ,
2012-09-07 02:09:59 +00:00
/* Reassembled data field */
NULL ,
2011-04-28 14:48:39 +00:00
/* Tag */
" Message fragments "
} ;
2011-04-28 05:36:26 +00:00
2013-03-22 23:59:54 +00:00
static reassembly_table msg_reassembly_table ;
2011-04-28 05:36:26 +00:00
2013-06-02 13:45:51 +00:00
static int
getExtendedHeader ( tvbuff_t * tvb , proto_tree * field_tree , int offset , guint8 * sizeMuxPPPHeader ) {
int i ;
2011-04-28 13:14:36 +00:00
2013-06-02 13:45:51 +00:00
* sizeMuxPPPHeader = tvb_get_guint8 ( tvb , offset ) ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_size , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2013-06-02 13:45:51 +00:00
if ( * sizeMuxPPPHeader > 0 ) {
2011-04-28 14:48:39 +00:00
int tmpOffset = 1 ;
guint16 tmpStartByte = 0 ;
guint16 tmpLastByte = 0 ;
2013-06-02 13:45:51 +00:00
for ( i = 0 ; i < * sizeMuxPPPHeader / 7 ; i + + ) {
2011-04-28 14:48:39 +00:00
switch ( i ) {
case ( 0 ) :
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_msg_number_I , tvb , offset + tmpOffset , 2 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 2 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_freq_number_I , tvb , offset + tmpOffset , 2 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 2 ;
2013-06-02 13:45:51 +00:00
tmpStartByte = tvb_get_guint8 ( tvb , tmpOffset ) + * sizeMuxPPPHeader + 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_start_pos_I , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_start_byte_I , tvb , tmpStartByte , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 1 ;
2013-06-02 13:45:51 +00:00
tmpLastByte = tvb_get_guint8 ( tvb , tmpOffset ) + * sizeMuxPPPHeader + 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_end_pos_I , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_end_byte_I , tvb , tmpLastByte , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_flag_ended_I , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
if ( ( tvb_get_guint8 ( tvb , tmpOffset ) & MUX27010_EXTENDED_HEADER_NOT_ENDED ) = = MUX27010_EXTENDED_HEADER_NOT_ENDED )
proto_tree_add_uint_format ( field_tree , hf_mux27010_extended_header_flag_ended_I , tvb , offset + tmpOffset , 1 , 1 , " Not Last Packet in Frequence " ) ;
else
proto_tree_add_uint_format ( field_tree , hf_mux27010_extended_header_flag_ended_I , tvb , offset + tmpOffset , 1 , 1 , " Last Packet in Frequence " ) ;
break ;
case ( 1 ) :
tmpOffset + = 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_msg_number_II , tvb , offset + tmpOffset , 2 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 2 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_freq_number_II , tvb , offset + tmpOffset , 2 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 2 ;
2013-06-02 13:45:51 +00:00
tmpStartByte = tvb_get_guint8 ( tvb , tmpOffset ) + * sizeMuxPPPHeader + 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_start_pos_II , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_start_byte_II , tvb , tmpStartByte , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 1 ;
2013-06-02 13:45:51 +00:00
tmpLastByte = tvb_get_guint8 ( tvb , tmpOffset ) + * sizeMuxPPPHeader + 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_end_pos_II , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_end_byte_II , tvb , tmpLastByte , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_flag_ended_II , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
if ( ( tvb_get_guint8 ( tvb , tmpOffset ) & MUX27010_EXTENDED_HEADER_NOT_ENDED ) = = MUX27010_EXTENDED_HEADER_NOT_ENDED )
proto_tree_add_uint_format ( field_tree , hf_mux27010_extended_header_flag_ended_II , tvb , offset + tmpOffset , 1 , 1 , " Not Last Packet in Frequence " ) ;
else
proto_tree_add_uint_format ( field_tree , hf_mux27010_extended_header_flag_ended_II , tvb , offset + tmpOffset , 1 , 1 , " Last Packet in Frequence " ) ;
break ;
case ( 2 ) :
tmpOffset + = 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_msg_number_III , tvb , offset + tmpOffset , 2 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 2 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_freq_number_III , tvb , offset + tmpOffset , 2 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 2 ;
2013-06-02 13:45:51 +00:00
tmpStartByte = tvb_get_guint8 ( tvb , tmpOffset ) + * sizeMuxPPPHeader + 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_start_pos_III , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_start_byte_III , tvb , tmpStartByte , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 1 ;
2013-06-02 13:45:51 +00:00
tmpLastByte = tvb_get_guint8 ( tvb , tmpOffset ) + * sizeMuxPPPHeader + 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_end_pos_III , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_end_byte_III , tvb , tmpLastByte , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
tmpOffset + = 1 ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_extended_header_flag_ended_III , tvb , offset + tmpOffset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
if ( ( tvb_get_guint8 ( tvb , tmpOffset ) & MUX27010_EXTENDED_HEADER_NOT_ENDED ) = = MUX27010_EXTENDED_HEADER_NOT_ENDED )
proto_tree_add_uint_format ( field_tree , hf_mux27010_extended_header_flag_ended_III , tvb , offset + tmpOffset , 1 , 1 , " Not Last Packet in Frequence " ) ;
else
proto_tree_add_uint_format ( field_tree , hf_mux27010_extended_header_flag_ended_III , tvb , offset + tmpOffset , 1 , 1 , " Last Packet in Frequence " ) ;
break ;
}
}
}
2011-04-28 05:36:26 +00:00
2013-06-02 13:45:51 +00:00
return * sizeMuxPPPHeader ;
2011-04-28 05:36:26 +00:00
}
/*Get the direction of the actual packet*/
2013-06-02 13:45:51 +00:00
static int
getFrameDirection ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * field_tree , int offset ) {
guint8 direction_in_out ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Direction is coded in the first byte of the frame*/
direction_in_out = tvb_get_guint8 ( tvb , offset ) ;
/*If first byte is 0 => Frame source is Application*/
/*If first byte is 1 => Frame source is Module*/
/*else Error*/
2013-06-02 13:45:51 +00:00
proto_tree_add_uint ( field_tree , hf_mux27010_direction , tvb , offset , 1 , direction_in_out & 3 ) ;
switch ( direction_in_out & 3 ) {
2011-04-28 14:48:39 +00:00
case ( 0 ) : /*Application >> Module*/
2013-06-02 13:45:51 +00:00
col_add_str ( pinfo - > cinfo , COL_DEF_SRC , " Application DLCI " ) ;
col_add_str ( pinfo - > cinfo , COL_DEF_DST , " Module " ) ;
2011-04-28 14:48:39 +00:00
break ;
case ( 1 ) : /*Module >> Application*/
2013-06-02 13:45:51 +00:00
col_add_str ( pinfo - > cinfo , COL_DEF_SRC , " Module DLCI " ) ;
col_add_str ( pinfo - > cinfo , COL_DEF_DST , " Application " ) ;
2011-04-28 14:48:39 +00:00
break ;
default : /*?? >> ??*/
2013-06-02 13:45:51 +00:00
col_add_str ( pinfo - > cinfo , COL_DEF_SRC , " Direction not valid " ) ;
col_add_str ( pinfo - > cinfo , COL_DEF_DST , " Direction not valid " ) ;
2011-04-28 14:48:39 +00:00
break ;
}
2011-04-28 05:36:26 +00:00
2013-06-02 13:45:51 +00:00
return 1 ;
2011-04-28 05:36:26 +00:00
}
/*Get the address of the actual frame*/
2013-06-02 13:45:51 +00:00
static int
getFrameAddress ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * field_tree_addr , int offset , guint8 * dlci_number ) {
guint8 byte ;
2011-04-28 05:36:26 +00:00
2013-06-02 13:45:51 +00:00
byte = tvb_get_guint8 ( tvb , offset ) ;
2011-04-28 14:48:39 +00:00
/*Get the DCLI number of the frame >> overwrite other bits (E/A, CR) >> shift*/
2013-06-02 13:45:51 +00:00
* dlci_number = ( byte & MUX27010_DLCI_ADDRESS_FLAG ) > > 2 ;
2011-04-28 14:48:39 +00:00
/*Add text to string for Source column*/
2013-06-02 13:45:51 +00:00
col_append_fstr ( pinfo - > cinfo , COL_DEF_SRC , " %d " , * dlci_number ) ;
2011-04-28 14:48:39 +00:00
/*Add items to subtree to display the details*/
2011-10-10 00:39:31 +00:00
proto_tree_add_item ( field_tree_addr , hf_mux27010_eaaddressflag , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_addr , hf_mux27010_craddressflag , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_addr , hf_mux27010_dlciaddressflag , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
2013-06-02 13:45:51 +00:00
return 1 ;
2011-04-28 05:36:26 +00:00
}
/*Get frame data from control field*/
2013-06-02 13:45:51 +00:00
static int
getFrameControlData ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * field_tree , int offset , guint8 * frame_type ) {
/*if the frame type is known -> 1 else 0*/
guint8 known_frame_type = 0 ;
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
/*Get the type of frame*/
2013-06-02 13:45:51 +00:00
* frame_type = tvb_get_guint8 ( tvb , offset ) & MUX27010_FRAMETYPE_CONTROL_FLAG ;
2011-04-28 14:48:39 +00:00
/*Find out the frame type and write info into column*/
2013-06-02 13:45:51 +00:00
switch ( * frame_type ) {
2011-04-28 14:48:39 +00:00
case ( MUX27010_FRAMETYPE_CONTROL_FLAG_SABM ) : /*SABM frame*/
case ( MUX27010_FRAMETYPE_CONTROL_FLAG_UA ) : /*UA frame*/
case ( MUX27010_FRAMETYPE_CONTROL_FLAG_DM ) : /*DM frame*/
case ( MUX27010_FRAMETYPE_CONTROL_FLAG_DISC ) : /*DISC frame*/
case ( MUX27010_FRAMETYPE_CONTROL_FLAG_UIH ) : /*UIH frame*/
2013-06-02 13:45:51 +00:00
proto_tree_add_uint ( field_tree , hf_mux27010_controlframetype , tvb , offset , 1 , * frame_type ) ;
2011-04-28 14:48:39 +00:00
break ;
default :
/*Got another frame -> probably a UIH_E, RR, RNR or REJ frame from a DLCI channel != 0 ==> Data channel*/
/*Check if frame is a UIH_E frame*/
2013-06-02 13:45:51 +00:00
if ( ( MUX27010_FRAMETYPE_CONTROL_FLAG_UIH_E | MUX27010_FRAMETYPE_CONTROL_FLAG_NS | MUX27010_FRAMETYPE_CONTROL_FLAG_NR ) = = ( * frame_type | MUX27010_FRAMETYPE_CONTROL_FLAG_NS | MUX27010_FRAMETYPE_CONTROL_FLAG_NR ) ) {
* frame_type = MUX27010_FRAMETYPE_CONTROL_FLAG_UIH_E ;
2011-04-28 14:48:39 +00:00
/*Add frame type to column*/
2013-06-02 13:45:51 +00:00
proto_tree_add_uint ( field_tree , hf_mux27010_controlframetype , tvb , offset , 1 , MUX27010_FRAMETYPE_CONTROL_FLAG_UIH_E ) ;
2011-04-28 14:48:39 +00:00
/*Add info about sequence numbers to column*/
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_controlframetypens , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree , hf_mux27010_controlframetypenr , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
/*Frame type is known*/
known_frame_type = 1 ;
}
/*Check if frame is a RR frame*/
2013-06-02 13:45:51 +00:00
if ( ( MUX27010_FRAMETYPE_CONTROL_FLAG_RR | MUX27010_FRAMETYPE_CONTROL_FLAG_NR ) = = ( * frame_type | MUX27010_FRAMETYPE_CONTROL_FLAG_NR ) ) {
* frame_type = MUX27010_FRAMETYPE_CONTROL_FLAG_RR ;
2011-04-28 14:48:39 +00:00
/*Add frame type to column*/
2013-06-02 13:45:51 +00:00
proto_tree_add_uint ( field_tree , hf_mux27010_controlframetype , tvb , offset , 1 , MUX27010_FRAMETYPE_CONTROL_FLAG_RR ) ;
2011-04-28 14:48:39 +00:00
/*Add info about sequence number to column*/
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_controlframetypenr , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
/*Frame type is known*/
known_frame_type = 1 ;
}
2013-06-02 13:45:51 +00:00
if ( ( MUX27010_FRAMETYPE_CONTROL_FLAG_RNR | MUX27010_FRAMETYPE_CONTROL_FLAG_NR ) = = ( * frame_type | MUX27010_FRAMETYPE_CONTROL_FLAG_NR ) ) {
* frame_type = MUX27010_FRAMETYPE_CONTROL_FLAG_RNR ;
2011-04-28 14:48:39 +00:00
/*Add frame type to column*/
2013-06-02 13:45:51 +00:00
proto_tree_add_uint ( field_tree , hf_mux27010_controlframetype , tvb , offset , 1 , MUX27010_FRAMETYPE_CONTROL_FLAG_RNR ) ;
2011-04-28 14:48:39 +00:00
/*Add info about sequence number to column*/
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_controlframetypenr , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
/*Frame type is known*/
known_frame_type = 1 ;
}
2013-06-02 13:45:51 +00:00
if ( ( MUX27010_FRAMETYPE_CONTROL_FLAG_REJ | MUX27010_FRAMETYPE_CONTROL_FLAG_NR ) = = ( * frame_type | MUX27010_FRAMETYPE_CONTROL_FLAG_NR ) ) {
* frame_type = MUX27010_FRAMETYPE_CONTROL_FLAG_REJ ;
2011-04-28 14:48:39 +00:00
/*Add frame type to column*/
2013-06-02 13:45:51 +00:00
proto_tree_add_uint ( field_tree , hf_mux27010_controlframetype , tvb , offset , 1 , MUX27010_FRAMETYPE_CONTROL_FLAG_REJ ) ;
2011-04-28 14:48:39 +00:00
/*Add info about sequence number to column*/
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_controlframetypenr , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
/*Frame type is known*/
known_frame_type = 1 ;
}
/*Unknown frame*/
if ( known_frame_type = = 0 ) {
/*Add frame type to column*/
2013-06-02 13:45:51 +00:00
proto_tree_add_uint ( field_tree , hf_mux27010_controlframetype , tvb , offset , 1 , * frame_type ) ;
2011-04-28 14:48:39 +00:00
}
}
/*Write information to string for column info*/
2013-06-02 13:45:51 +00:00
col_add_fstr ( pinfo - > cinfo , COL_INFO , " (%s) " , val_to_str_const ( * frame_type , frame_type_vals , " Unknown " ) ) ;
2011-04-28 14:48:39 +00:00
/*Add Frame type value and PF bit to column*/
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_controlframetype , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree , hf_mux27010_pfcontrolflag , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
2013-06-02 13:45:51 +00:00
return 1 ;
2011-04-28 05:36:26 +00:00
}
/*Get frame data from length field*/
2013-06-02 13:45:51 +00:00
static int
getFrameLength ( tvbuff_t * tvb , proto_tree * field_tree , int offset , guint16 * length_info ) {
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
/*Get the E/A bit*/
2013-06-02 13:45:51 +00:00
guint8 length_ea = tvb_get_guint8 ( tvb , offset ) & MUX27010_EA_LENGTH_FLAG ;
proto_tree_add_item ( field_tree , hf_mux27010_ealengthflag , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
/*Get the length of the info field*/
2011-04-28 14:48:39 +00:00
/*If E/A = 1 it is the last octet*/
if ( length_ea = = 1 ) {
/*Add the E/A bit and the length value to the subtree*/
2013-06-02 13:45:51 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_lengthframesize , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
* length_info = ( tvb_get_guint8 ( tvb , offset ) & MUX27010_FRAMESIZE_LENGTH_FLAG ) > > 1 ; /*Shift because of EA bit*/
return 1 ;
2011-04-28 14:48:39 +00:00
}
2013-06-02 13:45:51 +00:00
2011-04-28 14:48:39 +00:00
/*If E/A = 0 the length of the info field is >127*/
2013-06-02 13:45:51 +00:00
proto_tree_add_item ( field_tree , hf_mux27010_lengthframesize_ea , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
* length_info = ( tvb_get_ntohs ( tvb , offset ) & MUX27010_FRAMESIZE_LENGTH_FLAG_EA ) > > 1 ; /*Shift because of EA bit*/
return 2 ;
2011-04-28 05:36:26 +00:00
}
/*Get frame type of control channel frame*/
2013-06-02 13:45:51 +00:00
static int
getControlChannelFrameType ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * field_tree_ctr , int offset ,
struct controlchannel_type * cctype ) {
guint8 controlchannel_type_ea ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get the E/A bit*/
2013-06-02 13:45:51 +00:00
controlchannel_type_ea = tvb_get_guint8 ( tvb , offset ) & MUX27010_EA_CONTROLCHANNEL_FRAMETYPE_FLAG ;
2011-04-28 14:48:39 +00:00
/*Set variable for number of octets for frame type to 0*/
2013-06-02 13:45:51 +00:00
cctype - > number_of_type_frames = 0 ;
2011-04-28 14:48:39 +00:00
/*If E/A bit = 1, there will be no other frame type octet*/
2013-06-02 13:45:51 +00:00
if ( controlchannel_type_ea = = 1 )
cctype - > number_of_type_frames + + ;
2011-04-28 14:48:39 +00:00
/*If E/A = 0, read all frame type octets*/
while ( controlchannel_type_ea = = 0 ) {
2013-06-02 13:45:51 +00:00
cctype - > number_of_type_frames + + ;
controlchannel_type_ea = tvb_get_guint8 ( tvb , offset + cctype - > number_of_type_frames ) & MUX27010_EA_CONTROLCHANNEL_FRAMETYPE_FLAG ;
2011-04-28 14:48:39 +00:00
}
/*Get CR bit*/
2013-06-02 13:45:51 +00:00
cctype - > cr = ( tvb_get_guint8 ( tvb , offset ) & MUX27010_CR_CONTROLCHANNEL_FRAMETYPE_FLAG ) > > 1 ;
2011-04-28 14:48:39 +00:00
/*Get command info*/
2013-06-02 13:45:51 +00:00
cctype - > command = tvb_get_guint8 ( tvb , offset ) & MUX27010_COMMAND_CONTROLCHANNEL_FRAMETYPE_FLAG ;
2011-04-28 14:48:39 +00:00
/*Add info to subtree*/
2011-10-10 00:39:31 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneleaframetype , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchannelcrframetype , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchannelframetypecommand , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
/*Check the control channel frame types and add the name to the subtree and strcat the name to the info column*/
2013-06-02 13:45:51 +00:00
col_append_fstr ( pinfo - > cinfo , COL_INFO , " %s " , val_to_str_const ( cctype - > command > > 2 , command_vals , " Unknown " ) ) ;
2011-04-28 14:48:39 +00:00
2013-06-02 13:45:51 +00:00
if ( cctype - > cr = = 1 ) /*Command C/R*/ {
col_append_str ( pinfo - > cinfo , COL_INFO , " (Command) " ) ;
2011-04-28 14:48:39 +00:00
}
else { /*Response*/
2013-06-02 13:45:51 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " (Response) " ) ;
2011-04-28 14:48:39 +00:00
}
2013-06-02 13:45:51 +00:00
return cctype - > number_of_type_frames ;
2011-04-28 05:36:26 +00:00
}
/*Get length of control channel info field*/
2013-06-02 13:45:51 +00:00
static int
getControlChannelLength ( tvbuff_t * tvb , proto_tree * field_tree_ctr , int offset , struct controlchannel * cc ) {
guint8 controlchannel_length_ea ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get the E/A bit*/
2013-06-02 13:45:51 +00:00
controlchannel_length_ea = tvb_get_guint8 ( tvb , offset ) & MUX27010_EA_CONTROLCHANNEL_LENGTH_FLAG ;
2011-04-28 14:48:39 +00:00
/*Set variable for number of octets for info field to 0*/
2013-06-02 13:45:51 +00:00
cc - > number_of_length_frames = 0 ;
2011-04-28 14:48:39 +00:00
/*If E/A bit = 1, there will be no other info field length octet*/
2013-06-02 13:45:51 +00:00
if ( controlchannel_length_ea = = 1 )
cc - > number_of_length_frames + + ;
2011-04-28 14:48:39 +00:00
/*If E/A = 0, read all length of info field octets*/
while ( controlchannel_length_ea = = 0 ) {
2013-06-02 13:45:51 +00:00
cc - > number_of_length_frames + + ;
controlchannel_length_ea = tvb_get_guint8 ( tvb , offset + cc - > number_of_length_frames ) & MUX27010_EA_CONTROLCHANNEL_LENGTH_FLAG ;
2011-04-28 14:48:39 +00:00
}
/*Get the data from info field*/
2013-06-02 13:45:51 +00:00
cc - > length_value = ( tvb_get_guint8 ( tvb , offset ) & MUX27010_LENGTHFIELD_CONTROLCHANNEL_LENGTH_FLAG ) > > 1 ;
2011-04-28 14:48:39 +00:00
/*Add data to subtree*/
2011-10-10 00:39:31 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchannelealength , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchannellengthfield , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
2013-06-02 13:45:51 +00:00
return cc - > number_of_length_frames ;
2011-04-28 05:36:26 +00:00
}
/*Get values of control channel*/
2013-06-02 13:45:51 +00:00
static int
getControlChannelValues ( tvbuff_t * tvb , proto_tree * field_tree_ctr , int offset ,
struct controlchannel * cc , struct controlchannel_type * cctype ) {
guint8 controlchannel_iei ;
guint8 controlchannel_psc ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Command pattern for Test Command (C/R is set to 1)*/
2013-06-02 13:45:51 +00:00
switch ( cctype - > command | MUX27010_EA_CONTROLCHANNEL_FRAMETYPE_FLAG | MUX27010_CR_CONTROLCHANNEL_FRAMETYPE_FLAG )
{
case MUX27010_COMMAND_TEST_COMMAND :
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluetestcommandversion , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
controlchannel_iei = tvb_get_guint8 ( tvb , offset ) ;
2013-06-02 13:45:51 +00:00
if ( ( controlchannel_iei = = MUX27010_VALUE_CONTROLCHANNEL_TEST_IEI_TE ) | |
( controlchannel_iei = = MUX27010_VALUE_CONTROLCHANNEL_TEST_IEI_MS ) ) {
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchannel_iei_coding , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
}
2013-06-02 13:45:51 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchannelvalue , tvb , offset + 1 , cc - > length_value - 1 , ENC_NA | ENC_ASCII ) ;
break ;
2011-04-28 14:48:39 +00:00
/*Command pattern for Power saving control (C/R is set to 1)*/
2013-06-02 13:45:51 +00:00
case MUX27010_COMMAND_POWER_SAVING_CONTROL :
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvalue , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
controlchannel_psc = tvb_get_guint8 ( tvb , offset ) ;
2013-06-02 13:45:51 +00:00
if ( cctype - > cr = = 0 & & controlchannel_psc = = 0 ) /*Response Failure*/
proto_tree_add_uint ( field_tree_ctr , hf_mux27010_controlchannel_detailedvalue_response , tvb , offset , cc - > length_value , 0 ) ;
if ( cctype - > cr = = 0 & & controlchannel_psc = = 1 ) /*Response Success*/
proto_tree_add_uint ( field_tree_ctr , hf_mux27010_controlchannel_detailedvalue_response , tvb , offset , cc - > length_value , 1 ) ;
break ;
2011-04-28 14:48:39 +00:00
/*Command pattern for non-supported command response (C/R is set to 1)*/
2013-06-02 13:45:51 +00:00
case MUX27010_COMMAND_NON_SUPPORTED_COMMAND_RESPONSE :
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvalue , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2013-06-02 13:45:51 +00:00
break ;
2011-04-28 14:48:39 +00:00
/*Command pattern for Modem Status Command (C/R is set to 1)*/
2013-06-02 13:45:51 +00:00
case MUX27010_COMMAND_MODEM_STATUS_COMMAND :
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluemscdlci , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
/*Add bits of Flow Control*/
2011-10-10 00:39:31 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluemscv24fc , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluemscv24rtc , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluemscv24rtr , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluemscv24ring , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluemscv24dcd , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
/**/
2013-06-02 13:45:51 +00:00
if ( cc - > length_value = = 3 ) {
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluemscbreak , tvb , offset + 2 , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
}
2013-06-02 13:45:51 +00:00
break ;
2011-04-28 14:48:39 +00:00
/*Command pattern for Parameter Negotiation (EA + C/R is set to 1)*/
2013-06-02 13:45:51 +00:00
case MUX27010_COMMAND_PARAMETER_NEGOTIATION :
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluepndlci , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluepnframetype , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluepncl , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluepnprio , tvb , offset + 2 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluepntimer , tvb , offset + 3 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluepnframesize , tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluepnna , tvb , offset + 6 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( field_tree_ctr , hf_mux27010_controlchanneldetailedvaluepnwinsize , tvb , offset + 7 , 1 , ENC_BIG_ENDIAN ) ;
2013-06-02 13:45:51 +00:00
break ;
2011-04-28 14:48:39 +00:00
}
2013-06-02 13:45:51 +00:00
return cc - > length_value ;
2011-04-28 05:36:26 +00:00
}
/*Get values information field*/
2013-06-02 13:45:51 +00:00
static int
2013-06-02 18:01:14 +00:00
getFrameInformation ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * field_tree ,
int offset , guint16 length_info ) {
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get the data from information field as string*/
2013-06-02 13:45:51 +00:00
char * information_field = tvb_get_ephemeral_string ( tvb , offset , length_info ) ;
2011-04-28 14:48:39 +00:00
2013-06-02 13:45:51 +00:00
/*delete unneeded signs out of info field -> for info column: CR (0x0d) and LF (0x0a)*/
information_field = g_strdelimit ( information_field , " \r \n " , ' ' ) ;
2011-04-28 14:48:39 +00:00
2013-06-02 13:45:51 +00:00
col_append_fstr ( pinfo - > cinfo , COL_INFO , " %s " , information_field ) ;
2011-04-28 14:48:39 +00:00
/*Add info to subtree*/
2013-06-02 13:45:51 +00:00
proto_tree_add_string ( field_tree , hf_mux27010_information_str , tvb , offset , length_info , information_field ) ;
2011-04-28 14:48:39 +00:00
/*Increment offset by the length of chars in info field*/
2013-06-02 13:45:51 +00:00
return length_info ;
2011-04-28 05:36:26 +00:00
}
2011-04-28 14:38:29 +00:00
static void
2011-04-28 05:36:26 +00:00
dissect_mux27010 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree )
{
2013-06-02 13:45:51 +00:00
proto_item * ti , * tf , * tf_extended_header , * tf_addr , * tf_ctr ;
proto_tree * mux27010_tree , * field_tree , * field_tree_extended_header , * field_tree_addr , * field_tree_ctr ;
int offset = 0 ;
guint16 length_info ;
packet_info pinfo_tmp ;
/*Address DLCI*/
gint8 dlci_number = 0 ;
guint8 frame_type ;
/*private MUX frame header (PPP)*/
guint8 sizeMuxPPPHeader ;
struct controlchannel_type cc_type ;
struct controlchannel cc ;
/* Setup columns */
2011-04-28 14:48:39 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , PROTO_TAG_MUX27010 ) ;
2013-06-02 13:45:51 +00:00
col_clear ( pinfo - > cinfo , COL_INFO ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/* Set offset to 0 => start to read at the begin of the frame*/
offset = 0 ;
2011-04-28 05:36:26 +00:00
2011-10-21 02:10:19 +00:00
ti = proto_tree_add_item ( tree , proto_mux27010 , tvb , 0 , - 1 , ENC_NA ) ;
2011-04-28 14:48:39 +00:00
mux27010_tree = proto_item_add_subtree ( ti , ett_mux27010 ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Add a subtree (=item) to the child node => in this subtree the details of extended header will be displayed*/
2011-10-06 03:35:44 +00:00
tf_extended_header = proto_tree_add_item ( mux27010_tree , hf_mux27010_extended_header , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree_extended_header = proto_item_add_subtree ( tf_extended_header , ett_mux27010_extended_header ) ;
2011-04-28 13:14:36 +00:00
2013-06-02 13:45:51 +00:00
offset + = getExtendedHeader ( tvb , field_tree_extended_header , offset , & sizeMuxPPPHeader ) ;
2011-04-28 14:48:39 +00:00
offset + + ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get direction of the frame*/
2013-06-02 13:45:51 +00:00
offset + = getFrameDirection ( tvb , pinfo , mux27010_tree , offset ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*~~~~~~~~Flag~~~~~~~~*/
/*(Insert data into the child node)*/
/*Create item to show/highlight flag sequence*/
2011-10-06 03:35:44 +00:00
proto_tree_add_item ( mux27010_tree , hf_mux27010 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2013-06-02 13:45:51 +00:00
offset + + ;
2011-04-28 14:48:39 +00:00
/*~~~~~~~~/Flag~~~~~~~~*/
2011-04-28 05:36:26 +00:00
2011-04-28 13:14:36 +00:00
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*~~~~~~~~Address~~~~~~~~*/
/*Add a subtree (=item) to the child node => in this subtree the details of address data will be displayed*/
2011-10-06 03:35:44 +00:00
tf_addr = proto_tree_add_item ( mux27010_tree , hf_mux27010_address , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree_addr = proto_item_add_subtree ( tf_addr , ett_mux27010_address ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get address data (DLCI, E/A, CR)*/
2013-06-02 13:45:51 +00:00
offset + = getFrameAddress ( tvb , pinfo , field_tree_addr , offset , & dlci_number ) ;
2011-04-28 14:48:39 +00:00
/*~~~~~~~~/Address~~~~~~~~*/
2011-04-28 05:36:26 +00:00
2011-04-28 13:14:36 +00:00
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*~~~~~~~~Control Data~~~~~~~~*/
/*Add a subtree (=item) to the child node => in this subtree the details of control data will be displayed*/
2011-10-06 03:35:44 +00:00
tf = proto_tree_add_item ( mux27010_tree , hf_mux27010_control , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree = proto_item_add_subtree ( tf , ett_mux27010_control ) ;
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
/*Get control data of frame (Frame type)*/
2013-06-02 13:45:51 +00:00
offset + = getFrameControlData ( tvb , pinfo , field_tree , offset , & frame_type ) ;
2011-04-28 14:48:39 +00:00
/*~~~~~~~~/Control Data~~~~~~~~*/
2011-04-28 05:36:26 +00:00
2011-04-28 13:14:36 +00:00
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*~~~~~~~~Length~~~~~~~~*/
/*Set the variable for length of the info field to 0*/
length_info = 0 ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Check the frame type because in RR, RNR and REJ are no info and no lenght fields*/
2013-06-02 13:45:51 +00:00
if ( ( frame_type ! = MUX27010_FRAMETYPE_CONTROL_FLAG_RR ) & & ( frame_type ! = MUX27010_FRAMETYPE_CONTROL_FLAG_RNR ) & &
( frame_type ! = MUX27010_FRAMETYPE_CONTROL_FLAG_REJ ) ) {
2011-04-28 14:48:39 +00:00
/*Add a subtree (=item) to the child node => in this subtree will be the details of length field*/
2011-10-06 03:35:44 +00:00
tf = proto_tree_add_item ( mux27010_tree , hf_mux27010_length , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree = proto_item_add_subtree ( tf , ett_mux27010_length ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get frame length data*/
2013-06-02 13:45:51 +00:00
offset + = getFrameLength ( tvb , field_tree , offset , & length_info ) ;
2011-04-28 14:48:39 +00:00
}
/*~~~~~~~~/Length~~~~~~~~*/
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*~~~~~~~~Control Channel~~~~~~~~*/
/*Control Channel only exists if DLCI = 0*/
if ( dlci_number = = 0 ) {
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
/*If length field > 0, otherwise the frame has no data*/
if ( length_info > 0 ) {
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
/*--------Frame Type--------*/
/*Get and display data of frame type*/
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
/*Add a subtree (=item) to the child node => in this subtree the details of control channel will be displayed*/
2011-10-06 03:35:44 +00:00
tf = proto_tree_add_item ( mux27010_tree , hf_mux27010_controlchannel , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree = proto_item_add_subtree ( tf , ett_mux27010_controlchannel ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Add another subtree to the control channel subtree => in this subtree the details of control channel frame type will be displayed*/
2013-06-02 13:45:51 +00:00
tf_ctr = proto_tree_add_item ( field_tree , hf_mux27010_controlchannelframetype , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree_ctr = proto_item_add_subtree ( tf_ctr , ett_mux27010_controlchannelframetype ) ;
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
/*Get data about the type of the frame*/
2013-06-02 13:45:51 +00:00
offset + = getControlChannelFrameType ( tvb , pinfo , field_tree_ctr , offset , & cc_type ) ;
proto_item_set_len ( tf_ctr , cc_type . number_of_type_frames ) ;
2011-04-28 14:48:39 +00:00
/*--------/Frame Type--------*/
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*--------Length Field--------*/
/*Add another subtree to the control channel subtree => in this subtree the details of control channel length field will be displayed*/
2013-06-02 13:45:51 +00:00
tf_ctr = proto_tree_add_item ( field_tree , hf_mux27010_controlchannellength , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree_ctr = proto_item_add_subtree ( tf_ctr , ett_mux27010_controlchannellength ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get data of length field*/
2013-06-02 13:45:51 +00:00
offset + = getControlChannelLength ( tvb , field_tree_ctr , offset , & cc ) ;
proto_item_set_len ( tf_ctr , cc . number_of_length_frames ) ;
2011-04-28 14:48:39 +00:00
/*--------/Length Field--------*/
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*--------Values--------*/
/*If frame has data inside the length_value is > 0*/
2013-06-02 13:45:51 +00:00
if ( cc . length_value > 0 ) {
2011-04-28 14:48:39 +00:00
/*Add another subtree to the control channel subtree => in this subtree the details of control channel values/data will be displayed*/
2013-06-02 13:45:51 +00:00
tf_ctr = proto_tree_add_text ( field_tree , tvb , offset , cc . length_value , " Data: %i Byte(s) " , cc . length_value ) ;
2011-04-28 14:48:39 +00:00
field_tree_ctr = proto_item_add_subtree ( tf_ctr , ett_mux27010_controlchannelvalue ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get data of frame*/
2013-06-02 13:45:51 +00:00
offset + = getControlChannelValues ( tvb , field_tree_ctr , offset , & cc , & cc_type ) ;
2011-04-28 14:48:39 +00:00
} /*(controlchannel_length_value > 0)*/
/*--------/Values--------*/
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
} /*length_info > 0*/
} /*dlci_number == 0*/
2011-04-28 13:14:36 +00:00
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*~~~~~~~~Information~~~~~~~~*/
/*Display "normal" data/values (not control channel) if exists ==> length_info > 0*/
if ( dlci_number ! = 0 & & length_info > 0 ) {
/*Add a subtree (=item) to the child node => in this subtree will be the data*/
2011-10-06 03:35:44 +00:00
tf = proto_tree_add_item ( mux27010_tree , hf_mux27010_information , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree = proto_item_add_subtree ( tf , ett_mux27010_information ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*We have at least one PPP packet*/
if ( sizeMuxPPPHeader > 0 ) {
guint16 tmpOffset = 1 ;
guint16 tmpOffsetBegin = 1 ;
guint16 tmpOffsetEnd = 1 ;
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
guint16 msg_seqid ;
guint16 msg_num ;
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
guint8 msg_start ;
guint8 msg_end ;
guint8 msg_flag ;
2011-04-28 13:14:36 +00:00
2013-07-17 21:12:24 +00:00
fragment_head * frag_msg = NULL ;
2011-05-02 14:27:48 +00:00
tvbuff_t * new_tvb = NULL ;
tvbuff_t * next_tvb2 = NULL ;
2011-04-28 13:14:36 +00:00
2013-06-02 13:45:51 +00:00
int i ;
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
for ( i = 0 ; i < sizeMuxPPPHeader / 7 ; i + + ) {
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
tmpOffset = 7 ;
tmpOffset = ( i * tmpOffset ) + 1 ;
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
msg_seqid = tvb_get_ntohs ( tvb , tmpOffset ) ; tmpOffset + = 2 ;
2011-04-29 14:02:55 +00:00
msg_num = tvb_get_ntohs ( tvb , tmpOffset ) ; tmpOffset + = 2 ;
2011-04-28 14:48:39 +00:00
msg_start = tvb_get_guint8 ( tvb , tmpOffset ) ; tmpOffset + = 1 ;
2011-04-29 14:02:55 +00:00
msg_end = tvb_get_guint8 ( tvb , tmpOffset ) ; tmpOffset + = 1 ;
msg_flag = tvb_get_guint8 ( tvb , tmpOffset ) ; tmpOffset + = 1 ;
2011-04-28 13:14:36 +00:00
2011-05-02 14:27:48 +00:00
if ( msg_end < = msg_start ) {
2013-07-03 02:59:31 +00:00
proto_tree_add_expert ( field_tree , pinfo , & ei_mux27010_message_illogical ,
tvb , tmpOffset - 3 , 2 ) ;
2011-05-02 14:27:48 +00:00
continue ;
}
2011-04-28 14:48:39 +00:00
tmpOffsetBegin = sizeMuxPPPHeader + 1 + msg_start ; /*+ Header_Size, + Direction*/
tmpOffsetEnd = sizeMuxPPPHeader + 1 + msg_end ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
pinfo - > fragmented = TRUE ;
2011-04-28 13:14:36 +00:00
2013-06-02 13:45:51 +00:00
/* XXX - WHY? Isn't there a simpler way? */
2011-05-02 14:27:48 +00:00
memcpy ( & pinfo_tmp , pinfo , sizeof ( * pinfo ) ) ;
2011-04-28 05:36:26 +00:00
2013-03-22 23:59:54 +00:00
frag_msg = fragment_add_seq_check ( & msg_reassembly_table ,
tvb , tmpOffsetBegin ,
pinfo ,
2011-04-29 14:02:55 +00:00
msg_seqid , /* ID for fragments belonging together */
2013-03-22 23:59:54 +00:00
NULL ,
2011-04-29 14:02:55 +00:00
msg_num , /* fragment sequence number */
2011-04-28 14:48:39 +00:00
( tmpOffsetEnd - tmpOffsetBegin ) + 1 , /* fragment length */
msg_flag ) ; /* More fragments? */
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
new_tvb = process_reassembled_data ( tvb , tmpOffsetBegin , pinfo ,
" Reassembled Message " , frag_msg , & msg_frag_items ,
NULL , mux27010_tree ) ;
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
if ( ! frag_msg ) { /* Not last packet of reassembled Message */
2013-06-02 13:45:51 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " [Split Msg] " ) ;
2011-04-28 14:48:39 +00:00
}
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
if ( new_tvb ) { /* take it all */
2012-03-06 16:58:09 +00:00
next_tvb2 = tvb_new_subset_remaining ( new_tvb , 1 ) ;
2011-05-02 14:27:48 +00:00
call_dissector ( ppp_handle , next_tvb2 , pinfo , tree ) ;
2011-04-28 14:48:39 +00:00
}
2011-04-28 13:14:36 +00:00
2011-04-28 14:48:39 +00:00
pinfo = & pinfo_tmp ;
}
}
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Get and display information*/
2013-06-02 18:01:14 +00:00
offset + = getFrameInformation ( tvb , pinfo , field_tree , offset , length_info ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
}
/*~~~~~~~~/Information~~~~~~~~*/
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*~~~~~~~~Checksum~~~~~~~~*/
/*Validate checksum of frame*/
/*Add a subtree (=item) to the child node => in this subtree will be the checksum*/
2011-10-06 03:35:44 +00:00
tf = proto_tree_add_item ( mux27010_tree , hf_mux27010_checksum , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2011-04-28 14:48:39 +00:00
field_tree = proto_item_add_subtree ( tf , ett_mux27010_checksum ) ;
2011-04-28 05:36:26 +00:00
2011-04-28 14:48:39 +00:00
/*Call method check_checksum and validate checksum*/
if ( check_fcs ( tvb , offset - sizeMuxPPPHeader - 3 - length_info , sizeMuxPPPHeader + 3 , tvb_get_guint8 ( tvb , offset ) ) ) {
/*Checksum is correct*/
2013-06-02 13:45:51 +00:00
proto_tree_add_boolean ( field_tree , hf_mux27010_checksum_correct , tvb , offset , 1 , TRUE ) ;
2011-04-28 14:48:39 +00:00
}
else {
2013-06-02 13:45:51 +00:00
/*Checksum is incorrect*/
expert_add_info ( pinfo , tf , & ei_mux27010_checksum_incorrect ) ;
2011-04-28 14:48:39 +00:00
}
/*~~~~~~~~/Checksum~~~~~~~~*/
2011-04-28 05:36:26 +00:00
}
2011-04-28 14:38:29 +00:00
static void
mux27010_init ( void )
{
2011-04-28 14:48:39 +00:00
/*
* Initialize the fragment and reassembly tables .
*/
2013-03-22 23:59:54 +00:00
reassembly_table_init ( & msg_reassembly_table ,
& addresses_reassembly_table_functions ) ;
2011-04-28 14:38:29 +00:00
}
/*Register the protocol*/
void
proto_register_mux27010 ( void )
{
2011-04-28 14:48:39 +00:00
/* A header field is something you can search/filter on.
*
* Create a structure to register fields . It consists of an
* array of hf_register_info structures , each of which are of the format
* { & ( field id ) , { name , abbrev , type , display , strings , bitmask , blurb , HFILL } } .
*/
static hf_register_info hf [ ] = {
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
/*Extended MUX header (for PPP)*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header ,
2011-04-29 14:02:55 +00:00
{ " Extended Header " , " mux27010.ext_header " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_size ,
2011-04-29 14:02:55 +00:00
{ " Header Size " , " mux27010.ext_header.size " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_msg_number_I ,
2011-04-29 14:02:55 +00:00
{ " Message Number I " , " mux27010.ext_header.msg_number_I " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_freq_number_I ,
2011-04-29 14:02:55 +00:00
{ " Frequenz Number I " , " mux27010.ext_header.frequenz_number_I " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_start_pos_I ,
2011-04-29 14:02:55 +00:00
{ " Start Position I " , " mux27010.ext_header.start_pos_I " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_start_byte_I ,
2011-04-29 14:02:55 +00:00
{ " Start Byte I " , " mux27010.ext_header.start_byte_I " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_end_pos_I ,
2012-01-23 19:17:42 +00:00
{ " End Position I " , " mux27010.ext_header.end_pos_I " ,
2011-04-29 14:02:55 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_end_byte_I ,
2011-04-29 14:02:55 +00:00
{ " End Byte I " , " mux27010.ext_header.end_byte_I " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_flag_ended_I ,
2011-04-29 14:02:55 +00:00
{ " Flag Ended I " , " mux27010.ext_header.flag_ended_I " ,
FT_UINT8 , BASE_HEX , NULL , MUX27010_EXTENDED_HEADER_NOT_ENDED , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_msg_number_II ,
2011-04-29 14:02:55 +00:00
{ " Message Number II " , " mux27010.ext_header.msg_number_II " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_freq_number_II ,
2011-04-29 14:02:55 +00:00
{ " Frequenz Number II " , " mux27010.ext_header.frequenz_number_II " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_start_pos_II ,
2011-04-29 14:02:55 +00:00
{ " Start Position II " , " mux27010.ext_header.start_pos_II " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_start_byte_II ,
2011-04-29 14:02:55 +00:00
{ " Start Byte II " , " mux27010.ext_header.start_byte_II " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_end_pos_II ,
2012-01-23 19:17:42 +00:00
{ " End Position II " , " mux27010.ext_header.end_pos_II " ,
2011-04-29 14:02:55 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_end_byte_II ,
2011-04-29 14:02:55 +00:00
{ " End Byte II " , " mux27010.ext_header.end_byte_II " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_flag_ended_II ,
2011-04-29 14:02:55 +00:00
{ " Flag Ended II " , " mux27010.ext_header.flag_ended_II " ,
FT_UINT8 , BASE_HEX , NULL , MUX27010_EXTENDED_HEADER_NOT_ENDED , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_msg_number_III ,
2011-04-29 14:02:55 +00:00
{ " Message Number III " , " mux27010.ext_header.msg_number_III " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_freq_number_III ,
2011-04-29 14:02:55 +00:00
{ " Frequenz Number III " , " mux27010.ext_header.frequenz_number_III " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_start_pos_III ,
2011-04-29 14:02:55 +00:00
{ " Start Position III " , " mux27010.ext_header.start_pos_III " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_start_byte_III ,
2011-04-29 14:02:55 +00:00
{ " Start Byte III " , " mux27010.ext_header.start_byte_III " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_end_pos_III ,
2012-01-23 19:17:42 +00:00
{ " End Position III " , " mux27010.ext_header.end_pos_III " ,
2011-04-29 14:02:55 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_extended_header_end_byte_III ,
2011-04-29 14:02:55 +00:00
{ " End Byte III " , " mux27010.ext_header.end_byte_III " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
2011-04-29 14:02:55 +00:00
{ & hf_mux27010_extended_header_flag_ended_III ,
{ " Flag Ended III " , " mux27010.ext_header.flag_ended_III " ,
FT_UINT8 , BASE_HEX , NULL , MUX27010_EXTENDED_HEADER_NOT_ENDED , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
/*Direction*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_direction ,
2011-04-29 14:02:55 +00:00
{ " Direction " , " mux27010.direction " ,
2013-06-02 13:45:51 +00:00
FT_UINT8 , BASE_HEX , VALS ( & direction_vals ) , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
/*Flag*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010 ,
2011-04-29 14:02:55 +00:00
{ " Flag " , " mux27010.flag " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
/*Address frame*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_address ,
2011-04-29 14:02:55 +00:00
{ " Address field " , " mux27010.address " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_dlciaddressflag ,
2011-04-29 14:02:55 +00:00
{ " DLCI number (decimal) " , " mux27010.address.dlciaddress " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_DLCI_ADDRESS_FLAG , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_eaaddressflag ,
2011-04-29 14:02:55 +00:00
{ " EA Address Flag " , " mux27010.address.eaaddress " ,
FT_BOOLEAN , 8 , NULL , MUX27010_EA_ADDRESS_FLAG , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_craddressflag ,
2011-04-29 14:02:55 +00:00
{ " C/R Address Flag " , " mux27010.address.craddress " ,
FT_BOOLEAN , 8 , NULL , MUX27010_CR_ADDRESS_FLAG , NULL , HFILL } } ,
2013-01-31 18:35:06 +00:00
#if 0
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_addressdirection ,
2011-04-29 14:02:55 +00:00
{ " Direction " , " mux27010.address.direction " ,
FT_UINT8 , BASE_HEX , NULL , MUX27010_CR_ADDRESS_FLAG , NULL , HFILL } } ,
2013-01-31 18:35:06 +00:00
# endif
2011-04-28 14:48:39 +00:00
/*Control frame*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_control ,
2011-04-29 14:02:55 +00:00
{ " Control field " , " mux27010.control " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_controlframetype ,
2011-04-29 14:02:55 +00:00
{ " Frame Type " , " mux27010.control.frametype " ,
2013-06-02 13:45:51 +00:00
FT_UINT8 , BASE_HEX , VALS ( frame_type_vals ) , MUX27010_FRAMETYPE_CONTROL_FLAG , NULL , HFILL } } ,
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_controlframetypens ,
2011-04-29 14:02:55 +00:00
{ " N(S) Sequence Number " , " mux27010.control.frametype.ns " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_FRAMETYPE_CONTROL_FLAG_NS , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_controlframetypenr ,
2011-04-29 14:02:55 +00:00
{ " N(R) Receive Number " , " mux27010.control.frametype.nr " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_FRAMETYPE_CONTROL_FLAG_NR , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_pfcontrolflag ,
2011-04-29 14:02:55 +00:00
{ " Poll/Final bit " , " mux27010.control.pfcontrol " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_PF_CONTROL_FLAG , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
/*Length frame*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_length ,
2011-04-29 14:02:55 +00:00
{ " Length field " , " mux27010.length " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_ealengthflag ,
2011-04-29 14:02:55 +00:00
{ " E/A Flag " , " mux27010.length.ealength " ,
FT_BOOLEAN , 8 , NULL , MUX27010_EA_LENGTH_FLAG , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_lengthframesize_ea ,
2013-06-02 13:45:51 +00:00
{ " Info length " , " mux27010.length.framesize_ea " ,
2011-04-29 14:02:55 +00:00
FT_UINT16 , BASE_DEC , NULL , MUX27010_FRAMESIZE_LENGTH_FLAG_EA , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_lengthframesize ,
2013-06-02 13:45:51 +00:00
{ " Info length " , " mux27010.length.framesize " ,
2011-04-29 14:02:55 +00:00
FT_UINT8 , BASE_DEC , NULL , MUX27010_FRAMESIZE_LENGTH_FLAG , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
/*Control Channel DLCI = 0*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_controlchannel ,
2011-04-29 14:02:55 +00:00
{ " Control Channel " , " mux27010.controlchannel " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
/*Frame Type*/
{ & hf_mux27010_controlchannelframetype ,
{ " Frame Type " , " mux27010.controlchannel.frametype " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneleaframetype ,
{ " EA Flag " , " mux27010.controlchannel.frametype.eatype " ,
FT_BOOLEAN , 8 , NULL , MUX27010_EA_CONTROLCHANNEL_FRAMETYPE_FLAG , NULL , HFILL } } ,
{ & hf_mux27010_controlchannelcrframetype ,
{ " C/R Flag " , " mux27010.controlchannel.frametype.crtype " ,
FT_BOOLEAN , 8 , NULL , MUX27010_CR_CONTROLCHANNEL_FRAMETYPE_FLAG , NULL , HFILL } } ,
{ & hf_mux27010_controlchannelframetypecommand ,
{ " Command Type " , " mux27010.controlchannel.frametype.command " ,
2013-06-02 13:45:51 +00:00
FT_UINT8 , BASE_HEX , VALS ( command_vals ) , MUX27010_COMMAND_CONTROLCHANNEL_FRAMETYPE_FLAG , NULL , HFILL } } ,
2011-04-29 14:02:55 +00:00
/*Length*/
{ & hf_mux27010_controlchannellength ,
{ " Length " , " mux27010.controlchannel.length " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_mux27010_controlchannelealength ,
{ " EA Flag " , " mux27010.controlchannel.length.ealength " ,
FT_BOOLEAN , 8 , NULL , MUX27010_EA_CONTROLCHANNEL_LENGTH_FLAG , NULL , HFILL } } ,
{ & hf_mux27010_controlchannellengthfield ,
{ " Length field " , " mux27010.controlchannel.length.length " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_LENGTHFIELD_CONTROLCHANNEL_LENGTH_FLAG , NULL , HFILL } } ,
/*Value*/
{ & hf_mux27010_controlchannelvalue ,
2013-06-02 13:45:51 +00:00
{ " Value (ASCII) " , " mux27010.controlchannel.value " ,
FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_mux27010_controlchannel_iei_coding ,
{ " IEI coding " , " mux27010.controlchannel.value.iei_coding " ,
FT_UINT8 , BASE_HEX , VALS ( iei_coding_vals ) , 0x0 , NULL , HFILL } } ,
2011-04-29 14:02:55 +00:00
{ & hf_mux27010_controlchanneldetailedvalue ,
{ " Detailed Values " , " mux27010.controlchannel.value.detailedvalues " ,
FT_UINT8 , BASE_HEX , NULL , 0xFF , NULL , HFILL } } ,
2013-06-02 13:45:51 +00:00
{ & hf_mux27010_controlchannel_detailedvalue_response ,
{ " Resposne " , " mux27010.controlchannel.value.detailedvalue.response " ,
FT_UINT8 , BASE_DEC , VALS ( detailedvalue_response_vals ) , 0 , NULL , HFILL } } ,
2011-04-29 14:02:55 +00:00
/*Test Command*/
{ & hf_mux27010_controlchanneldetailedvaluetestcommandversion ,
{ " Version " , " mux27010.controlchannel.value.detailedvaluetestcommandversion " ,
FT_UINT8 , BASE_HEX , NULL , MUX27010_VALUE_CONTROLCHANNEL_TEST_VERSION , NULL , HFILL } } ,
/*Modem Status Command*/
{ & hf_mux27010_controlchanneldetailedvaluemscdlci ,
{ " DLCI number (decimal) " , " mux27010.controlchannel.value.detailedvaluemscdlci " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_VALUE_CONTROLCHANNEL_MSC_DCLI , NULL , HFILL } } ,
2013-01-31 18:35:06 +00:00
#if 0
2011-04-29 14:02:55 +00:00
{ & hf_mux27010_controlchanneldetailedvaluemscv24 ,
{ " V.24 Signal " , " mux27010.controlchannel.value.detailedvaluemscv24 " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2013-01-31 18:35:06 +00:00
# endif
2011-04-29 14:02:55 +00:00
{ & hf_mux27010_controlchanneldetailedvaluemscv24fc ,
{ " FC " , " mux27010.controlchannel.value.detailedvaluemscv24.fc " ,
FT_BOOLEAN , 8 , NULL , MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_FC , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluemscv24rtc ,
{ " RTC " , " mux27010.controlchannel.value.detailedvaluemscv24.rtc " ,
FT_BOOLEAN , 8 , NULL , MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_RTC , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluemscv24rtr ,
{ " RTR " , " mux27010.controlchannel.value.detailedvaluemscv24.rtr " ,
FT_BOOLEAN , 8 , NULL , MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_RTR , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluemscv24ring ,
{ " RING " , " mux27010.controlchannel.value.detailedvaluemscv24.ring " ,
FT_BOOLEAN , 8 , NULL , MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_RING , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluemscv24dcd ,
{ " DCD " , " mux27010.controlchannel.value.detailedvaluemscv24.dcd " ,
FT_BOOLEAN , 8 , NULL , MUX27010_VALUE_CONTROLCHANNEL_MSC_V24_DCD , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluemscbreak ,
{ " Break Signal " , " mux27010.controlchannel.value.detailedvaluemscbreak " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
/*Parameter Negotation*/
{ & hf_mux27010_controlchanneldetailedvaluepndlci ,
{ " DLCI " , " mux27010.controlchannel.value.detailedvaluepndlci " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_VALUE_CONTROLCHANNEL_PN_DLCI , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluepnframetype ,
{ " Frame Type " , " mux27010.controlchannel.value.detailedvaluepnframetype " ,
FT_UINT8 , BASE_HEX , NULL , MUX27010_VALUE_CONTROLCHANNEL_PN_FRAMETYPE , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluepncl ,
{ " Convergence Layer " , " mux27010.controlchannel.value.detailedvaluepncl " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_VALUE_CONTROLCHANNEL_PN_CL , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluepnprio ,
{ " Priority " , " mux27010.controlchannel.value.detailedvaluepnprio " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_VALUE_CONTROLCHANNEL_PN_PRIO , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluepntimer ,
{ " Acknowledgment Timer (ms) " , " mux27010.controlchannel.value.detailedvaluepntimer " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluepnframesize ,
{ " Max. Frame Size " , " mux27010.controlchannel.value.detailedvaluepnframesize " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluepnna ,
{ " Max. Number of Retransmissions " , " mux27010.controlchannel.value.detailedvaluepnna " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_mux27010_controlchanneldetailedvaluepnwinsize ,
{ " Window Size for Error Recovery Mode " , " mux27010.controlchannel.value.detailedvaluepnwinsize " ,
FT_UINT8 , BASE_DEC , NULL , MUX27010_VALUE_CONTROLCHANNEL_PN_WINSIZE , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
/*Information frame*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_information ,
2011-04-29 14:02:55 +00:00
{ " Information field " , " mux27010.information " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2013-06-02 13:45:51 +00:00
{ & hf_mux27010_information_str ,
{ " Information " , " mux27010.information_str " ,
FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
/*Checksum frame*/
2011-04-29 14:02:55 +00:00
2011-04-28 14:48:39 +00:00
{ & hf_mux27010_checksum ,
2011-04-29 14:02:55 +00:00
{ " Checksum " , " mux27010.checksum " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
2013-06-02 13:45:51 +00:00
{ & hf_mux27010_checksum_correct ,
{ " Correct " , " mux27010.checksum_correct " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
2011-04-29 14:02:55 +00:00
{ & hf_msg_fragments ,
{ " Message fragments " , " mux27010.fragments " ,
FT_NONE , BASE_NONE , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_fragment ,
{ " Message fragment " , " mux27010.fragment " ,
FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_fragment_overlap ,
{ " Message fragment overlap " , " mux27010.fragment.overlap " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_fragment_overlap_conflicts ,
{ " Message fragment overlapping with conflicting data " ,
" mux27010.fragment.overlap.conflicts " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_fragment_multiple_tails ,
{ " Message has multiple tail fragments " ,
" mux27010.fragment.multiple_tails " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_fragment_too_long_fragment ,
{ " Message fragment too long " , " mux27010.fragment.too_long_fragment " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_fragment_error ,
{ " Message defragmentation error " , " mux27010.fragment.error " ,
FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_fragment_count ,
{ " Message fragment count " , " mux27010.fragment.count " ,
FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_reassembled_in ,
{ " Reassembled in " , " mux27010.reassembled.in " ,
FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL } } ,
{ & hf_msg_reassembled_length ,
{ " Reassembled length " , " mux27010.reassembled.length " ,
FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL } } ,
2011-04-28 14:48:39 +00:00
} ;
/* Setup protocol subtree array */
static gint * ett [ ] = {
& ett_mux27010_extended_header ,
& ett_mux27010 ,
& ett_mux27010_address ,
& ett_mux27010_control ,
& ett_mux27010_length ,
& ett_mux27010_controlchannel ,
& ett_mux27010_controlchannelframetype ,
& ett_mux27010_controlchannellength ,
& ett_mux27010_controlchannelvalue ,
& ett_mux27010_information ,
& ett_mux27010_checksum ,
& ett_msg_fragment ,
& ett_msg_fragments
} ;
2013-05-27 17:30:43 +00:00
static ei_register_info ei [ ] = {
2013-07-03 02:59:31 +00:00
{ & ei_mux27010_message_illogical , { " mux27010.message_illogical " , PI_MALFORMED , PI_ERROR , " Message start and end are illogical, aborting dissection " , EXPFILL } } ,
2013-06-02 13:45:51 +00:00
{ & ei_mux27010_checksum_incorrect , { " mux27010.checksum_incorrect " , PI_CHECKSUM , PI_WARN , " Checksum: incorrect " , EXPFILL } } ,
2013-05-27 17:30:43 +00:00
} ;
expert_module_t * expert_mux27010 ;
2011-04-28 14:48:39 +00:00
/*Register protocoll*/
proto_mux27010 = proto_register_protocol ( " MUX27010 Protocol " , " MUX27010 " , " mux27010 " ) ;
/*Register arrays*/
proto_register_field_array ( proto_mux27010 , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
2013-08-05 19:09:44 +00:00
mux27010_handle = register_dissector ( " mux27010 " , dissect_mux27010 , proto_mux27010 ) ;
2013-05-27 17:30:43 +00:00
expert_mux27010 = expert_register_protocol ( proto_mux27010 ) ;
expert_register_field_array ( expert_mux27010 , ei , array_length ( ei ) ) ;
2011-04-28 14:48:39 +00:00
register_init_routine ( mux27010_init ) ;
2011-04-28 14:38:29 +00:00
}
/*Initialize dissector*/
void
proto_reg_handoff_mux27010 ( void )
{
2011-04-28 14:48:39 +00:00
/*Initialization of dissector*/
dissector_add_uint ( " wtap_encap " , WTAP_ENCAP_MUX27010 , mux27010_handle ) ;
2011-04-28 14:38:29 +00:00
2011-04-28 14:48:39 +00:00
ppp_handle = find_dissector ( " ppp " ) ;
2011-04-28 14:38:29 +00:00
}