xref: /openbmc/linux/include/net/lib80211.h (revision 7e272fcff6f0a32a3d46e600ea5895f6058f4e2d)
1*7e272fcfSJohn W. Linville /*
2*7e272fcfSJohn W. Linville  * lib80211.h -- common bits for IEEE802.11 wireless drivers
3*7e272fcfSJohn W. Linville  *
4*7e272fcfSJohn W. Linville  * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com>
5*7e272fcfSJohn W. Linville  *
6*7e272fcfSJohn W. Linville  */
7*7e272fcfSJohn W. Linville 
8*7e272fcfSJohn W. Linville #ifndef LIB80211_H
9*7e272fcfSJohn W. Linville #define LIB80211_H
10*7e272fcfSJohn W. Linville 
11*7e272fcfSJohn W. Linville /* escape_ssid() is intended to be used in debug (and possibly error)
12*7e272fcfSJohn W. Linville  * messages. It should never be used for passing ssid to user space. */
13*7e272fcfSJohn W. Linville const char *escape_ssid(const char *ssid, u8 ssid_len);
14*7e272fcfSJohn W. Linville 
15*7e272fcfSJohn W. Linville static inline int is_empty_ssid(const char *ssid, int ssid_len)
16*7e272fcfSJohn W. Linville {
17*7e272fcfSJohn W. Linville 	/* Single white space is for Linksys APs */
18*7e272fcfSJohn W. Linville 	if (ssid_len == 1 && ssid[0] == ' ')
19*7e272fcfSJohn W. Linville 		return 1;
20*7e272fcfSJohn W. Linville 
21*7e272fcfSJohn W. Linville 	/* Otherwise, if the entire ssid is 0, we assume it is hidden */
22*7e272fcfSJohn W. Linville 	while (ssid_len) {
23*7e272fcfSJohn W. Linville 		ssid_len--;
24*7e272fcfSJohn W. Linville 		if (ssid[ssid_len] != '\0')
25*7e272fcfSJohn W. Linville 			return 0;
26*7e272fcfSJohn W. Linville 	}
27*7e272fcfSJohn W. Linville 
28*7e272fcfSJohn W. Linville 	return 1;
29*7e272fcfSJohn W. Linville }
30*7e272fcfSJohn W. Linville 
31*7e272fcfSJohn W. Linville #endif /* LIB80211_H */
32