1 #include <headers.h> 2 #include <datatypes.h> 3 maccpy(u8b dest[16],u8b source[16])4int maccpy( u8b dest[16], u8b source[16] ) 5 { 6 int i; 7 for( i = 0; i < 16; i++ ) 8 dest[i] = source[i]; 9 return 0; 10 } 11 maccmp(u8b dest[16],u8b source[16])12int maccmp( u8b dest[16], u8b source[16] ) 13 { 14 int i; 15 char equal = 0; 16 17 for( i = 0; i < 16; i++ ) 18 if( dest[i] != source[i] ) 19 equal = -1; 20 21 return equal; 22 } 23 str2mac(u8b from[17],u8b to[16])24int str2mac( u8b from[17], u8b to[16] ) 25 { 26 int i, j, length; 27 u8b buffer; 28 u8b dif; 29 30 length = (int)strlen( from ); 31 32 for( i = 0, j = 0; i < length; ) 33 { 34 buffer = 0; 35 while( (from[i] != ':' ) && (from[i]!= '\0' )) 36 { 37 buffer = buffer << 4; 38 (from[i]>57)?(dif=55):(dif=48); 39 buffer += (from[i] - dif); 40 i++; 41 } 42 to[j++] = buffer; 43 i++; 44 } 45 return 0; 46 } 47