1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef FLOW_ID_TAG_H
21 #define FLOW_ID_TAG_H
22 
23 #include "ns3/tag.h"
24 
25 namespace ns3 {
26 
27 class FlowIdTag : public Tag
28 {
29 public:
30   /**
31    * \brief Get the type ID.
32    * \return the object TypeId
33    */
34   static TypeId GetTypeId (void);
35   virtual TypeId GetInstanceTypeId (void) const;
36   virtual uint32_t GetSerializedSize (void) const;
37   virtual void Serialize (TagBuffer buf) const;
38   virtual void Deserialize (TagBuffer buf);
39   virtual void Print (std::ostream &os) const;
40   FlowIdTag ();
41 
42   /**
43    *  Constructs a FlowIdTag with the given flow id
44    *
45    *  \param flowId Id to use for the tag
46    */
47   FlowIdTag (uint32_t flowId);
48   /**
49    *  Sets the flow id for the tag
50    *  \param flowId Id to assign to the tag
51    */
52   void SetFlowId (uint32_t flowId);
53   /**
54    *  Gets the flow id for the tag
55    *  \returns current flow id for this tag
56    */
57   uint32_t GetFlowId (void) const;
58   /**
59    *  Uses a static variable to generate sequential flow id
60    *  \returns flow id allocated
61    */
62   static uint32_t AllocateFlowId (void);
63 private:
64   uint32_t m_flowId; //!< Flow ID
65 };
66 
67 } // namespace ns3
68 
69 #endif /* FLOW_ID_TAG_H */
70