Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(957)

Unified Diff: src/ltp-protocol/model/ltp-queue-set.h

Issue 123190043: LTP final code review
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ltp-protocol/model/ltp-queue-set.h
===================================================================
new file mode 100755
--- /dev/null
+++ b/src/ltp-protocol/model/ltp-queue-set.h
@@ -0,0 +1,90 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014 Universitat Autònoma de Barcelona
+ *
+ * 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: Rubén Martínez <rmartinez@deic.uab.cat>
+ */
+
+#ifndef LTP_QUEUE_SET_H
+#define LTP_QUEUE_SET_H
+
+#include "ns3/packet.h"
+#include "ns3/queue.h"
+#include "ltp-header.h"
+
+#include <queue>
+
+
+namespace ns3 {
+namespace ltp {
+
+/**
+ * \ingroup dtn
+ *
+ * \brief Queue set class containing the two queues for outbound traffic.
+ * Represents the dual queue structure and priority en/de-queueing policy described in
+ * RFC 5325 - 3.1.2 Deferred Transmission.
+ */
+class LtpQueueSet : public Queue
+{
+public:
+ /**
+ * \brief Get Type Id.
+ * \return the object TypeId
+ */
+ static TypeId GetTypeId (void);
+
+ /**
+ * \brief LtpQueueSet Constructor
+ *
+ * Create a ltp queue pair
+ */
+ LtpQueueSet ();
+
+ /**
+ * \brief Destructor
+ * Destructor
+ */
+ virtual ~LtpQueueSet ();
+
+private:
+ /**
+ * Push a packet in the queue set, this method checks the LTP Segment type and enqueues
+ * it in the corresponding priority queue.
+ * \param p the packet to enqueue
+ * \return true if success, false on failure.
+ */
+ virtual bool DoEnqueue (Ptr<Packet> p);
+ /**
+ * Pull a packet from the queue based on priority (internal operation queue packets are extracted first)
+ * \return the packet.
+ */
+ virtual Ptr<Packet> DoDequeue (void);
+ /**
+ * Peek the front packet based on priority
+ * \return the packet.
+ */
+ virtual Ptr<const Packet> DoPeek (void) const;
+
+ std::queue<Ptr<Packet> > m_internalOps; //!< Internal Operation Queue.
+ std::queue<Ptr<Packet> > m_appData; //!< Application Data Queue.
+};
+
+} // namespace ltp
+} // namespace ns3
+
+
+#endif /* LTP_QUEUE_SET_H_ */

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b