Skip to content

Commit b581299

Browse files
paul-szczepanek-armCruz Monrreal II
authored andcommitted
remove redundancy and maintainance overhead
1 parent e3f0699 commit b581299

File tree

2 files changed

+23
-80
lines changed

2 files changed

+23
-80
lines changed

features/netsocket/InternetSocket.h

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -93,85 +93,27 @@ class InternetSocket : public Socket {
9393
*/
9494
nsapi_error_t bind(const char *address, uint16_t port);
9595

96-
/** Bind the socket to a specific address and port on which to receive
97-
* data. If the IP address is zeroed, only the port is bound.
98-
*
99-
* @param address Local SocketAddress to bind, which includes the address and port.
100-
* @return 0 on success, negative error code on failure (@see nsapi_types.h).
96+
/** @copydoc Socket::bind
10197
*/
10298
virtual nsapi_error_t bind(const SocketAddress &address);
10399

104-
/** Set blocking or nonblocking mode of the socket.
105-
*
106-
* Initially all sockets are in blocking mode. In nonblocking mode,
107-
* blocking operations, such as send/recv/accept, return
108-
* NSAPI_ERROR_WOULD_BLOCK if they cannot continue.
109-
*
110-
* @note set_blocking(false) is equivalent to set_timeout(-1) and
111-
* set_blocking(true) is equivalent to set_timeout(0).
112-
*
113-
* @param blocking Use true for blocking mode, false for nonblocking mode.
100+
/** @copydoc Socket::set_blocking
114101
*/
115102
virtual void set_blocking(bool blocking);
116103

117-
/** Set timeout on blocking socket operations.
118-
*
119-
* Initially all sockets have unbounded timeouts. NSAPI_ERROR_WOULD_BLOCK
120-
* is returned if a blocking operation takes longer than the specified
121-
* timeout. A timeout of 0 removes the timeout from the socket. A negative
122-
* value give the socket an unbounded timeout.
123-
*
124-
* @note set_timeout(0) is equivalent to set_blocking(false) and
125-
* set_timeout(-1) is equivalent to set_blocking(true).
126-
*
127-
* @param timeout Timeout in milliseconds.
104+
/** @copydoc Socket::set_timeout
128105
*/
129106
virtual void set_timeout(int timeout);
130107

131-
/** Pass stack-specific options to the underlying stack using stack-specific
132-
* level and option names, or request generic options using levels from nsapi_socket_level_t.
133-
*
134-
* For unsupported options, NSAPI_ERROR_UNSUPPORTED is returned,
135-
* and the socket is unmodified.
136-
*
137-
* @param level Stack-specific protocol level or nsapi_socket_level_t.
138-
* @param optname Level-specific option name.
139-
* @param optval Option value.
140-
* @param optlen Length of the option value.
141-
* @return 0 on success, negative error code on failure (@see nsapi_types.h).
108+
/** @copydoc Socket::setsockopt
142109
*/
143110
virtual nsapi_error_t setsockopt(int level, int optname, const void *optval, unsigned optlen);
144111

145-
/** Retrieve stack-specific options from the underlying stack using
146-
* stack-specific level and option names, or request generic options
147-
* using levels from nsapi_socket_level_t.
148-
*
149-
* For unsupported options, NSAPI_ERROR_UNSUPPORTED is returned,
150-
* and the socket is unmodified.
151-
*
152-
* @param level Stack-specific protocol level or nsapi_socket_level_t.
153-
* @param optname Level-specific option name.
154-
* @param optval Destination for option value.
155-
* @param optlen Length of the option value.
156-
* @return 0 on success, negative error code on failure (@see nsapi_types.h).
112+
/** @copydoc Socket::getsockopt
157113
*/
158114
virtual nsapi_error_t getsockopt(int level, int optname, void *optval, unsigned *optlen);
159115

160-
/** Register a callback on state change of the socket.
161-
*
162-
* The specified callback is called on state changes, such as when
163-
* the socket can recv/send/accept successfully and when an error
164-
* occurs. The callback may also be called spuriously without a reason.
165-
*
166-
* The callback may be called in an interrupt context and should not
167-
* perform expensive operations, such as recv/send calls.
168-
*
169-
* @note This is not intended as a replacement for a poll or attach-like
170-
* asynchronous API, but rather as a building block for constructing
171-
* such functionality. The exact timing of when the registered function
172-
* is called is not guaranteed and is susceptible to change.
173-
*
174-
* @param func Function to call on state change.
116+
/** @copydoc Socket::sigio
175117
*/
176118
virtual void sigio(mbed::Callback<void()> func);
177119

features/netsocket/Socket.h

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Socket {
3838
* Closes any open connection and deallocates any memory associated
3939
* with the socket. Called from destructor if socket is not closed.
4040
*
41-
* @return 0 on success, negative error code on failure
41+
* @return NSAPI_ERROR_OK on success, negative error code on failure
4242
*/
4343
virtual nsapi_error_t close() = 0;
4444

@@ -54,7 +54,7 @@ class Socket {
5454
* object have to be in the address parameter.
5555
*
5656
* @param address The SocketAddress of the remote peer
57-
* @return 0 on success, negative error code on failure
57+
* @return NSAPI_ERROR_OK on success, negative error code on failure
5858
*/
5959
virtual nsapi_error_t connect(const SocketAddress &address) = 0;
6060

@@ -142,10 +142,11 @@ class Socket {
142142

143143
/** Bind a specific address to a socket.
144144
*
145-
* Binding assigns a local address to a socket.
145+
* Binding a socket specifies the address and port on which to receive
146+
* data. If the IP address is zeroed, only the port is bound.
146147
*
147148
* @param address Local address to bind
148-
* @return 0 on success, negative error code on failure.
149+
* @return NSAPI_ERROR_OK on success, negative error code on failure.
149150
*/
150151
virtual nsapi_error_t bind(const SocketAddress &address) = 0;
151152

@@ -190,7 +191,7 @@ class Socket {
190191
* such functionality. The exact timing of when the registered function
191192
* is called is not guaranteed and susceptible to change.
192193
*
193-
* @param func Function to call on state change
194+
* @param func Function to call on state change.
194195
*/
195196
virtual void sigio(mbed::Callback<void()> func) = 0;
196197

@@ -203,11 +204,11 @@ class Socket {
203204
* For unsupported options, NSAPI_ERROR_UNSUPPORTED is returned
204205
* and the socket is unmodified.
205206
*
206-
* @param level Stack-specific protocol level or nsapi_socket_level_t
207-
* @param optname Level-specific option name
208-
* @param optval Option value
209-
* @param optlen Length of the option value
210-
* @return 0 on success, negative error code on failure
207+
* @param level Stack-specific protocol level or nsapi_socket_level_t.
208+
* @param optname Level-specific option name.
209+
* @param optval Option value.
210+
* @param optlen Length of the option value.
211+
* @return NSAPI_ERROR_OK on success, negative error code on failure.
211212
*/
212213
virtual nsapi_error_t setsockopt(int level, int optname, const void *optval, unsigned optlen) = 0;
213214

@@ -220,11 +221,11 @@ class Socket {
220221
* For unsupported options, NSAPI_ERROR_UNSUPPORTED is returned
221222
* and the socket is unmodified.
222223
*
223-
* @param level Stack-specific protocol level or nsapi_socket_level_t
224-
* @param optname Level-specific option name
225-
* @param optval Destination for option value
226-
* @param optlen Length of the option value
227-
* @return 0 on success, negative error code on failure
224+
* @param level Stack-specific protocol level or nsapi_socket_level_t.
225+
* @param optname Level-specific option name.
226+
* @param optval Destination for option value.
227+
* @param optlen Length of the option value.
228+
* @return NSAPI_ERROR_OK on success, negative error code on failure.
228229
*/
229230
virtual nsapi_error_t getsockopt(int level, int optname, void *optval, unsigned *optlen) = 0;
230231

@@ -250,7 +251,7 @@ class Socket {
250251
*
251252
* @param backlog Number of pending connections that can be queued
252253
* simultaneously, defaults to 1
253-
* @return 0 on success, negative error code on failure
254+
* @return NSAPI_ERROR_OK on success, negative error code on failure
254255
*/
255256
virtual nsapi_error_t listen(int backlog = 1) = 0;
256257
};

0 commit comments

Comments
 (0)