Changeset 4609

Show
Ignore:
Timestamp:
02/13/07 22:05:40 (1 year ago)
Author:
morris
Message:

Experimental p7 support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wire/branches/p7/wire/client.c

    r4423 r4609  
    141141static wi_socket_context_t                      *wr_socket_context; 
    142142 
     143static wi_p7_spec_t                                     *wr_p7_spec; 
     144 
    143145wi_socket_t                                                     *wr_socket; 
    144146wi_address_t                                            *wr_address; 
     
    161163        wr_socket_context = wi_socket_context_init(wi_socket_context_alloc()); 
    162164         
    163       if(!wi_socket_context_set_ssl_type(wr_socket_context, WI_SOCKET_SSL_CLIENT)) 
    164               wi_log_err(WI_STR("Could not set SSL context: %m")); 
     165//    if(!wi_socket_context_set_ssl_type(wr_socket_context, WI_SOCKET_SSL_CLIENT)) 
     166//            wi_log_err(WI_STR("Could not set SSL context: %m")); 
    165167         
    166168        options = WI_STRING_ENCODING_IGNORE | WI_STRING_ENCODING_TRANSLITERATE; 
     
    175177         
    176178        wr_icon = wi_string_init_with_cstring(wi_string_alloc(), wr_default_icon); 
     179         
     180        wr_p7_spec = wi_p7_spec_init_with_file(wi_p7_spec_alloc(), WI_STR("protocol.xml"), true); 
     181     
     182        if(!wr_p7_spec) 
     183                wr_printf_prefix(WI_STR("Could not load protocol.xml: %m")); 
    177184} 
    178185 
     
    186193        wi_address_t            *address; 
    187194        wi_socket_t                     *socket; 
     195        wi_p7_socket_t          *p7_socket; 
    188196        wi_string_t                     *ip; 
    189197         
     
    222230                        goto next; 
    223231                } 
    224  
    225                 wr_printf_prefix(WI_STR("Connected using %@/%@/%u bits, logging in..."), 
     232                 
     233                p7_socket = wi_p7_socket_init_with_socket(wi_p7_socket_alloc(), socket, wr_p7_spec); 
     234                 
     235                if(!wi_p7_socket_connect(p7_socket, 10.0, WI_P7_COMPRESSION_DEFLATE | WI_P7_ENCRYPTION_RSA_BF, WI_P7_BINARY, WI_STR("guest"), WI_STR(""))) { 
     236                        wr_printf_prefix(WI_STR("Could not connect to %@: %m"), ip); 
     237 
     238                        goto next; 
     239                } 
     240 
     241/*              wr_printf_prefix(WI_STR("Connected using %@/%@/%u bits, logging in..."), 
    226242                        wi_socket_cipher_version(socket), 
    227243                        wi_socket_cipher_name(socket), 
    228                         wi_socket_cipher_bits(socket)); 
     244                        wi_socket_cipher_bits(socket));*/ 
     245                wr_printf_prefix(WI_STR("Connected, logging in...")); 
    229246 
    230247                wr_connected    = true; 
     
    461478        string = wi_string_init_with_format_and_arguments(wi_string_alloc(), fmt, ap); 
    462479        va_end(ap); 
    463          
     480 
    464481        wi_string_convert_encoding(string, wr_client_string_encoding, wr_server_string_encoding); 
    465482