Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
SocketStats Class Reference
SocketStats class. More...
#include <SocketStats.h>
Public Member Functions | |
| SocketStats () | |
| Create an socket statictics object. | |
| void | stats_new_socket_entry (const Socket *const reference_id) |
| Add entry of newly created socket in statistics array. | |
| void | stats_update_socket_state (const Socket *const reference_id, socket_state state) |
| Updates the state of the socket and records `tick_last_change`. | |
| void | stats_update_peer (const Socket *const reference_id, const SocketAddress &peer) |
| Update the peer information of the socket. | |
| void | stats_update_proto (const Socket *const reference_id, nsapi_protocol_t proto) |
| Update socket protocol. | |
| void | stats_update_sent_bytes (const Socket *const reference_id, size_t sent_bytes) |
| Update bytes sent on socket, which is cumulative count per socket. | |
| void | stats_update_recv_bytes (const Socket *const reference_id, size_t recv_bytes) |
| Update bytes received on socket, which is cumulative count per socket API used by socket (TCP or UDP) layers only, not to be used by application. | |
Static Public Member Functions | |
| static size_t | mbed_stats_socket_get_each (mbed_stats_socket_t *stats, size_t count) |
| Fill the passed array of structures with the socket statistics for each created socket. | |
Detailed Description
SocketStats class.
Class to get the network socket statistics
Definition at line 59 of file SocketStats.h.
Constructor & Destructor Documentation
| SocketStats | ( | ) |
Create an socket statictics object.
Application users must not create class objects. Entities reporting network statistics create the class object. Application can fetch network statistics using static `mbed_stats_socket_get_each` API without creating an object.
Definition at line 61 of file SocketStats.cpp.
Member Function Documentation
| size_t mbed_stats_socket_get_each | ( | mbed_stats_socket_t * | stats, |
| size_t | count | ||
| ) | [static] |
Fill the passed array of structures with the socket statistics for each created socket.
- Parameters:
-
stats A pointer to an array of mbed_stats_socket_t structures to fill count The number of mbed_stats_socket_t structures in the provided array
- Returns:
- The number of mbed_stats_socket_t structures that have been filled. If the number of sockets on the system is less than or equal to count, it will equal the number of sockets created (active or closed). If the number of sockets on the system is greater than count, it will equal count.
Definition at line 43 of file SocketStats.cpp.
| void stats_new_socket_entry | ( | const Socket *const | reference_id ) |
Add entry of newly created socket in statistics array.
API used by socket (TCP or UDP) layers only, not to be used by application.
- Parameters:
-
reference_id ID to identify socket in data array.
: The entry in the array is maintained even after the socket is closed. The entry is overwritten for sockets that were closed first, in case the socket creation count exceeds `MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT`.
Definition at line 65 of file SocketStats.cpp.
| void stats_update_peer | ( | const Socket *const | reference_id, |
| const SocketAddress & | peer | ||
| ) |
Update the peer information of the socket.
API used by socket (TCP or UDP) layers only, not to be used by application.
- Parameters:
-
reference_id ID to identify socket in data array. peer Parameter to update destination peer information.
Definition at line 114 of file SocketStats.cpp.
| void stats_update_proto | ( | const Socket *const | reference_id, |
| nsapi_protocol_t | proto | ||
| ) |
Update socket protocol.
API used by socket (TCP or UDP) layers only, not to be used by application.
- Parameters:
-
reference_id ID to identify socket in data array. proto Parameter to update the protocol type of socket.
Definition at line 126 of file SocketStats.cpp.
| void stats_update_recv_bytes | ( | const Socket *const | reference_id, |
| size_t | recv_bytes | ||
| ) |
Update bytes received on socket, which is cumulative count per socket API used by socket (TCP or UDP) layers only, not to be used by application.
- Parameters:
-
reference_id ID to identify socket in data array. recv_bytes Parameter to append bytes the socket receives.
Definition at line 150 of file SocketStats.cpp.
| void stats_update_sent_bytes | ( | const Socket *const | reference_id, |
| size_t | sent_bytes | ||
| ) |
Update bytes sent on socket, which is cumulative count per socket.
API used by socket (TCP or UDP) layers only, not to be used by application.
- Parameters:
-
reference_id ID to identify socket in data array. sent_bytes Parameter to append bytes sent over the socket.
Definition at line 138 of file SocketStats.cpp.
| void stats_update_socket_state | ( | const Socket *const | reference_id, |
| socket_state | state | ||
| ) |
Updates the state of the socket and records `tick_last_change`.
API used by socket (TCP or UDP) layers only, not to be used by application.
- Parameters:
-
reference_id ID to identify socket in data array. state Parameter to update the current state of the socket.
Definition at line 99 of file SocketStats.cpp.
Generated on Tue Jul 12 2022 13:55:36 by
1.7.2