This repository has been archived by the owner on Mar 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
libevent.vapi
155 lines (142 loc) · 5.75 KB
/
libevent.vapi
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
/* libevent Vala Bindings
* Copyright 2010 Evan Nemerson <[email protected]>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
[CCode (cheader_filename = "event2/event.h", lower_case_cprefix = "event_")]
namespace LibEvent {
[Compact, CCode (cname = "struct event_base", cheader_filename = "event2/event.h")]
public class Base {
public Base ();
public Base.with_config (LibEvent.Config cfg);
[CCode (cname = "event_reinit")]
public int reinit ();
public int dispatch ();
public unowned string get_method ();
public int get_features ();
public void set (LibEvent.Event event);
public int loop (LibEvent.LoopFlags flags);
public int loopexit (GLib.TimeVal tv);
public int loopbreak ();
public bool got_exit ();
public bool got_break ();
public int once (LibEvent.Base base, LibEvent.Util.Socket fd, short event, LibEvent.OccuredCallback cb, GLib.TimeVal tv);
public int priority_init (int npriorities);
public unowned GLib.TimeVal init_common_timeout (GLib.TimeVal duration);
public void dump_events (GLib.FileStream file);
}
[Compact, CCode (cname = "struct event_config")]
public class Config {
public int avoid_method (string method);
public int require_features (int feature);
public int set_flag (int flag);
}
[Compact, CCode (cname = "struct event", cprefix = "event_")]
public class Event {
public Event (LibEvent.Base base, LibEvent.Util.Socket fd, short event, LibEvent.OccuredCallback cb);
public int assign (LibEvent.Base base, LibEvent.Util.Socket fd, short event, LibEvent.OccuredCallback cb);
public int add (GLib.TimeVal tv);
public int del ();
public int active (int res, short ncalls);
public int pending (LibEvent.Flags what, GLib.TimeVal tv);
public bool initialized ();
public LibEvent.Util.Socket get_fd ();
public LibEvent.Base get_base ();
public int priority_set (int priority);
}
[CCode (cname = "enum event_method_feature", cprefix = "EV_FEATURE_", has_type_id = false)]
public enum MethodFeature {
ET,
O1,
FDS
}
[CCode (cname = "enum event_base_config_flag", cprefix = "EVENT_BASE_FLAG_", has_type_id = false)]
public enum BaseConfigFlag {
NOLOCK,
IGNORE_ENV,
STARTUP_IOCP,
NO_CACHE_TIME
}
[CCode (cname = "int", cprefix = "_EVENT_LOG_", has_type_id = false)]
public enum LogSeverity {
DEBUG,
MSG,
WARN,
ERR,
}
[Flags, CCode (cname = "int", cprefix = "EVLOOP_")]
public enum LoopFlags {
ONCE,
NONBLOCK
}
[Flags, CCode (cname = "short", cprefix = "EV_")]
public enum Flags {
TIMEOUT,
READ,
WRITE,
SIGNAL,
PERSIST,
ET
}
[CCode (cname = "event_log_cb", has_target = false)]
public delegate void LogCallback (LibEvent.LogSeverity severity, string message);
[CCode (cname = "event_fatal_cb", has_target = false)]
public delegate void FatalCallback (int err);
[CCode (cname = "void (*)(evutil_socket_t, short, void *)")]
public delegate void OccuredCallback (LibEvent.Util.Socket socket, short event);
[CCode (cname = "void *(*)(size_t)")]
public delegate void* MallocFunc (size_t sz);
[CCode (cname = "void *(*)(void *, size_t)")]
public delegate void* ReallocFunc (void* ptr, size_t sz);
[CCode (cname = "void (*)(void *)")]
public delegate void FreeFunc (void* ptr);
public static unowned string[] get_supported_methods ();
public static void set_log_callback (LibEvent.LogCallback cb);
public static void set_fatal_callback (LibEvent.FatalCallback cb);
public static unowned string get_version ();
public static uint32 get_version_number ();
public static void set_mem_functions (LibEvent.MallocFunc malloc_fn, LibEvent.ReallocFunc realloc_fn, LibEvent.FreeFunc free_fn);
[CCode (cname ="LIBEVENT_VERSION")]
public const int VERSION;
[CCode (cname ="LIBEVENT_VERSION_NUMBER")]
public const int VERSION_NUMBER;
public const int MAX_PRIORITIES;
[CCode (lower_case_cprefix = "evutil_")]
namespace Util {
[SimpleType, CCode (cname = "evutil_socket_t")]
public struct Socket {
[CCode (cname = "evutil_socketpair")]
public static int create_pair (int d, int type, int protocol, [CCode (array_length = false)] LibEvent.Util.Socket sv[2]);
[CCode (cname = "evutil_make_socket_nonblocking")]
public int make_nonblocking ();
[CCode (cname = "evutil_make_listen_socket_reuseable")]
public int make_listen_reuseable();
[CCode (cname = "evutil_make_socket_closeonexec")]
public int make_close_on_exec();
[CCode (cname = "evutil_closesocket")]
public int close ();
[CCode (cname = "evutil_socket_geterror")]
public int get_error ();
[CCode (cname = "evutil_socket_error_to_string")]
public static unowned string error_to_string (int errcode);
}
}
}