summaryrefslogtreecommitdiffstats
path: root/src/global/rec_attr_map.c
blob: e98dde8141cc14b02bc066caa5def6d06141ded9 (plain)
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
/*++
/* NAME
/*	rec_attr_map 3
/* SUMMARY
/*	map named attribute record type to pseudo record type
/* SYNOPSIS
/*	#include <rec_attr_map.h>
/*
/*	int	rec_attr_map(attr_name)
/*	const char *attr_name;
/* DESCRIPTION
/*	rec_attr_map() maps the record type of a named attribute to
/*	a pseudo record type, if such a mapping exists. The result
/*	is the pseudo record type in case of success, 0 on failure.
/* 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
/*--*/

/* System library. */

#include <sys_defs.h>
#include <string.h>

/* Global library. */

#include <mail_proto.h>
#include <rec_type.h>
#include <rec_attr_map.h>

/* rec_attr_map - map named attribute to pseudo record type */

int     rec_attr_map(const char *attr_name)
{
    if (strcmp(attr_name, MAIL_ATTR_DSN_ORCPT) == 0) {
	return (REC_TYPE_DSN_ORCPT);
    } else if (strcmp(attr_name, MAIL_ATTR_DSN_NOTIFY) == 0) {
	return (REC_TYPE_DSN_NOTIFY);
    } else if (strcmp(attr_name, MAIL_ATTR_DSN_ENVID) == 0) {
	return (REC_TYPE_DSN_ENVID);
    } else if (strcmp(attr_name, MAIL_ATTR_DSN_RET) == 0) {
	return (REC_TYPE_DSN_RET);
    } else if (strcmp(attr_name, MAIL_ATTR_CREATE_TIME) == 0) {
	return (REC_TYPE_CTIME);
    } else {
	return (0);
    }
}