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
19 /*
20  * External interface.
21  */
22typedef struct MATCH_LIST MATCH_LIST;
23
24typedef int (*MATCH_LIST_FN) (MATCH_LIST *, const char *, const char *);
25
26struct MATCH_LIST {
27    int     flags;			/* processing options */
28    ARGV   *patterns;			/* one pattern each */
29    int     match_count;		/* match function/argument count */
30    MATCH_LIST_FN *match_func;		/* match functions */
31    const char **match_args;		/* match arguments */
32    int     error;			/* last operation */
33};
34
35#define MATCH_FLAG_NONE		0
36#define MATCH_FLAG_PARENT	(1<<0)
37#define MATCH_FLAG_RETURN	(1<<1)
38#define MATCH_FLAG_ALL		(MATCH_FLAG_PARENT | MATCH_FLAG_RETURN)
39
40extern MATCH_LIST *match_list_init(int, const char *, int,...);
41extern int match_list_match(MATCH_LIST *,...);
42extern void match_list_free(MATCH_LIST *);
43
44 /*
45  * The following functions are not part of the public interface. These
46  * functions may be called only through match_list_match().
47  */
48extern int match_string(MATCH_LIST *, const char *, const char *);
49extern int match_hostname(MATCH_LIST *, const char *, const char *);
50extern int match_hostaddr(MATCH_LIST *, const char *, const char *);
51
52/* LICENSE
53/* .ad
54/* .fi
55/*	The Secure Mailer license must be distributed with this software.
56/* AUTHOR(S)
57/*	Wietse Venema
58/*	IBM T.J. Watson Research
59/*	P.O. Box 704
60/*	Yorktown Heights, NY 10598, USA
61/*--*/
62
63#endif
64
65