File: internals.h

package info (click to toggle)
ctrlproxy 3.0.7-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,668 kB
  • ctags: 2,045
  • sloc: ansic: 15,358; sh: 2,805; xml: 1,078; python: 346; makefile: 302; perl: 18
file content (174 lines) | stat: -rw-r--r-- 6,293 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/* 
	ctrlproxy: A modular IRC proxy
	(c) 2002-2005 Jelmer Vernooij <jelmer@nl.linux.org>

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __INTERNALS_H__
#define __INTERNALS_H__

#define CTRLPROXY_CORE_BUILD

#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif
#ifdef HAVE_UNISTD_H
#  include <unistd.h>
#endif
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <stdarg.h>
#include <signal.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "ctrlproxy.h"
#include "plugins.h"
#include "redirect.h"
#include "local.h"

#define DEFAULT_RECONNECT_INTERVAL 	60
#define MIN_SILENT_TIME				60
#define MAX_SILENT_TIME 			(2*MIN_SILENT_TIME)

/* server.c */
void fini_networks(struct global *);
void kill_pending_clients(const char *reason);
gboolean network_set_iochannel(struct irc_network *s, GIOChannel *ioc);

/* state.c */
void free_channels(struct irc_network *s);
void network_nick_set_data(struct network_nick *n, const char *nick, const char *username, const char *host);

/* plugins.c */
gboolean init_plugins(const char *dir);

/* motd.c */
char **get_motd_lines(const char *motd_file);

/* network.c */
G_MODULE_EXPORT struct irc_network *load_network(struct global *global, struct network_config *sc);
G_MODULE_EXPORT gboolean load_networks(struct global *, struct ctrlproxy_config *cfg);
G_MODULE_EXPORT void unload_network(struct irc_network *);
typedef void (*new_network_notify_fn) (struct irc_network *, void *);
G_MODULE_EXPORT struct irc_network *find_network_by_hostname(struct global *global, const char *host, guint16 port, gboolean create);
G_MODULE_EXPORT void register_new_network_notify(struct global *, new_network_notify_fn, void *userdata);

/* hooks.c */
void server_disconnected_hook_execute(struct irc_network *);
void server_connected_hook_execute(struct irc_network *);
gboolean new_client_hook_execute(struct irc_client *c);
void lose_client_hook_execute(struct irc_client *c);
gboolean run_client_filter(struct irc_client *c, const struct irc_line *l, enum data_direction dir);
gboolean run_server_filter(struct irc_network *s, const struct irc_line *l, enum data_direction dir);
gboolean run_log_filter(struct irc_network *s, const struct irc_line *l, enum data_direction dir);
gboolean run_replication_filter(struct irc_network *s, const struct irc_line *l, enum data_direction dir);

/* client.c */
/**
 * Add a new client
 *
 * @param net Network this client is connected to. May be NULL.
 * @param io IO Channel to use for communication.
 * @param desc Description of the client.
 */
G_MODULE_EXPORT G_GNUC_MALLOC struct irc_client *client_init_iochannel(
										   struct irc_network *net, 
										   GIOChannel *io, 
										   const char *desc);

G_MODULE_EXPORT G_GNUC_MALLOC struct irc_client *client_init(
										   struct irc_network *net, 
										   struct irc_transport *transport,
										   const char *desc);

G_MODULE_EXPORT void clients_send(GList *clients, const struct irc_line *, const struct irc_client *exception);
G_MODULE_EXPORT void clients_send_args_ex(GList *clients, const char *hostmask, ...);

/* log.c */
gboolean init_log(const char *file);
void log_network_line(const struct irc_network *n, const struct irc_line *l, gboolean incoming);
void log_client_line(const struct irc_client *c, const struct irc_line *l, gboolean incoming);
void handle_network_log(enum log_level level, const struct irc_network *n, 
						const char *msg);
char *custom_subst(struct irc_network *network, 
						 const char *fmt, const struct irc_line *l, 
						 const char *_identifier, 
						 gboolean case_sensitive, gboolean noslash);

/* cache.c */
gboolean client_try_cache(struct irc_client *c, struct irc_network_state *n, struct irc_line *l);

/* linestack.c */
void init_linestack(struct ctrlproxy_config *);

/* gen_config.c */
void network_update_config(struct irc_network_state *ns, struct network_config *nc);
void channel_update_config(struct irc_channel_state *ns, struct channel_config *nc);
void global_update_config(struct global *my_global);

/* repl.c */
void client_replicate(struct irc_client *);

gboolean init_replication(void);

/* main.c */
void free_global(struct global *);
void config_load_notify(struct global *global);
void config_save_notify(struct global *global, const char *);
struct global *load_global(const char *config_dir);
struct global *init_global(void);

/* nickserv.c */
void init_nickserv(void);
gboolean nickserv_load(struct global *global);
gboolean nickserv_save(struct global *global, const char *dir);
void nickserv_identify_me(struct irc_network *network, char *nick);

/* admin.c */
void init_admin(void);
gboolean admin_process_command(struct irc_client *c, struct irc_line *l, int cmdoffset);
void admin_log(enum log_level level, const struct irc_network *n, const struct irc_client *c, const char *data);
gboolean start_admin_socket(struct global *global);
gboolean stop_admin_socket(struct global *global);
gboolean admin_socket_prompt(const char *config_dir);

/* settings.c */
gboolean create_configuration(const char *config_dir);

/* pipes.c */
gboolean start_unix_socket(struct global *);
gboolean stop_unix_socket(struct global *);

/* log_custom.c */
void log_custom_load(struct log_file_config *config);

/* listener.c */
G_GNUC_MALLOC G_MODULE_EXPORT struct irc_listener *listener_init(struct global *global, struct listener_config *);
void free_listeners(struct global *global);

/* auto_away.c */
void auto_away_add(struct global *global, struct auto_away_config *config);



#endif /* __INTERNALS_H__ */