00001 // 00002 // Copyright (C) 2008-2009 Reto Gantenbein 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (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, see http://www.gnu.org/licenses/. 00016 // 00017 00018 #include <MACAddress.h> 00019 #include <Ieee802Ctrl_m.h> 00020 #include "RAWEtherFrame.h" 00021 00022 Register_Class(RAWEtherFrame); 00023 00024 RAWEtherFrame::RAWEtherFrame(const char *name, int kind) : RAWEtherFrame_Base(name, kind) 00025 { 00026 name = NULL; 00027 kind = 0; 00028 } 00029 00030 RAWEtherFrame::RAWEtherFrame(const RAWEtherFrame& other) : RAWEtherFrame_Base(other.getName()) 00031 { 00032 operator=(other); 00033 } 00034 00035 RAWEtherFrame& RAWEtherFrame::operator=(const RAWEtherFrame& other) 00036 { 00037 RAWEtherFrame_Base::operator=(other); 00038 return *this; 00039 } 00040 00044 void RAWEtherFrame::setDest() 00045 { 00046 int i; 00047 unsigned char destMac[ETH_ALEN]; 00048 char *charPtr = (char *) &destMac; 00049 00050 for (i = 0; i < 6; i++) 00051 { 00052 *charPtr = getRawBytes(i); 00053 charPtr++; 00054 } 00055 // printf("\nMACAddress: %02x:%02x:%02x:%02x:%02x:%02x\n", destMac[0], destMac[1], destMac[2], destMac[3], destMac[4], destMac[5]); 00056 00057 MACAddress macAddr; 00058 macAddr.setAddressBytes((unsigned char *) destMac); 00059 00060 Ieee802Ctrl *controlInfo = new Ieee802Ctrl(); 00061 controlInfo->setDest(macAddr); 00062 setControlInfo(controlInfo); 00063 }