aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/cdt/cdt.cnf
blob: 299ee1e7b2524c66ed4269e486e2194dfcbb8e05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# cdt.cnf
# Compressed Data Type conformation file

#.EXPORTS
CompressedData

#.REGISTER
CompressedData    B "1.3.26.0.4406.0.4.2"  "cdt"

#.FN_BODY CompressedData
  content_type = 0;

  %(DEFAULT_BODY)s

#.FN_PARS AlgorithmID-ShortForm
  VAL_PTR = &value

#.FN_BODY AlgorithmID-ShortForm
  guint32 value;

  %(DEFAULT_BODY)s
  proto_item_append_text (cdt_item, ", %%s",
                          val_to_str (value, cdt_AlgorithmID_ShortForm_vals,
                                      "unknown"));

  col_append_fstr (actx->pinfo->cinfo, COL_INFO, "%%s ",
                   val_to_str (value, cdt_AlgorithmID_ShortForm_vals,
                               "unknown"));

#.FN_PARS ContentType-ShortForm
  VAL_PTR = &content_type

#.FN_BODY ContentType-ShortForm

  %(DEFAULT_BODY)s
  proto_item_append_text (cdt_item, ", %%s",
                          val_to_str (content_type, cdt_ContentType_ShortForm_vals,
                                      "unknown"));

  col_append_fstr (actx->pinfo->cinfo, COL_INFO, "%%s ",
                   val_to_str (content_type, cdt_ContentType_ShortForm_vals,
                               "unknown"));

#.FN_PARS CompressedContentInfo/contentType/contentType-OID
  FN_VARIANT = _str  VAL_PTR = &obj_id

#.FN_BODY CompressedContentInfo/contentType/contentType-OID
  const char *obj_id = NULL;

  %(DEFAULT_BODY)s
  if (obj_id) {
    const char *name = oid_resolved_from_string (wmem_packet_scope(), obj_id);

    if (!name) {
      name = obj_id;
    }

    proto_item_append_text (cdt_item, ", %%s", name);

    col_append_fstr (actx->pinfo->cinfo, COL_INFO, "%%s ", name);
  }

#.FN_PARS CompressedContent
  VAL_PTR = &compr_tvb

#.FN_BODY CompressedContent
  tvbuff_t   *next_tvb = NULL, *compr_tvb = NULL;
  int         save_offset = offset;

  %(DEFAULT_BODY)s
  if (compr_tvb == NULL) {
    proto_tree_add_expert(top_tree, actx->pinfo, &ei_cdt_unable_compress_content,
							tvb, save_offset, -1);
    col_append_str (actx->pinfo->cinfo, COL_INFO,
                    "[Error: Unable to get compressed content]");
    return offset;
  }

  next_tvb = tvb_child_uncompress (tvb, compr_tvb, 0, tvb_reported_length (compr_tvb));

  if (next_tvb == NULL) {
    proto_tree_add_expert(top_tree, actx->pinfo, &ei_cdt_unable_uncompress_content,
							tvb, save_offset, -1);
    col_append_str (actx->pinfo->cinfo, COL_INFO,
                    "[Error: Unable to uncompress content]");
    return offset;
  }

  add_new_data_source (actx->pinfo, next_tvb, "Uncompressed Content");

   switch (content_type) {
   case CDT_UNDEFINED:
     call_data_dissector(next_tvb, actx->pinfo, top_tree);
     break;
   case CDT_EXTERNAL:
     dissect_unknown_ber (actx->pinfo, next_tvb, 0, top_tree);
     break;
   case CDT_P1:
     dissect_p1_mts_apdu (next_tvb, actx->pinfo, top_tree, NULL);
     break;
   default:
     call_data_dissector(next_tvb, actx->pinfo, top_tree);
     break;
   }

#.END