Logo Search packages:      
Sourcecode: uaputl version File versions  Download package

int mac2raw ( char *  mac,
u8 raw 
)

Converts colon separated MAC address to hex value.

Function Prototype Declaration

Parameters:
macA pointer to the colon separated MAC string
rawA pointer to the hex data buffer
Returns:
UAP_SUCCESS or UAP_FAILURE UAP_RET_MAC_BROADCAST - if broadcast mac UAP_RET_MAC_MULTICAST - if multicast mac

Definition at line 4875 of file uaputl.c.

References ETH_ALEN, UAP_FAILURE, UAP_RET_MAC_BROADCAST, UAP_RET_MAC_MULTICAST, and UAP_SUCCESS.

Referenced by apcmd_sta_deauth(), apcmd_sta_filter_table(), apcmd_sys_cfg_ap_mac_address(), and apcmd_sys_config_profile().

{
    unsigned int temp_raw[ETH_ALEN];
    int num_tokens = 0;
    int i;
    if (strlen(mac) != ((2 * ETH_ALEN) + (ETH_ALEN - 1))) {
        return UAP_FAILURE;
    }
    num_tokens = sscanf(mac, "%2x:%2x:%2x:%2x:%2x:%2x",
                        temp_raw + 0, temp_raw + 1, temp_raw + 2, temp_raw + 3,
                        temp_raw + 4, temp_raw + 5);
    if (num_tokens != ETH_ALEN) {
        return UAP_FAILURE;
    }
    for (i = 0; i < num_tokens; i++)
        raw[i] = (u8) temp_raw[i];

    if (memcmp(raw, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) == 0) {
        return UAP_RET_MAC_BROADCAST;
    } else if (raw[0] & 0x01) {
        return UAP_RET_MAC_MULTICAST;
    }
    return UAP_SUCCESS;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index