[en] Create a secure client that can connect to a specific Internet IP address and port.
[ja] 特定のインターネットIPアドレスとポートに接続可能なセキュアーなクライアントを作成します。
More...
#include <LTETLSClient.h>
Public Member Functions | |
LTETLSClient () | |
Construct LTETLSClient instance. | |
~LTETLSClient () | |
Destruct LTETLSClient instance. | |
int | connect (IPAddress ip, uint16_t port) |
Connects to a specified IP address and port. More... | |
int | connect (const char *host, uint16_t port) |
Connects to a specified host name and port. More... | |
size_t | write (uint8_t val) |
Send one byte data to the server the client is connected to. More... | |
size_t | write (const uint8_t *buf, size_t size) |
Send series of bytes data to the server the client is connected to. More... | |
int | available () |
Returns the number of bytes available for reading. More... | |
int | read () |
Read the next byte received from the server the client is connected to. More... | |
int | read (uint8_t *buf, size_t size) |
Read series of bytes received from the server the client is connected to. More... | |
int | peek () |
Returns the next byte received from the server without removing it from the buffer. More... | |
void | flush () |
Discards any bytes that have been written to the client. More... | |
void | stop () |
Disconnect from the server. More... | |
uint8_t | connected () |
Whether or not the client is connected. More... | |
operator bool () | |
Assignment operator for bool. More... | |
void | setCACert (const char *rootCA) |
Set the root certificate authority certificate on the client. More... | |
void | setCACert (const unsigned char *rootCA, size_t size) |
Set the root certificate authority certificate on the client. More... | |
void | setCACert (File &f, size_t size) |
Read the root certificate authority certificate from the file and set it on the client. More... | |
void | setCACert (Stream &stream, size_t size) |
Read the root certificate authority certificate from the file or other stream and set it on the client. More... | |
void | setCertificate (const char *clientCA) |
Set the certificate on the client. More... | |
void | setCertificate (const unsigned char *clientCA, size_t size) |
Set the certificate on the client. More... | |
void | setCertificate (File &f, size_t size) |
Read the certificate from the file and set it on the client. More... | |
void | setCertificate (Stream &stream, size_t size) |
Read the certificate from the file or other stream and set it on the client. More... | |
void | setPrivateKey (const char *privateKey) |
Set the private key on the client. More... | |
void | setPrivateKey (const unsigned char *privateKey, size_t size) |
Set the private key on the client. More... | |
void | setPrivateKey (File &f, size_t size) |
Read the private key from the file and set it on the client. More... | |
void | setPrivateKey (Stream &stream, size_t size) |
Read the private key from the file or other stream and set it on the client. More... | |
int | setTimeout (uint32_t milliseconds) |
Set the timeout when the client receive (including TLS handshake). More... | |
int | setSendTimeout (uint32_t milliseconds) |
Set the timeout when the client send. More... | |
[en] Create a secure client that can connect to a specific Internet IP address and port.
[ja] 特定のインターネットIPアドレスとポートに接続可能なセキュアーなクライアントを作成します。
int LTETLSClient::connect | ( | IPAddress | ip, |
uint16_t | port | ||
) |
Connects to a specified IP address and port.
[en] Connects to a specified IP address and port.
[ja] 指定されたIPアドレスとポートに接続します。
[in] | ip | [en] Server IP address. [ja] 接続先サーバーのIPアドレス。 |
[in] | port | [en] Server port. [ja] 接続先サーバーのポート番号。 |
int LTETLSClient::connect | ( | const char * | host, |
uint16_t | port | ||
) |
Connects to a specified host name and port.
[en] Connects to a specified host and port.
[ja] 指定されたホスト名とポートに接続します。
[in] | host | [en] Server host name. [ja] 接続先サーバーのホスト名。 |
[in] | port | [en] Server port. [ja] 接続先サーバーのポート番号。 |
size_t LTETLSClient::write | ( | uint8_t | val | ) |
Send one byte data to the server the client is connected to.
[en] Send one byte data to the server the client is connected to.
[ja] 接続先のサーバーに1バイトのデータを送信します。
[in] | val | [en] A value to send as a single byte. [ja] 送信する値。 |
size_t LTETLSClient::write | ( | const uint8_t * | buf, |
size_t | size | ||
) |
Send series of bytes data to the server the client is connected to.
[en] Send series of bytes data to the server the client is connected to.
[ja] 接続先のサーバーに一連のデータを送信します。
[in] | buf | [en] A buffer to send. [ja] 送信バッファー。 |
[in] | size | [en] The length of the buffer. [ja] 送信バッファーの長さ。 |
int LTETLSClient::available | ( | ) |
Returns the number of bytes available for reading.
[en] Returns the number of bytes available for reading.
[ja] 読み出し可能なバイト数を返します。
int LTETLSClient::read | ( | ) |
Read the next byte received from the server the client is connected to.
[en] Read the next byte received from the server the client is connected to.
[ja] 接続先のサーバーから受信したデータを読み出します。
int LTETLSClient::read | ( | uint8_t * | buf, |
size_t | size | ||
) |
Read series of bytes received from the server the client is connected to.
[en] Read series of bytes received from the server the client is connected to.
[ja] 接続先のサーバーから受信した一連のデータを読み出します。
[out] | buf | [en] A buffer to read. [ja] 受信バッファー。 |
[in] | size | [en] The length of the buffer. [ja] 受信バッファーの長さ。 |
int LTETLSClient::peek | ( | ) |
Returns the next byte received from the server without removing it from the buffer.
[en] Returns the next byte received from the server without removing it from the buffer.
[ja] 接続先のサーバーから受信したデータを、バッファーから削除せずに読み出します。
void LTETLSClient::flush | ( | ) |
Discards any bytes that have been written to the client.
[en] Discards any bytes that have been written to the client.
[ja] クライアントに書き込まれたデータを破棄します。
void LTETLSClient::stop | ( | ) |
Disconnect from the server.
[en] Disconnect from the server.
[ja] サーバーから切断します。
uint8_t LTETLSClient::connected | ( | ) |
Whether or not the client is connected.
[en] Whether or not the client is connected. Note that a client is considered connected if the connection has been closed but there is still unread data.
[ja] クライアントが接続されているかどうかを返します。接続は閉じられているが未読データが残っている場合、クライアントは接続されていると見なされることに注意してください。
|
inline |
Assignment operator for bool.
[en] Whether or not the client is connected.
[ja] クライアントが接続されているかどうかを返します。
void LTETLSClient::setCACert | ( | const char * | rootCA | ) |
Set the root certificate authority certificate on the client.
[en] Set the root certificate authority certificate in PEM format on the client. Please call this method before connecting to the server by connect() method.
[ja] PEM形式のルート認証局の証明書をクライアントに設定します。connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | rootCA | [en] An array to set the root CA certificate as a series of characters. [ja] ルート認証局の証明書の文字列。 |
void LTETLSClient::setCACert | ( | const unsigned char * | rootCA, |
size_t | size | ||
) |
Set the root certificate authority certificate on the client.
[en] Set the root certificate authority certificate in DER format on the client. Please call this method before connecting to the server by connect() method.
[ja] DER形式のルート認証局の証明書をクライアントに設定します。connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | rootCA | [en] An array to set the root CA certificate as a series of bytes. [ja] ルート認証局の証明書のバイト配列。 |
[in] | size | [en] Size of root certificate authority certificate. [ja] ルート認証局の証明書のサイズ。 |
void LTETLSClient::setCACert | ( | File & | f, |
size_t | size | ||
) |
Read the root certificate authority certificate from the file and set it on the client.
[en] Read the root certificate authority certificate from the file and set it on the client. Both DER and PEM formats can be set. Please call this method before connecting to the server by connect() method.
[ja] ルート認証局の証明書をファイルから読み出してクライアントに設定します。DER形式とPEM形式のどちらも設定可能です。connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | f | [en] File to set the root CA certificate. [ja] ルート認証局の証明書のファイルオブジェクト。 |
[in] | size | [en] Readable size. [ja] 読み出し可能なサイズ。 |
void LTETLSClient::setCACert | ( | Stream & | stream, |
size_t | size | ||
) |
Read the root certificate authority certificate from the file or other stream and set it on the client.
[en] Read the root certificate authority certificate from the file or other stream and set it on the client. Both DER and PEM formats can be set. Please call this method before connecting to the server by connect() method.
[ja] ルート認証局の証明書をファイルなどのストリームから読み出してクライアントに設定します。DER形式とPEM形式のどちらも設定可能です。connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | stream | [en] Stream to set the root CA certificate. [ja] ルート認証局の証明書のストリーム。 |
[in] | size | [en] Readable size. [ja] 読み出し可能なサイズ。 |
void LTETLSClient::setCertificate | ( | const char * | clientCA | ) |
Set the certificate on the client.
[en] Set the certificate in PEM format on the client. Please call this method before connecting to the server by connect() method if you need.
[ja] PEM形式のクライアント証明書をクライアントに設定します。必要であれば、connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | clientCA | [en] An array to set the certificate as a series of characters. [ja] クライアント証明書の文字列。 |
void LTETLSClient::setCertificate | ( | const unsigned char * | clientCA, |
size_t | size | ||
) |
Set the certificate on the client.
[en] Set the certificate in DER format on the client. Please call this method before connecting to the server by connect() method if you need.
[ja] DER形式のクライアント証明書をクライアントに設定します。必要であれば、connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | clientCA | [en] An array to set the certificate as a series of bytes. [ja] クライアント証明書のバイト配列。 |
[in] | size | [en] Size of certificate. [ja] クライアント証明書のサイズ。 |
void LTETLSClient::setCertificate | ( | File & | f, |
size_t | size | ||
) |
Read the certificate from the file and set it on the client.
[en] Read the certificate from the file and set it on the client. Both DER and PEM formats can be set. Please call this method before connecting to the server by connect() method if you need.
[ja] クライアント証明書をファイルから読み出してクライアントに設定します。DER形式とPEM形式のどちらも設定可能です。必要であれば、connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | f | [en] File to set the certificate. [ja] クライアント証明書のファイルオブジェクト。 |
[in] | size | [en] Readable size. [ja] 読み出し可能なサイズ。 |
void LTETLSClient::setCertificate | ( | Stream & | stream, |
size_t | size | ||
) |
Read the certificate from the file or other stream and set it on the client.
[en] Read the certificate from the file or other stream and set it on the client. Both DER and PEM formats can be set. Please call this method before connecting to the server by connect() method if you need.
[ja] クライアント証明書をファイルなどのストリームから読み出してクライアントに設定します。DER形式とPEM形式のどちらも設定可能です。必要であれば、connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | stream | [en] Stream to set the certificate. [ja] クライアント証明書のストリーム。 |
[in] | size | [en] Readable size. [ja] 読み出し可能なサイズ。 |
void LTETLSClient::setPrivateKey | ( | const char * | privateKey | ) |
Set the private key on the client.
[en] Set the private key in PEM format on the client. Please call this method before connecting to the server by connect() method if you need.
[ja] PEM形式の秘密鍵をクライアントに設定します。必要であれば、connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | privateKey | [en] An array to set the private key as a series of characters. [ja] 秘密鍵の文字列。 |
void LTETLSClient::setPrivateKey | ( | const unsigned char * | privateKey, |
size_t | size | ||
) |
Set the private key on the client.
[en] Set the private key in DER format on the client. Please call this method before connecting to the server by connect() method if you need.
[ja] DER形式の秘密鍵をクライアントに設定します。必要であれば、connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | privateKey | [en] An array to set the private key as a series of bytes. [ja] 秘密鍵のバイト配列。 |
[in] | size | [en] Size of private key. [ja] 秘密鍵のサイズ。 |
void LTETLSClient::setPrivateKey | ( | File & | f, |
size_t | size | ||
) |
Read the private key from the file and set it on the client.
[en] Read the private key from the file and set it on the client. Both DER and PEM formats can be set. Please call this method before connecting to the server by connect() method if you need.
[ja] 秘密鍵をファイルから読み出してクライアントに設定します。DER形式とPEM形式のどちらも設定可能です。必要であれば、connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | f | [en] File to set the private key. [ja] 秘密鍵のファイルオブジェクト。 |
[in] | size | [en] Readable size. [ja] 読み出し可能なサイズ。 |
void LTETLSClient::setPrivateKey | ( | Stream & | stream, |
size_t | size | ||
) |
Read the private key from the file or other stream and set it on the client.
[en] Read the private key from the file or other stream and set it on the client. Both DER and PEM formats can be set. Please call this method before connecting to the server by connect() method if you need.
[ja] 秘密鍵をファイルなどのストリームから読み出してクライアントに設定します。DER形式とPEM形式のどちらも設定可能です。必要であれば、connect()のメソッドでサーバーに接続する前に本メソッドを呼び出してください。
[in] | stream | [en] Stream to set the private key. [ja] 秘密鍵のストリーム。 |
[in] | size | [en] Readable size. [ja] 読み出し可能なサイズ。 |
int LTETLSClient::setTimeout | ( | uint32_t | milliseconds | ) |
Set the timeout when the client receive (including TLS handshake).
[en] Set the timeout when the client receive (including TLS handshake). 0 means disabled (no timeout). If this method has not been called, the timeout is 10 seconds.
[ja] クライアントが受信をする際のタイムアウトを設定します(TLSハンドシェイクを含みます)。0は無効(タイムアウトしない)を意味します。本メソッドを呼び出さない場合のタイムアウトは10秒です。
int LTETLSClient::setSendTimeout | ( | uint32_t | milliseconds | ) |
Set the timeout when the client send.
[en] Set the timeout when the client send. 0 means disabled (no timeout). If this method has not been called, the timeout is 60 seconds.
[ja] クライアントが送信をする際のタイムアウトを設定します。0は無効(タイムアウトしない)を意味します。本メソッドを呼び出さない場合のタイムアウトは60秒です。