Skip to content

Commit 8a7d96c

Browse files
doxy cleanup
1 parent ba23fef commit 8a7d96c

File tree

1 file changed

+51
-60
lines changed

1 file changed

+51
-60
lines changed

features/netsocket/UDPSocket.h

Lines changed: 51 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -26,119 +26,106 @@
2626
#include "rtos/EventFlags.h"
2727

2828

29-
/** UDP socket
29+
/** UDP socket implementation.
3030
*/
3131
class UDPSocket : public InternetSocket {
3232
public:
33-
/** Create an uninitialized socket
33+
/** Create an uninitialized socket.
3434
*
35-
* Must call open to initialize the socket on a network stack.
35+
* @note Must call open to initialize the socket on a network stack.
3636
*/
3737
UDPSocket();
3838

39-
/** Create a socket on a network interface
40-
*
41-
* Creates and opens a socket on the network stack of the given
39+
/** Create and open a socket on the network stack of the given
4240
* network interface.
4341
*
44-
* @param stack Network stack as target for socket
42+
* @tparam S Type of the Network stack.
43+
* @param stack Network stack as target for socket.
4544
*/
4645
template <typename S>
4746
UDPSocket(S *stack)
4847
{
4948
open(stack);
5049
}
5150

52-
/** Destroy a socket
51+
/** Destroy a socket.
5352
*
54-
* Closes socket if the socket is still open
53+
* @note Closes socket if the socket is still open.
5554
*/
5655
virtual ~UDPSocket();
5756

58-
/** Send a packet over a UDP socket
59-
*
60-
* Sends data to the specified address specified by either a domain name
61-
* or an IP address and port. Returns the number of bytes sent from the
62-
* buffer.
57+
/** Send data to the specified host and port.
6358
*
6459
* By default, sendto blocks until data is sent. If socket is set to
6560
* non-blocking or times out, NSAPI_ERROR_WOULD_BLOCK is returned
6661
* immediately.
6762
*
68-
* @param host Hostname of the remote host
69-
* @param port Port of the remote host
70-
* @param data Buffer of data to send to the host
71-
* @param size Size of the buffer in bytes
63+
* @param host Domain name of the remote host or a dotted notation IP address.
64+
* @param port Port of the remote host.
65+
* @param data Buffer of data to send to the host.
66+
* @param size Size of the buffer in bytes.
7267
* @return Number of sent bytes on success, negative error
73-
* code on failure
68+
* code on failure.
7469
*/
7570
virtual nsapi_size_or_error_t sendto(const char *host, uint16_t port,
7671
const void *data, nsapi_size_t size);
7772

78-
/** Send a packet over a UDP socket
79-
*
80-
* Sends data to the specified address. Returns the number of bytes
81-
* sent from the buffer.
73+
/** Send data to the specified address.
8274
*
8375
* By default, sendto blocks until data is sent. If socket is set to
8476
* non-blocking or times out, NSAPI_ERROR_WOULD_BLOCK is returned
8577
* immediately.
8678
*
87-
* @param address The SocketAddress of the remote host
88-
* @param data Buffer of data to send to the host
89-
* @param size Size of the buffer in bytes
79+
* @param address The SocketAddress of the remote host.
80+
* @param data Buffer of data to send to the host.
81+
* @param size Size of the buffer in bytes.
9082
* @return Number of sent bytes on success, negative error
91-
* code on failure
83+
* code on failure.
9284
*/
9385
virtual nsapi_size_or_error_t sendto(const SocketAddress &address,
9486
const void *data, nsapi_size_t size);
9587

96-
/** Receive a datagram over a UDP socket
88+
/** Receive a datagram and store the source address in address if it's not NULL.
89+
*
90+
* By default, recvfrom blocks until a datagram is received. If socket is set to
91+
* non-blocking or times out with no datagram, NSAPI_ERROR_WOULD_BLOCK
92+
* is returned.
9793
*
98-
* Receives a datagram and stores the source address in address if address
99-
* is not NULL. Returns the number of bytes written into the buffer. If the
100-
* datagram is larger than the buffer, the excess data is silently discarded.
94+
* @note If the datagram is larger than the buffer, the excess data is silently discarded.
10195
*
102-
* If socket is connected, only packets coming from connected peer address
96+
* @note If socket is connected, only packets coming from connected peer address
10397
* are accepted.
10498
*
10599
* @note recvfrom() is allowed write to address and data buffers even if error occurs.
106100
*
107-
* By default, recvfrom blocks until a datagram is received. If socket is set to
108-
* non-blocking or times out with no datagram, NSAPI_ERROR_WOULD_BLOCK
109-
* is returned.
110-
*
111-
* @param address Destination for the source address or NULL
112-
* @param data Destination buffer for datagram received from the host
113-
* @param size Size of the buffer in bytes
101+
* @param address Destination for the source address or NULL.
102+
* @param data Destination buffer for datagram received from the host.
103+
* @param size Size of the buffer in bytes.
114104
* @return Number of received bytes on success, negative error
115-
* code on failure
105+
* code on failure.
116106
*/
117107
virtual nsapi_size_or_error_t recvfrom(SocketAddress *address,
118108
void *data, nsapi_size_t size);
119109

120-
/** Set remote peer address
121-
*
122-
* Set the remote address for next send() call and filtering
123-
* for incomming packets. To reset the address, zero initialised
110+
/** Set the remote address for next send() call and filtering
111+
* of incoming packets. To reset the address, zero initialised
124112
* SocketAddress must be in the address parameter.
125113
*
126-
* @param address The SocketAddress of the remote host
127-
* @return 0 on success, negative error code on failure
114+
* @param address The SocketAddress of the remote host.
115+
* @return 0 on success, negative error code on failure.
128116
*/
129117
virtual nsapi_error_t connect(const SocketAddress &address);
130118

131-
/** Send a datagram to pre-specified remote.
132-
*
133-
* The socket must be connected to a remote host before send() call.
134-
* Returns the number of bytes sent from the buffer.
119+
/** Send a datagram to connected remote address.
135120
*
136121
* By default, send blocks until all data is sent. If socket is set to
137122
* non-blocking or times out, a partial amount can be written.
138123
* NSAPI_ERROR_WOULD_BLOCK is returned if no data was written.
139124
*
140-
* @param data Buffer of data to send to the host
141-
* @param size Size of the buffer in bytes
125+
* @note The socket must be connected to a remote host before send() call.
126+
*
127+
* @param data Buffer of data to send to the host.
128+
* @param size Size of the buffer in bytes.
142129
* @return Number of sent bytes on success, negative error
143130
* code on failure.
144131
*/
@@ -151,35 +138,39 @@ class UDPSocket : public InternetSocket {
151138
* If socket is connected, only packets coming from connected peer address
152139
* are accepted.
153140
*
154-
* @note recv() is allowed write to data buffer even if error occurs.
155-
*
156141
* By default, recv blocks until some data is received. If socket is set to
157142
* non-blocking or times out, NSAPI_ERROR_WOULD_BLOCK can be returned to
158143
* indicate no data.
159144
*
160-
* @param data Destination buffer for data received from the host
161-
* @param size Size of the buffer in bytes
145+
* @note recv() is allowed write to data buffer even if error occurs.
146+
*
147+
* @param data Pointer to buffer for data received from the host.
148+
* @param size Size of the buffer in bytes.
162149
* @return Number of received bytes on success, negative error
163150
* code on failure.
164151
*/
165152
virtual nsapi_size_or_error_t recv(void *data, nsapi_size_t size);
166153

167-
/** Not implemented for UDP
154+
/** Not implemented for UDP.
168155
*
169-
* @param error unused
156+
* @param error Not used.
170157
* @return NSAPI_ERROR_UNSUPPORTED
171158
*/
172159
virtual Socket *accept(nsapi_error_t *error = NULL);
173160

174-
/** Not implemented for UDP
161+
/** Not implemented for UDP.
175162
*
176-
* @param backlog unused
163+
* @param backlog Not used.
177164
* @return NSAPI_ERROR_UNSUPPORTED
178165
*/
179166
virtual nsapi_error_t listen(int backlog = 1);
180167

168+
#if !defined(DOXYGEN_ONLY)
169+
181170
protected:
182171
virtual nsapi_protocol_t get_proto();
172+
173+
#endif //!defined(DOXYGEN_ONLY)
183174
};
184175

185176

0 commit comments

Comments
 (0)