jabberd2  2.2.17
router.h
Go to the documentation of this file.
1 /*
2  * jabberd - Jabber Open Source Server
3  * Copyright (c) 2002 Jeremie Miller, Thomas Muldowney,
4  * Ryan Eatmon, Robert Norris
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19  */
20 
36 #ifdef HAVE_CONFIG_H
37 # include <config.h>
38 #endif
39 
40 #include "sx/sx.h"
41 #include "mio/mio.h"
42 #include "util/util.h"
43 
44 #ifdef HAVE_SIGNAL_H
45 # include <signal.h>
46 #endif
47 #ifdef HAVE_SYS_STAT_H
48 # include <sys/stat.h>
49 #endif
50 
51 typedef struct router_st *router_t;
52 typedef struct component_st *component_t;
53 typedef struct routes_st *routes_t;
54 typedef struct alias_st *alias_t;
55 
56 typedef struct acl_s *acl_t;
57 struct acl_s {
58  int error;
59  char *redirect;
61  char *what;
62  char *from;
63  char *to;
64  int log;
65  acl_t next;
66 };
67 
68 struct router_st {
70  char *id;
71 
74 
77  time_t users_load;
78 
80  acl_t filter;
81  time_t filter_load;
82 
85 
88  char *log_facility;
89  char *log_ident;
90 
92  char *local_ip;
94  char *local_secret;
96 
99 
102 
107 
109 
114 
119 
122 
125 
129 
130  time_t next_check;
131 
134 
137 
140 
143 
145  alias_t aliases;
146 
149 
152 
155 
158 
162 };
163 
165 struct component_st {
166  router_t r;
167 
170 
173  int port;
174 
177 
180 
183  int rate_log;
184 
187 
189  int legacy;
190 
193 
196 };
197 
199 typedef enum {
200  route_SINGLE = 0x00,
201  route_MULTI_TO = 0x10,
203 } route_type_t;
204 
205 struct routes_st
206 {
207  char *name;
209  component_t *comp;
210  int ncomp;
211 };
212 
213 struct alias_st {
214  char *name;
215  char *target;
216 
217  alias_t next;
218 };
219 
220 int router_mio_callback(mio_t m, mio_action_t a, mio_fd_t fd, void *data, void *arg);
221 void router_sx_handshake(sx_t s, sx_buf_t buf, void *arg);
222 
223 xht aci_load(router_t r);
224 void aci_unload(xht aci);
225 int aci_check(xht acls, const char *type, const char *name);
226 
227 int user_table_load(router_t r);
228 void user_table_unload(router_t r);
229 
230 int filter_load(router_t r);
231 void filter_unload(router_t r);
232 int filter_packet(router_t r, nad_t nad);
233 
234 int message_log(nad_t nad, router_t r, const unsigned char *msg_from, const unsigned char *msg_to);
235 
236 void routes_free(routes_t routes);
237 
238 /* union for xhash_iter_get to comply with strict-alias rules for gcc3 */
239 union xhashv
240 {
241  void **val;
242  char **char_val;
243  component_t *comp_val;
245 };