1 |
/* |
2 |
* Copyright © 2003-2004 E. Will et al. |
3 |
* Copyright © 2005-2006 Atheme Development Group |
4 |
* Rights to this code are as defined in doc/pod/license.pod. |
5 |
* |
6 |
* String matching |
7 |
* |
8 |
* $Id: match.h,v 1.2 2007-07-21 01:29:07 pippijn Exp $ |
9 |
*/ |
10 |
|
11 |
#ifndef _MATCH_H |
12 |
#define _MATCH_H |
13 |
|
14 |
/* cidr.c */ |
15 |
E int match_ips (char const * const mask, char const * const address); |
16 |
E int match_cidr (char const * const mask, char const * const address); |
17 |
|
18 |
/* match.c */ |
19 |
#define MATCH_RFC1459 0 |
20 |
#define MATCH_ASCII 1 |
21 |
|
22 |
E int match_mapping; |
23 |
|
24 |
#define IsLower(c) ((unsigned char)(c) > 0x5f) |
25 |
#define IsUpper(c) ((unsigned char)(c) < 0x60) |
26 |
|
27 |
#define C_ALPHA 0x00000001 |
28 |
#define C_DIGIT 0x00000002 |
29 |
|
30 |
E const unsigned int charattrs[]; |
31 |
|
32 |
#define IsAlpha(c) (charattrs[(unsigned char) (c)] & C_ALPHA) |
33 |
#define IsDigit(c) (charattrs[(unsigned char) (c)] & C_DIGIT) |
34 |
#define IsAlphaNum(c) (IsAlpha((c)) || IsDigit((c))) |
35 |
#define IsNon(c) (!IsAlphaNum((c))) |
36 |
|
37 |
E const unsigned char ToLowerTab[]; |
38 |
E const unsigned char ToUpperTab[]; |
39 |
|
40 |
void set_match_mapping (int); |
41 |
|
42 |
E int ToLower (int); |
43 |
E int ToUpper (int); |
44 |
|
45 |
E int match (char const * const mask, char const * const name); |
46 |
E char *collapse (char *); |
47 |
|
48 |
/* regex_create() flags */ |
49 |
#define AREGEX_ICASE 1 /* case insensitive */ |
50 |
|
51 |
E regex_t *regex_create (char *pattern, int flags); |
52 |
E char *regex_extract (char *pattern, char **pend, int *pflags); |
53 |
E bool regex_match (regex_t * preg, char *string); |
54 |
E bool regex_destroy (regex_t * preg); |
55 |
|
56 |
#endif |