Fix header installation.
[jelmer/ctrlproxy.git] / src / ctrlproxy.h
1 /*
2         ctrlproxy: A modular IRC proxy
3         (c) 2002 Jelmer Vernooij <jelmer@nl.linux.org>
4
5         This program is free software; you can redistribute it and/or modify
6         it under the terms of the GNU General Public License as published by
7         the Free Software Foundation; either version 2 of the License, or
8         (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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef __CTRLPROXY_H__
21 #define __CTRLPROXY_H__
22
23 #include <stdlib.h>
24 #include <string.h>
25 #include <time.h>
26 #include <stdarg.h>
27 #include <glib.h>
28 #include <gmodule.h>
29
30 /**
31  * @file
32  * @brief Main functions
33  */
34
35 #if defined(STRICT_MEMORY_ALLOCS) && !defined(SWIGPYTHON)
36 #define calloc(a,b) __ERROR_USE_G_NEW0__
37 #define malloc(a) __ERROR_USE_G_MALLOC_OR_G_NEW__
38 #define realloc(a,b) __ERROR_USE_G_REALLOC_OR_G_RE_NEW__
39 #define free(a) __ERROR_USE_G_FREE__
40 #undef strdup
41 #define strdup(a) __ERROR_USE_G_STRDUP__
42 #undef strndup
43 #define strndup(a) __ERROR_USE_G_STRNDUP__
44 #endif
45
46 #ifndef G_MODULE_EXPORT
47 #define G_MODULE_EXPORT 
48 #endif
49
50 #include "settings.h"
51 #include "network.h"
52 #include "client.h"
53 #include "state.h"
54 #include "linestack.h"
55 #include "hooks.h"
56 #include "repl.h"
57 #include "ctcp.h"
58 #include "admin.h"
59
60 /**
61  * Global information.
62  */
63 struct global {
64         struct ctrlproxy_config *config;
65         GList *new_network_notifiers;
66         GList *networks;
67         GList *nickserv_nicks;
68
69         GIOChannel *unix_incoming;
70         gint unix_incoming_id;
71 };
72
73 struct plugin_ops {
74         int version;
75         const char *name;
76         gboolean (*init) (void);
77 };
78
79 /* main.c */
80 G_MODULE_EXPORT const char *ctrlproxy_version(void);
81 G_MODULE_EXPORT const char *get_my_hostname(void);
82
83 typedef void (*config_load_notify_fn) (struct global *);
84 typedef void (*config_save_notify_fn) (struct global *, const char *);
85 G_MODULE_EXPORT void register_load_config_notify(config_load_notify_fn fn);
86 G_MODULE_EXPORT void register_save_config_notify(config_save_notify_fn fn);
87
88 /* util.c */
89 G_MODULE_EXPORT char *list_make_string(GList *);
90 G_MODULE_EXPORT int verify_client(const struct network *s, const struct client *c);
91 G_MODULE_EXPORT int str_rfc1459cmp(const char *a, const char *b);
92 G_MODULE_EXPORT int str_strictrfc1459cmp(const char *a, const char *b);
93 G_MODULE_EXPORT int str_asciicmp(const char *a, const char *b);
94 G_MODULE_EXPORT char *g_io_channel_ip_get_description(GIOChannel *ch);
95
96 /* log.c */
97 enum log_level { LOG_DATA=5, LOG_TRACE=4, LOG_INFO=3, LOG_WARNING=2, LOG_ERROR=1 };
98 G_MODULE_EXPORT void log_network(enum log_level, const struct network *, const char *fmt, ...);
99 G_MODULE_EXPORT void log_client(enum log_level, const struct client *, const char *fmt, ...);
100 G_MODULE_EXPORT void log_global(enum log_level, const char *fmt, ...);
101 G_MODULE_EXPORT void log_network_state(enum log_level l, const struct network_state *st, const char *fmt, ...);
102
103 #endif /* __CTRLPROXY_H__ */