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.
Files changed (116) hide show
  1. data/{docs/README → README} +21 -13
  2. data/Rakefile +14 -4
  3. data/docs/DEFERRABLES +0 -5
  4. data/docs/INSTALL +2 -4
  5. data/docs/LEGAL +1 -1
  6. data/docs/LIGHTWEIGHT_CONCURRENCY +0 -2
  7. data/docs/PURE_RUBY +0 -2
  8. data/docs/RELEASE_NOTES +0 -2
  9. data/docs/SMTP +0 -7
  10. data/docs/SPAWNED_PROCESSES +0 -4
  11. data/docs/TODO +0 -2
  12. data/eventmachine.gemspec +41 -32
  13. data/examples/ex_channel.rb +43 -0
  14. data/examples/ex_queue.rb +2 -0
  15. data/examples/helper.rb +2 -0
  16. data/ext/cmain.cpp +685 -586
  17. data/ext/cplusplus.cpp +15 -6
  18. data/ext/ed.cpp +1732 -1522
  19. data/ext/ed.h +407 -380
  20. data/ext/em.cpp +2263 -1937
  21. data/ext/em.h +223 -186
  22. data/ext/eventmachine.h +111 -98
  23. data/ext/eventmachine_cpp.h +1 -0
  24. data/ext/extconf.rb +4 -0
  25. data/ext/kb.cpp +81 -82
  26. data/ext/pipe.cpp +349 -351
  27. data/ext/project.h +21 -0
  28. data/ext/rubymain.cpp +1047 -847
  29. data/ext/ssl.cpp +38 -1
  30. data/ext/ssl.h +5 -1
  31. data/java/src/com/rubyeventmachine/Application.java +7 -3
  32. data/java/src/com/rubyeventmachine/EmReactor.java +16 -1
  33. data/java/src/com/rubyeventmachine/tests/ConnectTest.java +25 -3
  34. data/lib/{protocols → em}/buftok.rb +16 -5
  35. data/lib/em/callback.rb +26 -0
  36. data/lib/em/channel.rb +57 -0
  37. data/lib/em/connection.rb +505 -0
  38. data/lib/em/deferrable.rb +144 -165
  39. data/lib/em/file_watch.rb +54 -0
  40. data/lib/em/future.rb +24 -25
  41. data/lib/em/messages.rb +1 -1
  42. data/lib/em/process_watch.rb +44 -0
  43. data/lib/em/processes.rb +119 -113
  44. data/lib/em/protocols.rb +35 -0
  45. data/lib/em/protocols/header_and_content.rb +138 -0
  46. data/lib/em/protocols/httpclient.rb +263 -0
  47. data/lib/em/protocols/httpclient2.rb +582 -0
  48. data/lib/{protocols → em/protocols}/line_and_text.rb +2 -2
  49. data/lib/em/protocols/linetext2.rb +160 -0
  50. data/lib/{protocols → em/protocols}/memcache.rb +37 -7
  51. data/lib/em/protocols/object_protocol.rb +39 -0
  52. data/lib/em/protocols/postgres3.rb +247 -0
  53. data/lib/em/protocols/saslauth.rb +175 -0
  54. data/lib/em/protocols/smtpclient.rb +331 -0
  55. data/lib/em/protocols/smtpserver.rb +547 -0
  56. data/lib/em/protocols/stomp.rb +200 -0
  57. data/lib/{protocols → em/protocols}/tcptest.rb +21 -25
  58. data/lib/em/queue.rb +61 -0
  59. data/lib/em/spawnable.rb +53 -56
  60. data/lib/em/streamer.rb +92 -74
  61. data/lib/em/timers.rb +55 -0
  62. data/lib/em/version.rb +3 -0
  63. data/lib/eventmachine.rb +1636 -1926
  64. data/lib/evma.rb +1 -1
  65. data/lib/jeventmachine.rb +106 -101
  66. data/lib/pr_eventmachine.rb +47 -36
  67. data/tasks/project.rake +2 -1
  68. data/tests/client.crt +31 -0
  69. data/tests/client.key +51 -0
  70. data/tests/test_attach.rb +18 -0
  71. data/tests/test_basic.rb +285 -231
  72. data/tests/test_channel.rb +63 -0
  73. data/tests/test_connection_count.rb +2 -2
  74. data/tests/test_epoll.rb +162 -163
  75. data/tests/test_errors.rb +36 -36
  76. data/tests/test_exc.rb +22 -25
  77. data/tests/test_file_watch.rb +49 -0
  78. data/tests/test_futures.rb +77 -93
  79. data/tests/test_hc.rb +2 -2
  80. data/tests/test_httpclient.rb +55 -52
  81. data/tests/test_httpclient2.rb +153 -155
  82. data/tests/test_inactivity_timeout.rb +30 -0
  83. data/tests/test_kb.rb +8 -9
  84. data/tests/test_ltp2.rb +274 -277
  85. data/tests/test_next_tick.rb +135 -109
  86. data/tests/test_object_protocol.rb +37 -0
  87. data/tests/test_process_watch.rb +48 -0
  88. data/tests/test_processes.rb +128 -95
  89. data/tests/test_proxy_connection.rb +92 -0
  90. data/tests/test_pure.rb +1 -5
  91. data/tests/test_queue.rb +44 -0
  92. data/tests/test_running.rb +9 -14
  93. data/tests/test_sasl.rb +32 -34
  94. data/tests/test_send_file.rb +175 -176
  95. data/tests/test_servers.rb +37 -41
  96. data/tests/test_smtpserver.rb +47 -55
  97. data/tests/test_spawn.rb +284 -291
  98. data/tests/test_ssl_args.rb +1 -1
  99. data/tests/test_ssl_methods.rb +1 -1
  100. data/tests/test_ssl_verify.rb +82 -0
  101. data/tests/test_timers.rb +81 -88
  102. data/tests/test_ud.rb +0 -7
  103. data/tests/testem.rb +1 -1
  104. metadata +52 -36
  105. data/lib/em/eventable.rb +0 -39
  106. data/lib/eventmachine_version.rb +0 -31
  107. data/lib/protocols/header_and_content.rb +0 -129
  108. data/lib/protocols/httpcli2.rb +0 -803
  109. data/lib/protocols/httpclient.rb +0 -270
  110. data/lib/protocols/linetext2.rb +0 -161
  111. data/lib/protocols/postgres.rb +0 -261
  112. data/lib/protocols/saslauth.rb +0 -179
  113. data/lib/protocols/smtpclient.rb +0 -308
  114. data/lib/protocols/smtpserver.rb +0 -556
  115. data/lib/protocols/stomp.rb +0 -153
  116. 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 time_t gCurrentLoopTime;
