OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
| 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: Manuel Requena <manuel.requena@cttc.es> |
| 19 */ |
| 20 |
| 21 #ifndef NIST_LTE_RLC_AM_HEADER_H |
| 22 #define NIST_LTE_RLC_AM_HEADER_H |
| 23 |
| 24 #include "ns3/header.h" |
| 25 #include "ns3/nist-lte-rlc-sequence-number.h" |
| 26 |
| 27 #include <list> |
| 28 |
| 29 namespace ns3 { |
| 30 |
| 31 /** |
| 32 * \ingroup lte |
| 33 * \brief The packet header for the AM Radio Link Control (RLC) protocol packets |
| 34 * |
| 35 * This class has fields corresponding to those in an RLC header as well as |
| 36 * methods for serialization to and deserialization from a byte buffer. |
| 37 * It follows 3GPP TS 36.322 Radio Link Control (RLC) protocol specification. |
| 38 */ |
| 39 class NistLteRlcAmHeader : public Header |
| 40 { |
| 41 public: |
| 42 |
| 43 /** |
| 44 * \brief Constructor |
| 45 * |
| 46 * Creates a null header |
| 47 */ |
| 48 NistLteRlcAmHeader (); |
| 49 ~NistLteRlcAmHeader (); |
| 50 |
| 51 void SetDataPdu (void); |
| 52 void SetControlPdu (uint8_t controlPduType); |
| 53 bool IsDataPdu (void) const; |
| 54 bool IsControlPdu (void) const; |
| 55 |
| 56 typedef enum { |
| 57 CONTROL_PDU = 0, |
| 58 DATA_PDU = 1 |
| 59 } DataControlPdu_t; |
| 60 |
| 61 typedef enum { |
| 62 STATUS_PDU = 000, |
| 63 } ControPduType_t; |
| 64 |
| 65 // |
| 66 // DATA PDU |
| 67 // |
| 68 |
| 69 void SetSequenceNumber (NistSequenceNumber10 sequenceNumber); |
| 70 NistSequenceNumber10 GetSequenceNumber () const; |
| 71 |
| 72 void SetFramingInfo (uint8_t framingInfo); |
| 73 uint8_t GetFramingInfo () const; |
| 74 |
| 75 typedef enum { |
| 76 FIRST_BYTE = 0x00, |
| 77 NO_FIRST_BYTE = 0x02 |
| 78 } FramingInfoFirstByte_t; |
| 79 |
| 80 typedef enum { |
| 81 LAST_BYTE = 0x00, |
| 82 NO_LAST_BYTE = 0x01 |
| 83 } FramingInfoLastByte_t; |
| 84 |
| 85 void PushExtensionBit (uint8_t extensionBit); |
| 86 void PushLengthIndicator (uint16_t lengthIndicator); |
| 87 |
| 88 uint8_t PopExtensionBit (void); |
| 89 uint16_t PopLengthIndicator (void); |
| 90 |
| 91 typedef enum { |
| 92 DATA_FIELD_FOLLOWS = 0, |
| 93 E_LI_FIELDS_FOLLOWS = 1 |
| 94 } ExtensionBit_t; |
| 95 |
| 96 void SetResegmentationFlag (uint8_t resegFlag); |
| 97 uint8_t GetResegmentationFlag () const; |
| 98 |
| 99 typedef enum { |
| 100 PDU = 0, |
| 101 SEGMENT = 1 |
| 102 } ResegmentationFlag_t; |
| 103 |
| 104 void SetPollingBit (uint8_t pollingBit); |
| 105 uint8_t GetPollingBit () const; |
| 106 |
| 107 typedef enum { |
| 108 STATUS_REPORT_NOT_REQUESTED = 0, |
| 109 STATUS_REPORT_IS_REQUESTED = 1 |
| 110 } PollingBit_t; |
| 111 |
| 112 void SetLastSegmentFlag (uint8_t lsf); |
| 113 uint8_t GetLastSegmentFlag () const; |
| 114 |
| 115 typedef enum { |
| 116 NO_LAST_PDU_SEGMENT = 0, |
| 117 LAST_PDU_SEGMENT = 1 |
| 118 } LastSegmentFlag_t; |
| 119 |
| 120 void SetSegmentOffset (uint16_t segmentOffset); |
| 121 uint16_t GetSegmentOffset () const; |
| 122 uint16_t GetLastOffset () const; |
| 123 |
| 124 // |
| 125 // CONTROL PDU |
| 126 // |
| 127 |
| 128 void SetAckSn (NistSequenceNumber10 ackSn); |
| 129 NistSequenceNumber10 GetAckSn () const; |
| 130 |
| 131 |
| 132 static TypeId GetTypeId (void); |
| 133 virtual TypeId GetInstanceTypeId (void) const; |
| 134 virtual void Print (std::ostream &os) const; |
| 135 virtual uint32_t GetSerializedSize (void) const; |
| 136 virtual void Serialize (Buffer::Iterator start) const; |
| 137 virtual uint32_t Deserialize (Buffer::Iterator start); |
| 138 |
| 139 private: |
| 140 uint16_t m_headerLength; |
| 141 uint8_t m_dataControlBit; |
| 142 |
| 143 // Data PDU fields |
| 144 uint8_t m_resegmentationFlag; |
| 145 uint8_t m_pollingBit; |
| 146 uint8_t m_framingInfo; // 2 bits |
| 147 NistSequenceNumber10 m_sequenceNumber; |
| 148 uint8_t m_lastSegmentFlag; |
| 149 uint16_t m_segmentOffset; |
| 150 uint16_t m_lastOffset; |
| 151 |
| 152 std::list <uint8_t> m_extensionBits; // Includes extensionBit of the fixed par
t |
| 153 std::list <uint16_t> m_lengthIndicators; |
| 154 |
| 155 // Control PDU fields |
| 156 uint8_t m_controlPduType; |
| 157 |
| 158 // NistStatus PDU fields |
| 159 NistSequenceNumber10 m_ackSn; |
| 160 NistSequenceNumber10 m_nackSn; |
| 161 |
| 162 std::list <uint8_t> m_extensionBits1; // Includes E1 after ACK_SN |
| 163 std::list <uint8_t> m_extensionBits2; |
| 164 |
| 165 }; |
| 166 |
| 167 }; // namespace ns3 |
| 168 |
| 169 #endif // NIST_LTE_RLC_AM_HEADER_H |
OLD | NEW |