Defines | Typedefs | Functions
common.h File Reference
#include "os.h"
#include <stdint.h>
#include "wpa_debug.h"
Include dependency graph for common.h:

Go to the source code of this file.

Defines

#define __bitwise
#define __force
#define aliasing_hide_typecast(a, t)   (t *) __hide_aliasing_typecast((a))
#define PRINTF_FORMAT(a, b)
#define STRUCT_PACKED
#define WPA_GET_BE16(a)   ((u16) (((a)[0] << 8) | (a)[1]))
#define WPA_GET_BE24(a)
#define WPA_GET_BE32(a)
#define WPA_GET_BE64(a)
#define WPA_GET_LE16(a)   ((u16) (((a)[1] << 8) | (a)[0]))
#define WPA_GET_LE32(a)
#define WPA_GET_LE64(a)
#define WPA_PUT_BE16(a, val)
#define WPA_PUT_BE24(a, val)
#define WPA_PUT_BE32(a, val)
#define WPA_PUT_BE64(a, val)
#define WPA_PUT_LE16(a, val)
#define WPA_PUT_LE32(a, val)
#define wpa_strdup_tchar(s)   strdup((s))
#define wpa_unicode2ascii_inplace(s)   do { } while (0)

Typedefs

typedef u16 __bitwise be16
typedef u32 __bitwise be32
typedef u64 __bitwise be64
typedef u16 __bitwise le16
typedef u32 __bitwise le32
typedef u64 __bitwise le64

Functions

void * __hide_aliasing_typecast (void *foo)
int hexstr2bin (const char *hex, u8 *buf, size_t len)
int hwaddr_aton (const char *txt, u8 *addr)
int hwaddr_aton2 (const char *txt, u8 *addr)
void inc_byte_array (u8 *counter, size_t len)
static int is_zero_ether_addr (const u8 *a)
void wpa_get_ntp_timestamp (u8 *buf)
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)

Define Documentation

#define __bitwise

Definition at line 420 of file common.h.

#define __force

Definition at line 419 of file common.h.

#define aliasing_hide_typecast (   a,
  t 
)    (t *) __hide_aliasing_typecast((a))

Definition at line 475 of file common.h.

#define PRINTF_FORMAT (   a,
 
)

Definition at line 341 of file common.h.

Definition at line 342 of file common.h.

#define WPA_GET_BE16 (   a)    ((u16) (((a)[0] << 8) | (a)[1]))

Definition at line 249 of file common.h.

#define WPA_GET_BE24 (   a)
Value:
((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \
                         ((u32) (a)[2]))

Definition at line 263 of file common.h.

#define WPA_GET_BE32 (   a)
Value:
((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \
                         (((u32) (a)[2]) << 8) | ((u32) (a)[3]))

Definition at line 272 of file common.h.

#define WPA_GET_BE64 (   a)
Value:
((((u64) (a)[0]) << 56) | (((u64) (a)[1]) << 48) | \
                         (((u64) (a)[2]) << 40) | (((u64) (a)[3]) << 32) | \
                         (((u64) (a)[4]) << 24) | (((u64) (a)[5]) << 16) | \
                         (((u64) (a)[6]) << 8) | ((u64) (a)[7]))

Definition at line 292 of file common.h.

#define WPA_GET_LE16 (   a)    ((u16) (((a)[1] << 8) | (a)[0]))

Definition at line 256 of file common.h.

#define WPA_GET_LE32 (   a)
Value:
((((u32) (a)[3]) << 24) | (((u32) (a)[2]) << 16) | \
                         (((u32) (a)[1]) << 8) | ((u32) (a)[0]))

Definition at line 282 of file common.h.

#define WPA_GET_LE64 (   a)
Value:
((((u64) (a)[7]) << 56) | (((u64) (a)[6]) << 48) | \
                         (((u64) (a)[5]) << 40) | (((u64) (a)[4]) << 32) | \
                         (((u64) (a)[3]) << 24) | (((u64) (a)[2]) << 16) | \
                         (((u64) (a)[1]) << 8) | ((u64) (a)[0]))

Definition at line 308 of file common.h.

#define WPA_PUT_BE16 (   a,
  val 
)
Value:
do {                                    \
                (a)[0] = ((u16) (val)) >> 8;    \
                (a)[1] = ((u16) (val)) & 0xff;  \
        } while (0)

Definition at line 250 of file common.h.

#define WPA_PUT_BE24 (   a,
  val 
)
Value:
do {                                                    \
                (a)[0] = (u8) ((((u32) (val)) >> 16) & 0xff);   \
                (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff);    \
                (a)[2] = (u8) (((u32) (val)) & 0xff);           \
        } while (0)

Definition at line 265 of file common.h.

#define WPA_PUT_BE32 (   a,
  val 
)
Value:
do {                                                    \
                (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff);   \
                (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff);   \
                (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff);    \
                (a)[3] = (u8) (((u32) (val)) & 0xff);           \
        } while (0)

