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 __BIG_ENDIAN   4321
#define __bitwise
#define __force
#define __LITTLE_ENDIAN   1234
#define __must_check
#define aliasing_hide_typecast(a, t)   (t *) __hide_aliasing_typecast((a))
#define be_to_host16(n)   bswap_16((__force u16) (be16) (n))
#define be_to_host32(n)   bswap_32((__force u32) (be32) (n))
#define be_to_host64(n)   bswap_64((__force u64) (be64) (n))
#define BIT(x)   (1 << (x))
#define ETH_ALEN   6
#define ETH_P_ALL   0x0003
#define ETH_P_EAPOL   ETH_P_PAE
#define ETH_P_PAE   0x888E
#define ETH_P_RRB   0x890D
#define ETH_P_RSN_PREAUTH   0x88c7
#define host_to_be16(n)   ((__force be16) bswap_16((n)))
#define host_to_be32(n)   ((__force be32) bswap_32((n)))
#define host_to_be64(n)   ((__force be64) bswap_64((n)))
#define host_to_le16(n)   ((__force le16) (u16) (n))
#define host_to_le32(n)   ((__force le32) (u32) (n))
#define host_to_le64(n)   ((__force le64) (u64) (n))
#define IFNAMSIZ   16
#define le_to_host16(n)   ((__force u16) (le16) (n))
#define le_to_host32(n)   ((__force u32) (le32) (n))
#define le_to_host64(n)   ((__force u64) (le64) (n))
#define MAC2STR(a)   (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR   "%02x:%02x:%02x:%02x:%02x:%02x"
#define PRINTF_FORMAT(a, b)
#define STRUCT_PACKED
#define WPA_BYTE_SWAP_DEFINED
#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_TYPES_DEFINED
#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
typedef int16_t s16
typedef int32_t s32
typedef int64_t s64
typedef int8_t s8
typedef uint16_t u16
typedef uint32_t u32
typedef uint64_t u64
typedef uint8_t u8

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 __BIG_ENDIAN   4321

Definition at line 203 of file common.h.

#define __bitwise

Definition at line 420 of file common.h.

#define __force

Definition at line 419 of file common.h.

#define __LITTLE_ENDIAN   1234

Definition at line 202 of file common.h.

#define __must_check

Definition at line 434 of file common.h.

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

Definition at line 475 of file common.h.

#define be_to_host16 (  )     bswap_16((__force u16) (be16) (n))

Definition at line 214 of file common.h.

#define be_to_host32 (  )     bswap_32((__force u32) (be32) (n))

Definition at line 218 of file common.h.

#define be_to_host64 (  )     bswap_64((__force u64) (be64) (n))

Definition at line 222 of file common.h.

#define BIT (  )     (1 << (x))

Definition at line 408 of file common.h.

#define ETH_ALEN   6

Definition at line 315 of file common.h.

#define ETH_P_ALL   0x0003

Definition at line 321 of file common.h.

#define ETH_P_EAPOL   ETH_P_PAE

Definition at line 327 of file common.h.

#define ETH_P_PAE   0x888E

Definition at line 324 of file common.h.

#define ETH_P_RRB   0x890D

Definition at line 333 of file common.h.

#define ETH_P_RSN_PREAUTH   0x88c7

Definition at line 330 of file common.h.

#define host_to_be16 (  )     ((__force be16) bswap_16((n)))

Definition at line 215 of file common.h.

#define host_to_be32 (  )     ((__force be32) bswap_32((n)))

Definition at line 219 of file common.h.

#define host_to_be64 (  )     ((__force be64) bswap_64((n)))

Definition at line 223 of file common.h.

#define host_to_le16 (  )     ((__force le16) (u16) (n))

Definition at line 213 of file common.h.

#define host_to_le32 (  )     ((__force le32) (u32) (n))

Definition at line 217 of file common.h.

#define host_to_le64 (  )     ((__force le64) (u64) (n))

Definition at line 221 of file common.h.

#define IFNAMSIZ   16

Definition at line 318 of file common.h.

#define le_to_host16 (  )     ((__force u16) (le16) (n))

Definition at line 212 of file common.h.

#define le_to_host32 (  )     ((__force u32) (le32) (n))

Definition at line 216 of file common.h.

#define le_to_host64 (  )     ((__force u64) (le64) (n))

Definition at line 220 of file common.h.

#define MAC2STR (  )     (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]

Definition at line 403 of file common.h.

#define MACSTR   "%02x:%02x:%02x:%02x:%02x:%02x"

Definition at line 404 of file common.h.

#define PRINTF_FORMAT ( a,
 ) 

Definition at line 341 of file common.h.

struct wpa_ptk - WPA Pairwise Transient Key IEEE Std 802.11i-2004 - 8.5.1.2 Pairwise key hierarchy

Definition at line 342 of file common.h.

#define WPA_BYTE_SWAP_DEFINED

Definition at line 243 of file common.h.

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

Definition at line 249 of file common.h.

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

Definition at line 263 of file common.h.

#define WPA_GET_BE32 (  ) 
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 (  ) 
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 (  )     ((u16) (((a)[1] << 8) | (a)[0]))

Definition at line 256 of file common.h.

#define WPA_GET_LE32 (  ) 
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 (  ) 
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 (  )     strdup((s))

Definition at line 452 of file common.h.

#define WPA_TYPES_DEFINED

Definition at line 165 of file common.h.

#define wpa_unicode2ascii_inplace (  )     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.

typedef int16_t s16

Definition at line 163 of file common.h.

typedef int32_t s32

Definition at line 162 of file common.h.

typedef int64_t s64

Definition at line 161 of file common.h.

typedef int8_t s8

Definition at line 164 of file common.h.

typedef uint16_t u16

Definition at line 159 of file common.h.

typedef uint32_t u32

Definition at line 158 of file common.h.

typedef uint64_t u64

Definition at line 157 of file common.h.

typedef uint8_t u8

Definition at line 160 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.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Fri Jan 11 10:04:12 2013