]> git.ipfire.org Git - people/ms/network.git/blame - src/utils/network-phy-list-channels.c
wireless-ap: Enable 802.11w by default
[people/ms/network.git] / src / utils / network-phy-list-channels.c
CommitLineData
394cff53
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#include <stdio.h>
22#include <stdlib.h>
23
24#include <network/libnetwork.h>
25#include <network/logging.h>
26#include <network/phy.h>
27
28int main(int argc, char** argv) {
29 struct network_ctx* ctx = NULL;
30 struct network_phy* phy = NULL;
31 int r;
32
33 if (argc < 2) {
34 fprintf(stderr, "No enough arguments\n");
35 r = 2;
36 goto END;
37 }
38
39 // Initialise context
40 r = network_new(&ctx);
41 if (r)
42 return r;
43
44 r = network_phy_new(ctx, &phy, argv[1]);
45 if (r) {
46 fprintf(stderr, "Could not find %s\n", argv[1]);
47 goto END;
48 }
49
50 // Print all supported HT capabilities
51 char* channels = network_phy_list_channels(phy);
52 if (channels && *channels) {
53 printf("%s", channels);
54 free(channels);
55 }
56
57END:
58 network_phy_unref(phy);
59 network_unref(ctx);
60 return r;
61}