Definition at line 274 of file common.h.

#define WPA_PUT_BE64 (   a,
  val 
)
Value:
do {                                            \
                (a)[0] = (u8) (((u64) (val)) >> 56);    \
                (a)[1] = (u8) (((u64) (val)) >> 48);    \
                (a)[2] = (u8) (((u64) (val)) >> 40);    \
                (a)[3] = (u8) (((u64) (val)) >> 32);    \
                (a)[4] = (u8) (((u64) (val)) >> 24);    \
                (a)[5] = (u8) (((u64) (val)) >> 16);    \
                (a)[6] = (u8) (((u64) (val)) >> 8);     \
                (a)[7] = (u8) (((u64) (val)) & 0xff);   \
        } while (0)

Definition at line 296 of file common.h.

#define WPA_PUT_LE16 (   a,
  val 
)
Value:
do {                                    \
                (a)[1] = ((u16) (val)) >> 8;    \
                (a)[0] = ((u16) (val)) & 0xff;  \
        } while (0)

Definition at line 257 of file common.h.

#define WPA_PUT_LE32 (   a,
  val 
)
Value:
do {                                                    \
                (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff);   \
                (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff);   \
                (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff);    \
                (a)[0] = (u8) (((u32) (val)) & 0xff);           \
        } while (0)

Definition at line 284 of file common.h.

#define wpa_strdup_tchar (   s)    strdup((s))

Definition at line 452 of file common.h.

#define wpa_unicode2ascii_inplace (   s)    do { } while (0)

Definition at line 451 of file common.h.


Typedef Documentation

typedef u16 __bitwise be16

Definition at line 423 of file common.h.

typedef u32 __bitwise be32

Definition at line 425 of file common.h.

typedef u64 __bitwise be64

Definition at line 427 of file common.h.

typedef u16 __bitwise le16

Definition at line 424 of file common.h.

typedef u32 __bitwise le32

Definition at line 426 of file common.h.

typedef u64 __bitwise le64

Definition at line 428 of file common.h.


Function Documentation

void* __hide_aliasing_typecast ( void *  foo)

Definition at line 360 of file common.c.

int hexstr2bin ( const char *  hex,
u8 *  buf,
size_t  len 
)

hexstr2bin - Convert ASCII hex string into binary data : ASCII hex string (e.g., "01ab") : Buffer for the binary data : Length of the text to convert in bytes (of buf); hex will be double this size Returns: 0 on success, -1 on failure (invalid hex string)

Definition at line 111 of file common.c.

int hwaddr_aton ( const char *  txt,
u8 *  addr 
)

hwaddr_aton - Convert ASCII string to MAC address (colon-delimited format) : MAC address as a string (e.g., "00:11:22:33:44:55") : Buffer for the MAC address (ETH_ALEN = 6 bytes) Returns: 0 on success, -1 on failure (e.g., string not a MAC address)

Definition at line 51 of file common.c.

int hwaddr_aton2 ( const char *  txt,
u8 *  addr 
)

hwaddr_aton2 - Convert ASCII string to MAC address (in any known format) : MAC address as a string (e.g., 00:11:22:33:44:55 or 0011.2233.4455) : Buffer for the MAC address (ETH_ALEN = 6 bytes) Returns: Characters used (> 0) on success, -1 on failure

Definition at line 79 of file common.c.

void inc_byte_array ( u8 *  counter,
size_t  len 
)

inc_byte_array - Increment arbitrary length byte array by one : Pointer to byte array : 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.

Definition at line 138 of file common.c.

static int is_zero_ether_addr ( const u8 *  a) [inline, static]

Definition at line 457 of file common.h.

void wpa_get_ntp_timestamp ( u8 *  buf)

Definition at line 150 of file common.c.

int wpa_snprintf_hex ( char *  buf,
size_t  buf_size,
const u8 *  data,
size_t  len 
)

wpa_snprintf_hex - Print data as a hex string into a buffer : Memory area to use as the output buffer : Maximum buffer size in bytes (should be at least 2 * len + 1) : Data to be printed : Length of data in bytes Returns: Number of bytes written

Definition at line 198 of file common.c.

int wpa_snprintf_hex_uppercase ( char *  buf,
size_t  buf_size,
const u8 *  data,
size_t  len 
)

wpa_snprintf_hex_uppercase - Print data as a upper case hex string into buf : Memory area to use as the output buffer : Maximum buffer size in bytes (should be at least 2 * len + 1) : Data to be printed : Length of data in bytes Returns: Number of bytes written

Definition at line 212 of file common.c.

const char* wpa_ssid_txt ( const u8 *  ssid,
size_t  ssid_len 
)

wpa_ssid_txt - Convert SSID to a printable string : SSID (32-octet string) : Length of ssid in octets Returns: Pointer to a printable string

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.

Definition at line 343 of file common.c.



wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:33:22