software/drivers/sd8887/src/wlan/mapp/mlanconfig/mlanconfig.c
/**
 *  @brief Converts colon separated MAC address to hex value
 *
 *  @param mac      A pointer to the colon separated MAC string
 *  @param raw      A pointer to the hex data buffer
 *  @return         MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 *                  MAC_BROADCAST   - if breadcast mac
 *                  MAC_MULTICAST   - if multicast mac
 */
@brief Converts colon separated MAC address to hex value
@param mac      A pointer to the colon separated MAC string
@param raw      A pointer to the hex data buffer
@return         MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
MAC_BROADCAST   - if breadcast mac
MAC_MULTICAST   - if multicast mac
@brief Converts colon separated MAC address to hex value @param mac A pointer to the colon separated MAC string @param raw A pointer to the hex data buffer @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE MAC_BROADCAST - if breadcast mac MAC_MULTICAST - if multicast mac
static int
mac2raw(char *mac, t_u8 *raw)
{
	unsigned int temp_raw[ETH_ALEN];
	int num_tokens = 0;
	int i;
	if (strlen(mac) != ((2 * ETH_ALEN) + (ETH_ALEN - 1))) {
		return MLAN_STATUS_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 MLAN_STATUS_FAILURE;
	}
	for (i = 0; i < num_tokens; i++)
		raw[i] = (t_u8)temp_raw[i];
	if (memcmp(raw, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) == 0) {
		return MAC_BROADCAST;
	} else if (raw[0] & 0x01) {
		return MAC_MULTICAST;
	}
	return MLAN_STATUS_SUCCESS;
}
static int mac2raw ( char * mac , t_u8 * raw ) { unsigned int temp_raw [ ETH_ALEN ] ; int num_tokens = 0 ; int i ; if ( strlen ( mac ) != ( ( 2 * ETH_ALEN ) + ( ETH_ALEN - 1 ) ) ) { return MLAN_STATUS_FAILURE ; } num_tokens = sscanf ( mac , " " , temp_raw + 0 , temp_raw + 1 , temp_raw + 2 , temp_raw + 3 , temp_raw + 4 , temp_raw + 5 ) ; if ( num_tokens != ETH_ALEN ) { return MLAN_STATUS_FAILURE ; } for ( i = 0 ; i < num_tokens ; i ++ ) raw [ i ] = ( t_u8 ) temp_raw [ i ] ; if ( memcmp ( raw , " \xff \xff \xff \xff \xff \xff " , ETH_ALEN ) == 0 ) { return MAC_BROADCAST ; } else if ( raw [ 0 ] & 0x01 ) { return MAC_MULTICAST ; } return MLAN_STATUS_SUCCESS ; }
@brief Converts colon separated MAC address to hex value
  @param mac      A pointer to the colon separated MAC string
  @param raw      A pointer to the hex data buffer
  @return         MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
                  MAC_BROADCAST   - if breadcast mac
                  MAC_MULTICAST   - if multicast mac
@brief Converts colon separated MAC address to hex value @param mac A pointer to the colon separated MAC string @param raw A pointer to the hex data buffer @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE MAC_BROADCAST - if breadcast mac MAC_MULTICAST - if multicast mac