Postfix3.3.1
match_list.h
[詳解]
1 #ifndef _MATCH_LIST_H_INCLUDED_
2 #define _MATCH_LIST_H_INCLUDED_
3 
4 /*++
5 /* NAME
6 /* match_list 3h
7 /* SUMMARY
8 /* generic list-based pattern matching
9 /* SYNOPSIS
10 /* #include <match_list.h>
11 /* DESCRIPTION
12 /* .nf
13 
14  /*
15  * Utility library.
16  */
17 #include <argv.h>
18 #include <vstring.h>
19 
20  /*
21  * External interface.
22  */
23 typedef struct MATCH_LIST MATCH_LIST;
24 
25 typedef int (*MATCH_LIST_FN) (MATCH_LIST *, const char *, const char *);
26 
27 struct MATCH_LIST {
28  char *pname; /* used in error messages */
29  int flags; /* processing options */
30  ARGV *patterns; /* one pattern each */
31  int match_count; /* match function/argument count */
32  MATCH_LIST_FN *match_func; /* match functions */
33  const char **match_args; /* match arguments */
34  VSTRING *fold_buf; /* case-folded pattern string */
35  int error; /* last operation */
36 };
37 
38 #define MATCH_FLAG_NONE 0
39 #define MATCH_FLAG_PARENT (1<<0)
40 #define MATCH_FLAG_RETURN (1<<1)
41 #define MATCH_FLAG_ALL (MATCH_FLAG_PARENT | MATCH_FLAG_RETURN)
42 
43 extern MATCH_LIST *match_list_init(const char *, int, const char *, int,...);
44 extern int match_list_match(MATCH_LIST *,...);
45 extern void match_list_free(MATCH_LIST *);
46 
47  /*
48  * The following functions are not part of the public interface. These
49  * functions may be called only through match_list_match().
50  */
51 extern int match_string(MATCH_LIST *, const char *, const char *);
52 extern int match_hostname(MATCH_LIST *, const char *, const char *);
53 extern int match_hostaddr(MATCH_LIST *, const char *, const char *);
54 
55 /* LICENSE
56 /* .ad
57 /* .fi
58 /* The Secure Mailer license must be distributed with this software.
59 /* AUTHOR(S)
60 /* Wietse Venema
61 /* IBM T.J. Watson Research
62 /* P.O. Box 704
63 /* Yorktown Heights, NY 10598, USA
64 /*--*/
65 
66 #endif
ARGV * patterns
Definition: match_list.h:30
Definition: argv.h:17
int match_count
Definition: match_list.h:31
VSTRING * fold_buf
Definition: match_list.h:34
int match_string(MATCH_LIST *, const char *, const char *)
Definition: match_ops.c:113
int match_hostname(MATCH_LIST *, const char *, const char *)
Definition: match_ops.c:151
void match_list_free(MATCH_LIST *)
Definition: match_list.c:272
int(* MATCH_LIST_FN)(MATCH_LIST *, const char *, const char *)
Definition: match_list.h:25
MATCH_LIST_FN * match_func
Definition: match_list.h:32
MATCH_LIST * match_list_init(const char *, int, const char *, int,...)
Definition: match_list.c:197
char * pname
Definition: match_list.h:28
int int
Definition: smtpd_proxy.h:21
const char ** match_args
Definition: match_list.h:33
int match_hostaddr(MATCH_LIST *, const char *, const char *)
Definition: match_ops.c:221
int match_list_match(MATCH_LIST *,...)
Definition: match_list.c:235