1 /*        $NetBSD: resolve_clnt.h,v 1.2 2020/03/18 19:05:16 christos Exp $      */
2 
3 #ifndef _RESOLVE_CLNT_H_INCLUDED_
4 #define _RESOLVE_CLNT_H_INCLUDED_
5 
6 /*++
7 /* NAME
8 /*        resolve_clnt 3h
9 /* SUMMARY
10 /*        address resolver client
11 /* SYNOPSIS
12 /*        #include <resolve_clnt.h>
13 /* DESCRIPTION
14 /* .nf
15 
16  /*
17   * Utility library.
18   */
19 #include <vstring.h>
20 
21  /*
22   * External interface.
23   */
24 #define RESOLVE_REGULAR       "resolve"
25 #define RESOLVE_VERIFY        "verify"
26 
27 #define RESOLVE_FLAG_FINAL    (1<<0)    /* final delivery */
28 #define RESOLVE_FLAG_ROUTED   (1<<1)    /* routed destination */
29 #define RESOLVE_FLAG_ERROR    (1<<2)    /* bad destination syntax */
30 #define RESOLVE_FLAG_FAIL     (1<<3)    /* request failed */
31 
32 #define RESOLVE_CLASS_LOCAL   (1<<8)    /* mydestination/inet_interfaces */
33 #define RESOLVE_CLASS_ALIAS   (1<<9)    /* virtual_alias_domains */
34 #define RESOLVE_CLASS_VIRTUAL (1<<10)   /* virtual_mailbox_domains */
35 #define RESOLVE_CLASS_RELAY   (1<<11)   /* relay_domains */
36 #define RESOLVE_CLASS_DEFAULT (1<<12)   /* raise reject_unauth_destination */
37 
38 #define RESOLVE_CLASS_FINAL \
39           (RESOLVE_CLASS_LOCAL | RESOLVE_CLASS_ALIAS | RESOLVE_CLASS_VIRTUAL)
40 
41 #define RESOLVE_CLASS_MASK \
42           (RESOLVE_CLASS_LOCAL | RESOLVE_CLASS_ALIAS | RESOLVE_CLASS_VIRTUAL \
43           | RESOLVE_CLASS_RELAY | RESOLVE_CLASS_DEFAULT)
44 
45 typedef struct RESOLVE_REPLY {
46     VSTRING *transport;
47     VSTRING *nexthop;
48     VSTRING *recipient;
49     int     flags;
50 } RESOLVE_REPLY;
51 
52 extern void resolve_clnt_init(RESOLVE_REPLY *);
53 extern void resolve_clnt(const char *, const char *, const char *, RESOLVE_REPLY *);
54 extern void resolve_clnt_free(RESOLVE_REPLY *);
55 
56 #define RESOLVE_NULL_FROM     ""
57 
58 #define resolve_clnt_query_from(f, a, r) \
59           resolve_clnt(RESOLVE_REGULAR, (f), (a), (r))
60 #define resolve_clnt_verify_from(f, a, r) \
61           resolve_clnt(RESOLVE_VERIFY, (f), (a), (r))
62 
63 #define RESOLVE_CLNT_ASSIGN(reply, transport, nexthop, recipient) { \
64           (reply).transport = (transport); \
65           (reply).nexthop = (nexthop); \
66           (reply).recipient = (recipient); \
67     }
68 
69 /* LICENSE
70 /* .ad
71 /* .fi
72 /*        The Secure Mailer license must be distributed with this software.
73 /* AUTHOR(S)
74 /*        Wietse Venema
75 /*        IBM T.J. Watson Research
76 /*        P.O. Box 704
77 /*        Yorktown Heights, NY 10598, USA
78 /*
79 /*        Wietse Venema
80 /*        Google, Inc.
81 /*        111 8th Avenue
82 /*        New York, NY 10011, USA
83 /*--*/
84 
85 #endif
86