2017-03-23 17:48:53 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Wireless daemon for Linux
|
|
|
|
*
|
2019-10-25 00:43:08 +02:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
|
2017-03-23 17:48:53 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-04-13 18:56:13 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2017-04-07 23:55:31 +02:00
|
|
|
struct proxy_interface;
|
|
|
|
|
2021-01-19 18:14:44 +01:00
|
|
|
#define IWD_ADAPTER_INTERFACE "net.connman.iwd.Adapter"
|
|
|
|
#define IWD_ACCESS_POINT_INTERFACE "net.connman.iwd.AccessPoint"
|
|
|
|
#define IWD_AD_HOC_INTERFACE "net.connman.iwd.AdHoc"
|
|
|
|
#define IWD_AGENT_MANAGER_INTERFACE "net.connman.iwd.AgentManager"
|
|
|
|
#define IWD_DEVICE_INTERFACE "net.connman.iwd.Device"
|
|
|
|
#define IWD_KNOWN_NETWORK_INTREFACE "net.connman.iwd.KnownNetwork"
|
|
|
|
#define IWD_NETWORK_INTERFACE "net.connman.iwd.Network"
|
|
|
|
#define IWD_WSC_INTERFACE "net.connman.iwd.SimpleConfiguration"
|
|
|
|
#define IWD_STATION_INTERFACE "net.connman.iwd.Station"
|
|
|
|
#define IWD_STATION_DIAGNOSTIC_INTERFACE "net.connman.iwd.StationDiagnostic"
|
2021-01-20 19:30:33 +01:00
|
|
|
#define IWD_AP_DIAGNOSTIC_INTERFACE "net.connman.iwd.AccessPointDiagnostic"
|
2021-10-25 23:04:41 +02:00
|
|
|
#define IWD_DAEMON_INTERFACE "net.connman.iwd.Daemon"
|
2021-12-21 01:07:46 +01:00
|
|
|
#define IWD_DPP_INTERFACE "net.connman.iwd.DeviceProvisioning"
|
2017-04-12 02:48:09 +02:00
|
|
|
|
2017-04-17 18:50:10 +02:00
|
|
|
typedef bool (*proxy_property_match_func_t) (const void *a, const void *b);
|
|
|
|
|
2017-04-07 23:55:34 +02:00
|
|
|
struct proxy_interface_property {
|
|
|
|
const char *name;
|
|
|
|
const char *type;
|
2018-07-25 01:17:17 +02:00
|
|
|
void (*update)(void *data, struct l_dbus_message_iter *variant);
|
2017-04-27 01:08:36 +02:00
|
|
|
const char *(*tostr)(const void *data);
|
2017-04-14 19:52:40 +02:00
|
|
|
const bool is_read_write;
|
2018-07-25 21:54:39 +02:00
|
|
|
bool (*append)(struct l_dbus_message_builder *builder,
|
|
|
|
const char *value_str);
|
2019-04-11 00:58:19 +02:00
|
|
|
const char **options;
|
2017-04-07 23:55:34 +02:00
|
|
|
};
|
|
|
|
|
2017-04-07 23:55:32 +02:00
|
|
|
struct proxy_interface_type_ops {
|
|
|
|
void *(*create)(void);
|
2017-04-07 23:55:33 +02:00
|
|
|
void (*destroy)(void *data);
|
2017-04-14 19:52:42 +02:00
|
|
|
const char *(*identity)(void *data);
|
|
|
|
void (*display)(const char *margin, const void *data);
|
2017-04-07 23:55:32 +02:00
|
|
|
};
|
|
|
|
|
2017-04-07 23:55:31 +02:00
|
|
|
struct proxy_interface_type {
|
|
|
|
const char *interface;
|
2017-04-07 23:55:34 +02:00
|
|
|
const struct proxy_interface_property *properties;
|
2017-04-07 23:55:32 +02:00
|
|
|
const struct proxy_interface_type_ops *ops;
|
2017-04-07 23:55:31 +02:00
|
|
|
};
|
|
|
|
|
2018-07-25 21:54:42 +02:00
|
|
|
char *proxy_property_completion(
|
|
|
|
const struct proxy_interface_property *properties,
|
|
|
|
const char *text, int state);
|
|
|
|
|
2018-07-25 21:54:39 +02:00
|
|
|
bool proxy_property_set(const struct proxy_interface *proxy, const char *name,
|
|
|
|
const char *value_str, l_dbus_message_func_t callback);
|
|
|
|
|
2017-04-07 23:55:31 +02:00
|
|
|
struct proxy_interface *proxy_interface_find(const char *interface,
|
|
|
|
const char *path);
|
|
|
|
|
2017-04-17 18:50:10 +02:00
|
|
|
struct l_queue *proxy_interface_find_all(const char *interface,
|
|
|
|
proxy_property_match_func_t function,
|
|
|
|
const void *value);
|
|
|
|
|
2018-06-01 00:01:31 +02:00
|
|
|
bool proxy_interface_is_same(const struct proxy_interface *a,
|
|
|
|
const struct proxy_interface *b);
|
|
|
|
|
2017-04-19 00:04:15 +02:00
|
|
|
bool dbus_message_has_error(struct l_dbus_message *message);
|
|
|
|
|
2017-04-18 23:42:45 +02:00
|
|
|
bool proxy_interface_method_call(const struct proxy_interface *proxy,
|
|
|
|
const char *name, const char *signature,
|
|
|
|
l_dbus_message_func_t callback, ...);
|
|
|
|
|
2017-04-27 01:08:41 +02:00
|
|
|
void proxy_properties_display(const struct proxy_interface *proxy,
|
|
|
|
const char *caption, const char *margin,
|
2022-06-29 21:27:08 +02:00
|
|
|
unsigned int name_column_width,
|
|
|
|
unsigned int value_column_width);
|
2017-04-27 01:08:41 +02:00
|
|
|
|
2017-04-27 01:08:37 +02:00
|
|
|
char *proxy_property_str_completion(const struct proxy_interface_type *type,
|
|
|
|
proxy_property_match_func_t function,
|
|
|
|
const char *property_name,
|
2018-09-14 10:45:14 +02:00
|
|
|
const void *value, int state,
|
|
|
|
const char *extra_interface);
|
2017-04-27 01:08:37 +02:00
|
|
|
|
2017-04-14 19:52:42 +02:00
|
|
|
void *proxy_interface_get_data(const struct proxy_interface *proxy);
|
|
|
|
const char *proxy_interface_get_interface(const struct proxy_interface *proxy);
|
2018-09-14 09:53:36 +02:00
|
|
|
const char *proxy_interface_get_path(const struct proxy_interface *proxy);
|
2017-04-14 19:52:42 +02:00
|
|
|
const char *proxy_interface_get_identity_str(
|
|
|
|
const struct proxy_interface *proxy);
|
|
|
|
|
2017-04-19 00:04:15 +02:00
|
|
|
void proxy_interface_display_list(const char *interface);
|
|
|
|
|
2017-04-10 22:16:46 +02:00
|
|
|
void proxy_interface_type_register(
|
|
|
|
const struct proxy_interface_type *interface_type);
|
|
|
|
void proxy_interface_type_unregister(
|
|
|
|
const struct proxy_interface_type *interface_type);
|
|
|
|
|
2018-05-03 22:57:51 +02:00
|
|
|
struct l_dbus *dbus_get_bus(void);
|
|
|
|
|
2017-04-13 18:56:13 +02:00
|
|
|
struct interface_type_desc {
|
|
|
|
const char *interface;
|
|
|
|
int (*init)(void);
|
|
|
|
void (*exit)(void);
|
|
|
|
} __attribute__((aligned(8)));
|
|
|
|
|
|
|
|
#define INTERFACE_TYPE(interface, init, exit) \
|
2021-11-11 04:07:58 +01:00
|
|
|
_Pragma("GCC diagnostic push") \
|
|
|
|
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
|
2017-04-13 18:56:13 +02:00
|
|
|
static struct interface_type_desc __interface_type_ ## interface\
|
2021-11-11 04:07:58 +01:00
|
|
|
__attribute__((used, retain, section("__interface"), \
|
|
|
|
aligned(8))) = { \
|
2017-04-13 18:56:13 +02:00
|
|
|
#interface, init, exit \
|
|
|
|
}; \
|
2021-11-11 04:07:58 +01:00
|
|
|
_Pragma("GCC diagnostic pop")
|
2017-04-13 18:56:13 +02:00
|
|
|
|
2017-03-23 17:48:53 +01:00
|
|
|
bool dbus_proxy_init(void);
|
|
|
|
bool dbus_proxy_exit(void);
|