link_addr.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Function implementations to convert between link layer addresses and 2N/A * ascii representations of the form "x:x:x:...:x:x:x" where x is a hex 2N/A * number between 0x00 and 0xff; the bytes are always in network order. 2N/A * Converts a "size" bytes long mac address to its string representation. 2N/A * Currently, the "mactype" is unused, but in the future, the string 2N/A * Converts a string possibly representing a link address into its 2N/A * bit format, returning length of the address in bytes. 2N/A * Find how many :'s in the string. Also sanity check 2N/A * the string for valid hex chars, absence of white 2N/A * spaces, not starting or ending with :, absence of 2N/A * consecutive :'s, excessive digits per element 2N/A * and non-null string. 2N/A * We must have hit a whitespace. Stop