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