Don't guard col_set_str (COL_INFO/COL_PROTOCOL) with col_check
[obnox/wireshark/wip.git] / epan / dissectors / packet-2dparityfec.c
index 7f6c0dcb6b8fcd43267f0416547cdb2afc0e92e1..ddb57dd9043735b117385e005dd875cb20fd5931 100644 (file)
@@ -69,7 +69,6 @@
 #include <epan/prefs.h>
 
 /* forward reference */
-void proto_register_2dparityfec(void);
 void proto_reg_handoff_2dparityfec(void);
 
 static gboolean dissect_fec = FALSE;
@@ -94,10 +93,10 @@ static int hf_2dparityfec_snbase_ext      = -1;
 static int hf_2dparityfec_payload         = -1;
 
 static const value_string fec_type_names[] = {
-      {0, "XOR"},
-      {1, "Hamming"},
-      {2, "Reed-Solomon"},
-      {0, NULL}
+   {0, "XOR"},
+   {1, "Hamming"},
+   {2, "Reed-Solomon"},
+   {0, NULL}
 };
 
 static void dissect_2dparityfec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -119,10 +118,7 @@ static void dissect_2dparityfec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
    OffsetField    = tvb_get_guint8(tvb, 13);
    NAField        = tvb_get_guint8(tvb, 14);
 
-   if(check_col(pinfo->cinfo, COL_PROTOCOL))
-   {
-      col_set_str(pinfo->cinfo, COL_PROTOCOL, "2dFEC");
-   }
+   col_set_str(pinfo->cinfo, COL_PROTOCOL, "2dFEC");
 
    /* Configure the info column */
    if(check_col(pinfo->cinfo, COL_INFO))
@@ -168,191 +164,204 @@ static void dissect_2dparityfec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
    }
 }
 
