libwebsockets
Lightweight C library for HTML5 websockets
lws-conmon.h
Go to the documentation of this file.
1 /*
2  * libwebsockets - small server side websockets and web server implementation
3  *
4  * Copyright (C) 2010 - 2021 Andy Green <andy@warmcat.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  */
24 
33 
34 /* enough for 4191s, or just over an hour */
36 
37 /*
38  * Connection latency information... note that not all wsi actually make
39  * connections, for example h2 streams after the initial one will have 0
40  * for everything except ciu_txn_resp.
41  *
42  * If represented in JSON, it should look like this
43  *
44  * {
45  * "peer": "46.105.127.147",
46  * "dns_us": 1234,
47  * "dns_disp": 1,
48  * "sockconn_us": 1234,
49  * "tls_us": 1234,
50  * "txn_resp_us": 1234,
51  * "dns":["46.105.127.147", "2001:41d0:2:ee93::1"],
52  * "prot_specific": {
53  * "protocol": "http",
54  * "resp": 200
55  * }
56  * }
57  *
58  * The indexes in "dns_disp" are declared in lws_conmon_dns_disposition_t
59  * below.
60  *
61  * "prot_specific" may not be present if the protocol doesn't have anything
62  * to report or is not supported.
63  */
64 
65 typedef enum lws_conmon_pcol {
67  LWSCONMON_PCOL_HTTP, /* .protocol_specific.http is valid */
69 
73  LWSCONMON_DNS_OK = 1,
80 
81 struct lws_conmon {
86  union {
87  struct {
88  int response;
90  } http;
97  struct addrinfo *dns_results_copy;
122 };
123 
141 lws_conmon_wsi_take(struct lws *wsi, struct lws_conmon *dest);
142 
154 
lws_conmon_interval_us_t ciu_txn_resp
Definition: lws-conmon.h:111
lws_conmon_interval_us_t ciu_tls
Definition: lws-conmon.h:109
lws_conmon_pcol_t pcol
Definition: lws-conmon.h:116
lws_conmon_dns_disposition_t dns_disposition
Definition: lws-conmon.h:120
lws_conmon_interval_us_t ciu_sockconn
Definition: lws-conmon.h:106
lws_conmon_interval_us_t ciu_dns
Definition: lws-conmon.h:102
union lws_conmon::@4 protocol_specific
struct addrinfo * dns_results_copy
Definition: lws-conmon.h:97
lws_sockaddr46 peer46
Definition: lws-conmon.h:82
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)
enum lws_conmon_pcol lws_conmon_pcol_t
uint32_t lws_conmon_interval_us_t
Definition: lws-conmon.h:35
lws_conmon_dns_disposition
Definition: lws-conmon.h:70
enum lws_conmon_dns_disposition lws_conmon_dns_disposition_t
lws_conmon_pcol
Definition: lws-conmon.h:65
@ 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
@ LWSCONMON_PCOL_HTTP
Definition: lws-conmon.h:67
@ LWSCONMON_PCOL_NONE
Definition: lws-conmon.h:66
unsigned int uint32_t
#define LWS_EXTERN
#define LWS_VISIBLE