Changeset 503

Show
Ignore:
Timestamp:
08/15/07 09:56:48 (1 year ago)
Author:
blackhedd
Message:

added set_tls_parms and evma_set_tls_parms

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • version_0/ext/cmain.cpp

    r483 r503  
    206206        if (ed) 
    207207                ed->StartTls(); 
     208} 
     209 
     210/****************** 
     211evma_set_tls_parms 
     212******************/ 
     213 
     214extern "C" void evma_set_tls_parms (const char *binding, const char *privatekey_filename, const char *certchain_filename) 
     215{ 
     216        if (!EventMachine) 
     217                throw std::runtime_error ("not initialized"); 
     218        EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding)); 
     219        if (ed) 
     220                ed->SetTlsParms (privatekey_filename, certchain_filename); 
    208221} 
    209222 
  • version_0/ext/eventmachine.h

    r433 r503  
    4444        const char *evma_create_unix_domain_server (const char *filename); 
    4545        const char *evma_open_datagram_socket (const char *server, int port); 
     46        void evma_set_tls_parms (const char *binding, const char *privatekey_filename, const char *certchain_filenane); 
    4647        void evma_start_tls (const char *binding); 
    4748        int evma_get_peername (const char *binding, struct sockaddr*); 
  • version_0/ext/rubymain.cpp

    r483 r503  
    136136{ 
    137137        evma_start_tls (StringValuePtr (signature)); 
     138        return Qnil; 
     139} 
     140 
     141/*************** 
     142t_set_tls_parms 
     143***************/ 
     144 
     145static VALUE t_set_tls_parms (VALUE self, VALUE signature, VALUE privkeyfile, VALUE certchainfile) 
     146{ 
     147        /* set_tls_parms takes a series of positional arguments for specifying such things 
     148         * as private keys and certificate chains. 
     149         * It's expected that the parameter list will grow as we add more supported features. 
     150         * ALL of these parameters are optional, and can be specified as empty or NULL strings. 
     151         */ 
     152        evma_set_tls_parms (StringValuePtr (signature), StringValuePtr (privkeyfile), StringValuePtr (certchainfile) ); 
    138153        return Qnil; 
    139154} 
     
    453468        rb_define_module_function (EmModule, "stop_tcp_server", (VALUE(*)(...))t_stop_server, 1); 
    454469        rb_define_module_function (EmModule, "start_unix_server", (VALUE(*)(...))t_start_unix_server, 1); 
     470        rb_define_module_function (EmModule, "set_tls_parms", (VALUE(*)(...))t_set_tls_parms, 3); 
    455471        rb_define_module_function (EmModule, "start_tls", (VALUE(*)(...))t_start_tls, 1); 
    456472        rb_define_module_function (EmModule, "send_data", (VALUE(*)(...))t_send_data, 3);