A Discrete-Event Network Simulator
API
sll-header.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015 Université Pierre et Marie Curie
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: Matthieu Coudron <matthieu.coudron@lip6.fr>
19  */
20 #ifndef SLL_HEADER_H
21 #define SLL_HEADER_H
22 
23 #include "ns3/buffer.h"
24 #include "ns3/header.h"
25 #include <stdint.h>
26 
27 namespace ns3 {
28 
64 class SllHeader : public Header
65 {
66 public:
67 
72  {
77  SENT_BY_US
78  };
79 
84  static TypeId GetTypeId (void);
85 
86  SllHeader ();
87  virtual ~SllHeader ();
88 
93  uint16_t GetArpType () const;
94 
98  void SetArpType (uint16_t arphdType);
99 
103  enum PacketType GetPacketType () const;
104 
108  void SetPacketType (PacketType type);
109 
110  // Inherited from ObjectBase
111  virtual TypeId GetInstanceTypeId (void) const;
112  // Inherited from Header
113  virtual uint32_t GetSerializedSize (void) const;
114  virtual void Serialize (Buffer::Iterator start) const;
115  virtual uint32_t Deserialize (Buffer::Iterator start);
116  virtual void Print (std::ostream &os) const;
117 
118 protected:
119  // declared in packet order
121  uint16_t m_arphdType;
122  uint16_t m_addressLength;
123  uint64_t m_address;
124  uint16_t m_protocolType;
125 };
126 
127 } // namespace ns3
128 
129 #endif /* SLL_HEADER_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.
Protocol header serialization and deserialization.
Definition: sll-header.h:65
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: sll-header.cc:58
static TypeId GetTypeId(void)
Get the type ID.
Definition: sll-header.cc:47
void SetArpType(uint16_t arphdType)
Definition: sll-header.cc:70
uint16_t m_addressLength
Address length.
Definition: sll-header.h:122
virtual ~SllHeader()
Definition: sll-header.cc:40
uint16_t GetArpType() const
Definition: sll-header.cc:64
PacketType m_packetType
Packet type.
Definition: sll-header.h:120
PacketType
Type of the packet.
Definition: sll-header.h:72
@ BROADCAST_BY_PEER
packet was broadcast by somebody else
Definition: sll-header.h:74
@ INTERCEPTED_PACKET
packet was sent to somebody else by somebody else
Definition: sll-header.h:76
@ UNICAST_FROM_PEER_TO_ME
the packet was specifically sent to us by somebody else
Definition: sll-header.h:73
@ MULTICAST_BY_PEER
packet was multicast, but not broadcast, by somebody else
Definition: sll-header.h:75
@ SENT_BY_US
the packet was sent by us
Definition: sll-header.h:77
uint16_t m_arphdType
ARP protocol hardware identifier.
Definition: sll-header.h:121
virtual uint32_t GetSerializedSize(void) const
Definition: sll-header.cc:96
enum PacketType GetPacketType() const
Definition: sll-header.cc:77
void SetPacketType(PacketType type)
Definition: sll-header.cc:83
uint16_t m_protocolType
protocol type
Definition: sll-header.h:124
uint64_t m_address
Address.
Definition: sll-header.h:123
virtual void Print(std::ostream &os) const
Definition: sll-header.cc:90
virtual void Serialize(Buffer::Iterator start) const
Definition: sll-header.cc:102
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1853