Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

MACAddress.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003 CTIE, Monash University
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #ifndef MACADDRESS_H_
00020 #define MACADDRESS_H_
00021 
00022 #include <omnetpp.h>
00023 #include "MACAddress_m.h"
00024 
00025 
00026 #define MAC_ADDRESS_BYTES    6
00027 
00028 
00032 class MACAddress : public MACAddress_Base
00033 {
00034   private:
00035     unsigned char address[6];
00036 
00037   public:
00041     MACAddress();
00045     MACAddress(const char *hexstr);
00049     MACAddress(const MACAddress& other) : MACAddress_Base() {operator=(other);}
00053     MACAddress& operator=(const MACAddress& other);
00057     virtual unsigned int getAddressArraySize() const;
00061     virtual unsigned char getAddress(unsigned int k) const;
00065     virtual void setAddress(unsigned int k, unsigned char addrbyte);
00070     void setAddress(const char *hexstr);
00074     unsigned char *getAddressBytes() {return address;}
00078     void setAddressBytes(unsigned char *addrbytes);
00082     void setBroadcast();
00086     bool isBroadcast() const;
00090     bool isMulticast() const  {return address[0]&0x80;};
00094     bool isEmpty() const;
00098     const char *toHexString(char *buf) const;
00102     bool equals(const MACAddress& other) const;
00106     int compareTo(const MACAddress& other) const;
00107 };
00108 
00109 #endif

Generated on Sat May 15 20:30:43 2004 for Ethernet by doxygen1.2.17