3 #ifndef _TOK822_H_INCLUDED_
4 #define _TOK822_H_INCLUDED_
10 /* RFC822 token structures
12 /* #include <tok822.h>
24 #include <resolve_clnt.h>
27 * Internal address representation: a token tree.
29 typedef struct TOK822
{
30 int type
; /* token value, see below */
31 VSTRING
*vstr
; /* token contents */
32 struct TOK822
*prev
; /* peer */
33 struct TOK822
*next
; /* peer */
34 struct TOK822
*head
; /* group members */
35 struct TOK822
*tail
; /* group members */
36 struct TOK822
*owner
; /* group owner */
40 * Token values for multi-character objects. Single-character operators are
41 * represented by their own character value.
43 #define TOK822_MINTOK 256
44 #define TOK822_ATOM 256 /* non-special character sequence */
45 #define TOK822_QSTRING 257 /* stuff between "", not nesting */
46 #define TOK822_COMMENT 258 /* comment including (), may nest */
47 #define TOK822_DOMLIT 259 /* stuff between [] not nesting */
48 #define TOK822_ADDR 260 /* actually a token group */
49 #define TOK822_STARTGRP 261 /* start of named group */
50 #define TOK822_MAXTOK 261
55 extern TOK822
*tok822_alloc(int, const char *);
56 extern TOK822
*tok822_free(TOK822
*);
61 extern TOK822
*tok822_append(TOK822
*, TOK822
*);
62 extern TOK822
*tok822_prepend(TOK822
*, TOK822
*);
63 extern TOK822
*tok822_cut_before(TOK822
*);
64 extern TOK822
*tok822_cut_after(TOK822
*);
65 extern TOK822
*tok822_unlink(TOK822
*);
66 extern TOK822
*tok822_sub_append(TOK822
*, TOK822
*);
67 extern TOK822
*tok822_sub_prepend(TOK822
*, TOK822
*);
68 extern TOK822
*tok822_sub_keep_before(TOK822
*, TOK822
*);
69 extern TOK822
*tok822_sub_keep_after(TOK822
*, TOK822
*);
70 extern TOK822
*tok822_free_tree(TOK822
*);
72 typedef int (*TOK822_ACTION
) (TOK822
*);
73 extern int tok822_apply(TOK822
*, int, TOK822_ACTION
);
74 extern TOK822
**tok822_grep(TOK822
*, int);
79 extern TOK822
*tok822_scan_limit(const char *, TOK822
**, int);
80 extern TOK822
*tok822_scan_addr(const char *);
81 extern TOK822
*tok822_parse_limit(const char *, int);
82 extern VSTRING
*tok822_externalize(VSTRING
*, TOK822
*, int);
83 extern VSTRING
*tok822_internalize(VSTRING
*, TOK822
*, int);
85 #define tok822_scan(cp, ptr) tok822_scan_limit((cp), (ptr), 0)
86 #define tok822_parse(cp) tok822_parse_limit((cp), 0)
88 #define TOK822_STR_NONE (0)
89 #define TOK822_STR_WIPE (1<<0)
90 #define TOK822_STR_TERM (1<<1)
91 #define TOK822_STR_LINE (1<<2)
92 #define TOK822_STR_TRNC (1<<3)
93 #define TOK822_STR_DEFL (TOK822_STR_WIPE | TOK822_STR_TERM)
94 #define TOK822_STR_HEAD (TOK822_STR_TERM | TOK822_STR_LINE | TOK822_STR_TRNC)
99 extern TOK822
*tok822_find_type(TOK822
*, int);
100 extern TOK822
*tok822_rfind_type(TOK822
*, int);
105 extern TOK822
*tok822_rewrite(TOK822
*, const char *);
110 #define tok822_resolve(t, r) tok822_resolve_from(RESOLVE_NULL_FROM, (t), (r))
112 extern void tok822_resolve_from(const char *, TOK822
*, RESOLVE_REPLY
*);
117 /* The Secure Mailer license must be distributed with this software.
120 /* IBM T.J. Watson Research
122 /* Yorktown Heights, NY 10598, USA