eventmachine 0.12.6-x86-mswin32-60 → 0.12.8-x86-mswin32-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{docs/README → README} +21 -13
- data/Rakefile +14 -4
- data/docs/DEFERRABLES +0 -5
- data/docs/INSTALL +2 -4
- data/docs/LEGAL +1 -1
- data/docs/LIGHTWEIGHT_CONCURRENCY +0 -2
- data/docs/PURE_RUBY +0 -2
- data/docs/RELEASE_NOTES +0 -2
- data/docs/SMTP +0 -7
- data/docs/SPAWNED_PROCESSES +0 -4
- data/docs/TODO +0 -2
- data/eventmachine.gemspec +41 -32
- data/examples/ex_channel.rb +43 -0
- data/examples/ex_queue.rb +2 -0
- data/examples/helper.rb +2 -0
- data/ext/cmain.cpp +685 -586
- data/ext/cplusplus.cpp +15 -6
- data/ext/ed.cpp +1732 -1522
- data/ext/ed.h +407 -380
- data/ext/em.cpp +2263 -1937
- data/ext/em.h +223 -186
- data/ext/eventmachine.h +111 -98
- data/ext/eventmachine_cpp.h +1 -0
- data/ext/extconf.rb +4 -0
- data/ext/kb.cpp +81 -82
- data/ext/pipe.cpp +349 -351
- data/ext/project.h +21 -0
- data/ext/rubymain.cpp +1047 -847
- data/ext/ssl.cpp +38 -1
- data/ext/ssl.h +5 -1
- data/java/src/com/rubyeventmachine/Application.java +7 -3
- data/java/src/com/rubyeventmachine/EmReactor.java +16 -1
- data/java/src/com/rubyeventmachine/tests/ConnectTest.java +25 -3
- data/lib/{protocols → em}/buftok.rb +16 -5
- data/lib/em/callback.rb +26 -0
- data/lib/em/channel.rb +57 -0
- data/lib/em/connection.rb +505 -0
- data/lib/em/deferrable.rb +144 -165
- data/lib/em/file_watch.rb +54 -0
- data/lib/em/future.rb +24 -25
- data/lib/em/messages.rb +1 -1
- data/lib/em/process_watch.rb +44 -0
- data/lib/em/processes.rb +119 -113
- data/lib/em/protocols.rb +35 -0
- data/lib/em/protocols/header_and_content.rb +138 -0
- data/lib/em/protocols/httpclient.rb +263 -0
- data/lib/em/protocols/httpclient2.rb +582 -0
- data/lib/{protocols → em/protocols}/line_and_text.rb +2 -2
- data/lib/em/protocols/linetext2.rb +160 -0
- data/lib/{protocols → em/protocols}/memcache.rb +37 -7
- data/lib/em/protocols/object_protocol.rb +39 -0
- data/lib/em/protocols/postgres3.rb +247 -0
- data/lib/em/protocols/saslauth.rb +175 -0
- data/lib/em/protocols/smtpclient.rb +331 -0
- data/lib/em/protocols/smtpserver.rb +547 -0
- data/lib/em/protocols/stomp.rb +200 -0
- data/lib/{protocols → em/protocols}/tcptest.rb +21 -25
- data/lib/em/queue.rb +61 -0
- data/lib/em/spawnable.rb +53 -56
- data/lib/em/streamer.rb +92 -74
- data/lib/em/timers.rb +55 -0
- data/lib/em/version.rb +3 -0
- data/lib/eventmachine.rb +1636 -1926
- data/lib/evma.rb +1 -1
- data/lib/jeventmachine.rb +106 -101
- data/lib/pr_eventmachine.rb +47 -36
- data/tasks/project.rake +2 -1
- data/tests/client.crt +31 -0
- data/tests/client.key +51 -0
- data/tests/test_attach.rb +18 -0
- data/tests/test_basic.rb +285 -231
- data/tests/test_channel.rb +63 -0
- data/tests/test_connection_count.rb +2 -2
- data/tests/test_epoll.rb +162 -163
- data/tests/test_errors.rb +36 -36
- data/tests/test_exc.rb +22 -25
- data/tests/test_file_watch.rb +49 -0
- data/tests/test_futures.rb +77 -93
- data/tests/test_hc.rb +2 -2
- data/tests/test_httpclient.rb +55 -52
- data/tests/test_httpclient2.rb +153 -155
- data/tests/test_inactivity_timeout.rb +30 -0
- data/tests/test_kb.rb +8 -9
- data/tests/test_ltp2.rb +274 -277
- data/tests/test_next_tick.rb +135 -109
- data/tests/test_object_protocol.rb +37 -0
- data/tests/test_process_watch.rb +48 -0
- data/tests/test_processes.rb +128 -95
- data/tests/test_proxy_connection.rb +92 -0
- data/tests/test_pure.rb +1 -5
- data/tests/test_queue.rb +44 -0
- data/tests/test_running.rb +9 -14
- data/tests/test_sasl.rb +32 -34
- data/tests/test_send_file.rb +175 -176
- data/tests/test_servers.rb +37 -41
- data/tests/test_smtpserver.rb +47 -55
- data/tests/test_spawn.rb +284 -291
- data/tests/test_ssl_args.rb +1 -1
- data/tests/test_ssl_methods.rb +1 -1
- data/tests/test_ssl_verify.rb +82 -0
- data/tests/test_timers.rb +81 -88
- data/tests/test_ud.rb +0 -7
- data/tests/testem.rb +1 -1
- metadata +52 -36
- data/lib/em/eventable.rb +0 -39
- data/lib/eventmachine_version.rb +0 -31
- data/lib/protocols/header_and_content.rb +0 -129
- data/lib/protocols/httpcli2.rb +0 -803
- data/lib/protocols/httpclient.rb +0 -270
- data/lib/protocols/linetext2.rb +0 -161
- data/lib/protocols/postgres.rb +0 -261
- data/lib/protocols/saslauth.rb +0 -179
- data/lib/protocols/smtpclient.rb +0 -308
- data/lib/protocols/smtpserver.rb +0 -556
- data/lib/protocols/stomp.rb +0 -153
- data/tests/test_eventables.rb +0 -77
data/ext/em.h
CHANGED
@@ -1,186 +1,223 @@
|
|
1
|
-
/*****************************************************************************
|
2
|
-
|
3
|
-
$Id$
|
4
|
-
|
5
|
-
File: em.h
|
6
|
-
Date: 06Apr06
|
7
|
-
|
8
|
-
Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
-
Gmail: blackhedd
|
10
|
-
|
11
|
-
This program is free software; you can redistribute it and/or modify
|
12
|
-
it under the terms of either: 1) the GNU General Public License
|
13
|
-
as published by the Free Software Foundation; either version 2 of the
|
14
|
-
License, or (at your option) any later version; or 2) Ruby's License.
|
15
|
-
|
16
|
-
See the file COPYING for complete licensing information.
|
17
|
-
|
18
|
-
*****************************************************************************/
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
#ifdef OS_WIN32
|
23
|
-
#include "emwin.h"
|
24
|
-
#endif
|
25
|
-
|
26
|
-
|
27
|
-
// THIS ENTIRE FILE WILL EVENTUALLY BE FOR UNIX BUILDS ONLY.
|
28
|
-
//#ifdef OS_UNIX
|
29
|
-
|
30
|
-
#ifndef __EventMachine__H_
|
31
|
-
#define __EventMachine__H_
|
32
|
-
|
33
|
-
#ifdef BUILD_FOR_RUBY
|
34
|
-
#include <ruby.h>
|
35
|
-
#define EmSelect rb_thread_select
|
36
|
-
|
37
|
-
#ifdef HAVE_RBTRAP
|
38
|
-
#include <rubysig.h>
|
39
|
-
#else
|
40
|
-
#define TRAP_BEG
|
41
|
-
#define TRAP_END
|
42
|
-
#endif
|
43
|
-
|
44
|
-
// 1.9.0 compat
|
45
|
-
#ifndef RUBY_UBF_IO
|
46
|
-
#define RUBY_UBF_IO RB_UBF_DFL
|
47
|
-
#endif
|
48
|
-
#else
|
49
|
-
#define EmSelect select
|
50
|
-
#endif
|
51
|
-
|
52
|
-
|
53
|
-
#ifdef OS_UNIX
|
54
|
-
typedef long long Int64;
|
55
|
-
#endif
|
56
|
-
#ifdef OS_WIN32
|
57
|
-
typedef __int64 Int64;
|
58
|
-
#endif
|
59
|
-
|
60
|
-
extern
|
61
|
-
|
62
|
-
class EventableDescriptor;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
static
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
void
|
81
|
-
void
|
82
|
-
|
83
|
-
const char *
|
84
|
-
const char *
|
85
|
-
const char *
|
86
|
-
|
87
|
-
const char *CreateTcpServer (const char *, int);
|
88
|
-
const char *OpenDatagramSocket (const char *, int);
|
89
|
-
const char *CreateUnixDomainServer (const char*);
|
90
|
-
const char *_OpenFileForWriting (const char*);
|
91
|
-
const char *OpenKeyboard();
|
92
|
-
//const char *Popen (const char*, const char*);
|
93
|
-
const char *Socketpair (char* const*);
|
94
|
-
|
95
|
-
void Add (EventableDescriptor*);
|
96
|
-
void Modify (EventableDescriptor*);
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
void
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
int
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
void
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
void
|
127
|
-
|
128
|
-
|
129
|
-
void
|
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
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
1
|
+
/*****************************************************************************
|
2
|
+
|
3
|
+
$Id$
|
4
|
+
|
5
|
+
File: em.h
|
6
|
+
Date: 06Apr06
|
7
|
+
|
8
|
+
Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
+
Gmail: blackhedd
|
10
|
+
|
11
|
+
This program is free software; you can redistribute it and/or modify
|
12
|
+
it under the terms of either: 1) the GNU General Public License
|
13
|
+
as published by the Free Software Foundation; either version 2 of the
|
14
|
+
License, or (at your option) any later version; or 2) Ruby's License.
|
15
|
+
|
16
|
+
See the file COPYING for complete licensing information.
|
17
|
+
|
18
|
+
*****************************************************************************/
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
#ifdef OS_WIN32
|
23
|
+
#include "emwin.h"
|
24
|
+
#endif
|
25
|
+
|
26
|
+
|
27
|
+
// THIS ENTIRE FILE WILL EVENTUALLY BE FOR UNIX BUILDS ONLY.
|
28
|
+
//#ifdef OS_UNIX
|
29
|
+
|
30
|
+
#ifndef __EventMachine__H_
|
31
|
+
#define __EventMachine__H_
|
32
|
+
|
33
|
+
#ifdef BUILD_FOR_RUBY
|
34
|
+
#include <ruby.h>
|
35
|
+
#define EmSelect rb_thread_select
|
36
|
+
|
37
|
+
#ifdef HAVE_RBTRAP
|
38
|
+
#include <rubysig.h>
|
39
|
+
#else
|
40
|
+
#define TRAP_BEG
|
41
|
+
#define TRAP_END
|
42
|
+
#endif
|
43
|
+
|
44
|
+
// 1.9.0 compat
|
45
|
+
#ifndef RUBY_UBF_IO
|
46
|
+
#define RUBY_UBF_IO RB_UBF_DFL
|
47
|
+
#endif
|
48
|
+
#else
|
49
|
+
#define EmSelect select
|
50
|
+
#endif
|
51
|
+
|
52
|
+
|
53
|
+
#ifdef OS_UNIX
|
54
|
+
typedef long long Int64;
|
55
|
+
#endif
|
56
|
+
#ifdef OS_WIN32
|
57
|
+
typedef __int64 Int64;
|
58
|
+
#endif
|
59
|
+
|
60
|
+
extern Int64 gCurrentLoopTime;
|
61
|
+
|
62
|
+
class EventableDescriptor;
|
63
|
+
class InotifyDescriptor;
|
64
|
+
|
65
|
+
|
66
|
+
/********************
|
67
|
+
class EventMachine_t
|
68
|
+
********************/
|
69
|
+
|
70
|
+
class EventMachine_t
|
71
|
+
{
|
72
|
+
public:
|
73
|
+
static int GetMaxTimerCount();
|
74
|
+
static void SetMaxTimerCount (int);
|
75
|
+
|
76
|
+
public:
|
77
|
+
EventMachine_t (void(*event_callback)(const char*, int, const char*, int));
|
78
|
+
virtual ~EventMachine_t();
|
79
|
+
|
80
|
+
void Run();
|
81
|
+
void ScheduleHalt();
|
82
|
+
void SignalLoopBreaker();
|
83
|
+
const char *InstallOneshotTimer (int);
|
84
|
+
const char *ConnectToServer (const char *, int, const char *, int);
|
85
|
+
const char *ConnectToUnixServer (const char *);
|
86
|
+
|
87
|
+
const char *CreateTcpServer (const char *, int);
|
88
|
+
const char *OpenDatagramSocket (const char *, int);
|
89
|
+
const char *CreateUnixDomainServer (const char*);
|
90
|
+
const char *_OpenFileForWriting (const char*);
|
91
|
+
const char *OpenKeyboard();
|
92
|
+
//const char *Popen (const char*, const char*);
|
93
|
+
const char *Socketpair (char* const*);
|
94
|
+
|
95
|
+
void Add (EventableDescriptor*);
|
96
|
+
void Modify (EventableDescriptor*);
|
97
|
+
|
98
|
+
const char *AttachFD (int, bool, bool);
|
99
|
+
int DetachFD (EventableDescriptor*);
|
100
|
+
|
101
|
+
void ArmKqueueWriter (EventableDescriptor*);
|
102
|
+
void ArmKqueueReader (EventableDescriptor*);
|
103
|
+
|
104
|
+
void SetTimerQuantum (int);
|
105
|
+
static void SetuidString (const char*);
|
106
|
+
static int SetRlimitNofile (int);
|
107
|
+
|
108
|
+
pid_t SubprocessPid;
|
109
|
+
int SubprocessExitStatus;
|
110
|
+
|
111
|
+
int GetConnectionCount();
|
112
|
+
float GetHeartbeatInterval();
|
113
|
+
int SetHeartbeatInterval(float);
|
114
|
+
|
115
|
+
const char *WatchFile (const char*);
|
116
|
+
void UnwatchFile (int);
|
117
|
+
void UnwatchFile (const char*);
|
118
|
+
|
119
|
+
#ifdef HAVE_KQUEUE
|
120
|
+
void _HandleKqueueFileEvent (struct kevent*);
|
121
|
+
void _RegisterKqueueFileEvent(int);
|
122
|
+
#endif
|
123
|
+
|
124
|
+
const char *WatchPid (int);
|
125
|
+
void UnwatchPid (int);
|
126
|
+
void UnwatchPid (const char *);
|
127
|
+
|
128
|
+
#ifdef HAVE_KQUEUE
|
129
|
+
void _HandleKqueuePidEvent (struct kevent*);
|
130
|
+
#endif
|
131
|
+
|
132
|
+
// Temporary:
|
133
|
+
void _UseEpoll();
|
134
|
+
void _UseKqueue();
|
135
|
+
|
136
|
+
bool UsingKqueue() { return bKqueue; }
|
137
|
+
bool UsingEpoll() { return bEpoll; }
|
138
|
+
|
139
|
+
private:
|
140
|
+
bool _RunOnce();
|
141
|
+
bool _RunTimers();
|
142
|
+
void _UpdateTime();
|
143
|
+
void _AddNewDescriptors();
|
144
|
+
void _ModifyDescriptors();
|
145
|
+
void _InitializeLoopBreaker();
|
146
|
+
|
147
|
+
bool _RunSelectOnce();
|
148
|
+
bool _RunEpollOnce();
|
149
|
+
bool _RunKqueueOnce();
|
150
|
+
|
151
|
+
void _ModifyEpollEvent (EventableDescriptor*);
|
152
|
+
|
153
|
+
public:
|
154
|
+
void _ReadLoopBreaker();
|
155
|
+
void _ReadInotifyEvents();
|
156
|
+
|
157
|
+
private:
|
158
|
+
enum {
|
159
|
+
MaxEpollDescriptors = 64*1024,
|
160
|
+
MaxEvents = 4096
|
161
|
+
};
|
162
|
+
int HeartbeatInterval;
|
163
|
+
void (*EventCallback)(const char*, int, const char*, int);
|
164
|
+
|
165
|
+
class Timer_t: public Bindable_t {
|
166
|
+
};
|
167
|
+
|
168
|
+
multimap<Int64, Timer_t> Timers;
|
169
|
+
map<int, Bindable_t*> Files;
|
170
|
+
map<int, Bindable_t*> Pids;
|
171
|
+
vector<EventableDescriptor*> Descriptors;
|
172
|
+
vector<EventableDescriptor*> NewDescriptors;
|
173
|
+
set<EventableDescriptor*> ModifiedDescriptors;
|
174
|
+
|
175
|
+
Int64 NextHeartbeatTime;
|
176
|
+
|
177
|
+
int LoopBreakerReader;
|
178
|
+
int LoopBreakerWriter;
|
179
|
+
#ifdef OS_WIN32
|
180
|
+
struct sockaddr_in LoopBreakerTarget;
|
181
|
+
#endif
|
182
|
+
|
183
|
+
timeval Quantum;
|
184
|
+
|
185
|
+
private:
|
186
|
+
bool bEpoll;
|
187
|
+
int epfd; // Epoll file-descriptor
|
188
|
+
#ifdef HAVE_EPOLL
|
189
|
+
struct epoll_event epoll_events [MaxEvents];
|
190
|
+
#endif
|
191
|
+
|
192
|
+
bool bKqueue;
|
193
|
+
int kqfd; // Kqueue file-descriptor
|
194
|
+
#ifdef HAVE_KQUEUE
|
195
|
+
struct kevent Karray [MaxEvents];
|
196
|
+
#endif
|
197
|
+
|
198
|
+
InotifyDescriptor *inotify; // pollable descriptor for our inotify instance
|
199
|
+
};
|
200
|
+
|
201
|
+
|
202
|
+
/*******************
|
203
|
+
struct SelectData_t
|
204
|
+
*******************/
|
205
|
+
|
206
|
+
struct SelectData_t
|
207
|
+
{
|
208
|
+
SelectData_t();
|
209
|
+
|
210
|
+
int _Select();
|
211
|
+
|
212
|
+
int maxsocket;
|
213
|
+
fd_set fdreads;
|
214
|
+
fd_set fdwrites;
|
215
|
+
timeval tv;
|
216
|
+
int nSockets;
|
217
|
+
};
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
#endif // __EventMachine__H_
|
222
|
+
|
223
|
+
//#endif // OS_UNIX
|
data/ext/eventmachine.h
CHANGED
@@ -1,98 +1,111 @@
|
|
1
|
-
/*****************************************************************************
|
2
|
-
|
3
|
-
$Id$
|
4
|
-
|
5
|
-
File: eventmachine.h
|
6
|
-
Date: 15Apr06
|
7
|
-
|
8
|
-
Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
-
Gmail: blackhedd
|
10
|
-
|
11
|
-
This program is free software; you can redistribute it and/or modify
|
12
|
-
it under the terms of either: 1) the GNU General Public License
|
13
|
-
as published by the Free Software Foundation; either version 2 of the
|
14
|
-
License, or (at your option) any later version; or 2) Ruby's License.
|
15
|
-
|
16
|
-
See the file COPYING for complete licensing information.
|
17
|
-
|
18
|
-
*****************************************************************************/
|
19
|
-
|
20
|
-
#ifndef __EVMA_EventMachine__H_
|
21
|
-
#define __EVMA_EventMachine__H_
|
22
|
-
|
23
|
-
#if __cplusplus
|
24
|
-
extern "C" {
|
25
|
-
#endif
|
26
|
-
|
27
|
-
enum { // Event names
|
28
|
-
EM_TIMER_FIRED = 100,
|
29
|
-
EM_CONNECTION_READ = 101,
|
30
|
-
EM_CONNECTION_UNBOUND = 102,
|
31
|
-
EM_CONNECTION_ACCEPTED = 103,
|
32
|
-
EM_CONNECTION_COMPLETED = 104,
|
33
|
-
EM_LOOPBREAK_SIGNAL = 105,
|
34
|
-
EM_CONNECTION_NOTIFY_READABLE = 106,
|
35
|
-
EM_CONNECTION_NOTIFY_WRITABLE = 107,
|
36
|
-
EM_SSL_HANDSHAKE_COMPLETED = 108
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
void
|
43
|
-
|
44
|
-
|
45
|
-
const char *
|
46
|
-
|
47
|
-
const char *
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
const char *
|
54
|
-
const char *
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
#
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
int
|
66
|
-
int
|
67
|
-
int
|
68
|
-
int
|
69
|
-
int
|
70
|
-
int
|
71
|
-
int
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
int
|
76
|
-
|
77
|
-
void
|
78
|
-
int
|
79
|
-
void
|
80
|
-
void
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
int
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
1
|
+
/*****************************************************************************
|
2
|
+
|
3
|
+
$Id$
|
4
|
+
|
5
|
+
File: eventmachine.h
|
6
|
+
Date: 15Apr06
|
7
|
+
|
8
|
+
Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
+
Gmail: blackhedd
|
10
|
+
|
11
|
+
This program is free software; you can redistribute it and/or modify
|
12
|
+
it under the terms of either: 1) the GNU General Public License
|
13
|
+
as published by the Free Software Foundation; either version 2 of the
|
14
|
+
License, or (at your option) any later version; or 2) Ruby's License.
|
15
|
+
|
16
|
+
See the file COPYING for complete licensing information.
|
17
|
+
|
18
|
+
*****************************************************************************/
|
19
|
+
|
20
|
+
#ifndef __EVMA_EventMachine__H_
|
21
|
+
#define __EVMA_EventMachine__H_
|
22
|
+
|
23
|
+
#if __cplusplus
|
24
|
+
extern "C" {
|
25
|
+
#endif
|
26
|
+
|
27
|
+
enum { // Event names
|
28
|
+
EM_TIMER_FIRED = 100,
|
29
|
+
EM_CONNECTION_READ = 101,
|
30
|
+
EM_CONNECTION_UNBOUND = 102,
|
31
|
+
EM_CONNECTION_ACCEPTED = 103,
|
32
|
+
EM_CONNECTION_COMPLETED = 104,
|
33
|
+
EM_LOOPBREAK_SIGNAL = 105,
|
34
|
+
EM_CONNECTION_NOTIFY_READABLE = 106,
|
35
|
+
EM_CONNECTION_NOTIFY_WRITABLE = 107,
|
36
|
+
EM_SSL_HANDSHAKE_COMPLETED = 108,
|
37
|
+
EM_SSL_VERIFY = 109,
|
38
|
+
EM_PROXY_TARGET_UNBOUND = 110
|
39
|
+
|
40
|
+
};
|
41
|
+
|
42
|
+
void evma_initialize_library (void(*)(const char*, int, const char*, int));
|
43
|
+
void evma_run_machine();
|
44
|
+
void evma_release_library();
|
45
|
+
const char *evma_install_oneshot_timer (int seconds);
|
46
|
+
const char *evma_connect_to_server (const char *bind_addr, int bind_port, const char *server, int port);
|
47
|
+
const char *evma_connect_to_unix_server (const char *server);
|
48
|
+
|
49
|
+
const char *evma_attach_fd (int file_descriptor, int read_mode, int write_mode);
|
50
|
+
int evma_detach_fd (const char *binding);
|
51
|
+
|
52
|
+
void evma_stop_tcp_server (const char *signature);
|
53
|
+
const char *evma_create_tcp_server (const char *address, int port);
|
54
|
+
const char *evma_create_unix_domain_server (const char *filename);
|
55
|
+
const char *evma_open_datagram_socket (const char *server, int port);
|
56
|
+
const char *evma_open_keyboard();
|
57
|
+
void evma_set_tls_parms (const char *binding, const char *privatekey_filename, const char *certchain_filenane, int verify_peer);
|
58
|
+
void evma_start_tls (const char *binding);
|
59
|
+
|
60
|
+
#ifdef WITH_SSL
|
61
|
+
X509 *evma_get_peer_cert (const char *binding);
|
62
|
+
void evma_accept_ssl_peer (const char *binding);
|
63
|
+
#endif
|
64
|
+
|
65
|
+
int evma_get_peername (const char *binding, struct sockaddr*);
|
66
|
+
int evma_get_sockname (const char *binding, struct sockaddr*);
|
67
|
+
int evma_get_subprocess_pid (const char *binding, pid_t*);
|
68
|
+
int evma_get_subprocess_status (const char *binding, int*);
|
69
|
+
int evma_get_connection_count();
|
70
|
+
int evma_send_data_to_connection (const char *binding, const char *data, int data_length);
|
71
|
+
int evma_send_datagram (const char *binding, const char *data, int data_length, const char *address, int port);
|
72
|
+
float evma_get_comm_inactivity_timeout (const char *binding);
|
73
|
+
int evma_set_comm_inactivity_timeout (const char *binding, float value);
|
74
|
+
int evma_get_outbound_data_size (const char *binding);
|
75
|
+
int evma_send_file_data_to_connection (const char *binding, const char *filename);
|
76
|
+
|
77
|
+
void evma_close_connection (const char *binding, int after_writing);
|
78
|
+
int evma_report_connection_error_status (const char *binding);
|
79
|
+
void evma_signal_loopbreak();
|
80
|
+
void evma_set_timer_quantum (int);
|
81
|
+
int evma_get_max_timer_count();
|
82
|
+
void evma_set_max_timer_count (int);
|
83
|
+
void evma_setuid_string (const char *username);
|
84
|
+
void evma_stop_machine();
|
85
|
+
float evma_get_heartbeat_interval();
|
86
|
+
int evma_set_heartbeat_interval(float);
|
87
|
+
|
88
|
+
const char *evma__write_file (const char *filename);
|
89
|
+
const char *evma_popen (char * const*cmd_strings);
|
90
|
+
|
91
|
+
const char *evma_watch_filename (const char *fname);
|
92
|
+
void evma_unwatch_filename (const char *sig);
|
93
|
+
|
94
|
+
const char *evma_watch_pid (int);
|
95
|
+
void evma_unwatch_pid (const char *sig);
|
96
|
+
|
97
|
+
void evma_start_proxy(const char*, const char*);
|
98
|
+
void evma_stop_proxy(const char*);
|
99
|
+
|
100
|
+
int evma_set_rlimit_nofile (int n_files);
|
101
|
+
|
102
|
+
void evma_set_epoll (int use);
|
103
|
+
void evma_set_kqueue (int use);
|
104
|
+
|
105
|
+
#if __cplusplus
|
106
|
+
}
|
107
|
+
#endif
|
108
|
+
|
109
|
+
|
110
|
+
#endif // __EventMachine__H_
|
111
|
+
|