John W. Linville | 7e272fc | 2008-09-24 18:13:14 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * lib80211 -- common bits for IEEE802.11 drivers |
| 3 | * |
| 4 | * Copyright(c) 2008 John W. Linville <linville@tuxdriver.com> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <linux/module.h> |
| 9 | #include <linux/ieee80211.h> |
| 10 | |
| 11 | #include <net/lib80211.h> |
| 12 | |
| 13 | #define DRV_NAME "lib80211" |
| 14 | |
| 15 | #define DRV_DESCRIPTION "common routines for IEEE802.11 drivers" |
| 16 | |
| 17 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
| 18 | MODULE_AUTHOR("John W. Linville <linville@tuxdriver.com>"); |
| 19 | MODULE_LICENSE("GPL"); |
| 20 | |
| 21 | const char *escape_ssid(const char *ssid, u8 ssid_len) |
| 22 | { |
| 23 | static char escaped[IEEE80211_MAX_SSID_LEN * 2 + 1]; |
| 24 | const char *s = ssid; |
| 25 | char *d = escaped; |
| 26 | |
| 27 | if (is_empty_ssid(ssid, ssid_len)) { |
| 28 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); |
| 29 | return escaped; |
| 30 | } |
| 31 | |
| 32 | ssid_len = min_t(u8, ssid_len, IEEE80211_MAX_SSID_LEN); |
| 33 | while (ssid_len--) { |
| 34 | if (*s == '\0') { |
| 35 | *d++ = '\\'; |
| 36 | *d++ = '0'; |
| 37 | s++; |
| 38 | } else { |
| 39 | *d++ = *s++; |
| 40 | } |
| 41 | } |
| 42 | *d = '\0'; |
| 43 | return escaped; |
| 44 | } |
| 45 | EXPORT_SYMBOL(escape_ssid); |
| 46 | |
| 47 | static int __init ieee80211_init(void) |
| 48 | { |
| 49 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION "\n"); |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | static void __exit ieee80211_exit(void) |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | module_init(ieee80211_init); |
| 58 | module_exit(ieee80211_exit); |