+void proto_register_2dparityfec(void)
+{
+   module_t *module_2dparityfec;
+
 /* Payload type definitions */
 static hf_register_info hf[] = {
-       {&hf_2dparityfec_snbase_low,
-               {  "SNBase low",
-                       "2dparityfec.snbase_low",
-                       FT_UINT16,
-                       BASE_DEC,
-                       NULL,
-                       0x0,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_length_recovery,
-               {  "Length recovery",
-                       "2dparityfec.lr",
-                       FT_UINT16,
-                       BASE_HEX,
-                       NULL,
-                       0x0,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_rfc2733_ext,
-               {  "RFC2733 Extension (E)",
-                       "2dparityfec.e",
-                       FT_BOOLEAN,
-                       8,
-                       NULL,
-                       0x80,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_pt_recovery,
-               {  "Payload Type recovery",
-                       "2dparityfec.ptr",
-                       FT_UINT8,
-                       BASE_HEX,
-                       NULL,
-                       0x7f,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_mask,
-               {  "Mask",
-                       "2dparityfec.mask",
-                       /*FT_UINT32*/FT_UINT24,
-                       BASE_HEX,
-                       NULL,
-                       /*0x00ffffff*/0x0,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_ts_recovery,
-               {  "Timestamp recovery",
-                       "2dparityfec.tsr",
-                       FT_UINT32,
-                       BASE_HEX,
-                       NULL,
-                       0x0,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_ts_pro_mpeg_ext,
-               {  "Pro-MPEG Extension (X)",
-                       "2dparityfec.x",
-                       FT_BOOLEAN,
-                       8,
-                       NULL,
-                       0x80,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_row_flag,
-               {  "Row FEC (D)",
-                       "2dparityfec.d",
-                       FT_BOOLEAN,
-                       8,
-                       NULL,
-                       0x40,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_type,
-               {  "Type",
-                       "2dparityfec.type",
-                       FT_UINT8,
-                       BASE_DEC,
-                       VALS(fec_type_names),
-                       0x38,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_index,
-               {  "Index",
-                       "2dparityfec.index",
-                       FT_UINT8,
-                       BASE_DEC,
-                       NULL,
-                       0x07,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_offset,
-               {  "Offset",
-                       "2dparityfec.offset",
-                       FT_UINT8,
-                       BASE_DEC,
-                       NULL,
-                       0x0,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_na,
-               {  "NA",
-                       "2dparityfec.na",
-                       FT_UINT8,
-                       BASE_DEC,
-                       NULL,
-                       0x0,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_snbase_ext,
-               {  "SNBase ext",
-                       "2dparityfec.snbase_ext",
-                       FT_UINT8,
-                       BASE_DEC,
-                       NULL,
-                       0x0,
-                       "",
-                       HFILL}   },
-
-       {&hf_2dparityfec_payload,
-               {  "FEC Payload",
-                       "2dparityfec.payload",
-                       FT_BYTES,
-                       BASE_HEX,
-                       NULL,
-                       0x0,
-                       "",
-                       HFILL}   }
+   {&hf_2dparityfec_snbase_low,
+        "SNBase low",
+         "2dparityfec.snbase_low",
+         FT_UINT16,
+         BASE_DEC,
+         NULL,
+         0x0,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_length_recovery,
+      {  "Length recovery",
+         "2dparityfec.lr",
+         FT_UINT16,
+         BASE_HEX,
+         NULL,
+         0x0,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_rfc2733_ext,
+      {  "RFC2733 Extension (E)",
+         "2dparityfec.e",
+         FT_BOOLEAN,
+         8,
+         NULL,
+         0x80,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_pt_recovery,
+      {  "Payload Type recovery",
+         "2dparityfec.ptr",
+         FT_UINT8,
+         BASE_HEX,
+         NULL,
+         0x7f,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_mask,
+      {  "Mask",
+         "2dparityfec.mask",
+         /*FT_UINT32*/FT_UINT24,
+         BASE_HEX,
+         NULL,
+         /*0x00ffffff*/0x0,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_ts_recovery,
+      {  "Timestamp recovery",
+         "2dparityfec.tsr",
+         FT_UINT32,
+         BASE_HEX,
+         NULL,
+         0x0,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_ts_pro_mpeg_ext,
+      {  "Pro-MPEG Extension (X)",
+         "2dparityfec.x",
+         FT_BOOLEAN,
+         8,
+         NULL,
+         0x80,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_row_flag,
+      {  "Row FEC (D)",
+         "2dparityfec.d",
+         FT_BOOLEAN,
+         8,
+         NULL,
+         0x40,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_type,
+      {  "Type",
+         "2dparityfec.type",
+         FT_UINT8,
+         BASE_DEC,
+         VALS(fec_type_names),
+         0x38,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_index,
+      {  "Index",
+         "2dparityfec.index",
+         FT_UINT8,
+         BASE_DEC,
+         NULL,
+         0x07,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_offset,
+      {  "Offset",
+         "2dparityfec.offset",
+         FT_UINT8,
+         BASE_DEC,
+         NULL,
+         0x0,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_na,
+      {  "NA",
+         "2dparityfec.na",
+         FT_UINT8,
+         BASE_DEC,
+         NULL,
+         0x0,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_snbase_ext,
+      {  "SNBase ext",
+         "2dparityfec.snbase_ext",
+         FT_UINT8,
+         BASE_DEC,
+         NULL,
+         0x0,
+         NULL,
+         HFILL}   },
+
+   {&hf_2dparityfec_payload,
+      {  "FEC Payload",
+         "2dparityfec.payload",
+         FT_BYTES,
+         BASE_NONE,
+         NULL,
+         0x0,
+         NULL,
+         HFILL}   }
 
 
 };
 
 /* Setup protocol subtree array */
 static gint *ett[] = {
-       &ett_2dparityfec,
+   &ett_2dparityfec,
 };
 
-void proto_register_2dparityfec(void)
-{
-   module_t *module_2dparityfec;
-
    proto_2dparityfec = proto_register_protocol(
-       "Pro-MPEG Code of Practice #3 release 2 FEC Protocol",   /* name */
-        "2dparityfec",            /* short name */
-        "2dparityfec");           /* abbrev */
+      "Pro-MPEG Code of Practice #3 release 2 FEC Protocol",   /* name */
+      "2dparityfec",            /* short name */
+      "2dparityfec");           /* abbrev */
 
    proto_register_field_array(proto_2dparityfec, hf, array_length(hf));
    proto_register_subtree_array(ett, array_length(ett));
 
    module_2dparityfec = prefs_register_protocol(proto_2dparityfec,
-                                               proto_reg_handoff_2dparityfec);
+                                                proto_reg_handoff_2dparityfec);
 
    prefs_register_bool_preference(module_2dparityfec, "enable",
-      "Decode Pro-MPEG FEC on RTP dynamic payload type 96",
-      "Enable this option to recognise all traffic on RTP dynamic payload type 96 (0x60) "
-      "as FEC data corresponding to Pro-MPEG Code of Practice #3 release 2",
-      &dissect_fec);
+        "Decode Pro-MPEG FEC on RTP dynamic payload type 96",
+        "Enable this option to recognise all traffic on RTP dynamic payload type 96 (0x60) "
+        "as FEC data corresponding to Pro-MPEG Code of Practice #3 release 2",
+        &dissect_fec);
 
 }
 
 void proto_reg_handoff_2dparityfec(void)
 {
-      static dissector_handle_t handle_2dparityfec = NULL;
-      if (!handle_2dparityfec) {
-       handle_2dparityfec = create_dissector_handle(dissect_2dparityfec,
-                                                       proto_2dparityfec);
-      }
+   static dissector_handle_t handle_2dparityfec = NULL;
 
-      if (dissect_fec) {
-        dissector_add("rtp.pt", fec_rtp_payload_type, handle_2dparityfec);
-      } else {
-        dissector_delete("rtp.pt", fec_rtp_payload_type, handle_2dparityfec);
-      }
+   if (!handle_2dparityfec) {
+      handle_2dparityfec = create_dissector_handle(dissect_2dparityfec,
+                                                   proto_2dparityfec);
+   }
+
+   if (dissect_fec) {
+      dissector_add("rtp.pt", fec_rtp_payload_type, handle_2dparityfec);
+   } else {
+      dissector_delete("rtp.pt", fec_rtp_payload_type, handle_2dparityfec);
+   }
 }
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 3
+ * tab-width: 3
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=3 tabstop=3 expandtab
+ * :indentSize=3:tabSize=3:noTabs=true:
+ */