etherpkt.cc revision 1762
111507SCurtis.Dunham@arm.com/* 211507SCurtis.Dunham@arm.com * Copyright (c) 2004-2005 The Regents of The University of Michigan 311680SCurtis.Dunham@arm.com * All rights reserved. 411680SCurtis.Dunham@arm.com * 511680SCurtis.Dunham@arm.com * Redistribution and use in source and binary forms, with or without 611507SCurtis.Dunham@arm.com * modification, are permitted provided that the following conditions are 711680SCurtis.Dunham@arm.com * met: redistributions of source code must retain the above copyright 811680SCurtis.Dunham@arm.com * notice, this list of conditions and the following disclaimer; 911680SCurtis.Dunham@arm.com * redistributions in binary form must reproduce the above copyright 1011680SCurtis.Dunham@arm.com * notice, this list of conditions and the following disclaimer in the 1111680SCurtis.Dunham@arm.com * documentation and/or other materials provided with the distribution; 1211507SCurtis.Dunham@arm.com * neither the name of the copyright holders nor the names of its 1311507SCurtis.Dunham@arm.com * contributors may be used to endorse or promote products derived from 1411507SCurtis.Dunham@arm.com * this software without specific prior written permission. 1511507SCurtis.Dunham@arm.com * 1611680SCurtis.Dunham@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1711507SCurtis.Dunham@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1811570SCurtis.Dunham@arm.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1911570SCurtis.Dunham@arm.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2011507SCurtis.Dunham@arm.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2111507SCurtis.Dunham@arm.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2211507SCurtis.Dunham@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2311570SCurtis.Dunham@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2411570SCurtis.Dunham@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2511680SCurtis.Dunham@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2611680SCurtis.Dunham@arm.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2711680SCurtis.Dunham@arm.com */ 2811680SCurtis.Dunham@arm.com 2911680SCurtis.Dunham@arm.com#include <iostream> 3011680SCurtis.Dunham@arm.com 3111680SCurtis.Dunham@arm.com#include "base/misc.hh" 3211680SCurtis.Dunham@arm.com#include "dev/etherpkt.hh" 3311570SCurtis.Dunham@arm.com#include "sim/serialize.hh" 3411507SCurtis.Dunham@arm.com 3511570SCurtis.Dunham@arm.comusing namespace std; 3611507SCurtis.Dunham@arm.com 3711570SCurtis.Dunham@arm.comvoid 3811507SCurtis.Dunham@arm.comPacketData::serialize(const string &base, ostream &os) 3911507SCurtis.Dunham@arm.com{ 4011570SCurtis.Dunham@arm.com paramOut(os, base + ".length", length); 4111507SCurtis.Dunham@arm.com arrayParamOut(os, base + ".data", data, length); 4211507SCurtis.Dunham@arm.com} 4311507SCurtis.Dunham@arm.com 4411507SCurtis.Dunham@arm.comvoid 4511507SCurtis.Dunham@arm.comPacketData::unserialize(const string &base, Checkpoint *cp, 4611570SCurtis.Dunham@arm.com const string §ion) 4711507SCurtis.Dunham@arm.com{ 4811507SCurtis.Dunham@arm.com paramIn(cp, section, base + ".length", length); 4911507SCurtis.Dunham@arm.com if (length) 5011507SCurtis.Dunham@arm.com arrayParamIn(cp, section, base + ".data", data, length); 5111507SCurtis.Dunham@arm.com} 5211507SCurtis.Dunham@arm.com