diff options
Diffstat (limited to 'epan/dissectors/packet-dnp.c')
-rw-r--r-- | epan/dissectors/packet-dnp.c | 850 |
1 files changed, 425 insertions, 425 deletions
diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 823809fb..0a01108d 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -27,6 +27,8 @@ #include <epan/expert.h> #include <epan/to_str.h> #include <epan/crc16-tvb.h> +#include <epan/tfs.h> +#include <epan/unit_strings.h> #include <wsutil/crc16.h> #include <wsutil/str_util.h> #include "packet-tls.h" @@ -328,14 +330,14 @@ #define AL_OBJ_2BIC_RTIME 0x0403 /* 04 03 Double-bit Input Change With Relative Time */ /* Binary Input Quality Flags */ -#define AL_OBJ_BI_FLAG0 0x0001 /* Point Online (0=Offline; 1=Online) */ -#define AL_OBJ_BI_FLAG1 0x0002 /* Restart (0=Normal; 1=Restart) */ -#define AL_OBJ_BI_FLAG2 0x0004 /* Comms Lost (0=Normal; 1=Lost) */ -#define AL_OBJ_BI_FLAG3 0x0008 /* Remote Force (0=Normal; 1=Forced) */ -#define AL_OBJ_BI_FLAG4 0x0010 /* Local Force (0=Normal; 1=Forced) */ -#define AL_OBJ_BI_FLAG5 0x0020 /* Chatter Filter (0=Normal; 1=Filter On) */ -#define AL_OBJ_BI_FLAG6 0x0040 /* Double-bit LSB (0=Off; 1=On) */ -#define AL_OBJ_BI_FLAG7 0x0080 /* Point State (0=Off; 1=On) or Double-bit MSB */ +#define AL_OBJ_BI_FLAG0 0x01 /* Point Online (0=Offline; 1=Online) */ +#define AL_OBJ_BI_FLAG1 0x02 /* Restart (0=Normal; 1=Restart) */ +#define AL_OBJ_BI_FLAG2 0x04 /* Comms Lost (0=Normal; 1=Lost) */ +#define AL_OBJ_BI_FLAG3 0x08 /* Remote Force (0=Normal; 1=Forced) */ +#define AL_OBJ_BI_FLAG4 0x10 /* Local Force (0=Normal; 1=Forced) */ +#define AL_OBJ_BI_FLAG5 0x20 /* Chatter Filter (0=Normal; 1=Filter On) */ +#define AL_OBJ_BI_FLAG6 0x40 /* Double-bit LSB (0=Off; 1=On) */ +#define AL_OBJ_BI_FLAG7 0x80 /* Point State (0=Off; 1=On) or Double-bit MSB */ /***************************************************************************/ /* Binary Output Objects */ @@ -391,14 +393,14 @@ #define AL_OBJCTL_STATUS_MASK 0x7F /* Binary Output Quality Flags */ -#define AL_OBJ_BO_FLAG0 0x0001 /* Point Online (0=Offline; 1=Online) */ -#define AL_OBJ_BO_FLAG1 0x0002 /* Restart (0=Normal; 1=Restart) */ -#define AL_OBJ_BO_FLAG2 0x0004 /* Comms Lost (0=Normal; 1=Lost) */ -#define AL_OBJ_BO_FLAG3 0x0008 /* Remote Force (0=Normal; 1=Forced) */ -#define AL_OBJ_BO_FLAG4 0x0010 /* Local Force (0=Normal; 1=Forced) */ -#define AL_OBJ_BO_FLAG5 0x0020 /* Reserved */ -#define AL_OBJ_BO_FLAG6 0x0040 /* Reserved */ -#define AL_OBJ_BO_FLAG7 0x0080 /* Point State (0=Off; 1=On) */ +#define AL_OBJ_BO_FLAG0 0x01 /* Point Online (0=Offline; 1=Online) */ +#define AL_OBJ_BO_FLAG1 0x02 /* Restart (0=Normal; 1=Restart) */ +#define AL_OBJ_BO_FLAG2 0x04 /* Comms Lost (0=Normal; 1=Lost) */ +#define AL_OBJ_BO_FLAG3 0x08 /* Remote Force (0=Normal; 1=Forced) */ +#define AL_OBJ_BO_FLAG4 0x10 /* Local Force (0=Normal; 1=Forced) */ +#define AL_OBJ_BO_FLAG5 0x20 /* Reserved */ +#define AL_OBJ_BO_FLAG6 0x40 /* Reserved */ +#define AL_OBJ_BO_FLAG7 0x80 /* Point State (0=Off; 1=On) */ /***************************************************************************/ /* Counter Objects */ @@ -444,14 +446,14 @@ #define AL_OBJ_FDCTRC_16T 0x1708 /* 23 08 16-Bit Frozen Delta Counter Change Event w/ Time of Freeze */ /* Counter Quality Flags */ -#define AL_OBJ_CTR_FLAG0 0x0001 /* Point Online (0=Offline; 1=Online) */ -#define AL_OBJ_CTR_FLAG1 0x0002 /* Restart (0=Normal; 1=Restart) */ -#define AL_OBJ_CTR_FLAG2 0x0004 /* Comms Lost (0=Normal; 1=Lost) */ -#define AL_OBJ_CTR_FLAG3 0x0008 /* Remote Force (0=Normal; 1=Forced) */ -#define AL_OBJ_CTR_FLAG4 0x0010 /* Local Force (0=Normal; 1=Forced) */ -#define AL_OBJ_CTR_FLAG5 0x0020 /* Roll-over (0=Normal; 1=Roll-Over) */ -#define AL_OBJ_CTR_FLAG6 0x0040 /* Discontinuity (0=Normal; 1=Discontinuity) */ -#define AL_OBJ_CTR_FLAG7 0x0080 /* Reserved */ +#define AL_OBJ_CTR_FLAG0 0x01 /* Point Online (0=Offline; 1=Online) */ +#define AL_OBJ_CTR_FLAG1 0x02 /* Restart (0=Normal; 1=Restart) */ +#define AL_OBJ_CTR_FLAG2 0x04 /* Comms Lost (0=Normal; 1=Lost) */ +#define AL_OBJ_CTR_FLAG3 0x08 /* Remote Force (0=Normal; 1=Forced) */ +#define AL_OBJ_CTR_FLAG4 0x10 /* Local Force (0=Normal; 1=Forced) */ +#define AL_OBJ_CTR_FLAG5 0x20 /* Roll-over (0=Normal; 1=Roll-Over) */ +#define AL_OBJ_CTR_FLAG6 0x40 /* Discontinuity (0=Normal; 1=Discontinuity) */ +#define AL_OBJ_CTR_FLAG7 0x80 /* Reserved */ /***************************************************************************/ /* Analog Input Objects */ @@ -489,14 +491,14 @@ #define AL_OBJ_AIFC_DBLT 0x2108 /* 33 08 64-Bit Floating Point Frozen Change Event w/ Time*/ /* Analog Input Quality Flags */ -#define AL_OBJ_AI_FLAG0 0x0001 /* Point Online (0=Offline; 1=Online) */ -#define AL_OBJ_AI_FLAG1 0x0002 /* Restart (0=Normal; 1=Restart) */ -#define AL_OBJ_AI_FLAG2 0x0004 /* Comms Lost (0=Normal; 1=Lost) */ -#define AL_OBJ_AI_FLAG3 0x0008 /* Remote Force (0=Normal; 1=Forced) */ -#define AL_OBJ_AI_FLAG4 0x0010 /* Local Force (0=Normal; 1=Forced) */ -#define AL_OBJ_AI_FLAG5 0x0020 /* Over-Range (0=Normal; 1=Over-Range) */ -#define AL_OBJ_AI_FLAG6 0x0040 /* Reference Check (0=Normal; 1=Error) */ -#define AL_OBJ_AI_FLAG7 0x0080 /* Reserved */ +#define AL_OBJ_AI_FLAG0 0x01 /* Point Online (0=Offline; 1=Online) */ +#define AL_OBJ_AI_FLAG1 0x02 /* Restart (0=Normal; 1=Restart) */ +#define AL_OBJ_AI_FLAG2 0x04 /* Comms Lost (0=Normal; 1=Lost) */ +#define AL_OBJ_AI_FLAG3 0x08 /* Remote Force (0=Normal; 1=Forced) */ +#define AL_OBJ_AI_FLAG4 0x10 /* Local Force (0=Normal; 1=Forced) */ +#define AL_OBJ_AI_FLAG5 0x20 /* Over-Range (0=Normal; 1=Over-Range) */ +#define AL_OBJ_AI_FLAG6 0x40 /* Reference Check (0=Normal; 1=Error) */ +#define AL_OBJ_AI_FLAG7 0x80 /* Reserved */ #define AL_OBJ_AIDB_ALL 0x2200 /* 34 00 Analog Input Deadband Default Variation */ #define AL_OBJ_AIDB_16 0x2201 /* 34 01 16-Bit Analog Input Deadband */ @@ -533,14 +535,14 @@ #define AL_OBJ_AOC_DBLEVTT 0x2B08 /* 43 08 64-Bit Floating PointAnalog Output Command Event w/ Time */ /* Analog Output Quality Flags */ -#define AL_OBJ_AO_FLAG0 0x0001 /* Point Online (0=Offline; 1=Online) */ -#define AL_OBJ_AO_FLAG1 0x0002 /* Restart (0=Normal; 1=Restart) */ -#define AL_OBJ_AO_FLAG2 0x0004 /* Comms Lost (0=Normal; 1=Lost) */ -#define AL_OBJ_AO_FLAG3 0x0008 /* Remote Force (0=Normal; 1=Forced) */ -#define AL_OBJ_AO_FLAG4 0x0010 /* Local Force (0=Normal; 1=Forced) */ -#define AL_OBJ_AO_FLAG5 0x0020 /* Reserved */ -#define AL_OBJ_AO_FLAG6 0x0040 /* Reserved */ -#define AL_OBJ_AO_FLAG7 0x0080 /* Reserved */ +#define AL_OBJ_AO_FLAG0 0x01 /* Point Online (0=Offline; 1=Online) */ +#define AL_OBJ_AO_FLAG1 0x02 /* Restart (0=Normal; 1=Restart) */ +#define AL_OBJ_AO_FLAG2 0x04 /* Comms Lost (0=Normal; 1=Lost) */ +#define AL_OBJ_AO_FLAG3 0x08 /* Remote Force (0=Normal; 1=Forced) */ +#define AL_OBJ_AO_FLAG4 0x10 /* Local Force (0=Normal; 1=Forced) */ +#define AL_OBJ_AO_FLAG5 0x20 /* Reserved */ +#define AL_OBJ_AO_FLAG6 0x40 /* Reserved */ +#define AL_OBJ_AO_FLAG7 0x80 /* Reserved */ /***************************************************************************/ /* Time Objects */ @@ -625,201 +627,201 @@ void proto_register_dnp3(void); void proto_reg_handoff_dnp3(void); /* Initialize the protocol and registered fields */ -static int proto_dnp3 = -1; -static int hf_dnp3_start = -1; -static int hf_dnp3_len = -1; -static int hf_dnp3_ctl = -1; -static int hf_dnp3_ctl_prifunc = -1; -static int hf_dnp3_ctl_secfunc = -1; -static int hf_dnp3_ctl_dir = -1; -static int hf_dnp3_ctl_prm = -1; -static int hf_dnp3_ctl_fcb = -1; -static int hf_dnp3_ctl_fcv = -1; -static int hf_dnp3_ctl_dfc = -1; -static int hf_dnp3_dst = -1; -static int hf_dnp3_src = -1; -static int hf_dnp3_addr = -1; -static int hf_dnp3_data_hdr_crc = -1; -static int hf_dnp3_data_hdr_crc_status = -1; -static int hf_dnp3_tr_ctl = -1; -static int hf_dnp3_tr_fin = -1; -static int hf_dnp3_tr_fir = -1; -static int hf_dnp3_tr_seq = -1; -static int hf_dnp3_data_chunk = -1; -static int hf_dnp3_data_chunk_len = -1; -static int hf_dnp3_data_chunk_crc = -1; -static int hf_dnp3_data_chunk_crc_status = -1; +static int proto_dnp3; +static int hf_dnp3_start; +static int hf_dnp3_len; +static int hf_dnp3_ctl; +static int hf_dnp3_ctl_prifunc; +static int hf_dnp3_ctl_secfunc; +static int hf_dnp3_ctl_dir; +static int hf_dnp3_ctl_prm; +static int hf_dnp3_ctl_fcb; +static int hf_dnp3_ctl_fcv; +static int hf_dnp3_ctl_dfc; +static int hf_dnp3_dst; +static int hf_dnp3_src; +static int hf_dnp3_addr; +static int hf_dnp3_data_hdr_crc; +static int hf_dnp3_data_hdr_crc_status; +static int hf_dnp3_tr_ctl; +static int hf_dnp3_tr_fin; +static int hf_dnp3_tr_fir; +static int hf_dnp3_tr_seq; +static int hf_dnp3_data_chunk; +static int hf_dnp3_data_chunk_len; +static int hf_dnp3_data_chunk_crc; +static int hf_dnp3_data_chunk_crc_status; /* Added for Application Layer Decoding */ -static int hf_dnp3_al_ctl = -1; -static int hf_dnp3_al_fir = -1; -static int hf_dnp3_al_fin = -1; -static int hf_dnp3_al_con = -1; -static int hf_dnp3_al_uns = -1; -static int hf_dnp3_al_seq = -1; -static int hf_dnp3_al_func = -1; -static int hf_dnp3_al_iin = -1; -static int hf_dnp3_al_iin_bmsg = -1; -static int hf_dnp3_al_iin_cls1d = -1; -static int hf_dnp3_al_iin_cls2d = -1; -static int hf_dnp3_al_iin_cls3d = -1; -static int hf_dnp3_al_iin_tsr = -1; -static int hf_dnp3_al_iin_dol = -1; -static int hf_dnp3_al_iin_dt = -1; -static int hf_dnp3_al_iin_rst = -1; -static int hf_dnp3_al_iin_fcni = -1; -static int hf_dnp3_al_iin_obju = -1; -static int hf_dnp3_al_iin_pioor = -1; -static int hf_dnp3_al_iin_ebo = -1; -static int hf_dnp3_al_iin_oae = -1; -static int hf_dnp3_al_iin_cc = -1; -static int hf_dnp3_al_obj = -1; -static int hf_dnp3_al_objq_prefix = -1; -static int hf_dnp3_al_objq_range = -1; -static int hf_dnp3_al_range_start8 = -1; -static int hf_dnp3_al_range_stop8 = -1; -static int hf_dnp3_al_range_start16 = -1; -static int hf_dnp3_al_range_stop16 = -1; -static int hf_dnp3_al_range_start32 = -1; -static int hf_dnp3_al_range_stop32 = -1; -static int hf_dnp3_al_range_abs8 = -1; -static int hf_dnp3_al_range_abs16 = -1; -static int hf_dnp3_al_range_abs32 = -1; -static int hf_dnp3_al_range_quant8 = -1; -static int hf_dnp3_al_range_quant16 = -1; -static int hf_dnp3_al_range_quant32 = -1; -static int hf_dnp3_al_index8 = -1; -static int hf_dnp3_al_index16 = -1; -static int hf_dnp3_al_index32 = -1; -static int hf_dnp3_al_size8 = -1; -static int hf_dnp3_al_size16 = -1; -static int hf_dnp3_al_size32 = -1; -static int hf_dnp3_bocs_bit = -1; - -/*static int hf_dnp3_al_objq = -1; - static int hf_dnp3_al_nobj = -1; */ +static int hf_dnp3_al_ctl; +static int hf_dnp3_al_fir; +static int hf_dnp3_al_fin; +static int hf_dnp3_al_con; +static int hf_dnp3_al_uns; +static int hf_dnp3_al_seq; +static int hf_dnp3_al_func; +static int hf_dnp3_al_iin; +static int hf_dnp3_al_iin_bmsg; +static int hf_dnp3_al_iin_cls1d; +static int hf_dnp3_al_iin_cls2d; +static int hf_dnp3_al_iin_cls3d; +static int hf_dnp3_al_iin_tsr; +static int hf_dnp3_al_iin_dol; +static int hf_dnp3_al_iin_dt; +static int hf_dnp3_al_iin_rst; +static int hf_dnp3_al_iin_fcni; +static int hf_dnp3_al_iin_obju; +static int hf_dnp3_al_iin_pioor; +static int hf_dnp3_al_iin_ebo; +static int hf_dnp3_al_iin_oae; +static int hf_dnp3_al_iin_cc; +static int hf_dnp3_al_obj; +static int hf_dnp3_al_objq_prefix; +static int hf_dnp3_al_objq_range; +static int hf_dnp3_al_range_start8; +static int hf_dnp3_al_range_stop8; +static int hf_dnp3_al_range_start16; +static int hf_dnp3_al_range_stop16; +static int hf_dnp3_al_range_start32; +static int hf_dnp3_al_range_stop32; +static int hf_dnp3_al_range_abs8; +static int hf_dnp3_al_range_abs16; +static int hf_dnp3_al_range_abs32; +static int hf_dnp3_al_range_quant8; +static int hf_dnp3_al_range_quant16; +static int hf_dnp3_al_range_quant32; +static int hf_dnp3_al_index8; +static int hf_dnp3_al_index16; +static int hf_dnp3_al_index32; +static int hf_dnp3_al_size8; +static int hf_dnp3_al_size16; +static int hf_dnp3_al_size32; +static int hf_dnp3_bocs_bit; + +/* static int hf_dnp3_al_objq;*/ +/* static int hf_dnp3_al_nobj; */ /* XXX - unused -static int hf_dnp3_al_ptnum = -1; */ -static int hf_dnp3_al_biq_b0 = -1; -static int hf_dnp3_al_biq_b1 = -1; -static int hf_dnp3_al_biq_b2 = -1; -static int hf_dnp3_al_biq_b3 = -1; -static int hf_dnp3_al_biq_b4 = -1; -static int hf_dnp3_al_biq_b5 = -1; -static int hf_dnp3_al_biq_b6 = -1; -static int hf_dnp3_al_biq_b7 = -1; -static int hf_dnp3_al_boq_b0 = -1; -static int hf_dnp3_al_boq_b1 = -1; -static int hf_dnp3_al_boq_b2 = -1; -static int hf_dnp3_al_boq_b3 = -1; -static int hf_dnp3_al_boq_b4 = -1; -static int hf_dnp3_al_boq_b5 = -1; -static int hf_dnp3_al_boq_b6 = -1; -static int hf_dnp3_al_boq_b7 = -1; -static int hf_dnp3_al_ctrq_b0 = -1; -static int hf_dnp3_al_ctrq_b1 = -1; -static int hf_dnp3_al_ctrq_b2 = -1; -static int hf_dnp3_al_ctrq_b3 = -1; -static int hf_dnp3_al_ctrq_b4 = -1; -static int hf_dnp3_al_ctrq_b5 = -1; -static int hf_dnp3_al_ctrq_b6 = -1; -static int hf_dnp3_al_ctrq_b7 = -1; -static int hf_dnp3_al_aiq_b0 = -1; -static int hf_dnp3_al_aiq_b1 = -1; -static int hf_dnp3_al_aiq_b2 = -1; -static int hf_dnp3_al_aiq_b3 = -1; -static int hf_dnp3_al_aiq_b4 = -1; -static int hf_dnp3_al_aiq_b5 = -1; -static int hf_dnp3_al_aiq_b6 = -1; -static int hf_dnp3_al_aiq_b7 = -1; -static int hf_dnp3_al_aoq_b0 = -1; -static int hf_dnp3_al_aoq_b1 = -1; -static int hf_dnp3_al_aoq_b2 = -1; -static int hf_dnp3_al_aoq_b3 = -1; -static int hf_dnp3_al_aoq_b4 = -1; -static int hf_dnp3_al_aoq_b5 = -1; -static int hf_dnp3_al_aoq_b6 = -1; -static int hf_dnp3_al_aoq_b7 = -1; -static int hf_dnp3_al_timestamp = -1; -static int hf_dnp3_al_file_perms = -1; -static int hf_dnp3_al_file_perms_read_owner = -1; -static int hf_dnp3_al_file_perms_write_owner = -1; -static int hf_dnp3_al_file_perms_exec_owner = -1; -static int hf_dnp3_al_file_perms_read_group = -1; -static int hf_dnp3_al_file_perms_write_group = -1; -static int hf_dnp3_al_file_perms_exec_group = -1; -static int hf_dnp3_al_file_perms_read_world = -1; -static int hf_dnp3_al_file_perms_write_world = -1; -static int hf_dnp3_al_file_perms_exec_world = -1; -static int hf_dnp3_al_rel_timestamp = -1; -static int hf_dnp3_al_ana16 = -1; -static int hf_dnp3_al_ana32 = -1; -static int hf_dnp3_al_anaflt = -1; -static int hf_dnp3_al_anadbl = -1; -static int hf_dnp3_al_bit = -1; -static int hf_dnp3_al_2bit = -1; -static int hf_dnp3_al_cnt16 = -1; -static int hf_dnp3_al_cnt32 = -1; -static int hf_dnp3_al_ctrlstatus = -1; -static int hf_dnp3_al_anaout16 = -1; -static int hf_dnp3_al_anaout32 = -1; -static int hf_dnp3_al_anaoutflt = -1; -static int hf_dnp3_al_anaoutdbl = -1; -static int hf_dnp3_al_file_mode = -1; -static int hf_dnp3_al_file_auth = -1; -static int hf_dnp3_al_file_size = -1; -static int hf_dnp3_al_file_maxblk = -1; -static int hf_dnp3_al_file_reqID = -1; -static int hf_dnp3_al_file_handle = -1; -static int hf_dnp3_al_file_status = -1; -static int hf_dnp3_al_file_blocknum = -1; -static int hf_dnp3_al_file_lastblock = -1; -static int hf_dnp3_al_file_data = -1; -static int hf_dnp3_ctlobj_code_c = -1; -static int hf_dnp3_ctlobj_code_m = -1; -static int hf_dnp3_ctlobj_code_tc = -1; -static int hf_dnp3_al_datatype = -1; -static int hf_dnp3_al_da_length = -1; -static int hf_dnp3_al_da_uint8 = -1; -static int hf_dnp3_al_da_uint16 = -1; -static int hf_dnp3_al_da_uint32 = -1; -static int hf_dnp3_al_da_int8 = -1; -static int hf_dnp3_al_da_int16 = -1; -static int hf_dnp3_al_da_int32 = -1; -static int hf_dnp3_al_da_flt = -1; -static int hf_dnp3_al_da_dbl = -1; -static int hf_dnp3_al_sa_cd = -1; -static int hf_dnp3_al_sa_cdl = -1; -static int hf_dnp3_al_sa_csq = -1; -static int hf_dnp3_al_sa_err = -1; -static int hf_dnp3_al_sa_key = -1; -static int hf_dnp3_al_sa_kcm = -1; -static int hf_dnp3_al_sa_ks = -1; -static int hf_dnp3_al_sa_ksq = -1; -static int hf_dnp3_al_sa_kwa = -1; -static int hf_dnp3_al_sa_mac = -1; -static int hf_dnp3_al_sa_mal = -1; -static int hf_dnp3_al_sa_rfc = -1; -static int hf_dnp3_al_sa_seq = -1; -static int hf_dnp3_al_sa_uk = -1; -static int hf_dnp3_al_sa_ukl = -1; -static int hf_dnp3_al_sa_usr = -1; -static int hf_dnp3_al_sa_usrn = -1; -static int hf_dnp3_al_sa_usrnl = -1; -static int hf_dnp3_al_sa_assoc_id = -1; +static int hf_dnp3_al_ptnum; */ +static int hf_dnp3_al_biq_b0; +static int hf_dnp3_al_biq_b1; +static int hf_dnp3_al_biq_b2; +static int hf_dnp3_al_biq_b3; +static int hf_dnp3_al_biq_b4; +static int hf_dnp3_al_biq_b5; +static int hf_dnp3_al_biq_b6; +static int hf_dnp3_al_biq_b7; +static int hf_dnp3_al_boq_b0; +static int hf_dnp3_al_boq_b1; +static int hf_dnp3_al_boq_b2; +static int hf_dnp3_al_boq_b3; +static int hf_dnp3_al_boq_b4; +static int hf_dnp3_al_boq_b5; +static int hf_dnp3_al_boq_b6; +static int hf_dnp3_al_boq_b7; +static int hf_dnp3_al_ctrq_b0; +static int hf_dnp3_al_ctrq_b1; +static int hf_dnp3_al_ctrq_b2; +static int hf_dnp3_al_ctrq_b3; +static int hf_dnp3_al_ctrq_b4; +static int hf_dnp3_al_ctrq_b5; +static int hf_dnp3_al_ctrq_b6; +static int hf_dnp3_al_ctrq_b7; +static int hf_dnp3_al_aiq_b0; +static int hf_dnp3_al_aiq_b1; +static int hf_dnp3_al_aiq_b2; +static int hf_dnp3_al_aiq_b3; +static int hf_dnp3_al_aiq_b4; +static int hf_dnp3_al_aiq_b5; +static int hf_dnp3_al_aiq_b6; +static int hf_dnp3_al_aiq_b7; +static int hf_dnp3_al_aoq_b0; +static int hf_dnp3_al_aoq_b1; +static int hf_dnp3_al_aoq_b2; +static int hf_dnp3_al_aoq_b3; +static int hf_dnp3_al_aoq_b4; +static int hf_dnp3_al_aoq_b5; +static int hf_dnp3_al_aoq_b6; +static int hf_dnp3_al_aoq_b7; +static int hf_dnp3_al_timestamp; +static int hf_dnp3_al_file_perms; +static int hf_dnp3_al_file_perms_read_owner; +static int hf_dnp3_al_file_perms_write_owner; +static int hf_dnp3_al_file_perms_exec_owner; +static int hf_dnp3_al_file_perms_read_group; +static int hf_dnp3_al_file_perms_write_group; +static int hf_dnp3_al_file_perms_exec_group; +static int hf_dnp3_al_file_perms_read_world; +static int hf_dnp3_al_file_perms_write_world; +static int hf_dnp3_al_file_perms_exec_world; +static int hf_dnp3_al_rel_timestamp; +static int hf_dnp3_al_ana16; +static int hf_dnp3_al_ana32; +static int hf_dnp3_al_anaflt; +static int hf_dnp3_al_anadbl; +static int hf_dnp3_al_bit; +static int hf_dnp3_al_2bit; +static int hf_dnp3_al_cnt16; +static int hf_dnp3_al_cnt32; +static int hf_dnp3_al_ctrlstatus; +static int hf_dnp3_al_anaout16; +static int hf_dnp3_al_anaout32; +static int hf_dnp3_al_anaoutflt; +static int hf_dnp3_al_anaoutdbl; +static int hf_dnp3_al_file_mode; +static int hf_dnp3_al_file_auth; +static int hf_dnp3_al_file_size; +static int hf_dnp3_al_file_maxblk; +static int hf_dnp3_al_file_reqID; +static int hf_dnp3_al_file_handle; +static int hf_dnp3_al_file_status; +static int hf_dnp3_al_file_blocknum; +static int hf_dnp3_al_file_lastblock; +static int hf_dnp3_al_file_data; +static int hf_dnp3_ctlobj_code_c; +static int hf_dnp3_ctlobj_code_m; +static int hf_dnp3_ctlobj_code_tc; +static int hf_dnp3_al_datatype; +static int hf_dnp3_al_da_length; +static int hf_dnp3_al_da_uint8; +static int hf_dnp3_al_da_uint16; +static int hf_dnp3_al_da_uint32; +static int hf_dnp3_al_da_int8; +static int hf_dnp3_al_da_int16; +static int hf_dnp3_al_da_int32; +static int hf_dnp3_al_da_flt; +static int hf_dnp3_al_da_dbl; +static int hf_dnp3_al_sa_cd; +static int hf_dnp3_al_sa_cdl; +static int hf_dnp3_al_sa_csq; +static int hf_dnp3_al_sa_err; +static int hf_dnp3_al_sa_key; +static int hf_dnp3_al_sa_kcm; +static int hf_dnp3_al_sa_ks; +static int hf_dnp3_al_sa_ksq; +static int hf_dnp3_al_sa_kwa; +static int hf_dnp3_al_sa_mac; +static int hf_dnp3_al_sa_mal; +static int hf_dnp3_al_sa_rfc; +static int hf_dnp3_al_sa_seq; +static int hf_dnp3_al_sa_uk; +static int hf_dnp3_al_sa_ukl; +static int hf_dnp3_al_sa_usr; +static int hf_dnp3_al_sa_usrn; +static int hf_dnp3_al_sa_usrnl; +static int hf_dnp3_al_sa_assoc_id; /* Generated from convert_proto_tree_add_text.pl */ -static int hf_dnp3_al_point_index = -1; -static int hf_dnp3_al_da_value = -1; -static int hf_dnp3_al_count = -1; -static int hf_dnp3_al_on_time = -1; -static int hf_dnp3_al_off_time = -1; -static int hf_dnp3_al_time_delay = -1; -static int hf_dnp3_al_file_string_offset = -1; -static int hf_dnp3_al_file_string_length = -1; -static int hf_dnp3_al_file_name = -1; -static int hf_dnp3_al_octet_string = -1; -static int hf_dnp3_unknown_data_chunk = -1; +static int hf_dnp3_al_point_index; +static int hf_dnp3_al_da_value; +static int hf_dnp3_al_count; +static int hf_dnp3_al_on_time; +static int hf_dnp3_al_off_time; +static int hf_dnp3_al_time_delay; +static int hf_dnp3_al_file_string_offset; +static int hf_dnp3_al_file_string_length; +static int hf_dnp3_al_file_name; +static int hf_dnp3_al_octet_string; +static int hf_dnp3_unknown_data_chunk; /***************************************************************************/ /* Value String Look-Ups */ @@ -1412,7 +1414,7 @@ static const value_string dnp3_al_sa_err_vals[] = { { 2, "Unexpected Response" }, { 3, "No response" }, { 4, "Aggressive Mode not supported" }, - { 5, "MAC Algorithm not supproted" }, + { 5, "MAC Algorithm not supported" }, { 6, "Key Wrap Algorithm not supported" }, { 7, "Authorization failed" }, { 8, "Update Key Change Method not permitted" }, @@ -1475,37 +1477,37 @@ static const value_string dnp3_al_sa_secstat_vals[] = { static value_string_ext dnp3_al_sa_secstat_vals_ext = VALUE_STRING_EXT_INIT(dnp3_al_sa_secstat_vals); /* Initialize the subtree pointers */ -static gint ett_dnp3 = -1; -static gint ett_dnp3_dl = -1; -static gint ett_dnp3_dl_ctl = -1; -static gint ett_dnp3_tr_ctl = -1; -static gint ett_dnp3_dl_data = -1; -static gint ett_dnp3_dl_chunk = -1; -static gint ett_dnp3_al = -1; -static gint ett_dnp3_al_ctl = -1; -static gint ett_dnp3_al_obj_point_tcc = -1; +static int ett_dnp3; +static int ett_dnp3_dl; +static int ett_dnp3_dl_ctl; +static int ett_dnp3_tr_ctl; +static int ett_dnp3_dl_data; +static int ett_dnp3_dl_chunk; +static int ett_dnp3_al; +static int ett_dnp3_al_ctl; +static int ett_dnp3_al_obj_point_tcc; /* Added for Application Layer Decoding */ -static gint ett_dnp3_al_iin = -1; -static gint ett_dnp3_al_obj = -1; -static gint ett_dnp3_al_obj_qualifier = -1; -static gint ett_dnp3_al_obj_range = -1; -static gint ett_dnp3_al_objdet = -1; -static gint ett_dnp3_al_obj_quality = -1; -static gint ett_dnp3_al_obj_point = -1; -static gint ett_dnp3_al_obj_point_perms = -1; - -static expert_field ei_dnp_num_items_neg = EI_INIT; -static expert_field ei_dnp_invalid_length = EI_INIT; -static expert_field ei_dnp_iin_abnormal = EI_INIT; -static expert_field ei_dnp3_data_hdr_crc_incorrect = EI_INIT; -static expert_field ei_dnp3_data_chunk_crc_incorrect = EI_INIT; -static expert_field ei_dnp3_unknown_object = EI_INIT; -static expert_field ei_dnp3_unknown_group0_variation = EI_INIT; -static expert_field ei_dnp3_num_items_invalid = EI_INIT; +static int ett_dnp3_al_iin; +static int ett_dnp3_al_obj; +static int ett_dnp3_al_obj_qualifier; +static int ett_dnp3_al_obj_range; +static int ett_dnp3_al_objdet; +static int ett_dnp3_al_obj_quality; +static int ett_dnp3_al_obj_point; +static int ett_dnp3_al_obj_point_perms; + +static expert_field ei_dnp_num_items_neg; +static expert_field ei_dnp_invalid_length; +static expert_field ei_dnp_iin_abnormal; +static expert_field ei_dnp3_data_hdr_crc_incorrect; +static expert_field ei_dnp3_data_chunk_crc_incorrect; +static expert_field ei_dnp3_unknown_object; +static expert_field ei_dnp3_unknown_group0_variation; +static expert_field ei_dnp3_num_items_invalid; /* Generated from convert_proto_tree_add_text.pl */ #if 0 -static expert_field ei_dnp3_buffering_user_data_until_final_frame_is_received = EI_INIT; +static expert_field ei_dnp3_buffering_user_data_until_final_frame_is_received; #endif /* Tables for reassembly of fragments. */ @@ -1514,19 +1516,19 @@ static reassembly_table al_reassembly_table; /* ************************************************************************* */ /* Header values for reassembly */ /* ************************************************************************* */ -static int hf_al_frag_data = -1; -static int hf_dnp3_fragment = -1; -static int hf_dnp3_fragments = -1; -static int hf_dnp3_fragment_overlap = -1; -static int hf_dnp3_fragment_overlap_conflict = -1; -static int hf_dnp3_fragment_multiple_tails = -1; -static int hf_dnp3_fragment_too_long_fragment = -1; -static int hf_dnp3_fragment_error = -1; -static int hf_dnp3_fragment_count = -1; -static int hf_dnp3_fragment_reassembled_in = -1; -static int hf_dnp3_fragment_reassembled_length = -1; -static gint ett_dnp3_fragment = -1; -static gint ett_dnp3_fragments = -1; +static int hf_al_frag_data; +static int hf_dnp3_fragment; +static int hf_dnp3_fragments; +static int hf_dnp3_fragment_overlap; +static int hf_dnp3_fragment_overlap_conflict; +static int hf_dnp3_fragment_multiple_tails; +static int hf_dnp3_fragment_too_long_fragment; +static int hf_dnp3_fragment_error; +static int hf_dnp3_fragment_count; +static int hf_dnp3_fragment_reassembled_in; +static int hf_dnp3_fragment_reassembled_length; +static int ett_dnp3_fragment; +static int ett_dnp3_fragments; static dissector_handle_t dnp3_tcp_handle; static dissector_handle_t dnp3_udp_handle; @@ -1550,7 +1552,7 @@ static const fragment_items dnp3_frag_items = { }; /* desegmentation of DNP3 over TCP */ -static gboolean dnp3_desegment = TRUE; +static bool dnp3_desegment = true; /* Enum for different quality type fields */ enum QUALITY_TYPE { @@ -1562,16 +1564,16 @@ enum QUALITY_TYPE { }; /* calculates crc given a buffer of characters and a length of buffer */ -static guint16 -calculateCRC(const void *buf, guint len) { - guint16 crc = crc16_0x3D65_seed((const guint8 *)buf, len, 0); +static uint16_t +calculateCRC(const void *buf, unsigned len) { + uint16_t crc = crc16_0x3D65_seed((const uint8_t *)buf, len, 0); return ~crc; } /* calculates crc given a tvbuff, offset, and length */ -static guint16 -calculateCRCtvb(tvbuff_t *tvb, guint offset, guint len) { - guint16 crc = crc16_0x3D65_tvb_offset_seed(tvb, offset, len, 0); +static uint16_t +calculateCRCtvb(tvbuff_t *tvb, unsigned offset, unsigned len) { + uint16_t crc = crc16_0x3D65_tvb_offset_seed(tvb, offset, len, 0); return ~crc; } @@ -1581,7 +1583,7 @@ calculateCRCtvb(tvbuff_t *tvb, guint offset, guint len) { static void dnp3_al_process_iin(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *al_tree) { - guint16 al_iin; + uint16_t al_iin; proto_item *tiin; static int* const indications[] = { &hf_dnp3_al_iin_rst, @@ -1616,7 +1618,7 @@ dnp3_al_process_iin(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *a /* and Point address. */ /**************************************************************/ static int -dnp3_al_obj_procprefix(tvbuff_t *tvb, int offset, guint8 al_objq_prefix, guint32 *al_ptaddr, proto_tree *item_tree) +dnp3_al_obj_procprefix(tvbuff_t *tvb, int offset, uint8_t al_objq_prefix, uint32_t *al_ptaddr, proto_tree *item_tree) { int prefixbytes = 0; proto_item *prefix_item; @@ -1629,7 +1631,7 @@ dnp3_al_obj_procprefix(tvbuff_t *tvb, int offset, guint8 al_objq_prefix, guint32 proto_item_set_generated(prefix_item); break; case AL_OBJQL_PREFIX_1O: - *al_ptaddr = tvb_get_guint8(tvb, offset); + *al_ptaddr = tvb_get_uint8(tvb, offset); proto_tree_add_item(item_tree, hf_dnp3_al_index8, tvb, offset, 1, ENC_LITTLE_ENDIAN); prefixbytes = 1; break; @@ -1644,7 +1646,7 @@ dnp3_al_obj_procprefix(tvbuff_t *tvb, int offset, guint8 al_objq_prefix, guint32 prefixbytes = 4; break; case AL_OBJQL_PREFIX_1OS: - *al_ptaddr = tvb_get_guint8(tvb, offset); + *al_ptaddr = tvb_get_uint8(tvb, offset); proto_tree_add_item(item_tree, hf_dnp3_al_size8, tvb, offset, 1, ENC_LITTLE_ENDIAN); prefixbytes = 1; break; @@ -1666,7 +1668,7 @@ dnp3_al_obj_procprefix(tvbuff_t *tvb, int offset, guint8 al_objq_prefix, guint32 /* Function to add the same string to two separate tree items */ /*****************************************************************/ static void -dnp3_append_2item_text(proto_item *item1, proto_item *item2, const gchar *text) +dnp3_append_2item_text(proto_item *item1, proto_item *item2, const char *text) { proto_item_append_text(item1, "%s", text); proto_item_append_text(item2, "%s", text); @@ -1677,7 +1679,7 @@ dnp3_append_2item_text(proto_item *item1, proto_item *item2, const gchar *text) /* add Point Quality Flag Sub-Tree */ /*****************************************************************/ static void -dnp3_al_obj_quality(tvbuff_t *tvb, int offset, guint8 al_ptflags, proto_tree *point_tree, proto_item *point_item, enum QUALITY_TYPE type) +dnp3_al_obj_quality(tvbuff_t *tvb, int offset, uint8_t al_ptflags, proto_tree *point_tree, proto_item *point_item, enum QUALITY_TYPE type) { proto_tree *quality_tree; @@ -1791,23 +1793,23 @@ static void dnp3_al_get_timestamp(nstime_t *timestamp, tvbuff_t *tvb, int data_pos) { - guint32 hi, lo; - guint64 time_ms; + uint32_t hi, lo; + uint64_t time_ms; lo = tvb_get_letohs(tvb, data_pos); hi = tvb_get_letohl(tvb, data_pos + 2); - time_ms = (guint64)hi * 0x10000 + lo; + time_ms = (uint64_t)hi * 0x10000 + lo; timestamp->secs = (long)(time_ms / 1000); timestamp->nsecs = (int)(time_ms % 1000) * 1000000; } -static gboolean -dnp3_al_empty_obj(guint16 al_obj) +static bool +dnp3_al_empty_obj(uint16_t al_obj) { - /* return a TRUE if we expect an empty object (default var, class object, etc) */ + /* return a true if we expect an empty object (default var, class object, etc) */ switch (al_obj) { case AL_OBJ_BI_ALL: /* Binary Input Default Variation (Obj:01, Var:Default) */ @@ -1825,11 +1827,9 @@ dnp3_al_empty_obj(guint16 al_obj) case AL_OBJ_CLASS1: case AL_OBJ_CLASS2: case AL_OBJ_CLASS3: - return TRUE; - break; + return true; default: - return FALSE; - break; + return false; } } @@ -1839,18 +1839,18 @@ dnp3_al_empty_obj(guint16 al_obj) /*****************************************************************/ static int dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, - proto_tree *robj_tree, gboolean header_only, - guint16 *al_objtype, nstime_t *al_cto) + proto_tree *robj_tree, bool header_only, + uint16_t *al_objtype, nstime_t *al_cto) { - guint8 al_objq, al_objq_prefix, al_objq_range, al_oct_len = 0, bitindex; - guint16 al_obj, temp; - guint32 al_ptaddr = 0; + uint8_t al_objq, al_objq_prefix, al_objq_range, al_oct_len = 0, bitindex; + uint16_t al_obj, temp; + uint32_t al_ptaddr = 0; int num_items = 0; int orig_offset, rangebytes = 0; proto_item *object_item, *range_item; proto_tree *object_tree, *qualifier_tree, *range_tree; - const gchar *sec_stat_str; + const char *sec_stat_str; orig_offset = offset; /* Application Layer Objects in this Message */ @@ -1867,7 +1867,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, /* Special handling for Aggressive Mode Requests (Obj:120, Var3) and Message Authentication Codes (Obj:120, Var:9) objects that occur in read messages and require full dissection */ if ((al_obj == AL_OBJ_SA_AUTH_AGMRQ) || (al_obj == AL_OBJ_SA_AUTH_MAC)) { - header_only = FALSE; + header_only = false; } /* Create Data Objects Detail Tree */ @@ -1901,7 +1901,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, offset += 2; /* Object Qualifier */ - al_objq = tvb_get_guint8(tvb, offset); + al_objq = tvb_get_uint8(tvb, offset); al_objq_prefix = al_objq & AL_OBJQ_PREFIX; al_objq_prefix = al_objq_prefix >> 4; al_objq_range = al_objq & AL_OBJQ_RANGE; @@ -1921,9 +1921,9 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, switch (al_objq_range) { case AL_OBJQL_RANGE_SSI8: /* 8-bit Start and Stop Indices in Range Field */ - num_items = ( tvb_get_guint8(tvb, offset+1) - tvb_get_guint8(tvb, offset) + 1); + num_items = ( tvb_get_uint8(tvb, offset+1) - tvb_get_uint8(tvb, offset) + 1); proto_item_set_generated(range_item); - al_ptaddr = tvb_get_guint8(tvb, offset); + al_ptaddr = tvb_get_uint8(tvb, offset); proto_tree_add_item(range_tree, hf_dnp3_al_range_start8, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(range_tree, hf_dnp3_al_range_stop8, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN); rangebytes = 2; @@ -1947,7 +1947,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJQL_RANGE_AA8: /* 8-bit Absolute Address in Range Field */ num_items = 1; proto_item_set_generated(range_item); - al_ptaddr = tvb_get_guint8(tvb, offset); + al_ptaddr = tvb_get_uint8(tvb, offset); proto_tree_add_item(range_tree, hf_dnp3_al_range_abs8, tvb, offset, 1, ENC_LITTLE_ENDIAN); rangebytes = 1; break; @@ -1966,7 +1966,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, rangebytes = 4; break; case AL_OBJQL_RANGE_SF8: /* 8-bit Single Field Quantity in Range Field */ - num_items = tvb_get_guint8(tvb, offset); + num_items = tvb_get_uint8(tvb, offset); proto_tree_add_item(range_tree, hf_dnp3_al_range_quant8, tvb, offset, 1, ENC_LITTLE_ENDIAN); rangebytes = 1; proto_item_set_len(range_item, rangebytes); @@ -1984,7 +1984,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_item_set_len(range_item, rangebytes); break; case AL_OBJQL_RANGE_FF: /* 8 bit object count in Range Field */ - num_items = tvb_get_guint8(tvb, offset); + num_items = tvb_get_uint8(tvb, offset); proto_tree_add_item(range_tree, hf_dnp3_al_range_quant8, tvb, offset, 1, ENC_LITTLE_ENDIAN); rangebytes = 1; proto_item_set_len(range_item, rangebytes); @@ -2017,7 +2017,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, { proto_item *point_item; proto_tree *point_tree; - guint data_pos; + unsigned data_pos; int prefixbytes; /* Create Point item and process prefix */ @@ -2045,23 +2045,23 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, if (!header_only || (AL_OBJQL_PREFIX_1OS <= al_objq_prefix && al_objq_prefix <= AL_OBJQL_PREFIX_4OS)) { /* Process the object values */ - guint8 al_2bit, al_ptflags, al_bi_val, al_tcc_code, al_sa_mac_len; - gint16 al_val_int16; - guint16 al_val_uint16, al_ctlobj_stat; - guint16 al_relms, al_filename_len, al_file_ctrl_mode; - guint16 sa_username_len, sa_challengedata_len, sa_updatekey_len; - gint32 al_val_int32; - guint32 al_val_uint32, file_data_size; + uint8_t al_2bit, al_ptflags, al_bi_val, al_tcc_code, al_sa_mac_len; + int16_t al_val_int16; + uint16_t al_val_uint16, al_ctlobj_stat; + uint16_t al_relms, al_filename_len, al_file_ctrl_mode; + uint16_t sa_username_len, sa_challengedata_len, sa_updatekey_len; + int32_t al_val_int32; + uint32_t al_val_uint32, file_data_size; nstime_t al_reltime, al_abstime; - gboolean al_bit; - gfloat al_valflt; - gdouble al_valdbl; - const gchar *ctl_status_str; + bool al_bit; + float al_valflt; + double al_valdbl; + const char *ctl_status_str; /* Device Attributes (g0) all have a type code, use that rather than the individual variation */ if (AL_OBJ_GROUP(al_obj) == 0x0) { - guint32 data_type; - guint8 da_len; + uint32_t data_type; + uint8_t da_len; /* Add and retrieve the data type */ proto_tree_add_item_ret_uint(point_tree, hf_dnp3_al_datatype, tvb, data_pos, 1, ENC_LITTLE_ENDIAN, &data_type); @@ -2073,21 +2073,21 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_DATA_TYPE_NONE: break; case AL_DATA_TYPE_VSTR: - da_len = tvb_get_guint8(tvb, data_pos); + da_len = tvb_get_uint8(tvb, data_pos); proto_tree_add_item(point_tree, hf_dnp3_al_da_length, tvb, data_pos, 1, ENC_LITTLE_ENDIAN); data_pos++; - const guint8* da_value; + const uint8_t* da_value; proto_tree_add_item_ret_string(point_tree, hf_dnp3_al_da_value, tvb, data_pos, da_len, ENC_ASCII|ENC_NA, pinfo->pool, &da_value); proto_item_append_text(object_item, ", Value: %s", da_value); data_pos += da_len; break; case AL_DATA_TYPE_UINT: - da_len = tvb_get_guint8(tvb, data_pos); + da_len = tvb_get_uint8(tvb, data_pos); proto_tree_add_item(point_tree, hf_dnp3_al_da_length, tvb, data_pos, 1, ENC_LITTLE_ENDIAN); data_pos++; if (da_len == 1) { proto_tree_add_item(point_tree, hf_dnp3_al_da_uint8, tvb, data_pos, 1, ENC_LITTLE_ENDIAN); - proto_item_append_text(object_item, ", Value: %u", tvb_get_guint8(tvb, data_pos)); + proto_item_append_text(object_item, ", Value: %u", tvb_get_uint8(tvb, data_pos)); data_pos++; } else if (da_len == 2) { @@ -2102,12 +2102,12 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, } break; case AL_DATA_TYPE_INT: - da_len = tvb_get_guint8(tvb, data_pos); + da_len = tvb_get_uint8(tvb, data_pos); proto_tree_add_item(point_tree, hf_dnp3_al_da_length, tvb, data_pos, 1, ENC_LITTLE_ENDIAN); data_pos++; if (da_len == 1) { proto_tree_add_item(point_tree, hf_dnp3_al_da_int8, tvb, data_pos, 1, ENC_LITTLE_ENDIAN); - proto_item_append_text(object_item, ", Value: %d", tvb_get_guint8(tvb, data_pos)); + proto_item_append_text(object_item, ", Value: %d", tvb_get_uint8(tvb, data_pos)); data_pos++; } else if (da_len == 2) { @@ -2122,7 +2122,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, } break; case AL_DATA_TYPE_FLT: - da_len = tvb_get_guint8(tvb, data_pos); + da_len = tvb_get_uint8(tvb, data_pos); proto_tree_add_item(point_tree, hf_dnp3_al_da_length, tvb, data_pos, 1, ENC_LITTLE_ENDIAN); data_pos++; if (da_len == 4) { @@ -2185,11 +2185,11 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_IIN: /* Internal Indications - IIN (Obj: 80, Var:01) */ /* Extract the bit from the packed byte */ - al_bi_val = tvb_get_guint8(tvb, data_pos); + al_bi_val = tvb_get_uint8(tvb, data_pos); al_bit = (al_bi_val & 1) > 0; if (al_obj == AL_OBJ_IIN) { /* For an IIN bit, work out the IIN constant value for the bit position to get the name of the bit */ - guint16 iin_bit = 0; + uint16_t iin_bit = 0; if (al_ptaddr < 8) { iin_bit = 0x100 << al_ptaddr; } @@ -2236,7 +2236,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, } /* Extract the Double-bit from the packed byte */ - al_bi_val = tvb_get_guint8(tvb, offset); + al_bi_val = tvb_get_uint8(tvb, offset); al_2bit = ((al_bi_val >> (bitindex << 1)) & 3); proto_item_append_text(point_item, ", Value: %u", al_2bit); @@ -2259,7 +2259,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_BOC_NOTIME: /* Binary Output Change Without Time (Obj:11, Var:01) */ /* Get Point Flags */ - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); switch (al_obj) { case AL_OBJ_BI_STAT: @@ -2285,7 +2285,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_2BIC_NOTIME: /* Double-bit Input Change Without Time (Obj:04, Var:01) */ /* Get Point Flags */ - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); dnp3_al_obj_quality(tvb, data_pos, al_ptflags, point_tree, point_item, BIN_IN); data_pos += 1; @@ -2300,7 +2300,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_BOC_TIME: /* Binary Output Change w/ Time (Obj:11, Var:02) */ /* Get Point Flags */ - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); switch (al_obj) { case AL_OBJ_BIC_TIME: dnp3_al_obj_quality(tvb, data_pos, al_ptflags, point_tree, point_item, BIN_IN); @@ -2318,7 +2318,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, al_bit = (al_ptflags & AL_OBJ_BI_FLAG7) >> 7; /* bit shift 1xxxxxxx -> xxxxxxx1 */ proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", - al_bit, abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + al_bit, abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -2327,7 +2327,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_2BIC_TIME: /* Double-bit Input Change w/ Time (Obj:04, Var:02) */ /* Get Point Flags */ - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); dnp3_al_obj_quality(tvb, (offset+prefixbytes), al_ptflags, point_tree, point_item, BIN_IN); data_pos += 1; @@ -2338,7 +2338,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, al_2bit = (al_ptflags >> 6) & 3; /* bit shift 11xxxxxx -> 00000011 */ proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", - al_2bit, abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + al_2bit, abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -2348,7 +2348,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_2BIC_RTIME: /* Double-bit Input Change w/ Relative Time (Obj:04, Var:03) */ /* Get Point Flags */ - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); dnp3_al_obj_quality(tvb, data_pos, al_ptflags, point_tree, point_item, BIN_IN); data_pos += 1; @@ -2365,13 +2365,13 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_BIC_RTIME: al_bit = (al_ptflags & AL_OBJ_BI_FLAG7) >> 7; /* bit shift 1xxxxxxx -> xxxxxxx1 */ proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", - al_bit, abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + al_bit, abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_item_set_len(point_item, data_pos - offset); break; case AL_OBJ_2BIC_RTIME: al_2bit = (al_ptflags >> 6) & 3; /* bit shift 11xxxxxx -> 00000011 */ proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", - al_2bit, abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + al_2bit, abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_item_set_len(point_item, data_pos - offset); break; } @@ -2385,7 +2385,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tcc_tree; /* Add a expand/collapse for TCC */ - al_tcc_code = tvb_get_guint8(tvb, data_pos); + al_tcc_code = tvb_get_uint8(tvb, data_pos); tcc_tree = proto_tree_add_subtree_format(point_tree, tvb, data_pos, 1, ett_dnp3_al_obj_point_tcc, NULL, "Control Code [0x%02x]",al_tcc_code); @@ -2445,7 +2445,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_AOC_DBLEVTT: /* 64-bit Floating Point Analog Command Event with time (Obj:43, Var:08) */ { /* Get the status code */ - al_ctlobj_stat = tvb_get_guint8(tvb, data_pos) & AL_OBJCTL_STATUS_MASK; + al_ctlobj_stat = tvb_get_uint8(tvb, data_pos) & AL_OBJCTL_STATUS_MASK; ctl_status_str = val_to_str_ext(al_ctlobj_stat, &dnp3_al_ctl_status_vals_ext, "Invalid Status (0x%02x)"); proto_item_append_text(point_item, " [Status: %s (0x%02x)]", ctl_status_str, al_ctlobj_stat); proto_tree_add_item(point_tree, hf_dnp3_al_ctrlstatus, tvb, data_pos, 1, ENC_LITTLE_ENDIAN); @@ -2500,7 +2500,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_AOC_FLTEVTT: /* 32-bit Floating Point Analog Command Event with time (Obj:43, Var:07) */ case AL_OBJ_AOC_DBLEVTT: /* 64-bit Floating Point Analog Command Event with time (Obj:43, Var:08) */ dnp3_al_get_timestamp(&al_abstime, tvb, data_pos); - proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; break; @@ -2545,7 +2545,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, } /* Get control status */ - al_ctlobj_stat = tvb_get_guint8(tvb, data_pos) & AL_OBJCTL_STATUS_MASK; + al_ctlobj_stat = tvb_get_uint8(tvb, data_pos) & AL_OBJCTL_STATUS_MASK; ctl_status_str = val_to_str_ext(al_ctlobj_stat, &dnp3_al_ctl_status_vals_ext, "Invalid Status (0x%02x)"); proto_item_append_text(point_item, " [Status: %s (0x%02x)]", ctl_status_str, al_ctlobj_stat); proto_tree_add_item(point_tree, hf_dnp3_al_ctrlstatus, tvb, data_pos, 1, ENC_LITTLE_ENDIAN); @@ -2607,7 +2607,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, break; default: - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); dnp3_al_obj_quality(tvb, data_pos, al_ptflags, point_tree, point_item, COUNTER); data_pos += 1; break; @@ -2683,7 +2683,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_FDCTRC_32T: case AL_OBJ_FDCTRC_16T: dnp3_al_get_timestamp(&al_abstime, tvb, data_pos); - proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; break; @@ -2728,7 +2728,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, break; default: - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); dnp3_al_obj_quality(tvb, data_pos, al_ptflags, point_tree, point_item, ANA_IN); data_pos += 1; break; @@ -2798,7 +2798,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_AIFC_FLTT: case AL_OBJ_AIFC_DBLT: dnp3_al_get_timestamp(&al_abstime, tvb, data_pos); - proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; break; @@ -2823,7 +2823,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_AOC_DBLT: /* 64-Bit Floating Point Output Event w/ Time (Obj:42, Var:08) */ /* Get Point Flags */ - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); dnp3_al_obj_quality(tvb, data_pos, al_ptflags, point_tree, point_item, ANA_OUT); data_pos += 1; @@ -2878,7 +2878,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_AOC_FLTT: case AL_OBJ_AOC_DBLT: dnp3_al_get_timestamp(&al_abstime, tvb, data_pos); - proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; break; @@ -3166,7 +3166,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, /* MAC Algorithm */ /* Use the MAC Algorithm to determine the length of the MAC Value */ - temp = tvb_get_guint8(tvb, data_pos); + temp = tvb_get_uint8(tvb, data_pos); switch (temp) { case 1: al_sa_mac_len = 4; @@ -3344,7 +3344,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_item_append_text(point_item, " %s", sec_stat_str); /* Quality Flags */ - al_ptflags = tvb_get_guint8(tvb, data_pos); + al_ptflags = tvb_get_uint8(tvb, data_pos); dnp3_al_obj_quality(tvb, data_pos, al_ptflags, point_tree, point_item, COUNTER); data_pos += 1; @@ -3362,7 +3362,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, if (al_obj == AL_OBJ_SA_SECSTATEVTT) { dnp3_al_get_timestamp(&al_abstime, tvb, data_pos); - proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, FALSE)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(pinfo->pool, &al_abstime, ABSOLUTE_TIME_UTC, false)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; } @@ -3402,12 +3402,12 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, static int dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - guint8 al_ctl, al_seq, al_func, al_class = 0, i; - guint16 bytes, obj_type = 0; - guint data_len = 0, offset = 0; + uint8_t al_ctl, al_seq, al_func, al_class = 0, i; + uint16_t bytes, obj_type = 0; + unsigned data_len = 0, offset = 0; proto_item *ti, *tc; proto_tree *al_tree, *robj_tree; - const gchar *func_code_str, *obj_type_str; + const char *func_code_str, *obj_type_str; nstime_t al_cto; static int * const control_flags[] = { &hf_dnp3_al_fir, @@ -3423,9 +3423,9 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) data_len = tvb_captured_length(tvb); /* Handle the control byte and function code */ - al_ctl = tvb_get_guint8(tvb, offset); + al_ctl = tvb_get_uint8(tvb, offset); al_seq = al_ctl & DNP3_AL_SEQ; - al_func = tvb_get_guint8(tvb, (offset+1)); + al_func = tvb_get_uint8(tvb, (offset+1)); func_code_str = val_to_str_ext(al_func, &dnp3_al_func_vals_ext, "Unknown function (0x%02x)"); /* Clear out lower layer info */ @@ -3477,7 +3477,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, TRUE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, true, &obj_type, &al_cto); } } break; @@ -3489,7 +3489,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, TRUE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, true, &obj_type, &al_cto); /* Update class type for each object that was a class read */ switch(obj_type) { @@ -3527,7 +3527,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); /* For writes for specific object types, bit-mask out the first byte and add the generic obj description to the column info */ obj_type_str = val_to_str_ext_const((obj_type & 0xFF00), &dnp3_al_write_obj_vals_ext, "Unknown Object Type"); @@ -3544,7 +3544,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); } break; @@ -3557,7 +3557,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); } break; @@ -3571,7 +3571,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); } break; @@ -3586,7 +3586,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, TRUE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, true, &obj_type, &al_cto); } break; @@ -3598,7 +3598,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); } break; @@ -3610,7 +3610,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); } break; @@ -3628,7 +3628,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); } break; @@ -3642,7 +3642,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); } break; @@ -3666,7 +3666,7 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Process Data Object Details */ while (offset <= (data_len-2)) { /* 2 octet object code + CRC32 */ - offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, FALSE, &obj_type, &al_cto); + offset = dnp3_al_process_object(tvb, pinfo, offset, robj_tree, false, &obj_type, &al_cto); } break; @@ -3689,10 +3689,10 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* proto_item *ti, *tdl, *tc, *hidden_item; proto_tree *dnp3_tree, *dl_tree, *field_tree; int offset = 0, temp_offset = 0; - gboolean dl_prm; - guint8 dl_len, dl_ctl, dl_func; - const gchar *func_code_str; - guint16 dl_dst, dl_src, calc_dl_crc; + bool dl_prm; + uint8_t dl_len, dl_ctl, dl_func; + const char *func_code_str; + uint16_t dl_dst, dl_src, calc_dl_crc; /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "DNP 3.0"); @@ -3701,10 +3701,10 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* Skip "0x0564" header bytes */ temp_offset += 2; - dl_len = tvb_get_guint8(tvb, temp_offset); + dl_len = tvb_get_uint8(tvb, temp_offset); temp_offset += 1; - dl_ctl = tvb_get_guint8(tvb, temp_offset); + dl_ctl = tvb_get_uint8(tvb, temp_offset); temp_offset += 1; dl_dst = tvb_get_letohs(tvb, temp_offset); @@ -3810,15 +3810,15 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* { proto_tree *data_tree; proto_item *data_ti; - guint8 tr_ctl, tr_seq; - gboolean tr_fir, tr_fin; - guint8 *al_buffer, *al_buffer_ptr; - guint8 data_len; + uint8_t tr_ctl, tr_seq; + bool tr_fir, tr_fin; + uint8_t *al_buffer, *al_buffer_ptr; + uint8_t data_len; int data_start = offset; int tl_offset; - gboolean crc_OK = FALSE; + bool crc_OK = false; tvbuff_t *next_tvb; - guint i; + unsigned i; static int * const transport_flags[] = { &hf_dnp3_tr_fin, &hf_dnp3_tr_fir, @@ -3827,7 +3827,7 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* }; /* get the transport layer byte */ - tr_ctl = tvb_get_guint8(tvb, offset); + tr_ctl = tvb_get_uint8(tvb, offset); tr_seq = tr_ctl & DNP3_TR_SEQ; tr_fir = tr_ctl & DNP3_TR_FIR; tr_fin = tr_ctl & DNP3_TR_FIN; @@ -3846,17 +3846,17 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* XXX - check for dl_len <= 5 */ data_len = dl_len - 5; - al_buffer = (guint8 *)wmem_alloc(pinfo->pool, data_len); + al_buffer = (uint8_t *)wmem_alloc(pinfo->pool, data_len); al_buffer_ptr = al_buffer; i = 0; tl_offset = 1; /* skip the initial transport layer byte when assembling chunks for the application layer tvb */ while (data_len > 0) { - guint8 chk_size; - const guint8 *chk_ptr; + uint8_t chk_size; + const uint8_t *chk_ptr; proto_tree *chk_tree; proto_item *chk_len_ti; - guint16 calc_crc, act_crc; + uint16_t calc_crc, act_crc; chk_size = MIN(data_len, AL_MAX_CHUNK_SIZE); chk_ptr = tvb_get_ptr(tvb, offset, chk_size); @@ -3892,18 +3892,18 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* if (crc_OK) { tvbuff_t *al_tvb; - gboolean save_fragmented; + bool save_fragmented; - al_tvb = tvb_new_child_real_data(tvb, al_buffer, (guint) (al_buffer_ptr-al_buffer), (gint) (al_buffer_ptr-al_buffer)); + al_tvb = tvb_new_child_real_data(tvb, al_buffer, (unsigned) (al_buffer_ptr-al_buffer), (int) (al_buffer_ptr-al_buffer)); /* Check for fragmented packet */ save_fragmented = pinfo->fragmented; /* Reassemble AL fragments */ - static guint al_max_fragments = 60; - static guint al_fragment_aging = 64; /* sequence numbers only 6 bit */ + static unsigned al_max_fragments = 60; + static unsigned al_fragment_aging = 64; /* sequence numbers only 6 bit */ fragment_head *frag_al = NULL; - pinfo->fragmented = TRUE; + pinfo->fragmented = true; if (!pinfo->fd->visited) { frag_al = fragment_add_seq_single_aging(&al_reassembly_table, @@ -3963,18 +3963,18 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* return offset; } -static gboolean -check_dnp3_header(tvbuff_t *tvb, gboolean dnp3_heuristics) +static bool +check_dnp3_header(tvbuff_t *tvb, bool dnp3_heuristics) { /* Assume the CRC will be bad */ - gboolean goodCRC = FALSE; + bool goodCRC = false; /* How big is the actual buffer */ - gint length = tvb_captured_length(tvb); + int length = tvb_captured_length(tvb); /* Calculate the header CRC if the bytes are available */ if (length >= DNP_HDR_LEN) { - guint16 calc_crc = calculateCRCtvb(tvb, 0, DNP_HDR_LEN - 2); + uint16_t calc_crc = calculateCRCtvb(tvb, 0, DNP_HDR_LEN - 2); goodCRC = (calc_crc == tvb_get_letohs(tvb, 8)); } @@ -3982,33 +3982,33 @@ check_dnp3_header(tvbuff_t *tvb, gboolean dnp3_heuristics) and a valid header CRC */ if (dnp3_heuristics) { if ( !goodCRC || (tvb_get_ntohs(tvb, 0) != 0x0564)) { - return FALSE; + return false; } } else { /* For a non-heuristic match, at least the first byte is 0x05 and if available the second byte is 64 and if available the CRC is valid */ - if (tvb_get_guint8(tvb, 0) != 0x05) { - return FALSE; + if (tvb_get_uint8(tvb, 0) != 0x05) { + return false; } - if ((length > 1) && (tvb_get_guint8(tvb, 1) != 0x64)) { - return FALSE; + if ((length > 1) && (tvb_get_uint8(tvb, 1) != 0x64)) { + return false; } if ((length >= DNP_HDR_LEN) && !goodCRC) { - return FALSE; + return false; } } - return TRUE; + return true; } -static guint +static unsigned get_dnp3_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) { - guint16 message_len; /* need 16 bits as total can exceed 255 */ - guint16 data_crc; /* No. of user data CRC bytes */ + uint16_t message_len; /* need 16 bits as total can exceed 255 */ + uint16_t data_crc; /* No. of user data CRC bytes */ - message_len = tvb_get_guint8(tvb, offset + 2); + message_len = tvb_get_uint8(tvb, offset + 2); /* Add in 2 bytes for header start octets, 1 byte for len itself, @@ -4016,7 +4016,7 @@ get_dnp3_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, data CRC bytes (2 bytes per 16 bytes of data */ - data_crc = (guint16)(ceil((message_len - 5) / 16.0)) * 2; + data_crc = (uint16_t)(ceil((message_len - 5) / 16.0)) * 2; message_len += 2 + 1 + 2 + data_crc; return message_len; } @@ -4024,39 +4024,39 @@ get_dnp3_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, static int dissect_dnp3_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if (!check_dnp3_header(tvb, FALSE)) { + if (!check_dnp3_header(tvb, false)) { return 0; } - tcp_dissect_pdus(tvb, pinfo, tree, TRUE, DNP_HDR_LEN, + tcp_dissect_pdus(tvb, pinfo, tree, true, DNP_HDR_LEN, get_dnp3_message_len, dissect_dnp3_message, data); return tvb_captured_length(tvb); } -static gboolean +static bool dissect_dnp3_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if (!check_dnp3_header(tvb, TRUE)) { - return FALSE; + if (!check_dnp3_header(tvb, true)) { + return false; } - tcp_dissect_pdus(tvb, pinfo, tree, TRUE, DNP_HDR_LEN, + tcp_dissect_pdus(tvb, pinfo, tree, true, DNP_HDR_LEN, get_dnp3_message_len, dissect_dnp3_message, data); - return TRUE; + return true; } -static gboolean +static bool dnp3_udp_check_header(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_, void *data _U_) { - return check_dnp3_header(tvb, FALSE); + return check_dnp3_header(tvb, false); } -static gboolean +static bool dnp3_udp_check_header_heur(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_, void *data _U_) { - return check_dnp3_header(tvb, TRUE); + return check_dnp3_header(tvb, true); } static int @@ -4066,7 +4066,7 @@ dissect_dnp3_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data get_dnp3_message_len, dissect_dnp3_message, data); } -static gboolean +static bool dissect_dnp3_udp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { return (udp_dissect_pdus(tvb, pinfo, tree, DNP_HDR_LEN, dnp3_udp_check_header_heur, @@ -4277,7 +4277,7 @@ proto_register_dnp3(void) { &hf_dnp3_al_func, { "Application Layer Function Code", "dnp3.al.func", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &dnp3_al_func_vals_ext, DNP3_AL_FUNC, - "Application Function Code", HFILL } + NULL, HFILL } }, { &hf_dnp3_al_iin, @@ -5199,7 +5199,7 @@ proto_register_dnp3(void) { &hf_dnp3_al_count, { "Count", "dnp3.al.count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dnp3_al_on_time, { "On Time", "dnp3.al.on_time", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dnp3_al_off_time, { "Off Time", "dnp3.al.off_time", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_dnp3_al_time_delay, { "Time Delay", "dnp3.al.time_delay", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, + { &hf_dnp3_al_time_delay, { "Time Delay", "dnp3.al.time_delay", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0, NULL, HFILL }}, { &hf_dnp3_al_file_string_offset, { "File String Offset", "dnp3.al.file_string_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dnp3_al_file_string_length, { "File String Length", "dnp3.al.file_string_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dnp3_al_file_name, { "File Name", "dnp3.al.file_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, @@ -5209,7 +5209,7 @@ proto_register_dnp3(void) }; /* Setup protocol subtree array */ - static gint *ett[] = { + static int *ett[] = { &ett_dnp3, &ett_dnp3_dl, &ett_dnp3_dl_ctl, |