libwebsockets
Lightweight C library for HTML5 websockets
lws-system.h
1 /*
2  * libwebsockets - small server side websockets and web server implementation
3  *
4  * Copyright (C) 2010-2019 Andy Green <andy@warmcat.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation:
9  * version 2.1 of the License.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  *
21  * included from libwebsockets.h
22  *
23  * This provides a clean way to interface lws user code to be able to
24  * work unchanged on different systems for fetching common system information,
25  * and performing common system operations like reboot.
26  *
27  * An ops struct with the system-specific implementations is set at
28  * context creation time, and apis are provided that call through to
29  * those where they exist.
30  */
31 
32 typedef enum {
33  LWS_SYSI_HRS_DEVICE_MODEL = 1,
34  LWS_SYSI_HRS_DEVICE_SERIAL,
35  LWS_SYSI_HRS_FIRMWARE_VERSION,
36 
37  LWS_SYSI_USER_BASE = 100
38 } lws_system_item_t;
39 
40 typedef union {
41  const char *hrs; /* human readable string */
42  void *data;
43  time_t t;
45 
46 typedef struct lws_system_ops {
47  int (*get_info)(lws_system_item_t i, lws_system_arg_t arg, size_t *len);
48  int (*reboot)(void);
50 
51 /* wrappers handle NULL members or no ops struct set at all cleanly */
52 
71 LWS_EXTERN LWS_VISIBLE int
72 lws_system_get_info(struct lws_context *context, lws_system_item_t item,
73  lws_system_arg_t arg, size_t *len);
74 
75 
83 LWS_EXTERN LWS_VISIBLE int
84 lws_system_reboot(struct lws_context *context);
Definition: lws-system.h:46
Definition: lws-system.h:40