ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/match.h
Revision: 1.1
Committed: Thu Jul 19 08:24:50 2007 UTC (16 years, 10 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Log Message:
initial import. the most important changes since Atheme are:
- fixed many memory leaks
- fixed many bugs
- converted to C++ and use more STL containers
- added a (not very enhanced yet) perl module
- greatly improved XML-RPC speed
- added a JSON-RPC module with code from json-cpp
- added a valgrind memcheck module to operserv
- added a more object oriented base64 implementation
- added a specialised unit test framework
- improved stability
- use gettimeofday() if available
- reworked adding/removing commands
- MemoServ IGNORE DEL can now remove indices

File Contents

# Content
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/LICENSE.
5 *
6 * String matching
7 *
8 * $Id: match.h 7779 2007-03-03 13:55:42Z pippijn $
9 */
10
11 #ifndef _MATCH_H
12 #define _MATCH_H
13
14 /* cidr.c */
15 E int match_ips (const char *mask, const char *address);
16 E int match_cidr (const char *mask, const char *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 irccasecmp (const char *, const char *);
46 E int ircncasecmp (const char *, const char *, int);
47
48 E int match (const char *, const char *);
49 E char *collapse (char *);
50
51 /* regex_create() flags */
52 #define AREGEX_ICASE 1 /* case insensitive */
53
54 E regex_t *regex_create (char *pattern, int flags);
55 E char *regex_extract (char *pattern, char **pend, int *pflags);
56 E bool regex_match (regex_t * preg, char *string);
57 E bool regex_destroy (regex_t * preg);
58
59 #endif