libwebsockets
Lightweight C library for HTML5 websockets
Connection Latency information

Data Structures

struct  lws_conmon
 
union  lws_conmon.protocol_specific
 
struct  lws_conmon.protocol_specific.http
 

Typedefs

typedef uint32_t lws_conmon_interval_us_t
 
typedef enum lws_conmon_pcol lws_conmon_pcol_t
 
typedef enum lws_conmon_dns_disposition lws_conmon_dns_disposition_t
 

Enumerations

enum  lws_conmon_pcol { LWSCONMON_PCOL_NONE , LWSCONMON_PCOL_HTTP }
 
enum  lws_conmon_dns_disposition { LWSCONMON_DNS_NONE , LWSCONMON_DNS_OK = 1 , LWSCONMON_DNS_SERVER_UNREACHABLE = 2 , LWSCONMON_DNS_NO_RESULT = 3 }
 

Functions

LWS_VISIBLE LWS_EXTERN void lws_conmon_wsi_take (struct lws *wsi, struct lws_conmon *dest)
 
LWS_VISIBLE LWS_EXTERN void lws_conmon_release (struct lws_conmon *conmon)
 

Detailed Description

Connection Latency information

When LWS_WITH_CONMON is enabled at build, collects detailed statistics about the client connection setup latency, available to the connection itself


Data Structure Documentation

◆ lws_conmon

struct lws_conmon

Definition at line 81 of file lws-conmon.h.

+ Collaboration diagram for lws_conmon:
Data Fields
lws_sockaddr46 peer46

The peer we actually connected to, if any. .peer46.sa4.sa_family is either 0 if invalid, or the AF_

union lws_conmon.protocol_specific protocol_specific

possibly-present protocol-specific additional information. This is only valid for the first transaction after connection and does not capture results for persistent or muxed connections like ws messages, mqtt messages, or h2 streams

struct addrinfo * dns_results_copy

NULL, or Allocated copy of dns results, owned by this object and freed when object destroyed. Only set if client flag LCCSCF_CONMON applied

lws_conmon_interval_us_t ciu_dns

0, or if a socket connection, us taken to acquire this DNS response

lws_conmon_interval_us_t ciu_sockconn

0, or if connection-based, the us interval between the socket connect() attempt that succeeded, and the connection setup

lws_conmon_interval_us_t ciu_tls

0 if no tls, or us taken to establish the tls tunnel

lws_conmon_interval_us_t ciu_txn_resp

0, or if the protocol supports transactions, the interval between sending the initial transaction request and starting to receive the response

lws_conmon_pcol_t pcol

indicates which extra protocol_specific info member is valid, if any

lws_conmon_dns_disposition_t dns_disposition

indicates general disposition of DNS request

◆ lws_conmon.protocol_specific

union lws_conmon.protocol_specific

Definition at line 86 of file lws-conmon.h.

+ Collaboration diagram for lws_conmon.protocol_specific:
Data Fields
struct lws_conmon.protocol_specific.http http

◆ lws_conmon.protocol_specific.http

struct lws_conmon.protocol_specific.http

Definition at line 87 of file lws-conmon.h.

+ Collaboration diagram for lws_conmon.protocol_specific.http:
Data Fields
int response

h1 http response code

Typedef Documentation

◆ lws_conmon_interval_us_t

typedef uint32_t lws_conmon_interval_us_t

#include <include/libwebsockets/lws-conmon.h>

Definition at line 35 of file lws-conmon.h.

◆ lws_conmon_pcol_t

◆ lws_conmon_dns_disposition_t

Enumeration Type Documentation

◆ lws_conmon_pcol

#include <include/libwebsockets/lws-conmon.h>

Enumerator
LWSCONMON_PCOL_NONE 
LWSCONMON_PCOL_HTTP 

Definition at line 65 of file lws-conmon.h.

65 {
67 LWSCONMON_PCOL_HTTP, /* .protocol_specific.http is valid */
enum lws_conmon_pcol lws_conmon_pcol_t
@ LWSCONMON_PCOL_HTTP
Definition: lws-conmon.h:67
@ LWSCONMON_PCOL_NONE
Definition: lws-conmon.h:66

◆ lws_conmon_dns_disposition

#include <include/libwebsockets/lws-conmon.h>

Enumerator
LWSCONMON_DNS_NONE 

did not attempt DNS

LWSCONMON_DNS_OK 

DNS lookup did give results

LWSCONMON_DNS_SERVER_UNREACHABLE 

DNS server was not reachable

LWSCONMON_DNS_NO_RESULT 

DNS server replied but nothing usable

Definition at line 70 of file lws-conmon.h.

70 {
enum lws_conmon_dns_disposition lws_conmon_dns_disposition_t
@ LWSCONMON_DNS_SERVER_UNREACHABLE
Definition: lws-conmon.h:75
@ LWSCONMON_DNS_NONE
Definition: lws-conmon.h:71
@ LWSCONMON_DNS_NO_RESULT
Definition: lws-conmon.h:77
@ LWSCONMON_DNS_OK
Definition: lws-conmon.h:73

Function Documentation

◆ lws_conmon_wsi_take()

LWS_VISIBLE LWS_EXTERN void lws_conmon_wsi_take ( struct lws *  wsi,
struct lws_conmon dest 
)

#include <include/libwebsockets/lws-conmon.h>

lws_conmon_wsi_take() - create a connection latency object from client wsi

Parameters
contextlws wsi
destconmon struct to fill

Copies wsi conmon data into the caller's struct. Passes ownership of any allocations in the addrinfo list to the caller, lws will not delete that any more on wsi close after this call. The caller must call lws_conmon_release() on the struct to destroy any addrinfo in the struct that is prepared by this eventually but it can defer it as long as it wants.

Other than the addrinfo list, the contents of the returned object are completely selfcontained and don't point outside of the object itself, ie, everything else in there remains in scope while the object itself does.

◆ lws_conmon_release()

LWS_VISIBLE LWS_EXTERN void lws_conmon_release ( struct lws_conmon conmon)

#include <include/libwebsockets/lws-conmon.h>

lws_conmon_release() - free any allocations in the conmon struct

Parameters
conmonpointer to conmon struct

Destroys any allocations in the conmon struct so it can go out of scope. It doesn't free dest itself, it's designed to clean out a struct that is on the stack or embedded in another object.