A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
cognitive-packet-tags.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006,2007 INRIA
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:
19  * Abdulla Al-Ali <al-ali.a@husky.neu.edu>
20  */
21 
22 #ifndef COGNITIVE_PACKET_TAGS_H_
23 #define COGNITIVE_PACKET_TAGS_H_
24 
25 #include "ns3/tag.h"
26 
27 namespace ns3 {
28 
29 enum PacketType
30 {
31  CTRL_PACKET = 1, //for packets destined to ctrl interface
32  DATA_PACKET = 2 //for packets destined to tx interface
33 };
34 
35 class PacketTypePacketTag : public Tag
36 {
37 public:
38 
39  PacketTypePacketTag (PacketType t = CTRL_PACKET);
40  static TypeId GetTypeId (void);
41  virtual TypeId GetInstanceTypeId (void) const;
42  virtual uint32_t GetSerializedSize (void) const;
43  virtual void Serialize (TagBuffer i) const;
44  virtual void Deserialize (TagBuffer i);
45 
46  void Print (std::ostream &os) const;
47  void Set (PacketType m_type);
48  PacketType Get () const { return m_type; }
49 
50 private:
51  PacketType m_type;
52 };
53 
55 {
56 public:
57 
58  PacketChannelPacketTag (uint16_t t = 0);
59  static TypeId GetTypeId (void);
60  virtual TypeId GetInstanceTypeId (void) const;
61  virtual uint32_t GetSerializedSize (void) const;
62  virtual void Serialize (TagBuffer i) const;
63  virtual void Deserialize (TagBuffer i);
64 
65  void Print (std::ostream &os) const;
66  uint16_t GetChannel () const { return m_channel; }
67 
68 private:
69  uint16_t m_channel;
70 };
71 
72 }
73 #endif /* COGNITIVE_PACKET_TAGS_H_ */
virtual void Deserialize(TagBuffer i)
virtual uint32_t GetSerializedSize(void) const
virtual void Deserialize(TagBuffer i)
virtual TypeId GetInstanceTypeId(void) const
virtual uint32_t GetSerializedSize(void) const
tag a set of bytes in a packet
Definition: tag.h:36
void Print(std::ostream &os) const
read and write tag data
Definition: tag-buffer.h:51
virtual void Serialize(TagBuffer i) const
a unique identifier for an interface.
Definition: type-id.h:44
virtual TypeId GetInstanceTypeId(void) const
virtual void Serialize(TagBuffer i) const
void Print(std::ostream &os) const