2 # ROS ReturnError common code
3 # Copyright 2007 Tomas Kukosa
6 dissector_handle_t err_handle = NULL;
7 const char *descr = "";
11 actx->rose_ctx->d.pdu = 3;
13 if ((actx->rose_ctx->d.code == 0) && actx->rose_ctx->err_local_dissector_table) {
14 err_handle = dissector_get_uint_handle(actx->rose_ctx->err_local_dissector_table, actx->rose_ctx->d.code_local);
15 } else if ((actx->rose_ctx->d.code == 1) && actx->rose_ctx->err_global_dissector_table) {
16 err_handle = dissector_get_string_handle(actx->rose_ctx->err_global_dissector_table, actx->rose_ctx->d.code_global);
22 !proto_is_protocol_enabled(find_protocol_by_id(dissector_handle_get_protocol_index(err_handle)))) {
23 if (actx->rose_ctx->d.code == 0)
24 descr = wmem_strdup_printf(actx->pinfo->pool, "ERR: %d", actx->rose_ctx->d.code_local);
25 else if (actx->rose_ctx->d.code == 1)
26 descr = wmem_strdup_printf(actx->pinfo->pool, "ERR: %s", actx->rose_ctx->d.code_global);
28 descr = wmem_strdup(actx->pinfo->pool, "ERR:");
31 if (actx->rose_ctx->apdu_depth >= 0)
32 proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", descr);
33 if (actx->rose_ctx->fillin_info)
34 col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
35 if (actx->rose_ctx->fillin_ptr)
36 (void) g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
38 if (!err_next_tvb) { /* empty error */
39 err_next_tvb = tvb_new_subset_length_caplen(tvb, (actx->encoding==ASN1_ENC_PER)?offset>>3:offset, 0, 0);
42 call_dissector_with_data((err_handle)?err_handle:data_handle, err_next_tvb, actx->pinfo, tree, actx->rose_ctx);
44 expert_add_info_format(actx->pinfo, tree, &ei_ros_undecoded, "Undecoded %s", descr);