No empty .Rs/.Re
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / global / tok822_resolve.c
blobc20a1e0e8fb04a84098a820c4fa36c2a77605ada
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* tok822_resolve 3
6 /* SUMMARY
7 /* address resolving, client interface
8 /* SYNOPSIS
9 /* #include <tok822.h>
11 /* void tok822_resolve(addr, reply)
12 /* TOK822 *addr;
13 /* RESOLVE_REPLY *reply;
15 /* void tok822_resolve_from(sender, addr, reply)
16 /* const char *sender;
17 /* TOK822 *addr;
18 /* RESOLVE_REPLY *reply;
19 /* DESCRIPTION
20 /* tok822_resolve() takes an address token tree and finds out the
21 /* transport to deliver via, the next-hop host on that transport,
22 /* and the recipient relative to that host.
24 /* tok822_resolve_from() allows the caller to specify sender context
25 /* that will be used to look up sender-dependent relayhost information.
26 /* SEE ALSO
27 /* resolve_clnt(3) basic resolver client interface
28 /* LICENSE
29 /* .ad
30 /* .fi
31 /* The Secure Mailer license must be distributed with this software.
32 /* AUTHOR(S)
33 /* Wietse Venema
34 /* IBM T.J. Watson Research
35 /* P.O. Box 704
36 /* Yorktown Heights, NY 10598, USA
37 /*--*/
39 /* System library. */
41 #include <sys_defs.h>
43 /* Utility library. */
45 #include <vstring.h>
46 #include <msg.h>
48 /* Global library. */
50 #include "resolve_clnt.h"
51 #include "tok822.h"
53 /* tok822_resolve - address rewriting interface */
55 void tok822_resolve_from(const char *sender, TOK822 *addr,
56 RESOLVE_REPLY *reply)
58 VSTRING *intern_form = vstring_alloc(100);
60 if (addr->type != TOK822_ADDR)
61 msg_panic("tok822_resolve: non-address token type: %d", addr->type);
64 * Internalize the token tree and ship it to the resolve service.
65 * Shipping string forms is much simpler than shipping parse trees.
67 tok822_internalize(intern_form, addr->head, TOK822_STR_DEFL);
68 resolve_clnt_query_from(sender, vstring_str(intern_form), reply);
69 if (msg_verbose)
70 msg_info("tok822_resolve: from=%s addr=%s -> chan=%s, host=%s, rcpt=%s",
71 sender,
72 vstring_str(intern_form), vstring_str(reply->transport),
73 vstring_str(reply->nexthop), vstring_str(reply->recipient));
75 vstring_free(intern_form);