#include <stdio.h> not needed.
[obnox/wireshark/wip.git] / epan / dissectors / packet-dop.c
index ea5b75c0d93b1e3f4c35336c10a6ad65a0c12a1e..d8c9248025935d086dd91340cb344ddff6923921 100644 (file)
@@ -42,7 +42,6 @@
 #include <epan/asn1.h>
 #include <epan/expert.h>
 
-#include <stdio.h>
 #include <string.h>
 
 #include "packet-ber.h"
@@ -68,7 +67,7 @@ static dissector_handle_t tpkt_handle;
 void prefs_register_dop(void); /* forward declaration for use in preferences registration */
 
 /* Initialize the protocol and registered fields */
-int proto_dop = -1;
+static int proto_dop = -1;
 
 static struct SESSION_DATA_STRUCTURE* session = NULL;
 static const char *binding_type = NULL; /* binding_type */
@@ -241,6 +240,8 @@ static int hf_dop_DSEType_rhob = -1;
 static int hf_dop_DSEType_sa = -1;
 static int hf_dop_DSEType_dsSubentry = -1;
 static int hf_dop_DSEType_familyMember = -1;
+static int hf_dop_DSEType_ditBridge = -1;
+static int hf_dop_DSEType_writeableCopy = -1;
 static int hf_dop_GrantsAndDenials_grantAdd = -1;
 static int hf_dop_GrantsAndDenials_denyAdd = -1;
 static int hf_dop_GrantsAndDenials_grantDiscloseOnError = -1;
@@ -269,7 +270,7 @@ static int hf_dop_GrantsAndDenials_grantInvoke = -1;
 static int hf_dop_GrantsAndDenials_denyInvoke = -1;
 
 /*--- End of included file: packet-dop-hf.c ---*/
-#line 71 "packet-dop-template.c"
+#line 70 "packet-dop-template.c"
 
 /* Initialize the subtree pointers */
 static gint ett_dop = -1;
@@ -346,7 +347,7 @@ static gint ett_dop_T_basicLevels = -1;
 static gint ett_dop_GrantsAndDenials = -1;
 
 /*--- End of included file: packet-dop-ett.c ---*/
-#line 76 "packet-dop-template.c"
+#line 75 "packet-dop-template.c"
 
 /* Dissector table */
 static dissector_table_t dop_dissector_table;
@@ -355,10 +356,8 @@ static void append_oid(packet_info *pinfo, const char *oid)
 {
        const char *name = NULL;
 
-  if(check_col(pinfo->cinfo, COL_INFO)) {
     name = oid_resolved_from_string(oid);
     col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name ? name : oid);
-  }
 }
 
 
@@ -383,6 +382,8 @@ static const asn_namedbit DSEType_bits[] = {
   { 15, &hf_dop_DSEType_sa, -1, -1, "sa", NULL },
   { 16, &hf_dop_DSEType_dsSubentry, -1, -1, "dsSubentry", NULL },
   { 17, &hf_dop_DSEType_familyMember, -1, -1, "familyMember", NULL },
+  { 18, &hf_dop_DSEType_ditBridge, -1, -1, "ditBridge", NULL },
+  { 19, &hf_dop_DSEType_writeableCopy, -1, -1, "writeableCopy", NULL },
   { 0, NULL, 0, 0, NULL, NULL }
 };
 
@@ -419,9 +420,7 @@ dissect_dop_T_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
                                                 &value);
 
 
-       if (check_col(actx->pinfo->cinfo, COL_INFO)) {
-                       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " id=%d", value);
-       }
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " id=%d", value);
 
 
 
@@ -434,16 +433,14 @@ dissect_dop_T_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
 
 static int
 dissect_dop_T_version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 183 "dop.cnf"
+#line 181 "dop.cnf"
        guint32 value;
 
          offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                                 &value);
 
 
-       if (check_col(actx->pinfo->cinfo, COL_INFO)) {
-                       col_append_fstr(actx->pinfo->cinfo, COL_INFO, ",%d", value);
-       }
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, ",%d", value);
 
 
 
