etherpkt.cc revision 572
111308Santhony.gutierrez@amd.com/* 211308Santhony.gutierrez@amd.com * Copyright (c) 2004 The Regents of The University of Michigan 312697Santhony.gutierrez@amd.com * All rights reserved. 412697Santhony.gutierrez@amd.com * 511308Santhony.gutierrez@amd.com * Redistribution and use in source and binary forms, with or without 612697Santhony.gutierrez@amd.com * modification, are permitted provided that the following conditions are 711308Santhony.gutierrez@amd.com * met: redistributions of source code must retain the above copyright 812697Santhony.gutierrez@amd.com * notice, this list of conditions and the following disclaimer; 912697Santhony.gutierrez@amd.com * redistributions in binary form must reproduce the above copyright 1011308Santhony.gutierrez@amd.com * notice, this list of conditions and the following disclaimer in the 1112697Santhony.gutierrez@amd.com * documentation and/or other materials provided with the distribution; 1212697Santhony.gutierrez@amd.com * neither the name of the copyright holders nor the names of its 1311308Santhony.gutierrez@amd.com * contributors may be used to endorse or promote products derived from 1412697Santhony.gutierrez@amd.com * this software without specific prior written permission. 1512697Santhony.gutierrez@amd.com * 1612697Santhony.gutierrez@amd.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1711308Santhony.gutierrez@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812697Santhony.gutierrez@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912697Santhony.gutierrez@amd.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012697Santhony.gutierrez@amd.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2111308Santhony.gutierrez@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212697Santhony.gutierrez@amd.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312697Santhony.gutierrez@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412697Santhony.gutierrez@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512697Santhony.gutierrez@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612697Santhony.gutierrez@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712697Santhony.gutierrez@amd.com */ 2812697Santhony.gutierrez@amd.com 2912697Santhony.gutierrez@amd.com#include <iostream> 3012697Santhony.gutierrez@amd.com 3112697Santhony.gutierrez@amd.com#include "dev/etherpkt.hh" 3212697Santhony.gutierrez@amd.com#include "sim/serialize.hh" 3311308Santhony.gutierrez@amd.com 3412697Santhony.gutierrez@amd.comusing namespace std; 3511308Santhony.gutierrez@amd.com 3611308Santhony.gutierrez@amd.comvoid 3711308Santhony.gutierrez@amd.comEtherPacket::serialize(ostream &os) 3811308Santhony.gutierrez@amd.com{ 3911308Santhony.gutierrez@amd.com SERIALIZE_SCALAR(length); 4011308Santhony.gutierrez@amd.com SERIALIZE_ARRAY(data, length); 4111308Santhony.gutierrez@amd.com} 4211692Santhony.gutierrez@amd.com 4311308Santhony.gutierrez@amd.comvoid 4411308Santhony.gutierrez@amd.comEtherPacket::unserialize(Checkpoint *cp, const std::string §ion) 4511308Santhony.gutierrez@amd.com{ 4611308Santhony.gutierrez@amd.com UNSERIALIZE_SCALAR(length); 4711308Santhony.gutierrez@amd.com data = new uint8_t[length]; 4811308Santhony.gutierrez@amd.com UNSERIALIZE_ARRAY(data, length); 4911308Santhony.gutierrez@amd.com} 5011308Santhony.gutierrez@amd.com 5111308Santhony.gutierrez@amd.com