1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include <inttypes.h> 5 6 #include "sd-device.h" 7 8 #include "macro.h" 9 10 typedef struct Manager Manager; 11 12 typedef struct Wiphy { 13 Manager *manager; 14 15 uint32_t index; 16 char *name; 17 } Wiphy; 18 19 Wiphy *wiphy_free(Wiphy *w); 20 DEFINE_TRIVIAL_CLEANUP_FUNC(Wiphy*, wiphy_free); 21 22 int wiphy_get_by_index(Manager *manager, uint32_t index, Wiphy **ret); 23 int wiphy_get_by_name(Manager *manager, const char *name, Wiphy **ret); 24 25 int manager_genl_process_nl80211_wiphy(sd_netlink *genl, sd_netlink_message *message, Manager *manager); 26 27 #define log_wiphy_full_errno_zerook(w, level, error, ...) \ 28 ({ \ 29 const Wiphy *_w = (w); \ 30 log_interface_full_errno_zerook(_w ? _w->name : NULL, level, error, __VA_ARGS__); \ 31 }) 32 33 #define log_wiphy_full_errno(w, level, error, ...) \ 34 ({ \ 35 int _error = (error); \ 36 ASSERT_NON_ZERO(_error); \ 37 log_wiphy_full_errno_zerook(w, level, _error, __VA_ARGS__); \ 38 }) 39 40 #define log_wiphy_full(w, level, ...) (void) log_wiphy_full_errno_zerook(w, level, 0, __VA_ARGS__) 41 42 #define log_wiphy_debug(w, ...) log_wiphy_full(w, LOG_DEBUG, __VA_ARGS__) 43 #define log_wiphy_info(w, ...) log_wiphy_full(w, LOG_INFO, __VA_ARGS__) 44 #define log_wiphy_notice(w, ...) log_wiphy_full(w, LOG_NOTICE, __VA_ARGS__) 45 #define log_wiphy_warning(w, ...) log_wiphy_full(w, LOG_WARNING, __VA_ARGS__) 46 #define log_wiphy_error(w, ...) log_wiphy_full(w, LOG_ERR, __VA_ARGS__) 47 48 #define log_wiphy_debug_errno(w, error, ...) log_wiphy_full_errno(w, LOG_DEBUG, error, __VA_ARGS__) 49 #define log_wiphy_info_errno(w, error, ...) log_wiphy_full_errno(w, LOG_INFO, error, __VA_ARGS__) 50 #define log_wiphy_notice_errno(w, error, ...) log_wiphy_full_errno(w, LOG_NOTICE, error, __VA_ARGS__) 51 #define log_wiphy_warning_errno(w, error, ...) log_wiphy_full_errno(w, LOG_WARNING, error, __VA_ARGS__) 52 #define log_wiphy_error_errno(w, error, ...) log_wiphy_full_errno(w, LOG_ERR, error, __VA_ARGS__) 53