@@ -60,17 +60,14 @@ class SocketStats {
6060public:
6161
6262#if !defined(DOXYGEN_ONLY)
63- /* * Create an socket statictics object
63+ /* * Create a socket statistics object
6464 *
6565 * Application users must not create class objects.
6666 * Entities reporting network statistics create the class object.
6767 * Application can fetch network statistics using static `mbed_stats_socket_get_each` API
6868 * without creating an object.
6969 */
70- SocketStats ();
71- virtual ~SocketStats ()
72- {
73- }
70+ constexpr SocketStats () = default;
7471#endif
7572 /* *
7673 * Fill the passed array of structures with the socket statistics for each created socket.
@@ -96,7 +93,7 @@ class SocketStats {
9693 * the socket creation count exceeds `MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT`.
9794 *
9895 */
99- void stats_new_socket_entry (const Socket *const reference_id);
96+ void stats_new_socket_entry (Socket *reference_id);
10097
10198 /* * Updates the state of the socket and records `tick_last_change`.
10299 * API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -105,7 +102,7 @@ class SocketStats {
105102 * @param state Parameter to update the current state of the socket.
106103 *
107104 */
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);
109106
110107 /* * Update the peer information of the socket.
111108 * API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -114,7 +111,7 @@ class SocketStats {
114111 * @param peer Parameter to update destination peer information.
115112 *
116113 */
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);
118115
119116 /* * Update socket protocol.
120117 * API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -123,7 +120,7 @@ class SocketStats {
123120 * @param proto Parameter to update the protocol type of socket.
124121 *
125122 */
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);
127124
128125 /* * Update bytes sent on socket, which is cumulative count per socket.
129126 * API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -132,7 +129,7 @@ class SocketStats {
132129 * @param sent_bytes Parameter to append bytes sent over the socket.
133130 *
134131 */
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);
136133
137134 /* * Update bytes received on socket, which is cumulative count per socket
138135 * API used by socket (TCP or UDP) layers only, not to be used by application.
@@ -141,7 +138,7 @@ class SocketStats {
141138 * @param recv_bytes Parameter to append bytes the socket receives.
142139 *
143140 */
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);
145142
146143#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
147144private:
@@ -154,9 +151,40 @@ class SocketStats {
154151 * @param reference_id ID to identify the socket in the data array.
155152 *
156153 */
157- int get_entry_position (const Socket *const reference_id);
154+ int get_entry_position (const Socket *reference_id);
158155#endif
159156#endif
160157};
161158
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+
162190#endif
0 commit comments