aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ptpip.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-ptpip.c')
-rw-r--r--epan/dissectors/packet-ptpip.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/epan/dissectors/packet-ptpip.c b/epan/dissectors/packet-ptpip.c
index 990e8bd528..a278b9e8ee 100644
--- a/epan/dissectors/packet-ptpip.c
+++ b/epan/dissectors/packet-ptpip.c
@@ -31,30 +31,30 @@
#define PTPIP_MAX_PARAM_COUNT 5 /* [1] Section 2.3.6 */
/* trees */
-static gint ett_ptpIP = -1;
-static gint ett_ptpIP_hdr = -1;
+static gint ett_ptpIP;
+static gint ett_ptpIP_hdr;
/* PTP/IP Fields */
-static int proto_ptpIP = -1;
-static int hf_ptpIP_len = -1; /* [1] Section 2.3 */
-static int hf_ptpIP_pktType = -1; /* [1] Section 2.3 */
-static int hf_ptpIP_guid = -1;
-static int hf_ptpIP_name = -1;
-static int hf_ptpIP_version = -1;
-static int hf_ptpIP_connectionNumber = -1;
-static int hf_ptpIP_dataPhaseInfo = -1;
+static int proto_ptpIP;
+static int hf_ptpIP_len; /* [1] Section 2.3 */
+static int hf_ptpIP_pktType; /* [1] Section 2.3 */
+static int hf_ptpIP_guid;
+static int hf_ptpIP_name;
+static int hf_ptpIP_version;
+static int hf_ptpIP_connectionNumber;
+static int hf_ptpIP_dataPhaseInfo;
/* note: separating the fields to make it easier to divide this code later. */
/* PTP Fields */
/* picking hf_ptp for now. Might need to change later for namespace issues with Precision Time Protocol. */
-static int hf_ptp_opCode = -1;
-static int hf_ptp_vendor_opCode = -1;
-static int hf_ptp_respCode = -1;
-static int hf_ptp_eventCode = -1;
-static int hf_ptp_transactionID = -1;
-static int hf_ptp_totalDataLength = -1;
-static int hf_ptp_opCode_param_sessionID = -1;
+static int hf_ptp_opCode;
+static int hf_ptp_vendor_opCode;
+static int hf_ptp_respCode;
+static int hf_ptp_eventCode;
+static int hf_ptp_transactionID;
+static int hf_ptp_totalDataLength;
+static int hf_ptp_opCode_param_sessionID;
/* function declarations */
static int dissect_ptpIP (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_);
@@ -75,6 +75,8 @@ static void dissect_ptpIP_guid (tvbuff_t *tvb, packet_info *pinf
void proto_register_ptpip( void );
void proto_reg_handoff_ptpIP( void );
+static dissector_handle_t ptpIP_handle;
+
typedef enum {
PTP_VENDOR_UNKNOWN = 0,
PTP_VENDOR_EASTMAN_KODAK = 1,
@@ -1008,7 +1010,7 @@ static void dissect_ptpIP_protocol_version(tvbuff_t *tvb, proto_tree *tree, guin
/* logic to format version */
minorVersion = protoVersion & 0xFFFF;
majorVersion = (protoVersion & 0xFFFF0000) >>16;
- g_snprintf(version, sizeof(version), "%u.%u", majorVersion, minorVersion);
+ snprintf(version, sizeof(version), "%u.%u", majorVersion, minorVersion);
proto_tree_add_string(tree, hf_ptpIP_version, tvb, *offset, 4, version);
*offset += 4;
}
@@ -1042,7 +1044,7 @@ void proto_register_ptpip( void )
"GUID", "ptpip.guid", FT_BYTES, BASE_NONE,
NULL, 0, NULL, HFILL }},
{ &hf_ptpIP_name, {
- "Host Name", "ptpip.name", FT_STRINGZ, STR_UNICODE,
+ "Host Name", "ptpip.name", FT_STRINGZ, BASE_NONE,
NULL, 0, NULL, HFILL }},
{ &hf_ptpIP_version, {
"Version", "ptpip.version", FT_STRING, BASE_NONE,
@@ -1090,6 +1092,12 @@ void proto_register_ptpip( void )
proto_register_field_array(proto_ptpIP, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ /* Use register_dissector() to indicate that dissect_ptpIP()
+ * returns the number of bytes it dissected (or 0 if it thinks the packet
+ * does not belong to PROTONAME).
+ */
+ ptpIP_handle = register_dissector("ptpip", dissect_ptpIP, proto_ptpIP);
+
ptpIP_module = prefs_register_protocol(proto_ptpIP, NULL);
prefs_register_enum_preference(ptpIP_module, "vendor",
@@ -1100,15 +1108,6 @@ void proto_register_ptpip( void )
}
void proto_reg_handoff_ptpIP( void ) {
-
- dissector_handle_t ptpIP_handle;
-
- /* Use create_dissector_handle() to indicate that dissect_ptpIP()
- * returns the number of bytes it dissected (or 0 if it thinks the packet
- * does not belong to PROTONAME).
- */
-
- ptpIP_handle = create_dissector_handle(dissect_ptpIP, proto_ptpIP);
dissector_add_uint_with_preference("tcp.port", PTPIP_PORT, ptpIP_handle);
}