ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/match.h
Revision: 1.4
Committed: Sun Sep 16 18:54:42 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.3: +9 -4 lines
Log Message:
#defines to enum

File Contents

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