File: rec_type.c

package info (click to toggle)
postfix 0.0.19991231pl11-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,044 kB
  • ctags: 4,401
  • sloc: ansic: 33,767; makefile: 5,099; sh: 1,790; awk: 19
file content (71 lines) | stat: -rw-r--r-- 1,666 bytes parent folder | download
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
/*++
/* NAME
/*	rec_type 3
/* SUMMARY
/*	Postfix record types
/* SYNOPSIS
/*	#include <rec_type.h>
/*
/*	const char *rec_type_name(type)
/*	int	type;
/* DESCRIPTION
/*	This module and its associated include file implement the
/*	Postfix-specific record types.
/*
/*	rec_type_name() returns a printable name for the given record
/*	type.
/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*--*/

/* Global library. */

#include "rec_type.h"

 /*
  * Lookup table with internal record type codes and printable names.
  */
typedef struct {
    int     type;
    const char *name;
} REC_TYPE_NAME;

REC_TYPE_NAME rec_type_names[] = {
    REC_TYPE_EOF, "end-of-file",	/* not Postfix-specific. */
    REC_TYPE_ERROR, "error",		/* not Postfix-specific. */
    REC_TYPE_SIZE, "message_size",
    REC_TYPE_TIME, "time",
    REC_TYPE_FULL, "fullname",
    REC_TYPE_FROM, "sender",
    REC_TYPE_DONE, "done",
    REC_TYPE_RCPT, "recipient",
    REC_TYPE_WARN, "warning_message_time",
    REC_TYPE_MESG, "message_content",
    REC_TYPE_CONT, "unterminated",
    REC_TYPE_NORM, "normal_data",
    REC_TYPE_XTRA, "extracted_info",
    REC_TYPE_RRTO, "return_receipt",
    REC_TYPE_ERTO, "errors_to",
    REC_TYPE_PRIO, "priority",
    REC_TYPE_END, "message_end",
    0, 0,
};

/* rec_type_name - map record type to printable name */

const char *rec_type_name(int type)
{
    REC_TYPE_NAME *p;

    for (p = rec_type_names; p->name != 0; p++)
	if (p->type == type)
	    return (p->name);
    return ("unknown_record_type");
}