29
29
30
30
/* * Enum of socket states
31
31
*
32
- * Can be used to specify current state of socket - Open / Close / Connected / Listen
32
+ * Can be used to specify current state of socket - open, closed, connected or listen.
33
33
*
34
34
* @enum socket_state
35
35
*/
36
36
typedef enum {
37
37
SOCK_CLOSED, /* *< Socket is closed and does not exist anymore in the system */
38
- SOCK_OPEN, /* *< Socket is open, but not associated to any peer address */
38
+ SOCK_OPEN, /* *< Socket is open but not associated to any peer address */
39
39
SOCK_CONNECTED, /* *< Socket is associated to peer address, either by connect() or sendto()/recvfrom() calls */
40
40
SOCK_LISTEN, /* *< Socket is listening for incoming connections */
41
41
} socket_state;
@@ -63,7 +63,7 @@ class SocketStats {
63
63
/* * Create an socket statictics object
64
64
*
65
65
* Application users must not create class objects.
66
- * The class object will be created by entities reporting network statistics .
66
+ * Entities reporting network statistics create the class object .
67
67
* Application can fetch network statistics using static `mbed_stats_socket_get_each` API
68
68
* without creating an object.
69
69
*/
@@ -79,66 +79,66 @@ class SocketStats {
79
79
* @param count The number of mbed_stats_socket_t structures in the provided array
80
80
* @return The number of mbed_stats_socket_t structures that have been filled.
81
81
* If the number of sockets on the system is less than or equal to count,
82
- * it will equal the number of sockets created (active / closed).
82
+ * it will equal the number of sockets created (active or closed).
83
83
* If the number of sockets on the system is greater than count,
84
84
* it will equal count.
85
85
*/
86
86
static size_t mbed_stats_socket_get_each (mbed_stats_socket_t *stats, size_t count);
87
87
88
88
#if !defined(DOXYGEN_ONLY)
89
89
/* * Add entry of newly created socket in statistics array.
90
- * API used by socket (TCP / UDP) layers only, not to be used by application.
90
+ * API used by socket (TCP or UDP) layers only, not to be used by application.
91
91
*
92
- * @param reference_id Id to identify socket in data array.
92
+ * @param reference_id ID to identify socket in data array.
93
93
*
94
- * @Note: Entry in the array will be maintained even after socket is closed.
95
- * Entry will be over-written for sockets which were closed first, in case
96
- * we socket creation count exceeds `MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT`.
94
+ * @Note: The entry in the array is maintained even after the socket is closed.
95
+ * The entry is overwritten for sockets that were closed first, in case
96
+ * the socket creation count exceeds `MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT`.
97
97
*
98
98
*/
99
99
void stats_new_socket_entry (const Socket *const reference_id);
100
100
101
- /* * Updates the state of socket and along with that records tick_last_change.
102
- * API used by socket (TCP / UDP) layers only, not to be used by application.
101
+ /* * Updates the state of the socket and records ` tick_last_change` .
102
+ * API used by socket (TCP or UDP) layers only, not to be used by application.
103
103
*
104
- * @param reference_id Id to identify socket in data array.
105
- * @param state Parameter to update current state of socket.
104
+ * @param reference_id ID to identify socket in data array.
105
+ * @param state Parameter to update the current state of the socket.
106
106
*
107
107
*/
108
108
void stats_update_socket_state (const Socket *const reference_id, socket_state state);
109
109
110
110
/* * Update the peer information of the socket.
111
- * API used by socket (TCP / UDP) layers only, not to be used by application.
111
+ * API used by socket (TCP or UDP) layers only, not to be used by application.
112
112
*
113
- * @param reference_id Id to identify socket in data array.
114
- * @param peer Parameter to update destination peer information
113
+ * @param reference_id ID to identify socket in data array.
114
+ * @param peer Parameter to update destination peer information.
115
115
*
116
116
*/
117
117
void stats_update_peer (const Socket *const reference_id, const SocketAddress &peer);
118
118
119
119
/* * Update socket protocol.
120
- * API used by socket (TCP / UDP) layers only, not to be used by application.
120
+ * API used by socket (TCP or UDP) layers only, not to be used by application.
121
121
*
122
- * @param reference_id Id to identify socket in data array.
122
+ * @param reference_id ID to identify socket in data array.
123
123
* @param proto Parameter to update the protocol type of socket.
124
124
*
125
125
*/
126
126
void stats_update_proto (const Socket *const reference_id, nsapi_protocol_t proto);
127
127
128
128
/* * Update bytes sent on socket, which is cumulative count per socket.
129
- * API used by socket (TCP / UDP) layers only, not to be used by application.
129
+ * API used by socket (TCP or UDP) layers only, not to be used by application.
130
130
*
131
- * @param reference_id Id to identify socket in data array.
131
+ * @param reference_id ID to identify socket in data array.
132
132
* @param sent_bytes Parameter to append bytes sent over the socket.
133
133
*
134
134
*/
135
135
void stats_update_sent_bytes (const Socket *const reference_id, size_t sent_bytes);
136
136
137
137
/* * Update bytes received on socket, which is cumulative count per socket
138
- * API used by socket (TCP / UDP) layers only, not to be used by application.
138
+ * API used by socket (TCP or UDP) layers only, not to be used by application.
139
139
*
140
- * @param reference_id Id to identify socket in data array.
141
- * @param recv_bytes Parameter to append bytes received by the socket
140
+ * @param reference_id ID to identify socket in data array.
141
+ * @param recv_bytes Parameter to append bytes the socket receives.
142
142
*
143
143
*/
144
144
void stats_update_recv_bytes (const Socket *const reference_id, size_t recv_bytes);
@@ -149,9 +149,9 @@ class SocketStats {
149
149
static SingletonPtr<PlatformMutex> _mutex;
150
150
static uint32_t _size;
151
151
152
- /* * Internal function to scan the array and get position of element in the list.
152
+ /* * Internal function to scan the array and get the position of the element in the list.
153
153
*
154
- * @param reference_id Id to identify socket in data array.
154
+ * @param reference_id ID to identify the socket in the data array.
155
155
*
156
156
*/
157
157
int get_entry_position (const Socket *const reference_id);
0 commit comments