src/devices/csma-cd/backoff.h
changeset 1737 e72c130c3a59
parent 1728 190372a33951
parent 1312 8bc3f26344b9
child 1738 6a3e37af9d24
--- a/src/devices/csma-cd/backoff.h	Mon Jul 30 14:48:56 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 Emmanuelle Laprise
- *
- * 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca
- * Derived from the p2p net device file
-Transmi */
-
-#ifndef BACKOFF_H
-#define BACKOFF_H
-
-#include <stdint.h>
-#include "ns3/nstime.h"
-#include "ns3/random-variable.h"
-
-namespace ns3 {
-
-  /**
-   * \brief The backoff class is used for calculating backoff times
-   * when many net devices can write to the same channel
-   *
-   */
-
-class Backoff {
-public:
-  uint32_t m_minSlots; // Minimum number of backoff slots (when
-                       // multiplied by m_slotTime, determines minimum
-                       // backoff time)
-  uint32_t m_maxSlots; // Maximim number of backoff slots (when
-                       // multiplied by m_slotTime, determines
-                       // maximum backoff time)
-  uint32_t m_ceiling;  // Caps the exponential function when the
-                       // number of retries reaches m_ceiling
-  uint32_t m_maxRetries; // Maximum number of transmission retries
-                         // before the packet is dropped.
-  Time     m_slotTime; // Length of one slot. A slot time, it usually
-                       // the packet transmission time, if the packet
-                       // size is fixed.
-
-  Backoff();
-  Backoff(Time slotTime, uint32_t minSlots, uint32_t maxSlots, 
-          uint32_t ceiling, uint32_t maxRetries);
-
-  /**
-   * \return The amount of time that the net device should wait before
-   * trying to retransmit the packet
-   */
-  Time GetBackoffTime();
-  /**
-   * Indicates to the backoff object that the last packet was
-   * successfully transmitted and that the number of retries should be
-   * reset to 0.
-   */
-  void ResetBackoffTime();
-  /**
-   * \return True if the maximum number of retries has been reached
-   */
-  bool MaxRetriesReached();
-  /**
-   * Increments the number of retries by 1.
-   */
-  void IncrNumRetries();
-
-private:
-  uint32_t m_numBackoffRetries; // Number of times that the
-                                // transmitter has tried to
-                                // unsuccessfully transmit the current
-                                // packet
-};
-
-}; // namespace ns3
-
-#endif // BACKOFF_H
-