#include <glib.h>
#include <epan/conversation.h>
-#include <epan/crc16.h>
+#include <epan/crc16-tvb.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/packet.h>
#include <epan/prefs.h>
static int proto_synphasor = -1;
static GSList *config_frame_list = NULL;
-#if ! GLIB_CHECK_VERSION(2,10,0)
-static GMemChunk *frame_chunks = NULL;
-#endif
-
/* user preferences */
static guint global_pref_tcp_port = 4712;
static guint global_pref_udp_port = 4713;
config_frame *frame;
/* get a new frame and initialize it */
-#if GLIB_CHECK_VERSION(2,10,0)
frame = g_slice_new(config_frame);
-#else
- frame = g_mem_chunk_alloc(frame_chunks);
-#endif
frame->config_blocks = g_array_new(FALSE, TRUE, sizeof(config_block));
g_array_free(frame->config_blocks, TRUE);
/* and the config_frame */
-#if GLIB_CHECK_VERSION(2,10,0)
g_slice_free1(sizeof(config_frame), frame);
-#else
- g_mem_chunk_free(frame_chunks, frame);
-#endif
}
/* called every time the user loads a capture file or starts to capture */
config_frame_list = NULL;
}
-#if ! GLIB_CHECK_VERSION(2,10,0)
- if (frame_chunks != NULL) {
- g_mem_chunk_destroy(frame_chunks);
- }
- frame_chunks = g_mem_chunk_new("Frame_Chunks",
- sizeof(config_frame),
- 10*(sizeof(config_frame)),
- G_ALLOC_AND_FREE);
-#endif
}
/* the main dissection routine */
guint16 framesize;
tvbuff_t *sub_tvb;
- temp_item = proto_tree_add_item(tree, proto_synphasor, tvb, 0, -1, FALSE);
+ temp_item = proto_tree_add_item(tree, proto_synphasor, tvb, 0, -1, ENC_NA);
proto_item_append_text(temp_item, ", %s", val_to_str(frame_type, typenames,
", invalid packet type"));
proto_item *temp_item;
gint offset = 0;
- guint16 framesize, idcode;
+ guint16 framesize;
/* SYNC and flags */
- temp_item = proto_tree_add_item(tree, hf_sync, tvb, offset, 2, FALSE);
+ temp_item = proto_tree_add_item(tree, hf_sync, tvb, offset, 2, ENC_BIG_ENDIAN);
temp_tree = proto_item_add_subtree(temp_item, ett_frtype);
- proto_tree_add_item(temp_tree, hf_sync_frtype, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_sync_version, tvb, offset, 2, FALSE);
+ proto_tree_add_item(temp_tree, hf_sync_frtype, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_sync_version, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* FRAMESIZE */
- proto_tree_add_item(tree, hf_frsize, tvb, offset, 2, FALSE);
+ proto_tree_add_item(tree, hf_frsize, tvb, offset, 2, ENC_BIG_ENDIAN);
framesize = tvb_get_ntohs(tvb, offset); offset += 2;
/* IDCODE */
- proto_tree_add_item(tree, hf_idcode, tvb, offset, 2, FALSE);
- idcode = tvb_get_ntohs(tvb, offset); offset += 2;
+ proto_tree_add_item(tree, hf_idcode, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
/* SOC */
{
/* time quality flags */
temp_item = proto_tree_add_text(tree, tvb, offset, 1, "Time quality flags");
temp_tree = proto_item_add_subtree(temp_item, ett_timequal);
- proto_tree_add_item(temp_tree, hf_timeqal_lsdir, tvb, offset, 1, FALSE);
- proto_tree_add_item(temp_tree, hf_timeqal_lsocc, tvb, offset, 1, FALSE);
- proto_tree_add_item(temp_tree, hf_timeqal_lspend, tvb, offset, 1, FALSE);
- proto_tree_add_item(temp_tree, hf_timeqal_timequalindic, tvb, offset, 1, FALSE);
+ proto_tree_add_item(temp_tree, hf_timeqal_lsdir, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_timeqal_lsocc, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_timeqal_lspend, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_timeqal_timequalindic, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- proto_tree_add_item(tree, hf_fracsec, tvb, offset, 3, FALSE); offset += 3;
+ proto_tree_add_item(tree, hf_fracsec, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 3;
return framesize;
}
/* TIME_BASE and NUM_PMU */
offset += 1; /* skip the reserved byte */
- proto_tree_add_item(config_tree, hf_conf_timebase, tvb, offset, 3, FALSE); offset += 3;
- proto_tree_add_item(config_tree, hf_conf_numpmu, tvb, offset, 2, FALSE);
+ proto_tree_add_item(config_tree, hf_conf_timebase, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 3;
+ proto_tree_add_item(config_tree, hf_conf_numpmu, tvb, offset, 2, ENC_BIG_ENDIAN);
/* add number of included PMUs to the text in the list view */
num_pmu = tvb_get_ntohs(tvb, offset); offset += 2;
proto_item_append_text(config_item, ", %"G_GUINT16_FORMAT" PMU(s) included", num_pmu);
offset += CHNAM_LEN;
/* IDCODE */
- proto_tree_add_item(station_tree, hf_idcode, tvb, offset, 2, FALSE); offset += 2;
+ proto_tree_add_item(station_tree, hf_idcode, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
/* FORMAT */
temp_item = proto_tree_add_text(station_tree, tvb, offset, 2, "Data format in data frame");
temp_tree = proto_item_add_subtree(temp_item, ett_conf_format);
- proto_tree_add_item(temp_tree, hf_conf_formatb3, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_conf_formatb2, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_conf_formatb1, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_conf_formatb0, tvb, offset, 2, FALSE);
+ proto_tree_add_item(temp_tree, hf_conf_formatb3, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_conf_formatb2, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_conf_formatb1, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_conf_formatb0, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* PHNMR, ANNMR, DGNMR */
offset = dissect_DIGUNIT(tvb, station_tree, offset, num_dg);
/* FNOM and CFGCNT */
- proto_tree_add_item(station_tree, hf_conf_fnom, tvb, offset, 2, FALSE); offset += 2;
- proto_tree_add_item(station_tree, hf_conf_cfgcnt, tvb, offset, 2, FALSE); offset += 2;
+ proto_tree_add_item(station_tree, hf_conf_fnom, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
+ proto_tree_add_item(station_tree, hf_conf_cfgcnt, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
/* set the correct length for the "Station :" item */
proto_item_set_len(station_item, offset - oldoffset);
/* STAT */
proto_item *temp_item = proto_tree_add_text(block_tree, tvb, offset, 2, "Flags");
proto_tree *temp_tree = proto_item_add_subtree(temp_item, ett_data_stat);
- proto_tree_add_item(temp_tree, hf_data_statb15, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_data_statb14, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_data_statb13, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_data_statb12, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_data_statb11, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_data_statb10, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_data_statb05to04, tvb, offset, 2, FALSE);
- proto_tree_add_item(temp_tree, hf_data_statb03to00, tvb, offset, 2, FALSE);
+ proto_tree_add_item(temp_tree, hf_data_statb15, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_data_statb14, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_data_statb13, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_data_statb12, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_data_statb11, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_data_statb10, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_data_statb05to04, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(temp_tree, hf_data_statb03to00, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* PHASORS, (D)FREQ, ANALOG, and DIGITAL */
command_tree = proto_item_add_subtree(command_item, ett_command);
/* CMD */
- proto_tree_add_item(command_tree, hf_command, tvb, 0, 2, FALSE);
+ proto_tree_add_item(command_tree, hf_command, tvb, 0, 2, ENC_BIG_ENDIAN);
if (check_col(pinfo->cinfo, COL_INFO)) {
const char *s = val_to_str(tvb_get_ntohs(tvb, 0), command_names, "invalid command");
col_append_str(pinfo->cinfo, COL_INFO, ", ");
TFS(&data_statb14names), 0x4000, NULL, HFILL }},
{ &hf_data_statb13,
- { "Time syncronized", PROTOCOL_ABBREV ".data.sync", FT_BOOLEAN, 16,
+ { "Time synchronized", PROTOCOL_ABBREV ".data.sync", FT_BOOLEAN, 16,
TFS(&data_statb13names), 0x2000, NULL, HFILL }},
{ &hf_data_statb12,
{ &hf_data_statb05to04,
{ "Unlocked time", PROTOCOL_ABBREV ".data.t_unlock", FT_UINT16, BASE_HEX,
- VALS(&data_statb05to04names), 0x0030, NULL, HFILL }},
+ VALS(data_statb05to04names), 0x0030, NULL, HFILL }},
{ &hf_data_statb03to00,
{ "Trigger reason", PROTOCOL_ABBREV ".data.trigger_reason", FT_UINT16, BASE_HEX,
- VALS(&data_statb03to00names), 0x000F, NULL, HFILL }},
+ VALS(data_statb03to00names), 0x000F, NULL, HFILL }},
/* Data type for command frame */
{ &hf_command,
}
else {
/* update preferences */
- dissector_delete("udp.port", current_udp_port, synphasor_udp_handle);
- dissector_delete("tcp.port", current_tcp_port, synphasor_tcp_handle);
+ dissector_delete_uint("udp.port", current_udp_port, synphasor_udp_handle);
+ dissector_delete_uint("tcp.port", current_tcp_port, synphasor_tcp_handle);
}
current_udp_port = global_pref_udp_port;
current_tcp_port = global_pref_tcp_port;
- dissector_add("udp.port", current_udp_port, synphasor_udp_handle);
- dissector_add("tcp.port", current_tcp_port, synphasor_tcp_handle);
+ dissector_add_uint("udp.port", current_udp_port, synphasor_udp_handle);
+ dissector_add_uint("tcp.port", current_tcp_port, synphasor_tcp_handle);
} /* proto_reg_handoff_synphasor() */
-