1 /*++
2 /* NAME
3 /*	trivial-rewrite 3h
4 /* SUMMARY
5 /*	mail address rewriter and resolver
6 /* SYNOPSIS
7 /*	#include "trivial-rewrite.h"
8 /* DESCRIPTION
9 /* .nf
10 
11  /*
12   * Utility library.
13   */
14 #include <vstring.h>
15 #include <vstream.h>
16 
17  /*
18   * Global library.
19   */
20 #include <tok822.h>
21 #include <maps.h>
22 
23  /*
24   * Connection management.
25   */
26 extern int server_flags;
27 
28  /*
29   * rewrite.c
30   */
31 typedef struct {
32     const char *origin_name;		/* name of variable */
33     char  **origin;			/* default origin */
34     const char *domain_name;		/* name of variable */
35     char  **domain;			/* default domain */
36 } RWR_CONTEXT;
37 
38 #define REW_PARAM_VALUE(x) (*(x))	/* make it easy to do it right */
39 
40 extern void rewrite_init(void);
41 extern int rewrite_proto(VSTREAM *);
42 extern void rewrite_addr(RWR_CONTEXT *, char *, VSTRING *);
43 extern void rewrite_tree(RWR_CONTEXT *, TOK822 *);
44 extern RWR_CONTEXT local_context;
45 extern RWR_CONTEXT inval_context;
46 
47  /*
48   * resolve.c
49   */
50 typedef struct {
51     const char *local_transport_name;	/* name of variable */
52     char  **local_transport;		/* local transport:nexthop */
53     const char *virt_transport_name;	/* name of variable */
54     char  **virt_transport;		/* virtual mailbox transport:nexthop */
55     const char *relay_transport_name;	/* name of variable */
56     char  **relay_transport;		/* relay transport:nexthop */
57     const char *def_transport_name;	/* name of variable */
58     char  **def_transport;		/* default transport:nexthop */
59     const char *snd_def_xp_maps_name;	/* name of variable */
60     char  **snd_def_xp_maps;		/* maptype:mapname */
61     MAPS   *snd_def_xp_info;		/* handle */
62     const char *relayhost_name;		/* name of variable */
63     char  **relayhost;			/* for relay and default transport */
64     const char *snd_relay_maps_name;	/* name of variable */
65     char  **snd_relay_maps;		/* maptype:mapname */
66     MAPS   *snd_relay_info;		/* handle */
67     const char *transport_maps_name;	/* name of variable */
68     char  **transport_maps;		/* maptype:mapname */
69     struct TRANSPORT_INFO *transport_info;	/* handle */
70 } RES_CONTEXT;
71 
72 #define RES_PARAM_VALUE(x) (*(x))	/* make it easy to do it right */
73 
74 extern void resolve_init(void);
75 extern int resolve_proto(RES_CONTEXT *, VSTREAM *);
76 extern int resolve_class(const char *);
77 
78 /* LICENSE
79 /* .ad
80 /* .fi
81 /*	The Secure Mailer license must be distributed with this software.
82 /* AUTHOR(S)
83 /*	Wietse Venema
84 /*	IBM T.J. Watson Research
85 /*	P.O. Box 704
86 /*	Yorktown Heights, NY 10598, USA
87 /*
88 /*	Wietse Venema
89 /*	Google, Inc.
90 /*	111 8th Avenue
91 /*	New York, NY 10011, USA
92 /*--*/
93