/*---------------------------------------------------------------------------*/ int HTTPS_ClientSessionOpenHost ( HTTPSClientSession* clientSession, const HTTP_CHAR* host, HTTP_UINT16 port, unsigned blocking, HTTP_INT32 timeoutMsec ) { if (HTTP_ClientSessionOpenHost ( &clientSession->session, host, port, 1, RTP_TIMEOUT_INFINITE ) >= 0) { if (rtp_ssl_init_client(&clientSession->sslSession, clientSession->session.netSock,clientSession->session.clientContext->sslContext) >= 0) // TBD if (rtp_ssl_connect (&clientSession->sslSession,clientSession->session.netSock, clientSession->session.clientContext->sslContext) >= 0) if (rtp_ssl_connect (clientSession->sslSession/* clientSession->session.clientContext->sslContext*/) >= 0) { clientSession->blocking = blocking; rtp_net_setblocking (clientSession->session.netSock, blocking); return (0); } } return (-1); }
/*---------------------------------------------------------------------------*/ int HTTPS_ClientSessionOpenAddr ( HTTPSClientSession* clientSession, RTP_NET_ADDR* addr, unsigned blocking, HTTP_INT32 timeoutMsec ) { if (HTTP_ClientSessionOpenAddr ( &clientSession->session, addr, 1, RTP_TIMEOUT_INFINITE ) >= 0) { if (rtp_ssl_connect (clientSession->sslSession) >= 0) // if (rtp_ssl_connect ( // &clientSession->sslSession, // clientSession->session.netSock, // clientSession->session.clientContext->sslContext // ) >= 0) { clientSession->blocking = blocking; rtp_net_setblocking (clientSession->session.netSock, blocking); return (0); } } return (-1);}
/*---------------------------------------------------------------------------*/ int HTTP_ClientSessionSetBlocking ( HTTPClientSession* clientSession, unsigned blocking ) { return (rtp_net_setblocking(clientSession->netSock, blocking)); }
int RTIP_SOCKETS_Driver::Ioctl( SOCK_SOCKET socket, int cmd, int* data ) { NATIVE_PROFILE_PAL_NETWORK(); int ret = SOCK_SOCKET_ERROR; int blocking = !(*data); int nToRead; switch( cmd ) { case SOCK_FIONBIO: ret = rtp_net_setblocking((RTP_SOCKET) socket, (unsigned int) blocking); break; case SOCK_FIONREAD: ret = rtp_net_getntoread ((RTP_SOCKET) socket, (unsigned long *) &nToRead); *data = nToRead; if (ret != -1) { return nToRead; } break; default: ret = 0; break; } return ret; }
/*---------------------------------------------------------------------------*/ int HTTP_ClientSessionOpenAddr ( HTTPClientSession* clientSession, RTP_NET_ADDR* addr, unsigned blocking, HTTP_INT32 timeoutMsec ) { clientSession->netAddr = *addr; if (rtp_net_socket_stream_dual (&clientSession->netSock, addr->type) >= 0) { /* attempt to put the socket into non-blocking mode */ rtp_net_setblocking (clientSession->netSock, blocking); clientSession->socketOpen = 1; /* bind to any IP address (of the same type as the server) and port */ if (rtp_net_bind_dual (clientSession->netSock, RTP_NET_STREAM, 0 /* addr = ANY */, 0 /* port = ANY*/, clientSession->netAddr.type) >= 0) { int connectResult; connectResult = rtp_net_connect_dual (clientSession->netSock, RTP_NET_STREAM, clientSession->netAddr.ipAddr, clientSession->netAddr.port, clientSession->netAddr.type); if (connectResult == -2 /* EWOULDBLOCK */ || connectResult == 0) { return (0); } } clientSession->socketOpen = 0; rtp_net_closesocket(clientSession->netSock); } return (-1); }