Postfix3.3.1
tok822.h
[詳解]
1 #ifndef _TOK822_H_INCLUDED_
2 #define _TOK822_H_INCLUDED_
3 
4 /*++
5 /* NAME
6 /* tok822 3h
7 /* SUMMARY
8 /* RFC822 token structures
9 /* SYNOPSIS
10 /* #include <tok822.h>
11 /* DESCRIPTION
12 /* .nf
13 
14  /*
15  * Utility library.
16  */
17 #include <vstring.h>
18 
19  /*
20  * Global library.
21  */
22 #include <resolve_clnt.h>
23 
24  /*
25  * Internal address representation: a token tree.
26  */
27 typedef struct TOK822 {
28  int type; /* token value, see below */
29  VSTRING *vstr; /* token contents */
30  struct TOK822 *prev; /* peer */
31  struct TOK822 *next; /* peer */
32  struct TOK822 *head; /* group members */
33  struct TOK822 *tail; /* group members */
34  struct TOK822 *owner; /* group owner */
35 } TOK822;
36 
37  /*
38  * Token values for multi-character objects. Single-character operators are
39  * represented by their own character value.
40  */
41 #define TOK822_MINTOK 256
42 #define TOK822_ATOM 256 /* non-special character sequence */
43 #define TOK822_QSTRING 257 /* stuff between "", not nesting */
44 #define TOK822_COMMENT 258 /* comment including (), may nest */
45 #define TOK822_DOMLIT 259 /* stuff between [] not nesting */
46 #define TOK822_ADDR 260 /* actually a token group */
47 #define TOK822_STARTGRP 261 /* start of named group */
48 #define TOK822_MAXTOK 261
49 
50  /*
51  * tok822_node.c
52  */
53 extern TOK822 *tok822_alloc(int, const char *);
54 extern TOK822 *tok822_free(TOK822 *);
55 
56  /*
57  * tok822_tree.c
58  */
59 extern TOK822 *tok822_append(TOK822 *, TOK822 *);
60 extern TOK822 *tok822_prepend(TOK822 *, TOK822 *);
62 extern TOK822 *tok822_cut_after(TOK822 *);
63 extern TOK822 *tok822_unlink(TOK822 *);
68 extern TOK822 *tok822_free_tree(TOK822 *);
69 
70 typedef int (*TOK822_ACTION) (TOK822 *);
71 extern int tok822_apply(TOK822 *, int, TOK822_ACTION);
72 extern TOK822 **tok822_grep(TOK822 *, int);
73 
74  /*
75  * tok822_parse.c
76  */
77 extern TOK822 *tok822_scan_limit(const char *, TOK822 **, int);
78 extern TOK822 *tok822_scan_addr(const char *);
79 extern TOK822 *tok822_parse_limit(const char *, int);
80 extern VSTRING *tok822_externalize(VSTRING *, TOK822 *, int);
81 extern VSTRING *tok822_internalize(VSTRING *, TOK822 *, int);
82 
83 #define tok822_scan(cp, ptr) tok822_scan_limit((cp), (ptr), 0)
84 #define tok822_parse(cp) tok822_parse_limit((cp), 0)
85 
86 #define TOK822_STR_NONE (0)
87 #define TOK822_STR_WIPE (1<<0)
88 #define TOK822_STR_TERM (1<<1)
89 #define TOK822_STR_LINE (1<<2)
90 #define TOK822_STR_TRNC (1<<3)
91 #define TOK822_STR_DEFL (TOK822_STR_WIPE | TOK822_STR_TERM)
92 #define TOK822_STR_HEAD (TOK822_STR_TERM | TOK822_STR_LINE | TOK822_STR_TRNC)
93 
94  /*
95  * tok822_find.c
96  */
97 extern TOK822 *tok822_find_type(TOK822 *, int);
98 extern TOK822 *tok822_rfind_type(TOK822 *, int);
99 
100  /*
101  * tok822_rewrite.c
102  */
103 extern TOK822 *tok822_rewrite(TOK822 *, const char *);
104 
105  /*
106  * tok822_resolve.c
107  */
108 #define tok822_resolve(t, r) tok822_resolve_from(RESOLVE_NULL_FROM, (t), (r))
109 
110 extern void tok822_resolve_from(const char *, TOK822 *, RESOLVE_REPLY *);
111 
112 /* LICENSE
113 /* .ad
114 /* .fi
115 /* The Secure Mailer license must be distributed with this software.
116 /* AUTHOR(S)
117 /* Wietse Venema
118 /* IBM T.J. Watson Research
119 /* P.O. Box 704
120 /* Yorktown Heights, NY 10598, USA
121 /*--*/
122 
123 #endif
TOK822 * tok822_sub_keep_before(TOK822 *, TOK822 *)
Definition: tok822_tree.c:240
TOK822 ** tok822_grep(TOK822 *, int)
Definition: tok822_tree.c:292
TOK822 * tok822_rfind_type(TOK822 *, int)
Definition: tok822_find.c:62
TOK822 * tok822_sub_keep_after(TOK822 *, TOK822 *)
Definition: tok822_tree.c:251
Definition: tok822.h:27
TOK822 * tok822_sub_append(TOK822 *, TOK822 *)
Definition: tok822_tree.c:206
void tok822_resolve_from(const char *, TOK822 *, RESOLVE_REPLY *)
TOK822 * tok822_free_tree(TOK822 *)
Definition: tok822_tree.c:262
struct TOK822 * owner
Definition: tok822.h:34
TOK822 * tok822_scan_limit(const char *, TOK822 **, int)
Definition: tok822_parse.c:427
VSTRING * vstr
Definition: tok822.h:29
struct TOK822 * head
Definition: tok822.h:32
int type
Definition: tok822.h:28
TOK822 * tok822_find_type(TOK822 *, int)
Definition: tok822_find.c:51
TOK822 * tok822_sub_prepend(TOK822 *, TOK822 *)
Definition: tok822_tree.c:221
VSTRING * tok822_externalize(VSTRING *, TOK822 *, int)
Definition: tok822_parse.c:270
VSTRING * tok822_internalize(VSTRING *, TOK822 *, int)
Definition: tok822_parse.c:199
TOK822 * tok822_append(TOK822 *, TOK822 *)
Definition: tok822_tree.c:127
TOK822 * tok822_alloc(int, const char *)
Definition: tok822_node.c:55
TOK822 * tok822_free(TOK822 *)
Definition: tok822_node.c:73
TOK822 * tok822_prepend(TOK822 *, TOK822 *)
Definition: tok822_tree.c:146
TOK822 * tok822_parse_limit(const char *, int)
Definition: tok822_parse.c:479
struct TOK822 TOK822
int int
Definition: smtpd_proxy.h:21
int tok822_apply(TOK822 *, int, TOK822_ACTION)
Definition: tok822_tree.c:277
TOK822 * tok822_scan_addr(const char *)
Definition: tok822_parse.c:648
int(* TOK822_ACTION)(TOK822 *)
Definition: tok822.h:70
TOK822 * tok822_cut_after(TOK822 *)
Definition: tok822_tree.c:178
TOK822 * tok822_cut_before(TOK822 *)
Definition: tok822_tree.c:165
TOK822 * tok822_unlink(TOK822 *)
Definition: tok822_tree.c:191
TOK822 * tok822_rewrite(TOK822 *, const char *)
struct TOK822 * prev
Definition: tok822.h:30
struct TOK822 * next
Definition: tok822.h:31
struct TOK822 * tail
Definition: tok822.h:33