wpa_supplicant/hostapd / common helper functions, etc. More...
#include "includes.h"
#include "common.h"
Go to the source code of this file.
Functions | |
int | hwaddr_aton (const char *txt, u8 *addr) |
Convert ASCII string to MAC address. | |
int | hexstr2bin (const char *hex, u8 *buf, size_t len) |
Convert ASCII hex string into binary data. | |
void | inc_byte_array (u8 *counter, size_t len) |
Increment arbitrary length byte array by one. | |
void | wpa_get_ntp_timestamp (u8 *buf) |
int | wpa_snprintf_hex (char *buf, size_t buf_size, const u8 *data, size_t len) |
Print data as a hex string into a buffer. | |
int | wpa_snprintf_hex_uppercase (char *buf, size_t buf_size, const u8 *data, size_t len) |
Print data as a upper case hex string into buf. | |
const char * | wpa_ssid_txt (const u8 *ssid, size_t ssid_len) |
Convert SSID to a printable string. | |
void * | __hide_aliasing_typecast (void *foo) |
wpa_supplicant/hostapd / common helper functions, etc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
Alternatively, this software may be distributed under the terms of BSD license.
See README and COPYING for more details.
Definition in file common.c.
int hexstr2bin | ( | const char * | hex, | |
u8 * | buf, | |||
size_t | len | |||
) |
Convert ASCII hex string into binary data.
hex | ASCII hex string (e.g., "01ab") | |
buf | Buffer for the binary data | |
len | Length of the text to convert in bytes (of buf); hex will be double this size |
int hwaddr_aton | ( | const char * | txt, | |
u8 * | addr | |||
) |
void inc_byte_array | ( | u8 * | counter, | |
size_t | len | |||
) |
Increment arbitrary length byte array by one.
counter | Pointer to byte array | |
len | Length of the counter in bytes |
This function increments the last byte of the counter by one and continues rolling over to more significant bytes if the byte was incremented from 0xff to 0x00.
int wpa_snprintf_hex | ( | char * | buf, | |
size_t | buf_size, | |||
const u8 * | data, | |||
size_t | len | |||
) |
int wpa_snprintf_hex_uppercase | ( | char * | buf, | |
size_t | buf_size, | |||
const u8 * | data, | |||
size_t | len | |||
) |
const char* wpa_ssid_txt | ( | const u8 * | ssid, | |
size_t | ssid_len | |||
) |
Convert SSID to a printable string.
ssid | SSID (32-octet string) | |
ssid_len | Length of ssid in octets |
This function can be used to convert SSIDs into printable form. In most cases, SSIDs do not use unprintable characters, but IEEE 802.11 standard does not limit the used character set, so anything could be used in an SSID.
This function uses a static buffer, so only one call can be used at the time, i.e., this is not re-entrant and the returned buffer must be used before calling this again.