]>
git.ipfire.org Git - thirdparty/iw.git/blob - util.c
4 int mac_addr_n2a(char *mac_addr
, unsigned char *arg
)
9 for (i
= 0; i
< ETH_ALEN
; i
++) {
11 sprintf(mac_addr
+l
, "%02x", arg
[i
]);
14 sprintf(mac_addr
+l
, ":%02x", arg
[i
]);
21 int mac_addr_a2n(unsigned char *mac_addr
, char *arg
)
25 for (i
= 0; i
< ETH_ALEN
; i
++) {
27 char *cp
= strchr(arg
, ':');
32 if (sscanf(arg
, "%x", &temp
) != 1)
34 if (temp
< 0 || temp
> 255)
48 static const char *ifmodes
[NL80211_IFTYPE_MAX
+ 1] = {
59 static char modebuf
[100];
61 const char *iftype_name(enum nl80211_iftype iftype
)
63 if (iftype
<= NL80211_IFTYPE_MAX
)
64 return ifmodes
[iftype
];
65 sprintf(modebuf
, "Unknown mode (%d)", iftype
);
69 int ieee80211_channel_to_frequency(int chan
)
72 return 2407 + chan
* 5;
77 /* FIXME: dot11ChannelStartingFactor (802.11-2007 17.3.8.3.2) */
78 return (chan
+ 1000) * 5;
81 int ieee80211_frequency_to_channel(int freq
)
87 return (freq
- 2407) / 5;
89 /* FIXME: dot11ChannelStartingFactor (802.11-2007 17.3.8.3.2) */