Skip to content

Commit 5fa13e4

Browse files
KariHaapalehtoSeppo Takalo
authored andcommitted
Doxygen corrections to DTLSSocket.h, TLSSocket.h, TLSSocketWrapper.h
and DTLSSocketWrapper.h
1 parent 249fa7f commit 5fa13e4

File tree

4 files changed

+85
-52
lines changed

4 files changed

+85
-52
lines changed

features/netsocket/DTLSSocket.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,31 @@
2929
// This class requires Mbed TLS SSL/TLS client code
3030
#if defined(MBEDTLS_SSL_CLI_C) || defined(DOXYGEN_ONLY)
3131

32+
/**
33+
* \brief DTLSSocket implement DTLS stream over the existing Socket transport
34+
*/
35+
3236
class DTLSSocket : public DTLSSocketWrapper {
3337
public:
34-
/** Create an uninitialized DTLS socket
38+
/** Create an uninitialized DTLS socket.
3539
*
3640
* Must call open to initialize the socket on a network stack.
41+
* @param _udp_socket Underlying transport socket.
3742
*/
3843
DTLSSocket() : DTLSSocketWrapper(&_udp_socket) {}
3944

4045
/** Destroy the DTLSSocket and closes the transport.
4146
*/
4247
virtual ~DTLSSocket();
4348

44-
/** Create a socket on a network interface
49+
/** Create a socket on a network interface.
4550
*
4651
* Creates and opens a socket on the network stack of the given
4752
* network interface.
4853
* If hostname is also given, user is not required to call set_hostname() later.
4954
*
50-
* @param stack Network stack as target for socket
51-
* @param hostname Hostname used for certificate verification
55+
* @param stack Network stack as target for socket.
56+
* @param hostname Hostname used for certificate verification.
5257
*/
5358
template <typename S>
5459
DTLSSocket(S *stack, const char *hostname = NULL) : DTLSSocketWrapper(&_udp_socket, hostname)
@@ -57,14 +62,14 @@ class DTLSSocket : public DTLSSocketWrapper {
5762
MBED_ASSERT(ret == NSAPI_ERROR_OK);
5863
}
5964

60-
/** Opens a socket
65+
/** Opens a socket.
6166
*
6267
* Creates a network socket on the network stack of the given
6368
* network interface. Not needed if stack is passed to the
6469
* socket's constructor.
6570
*
66-
* @param stack Network stack as target for socket
67-
* @return 0 on success, negative error code on failure
71+
* @param stack Network stack as target for socket.
72+
* @return 0 on success, negative error code on failure.
6873
*/
6974
virtual nsapi_error_t open(NetworkStack *stack)
7075
{
@@ -79,14 +84,14 @@ class DTLSSocket : public DTLSSocketWrapper {
7984

8085
using DTLSSocketWrapper::connect;
8186

82-
/** Connects TCP socket to a remote host
87+
/** Connects TCP socket to a remote host.
8388
*
8489
* Initiates a connection to a remote server specified by either
8590
* a domain name or an IP address and a port.
8691
*
87-
* @param host Hostname of the remote host
88-
* @param port Port of the remote host
89-
* @return 0 on success, negative error code on failure
92+
* @param host Hostname of the remote host.
93+
* @param port Port of the remote host.
94+
* @return 0 on success, negative error code on failure.
9095
*/
9196
nsapi_error_t connect(const char *host, uint16_t port);
9297

features/netsocket/DTLSSocketWrapper.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @file DTLSSocketWrapper.h DTLSSocketWrapper */
12
/*
23
* Copyright (c) 2018 ARM Limited
34
* SPDX-License-Identifier: Apache-2.0
@@ -14,6 +15,9 @@
1415
* See the License for the specific language governing permissions and
1516
* limitations under the License.
1617
*/
18+
/** @addtogroup netsocket
19+
* @{
20+
*/
1721

1822
#ifndef DTLSSOCKETWRAPPER_H
1923
#define DTLSSOCKETWRAPPER_H
@@ -23,8 +27,17 @@
2327
// This class requires Mbed TLS SSL/TLS client code
2428
#if defined(MBEDTLS_SSL_CLI_C) || defined(DOXYGEN_ONLY)
2529

30+
/**
31+
* \brief DTLSSocketWrapper implement DTLS stream over the existing Socket transport
32+
*/
2633
class DTLSSocketWrapper : public TLSSocketWrapper {
2734
public:
35+
/** Create a DTLSSocketWrapper.
36+
*
37+
* @param transport Underlying transport socket to wrap.
38+
* @param hostname Hostname of the remote host, used for certificate checking.
39+
* @param control Transport control mode. See @ref control_transport.
40+
*/
2841
DTLSSocketWrapper(Socket *transport, const char *hostname = NULL, control_transport control = TRANSPORT_CONNECT_AND_CLOSE);
2942
private:
3043
static void timing_set_delay(void *ctx, uint32_t int_ms, uint32_t fin_ms);
@@ -37,3 +50,4 @@ class DTLSSocketWrapper : public TLSSocketWrapper {
3750

3851
#endif
3952
#endif
53+
/** @} */

features/netsocket/TLSSocket.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,31 @@
3535
#if defined(MBEDTLS_SSL_CLI_C) || defined(DOXYGEN_ONLY)
3636

3737
/**
38-
* \brief TLSSocket a wrapper around TCPSocket for interacting with TLS servers
38+
* \brief TLSSocket a wrapper around TCPSocket for interacting with TLS servers.
3939
*/
4040
class TLSSocket : public TLSSocketWrapper {
4141
public:
42-
/** Create an uninitialized socket
42+
/** Create an uninitialized socket.
4343
*
4444
* Must call open to initialize the socket on a network stack.
45+
* @param tcp_socket Underlying transport socket.
4546
*/
4647
TLSSocket() : TLSSocketWrapper(&tcp_socket) {}
4748

4849
/** Destroy the TLSSocket and closes the transport.
4950
*/
5051
virtual ~TLSSocket();
5152

52-
/** Opens a socket
53+
/** Opens a socket.
5354
*
5455
* Creates a network socket on the network stack of the given
55-
* network interface. Not needed if stack is passed to the
56-
* socket's constructor.
56+
* network interface.
5757
*
5858
* @note TLSSocket cannot be reopened after closing. It should be destructed to
5959
* clear internal TLS memory structures.
6060
*
61-
* @param stack Network stack as target for socket
62-
* @return 0 on success, negative error code on failure
61+
* @param stack Network stack as target for socket.
62+
* @return 0 on success, negative error code on failure.
6363
*/
6464
virtual nsapi_error_t open(NetworkStack *stack)
6565
{
@@ -74,14 +74,14 @@ class TLSSocket : public TLSSocketWrapper {
7474

7575
using TLSSocketWrapper::connect;
7676

77-
/** Connects TCP socket to a remote host
77+
/** Connects TCP socket to a remote host.
7878
*
7979
* Initiates a connection to a remote server specified by either
8080
* a domain name or an IP address and a port.
8181
*
82-
* @param host Hostname of the remote host
83-
* @param port Port of the remote host
84-
* @return 0 on success, negative error code on failure
82+
* @param host Hostname of the remote host.
83+
* @param port Port of the remote host.
84+
* @return 0 on success, negative error code on failure.
8585
*/
8686
nsapi_error_t connect(const char *host, uint16_t port);
8787

features/netsocket/TLSSocketWrapper.h

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,25 @@
3939
*/
4040
class TLSSocketWrapper : public Socket {
4141
public:
42+
/** Transport modes */
4243
enum control_transport {
43-
TRANSPORT_KEEP,
44-
TRANSPORT_CONNECT_AND_CLOSE,
45-
TRANSPORT_CONNECT,
46-
TRANSPORT_CLOSE,
44+
TRANSPORT_KEEP, /**< Doesn't call connect() or close() on transport socket */
45+
TRANSPORT_CONNECT_AND_CLOSE, /**< Does call connect() and close() on transport socket */
46+
TRANSPORT_CONNECT, /**< Does call only connect() on transport socket */
47+
TRANSPORT_CLOSE, /**< Does call close() on transport socket */
4748
};
4849

49-
/* Create a TLSSocketWrapper
50+
/** Create a TLSSocketWrapper.
5051
*
51-
* @param transport Underlying transport socket to wrap
52-
* @param hostname Hostname of the remote host, used for certificate checking
52+
* @param transport Underlying transport socket to wrap.
53+
* @param hostname Hostname of the remote host, used for certificate checking.
54+
* @param control Transport control mode. See @ref control_transport.
5355
*/
5456
TLSSocketWrapper(Socket *transport, const char *hostname = NULL, control_transport control = TRANSPORT_CONNECT_AND_CLOSE);
5557

56-
/** Destroy a socket wrapper
58+
/** Destroy a socket wrapper.
5759
*
58-
* Closes socket wrapper if the socket wrapper is still open
60+
* Closes socket wrapper if the socket wrapper is still open.
5961
*/
6062
virtual ~TLSSocketWrapper();
6163

@@ -64,28 +66,33 @@ class TLSSocketWrapper : public Socket {
6466
* TLSSocket requires hostname that is used to verify the certificate.
6567
* If hostname is not given in constructor, this function must be used before
6668
* starting the TLS handshake.
69+
*
70+
* @param hostname Hostname of the remote host, used for certificate checking.
6771
*/
6872
void set_hostname(const char *hostname);
6973

7074
/** Sets the certification of Root CA.
7175
*
7276
* @param root_ca Root CA Certificate in any mbed-TLS supported format.
7377
* @param len Length of certificate (including terminating 0 for PEM).
78+
* @return 0 on success, negative error code on failure.
7479
*/
7580
nsapi_error_t set_root_ca_cert(const void *root_ca, size_t len);
7681

7782
/** Sets the certification of Root CA.
7883
*
79-
* @param root_ca_pem Root CA Certificate in PEM format
84+
* @param root_ca_pem Root CA Certificate in PEM format.
85+
* @return 0 on success, negative error code on failure.
8086
*/
8187
nsapi_error_t set_root_ca_cert(const char *root_ca_pem);
8288

8389
/** Sets client certificate, and client private key.
8490
*
8591
* @param client_cert client certification in PEM or DER format.
8692
* @param client_cert_len certificate size including the terminating null byte for PEM data.
87-
* @param client_private_key_pem client private key in PEM or DER format
93+
* @param client_private_key_pem client private key in PEM or DER format.
8894
* @param client_private_key_len key size including the terminating null byte for PEM data
95+
* @return 0 on success, negative error code on failure.
8996
*/
9097
nsapi_error_t set_client_cert_key(const void *client_cert, size_t client_cert_len,
9198
const void *client_private_key_pem, size_t client_private_key_len);
@@ -94,6 +101,7 @@ class TLSSocketWrapper : public Socket {
94101
*
95102
* @param client_cert_pem Client certification in PEM format.
96103
* @param client_private_key_pem Client private key in PEM format.
104+
* @return 0 on success, negative error code on failure.
97105
*/
98106
nsapi_error_t set_client_cert_key(const char *client_cert_pem, const char *client_private_key_pem);
99107

@@ -102,20 +110,19 @@ class TLSSocketWrapper : public Socket {
102110
* The socket must be connected to a remote host. Returns the number of
103111
* bytes sent from the buffer.
104112
*
105-
* @param data Buffer of data to send to the host
106-
* @param size Size of the buffer in bytes
107-
* @return Number of sent bytes on success, negative error
108-
* code on failure
113+
* @param data Buffer of data to send to the host.
114+
* @param size Size of the buffer in bytes.
115+
* @return Number of sent bytes on success, negative error code on failure.
109116
*/
110117
virtual nsapi_error_t send(const void *data, nsapi_size_t size);
111118

112-
/** Receive data over a TLS socket
119+
/** Receive data over a TLS socket.
113120
*
114121
* The socket must be connected to a remote host. Returns the number of
115122
* bytes received into the buffer.
116123
*
117-
* @param data Destination buffer for data received from the host
118-
* @param size Size of the buffer in bytes
124+
* @param data Destination buffer for data received from the host.
125+
* @param size Size of the buffer in bytes.
119126
* @return Number of received bytes on success, negative error
120127
* code on failure. If no data is available to be received
121128
* and the peer has performed an orderly shutdown,
@@ -140,48 +147,55 @@ class TLSSocketWrapper : public Socket {
140147
virtual nsapi_error_t getpeername(SocketAddress *address);
141148

142149
#if defined(MBEDTLS_X509_CRT_PARSE_C) || defined(DOXYGEN_ONLY)
143-
/** Get own certificate directly from Mbed TLS
144-
* @return internal Mbed TLS X509 structure
150+
/** Get own certificate directly from Mbed TLS.
151+
*
152+
* @return internal Mbed TLS X509 structure.
145153
*/
146154
mbedtls_x509_crt *get_own_cert();
147155

148-
/** Set own certificate directly to Mbed TLS
156+
/** Set own certificate directly to Mbed TLS.
157+
*
149158
* @param crt Mbed TLS X509 certificate chain.
150-
* @return error code from mbedtls_ssl_conf_own_cert()
159+
* @return error code from mbedtls_ssl_conf_own_cert().
151160
*/
152161
int set_own_cert(mbedtls_x509_crt *crt);
153162

154163
/** Get CA chain structure.
164+
*
155165
* @return Mbed TLS X509 certificate chain.
156166
*/
157167
mbedtls_x509_crt *get_ca_chain();
158168

159-
/** Set CA chain directly to Mbed TLS
169+
/** Set CA chain directly to Mbed TLS.
170+
*
160171
* @param crt Mbed TLS X509 certificate chain.
161172
*/
162173
void set_ca_chain(mbedtls_x509_crt *crt);
163174
#endif
164175

165-
/** Get internal Mbed TLS configuration structure
166-
* @return Mbed TLS SSL config
176+
/** Get internal Mbed TLS configuration structure.
177+
*
178+
* @return Mbed TLS SSL config.
167179
*/
168180
mbedtls_ssl_config *get_ssl_config();
169181

170182
/** Override Mbed TLS configuration.
171-
* @param conf Mbed TLS SSL configuration structure
183+
*
184+
* @param conf Mbed TLS SSL configuration structure.
172185
*/
173186
void set_ssl_config(mbedtls_ssl_config *conf);
174187

175188
/** Get internal Mbed TLS context structure.
176-
* @return SSL context
189+
*
190+
* @return SSL context.
177191
*/
178192
mbedtls_ssl_context *get_ssl_context();
179193

180194
protected:
181-
/** Initiates TLS Handshake
195+
/** Initiates TLS Handshake.
182196
*
183-
* Initiates a TLS handshake to a remote peer
184-
* Underlying transport socket should already be connected
197+
* Initiates a TLS handshake to a remote peer.
198+
* Underlying transport socket should already be connected.
185199
*
186200
* Root CA certification must be set by set_ssl_ca_pem() before
187201
* call this function.

0 commit comments

Comments
 (0)