summaryrefslogtreecommitdiffstats
path: root/src/trivial-rewrite/trivial-rewrite.h
blob: e27dd008ef326cca6d1d73146c7278ec21afb6bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*++
/* NAME
/*	trivial-rewrite 3h
/* SUMMARY
/*	mail address rewriter and resolver
/* SYNOPSIS
/*	#include "trivial-rewrite.h"
/* DESCRIPTION
/* .nf

 /*
  * Utility library.
  */
#include <vstring.h>
#include <vstream.h>

 /*
  * Global library.
  */
#include <tok822.h>
#include <maps.h>

 /*
  * Connection management.
  */
extern int server_flags;

 /*
  * rewrite.c
  */
typedef struct {
    const char *origin_name;		/* name of variable */
    char  **origin;			/* default origin */
    const char *domain_name;		/* name of variable */
    char  **domain;			/* default domain */
} RWR_CONTEXT;

#define REW_PARAM_VALUE(x) (*(x))	/* make it easy to do it right */

extern void rewrite_init(void);
extern int rewrite_proto(VSTREAM *);
extern void rewrite_addr(RWR_CONTEXT *, char *, VSTRING *);
extern void rewrite_tree(RWR_CONTEXT *, TOK822 *);
extern RWR_CONTEXT local_context;
extern RWR_CONTEXT inval_context;

 /*
  * resolve.c
  */
typedef struct {
    const char *local_transport_name;	/* name of variable */
    char  **local_transport;		/* local transport:nexthop */
    const char *virt_transport_name;	/* name of variable */
    char  **virt_transport;		/* virtual mailbox transport:nexthop */
    const char *relay_transport_name;	/* name of variable */
    char  **relay_transport;		/* relay transport:nexthop */
    const char *def_transport_name;	/* name of variable */
    char  **def_transport;		/* default transport:nexthop */
    const char *snd_def_xp_maps_name;	/* name of variable */
    char  **snd_def_xp_maps;		/* maptype:mapname */
    MAPS   *snd_def_xp_info;		/* handle */
    const char *relayhost_name;		/* name of variable */
    char  **relayhost;			/* for relay and default transport */
    const char *snd_relay_maps_name;	/* name of variable */
    char  **snd_relay_maps;		/* maptype:mapname */
    MAPS   *snd_relay_info;		/* handle */
    const char *transport_maps_name;	/* name of variable */
    char  **transport_maps;		/* maptype:mapname */
    struct TRANSPORT_INFO *transport_info;	/* handle */
} RES_CONTEXT;

#define RES_PARAM_VALUE(x) (*(x))	/* make it easy to do it right */

extern void resolve_init(void);
extern int resolve_proto(RES_CONTEXT *, VSTREAM *);
extern int resolve_class(const char *);

/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*
/*	Wietse Venema
/*	Google, Inc.
/*	111 8th Avenue
/*	New York, NY 10011, USA
/*--*/