aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/mms/mms.cnf
blob: 31bdc47d1b61d84fa8c4eb42b8dabede94ae8dff (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
# mms.cnf
# mms conformation file

# $Id$

#.MODULE_IMPORT
ISO-8650-ACSE-1 acse

#.IMPORT ../acse/acse-exp.cnf

#.EXPORTS
MMSpdu

#.PDU

#.NO_EMIT

#.TYPE_RENAME

#.TYPE_ATTR
TimeOfDay	TYPE = FT_STRING DISPLAY = BASE_NONE

#.FIELD_RENAME

#.FN_BODY ApplicationReference/ap-title
  offset=dissect_acse_AP_title(FALSE, tvb, offset, actx, tree, hf_mms_ap_title);

#.FN_BODY ApplicationReference/ap-invocation-id
  offset=dissect_acse_AP_invocation_identifier(FALSE, tvb, offset, actx, tree, hf_mms_ap_invocation_id);

#.FN_BODY ApplicationReference/ae-qualifier
  offset=dissect_acse_AE_qualifier(FALSE, tvb, offset, actx, tree, hf_mms_ae_qualifier);

#.FN_BODY ApplicationReference/ae-invocation-id
  offset=dissect_acse_AE_invocation_identifier(FALSE, tvb, offset, actx, tree, hf_mms_ae_invocation_id);

#.FN_BODY MMSpdu VAL_PTR=&branch_taken
  gint branch_taken;

%(DEFAULT_BODY)s

  if( (branch_taken!=-1) && mms_MMSpdu_vals[branch_taken].strptr ){
    if(check_col(actx->pinfo->cinfo, COL_INFO))
      col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%%s ", mms_MMSpdu_vals[branch_taken].strptr);
  }



#.FN_BODY TimeOfDay

	guint32 len;
	proto_item *cause;
	guint32 milliseconds;
	guint16 days;
	gchar *	ptime;
	nstime_t ts;

	len = tvb_length_remaining(tvb, offset);

	if(len == 4)
	{
		milliseconds = tvb_get_ntohl(tvb, offset);
		ptime = time_msecs_to_str(milliseconds);

		if(hf_index >= 0)
		{
			proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
		}
		return offset;
	}

	if(len == 6)
	{
		milliseconds = tvb_get_ntohl(tvb, offset);
		days = tvb_get_ntohs(tvb, offset+4);

		/* 5113 days between 01-01-1970 and 01-01-1984 */
		/* 86400 seconds in one day */

		ts.secs = (days + 5113) * 86400 + milliseconds / 1000;
		ts.nsecs = (milliseconds %% 1000) * G_GINT64_CONSTANT(1000000U);

		ptime = abs_time_to_str(&ts, TRUE);
		if(hf_index >= 0)
		{
			proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
		}

		return offset;
	}

	cause = proto_tree_add_text(tree, tvb, offset, len,
			"BER Error: malformed TimeOfDay encoding, "
			"length must be 4 or 6 bytes");
	proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
	expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: malformed TimeOfDay encoding");
	if(hf_index >= 0)
	{
		proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
	}
	return offset;