@@ -759,8 +756,8 @@ dissect_dop_T_validUntil(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
 
 
 static const ber_sequence_t Validity_sequence[] = {
-  { &hf_dop_validFrom       , BER_CLASS_CON, 0, 0, dissect_dop_T_validFrom },
-  { &hf_dop_validUntil      , BER_CLASS_CON, 1, 0, dissect_dop_T_validUntil },
+  { &hf_dop_validFrom       , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_dop_T_validFrom },
+  { &hf_dop_validUntil      , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_dop_T_validUntil },
   { NULL, 0, 0, 0, NULL }
 };
 
@@ -1564,7 +1561,7 @@ dissect_dop_NHOBSubordinateToSuperior(gboolean implicit_tag _U_, tvbuff_t *tvb _
 
 static int
 dissect_dop_Precedence(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 194 "dop.cnf"
+#line 190 "dop.cnf"
   guint32 precedence = 0;
 
     offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -2049,7 +2046,7 @@ static void dissect_ACIItem_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto
 
 
 /*--- End of included file: packet-dop-fn.c ---*/
-#line 91 "packet-dop-template.c"
+#line 88 "packet-dop-template.c"
 
 static int
 call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info)
@@ -2058,8 +2055,7 @@ call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info
 
   binding_param = ep_strdup_printf("%s.%s", base_string, binding_type ? binding_type : "");
 
-  if (col_info && (check_col(pinfo->cinfo, COL_INFO))) 
-    col_append_fstr(pinfo->cinfo, COL_INFO, " %s", col_info);
+  col_append_fstr(pinfo->cinfo, COL_INFO, " %s", col_info);
 
   if (dissector_try_string(dop_dissector_table, binding_param, tvb, pinfo, tree)) {
      offset += tvb_length_remaining (tvb, offset);
@@ -2110,10 +2106,8 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                item = proto_tree_add_item(parent_tree, proto_dop, tvb, 0, -1, FALSE);
                tree = proto_item_add_subtree(item, ett_dop);
        }
-       if (check_col(pinfo->cinfo, COL_PROTOCOL))
-               col_set_str(pinfo->cinfo, COL_PROTOCOL, "DOP");
-       if (check_col(pinfo->cinfo, COL_INFO))
-               col_clear(pinfo->cinfo, COL_INFO);
+       col_set_str(pinfo->cinfo, COL_PROTOCOL, "DOP");
+       col_clear(pinfo->cinfo, COL_INFO);
 
        switch(session->ros_op & ROS_OP_MASK) {
        case (ROS_OP_BIND | ROS_OP_ARGUMENT):   /*  BindInvoke */
@@ -2186,15 +2180,13 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
        }
 
        if(dop_dissector) {
-         if (check_col(pinfo->cinfo, COL_INFO))
-           col_set_str(pinfo->cinfo, COL_INFO, dop_op_name);
+      col_set_str(pinfo->cinfo, COL_INFO, dop_op_name);
 
          while (tvb_reported_length_remaining(tvb, offset) > 0){
            old_offset=offset;
            offset=(*dop_dissector)(FALSE, tvb, offset, &asn1_ctx, tree, -1);
            if(offset == old_offset){
              proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte DOP PDU");
-             offset = tvb_length(tvb);
              break;
            }
          }
@@ -2282,7 +2274,7 @@ void proto_register_dop(void) {
         "dop.OperationalBindingID", HFILL }},
     { &hf_dop_supplier_is_master,
       { "supplier-is-master", "dop.supplier_is_master",
-        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+        FT_BOOLEAN, BASE_NONE, NULL, 0,
         "dop.BOOLEAN", HFILL }},
     { &hf_dop_non_supplying_master,
       { "non-supplying-master", "dop.non_supplying_master",
@@ -2414,7 +2406,7 @@ void proto_register_dop(void) {
         "x509if.DistinguishedName", HFILL }},
     { &hf_dop_aliasDereferenced,
       { "aliasDereferenced", "dop.aliasDereferenced",
-        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+        FT_BOOLEAN, BASE_NONE, NULL, 0,
         "dop.BOOLEAN", HFILL }},
     { &hf_dop_notification,
       { "notification", "dop.notification",
@@ -2594,7 +2586,7 @@ void proto_register_dop(void) {
         "x509if.Attribute", HFILL }},
     { &hf_dop_alias,
       { "alias", "dop.alias",
-        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+        FT_BOOLEAN, BASE_NONE, NULL, 0,
         "dop.BOOLEAN", HFILL }},
     { &hf_dop_identificationTag,
       { "identificationTag", "dop.identificationTag",
@@ -2786,7 +2778,7 @@ void proto_register_dop(void) {
         "dop.INTEGER", HFILL }},
     { &hf_dop_signed,
       { "signed", "dop.signed",
-        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+        FT_BOOLEAN, BASE_NONE, NULL, 0,
         "dop.BOOLEAN", HFILL }},
     { &hf_dop_other,
       { "other", "dop.other",
@@ -2860,6 +2852,14 @@ void proto_register_dop(void) {
       { "familyMember", "dop.familyMember",
         FT_BOOLEAN, 8, NULL, 0x40,
         NULL, HFILL }},
+    { &hf_dop_DSEType_ditBridge,
+      { "ditBridge", "dop.ditBridge",
+        FT_BOOLEAN, 8, NULL, 0x20,
+        NULL, HFILL }},
+    { &hf_dop_DSEType_writeableCopy,
+      { "writeableCopy", "dop.writeableCopy",
+        FT_BOOLEAN, 8, NULL, 0x10,
+        NULL, HFILL }},
     { &hf_dop_GrantsAndDenials_grantAdd,
       { "grantAdd", "dop.grantAdd",
         FT_BOOLEAN, 8, NULL, 0x80,
@@ -2966,7 +2966,7 @@ void proto_register_dop(void) {
         NULL, HFILL }},
 
 /*--- End of included file: packet-dop-hfarr.c ---*/
-#line 251 "packet-dop-template.c"
+#line 243 "packet-dop-template.c"
   };
 
   /* List of subtrees */
@@ -3045,7 +3045,7 @@ void proto_register_dop(void) {
     &ett_dop_GrantsAndDenials,
 
 /*--- End of included file: packet-dop-ettarr.c ---*/
-#line 258 "packet-dop-template.c"
+#line 250 "packet-dop-template.c"
   };
 
   module_t *dop_module;
@@ -3101,7 +3101,7 @@ void proto_reg_handoff_dop(void) {
 
 
 /*--- End of included file: packet-dop-dis-tab.c ---*/
-#line 291 "packet-dop-template.c"
+#line 283 "packet-dop-template.c"
   /* APPLICATION CONTEXT */
 
   oid_add_from_string("id-ac-directory-operational-binding-management","2.5.3.3");