1 /*++
2 /* NAME
3 /* rec_type 3
4 /* SUMMARY
5 /* Postfix record types
6 /* SYNOPSIS
7 /* #include <rec_type.h>
8 /*
9 /* const char *rec_type_name(type)
10 /* int type;
11 /* DESCRIPTION
12 /* This module and its associated include file implement the
13 /* Postfix-specific record types.
14 /*
15 /* rec_type_name() returns a printable name for the given record
16 /* type.
17 /* LICENSE
18 /* .ad
19 /* .fi
20 /* The Secure Mailer license must be distributed with this software.
21 /* AUTHOR(S)
22 /* Wietse Venema
23 /* IBM T.J. Watson Research
24 /* P.O. Box 704
25 /* Yorktown Heights, NY 10598, USA
26 /*--*/
27
28 /* Global library. */
29
30 #include "rec_type.h"
31
32 /*
33 * Lookup table with internal record type codes and printable names.
34 */
35 typedef struct {
36 int type;
37 const char *name;
38 } REC_TYPE_NAME;
39
40 REC_TYPE_NAME rec_type_names[] = {
41 REC_TYPE_EOF, "end-of-file", /* not Postfix-specific. */
42 REC_TYPE_ERROR, "error", /* not Postfix-specific. */
43 REC_TYPE_SIZE, "message_size",
44 REC_TYPE_TIME, "message_arrival_time",
45 REC_TYPE_CTIME, "queue_file_create_time",
46 REC_TYPE_FULL, "sender_fullname",
47 REC_TYPE_INSP, "content_inspector",
48 REC_TYPE_FILT, "content_filter",
49 REC_TYPE_FROM, "sender",
50 REC_TYPE_DONE, "done_recipient",
51 REC_TYPE_DRCP, "canceled_recipient",
52 REC_TYPE_RCPT, "recipient",
53 REC_TYPE_ORCP, "original_recipient",
54 REC_TYPE_WARN, "warning_message_time",
55 REC_TYPE_ATTR, "named_attribute",
56 REC_TYPE_PTR, "pointer_record",
57 REC_TYPE_KILL, "killed_record",
58 REC_TYPE_MESG, "message_content",
59 REC_TYPE_CONT, "unterminated_text",
60 REC_TYPE_NORM, "regular_text",
61 REC_TYPE_DTXT, "padding",
62 REC_TYPE_XTRA, "extracted_info",
63 REC_TYPE_RRTO, "return_receipt",
64 REC_TYPE_ERTO, "errors_to",
65 REC_TYPE_PRIO, "priority",
66 REC_TYPE_VERP, "verp_delimiters",
67 REC_TYPE_END, "message_end",
68 REC_TYPE_RDR, "redirect_to",
69 REC_TYPE_FLGS, "flags",
70 REC_TYPE_DSN_RET, "dsn_return_flags",
71 REC_TYPE_DSN_ENVID, "dsn_envelope_id",
72 REC_TYPE_DSN_ORCPT, "dsn_original_recipient",
73 REC_TYPE_DSN_NOTIFY, "dsn_notify_flags",
74 0, 0,
75 };
76
77 /* rec_type_name - map record type to printable name */
78
rec_type_name(int type)79 const char *rec_type_name(int type)
80 {
81 REC_TYPE_NAME *p;
82
83 for (p = rec_type_names; p->name != 0; p++)
84 if (p->type == type)
85 return (p->name);
86 return ("unknown_record_type");
87 }
88