root/version_0/ext/eventmachine.h

Revision 626, 2.9 kB (checked in by blackhedd, 1 year ago)

implemented kqueue support

  • Property svn:keywords set to Id
Line 
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         };
35
36         void evma_initialize_library (void(*)(const char*, int, const char*, int));
37         void evma_run_machine();
38         void evma_release_library();
39         const char *evma_install_oneshot_timer (int seconds);
40         const char *evma_connect_to_server (const char *server, int port);
41         const char *evma_connect_to_unix_server (const char *server);
42         void evma_stop_tcp_server (const char *signature);
43         const char *evma_create_tcp_server (const char *address, int port);
44         const char *evma_create_unix_domain_server (const char *filename);
45         const char *evma_open_datagram_socket (const char *server, int port);
46         const char *evma_open_keyboard();
47         void evma_set_tls_parms (const char *binding, const char *privatekey_filename, const char *certchain_filenane);
48         void evma_start_tls (const char *binding);
49         int evma_get_peername (const char *binding, struct sockaddr*);
50         int evma_get_subprocess_pid (const char *binding, pid_t*);
51         int evma_get_subprocess_status (const char *binding, int*);
52         int evma_send_data_to_connection (const char *binding, const char *data, int data_length);
53         int evma_send_datagram (const char *binding, const char *data, int data_length, const char *address, int port);
54         int evma_get_comm_inactivity_timeout (const char *binding, /*out*/int *value);
55         int evma_set_comm_inactivity_timeout (const char *binding, /*in,out*/int *value);
56         int evma_get_outbound_data_size (const char *binding);
57         int evma_send_file_data_to_connection (const char *binding, const char *filename);
58
59         void evma_close_connection (const char *binding, int after_writing);
60         int evma_report_connection_error_status (const char *binding);
61         void evma_signal_loopbreak();
62         void evma_set_timer_quantum (int);
63         void evma_set_max_timer_count (int);
64         void evma_setuid_string (const char *username);
65         void evma_stop_machine();
66
67         const char *evma__write_file (const char *filename);
68         const char *evma_popen (char * const*cmd_strings);
69
70         int evma_set_rlimit_nofile (int n_files);
71
72         // Temporary:
73         void evma__epoll();
74         void evma__kqueue();
75
76 #if __cplusplus
77 }
78 #endif
79
80
81 #endif // __EventMachine__H_
82
Note: See TracBrowser for help on using the browser.