예제 #1
0
파일: client.cpp 프로젝트: aclamk/ruros
int main(int argc, char** argv)
{
	publishService(&serv2_server_side);
	int fd;
	fd=connect_server("./socket");
	UnixIO* io=new UnixIO(fd);
	ConnectionRef conn;
	conn=newConnection(io);
	if(conn.get()==NULL) return -1;
	bool b;
	b=requestService(conn, &serv1_client_side);
	if(!b) return -2;

	Register();
	sleep(1);
	int i;
	int iloc=1;
	int irpc=1;
	for(i=0;i<10000;i++)
	{
		Add(irpc,3,irpc);
		iloc=iloc*3;
		if(irpc!=iloc)
			return -3;
	}
    return 0;
}
예제 #2
0
파일: client.cpp 프로젝트: aclamk/ruros
int main(int argc, char** argv)
{
	int fd;
	fd=connect_server("./socket");
	UnixIO* io=new UnixIO(fd);
	ConnectionRef conn;
	conn=newConnection(io);
	if(conn.get()==NULL) return -1;
	bool b;
	b=requestService(conn, &serv1_client_side);
	if(!b) return -2;
	b=requestService(conn, &serv2_client_side);
	if(!b) return -3;

	int i;
	int iloc=0;
	int irpc=0;
	for(i=0;i<1000;i++)
	{
		Add(irpc,3,irpc);
		Mult(irpc,5,irpc);
		iloc=iloc+3;
		iloc=iloc*5;
		if(irpc!=iloc)
			return -4;
	}
    return 0;
}
예제 #3
0
TLSSocket::TLSSocket(ConnectionRef sock){
    this->sock=sock;

    SOCKET sockfd= ((Socket *)(sock.get()))->getSocket();

    /*sslClient=new yaSSL::Client();
    //sslClient->SetCA("E:\\bombus-ng\\certs\\class3.crt");
    sslClient->SetCA("E:\\bombus-ng\\certs\\root.der");
    int result=sslClient->Connect(sockfd);*/

    SSLeay_add_ssl_algorithms();
    SSL_load_error_strings();

    SSL_METHOD* method=TLSv1_client_method();
    SSL_CTX* ctx=SSL_CTX_new(method);
    this->ctx=ctx;

    SSL* ssl=SSL_new(ctx);
    this->ssl=ssl;

    int crt_result=SSL_CTX_use_certificate_file(ctx, "E:\\bombus-ng\\certs\\class3.crt", SSL_FILETYPE_PEM);

    SSL_set_fd(ssl, sockfd);

    int result=SSL_connect(ssl);

    int err=SSL_get_error(ssl, 0);
    int err2=SSL_get_error(ssl, err);

    //printf ("SSL connection using %s\n", SSL_get_cipher (ssl));



    X509* server_cert=  SSL_get_peer_certificate (ssl);
    char * str = X509_NAME_oneline (X509_get_subject_name (server_cert),0,0);

    //printf ("Server certificate:\n");
    //printf ("\t subject: %s\n", str);

    OPENSSL_free (str);

    str = X509_NAME_oneline (X509_get_issuer_name  (server_cert),0,0);

    //printf ("\t issuer: %s\n", str);
    OPENSSL_free (str);

    // We could do all sorts of certificate verification stuff here before
    //deallocating the certificate.

    X509_free (server_cert);

}