Handling of ROS Rejects.
authorgal <gal@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 13 Apr 2008 16:11:15 +0000 (16:11 +0000)
committergal <gal@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 13 Apr 2008 16:11:15 +0000 (16:11 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24983 f5534014-38df-0310-8fa8-9805f1628bb7

asn1/ros/packet-ros-template.c
asn1/ros/ros.cnf
epan/dissectors/packet-ros.c

index bf7abe37fc05084969e0675548ca86e3db37f8e8..91645b8b42fd3ddc50df31a4eed432e430335507 100644 (file)
@@ -384,6 +384,7 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
        int old_offset;
        proto_item *item=NULL;
        proto_tree *tree=NULL;
+       proto_tree *next_tree=NULL;
        conversation_t *conversation;
        ros_conv_info_t *ros_info = NULL;
        asn1_ctx_t asn1_ctx;
@@ -451,7 +452,13 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                old_offset=offset;
                offset=dissect_ros_ROS(FALSE, tvb, offset, &asn1_ctx , tree, -1);
                if(offset == old_offset){
-                       proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte ROS PDU");
+                       item = proto_tree_add_text(tree, tvb, offset, -1,"Unknown ROS PDU");
+
+                       if(item){
+                               next_tree=proto_item_add_subtree(item, ett_ros_unknown);
+                               dissect_unknown_ber(pinfo, tvb, offset, next_tree);
+                       }
+
                        offset = tvb_length(tvb);
                        break;
                }
index 813f79da23c149e56898b34b4fae81b1d1a43c76..457fd2ddbcfa28b9127ada54383d64c9a959bf77 100644 (file)
@@ -5,6 +5,7 @@ OPERATION-PACKAGE
 CONTRACT
 InvokeId
 Code
+ROS
 
 #.TYPE_RENAME
 ReturnResult/result/result     OperationResult
@@ -134,4 +135,58 @@ Reject/problem/returnResult        rejectResult
     session->ros_op = (ROS_OP_UNBIND | ROS_OP_ERROR);
     offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
   }
+
+#.FN_BODY ROS/reject
+       if(check_col(actx->pinfo->cinfo, COL_INFO))
+               col_set_str(actx->pinfo->cinfo, COL_INFO, "Reject");
+       %(DEFAULT_BODY)s
+
+#.FN_PARS GeneralProblem
+       VAL_PTR = &problem
+
+#.FN_BODY GeneralProblem
+  guint32 problem;
+
+  %(DEFAULT_BODY)s
+
+  if (check_col(actx->pinfo->cinfo, COL_INFO)) {
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", val_to_str(problem, ros_GeneralProblem_vals, "GeneralProblem(%%d)"));
+  }
+
+#.FN_PARS InvokeProblem
+       VAL_PTR = &problem
+
+#.FN_BODY InvokeProblem
+  guint32 problem;
+
+  %(DEFAULT_BODY)s
+
+  if (check_col(actx->pinfo->cinfo, COL_INFO)) {
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", val_to_str(problem, ros_InvokeProblem_vals, "InvokeProblem(%%d)"));
+  }
+
+#.FN_PARS ReturnResultProblem
+       VAL_PTR = &problem
+
+#.FN_BODY ReturnResultProblem
+  guint32 problem;
+
+  %(DEFAULT_BODY)s
+
+  if (check_col(actx->pinfo->cinfo, COL_INFO)) {
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", val_to_str(problem, ros_ReturnResultProblem_vals, "ReturnResultProblem(%%d)"));
+  }
+
+#.FN_PARS ReturnErrorProblem
+       VAL_PTR = &problem
+
+#.FN_BODY ReturnErrorProblem
+  guint32 problem;
+
+  %(DEFAULT_BODY)s
+
+  if (check_col(actx->pinfo->cinfo, COL_INFO)) {
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", val_to_str(problem, ros_ReturnErrorProblem_vals, "ReturnErrorProblem(%%d)"));
+  }
+
 #.END
index 61e208fe1b20fe7addfc299cffa476bb6a570734..99876d61a3d81fe9541d7f532affced9cd8253f9 100644 (file)
@@ -90,7 +90,7 @@ static int hf_ros_time = -1;
 static int hf_ros_invoke = -1;                    /* Invoke */
 static int hf_ros_returnResult = -1;              /* ReturnResult */
 static int hf_ros_returnError = -1;               /* ReturnError */
