wrapper of the mbed port of Cyassl. It's based of the work of Ashley Mills
Dependents: TLS_cyassl-Example TLS_cyassl-Example2 HTTPSClientExample2
Fork of TLS_cyassl by
Import programTLS_cyassl-Example
This program shows how to use TLS_cyassl to connect to mbed.org
Import programTLS_cyassl-Example2
This example show how to create a small TLS server using the TLS_cyassl library.
TLSConnection.h
- Committer:
- feb11
- Date:
- 2013-09-18
- Revision:
- 6:c12f49c210c2
- Parent:
- 4:86a5029194b4
File content as of revision 6:c12f49c210c2:
#ifndef TLSCONNECTION_H #define TLSCONNECTION_H #include "Socket.h" #include "Endpoint.h" #include "bsd_socket.h" #include "cyassl/ssl.h" class TLSServer; /** This class provides a user-friendly interface for the axTLS library. */ class TLSConnection : public Socket, public Endpoint { friend class TLSServer; public : TLSConnection(); /** This function tries to establish a TLS connection with the given host. It will first try to establish a TCP connection on port 443 with the host. Then, it runs the TLS handshake protocol. \param host A valid hostname (e.g. "mbed.org") \return True if it managed to establish a connection with the host. False otherwise. */ bool connect(const char *host); /** Indicates whether a connection is established or not. \return true if a connection is established, otherwise returns false. */ bool is_connected(void); /** Sends some data to the host. This method does not return until length bytes have been sent. \param data A pointer to some data \param length Number of bytes to send \return Number of bytes sent, or -1 if an error occured. */ int send_all(char *data, int length); /** Receive some data from the host. \param data \param length Maximum number of bytes to receive \return Number of bytes read in range 0..length, or -1 if an error occured. */ int receive(char *data, int length); /** Close the connection. \param shutdown \return True if the connection was closed with success, false otherwise. If no connection was established, returns true immediately. */ bool close(bool shutdown = true); private : bool _is_connected; CYASSL_CTX *_ssl_ctx; CYASSL *_ssl; }; #endif