A Discrete-Event Network Simulator
API
uan-header-common.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Leonard Tracy <lentracy@gmail.com>
19  */
20 
21 #ifndef UAN_HEADER_COMMON_H
22 #define UAN_HEADER_COMMON_H
23 
24 #include "ns3/header.h"
25 #include "ns3/nstime.h"
26 #include "ns3/simulator.h"
27 #include "ns3/mac8-address.h"
28 
29 namespace ns3 {
30 
37 {
38  uint8_t m_type : 4;
39  uint8_t m_protocolNumber : 4;
40 };
41 
64 class UanHeaderCommon : public Header
65 {
66 public:
68  UanHeaderCommon ();
78  UanHeaderCommon (const Mac8Address src, const Mac8Address dest, uint8_t type, uint8_t protocolNumber);
80  virtual ~UanHeaderCommon ();
81 
86  static TypeId GetTypeId (void);
87 
93  void SetDest (Mac8Address dest);
99  void SetSrc (Mac8Address src);
106  void SetType (uint8_t type);
113  void SetProtocolNumber (uint16_t protocolNumber);
114 
120  Mac8Address GetDest (void) const;
126  Mac8Address GetSrc (void) const;
132  uint8_t GetType (void) const;
138  uint16_t GetProtocolNumber (void) const;
139 
140  // Inherited methods
141  virtual uint32_t GetSerializedSize (void) const;
142  virtual void Serialize (Buffer::Iterator start) const;
143  virtual uint32_t Deserialize (Buffer::Iterator start);
144  virtual void Print (std::ostream &os) const;
145  virtual TypeId GetInstanceTypeId (void) const;
146 private:
150 
151 }; // class UanHeaderCommon
152 
153 } // namespace ns3
154 
155 #endif /* UAN_HEADER_COMMON_H */
iterator in a Buffer instance
Definition: buffer.h:99
Protocol header serialization and deserialization.
Definition: header.h:43
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
A class used for addressing MAC8 MAC's.
Definition: mac8-address.h:43
a unique identifier for an interface.
Definition: type-id.h:59
Common packet header fields.
virtual ~UanHeaderCommon()
Destructor.
virtual void Print(std::ostream &os) const
void SetSrc(Mac8Address src)
Set the source address.
uint8_t GetType(void) const
Get the header type value.
virtual void Serialize(Buffer::Iterator start) const
Mac8Address m_dest
The destination address.
static TypeId GetTypeId(void)
Register this type.
Mac8Address m_src
The source address.
UanHeaderCommon()
Default constructor.
virtual uint32_t GetSerializedSize(void) const
Mac8Address GetSrc(void) const
Get the source address.
Mac8Address GetDest(void) const
Get the destination address.
void SetProtocolNumber(uint16_t protocolNumber)
Set the packet type.
UanProtocolBits m_uanProtocolBits
The type and protocol bits.
void SetDest(Mac8Address dest)
Set the destination address.
void SetType(uint8_t type)
Set the header type.
uint16_t GetProtocolNumber(void) const
Get the packet type value.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1853
UAN protocol descriptor.
uint8_t m_protocolNumber
protocol number (4 bits)
uint8_t m_type
type (4 bits)