-static int hf_ros_reject = -1;                    /* Reject */
+static int hf_ros_reject = -1;                    /* T_reject */
 static int hf_ros_bind_invoke = -1;               /* T_bind_invoke */
 static int hf_ros_bind_result = -1;               /* T_bind_result */
 static int hf_ros_bind_error = -1;                /* T_bind_error */
@@ -434,7 +434,7 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
 static int
 dissect_ros_T_present(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  &invokeid);
+                                                &invokeid);
 
   return offset;
 }
@@ -475,7 +475,7 @@ dissect_ros_InvokeId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
 static int
 dissect_ros_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  NULL);
+                                                NULL);
 
   return offset;
 }
@@ -485,7 +485,7 @@ dissect_ros_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_
 static int
 dissect_ros_OperationCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  &opcode);
+                                                &opcode);
 
   return offset;
 }
@@ -494,7 +494,7 @@ dissect_ros_OperationCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
 
 static int
 dissect_ros_T_argument(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 25 "ros.cnf"
+#line 26 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "invoke argument");
@@ -535,7 +535,7 @@ dissect_ros_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_,
 
 static int
 dissect_ros_OperationResult(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 40 "ros.cnf"
+#line 41 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "return result");
@@ -590,7 +590,7 @@ dissect_ros_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
 static int
 dissect_ros_ErrorCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  &opcode);
+                                                &opcode);
 
   return offset;
 }
@@ -599,7 +599,7 @@ dissect_ros_ErrorCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
 
 static int
 dissect_ros_T_parameter(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 55 "ros.cnf"
+#line 56 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "return result");
@@ -647,8 +647,18 @@ static const value_string ros_GeneralProblem_vals[] = {
 
 static int
 dissect_ros_GeneralProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  NULL);
+#line 148 "ros.cnf"
+  guint32 problem;
+
+    offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
+                                                &problem);
+
+
+  if (check_col(actx->pinfo->cinfo, COL_INFO)) {
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s", val_to_str(problem, ros_GeneralProblem_vals, "GeneralProblem(%d)"));
+  }
+
+
 
   return offset;
 }
@@ -669,8 +679,18 @@ static const value_string ros_InvokeProblem_vals[] = {
 
 static int
 dissect_ros_InvokeProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  NULL);
+#line 160 "ros.cnf"
+  guint32 problem;
+
+    offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
+                                                &problem);
+
+
+  if (check_col(actx->pinfo->cinfo, COL_INFO)) {
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s", val_to_str(problem, ros_InvokeProblem_vals, "InvokeProblem(%d)"));
+  }
+
+
 
   return offset;
 }
@@ -686,8 +706,18 @@ static const value_string ros_ReturnResultProblem_vals[] = {
 
 static int
 dissect_ros_ReturnResultProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  NULL);
+#line 172 "ros.cnf"
+  guint32 problem;
+
+    offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
+                                                &problem);
+
+
+  if (check_col(actx->pinfo->cinfo, COL_INFO)) {
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s", val_to_str(problem, ros_ReturnResultProblem_vals, "ReturnResultProblem(%d)"));
+  }
+
+
 
   return offset;
 }
@@ -705,8 +735,18 @@ static const value_string ros_ReturnErrorProblem_vals[] = {
 
 static int
 dissect_ros_ReturnErrorProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  NULL);
+#line 184 "ros.cnf"
+  guint32 problem;
+
+    offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
+                                                &problem);
+
+
+  if (check_col(actx->pinfo->cinfo, COL_INFO)) {
+       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s", val_to_str(problem, ros_ReturnErrorProblem_vals, "ReturnErrorProblem(%d)"));
+  }
+
+
 
   return offset;
 }
