ap

Dependencies:   DnsQuery

Dependents:   WizFi310_TCP_Echo_Server_Example

Fork of NetworkSocketAPI by NetworkSocketAPI

Files at this revision

API Documentation at this revision

Comitter:
maru536
Date:
Sun Oct 01 20:55:24 2017 +0000
Parent:
125:ea3a618e0818
Commit message:
merge1

Changed in this revision

NetworkStack.h Show annotated file Show diff for this revision Revisions of this file
TCPSocket.cpp Show annotated file Show diff for this revision Revisions of this file
TCPSocket.h Show annotated file Show diff for this revision Revisions of this file
diff -r ea3a618e0818 -r 636a06d0aa42 NetworkStack.h
--- a/NetworkStack.h	Wed May 25 02:45:51 2016 +0000
+++ b/NetworkStack.h	Sun Oct 01 20:55:24 2017 +0000
@@ -203,6 +203,7 @@
      *  @return         0 on success, negative error code on failure
      */
     virtual int socket_connect(void *handle, const SocketAddress &address) = 0;
+    virtual int socket_connectSSL(void *handle, const SocketAddress &address) = 0;
 
     /** Accepts a connection on a TCP socket
      *
diff -r ea3a618e0818 -r 636a06d0aa42 TCPSocket.cpp
--- a/TCPSocket.cpp	Wed May 25 02:45:51 2016 +0000
+++ b/TCPSocket.cpp	Sun Oct 01 20:55:24 2017 +0000
@@ -50,6 +50,25 @@
     return connect(addr);
 }
 
+int TCPSocket::connectSSL(const char *host, uint16_t port)
+{
+    SocketAddress addr(_iface, host, port);
+    if (!addr) {
+        return NSAPI_ERROR_DNS_FAILURE;
+    }
+
+    return connectSSL(addr);
+}
+
+int TCPSocket::connectSSL(const SocketAddress &addr)
+{
+    if (!_socket) {
+        return NSAPI_ERROR_NO_SOCKET;
+    }
+
+    return _iface->socket_connectSSL(_socket, addr);
+}
+
 int TCPSocket::send(const void *data, unsigned size)
 {
     mbed::Timer timer;
diff -r ea3a618e0818 -r 636a06d0aa42 TCPSocket.h
--- a/TCPSocket.h	Wed May 25 02:45:51 2016 +0000
+++ b/TCPSocket.h	Sun Oct 01 20:55:24 2017 +0000
@@ -83,6 +83,10 @@
      *  @return         Number of sent bytes on success, negative error
      *                  code on failure
      */
+     
+    int connectSSL(const SocketAddress &addr);
+    int connectSSL(const char *host, uint16_t port);
+    
     int send(const void *data, unsigned size);
     
     /** Receive data over a TCP socket