Debian Codegraph @

src/bnetd/ipban.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2000 Gediminas ([email protected])
3 * Copyright (C) 2002 Bartomiej Butyn ([email protected])
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19 #ifndef INCLUDED_IPBAN_TYPES
20 #define INCLUDED_IPBAN_TYPES
21
22 #ifdef IPBAN_INTERNAL_ACCESS
23
24 #include <ctime>
25
26 #define MAX_FUNC_LEN 10
27 #define MAX_IP_STR 32
28 #define MAX_TIME_STR 9
29
30 #define IPBAN_FUNC_ADD 1
31 #define IPBAN_FUNC_DEL 2
32 #define IPBAN_FUNC_LIST 3
33 #define IPBAN_FUNC_CHECK 4
34 #define IPBAN_FUNC_UNKNOWN 5
35
36
37 namespace pvpgn
38 {
39
40 namespace bnetd
41 {
42
43 typedef enum
44 {
45 ipban_type_exact, /* 192.168.0.10 */
46 ipban_type_wildcard, /* 192.168.*.* */
47 ipban_type_range, /* 192.168.0.10-192.168.0.25 */
48 ipban_type_netmask, /* 192.168.0.0/255.255.0.0 */
49 ipban_type_prefix /* 192.168.0.0/16 */
50 } t_ipban_type;
51
52 typedef struct ipban_entry_struct
53 {
54 char * info1; /* third octet */
55 char * info2; /* third octet */
56 char * info3; /* third octet */
57 char * info4; /* fourth octet */
58 int type;
59 std::time_t endtime;
60 } t_ipban_entry;
61
62 }
63
64 }
65
66 #endif
67
68 #endif
69
70
71 /*****/
72 #ifndef JUST_NEED_TYPES
73 #ifndef INCLUDED_IPBAN_PROTOS
74 #define INCLUDED_IPBAN_PROTOS
75
76 #include <ctime>
77
78 #define JUST_NEED_TYPES
79 #include "connection.h"
80 #undef JUST_NEED_TYPES
81
82 namespace pvpgn
83 {
84
85 namespace bnetd
86 {
87
88 extern int ipbanlist_create(void);
89 extern int ipbanlist_destroy(void);
90 extern int ipbanlist_load(char const * filename);
91 extern int ipbanlist_save(char const * filename);
92 extern int ipbanlist_check(char const * addr);
93 extern int ipbanlist_add(t_connection * c, char const * cp, std::time_t endtime);
94 extern int ipbanlist_unload_expired(void);
95 extern std::time_t ipbanlist_str_to_time_t(t_connection * c, char const * timestr);
96 extern int handle_ipban_command(t_connection * c, char const * text);
97
98 }
99
100 }
101
102 #endif
103 #endif