package jos.system.net.jeps;
/************************
* Hardware MAC Address *
************************/
/*
* NOTE:
* This class is extremely messy, slow and cubersome.
* Usually in C these things are handled with a
* couple of structs, arrays and typecasts, but
* this does not work really well in Java.
* If you find a better solution, feel free to
* improve.
*/
class HWAddr
{
// The 6 octets of the MAC adress.
private byte[] oct;
/* private byte oct2;
private byte oct3;
private byte oct4;
private byte oct5;
private byte oct6; */
HWAddr()
{
oct=null;
}
HWAddr (byte a,byte b,byte c,byte d,byte e,byte f)
{
oct = new byte[6];
oct[0]=a;
oct[1]=b;
oct[2]=c;
oct[3]=d;
oct[4]=e;
oct[5]=f;
}
public boolean equals(HWAddr hwa)
{
if ((oct[1]==hwa.oct[1]) &&
(oct[2]==hwa.oct[2]) &&
(oct[3]==hwa.oct[3]) &&
(oct[4]==hwa.oct[4]) &&
(oct[5]==hwa.oct[5]) &&
(oct[0]==hwa.oct[0]))
{ return true;}
else
{ return false;}
}
public String toString()
{
return oct[0]+":"+oct[1]+":"+oct[2]+":"+oct[3]+":"+oct[4]+":"+oct[5];
}
public byte[] getData()
{
return oct;
}
public void setData(byte[] data)
{
oct=data;
}
};