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