OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2009 University of Pennsylvania |
| 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 |
| 19 #include "chord-transaction.h" |
| 20 #include "ns3/log.h" |
| 21 |
| 22 |
| 23 namespace ns3 { |
| 24 |
| 25 NS_LOG_COMPONENT_DEFINE ("ChordTransaction"); |
| 26 |
| 27 ChordTransaction::ChordTransaction (uint32_t transactionId, ChordMessage chordMe
ssage, Time requestTimeout, uint8_t maxRequestRetries) |
| 28 { |
| 29 NS_LOG_FUNCTION_NOARGS(); |
| 30 m_transactionId = transactionId; |
| 31 m_chordMessage = chordMessage; |
| 32 m_requestTimeout = requestTimeout; |
| 33 m_maxRetries = maxRequestRetries; |
| 34 m_requestTimeoutEventId = EventId (); |
| 35 } |
| 36 |
| 37 ChordTransaction::~ChordTransaction () |
| 38 { |
| 39 //Use DoDispose() |
| 40 } |
| 41 |
| 42 void |
| 43 ChordTransaction::DoDispose () |
| 44 { |
| 45 NS_LOG_FUNCTION_NOARGS(); |
| 46 //cancel timer if running |
| 47 Simulator::Cancel(m_requestTimeoutEventId); |
| 48 } |
| 49 |
| 50 void |
| 51 ChordTransaction::SetRetries (uint8_t retries) |
| 52 { |
| 53 NS_LOG_FUNCTION_NOARGS(); |
| 54 m_retries = retries; |
| 55 } |
| 56 |
| 57 void |
| 58 ChordTransaction::SetMaxRetries (uint8_t maxRetries) |
| 59 { |
| 60 NS_LOG_FUNCTION_NOARGS(); |
| 61 m_maxRetries = maxRetries; |
| 62 } |
| 63 |
| 64 void |
| 65 ChordTransaction::SetRequestTimeoutEventId (EventId eventId) |
| 66 { |
| 67 NS_LOG_FUNCTION_NOARGS(); |
| 68 m_requestTimeoutEventId = eventId; |
| 69 } |
| 70 |
| 71 uint32_t |
| 72 ChordTransaction::GetTransactionId () |
| 73 { |
| 74 NS_LOG_FUNCTION_NOARGS(); |
| 75 return m_transactionId; |
| 76 } |
| 77 |
| 78 uint8_t |
| 79 ChordTransaction::GetRetries () |
| 80 { |
| 81 NS_LOG_FUNCTION_NOARGS(); |
| 82 return m_retries; |
| 83 } |
| 84 |
| 85 uint8_t |
| 86 ChordTransaction::GetMaxRetries () |
| 87 { |
| 88 NS_LOG_FUNCTION_NOARGS (); |
| 89 return m_maxRetries; |
| 90 } |
| 91 |
| 92 Time |
| 93 ChordTransaction::GetRequestTimeout () |
| 94 { |
| 95 NS_LOG_FUNCTION_NOARGS(); |
| 96 return m_requestTimeout; |
| 97 |
| 98 } |
| 99 |
| 100 ChordMessage |
| 101 ChordTransaction::GetChordMessage () |
| 102 { |
| 103 NS_LOG_FUNCTION_NOARGS(); |
| 104 return m_chordMessage; |
| 105 } |
| 106 |
| 107 EventId |
| 108 ChordTransaction::GetRequestTimeoutEventId () |
| 109 { |
| 110 NS_LOG_FUNCTION_NOARGS (); |
| 111 return m_requestTimeoutEventId; |
| 112 } |
| 113 |
| 114 void· |
| 115 ChordTransaction::SetOriginator (ChordTransaction::Originator originator) |
| 116 { |
| 117 m_originator = originator; |
| 118 } |
| 119 |
| 120 ChordTransaction::Originator |
| 121 ChordTransaction::GetOriginator () |
| 122 { |
| 123 return m_originator; |
| 124 } |
| 125 |
| 126 Ptr<ChordIdentifier> |
| 127 ChordTransaction::GetRequestedIdentifier () |
| 128 { |
| 129 return m_requestedIdentifier; |
| 130 } |
| 131 |
| 132 void |
| 133 ChordTransaction::SetRequestedIdentifier (Ptr<ChordIdentifier> requestedIdentifi
er) |
| 134 { |
| 135 m_requestedIdentifier = requestedIdentifier; |
| 136 } |
| 137 |
| 138 } //namespace ns3 |
OLD | NEW |