A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
amsdu-subframe-header.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 MIRKO BANCHI
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: Mirko Banchi <mk.banchi@gmail.com>
19  */
20 #include "amsdu-subframe-header.h"
21 #include "ns3/address-utils.h"
22 
23 namespace ns3 {
24 
25 NS_OBJECT_ENSURE_REGISTERED (AmsduSubframeHeader);
26 
27 TypeId
29 {
30  static TypeId tid = TypeId ("ns3::AmsduSubframeHeader")
31  .SetParent<Header> ()
32  .AddConstructor<AmsduSubframeHeader> ()
33  ;
34  return tid;
35 }
36 
37 TypeId
39 {
40  return GetTypeId ();
41 }
42 
44  : m_length (0)
45 {
46 }
47 
49 {
50 }
51 
52 uint32_t
54 {
55  return (6 + 6 + 2);
56 }
57 
58 void
60 {
61  WriteTo (i, m_da);
62  WriteTo (i, m_sa);
64 }
65 
66 uint32_t
68 {
70  ReadFrom (i, m_da);
71  ReadFrom (i, m_sa);
72  m_length = i.ReadLsbtohU16 ();
73  return i.GetDistanceFrom (start);
74 }
75 
76 void
77 AmsduSubframeHeader::Print (std::ostream &os) const
78 {
79  os << "DA = " << m_da << ", SA = " << m_sa << ", length = " << m_length;
80 }
81 
82 void
84 {
85  m_da = to;
86 }
87 
88 void
90 {
91  m_sa = from;
92 }
93 
94 void
96 {
97  m_length = length;
98 }
99 
102 {
103  return m_da;
104 }
105 
108 {
109  return m_sa;
110 }
111 
112 uint16_t
114 {
115  return m_length;
116 }
117 
118 } // namespace ns3