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
|
/* $%BEGINLICENSE%$
Copyright (C) 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc
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; version 2 of the License.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$%ENDLICENSE%$ */
#ifndef _CHASSIS_MAINLOOP_H_
#define _CHASSIS_MAINLOOP_H_
#include <glib.h> /* GPtrArray */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* event.h needs struct tm */
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef _WIN32
#include <winsock2.h>
#endif
#include <event.h> /* struct event_base */
#include "chassis-exports.h"
#include "chassis-log.h"
typedef struct chassis_private chassis_private;
typedef struct chassis chassis;
struct chassis {
struct event_base *event_base;
GPtrArray *modules; /**< array(chassis_plugin) */
gchar *base_dir; /**< base directory for all relative paths referenced */
chassis_private *priv;
void (*priv_shutdown)(chassis *chas, chassis_private *priv);
void (*priv_free)(chassis *chas, chassis_private *priv);
chassis_log *log;
};
CHASSIS_API chassis *chassis_init(void);
CHASSIS_API void chassis_free(chassis *chas);
/**
* the mainloop for all chassis apps
*
* can be called directly or as gthread_* functions
*/
CHASSIS_API int chassis_mainloop(void *user_data);
CHASSIS_API void chassis_set_shutdown(void);
CHASSIS_API gboolean chassis_is_shutdown(void);
CHASSIS_API gboolean chassis_resolve_path(chassis *chas, gchar **filename);
#endif
|