example/ipsec_crypto/odp_ipsec_misc.h
static inline
int parse_mac_string(char *macaddress, uint8_t *mac)
{
	unsigned int macwords[ODPH_ETHADDR_LEN];
	int converted;

	converted = sscanf(macaddress,
			   "%x:%x:%x:%x:%x:%x",
			   &macwords[0], &macwords[1], &macwords[2],
			   &macwords[3], &macwords[4], &macwords[5]);
	if (6 != converted)
		return -1;

	mac[0] = macwords[0];
	mac[1] = macwords[1];
	mac[2] = macwords[2];
	mac[3] = macwords[3];
	mac[4] = macwords[4];
	mac[5] = macwords[5];

	return 0;
}
/**
 * Parse text string representing a MAC address into byte araray
 *
 * String is of the format "XX:XX:XX:XX:XX:XX" where XX is hexadecimal
 *
 * @param macaddress  Pointer to MAC address string to convert
 * @param mac         Pointer to MAC address byte array to populate
 *
 * @return 0 if successful else -1
 */


@param macaddress  Pointer to MAC address string to convert
@param mac         Pointer to MAC address byte array to populate

@return 0 if successful else -1
@param macaddress Pointer to MAC address string to convert @param mac Pointer to MAC address byte array to populate @return 0 if successful else - 1
static inline
int parse_mac_string(char *macaddress, uint8_t *mac)
{
	unsigned int macwords[ODPH_ETHADDR_LEN];
	int converted;
	converted = sscanf(macaddress,
			   "%x:%x:%x:%x:%x:%x",
			   &macwords[0], &macwords[1], &macwords[2],
			   &macwords[3], &macwords[4], &macwords[5]);
	if (6 != converted)
		return -1;
	mac[0] = macwords[0];
	mac[1] = macwords[1];
	mac[2] = macwords[2];
	mac[3] = macwords[3];
	mac[4] = macwords[4];
	mac[5] = macwords[5];
	return 0;
}
static inline int parse_mac_string ( char * macaddress , uint8_t * mac ) { unsigned int macwords [ ODPH_ETHADDR_LEN ] ; int converted ; converted = sscanf ( macaddress , " " , & macwords [ 0 ] , & macwords [ 1 ] , & macwords [ 2 ] , & macwords [ 3 ] , & macwords [ 4 ] , & macwords [ 5 ] ) ; if ( 6 != converted ) return -1 ; mac [ 0 ] = macwords [ 0 ] ; mac [ 1 ] = macwords [ 1 ] ; mac [ 2 ] = macwords [ 2 ] ; mac [ 3 ] = macwords [ 3 ] ; mac [ 4 ] = macwords [ 4 ] ; mac [ 5 ] = macwords [ 5 ] ; return 0 ; }
Parse text string representing a MAC address into byte araray
 String is of the format "XX:XX:XX:XX:XX:XX" where XX is hexadecimal
Parse text string representing a MAC address into byte araray String is of the format " XX : XX : XX : XX : XX : XX " where XX is hexadecimal