@@ -754,9 +794,24 @@ dissect_ros_Reject(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_,
 
 
 
+static int
+dissect_ros_T_reject(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 140 "ros.cnf"
+       if(check_col(actx->pinfo->cinfo, COL_INFO))
+               col_set_str(actx->pinfo->cinfo, COL_INFO, "Reject");
+         offset = dissect_ros_Reject(implicit_tag, tvb, offset, actx, tree, hf_index);
+
+
+
+
+  return offset;
+}
+
+
+
 static int
 dissect_ros_T_bind_invoke(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 71 "ros.cnf"
+#line 72 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "bind-invoke");
@@ -776,7 +831,7 @@ dissect_ros_T_bind_invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
 
 static int
 dissect_ros_T_bind_result(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 82 "ros.cnf"
+#line 83 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "bind-result");
@@ -796,7 +851,7 @@ dissect_ros_T_bind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
 
 static int
 dissect_ros_T_bind_error(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 93 "ros.cnf"
+#line 94 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "bind-error");
@@ -817,7 +872,7 @@ dissect_ros_T_bind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
 
 static int
 dissect_ros_T_unbind_invoke(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 105 "ros.cnf"
+#line 106 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "unbind-invoke");
@@ -838,7 +893,7 @@ dissect_ros_T_unbind_invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
 
 static int
 dissect_ros_T_unbind_result(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 117 "ros.cnf"
+#line 118 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "unbind-result");
@@ -858,7 +913,7 @@ dissect_ros_T_unbind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
 
 static int
 dissect_ros_T_unbind_error(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 128 "ros.cnf"
+#line 129 "ros.cnf"
   char *oid;
   /* not sure what the length should be - -1 for now */
   proto_tree_add_text(tree, tvb, offset,-1, "unbind-error");
@@ -870,11 +925,12 @@ dissect_ros_T_unbind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
   }
 
 
+
   return offset;
 }
 
 
-static const value_string ros_ROS_vals[] = {
+const value_string ros_ROS_vals[] = {
   {   1, "invoke" },
   {   2, "returnResult" },
   {   3, "returnError" },
@@ -892,7 +948,7 @@ static const ber_choice_t ROS_choice[] = {
   {   1, &hf_ros_invoke          , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_ros_Invoke },
   {   2, &hf_ros_returnResult    , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_ros_ReturnResult },
   {   3, &hf_ros_returnError     , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ros_ReturnError },
-  {   4, &hf_ros_reject          , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_ros_Reject },
+  {   4, &hf_ros_reject          , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_ros_T_reject },
   {  16, &hf_ros_bind_invoke     , BER_CLASS_CON, 16, BER_FLAGS_IMPLTAG, dissect_ros_T_bind_invoke },
   {  17, &hf_ros_bind_result     , BER_CLASS_CON, 17, BER_FLAGS_IMPLTAG, dissect_ros_T_bind_result },
   {  18, &hf_ros_bind_error      , BER_CLASS_CON, 18, BER_FLAGS_IMPLTAG, dissect_ros_T_bind_error },
@@ -902,7 +958,7 @@ static const ber_choice_t ROS_choice[] = {
   { 0, NULL, 0, 0, 0, NULL }
 };
 
-static int
+int
 dissect_ros_ROS(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ber_choice(actx, tree, tvb, offset,
                                  ROS_choice, hf_index, ett_ros_ROS,
@@ -947,7 +1003,7 @@ dissect_ros_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a
 static int
 dissect_ros_Priority(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
-                                  NULL);
+                                                NULL);
 
   return offset;
 }
@@ -966,6 +1022,7 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
        int old_offset;
        proto_item *item=NULL;
        proto_tree *tree=NULL;
+       proto_tree *next_tree=NULL;
        conversation_t *conversation;
        ros_conv_info_t *ros_info = NULL;
        asn1_ctx_t asn1_ctx;
@@ -1033,7 +1090,13 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                old_offset=offset;
                offset=dissect_ros_ROS(FALSE, tvb, offset, &asn1_ctx , tree, -1);
                if(offset == old_offset){
-                       proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte ROS PDU");
+                       item = proto_tree_add_text(tree, tvb, offset, -1,"Unknown ROS PDU");
+
+                       if(item){
+                               next_tree=proto_item_add_subtree(item, ett_ros_unknown);
+                               dissect_unknown_ber(pinfo, tvb, offset, next_tree);
+                       }
+
                        offset = tvb_length(tvb);
                        break;
                }
@@ -1094,7 +1157,7 @@ void proto_register_ros(void) {
     { &hf_ros_reject,
       { "reject", "ros.reject",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ros.Reject", HFILL }},
+        "ros.T_reject", HFILL }},
     { &hf_ros_bind_invoke,
       { "bind-invoke", "ros.bind_invoke",
         FT_NONE, BASE_NONE, NULL, 0,
@@ -1189,7 +1252,7 @@ void proto_register_ros(void) {
         "ros.OBJECT_IDENTIFIER", HFILL }},
 
 /*--- End of included file: packet-ros-hfarr.c ---*/
-#line 498 "packet-ros-template.c"
+#line 505 "packet-ros-template.c"
   };
 
   /* List of subtrees */
@@ -1210,7 +1273,7 @@ void proto_register_ros(void) {
     &ett_ros_Code,
 
 /*--- End of included file: packet-ros-ettarr.c ---*/
-#line 505 "packet-ros-template.c"
+#line 512 "packet-ros-template.c"
   };
 
   /* Register protocol */