libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-sysinfo.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2026 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
41
42#if defined(LWS_WITH_SYS_INFO)
43
44typedef enum lws_sysinfo_type {
45 LWS_SYSINFO_LWS_VERSION,
46 LWS_SYSINFO_LWS_BUILD,
47 LWS_SYSINFO_HOSTNAME,
48 LWS_SYSINFO_OS,
49 LWS_SYSINFO_ARCH,
50 LWS_SYSINFO_PID,
51 LWS_SYSINFO_TIME,
52 LWS_SYSINFO_UPTIME,
53 LWS_SYSINFO_CPUS,
54 LWS_SYSINFO_RAM_TOTAL,
55 LWS_SYSINFO_RAM_FREE,
56 LWS_SYSINFO_IFACE_ADDR,
59 LWS_SYSINFO_DNS_SERVER,
60 LWS_SYSINFO_DNS_SEARCH,
62
63 LWS_SYSINFO_TYPE_COUNT
64} lws_sysinfo_type_t;
65
66/* the state of an interface an LWS_SYSINFO_IFACE_ADDR address is on */
67
68enum {
69 LWS_SYSINFO_IF_UP = (1 << 0),
70 LWS_SYSINFO_IF_RUNNING = (1 << 1),
71 LWS_SYSINFO_IF_LOOPBACK = (1 << 2),
72 LWS_SYSINFO_IF_P2P = (1 << 3),
73};
74
75typedef struct lws_sysinfo_item {
76 lws_dll2_t list;
77 const char *name;
78 const char *s;
79 uint64_t u;
80 lws_sockaddr46 sa46;
81 uint32_t flags;
82 lws_sysinfo_type_t type;
83} lws_sysinfo_item_t;
84
85struct lws_sysinfo;
86
97LWS_VISIBLE LWS_EXTERN struct lws_sysinfo *
98lws_sysinfo_create(struct lws_context *cx);
99
108LWS_VISIBLE LWS_EXTERN const lws_sysinfo_item_t *
109lws_sysinfo_next(struct lws_sysinfo *si, const lws_sysinfo_item_t *prev);
110
122lws_sysinfo_describe(const lws_sysinfo_item_t *it, char *buf, size_t len);
123
127LWS_VISIBLE LWS_EXTERN const char *
128lws_sysinfo_type_name(lws_sysinfo_type_t type);
129
134lws_sysinfo_destroy(struct lws_sysinfo **psi);
135
136#endif
struct lws_dll2 lws_dll2_t
union lws_sockaddr46 lws_sockaddr46
unsigned int uint32_t
#define LWS_EXTERN
#define LWS_VISIBLE