@@ -60,17 +60,14 @@ class SocketStats {
60
60
public:
61
61
62
62
#if !defined(DOXYGEN_ONLY)
63
- /* * Create an socket statictics object
63
+ /* * Create a socket statistics object
64
64
*
65
65
* Application users must not create class objects.
66
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
*/
70
- SocketStats ();
71
- virtual ~SocketStats ()
72
- {
73
- }
70
+ constexpr SocketStats () = default;
74
71
#endif
75
72
/* *
76
73
* Fill the passed array of structures with the socket statistics for each created socket.
@@ -96,7 +93,7 @@ class SocketStats {
96
93
* the socket creation count exceeds `MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT`.
97
94
*
98
95
*/
99
- void stats_new_socket_entry (const Socket *const reference_id);
96
+ void stats_new_socket_entry (Socket *reference_id);
100
97
101
98
/* * Updates the state of the socket and records `tick_last_change`.
102
99
* API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -105,7 +102,7 @@ class SocketStats {
105
102
* @param state Parameter to update the current state of the socket.
106
103
*
107
104
*/
108
- void stats_update_socket_state (const Socket *const reference_id, socket_state state);
105
+ void stats_update_socket_state (const Socket *reference_id, socket_state state);
109
106
110
107
/* * Update the peer information of the socket.
111
108
* API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -114,7 +111,7 @@ class SocketStats {
114
111
* @param peer Parameter to update destination peer information.
115
112
*
116
113
*/
117
- void stats_update_peer (const Socket *const reference_id, const SocketAddress &peer);
114
+ void stats_update_peer (const Socket *reference_id, const SocketAddress &peer);
118
115
119
116
/* * Update socket protocol.
120
117
* API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -123,7 +120,7 @@ class SocketStats {
123
120
* @param proto Parameter to update the protocol type of socket.
124
121
*
125
122
*/
126
- void stats_update_proto (const Socket *const reference_id, nsapi_protocol_t proto);
123
+ void stats_update_proto (const Socket *reference_id, nsapi_protocol_t proto);
127
124
128
125
/* * Update bytes sent on socket, which is cumulative count per socket.
129
126
* API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -132,7 +129,7 @@ class SocketStats {
132
129
* @param sent_bytes Parameter to append bytes sent over the socket.
133
130
*
134
131
*/
135
- void stats_update_sent_bytes (const Socket *const reference_id, size_t sent_bytes);
132
+ void stats_update_sent_bytes (const Socket *reference_id, size_t sent_bytes);
136
133
137
134
/* * Update bytes received on socket, which is cumulative count per socket
138
135
* API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -141,7 +138,7 @@ class SocketStats {
141
138
* @param recv_bytes Parameter to append bytes the socket receives.
142
139
*
143
140
*/
144
- void stats_update_recv_bytes (const Socket *const reference_id, size_t recv_bytes);
141
+ void stats_update_recv_bytes (const Socket *reference_id, size_t recv_bytes);
145
142
146
143
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
147
144
private:
@@ -154,9 +151,40 @@ class SocketStats {
154
151
* @param reference_id ID to identify the socket in the data array.
155
152
*
156
153
*/
157
- int get_entry_position (const Socket *const reference_id);
154
+ int get_entry_position (const Socket *reference_id);
158
155
#endif
159
156
#endif
160
157
};
161
158
159
+ #if !MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
160
+ inline size_t SocketStats::mbed_stats_socket_get_each (mbed_stats_socket_t *, size_t )
161
+ {
162
+ return 0 ;
163
+ }
164
+
165
+ inline void SocketStats::stats_new_socket_entry (Socket *)
166
+ {
167
+ }
168
+
169
+ inline void SocketStats::stats_update_socket_state (const Socket *, socket_state)
170
+ {
171
+ }
172
+
173
+ inline void SocketStats::stats_update_peer (const Socket *, const SocketAddress &)
174
+ {
175
+ }
176
+
177
+ inline void SocketStats::stats_update_proto (const Socket *, nsapi_protocol_t )
178
+ {
179
+ }
180
+
181
+ inline void SocketStats::stats_update_sent_bytes (const Socket *, size_t )
182
+ {
183
+ }
184
+
185
+ inline void SocketStats::stats_update_recv_bytes (const Socket *, size_t )
186
+ {
187
+ }
188
+ #endif // !MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
189
+
162
190
#endif
0 commit comments