mirror of https://github.com/ARMmbed/mbed-os.git
parent
117eb0bc87
commit
81fc940a8e
|
|
@ -29,13 +29,13 @@
|
||||||
|
|
||||||
/** Enum of socket states
|
/** Enum of socket states
|
||||||
*
|
*
|
||||||
* Can be used to specify current state of socket - Open / Close / Connected / Listen
|
* Can be used to specify current state of socket - open, closed, connected or listen.
|
||||||
*
|
*
|
||||||
* @enum socket_state
|
* @enum socket_state
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SOCK_CLOSED, /**< Socket is closed and does not exist anymore in the system */
|
SOCK_CLOSED, /**< Socket is closed and does not exist anymore in the system */
|
||||||
SOCK_OPEN, /**< Socket is open, but not associated to any peer address */
|
SOCK_OPEN, /**< Socket is open but not associated to any peer address */
|
||||||
SOCK_CONNECTED, /**< Socket is associated to peer address, either by connect() or sendto()/recvfrom() calls */
|
SOCK_CONNECTED, /**< Socket is associated to peer address, either by connect() or sendto()/recvfrom() calls */
|
||||||
SOCK_LISTEN, /**< Socket is listening for incoming connections */
|
SOCK_LISTEN, /**< Socket is listening for incoming connections */
|
||||||
} socket_state;
|
} socket_state;
|
||||||
|
|
@ -63,7 +63,7 @@ public:
|
||||||
/** Create an socket statictics object
|
/** Create an socket statictics object
|
||||||
*
|
*
|
||||||
* Application users must not create class objects.
|
* Application users must not create class objects.
|
||||||
* The class object will be created by entities reporting network statistics.
|
* Entities reporting network statistics create the class object.
|
||||||
* Application can fetch network statistics using static `mbed_stats_socket_get_each` API
|
* Application can fetch network statistics using static `mbed_stats_socket_get_each` API
|
||||||
* without creating an object.
|
* without creating an object.
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,7 +79,7 @@ public:
|
||||||
* @param count The number of mbed_stats_socket_t structures in the provided array
|
* @param count The number of mbed_stats_socket_t structures in the provided array
|
||||||
* @return The number of mbed_stats_socket_t structures that have been filled.
|
* @return 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,
|
* If the number of sockets on the system is less than or equal to count,
|
||||||
* it will equal the number of sockets created (active / closed).
|
* it will equal the number of sockets created (active or closed).
|
||||||
* If the number of sockets on the system is greater than count,
|
* If the number of sockets on the system is greater than count,
|
||||||
* it will equal count.
|
* it will equal count.
|
||||||
*/
|
*/
|
||||||
|
|
@ -87,58 +87,58 @@ public:
|
||||||
|
|
||||||
#if !defined(DOXYGEN_ONLY)
|
#if !defined(DOXYGEN_ONLY)
|
||||||
/** Add entry of newly created socket in statistics array.
|
/** Add entry of newly created socket in statistics array.
|
||||||
* API used by socket (TCP / UDP) layers only, not to be used by application.
|
* API used by socket (TCP or UDP) layers only, not to be used by application.
|
||||||
*
|
*
|
||||||
* @param reference_id Id to identify socket in data array.
|
* @param reference_id ID to identify socket in data array.
|
||||||
*
|
*
|
||||||
* @Note: Entry in the array will be maintained even after socket is closed.
|
* @Note: The entry in the array is maintained even after the socket is closed.
|
||||||
* Entry will be over-written for sockets which were closed first, in case
|
* The entry is overwritten for sockets that were closed first, in case
|
||||||
* we socket creation count exceeds `MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT`.
|
* the socket creation count exceeds `MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT`.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stats_new_socket_entry(const Socket *const reference_id);
|
void stats_new_socket_entry(const Socket *const reference_id);
|
||||||
|
|
||||||
/** Updates the state of socket and along with that records tick_last_change.
|
/** Updates the state of the socket and records `tick_last_change`.
|
||||||
* API used by socket (TCP / UDP) layers only, not to be used by application.
|
* API used by socket (TCP or UDP) layers only, not to be used by application.
|
||||||
*
|
*
|
||||||
* @param reference_id Id to identify socket in data array.
|
* @param reference_id ID to identify socket in data array.
|
||||||
* @param state Parameter to update current state of socket.
|
* @param state Parameter to update the current state of the socket.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stats_update_socket_state(const Socket *const reference_id, socket_state state);
|
void stats_update_socket_state(const Socket *const reference_id, socket_state state);
|
||||||
|
|
||||||
/** Update the peer information of the socket.
|
/** Update the peer information of the socket.
|
||||||
* API used by socket (TCP / UDP) layers only, not to be used by application.
|
* API used by socket (TCP or UDP) layers only, not to be used by application.
|
||||||
*
|
*
|
||||||
* @param reference_id Id to identify socket in data array.
|
* @param reference_id ID to identify socket in data array.
|
||||||
* @param peer Parameter to update destination peer information
|
* @param peer Parameter to update destination peer information.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stats_update_peer(const Socket *const reference_id, const SocketAddress &peer);
|
void stats_update_peer(const Socket *const reference_id, const SocketAddress &peer);
|
||||||
|
|
||||||
/** Update socket protocol.
|
/** Update socket protocol.
|
||||||
* API used by socket (TCP / UDP) layers only, not to be used by application.
|
* API used by socket (TCP or UDP) layers only, not to be used by application.
|
||||||
*
|
*
|
||||||
* @param reference_id Id to identify socket in data array.
|
* @param reference_id ID to identify socket in data array.
|
||||||
* @param proto Parameter to update the protocol type of socket.
|
* @param proto Parameter to update the protocol type of socket.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stats_update_proto(const Socket *const reference_id, nsapi_protocol_t proto);
|
void stats_update_proto(const Socket *const reference_id, nsapi_protocol_t proto);
|
||||||
|
|
||||||
/** Update bytes sent on socket, which is cumulative count per socket.
|
/** Update bytes sent on socket, which is cumulative count per socket.
|
||||||
* API used by socket (TCP / UDP) layers only, not to be used by application.
|
* API used by socket (TCP or UDP) layers only, not to be used by application.
|
||||||
*
|
*
|
||||||
* @param reference_id Id to identify socket in data array.
|
* @param reference_id ID to identify socket in data array.
|
||||||
* @param sent_bytes Parameter to append bytes sent over the socket.
|
* @param sent_bytes Parameter to append bytes sent over the socket.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stats_update_sent_bytes(const Socket *const reference_id, size_t sent_bytes);
|
void stats_update_sent_bytes(const Socket *const reference_id, size_t sent_bytes);
|
||||||
|
|
||||||
/** Update bytes received on socket, which is cumulative count per socket
|
/** Update bytes received on socket, which is cumulative count per socket
|
||||||
* API used by socket (TCP / UDP) layers only, not to be used by application.
|
* API used by socket (TCP or UDP) layers only, not to be used by application.
|
||||||
*
|
*
|
||||||
* @param reference_id Id to identify socket in data array.
|
* @param reference_id ID to identify socket in data array.
|
||||||
* @param recv_bytes Parameter to append bytes received by the socket
|
* @param recv_bytes Parameter to append bytes the socket receives.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stats_update_recv_bytes(const Socket *const reference_id, size_t recv_bytes);
|
void stats_update_recv_bytes(const Socket *const reference_id, size_t recv_bytes);
|
||||||
|
|
@ -149,9 +149,9 @@ private:
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<PlatformMutex> _mutex;
|
||||||
static uint32_t _size;
|
static uint32_t _size;
|
||||||
|
|
||||||
/** Internal function to scan the array and get position of element in the list.
|
/** Internal function to scan the array and get the position of the element in the list.
|
||||||
*
|
*
|
||||||
* @param reference_id Id to identify socket in data array.
|
* @param reference_id ID to identify the socket in the data array.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int get_entry_position(const Socket *const reference_id);
|
int get_entry_position(const Socket *const reference_id);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue