2 * Routines for Transport-Neutral Encapsulation Format (TNEF) packet disassembly
6 * Copyright (c) 2007 by Graeme Lunt
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1999 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 #include <epan/packet.h>
39 #include <epan/conversation.h>
40 #include <epan/addr_resolv.h>
41 #include <epan/strutil.h>
43 #include <wiretap/tnef.h>
45 #include "packet-dcerpc.h"
46 #include "packet-dcerpc-nspi.h"
47 #include "packet-ber.h"
49 #define PNAME "Transport-Neutral Encapsulation Format"
53 #define ATP_TRIPLES (0x0000)
54 #define ATP_STRING (0x0001)
55 #define ATP_TEXT (0x0002)
56 #define ATP_DATE (0x0003)
57 #define ATP_SHORT (0x0004)
58 #define ATP_LONG (0x0005)
59 #define ATP_BYTE (0x0006)
60 #define ATP_WORD (0x0007)
61 #define ATP_DWORD (0x0008)
62 #define ATP_MAX (0x0009)
64 #define ATT_OWNER (0x00060000) /* handled */
65 #define ATT_SENT_FOR (0x00060001) /* handled */
66 #define ATT_DELEGATE (0x00060002)
67 #define ATT_DATE_START (0x00030006) /* handled */
68 #define ATT_DATE_END (0x00030007) /* handled */
69 #define ATT_AID_OWNER (0x00040008)
70 #define ATT_REQUEST_RES (0x00040009)
72 #define ATT_FROM (0x00008000)
73 #define ATT_SUBJECT (0x00018004)
74 #define ATT_DATE_SENT (0x00038005) /* handled */
75 #define ATT_DATE_RECD (0x00038006) /* handled */
76 #define ATT_MESSAGE_STATUS (0x00068007)
77 #define ATT_MESSAGE_CLASS (0x00078008) /* handled */
78 #define ATT_MESSAGE_ID (0x00018009)
79 #define ATT_PARENT_ID (0x0001800A) /* handled */
80 #define ATT_CONVERSATION_ID (0x0001800B) /* handled */
81 #define ATT_BODY (0x0002800C)
82 #define ATT_PRIORITY (0x0004800D) /* handled */
83 #define ATT_ATTACH_DATA (0x0006800F)
84 #define ATT_ATTACH_TITLE (0x00018010) /* handled */
85 #define ATT_ATTACH_META_FILE (0x00068011)
86 #define ATT_ATTACH_CREATE_DATE (0x00038012) /* handled */
87 #define ATT_ATTACH_MODIFY_DATE (0x00038013) /* handled */
88 #define ATT_DATE_MODIFIED (0x00038020) /* handled */
90 #define ATT_ATTACH_TRANSPORT_FILENAME (0x00069001)
91 #define ATT_ATTACH_REND_DATA (0x00069002)
92 #define ATT_MAPI_PROPS (0x00069003) /* handled */
93 #define ATT_RECIP_TABLE (0x00069004)
94 #define ATT_ATTACHMENT (0x00069005)
95 #define ATT_TNEF_VERSION (0x00089006) /* handled */
96 #define ATT_OEM_CODEPAGE (0x00069007) /* handled */
97 #define ATT_ORIGINAL_MESSAGE_CLASS (0x00079008) /* handled */
99 static int proto_tnef = -1;
101 static int hf_tnef_signature = -1;
102 static int hf_tnef_key = -1;
103 static int hf_tnef_attribute = -1;
104 static int hf_tnef_attribute_lvl = -1;
105 static int hf_tnef_attribute_tag = -1;
106 static int hf_tnef_attribute_tag_type = -1;
107 static int hf_tnef_attribute_tag_id = -1;
108 static int hf_tnef_attribute_length = -1;
109 static int hf_tnef_attribute_value = -1;
110 static int hf_tnef_attribute_string = -1;
111 static int hf_tnef_attribute_date = -1;
112 static int hf_tnef_attribute_display_name = -1;
113 static int hf_tnef_attribute_email_address = -1;
114 static int hf_tnef_attribute_checksum = -1;
115 static int hf_tnef_mapi_props = -1;
116 static int hf_tnef_oem_codepage = -1;
117 static int hf_tnef_version = -1;
118 static int hf_tnef_message_class = -1;
119 static int hf_tnef_original_message_class = -1;
120 static int hf_tnef_priority = -1;
121 static int hf_tnef_mapi_props_count = -1;
123 static int hf_tnef_property = -1;
124 static int hf_tnef_property_tag = -1;
125 static int hf_tnef_property_tag_type = -1;
126 static int hf_tnef_property_tag_id = -1;
127 static int hf_tnef_property_tag_set = -1;
128 static int hf_tnef_property_tag_kind = -1;
129 static int hf_tnef_property_tag_name_id = -1;
130 static int hf_tnef_property_tag_name_length = -1;
131 static int hf_tnef_property_tag_name_string = -1;
132 static int hf_tnef_property_padding = -1;
133 static int hf_tnef_padding = -1;
135 static int hf_tnef_values_count = -1;
136 static int hf_tnef_value_length = -1;
138 static int hf_tnef_attribute_date_year = -1;
139 static int hf_tnef_attribute_date_month = -1;
140 static int hf_tnef_attribute_date_day = -1;
141 static int hf_tnef_attribute_date_hour = -1;
142 static int hf_tnef_attribute_date_minute = -1;
143 static int hf_tnef_attribute_date_second = -1;
144 static int hf_tnef_attribute_date_day_of_week = -1;
146 static int hf_tnef_PropValue_i = -1;
147 static int hf_tnef_PropValue_l = -1;
148 static int hf_tnef_PropValue_b = -1;
149 static int hf_tnef_PropValue_lpszA = -1;
150 static int hf_tnef_PropValue_bin = -1;
151 static int hf_tnef_PropValue_ft = -1;
152 static int hf_tnef_PropValue_err = -1;
153 static int hf_tnef_PropValue_MVi = -1;
154 static int hf_tnef_PropValue_MVl = -1;
155 static int hf_tnef_PropValue_MVszA = -1;
156 static int hf_tnef_PropValue_MVbin = -1;
157 static int hf_tnef_PropValue_MVguid = -1;
158 static int hf_tnef_PropValue_MVszW = -1;
159 static int hf_tnef_PropValue_MVft = -1;
160 static int hf_tnef_PropValue_null = -1;
161 static int hf_tnef_PropValue_object = -1;
163 static int ett_tnef = -1;
164 static int ett_tnef_attribute = -1;
165 static int ett_tnef_attribute_tag = -1;
166 static int ett_tnef_mapi_props = -1;
167 static int ett_tnef_property = -1;
168 static int ett_tnef_property_tag = -1;
169 static int ett_tnef_counted_items = -1;
170 static int ett_tnef_attribute_date = -1;
171 static int ett_tnef_attribute_address = -1;
173 static const value_string tnef_Lvl_vals[] = {
174 { 1, "LVL-MESSAGE" },
175 { 2, "LVL-ATTACHMENT" },
179 static const value_string tnef_Priority_vals[] = {
186 static const value_string tnef_Types_vals[] = {
187 { ATP_TRIPLES, "Triples" },
188 { ATP_STRING, "String"},
189 { ATP_TEXT, "Text" },
191 { ATP_SHORT, "Short"},
195 { ATP_DWORD, "DWord"},
200 static const value_string weekday_vals[] = {
211 static const value_string tnef_Attribute_vals[] = {
212 { ATT_OWNER, "ATT_OWNER" },
213 { ATT_SENT_FOR, "ATT_SENT_FOR" },
214 { ATT_DELEGATE, "ATT_DELEGATE" },
215 { ATT_OWNER, "ATT_OWNER" },
216 { ATT_DATE_START, "ATT_DATE_START" },
217 { ATT_DATE_END, "ATT_DATE_END" },
218 { ATT_AID_OWNER, "ATT_AID_OWNER" },
219 { ATT_REQUEST_RES, "ATT_REQUEST_RES" },
220 { ATT_FROM, "ATT_FROM" },
221 { ATT_SUBJECT, "ATT_SUBJECT" },
222 { ATT_DATE_SENT, "ATT_DATE_SENT" },
223 { ATT_DATE_RECD, "ATT_DATE_RECD" },
224 { ATT_MESSAGE_STATUS, "ATT_MESSAGE_STATUS" },
225 { ATT_MESSAGE_CLASS, "ATT_MESSAGE_CLASS" },
226 { ATT_MESSAGE_ID, "ATT_MESSAGE_ID" },
227 { ATT_PARENT_ID, "ATT_PARENT_ID" },
228 { ATT_CONVERSATION_ID, "ATT_CONVERSATION_ID" },
229 { ATT_BODY, "ATT_BODY" },
230 { ATT_PRIORITY, "ATT_PRIORITY" },
231 { ATT_ATTACH_DATA, "ATT_ATTACH_DATA" },
232 { ATT_ATTACH_TITLE, "ATT_ATTACH_TITLE" },
233 { ATT_ATTACH_META_FILE, "ATT_ATTACH_META_FILE" },
234 { ATT_ATTACH_CREATE_DATE, "ATT_ATTACH_CREATE_DATE" },
235 { ATT_ATTACH_MODIFY_DATE, "ATT_ATTACH_MODIFY_DATE" },
236 { ATT_DATE_MODIFIED, "ATT_DATE_MODIFIED" },
237 { ATT_ATTACH_TRANSPORT_FILENAME, "ATT_ATTACH_TRANSPORT_FILENAME" },
238 { ATT_ATTACH_REND_DATA, "ATT_ATTACH_REND_DATA" },
239 { ATT_MAPI_PROPS, "ATT_MAPI_PROPS" },
240 { ATT_RECIP_TABLE, "ATT_RECIP_TABLE" },
241 { ATT_ATTACHMENT, "ATT_ATTACHMENT" },
242 { ATT_TNEF_VERSION, "ATT_TNEF_VERSION" },
243 { ATT_OEM_CODEPAGE, "ATT_OEM_CODEPAGE" },
244 { ATT_ORIGINAL_MESSAGE_CLASS, "ATT_ORIGINAL_MESSAGE_CLASS" },
248 static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packet_info *pinfo _U_, proto_tree *tree, gboolean single)
251 guint32 length, count, i;
253 count = tvb_get_letohl(tvb, offset);
254 item = proto_tree_add_item(tree, hf_tnef_values_count, tvb, offset, 4, TRUE);
258 item = proto_tree_add_text(tree, tvb, offset, 4,
259 "Expecting a single item but found %d", count);
260 proto_item_set_expert_flags(item, PI_MALFORMED, PI_ERROR);
262 tree = proto_item_add_subtree(item, ett_tnef_counted_items);
268 for(i = 0; i < count; i++) {
270 length = tvb_get_letohl(tvb, offset);
271 proto_tree_add_item(tree, hf_tnef_value_length, tvb, offset, 4, TRUE);
274 proto_tree_add_item(tree, hf_id, tvb, offset, length, FALSE);
277 /* XXX: may be padding ? */
284 static gint dissect_counted_address(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree)
288 length = tvb_get_letohs(tvb, offset);
289 proto_tree_add_item(tree, hf_tnef_value_length, tvb, offset, 2, TRUE);
292 proto_tree_add_item(tree, hf_tnef_attribute_display_name, tvb, offset, length, FALSE);
295 length = tvb_get_letohs(tvb, offset);
296 proto_tree_add_item(tree, hf_tnef_value_length, tvb, offset, 2, TRUE);
299 proto_tree_add_item(tree, hf_tnef_attribute_email_address, tvb, offset, length, FALSE);
306 static void dissect_DTR(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
313 item = proto_tree_add_item(tree, hf_tnef_attribute_date_year, tvb, offset, 2, TRUE);
316 item = proto_tree_add_item(tree, hf_tnef_attribute_date_month, tvb, offset, 2, TRUE);
319 item = proto_tree_add_item(tree, hf_tnef_attribute_date_day, tvb, offset, 2, TRUE);
322 item = proto_tree_add_item(tree, hf_tnef_attribute_date_hour, tvb, offset, 2, TRUE);
325 item = proto_tree_add_item(tree, hf_tnef_attribute_date_minute, tvb, offset, 2, TRUE);
328 item = proto_tree_add_item(tree, hf_tnef_attribute_date_second, tvb, offset, 2, TRUE);
331 item = proto_tree_add_item(tree, hf_tnef_attribute_date_day_of_week, tvb, offset, 2, TRUE);
336 static void dissect_mapiprops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
338 proto_item *item, *prop_item;
339 proto_tree *prop_tree, *tag_tree;
340 guint32 count, tag, tag_kind, tag_length;
342 gint offset, start_offset;
344 guint8 drep[] = {0x10 /* LE */, /* DCE_RPC_DREP_FP_IEEE */ 0 };
346 void *old_private_data;
350 di.conformant_run = 0;
353 old_private_data = pinfo->private_data;
354 pinfo->private_data = &di;
356 /* first the count */
357 item = proto_tree_add_item(tree, hf_tnef_mapi_props_count, tvb, offset, 4, TRUE);
358 count = tvb_get_letohl(tvb, offset);
362 while(tvb_length_remaining(tvb, offset) > 0 ) {
364 start_offset = offset;
366 /* get the property tag */
368 prop_item = proto_tree_add_item(tree, hf_tnef_property, tvb, offset, -1, TRUE);
369 prop_tree = proto_item_add_subtree(prop_item, ett_tnef_property);
371 item = proto_tree_add_item(prop_tree, hf_tnef_property_tag, tvb, offset, 4, TRUE);
372 tag_tree = proto_item_add_subtree(item, ett_tnef_property_tag);
374 /* add a nice name to the property */
375 tag = tvb_get_letohl(tvb, offset);
376 proto_item_append_text(prop_item, " %s", val_to_str(tag, nspi_MAPITAGS_vals, "Unknown tag (0x%08lx)"));
378 proto_tree_add_item(tag_tree, hf_tnef_property_tag_type, tvb, offset, 2, TRUE);
381 proto_tree_add_item(tag_tree, hf_tnef_property_tag_id, tvb, offset, 2, TRUE);
384 if(tag & 0x80000000) {
386 /* it is a named property */
387 proto_tree_add_item(tag_tree, hf_tnef_property_tag_set, tvb, offset, 16, TRUE);
390 tag_kind = tvb_get_letohl(tvb, offset);
391 proto_tree_add_item(tag_tree, hf_tnef_property_tag_kind, tvb, offset, 4, TRUE);
395 proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_id, tvb, offset, 4, TRUE);
398 proto_item_append_text(prop_item, " [Named Property]");
400 char *name_string = NULL;
402 tag_length = tvb_get_letohl(tvb, offset);
403 proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_length, tvb, offset, 4, TRUE);
406 name_string = tvb_get_ephemeral_faked_unicode (tvb, offset, tag_length / 2, TRUE);
407 proto_tree_add_string_format(tag_tree, hf_tnef_property_tag_name_string, tvb, offset,
408 tag_length, name_string, "Name: %s", name_string);
409 offset += tag_length;
411 if((padding = (4 - tag_length % 4)) != 4) {
412 proto_tree_add_item(tag_tree, hf_tnef_property_padding, tvb, offset, padding, TRUE);
416 proto_item_append_text(prop_item, " [Named Property: %s]", name_string);
422 /* handle any specific tags here */
424 /* otherwise just use the type */
425 switch(tag & 0x0000ffff) {
427 offset = PIDL_dissect_uint16(tvb, offset, pinfo, prop_tree, drep, hf_tnef_PropValue_i, 0);
430 offset = PIDL_dissect_uint32(tvb, offset, pinfo, prop_tree, drep, hf_tnef_PropValue_l, 0);
433 offset = PIDL_dissect_uint16(tvb, offset, pinfo, prop_tree, drep, hf_tnef_PropValue_b, 0);
436 offset = dissect_counted_values(tvb, offset, hf_tnef_PropValue_lpszA, pinfo, prop_tree, TRUE);
439 offset = dissect_counted_values(tvb, offset, hf_tnef_PropValue_bin, pinfo, prop_tree, TRUE);
441 case PT_UNICODE: /* XXX */
442 /* offset = nspi_dissect_element_SPropValue_CTR_lpszW(tvb, offset, pinfo, prop_tree, drep); */
444 case PT_CLSID: /* XXX */
445 /* offset = nspi_dissect_element_SPropValue_CTR_lpguid(tvb, offset, pinfo, prop_tree, drep); */
448 offset = nspi_dissect_struct_FILETIME(tvb,offset,pinfo,prop_tree,drep,hf_tnef_PropValue_ft,0);
451 offset = nspi_dissect_enum_MAPISTATUS(tvb, offset, pinfo, prop_tree, drep, hf_tnef_PropValue_err, 0);
454 offset = nspi_dissect_struct_SShortArray(tvb,offset,pinfo,prop_tree,drep,hf_tnef_PropValue_MVi,0);
457 offset = nspi_dissect_struct_MV_LONG_STRUCT(tvb,offset,pinfo,prop_tree,drep,hf_tnef_PropValue_MVl,0);
460 offset = nspi_dissect_struct_SLPSTRArray(tvb,offset,pinfo,prop_tree,drep,hf_tnef_PropValue_MVszA,0);
463 offset = nspi_dissect_struct_SBinaryArray(tvb,offset,pinfo,prop_tree,drep,hf_tnef_PropValue_MVbin,0);
466 offset = nspi_dissect_struct_SGuidArray(tvb,offset,pinfo,prop_tree,drep,hf_tnef_PropValue_MVguid,0);
469 offset = nspi_dissect_struct_MV_UNICODE_STRUCT(tvb,offset,pinfo,prop_tree,drep,hf_tnef_PropValue_MVszW,0);
472 offset = nspi_dissect_struct_SDateTimeArray(tvb,offset,pinfo,prop_tree,drep,hf_tnef_PropValue_MVft,0);
475 offset = PIDL_dissect_uint32(tvb, offset, pinfo, prop_tree, drep, hf_tnef_PropValue_null, 0);
478 offset = PIDL_dissect_uint32(tvb, offset, pinfo, prop_tree, drep, hf_tnef_PropValue_object, 0);
483 /* we may need to pad to a 4-byte boundary */
484 if((padding = (4 - (offset - start_offset) % 4)) != 4) {
487 item = proto_tree_add_item(prop_tree, hf_tnef_property_padding, tvb, offset, padding, TRUE);
492 proto_item_set_len(prop_item, offset - start_offset);
495 /* restore private_data */
496 pinfo->private_data = old_private_data;
500 static void dissect_tnef(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
502 proto_item *attr_item, *item;
503 proto_tree *attr_tree, *tag_tree, *props_tree, *addr_tree, *date_tree;
504 guint32 tag, length, signature;
505 gint offset, start_offset;
509 item = proto_tree_add_item(tree, proto_tnef, tvb, 0, -1, FALSE);
510 tree = proto_item_add_subtree(item, ett_tnef);
515 /* first the signature */
516 signature = tvb_get_letohl(tvb, offset);
517 item = proto_tree_add_item(tree, hf_tnef_signature, tvb, offset, 4, TRUE);
520 /* check the signature */
521 if(signature != TNEF_SIGNATURE) {
523 proto_item_append_text(item, " [Incorrect, should be 0x%x. No further dissection possible. Check any Content-Transfer-Encoding has been removed.]", TNEF_SIGNATURE);
525 proto_item_set_expert_flags(item, PI_MALFORMED, PI_WARN);
531 proto_item_append_text(item, " [Correct]");
535 item = proto_tree_add_item(tree, hf_tnef_key, tvb, offset, 2, TRUE);
538 while(tvb_length_remaining(tvb, offset) > 9 ) { /* there must be at least a level (1), tag (4) and length (4) to be valid */
540 start_offset = offset;
542 attr_item = proto_tree_add_item(tree, hf_tnef_attribute, tvb, offset, -1, TRUE);
543 attr_tree = proto_item_add_subtree(attr_item, ett_tnef_attribute);
545 proto_tree_add_item(attr_tree, hf_tnef_attribute_lvl, tvb, offset, 1, TRUE);
548 item = proto_tree_add_item(attr_tree, hf_tnef_attribute_tag, tvb, offset, 4, TRUE);
549 tag_tree = proto_item_add_subtree(item, ett_tnef_attribute_tag);
551 /* add a nice name to the property */
552 tag = tvb_get_letohl(tvb, offset);
553 proto_item_append_text(attr_item, " %s", val_to_str(tag, tnef_Attribute_vals, "Unknown tag (0x%08lx)"));
555 proto_tree_add_item(tag_tree, hf_tnef_attribute_tag_id, tvb, offset, 2, TRUE);
558 proto_tree_add_item(tag_tree, hf_tnef_attribute_tag_type, tvb, offset, 2, TRUE);
559 /* remember the type for the value dissection */
562 length = tvb_get_letohl(tvb, offset);
563 proto_tree_add_item(attr_tree, hf_tnef_attribute_length, tvb, offset, 4, TRUE);
567 case ATT_OEM_CODEPAGE:
568 proto_tree_add_item(attr_tree, hf_tnef_oem_codepage, tvb, offset, length, TRUE);
570 case ATT_TNEF_VERSION:
571 proto_tree_add_item(attr_tree, hf_tnef_version, tvb, offset, length, TRUE);
573 case ATT_MESSAGE_CLASS:
574 proto_tree_add_item(attr_tree, hf_tnef_message_class, tvb, offset, length, TRUE);
576 case ATT_ORIGINAL_MESSAGE_CLASS:
577 proto_tree_add_item(attr_tree, hf_tnef_original_message_class, tvb, offset, length, TRUE);
580 item = proto_tree_add_item(attr_tree, hf_tnef_mapi_props, tvb, offset, length, TRUE);
581 props_tree = proto_item_add_subtree(item, ett_tnef_mapi_props);
583 next_tvb = tvb_new_subset(tvb, offset, length, length);
585 dissect_mapiprops(next_tvb, pinfo, props_tree);
590 addr_tree = proto_item_add_subtree(item, ett_tnef_attribute_address);
592 (void)dissect_counted_address(tvb, offset, pinfo, addr_tree);
596 proto_tree_add_item(attr_tree, hf_tnef_priority, tvb, offset, length, TRUE);
599 /* just do it on the type */
600 switch((tag >> 16) & 0xffff) {
602 item = proto_tree_add_item(attr_tree, hf_tnef_attribute_date, tvb, offset, length, TRUE);
603 date_tree = proto_item_add_subtree(item, ett_tnef_attribute_date);
605 next_tvb = tvb_new_subset(tvb, offset, length, length);
607 dissect_DTR(next_tvb, pinfo, date_tree);
611 proto_tree_add_item(attr_tree, hf_tnef_attribute_string, tvb, offset, length, FALSE);
612 proto_item_append_text(attr_item, " %s", tvb_get_ephemeral_string(tvb, offset, length));
615 proto_tree_add_item(attr_tree, hf_tnef_attribute_value, tvb, offset, length, TRUE);
622 proto_tree_add_item(attr_tree, hf_tnef_attribute_checksum, tvb, offset, 2, TRUE);
625 proto_item_set_len(attr_item, offset - start_offset);
628 /* there may be some padding */
629 if(tvb_length_remaining(tvb, offset)) /* XXX: Not sure if they is really padding or not */
630 proto_tree_add_item(tree, hf_tnef_padding, tvb, offset, tvb_length_remaining(tvb, offset), TRUE);
633 static void dissect_tnef_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
635 if (check_col(pinfo->cinfo, COL_PROTOCOL))
636 col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
638 if (check_col(pinfo->cinfo, COL_DEF_SRC))
639 col_set_str(pinfo->cinfo, COL_DEF_SRC, PSNAME " encoded file");
641 if (check_col(pinfo->cinfo, COL_INFO))
642 col_append_str(pinfo->cinfo, COL_INFO, PNAME);
644 dissect_tnef(tvb, pinfo, tree);
647 /* Register all the bits needed by the filtering engine */
650 proto_register_tnef(void)
652 static hf_register_info hf[] = {
653 { &hf_tnef_signature,
654 { "Signature", "tnef.signature", FT_UINT32, BASE_HEX, NULL, 0x0,
657 { "Key", "tnef.key", FT_UINT16, BASE_HEX, NULL, 0x0,
659 { &hf_tnef_attribute,
660 { "Attribute", "tnef.attribute", FT_NONE, BASE_NONE, NULL, 0x0,
662 { &hf_tnef_attribute_lvl,
663 { "Type", "tnef.attribute.lvl", FT_UINT8, BASE_DEC, VALS(tnef_Lvl_vals), 0x0,
665 { &hf_tnef_attribute_tag,
666 { "Tag", "tnef.attribute.tag", FT_UINT32, BASE_HEX, VALS(tnef_Attribute_vals), 0x0,
668 { &hf_tnef_attribute_tag_type,
669 { "Type", "tnef.attribute.tag.type", FT_UINT16, BASE_HEX, VALS(tnef_Types_vals), 0x0,
671 { &hf_tnef_attribute_tag_id,
672 { "Tag", "tnef.attribute.tag.id", FT_UINT16, BASE_HEX, NULL, 0x0,
674 { &hf_tnef_attribute_length,
675 { "Length", "tnef.attribute.length", FT_UINT32, BASE_DEC, NULL, 0x0,
677 { &hf_tnef_attribute_value,
678 { "Value", "tnef.attribute.value", FT_NONE, BASE_NONE, NULL, 0x0,
680 { &hf_tnef_attribute_string,
681 { "String", "tnef.attribute.string", FT_STRING, BASE_NONE, NULL, 0x0,
683 { &hf_tnef_attribute_date,
684 { "Date", "tnef.attribute.string", FT_NONE, BASE_NONE, NULL, 0x0,
686 { &hf_tnef_attribute_display_name,
687 { "Display Name", "tnef.attribute.display_name", FT_STRING, BASE_NONE, NULL, 0x0,
689 { &hf_tnef_attribute_email_address,
690 { "Email Address", "tnef.attribute.email_address", FT_STRING, BASE_NONE, NULL, 0x0,
692 { &hf_tnef_attribute_date_year,
693 { "Year", "tnef.attribute.date.year", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }},
694 { &hf_tnef_attribute_date_month,
695 { "Month", "tnef.attribute.date.month", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }},
696 { &hf_tnef_attribute_date_day,
697 { "Day", "tnef.attribute.date.day", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }},
698 { &hf_tnef_attribute_date_hour,
699 { "Hour", "tnef.attribute.date.hour", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }},
700 { &hf_tnef_attribute_date_minute,
701 { "Minute", "tnef.attribute.date.minute", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }},
702 { &hf_tnef_attribute_date_second,
703 { "Second", "tnef.attribute.date.second", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }},
704 { &hf_tnef_attribute_date_day_of_week,
705 { "Day Of Week", "tnef.attribute.date.day_of_week", FT_UINT16, BASE_DEC, VALS(weekday_vals), 0, "", HFILL }},
706 { &hf_tnef_attribute_checksum,
707 { "Checksum", "tnef.attribute.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
709 { &hf_tnef_mapi_props,
710 { "MAPI Properties", "tnef.mapi_props", FT_NONE, BASE_NONE, NULL, 0x0,
713 { "Version", "tnef.version", FT_UINT32, BASE_HEX, NULL, 0x0,
715 { &hf_tnef_oem_codepage,
716 { "OEM Codepage", "tnef.oem_codepage", FT_UINT64, BASE_HEX, NULL, 0x0,
718 { &hf_tnef_message_class,
719 { "Message Class", "tnef.message_class", FT_STRING, BASE_NONE, NULL, 0x0,
721 { &hf_tnef_original_message_class,
722 { "Original Message Class", "tnef.message_class.original", FT_STRING, BASE_NONE, NULL, 0x0,
725 { "Priority", "tnef.priority", FT_UINT16, BASE_DEC, VALS(tnef_Priority_vals), 0x0,
727 { &hf_tnef_mapi_props_count,
728 { "Count", "tnef.mapi_props.count", FT_UINT16, BASE_DEC, NULL, 0x0,
731 { "Property", "tnef.property", FT_NONE, BASE_NONE, NULL, 0x0,
733 { &hf_tnef_property_tag,
734 { "Tag", "tnef.property.tag", FT_UINT32, BASE_HEX, VALS(nspi_MAPITAGS_vals), 0x0,
736 { &hf_tnef_property_tag_type,
737 { "Type", "tnef.property.tag.type", FT_UINT16, BASE_HEX, VALS(nspi_property_types_vals), 0x0,
739 { &hf_tnef_property_tag_id,
740 { "Tag", "tnef.property.tag.id", FT_UINT16, BASE_HEX, NULL, 0x0,
742 { &hf_tnef_property_tag_set,
743 { "Set", "tnef.attribute.tag.set", FT_GUID, BASE_NONE, NULL, 0x0,
745 { &hf_tnef_property_tag_kind,
746 { "Kind", "tnef.attribute.tag.kind", FT_UINT32, BASE_DEC, NULL, 0x0,
748 { &hf_tnef_property_tag_name_id,
749 { "Name", "tnef.attribute.tag.name.id", FT_UINT32, BASE_HEX, NULL, 0x0,
751 { &hf_tnef_property_tag_name_length,
752 { "Length", "tnef.attribute.tag.name.length", FT_UINT32, BASE_DEC, NULL, 0x0,
754 { &hf_tnef_property_tag_name_string,
755 { "Name", "tnef.attribute.tag.name.string", FT_STRING, BASE_HEX, NULL, 0x0,
757 { &hf_tnef_property_padding,
758 { "Padding", "tnef.property.padding", FT_NONE, BASE_NONE, NULL, 0x0,
761 { "Padding", "tnef.padding", FT_NONE, BASE_NONE, NULL, 0x0,
763 { &hf_tnef_values_count,
764 { "Count", "tnef.values.count", FT_UINT16, BASE_DEC, NULL, 0x0,
766 { &hf_tnef_value_length,
767 { "Length", "tnef.value.length", FT_UINT16, BASE_DEC, NULL, 0x0,
769 { &hf_tnef_PropValue_i,
770 { "I", "tnef.PropValue.i", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }},
771 { &hf_tnef_PropValue_l,
772 { "L", "tnef.PropValue.l", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }},
773 { &hf_tnef_PropValue_b,
774 { "B", "tnef.PropValue.b", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }},
775 { &hf_tnef_PropValue_lpszA,
776 { "Lpsza", "tnef.PropValue.lpszA", FT_STRING, BASE_NONE, NULL, 0, "", HFILL }},
777 { &hf_tnef_PropValue_bin,
778 { "Bin", "tnef.PropValue.bin", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
779 { &hf_tnef_PropValue_ft,
780 { "Ft", "tnef.PropValue.ft", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
781 { &hf_tnef_PropValue_err,
782 { "Err", "tnef.PropValue.err", FT_UINT32, BASE_DEC, VALS(nspi_MAPISTATUS_vals), 0, "", HFILL }},
783 { &hf_tnef_PropValue_MVi,
784 { "Mvi", "tnef.PropValue.MVi", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
785 { &hf_tnef_PropValue_MVl,
786 { "Mvl", "tnef.PropValue.MVl", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
787 { &hf_tnef_PropValue_MVszA,
788 { "Mvsza", "tnef.PropValue.MVszA", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
789 { &hf_tnef_PropValue_MVbin,
790 { "Mvbin", "tnef.PropValue.MVbin", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
791 { &hf_tnef_PropValue_MVguid,
792 { "Mvguid", "tnef.PropValue.MVguid", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
793 { &hf_tnef_PropValue_MVszW,
794 { "Mvszw", "tnef.PropValue.MVszW", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
795 { &hf_tnef_PropValue_MVft,
796 { "Mvft", "tnef.PropValue.MVft", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }},
797 { &hf_tnef_PropValue_null,
798 { "Null", "tnef.PropValue.null", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }},
799 { &hf_tnef_PropValue_object,
800 { "Object", "tnef.PropValue.object", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }},
802 static gint *ett[] = {
805 &ett_tnef_attribute_tag,
806 &ett_tnef_mapi_props,
808 &ett_tnef_property_tag,
809 &ett_tnef_counted_items,
810 &ett_tnef_attribute_date,
811 &ett_tnef_attribute_address,
814 proto_tnef = proto_register_protocol(PNAME, PSNAME, PFNAME);
816 proto_register_field_array(proto_tnef, hf, array_length(hf));
817 proto_register_subtree_array(ett, array_length(ett));
819 /* Allow dissector to find be found by name. */
820 register_dissector(PFNAME, dissect_tnef, proto_tnef);
824 /* The registration hand-off routine */
826 proto_reg_handoff_tnef(void)
828 dissector_handle_t tnef_handle, tnef_file_handle;
830 tnef_handle = find_dissector(PFNAME);
831 tnef_file_handle = create_dissector_handle(dissect_tnef_file, proto_tnef);
833 dissector_add_string("media_type", "application/ms-tnef", tnef_handle);
835 /* X.400 file transfer bodypart */
836 register_ber_oid_dissector("1.2.840.113556.3.10.1", dissect_tnef, proto_tnef, "id-et-tnef");
838 dissector_add("wtap_encap", WTAP_ENCAP_TNEF, tnef_file_handle);