61
-
62
- class EventableDescriptor;
63
-
64
-
65
- /********************
66
- class EventMachine_t
67
- ********************/
68
-
69
- class EventMachine_t
70
- {
71
- public:
72
- static int GetMaxTimerCount();
73
- static void SetMaxTimerCount (int);
74
-
75
- public:
76
- EventMachine_t (void(*event_callback)(const char*, int, const char*, int));
77
- virtual ~EventMachine_t();
78
-
79
- void Run();
80
- void ScheduleHalt();
81
- void SignalLoopBreaker();
82
- const char *InstallOneshotTimer (int);
83
- const char *ConnectToServer (const char *, int);
84
- const char *ConnectToUnixServer (const char *);
85
- const char *AttachFD (int, bool, bool);
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
- int DetachFD (EventableDescriptor*);
98
- void ArmKqueueWriter (EventableDescriptor*);
99
- void ArmKqueueReader (EventableDescriptor*);
100
-
101
- void SetTimerQuantum (int);
102
- static void SetuidString (const char*);
103
- static int SetRlimitNofile (int);
104
-
105
- pid_t SubprocessPid;
106
- int SubprocessExitStatus;
107
-
108
- int GetConnectionCount();
109
-
110
- // Temporary:
111
- void _UseEpoll();
112
- void _UseKqueue();
113
-
114
-
115
- private:
116
- bool _RunOnce();
117
- bool _RunTimers();
118
- void _AddNewDescriptors();
119
- void _ModifyDescriptors();
120
- void _InitializeLoopBreaker();
121
-
122
- bool _RunSelectOnce();
123
- bool _RunEpollOnce();
124
- bool _RunKqueueOnce();
125
-
126
- void _ModifyEpollEvent (EventableDescriptor*);
127
-
128
- public:
129
- void _ReadLoopBreaker();
130
-
131
- private:
132
- enum {
133
- HeartbeatInterval = 2,
134
- MaxEpollDescriptors = 64*1024
135
- };
136
- void (*EventCallback)(const char*, int, const char*, int);
137
-
138
- class Timer_t: public Bindable_t {
139
- };
140
-
141
- multimap<Int64, Timer_t> Timers;
142
- vector<EventableDescriptor*> Descriptors;
143
- vector<EventableDescriptor*> NewDescriptors;
144
- set<EventableDescriptor*> ModifiedDescriptors;
145
-
146
- time_t NextHeartbeatTime;
147
-
148
- int LoopBreakerReader;
149
- int LoopBreakerWriter;
150
- #ifdef OS_WIN32
151
- struct sockaddr_in LoopBreakerTarget;
152
- #endif
153
-
154
- timeval Quantum;
155
-
156
- private:
157
- bool bEpoll;
158
- int epfd; // Epoll file-descriptor
159
-
160
- bool bKqueue;
161
- int kqfd; // Kqueue file-descriptor
162
- };
163
-
164
-
165
- /*******************
166
- struct SelectData_t
167
- *******************/
168
-
169
- struct SelectData_t
170
- {
171
- SelectData_t();
172
-
173
- int _Select();
174
-
175
- int maxsocket;
176
- fd_set fdreads;
177
- fd_set fdwrites;
178
- timeval tv;
179
- int nSockets;
180
- };
181
-
182
-
183
-
184
- #endif // __EventMachine__H_
185
-
186
- //#endif // OS_UNIX
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
- void evma_initialize_library (void(*)(const char*, int, const char*, int));
41
- void evma_run_machine();
42
- void evma_release_library();
43
- const char *evma_install_oneshot_timer (int seconds);
44
- const char *evma_connect_to_server (const char *server, int port);
45
- const char *evma_connect_to_unix_server (const char *server);
46
-
47
- const char *evma_attach_fd (int file_descriptor, int read_mode, int write_mode);
48
- int evma_detach_fd (const char *binding);
49
-
50
- void evma_stop_tcp_server (const char *signature);
51
- const char *evma_create_tcp_server (const char *address, int port);
52
- const char *evma_create_unix_domain_server (const char *filename);
53
- const char *evma_open_datagram_socket (const char *server, int port);
54
- const char *evma_open_keyboard();
55
- void evma_set_tls_parms (const char *binding, const char *privatekey_filename, const char *certchain_filenane);
56
- void evma_start_tls (const char *binding);
57
-
58
- #ifdef WITH_SSL
59
- X509 *evma_get_peer_cert (const char *binding);
60
- #endif
61
-
62
- int evma_get_peername (const char *binding, struct sockaddr*);
63
- int evma_get_sockname (const char *binding, struct sockaddr*);
64
- int evma_get_subprocess_pid (const char *binding, pid_t*);
65
- int evma_get_subprocess_status (const char *binding, int*);
66
- int evma_get_connection_count();
67
- int evma_send_data_to_connection (const char *binding, const char *data, int data_length);
68
- int evma_send_datagram (const char *binding, const char *data, int data_length, const char *address, int port);
69
- int evma_get_comm_inactivity_timeout (const char *binding, /*out*/int *value);
70
- int evma_set_comm_inactivity_timeout (const char *binding, /*in,out*/int *value);
71
- int evma_get_outbound_data_size (const char *binding);
72
- int evma_send_file_data_to_connection (const char *binding, const char *filename);
73
-
74
- void evma_close_connection (const char *binding, int after_writing);
75
- int evma_report_connection_error_status (const char *binding);
76
- void evma_signal_loopbreak();
77
- void evma_set_timer_quantum (int);
78
- int evma_get_max_timer_count();
79
- void evma_set_max_timer_count (int);
80
- void evma_setuid_string (const char *username);
81
- void evma_stop_machine();
82
-
83
- const char *evma__write_file (const char *filename);
84
- const char *evma_popen (char * const*cmd_strings);
85
-
86
- int evma_set_rlimit_nofile (int n_files);
87
-
88
- // Temporary:
89
- void evma__epoll();
90
- void evma__kqueue();
91
-
92
- #if __cplusplus
93
- }
94
- #endif
95
-
96
-
97
- #endif // __EventMachine__H_
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
+