static void dissect_icep_request(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *icep_tree, proto_item* icep_item) { /* p. 612, chapter 23.3.2: * * struct RequestData { * int requestID; * Ice::Identity id; * Ice::StringSeq facet; * string operation; * byte mode; * Ice::Context context; * Encapsulation params; * } */ proto_item *ti = NULL; proto_tree *icep_sub_tree = NULL; gint32 consumed = 0; guint32 reqid = 0; DBG0("dissect request\n"); /* check for req id */ if ( !tvb_bytes_exist(tvb, offset, 4) ) { expert_add_info_format(pinfo, icep_item, &ei_icep_length, "too short header"); col_append_str(pinfo->cinfo, COL_INFO, " (too short header)"); return; } /* got at least 4 bytes */ /* create display subtree for this message type */ reqid = tvb_get_letohl(tvb, offset); ti = proto_tree_add_text(icep_tree, tvb, offset, -1, "Request Message Body"); icep_sub_tree = proto_item_add_subtree(ti, ett_icep_msg); proto_tree_add_item(icep_sub_tree, hf_icep_request_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); if ( reqid != 0 ) { col_append_fstr(pinfo->cinfo, COL_INFO, "(%d):", tvb_get_letohl(tvb, offset)); } else col_append_str(pinfo->cinfo, COL_INFO, "(oneway):"); offset += 4; DBG0("consumed --> 4\n"); dissect_icep_request_common(tvb, offset, pinfo, icep_sub_tree, ti, &consumed); if ( consumed == -1 ) return; /*offset += consumed;*/ DBG1("consumed --> %d\n", consumed); }
static void dissect_icep_batch_request(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *icep_tree, proto_item* icep_item) { /* p. 613, chapter 23.3.3 * A batch request msg is a "sequence" of batch request * Sequence is Size + elements * * struct BatchRequestData { * Ice::Identity id; * Ice::StringSeq facet; * string operation; * byte mode; * Ice::Context context; * Encapsulation params; * } * * NOTE!!!: * The only real implementation of the Ice protocol puts a 32bit count in front * of a Batch Request, *not* an Ice::Sequence (as the standard says). Basically the * same people wrote both code and standard so I'll follow the code. */ proto_item *ti = NULL; proto_tree *icep_sub_tree = NULL; guint32 num_reqs = 0; guint32 i = 0; gint32 consumed = 0; DBG0("dissect batch request\n"); /* check for first 4 byte */ if ( !tvb_bytes_exist(tvb, offset, 4) ) { if (icep_item) expert_add_info_format(pinfo, icep_item, PI_MALFORMED, PI_ERROR, "counter of batch requests missing"); col_append_str(mypinfo->cinfo, COL_INFO, " (counter of batch requests missing)"); return; } num_reqs = tvb_get_letohl(tvb, offset); offset += 4; DBG1("batch_requests.count --> %d\n", num_reqs); if ( num_reqs > icep_max_batch_requests ) { if (icep_item) expert_add_info_format(pinfo, icep_item, PI_PROTOCOL, PI_WARN, "too many batch requests (%d)", num_reqs); if ( check_col(mypinfo->cinfo, COL_INFO) ) { col_append_fstr(mypinfo->cinfo, COL_INFO, " (too many batch requests, %d)", num_reqs); } return; } if ( num_reqs == 0 ) { if (icep_tree) proto_tree_add_text(icep_tree, tvb, offset, -1, "empty batch requests sequence"); col_append_str(mypinfo->cinfo, COL_INFO, " (empty batch requests sequence)"); return; } col_append_str(mypinfo->cinfo, COL_INFO, ":"); /* * process requests */ for ( i = 0; i < num_reqs; i++ ) { DBG1("looping through sequence of batch requests, loop #%d\n", i); /* create display subtree for this message type */ if (icep_tree) { ti = proto_tree_add_text(icep_tree, tvb, offset, -1, "Batch Request Message Body: #%d", i); icep_sub_tree = proto_item_add_subtree(ti, ett_icep_msg); } if ( check_col(mypinfo->cinfo, COL_INFO) && (i != 0) ) { col_append_str(mypinfo->cinfo, COL_INFO, ","); } dissect_icep_request_common(tvb, offset, pinfo, icep_sub_tree, ti, &consumed); if ( consumed == -1 ) return; if ( icep_tree && ti ) proto_item_set_len(ti, consumed); offset += consumed; DBG1("consumed --> %d\n", consumed); } }