]> git.ipfire.org Git - network.git/blame - src/libnetwork/network/phy.h
ibnetwork: Add command to show available VHT capabilities of phys
[network.git] / src / libnetwork / network / phy.h
CommitLineData
9cb2f0c0
MT
1/*#############################################################################
2# #
3# IPFire.org - A linux based firewall #
4# Copyright (C) 2018 IPFire Network Development Team #
5# #
6# This program is free software: you can redistribute it and/or modify #
7# it under the terms of the GNU General Public License as published by #
8# the Free Software Foundation, either version 3 of the License, or #
9# (at your option) any later version. #
10# #
11# This program 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 #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
18# #
19#############################################################################*/
20
21#ifndef NETWORK_PHY_H
22#define NETWORK_PHY_H
23
24#include <network/libnetwork.h>
25
26struct network_phy;
27
28int network_phy_new(struct network_ctx*, struct network_phy** phy, const char* name);
29
30struct network_phy* network_phy_ref(struct network_phy* phy);
31struct network_phy* network_phy_unref(struct network_phy* phy);
32
e145b2f3
MT
33enum network_phy_ht_caps {
34 NETWORK_PHY_HT_CAP_RX_LDCP = (1 << 0),
35 NETWORK_PHY_HT_CAP_HT40 = (1 << 1),
36 NETWORK_PHY_HT_CAP_SMPS_STATIC = (1 << 2),
37 NETWORK_PHY_HT_CAP_SMPS_DYNAMIC = (1 << 3),
38 NETWORK_PHY_HT_CAP_RX_GF = (1 << 4),
39 NETWORK_PHY_HT_CAP_RX_HT20_SGI = (1 << 5),
40 NETWORK_PHY_HT_CAP_RX_HT40_SGI = (1 << 6),
41 NETWORK_PHY_HT_CAP_TX_STBC = (1 << 7),
42 NETWORK_PHY_HT_CAP_RX_STBC1 = (1 << 8),
43 NETWORK_PHY_HT_CAP_RX_STBC2 = (1 << 9),
44 NETWORK_PHY_HT_CAP_RX_STBC3 = (1 << 10),
45 NETWORK_PHY_HT_CAP_DELAYED_BA = (1 << 11),
46 NETWORK_PHY_HT_CAP_MAX_AMSDU_7935 = (1 << 12),
47 NETWORK_PHY_HT_CAP_DSSS_CCK_HT40 = (1 << 13),
48 NETWORK_PHY_HT_CAP_HT40_INTOLERANT = (1 << 14),
49 NETWORK_PHY_HT_CAP_LSIG_TXOP_PROT = (1 << 15),
50};
51
b2323e58
MT
52enum network_phy_vht_caps {
53 NETWORK_PHY_VHT_CAP_VHT160 = (1 << 0),
54 NETWORK_PHY_VHT_CAP_VHT80PLUS80 = (1 << 1),
55 NETWORK_PHY_VHT_CAP_RX_LDPC = (1 << 2),
56 NETWORK_PHY_VHT_CAP_RX_SHORT_GI_80 = (1 << 3),
57 NETWORK_PHY_VHT_CAP_RX_SHORT_GI_160 = (1 << 4),
58 NETWORK_PHY_VHT_CAP_TX_STBC = (1 << 5),
59 NETWORK_PHY_VHT_CAP_SU_BEAMFORMER = (1 << 6),
60 NETWORK_PHY_VHT_CAP_SU_BEAMFORMEE = (1 << 7),
61 NETWORK_PHY_VHT_CAP_MU_BEAMFORMER = (1 << 8),
62 NETWORK_PHY_VHT_CAP_MU_BEAMFORMEE = (1 << 9),
63 NETWORK_PHY_VHT_CAP_TXOP_PS = (1 << 10),
64 NETWORK_PHY_VHT_CAP_HTC_VHT = (1 << 11),
65 NETWORK_PHY_VHT_CAP_RX_ANTENNA_PATTERN = (1 << 12),
66 NETWORK_PHY_VHT_CAP_TX_ANTENNA_PATTERN = (1 << 13),
67};
68
69
70int network_phy_has_vht_capability(struct network_phy* phy, const enum network_phy_vht_caps cap);
71char* network_phy_list_vht_capabilities(struct network_phy* phy);
e145b2f3
MT
72int network_phy_has_ht_capability(struct network_phy* phy, const enum network_phy_ht_caps cap);
73char* network_phy_list_ht_capabilities(struct network_phy* phy);
74
75#ifdef NETWORK_PRIVATE
76
77#include <linux/nl80211.h>
78#include <netlink/msg.h>
79
80struct nl_msg* network_phy_make_netlink_message(struct network_phy* phy,
81 enum nl80211_commands cmd, int flags);
82
b2323e58
MT
83#define foreach_vht_cap(cap) \
84 for(int cap = NETWORK_PHY_VHT_CAP_VHT160; cap <= NETWORK_PHY_VHT_CAP_TX_ANTENNA_PATTERN; cap <<= 1)
85
e145b2f3
MT
86#define foreach_ht_cap(cap) \
87 for(int cap = NETWORK_PHY_HT_CAP_RX_LDCP; cap != NETWORK_PHY_HT_CAP_LSIG_TXOP_PROT; cap <<= 1)
88
89#endif
90
9cb2f0c0 91#endif /* NETWORK_PHY_H */