Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

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:
statsA pointer to an array of mbed_stats_socket_t structures to fill
countThe 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_idID 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_idID to identify socket in data array.
peerParameter 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_idID to identify socket in data array.
protoParameter 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_idID to identify socket in data array.
recv_bytesParameter 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_idID to identify socket in data array.
sent_bytesParameter 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_idID to identify socket in data array.
stateParameter to update the current state of the socket.

Definition at line 99 of file SocketStats.cpp.