From 20aaaf2cc5fd9f37ed570322b349ec3d909feada Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Fri, 15 Apr 2011 23:48:38 +0100 Subject: [PATCH] Inital bpdu details --- src/devices/bridge/model/bpdu-header.h | 117 +++++++++++++++++++++++++ src/devices/bridge/wscript | 1 + 2 files changed, 118 insertions(+) create mode 100644 src/devices/bridge/model/bpdu-header.h diff --git a/src/devices/bridge/model/bpdu-header.h b/src/devices/bridge/model/bpdu-header.h new file mode 100644 index 0000000..5126ea7 --- /dev/null +++ b/src/devices/bridge/model/bpdu-header.h @@ -0,0 +1,117 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2005 INRIA + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Richard Whitehouse + */ + +#ifndef BRIDGE_BPDU_HEADER_H +#define BRIDGE_BPDU_HEADER_H + +#include "ns3/header.h" +#include "ns3/address.h" +#include "ns3/ipv4-address.h" +#include + +namespace ns3 { +/** + * \ingroup bridge + * \brief The packet header for an Bridge Protocol Data Unit (BPDU) packet header + */ + +class BpduHeader : public Header { + +public: + + uint16_t getProtocol(); + uint8_t getVersion(); + uint8_t getType(); + + void setProtocol(uint16_t); + void setVersion(uint8_t); + void setType(uint8_t); + + static TypeId GetTypeId (void); + virtual TypeId GetInstanceTypeId (void) const; + virtual void Print (std::ostream &os) const; + virtual uint32_t GetSerializedSize (void) const; + virtual void Serialize (Buffer::Iterator start) const; + virtual uint32_t Deserialize (Buffer::Iterator start); + +private; + + uint16_t protocolIdentifier; + uint8_t versionIdentifier; + uint8_t bpduType; + + +}; + +/** + * \ingroup bridge + * \brief The packet header for an Configuration BPDU packet header + */ + + +class ConfigurationBpduHeader : public Header { + +public: + + + + + static TypeId GetTypeId (void); + virtual TypeId GetInstanceTypeId (void) const; + virtual void Print (std::ostream &os) const; + virtual uint32_t GetSerializedSize (void) const; + virtual void Serialize (Buffer::Iterator start) const; + virtual uint32_t Deserialize (Buffer::Iterator start); + +}; + +/** + * \ingroup bridge + * \brief The packet header for an Topology Change Notification BPDU packet header + */ + + +class TcnBpduHeader : public Header { + +public: + + static TypeId GetTypeId (void); + virtual TypeId GetInstanceTypeId (void) const; + virtual void Print (std::ostream &os) const; + virtual uint32_t GetSerializedSize (void) const; + virtual void Serialize (Buffer::Iterator start) const; + virtual uint32_t Deserialize (Buffer::Iterator start); + + +}; + +/** + * \ingroup bridge + * \brief The packet header for an Rapid Spanning Tree BPDU packet header + */ + + +class RstBpduHeader : public Header { + +}; + + +#endif + diff --git a/src/devices/bridge/wscript b/src/devices/bridge/wscript index a8738f9..2cf17d1 100644 --- a/src/devices/bridge/wscript +++ b/src/devices/bridge/wscript @@ -14,6 +14,7 @@ def build(bld): headers = bld.new_task_gen('ns3header') headers.module = 'bridge' headers.source = [ + 'model/bpdu-header.h', 'model/moose-bridge-port-net-device.h', 'model/moose-bridge-net-device.h', 'model/bridge-net-device.h', -- 2.34.1