1#ifndef _RECIPIENT_LIST_H_INCLUDED_
2#define _RECIPIENT_LIST_H_INCLUDED_
3
4/*++
5/* NAME
6/*	recipient_list 3h
7/* SUMMARY
8/*	recipient list structures
9/* SYNOPSIS
10/*	#include <recipient_list.h>
11/* DESCRIPTION
12/* .nf
13
14 /*
15  * Information about a recipient is kept in this structure. The file offset
16  * tells us the position of the REC_TYPE_RCPT byte in the message queue
17  * file, This byte is replaced by REC_TYPE_DONE when the delivery status to
18  * that recipient is established.
19  *
20  * Rather than bothering with subclasses that extend this structure with
21  * application-specific fields we just add them here.
22  */
23typedef struct RECIPIENT {
24    long    offset;			/* REC_TYPE_RCPT byte */
25    const char *dsn_orcpt;		/* DSN original recipient */
26    int     dsn_notify;			/* DSN notify flags */
27    const char *orig_addr;		/* null or original recipient */
28    const char *address;		/* complete address */
29    union {				/* Application specific. */
30	int     status;			/* SMTP client */
31	struct QMGR_QUEUE *queue;	/* Queue manager */
32	const char *addr_type;		/* DSN */
33    }       u;
34} RECIPIENT;
35
36#define RECIPIENT_ASSIGN(rcpt, offs, orcpt, notify, orig, addr) do { \
37    (rcpt)->offset = (offs); \
38    (rcpt)->dsn_orcpt = (orcpt); \
39    (rcpt)->dsn_notify = (notify); \
40    (rcpt)->orig_addr = (orig); \
41    (rcpt)->address = (addr); \
42    (rcpt)->u.status = (0); \
43} while (0)
44
45#define RECIPIENT_UPDATE(ptr, new) do { \
46    myfree((char *) (ptr)); (ptr) = mystrdup(new); \
47} while (0)
48
49typedef struct RECIPIENT_LIST {
50    RECIPIENT *info;
51    int     len;
52    int     avail;
53    int     variant;
54} RECIPIENT_LIST;
55
56extern void recipient_list_init(RECIPIENT_LIST *, int);
57extern void recipient_list_add(RECIPIENT_LIST *, long, const char *, int, const char *, const char *);
58extern void recipient_list_swap(RECIPIENT_LIST *, RECIPIENT_LIST *);
59extern void recipient_list_free(RECIPIENT_LIST *);
60
61#define RCPT_LIST_INIT_STATUS	1
62#define RCPT_LIST_INIT_QUEUE	2
63#define RCPT_LIST_INIT_ADDR	3
64
65/* LICENSE
66/* .ad
67/* .fi
68/*	The Secure Mailer license must be distributed with this software.
69/* AUTHOR(S)
70/*	Wietse Venema
71/*	IBM T.J. Watson Research
72/*	P.O. Box 704
73/*	Yorktown Heights, NY 10598, USA
74/*--*/
75
76#endif
77