eventmachine 0.4.5 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/RELEASE_NOTES +17 -1
- data/ext/binder.cpp +17 -1
- data/ext/binder.h +1 -1
- data/ext/cmain.cpp +15 -1
- data/ext/ed.cpp +206 -28
- data/ext/ed.h +18 -1
- data/ext/em.cpp +65 -19
- data/ext/em.h +1 -1
- data/ext/eventmachine.h +2 -1
- data/ext/extconf.rb +52 -3
- data/ext/page.cpp +114 -0
- data/ext/page.h +58 -0
- data/ext/project.h +30 -1
- data/ext/rubymain.cpp +89 -2
- data/ext/sigs.cpp +44 -8
- data/ext/sigs.h +5 -1
- data/ext/ssl.cpp +377 -0
- data/ext/ssl.h +92 -0
- data/lib/eventmachine.rb +39 -7
- metadata +6 -2
data/ext/ssl.h
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
|
3
|
+
$Id: ssl.h 2421 2006-04-29 23:48:49Z francis $
|
4
|
+
|
5
|
+
File: ssl.h
|
6
|
+
Date: 30Apr06
|
7
|
+
|
8
|
+
Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
9
|
+
Gmail: garbagecat20
|
10
|
+
|
11
|
+
This program is free software; you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
|
+
the Free Software Foundation; either version 2 of the License, or
|
14
|
+
(at your option) any later version.
|
15
|
+
|
16
|
+
This program is distributed in the hope that it will be useful,
|
17
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
GNU General Public License for more details.
|
20
|
+
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with this program; if not, write to the Free Software
|
23
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24
|
+
|
25
|
+
*****************************************************************************/
|
26
|
+
|
27
|
+
|
28
|
+
#ifndef __SslBox__H_
|
29
|
+
#define __SslBox__H_
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
/******************
|
36
|
+
class SslContext_t
|
37
|
+
******************/
|
38
|
+
|
39
|
+
class SslContext_t
|
40
|
+
{
|
41
|
+
public:
|
42
|
+
SslContext_t (bool is_server);
|
43
|
+
virtual ~SslContext_t();
|
44
|
+
|
45
|
+
private:
|
46
|
+
static bool bLibraryInitialized;
|
47
|
+
|
48
|
+
private:
|
49
|
+
bool bIsServer;
|
50
|
+
SSL_CTX *pCtx;
|
51
|
+
|
52
|
+
EVP_PKEY *PrivateKey;
|
53
|
+
X509 *Certificate;
|
54
|
+
|
55
|
+
friend class SslBox_t;
|
56
|
+
};
|
57
|
+
|
58
|
+
|
59
|
+
/**************
|
60
|
+
class SslBox_t
|
61
|
+
**************/
|
62
|
+
|
63
|
+
class SslBox_t
|
64
|
+
{
|
65
|
+
public:
|
66
|
+
SslBox_t (bool is_server);
|
67
|
+
virtual ~SslBox_t();
|
68
|
+
|
69
|
+
int PutPlaintext (const char*, int);
|
70
|
+
int GetPlaintext (char*, int);
|
71
|
+
|
72
|
+
bool PutCiphertext (const char*, int);
|
73
|
+
bool CanGetCiphertext();
|
74
|
+
int GetCiphertext (char*, int);
|
75
|
+
|
76
|
+
void Shutdown();
|
77
|
+
|
78
|
+
protected:
|
79
|
+
SslContext_t *Context;
|
80
|
+
|
81
|
+
bool bIsServer;
|
82
|
+
SSL *pSSL;
|
83
|
+
BIO *pbioRead;
|
84
|
+
BIO *pbioWrite;
|
85
|
+
|
86
|
+
PageList OutboundQ;
|
87
|
+
};
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
#endif // __SslBox__H_
|
92
|
+
|
data/lib/eventmachine.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: eventmachine.rb
|
1
|
+
# $Id: eventmachine.rb 2431 2006-04-30 22:17:20Z francis $
|
2
2
|
#
|
3
3
|
# Author:: blackhedd (gmail address: garbagecat20).
|
4
4
|
# Date:: 8 Apr 2006
|
@@ -402,10 +402,14 @@ module EventMachine
|
|
402
402
|
#
|
403
403
|
#
|
404
404
|
def EventMachine::start_server server, port, handler=nil
|
405
|
+
klass = if (handler and handler.is_a?(Class))
|
406
|
+
handler
|
407
|
+
else
|
408
|
+
Class.new( Connection ) {handler and include handler}
|
409
|
+
end
|
410
|
+
|
405
411
|
s = start_tcp_server server, port
|
406
|
-
@acceptors[s] =
|
407
|
-
handler and include handler
|
408
|
-
}
|
412
|
+
@acceptors[s] = klass
|
409
413
|
end
|
410
414
|
|
411
415
|
# EventMachine#connect initiates a TCP connection to a remote
|
@@ -463,6 +467,25 @@ module EventMachine
|
|
463
467
|
# }
|
464
468
|
# puts "The event loop has ended"
|
465
469
|
#
|
470
|
+
#
|
471
|
+
# There are times when it's more convenient to define a protocol handler
|
472
|
+
# as a Class rather than a Module. Here's how to do this:
|
473
|
+
#
|
474
|
+
# class MyProtocolHandler < EventMachine::Connection
|
475
|
+
# def initialize *args
|
476
|
+
# super
|
477
|
+
# # whatever else you want to do here
|
478
|
+
# end
|
479
|
+
#
|
480
|
+
# #.......your other class code
|
481
|
+
# end # class MyProtocolHandler
|
482
|
+
#
|
483
|
+
# If you do this, then an instance of your class will be instantiated to handle
|
484
|
+
# every network connection created by your code or accepted by servers that you
|
485
|
+
# create. If you redefine #post_init in your protocol-handler class, your
|
486
|
+
# #post_init method will be called _inside_ the call to #super that you will
|
487
|
+
# make in your #initialize method (if you provide one).
|
488
|
+
#
|
466
489
|
#--
|
467
490
|
# EventMachine::connect initiates a TCP connection to a remote
|
468
491
|
# server and sets up event-handling for the connection.
|
@@ -487,10 +510,14 @@ module EventMachine
|
|
487
510
|
# if at all possible.
|
488
511
|
#
|
489
512
|
def EventMachine::connect server, port, handler=nil
|
513
|
+
|
514
|
+
klass = if (handler and handler.is_a?(Class))
|
515
|
+
handler
|
516
|
+
else
|
517
|
+
Class.new( Connection ) {handler and include handler}
|
518
|
+
end
|
519
|
+
|
490
520
|
s = connect_server server, port
|
491
|
-
klass = Class.new( Connection ) {
|
492
|
-
handler and include handler
|
493
|
-
}
|
494
521
|
c = klass.new s
|
495
522
|
@conns[s] = c
|
496
523
|
block_given? and yield c
|
@@ -736,6 +763,11 @@ class Connection
|
|
736
763
|
end
|
737
764
|
|
738
765
|
|
766
|
+
def start_tls
|
767
|
+
EventMachine::start_tls @signature
|
768
|
+
end
|
769
|
+
|
770
|
+
|
739
771
|
# send_datagram is for sending UDP messages.
|
740
772
|
# This method may be called from any Connection object that refers
|
741
773
|
# to an open datagram socket (see EventMachine#open_datagram_socket).
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: eventmachine
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.5.1
|
7
|
+
date: 2006-05-05 00:00:00 -04:00
|
8
8
|
summary: Ruby/EventMachine socket engine library
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- tests/testem.rb
|
33
33
|
- lib/eventmachine.rb
|
34
34
|
- ext/binder.cpp
|
35
|
+
- ext/page.h
|
35
36
|
- ext/cmain.cpp
|
36
37
|
- ext/sigs.cpp
|
37
38
|
- ext/rubymain.cpp
|
@@ -40,10 +41,13 @@ files:
|
|
40
41
|
- ext/binder.h
|
41
42
|
- ext/em.h
|
42
43
|
- ext/ed.h
|
44
|
+
- ext/ssl.cpp
|
43
45
|
- ext/project.h
|
44
46
|
- ext/eventmachine.h
|
45
47
|
- ext/em.cpp
|
46
48
|
- ext/extconf.rb
|
49
|
+
- ext/page.cpp
|
50
|
+
- ext/ssl.h
|
47
51
|
- README
|
48
52
|
- RELEASE_NOTES
|
49
53
|
- COPYING
|