xref: /netbsd-src/external/ibm-public/postfix/dist/src/global/rec_attr_map.c (revision 41fbaed053f8fbfdf9d2a4ee0a7386a3c83f8505)
1 /*	$NetBSD: rec_attr_map.c,v 1.1.1.1 2009/06/23 10:08:47 tron Exp $	*/
2 
3 /*++
4 /* NAME
5 /*	rec_attr_map 3
6 /* SUMMARY
7 /*	map named attribute record type to pseudo record type
8 /* SYNOPSIS
9 /*	#include <rec_attr_map.h>
10 /*
11 /*	int	rec_attr_map(attr_name)
12 /*	const char *attr_name;
13 /* DESCRIPTION
14 /*	rec_attr_map() maps the record type of a named attribute to
15 /*	a pseudo record type, if such a mapping exists. The result
16 /*	is the pseudo record type in case of success, 0 on failure.
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 /* System library. */
29 
30 #include <sys_defs.h>
31 #include <string.h>
32 
33 /* Global library. */
34 
35 #include <mail_proto.h>
36 #include <rec_type.h>
37 #include <rec_attr_map.h>
38 
39 /* rec_attr_map - map named attribute to pseudo record type */
40 
rec_attr_map(const char * attr_name)41 int     rec_attr_map(const char *attr_name)
42 {
43     if (strcmp(attr_name, MAIL_ATTR_DSN_ORCPT) == 0) {
44 	return (REC_TYPE_DSN_ORCPT);
45     } else if (strcmp(attr_name, MAIL_ATTR_DSN_NOTIFY) == 0) {
46 	return (REC_TYPE_DSN_NOTIFY);
47     } else if (strcmp(attr_name, MAIL_ATTR_DSN_ENVID) == 0) {
48 	return (REC_TYPE_DSN_ENVID);
49     } else if (strcmp(attr_name, MAIL_ATTR_DSN_RET) == 0) {
50 	return (REC_TYPE_DSN_RET);
51     } else if (strcmp(attr_name, MAIL_ATTR_CREATE_TIME) == 0) {
52 	return (REC_TYPE_CTIME);
53     } else {
54 	return (0);
55     }
56 }
57