A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
mac-messages.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007,2008,2009 INRIA, UDcast
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
* Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19
* Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
20
* <amine.ismail@UDcast.com>
21
*/
22
23
#include "
mac-messages.h
"
24
#include "ns3/address-utils.h"
25
#include "ns3/uinteger.h"
26
#include "ns3/log.h"
27
#include "
wimax-tlv.h
"
28
29
NS_LOG_COMPONENT_DEFINE
(
"MACMESSAGES"
);
30
namespace
ns3 {
31
32
NS_OBJECT_ENSURE_REGISTERED
(ManagementMessageType);
33
34
ManagementMessageType::ManagementMessageType
(
void
)
35
: m_type (~0)
36
{
37
}
38
39
ManagementMessageType::ManagementMessageType
(uint8_t type)
40
: m_type (type)
41
{
42
}
43
44
ManagementMessageType::~ManagementMessageType
(
void
)
45
{
46
}
47
48
void
49
ManagementMessageType::SetType
(uint8_t type)
50
{
51
m_type
= type;
52
}
53
54
uint8_t
55
ManagementMessageType::GetType
(
void
)
const
56
{
57
return
m_type
;
58
}
59
60
std::string
61
ManagementMessageType::GetName
(
void
)
const
62
{
63
return
"Management Message Type"
;
64
}
65
66
TypeId
67
ManagementMessageType::GetTypeId
(
void
)
68
{
69
static
TypeId
tid =
70
TypeId
(
"ns3::ManagementMessageType"
).
SetParent
<
Header
> ().AddConstructor<ManagementMessageType> ();
71
return
tid;
72
}
73
74
TypeId
75
ManagementMessageType::GetInstanceTypeId
(
void
)
const
76
{
77
return
GetTypeId
();
78
}
79
80
void
81
ManagementMessageType::Print
(std::ostream &os)
const
82
{
83
os <<
" management message type = "
<< (uint32_t)
m_type
;
84
}
85
86
uint32_t
87
ManagementMessageType::GetSerializedSize
(
void
)
const
88
{
89
return
1;
90
}
91
92
void
93
ManagementMessageType::Serialize
(
Buffer::Iterator
start
)
const
94
{
95
Buffer::Iterator
i =
start
;
96
i.
WriteU8
(
m_type
);
97
}
98
99
uint32_t
100
ManagementMessageType::Deserialize
(
Buffer::Iterator
start
)
101
{
102
Buffer::Iterator
i =
start
;
103
m_type
= i.
ReadU8
();
104
return
i.
GetDistanceFrom
(start);
105
}
106
107
// ----------------------------------------------------------------------------------------------------------
108
109
NS_OBJECT_ENSURE_REGISTERED
(
RngReq
);
110
111
RngReq::RngReq
(
void
)
112
: m_reserved (0),
113
m_reqDlBurstProfile (0),
114
m_macAddress (
Mac48Address
(
"00:00:00:00:00:00"
)),
115
m_rangingAnomalies (0)
116
{
117
}
118
119
RngReq::~RngReq
(
void
)
120
{
121
}
122
123
void
124
RngReq::SetReqDlBurstProfile
(uint8_t reqDlBurstProfile)
125
{
126
m_reqDlBurstProfile
= reqDlBurstProfile;
127
}
128
129
void
130
RngReq::SetMacAddress
(
Mac48Address
macAddress)
131
{
132
m_macAddress
= macAddress;
133
}
134
135
void
136
RngReq::SetRangingAnomalies
(uint8_t rangingAnomalies)
137
{
138
m_rangingAnomalies
= rangingAnomalies;
139
}
140
141
uint8_t
142
RngReq::GetReqDlBurstProfile
(
void
)
const
143
{
144
return
m_reqDlBurstProfile
;
145
}
146
147
Mac48Address
148
RngReq::GetMacAddress
(
void
)
const
149
{
150
return
m_macAddress
;
151
}
152
153
uint8_t
154
RngReq::GetRangingAnomalies
(
void
)
const
155
{
156
return
m_rangingAnomalies
;
157
}
158
159
std::string
160
RngReq::GetName
(
void
)
const
161
{
162
return
"RNG-REQ"
;
163
}
164
165
TypeId
166
RngReq::GetTypeId
(
void
)
167
{
168
static
TypeId
tid =
TypeId
(
"ns3::RngReq"
).
SetParent
<
Header
> ().AddConstructor<RngReq> ();
169
return
tid;
170
}
171
172
TypeId
173
RngReq::GetInstanceTypeId
(
void
)
const
174
{
175
return
GetTypeId
();
176
}
177
178
void
179
RngReq::Print
(std::ostream &os)
const
180
{
181
os <<
" requested dl burst profile = "
<< (uint32_t)
m_reqDlBurstProfile
<<
", mac address = "
<<
m_macAddress
182
<<
", ranging anomalies = "
<< (uint32_t)
m_rangingAnomalies
;
183
}
184
185
void
186
RngReq::PrintDebug
(
void
)
const
187
{
188
NS_LOG_DEBUG
(
" requested dl burst profile = "
<< (uint32_t)
m_reqDlBurstProfile
<<
", mac address = "
189
<<
m_macAddress
<<
", ranging anomalies = "
190
<< (uint32_t)
m_rangingAnomalies
);
191
}
192
193
uint32_t
194
RngReq::GetSerializedSize
(
void
)
const
195
{
196
return
1 + 1 + 6 + 1;
197
}
198
199
void
200
RngReq::Serialize
(
Buffer::Iterator
start
)
const
201
{
202
Buffer::Iterator
i =
start
;
203
i.
WriteU8
(
m_reserved
);
204
i.
WriteU8
(
m_reqDlBurstProfile
);
205
WriteTo
(i,
m_macAddress
);
206
i.
WriteU8
(
m_rangingAnomalies
);
207
}
208
209
uint32_t
210
RngReq::Deserialize
(
Buffer::Iterator
start
)
211
{
212
Buffer::Iterator
i =
start
;
213
m_reserved
= i.
ReadU8
();
214
m_reqDlBurstProfile
= i.
ReadU8
();
215
ReadFrom
(i,
m_macAddress
);
216
m_rangingAnomalies
= i.
ReadU8
();
217
218
return
i.
GetDistanceFrom
(start);
219
}
220
221
// ----------------------------------------------------------------------------------------------------------
222
223
NS_OBJECT_ENSURE_REGISTERED
(
RngRsp
);
224
225
RngRsp::RngRsp
(
void
)
226
: m_reserved (0),
227
m_timingAdjust (0),
228
m_powerLevelAdjust (0),
229
m_offsetFreqAdjust (0),
230
m_rangStatus (0),
231
m_dlFreqOverride (0),
232
m_ulChnlIdOverride (0),
233
m_dlOperBurstProfile (0),
234
m_macAddress (
Mac48Address
(
"00:00:00:00:00:00"
)),
235
m_basicCid (),
236
m_primaryCid (),
237
m_aasBdcastPermission (0),
238
m_frameNumber (0),
239
m_initRangOppNumber (0),
240
m_rangSubchnl (0)
241
{
242
}
243
244
RngRsp::~RngRsp
(
void
)
245
{
246
}
247
248
void
249
RngRsp::SetTimingAdjust
(uint32_t timingAdjust)
250
{
251
m_timingAdjust
= timingAdjust;
252
}
253
254
void
255
RngRsp::SetPowerLevelAdjust
(uint8_t powerLevelAdjust)
256
{
257
m_powerLevelAdjust
= powerLevelAdjust;
258
}
259
260
void
261
RngRsp::SetOffsetFreqAdjust
(uint32_t offsetFreqAdjust)
262
{
263
m_offsetFreqAdjust
= offsetFreqAdjust;
264
}
265
266
void
267
RngRsp::SetRangStatus
(uint8_t rangStatus)
268
{
269
m_rangStatus
= rangStatus;
270
}
271
272
void
273
RngRsp::SetDlFreqOverride
(uint32_t dlFreqOverride)
274
{
275
m_dlFreqOverride
= dlFreqOverride;
276
}
277
278
void
279
RngRsp::SetUlChnlIdOverride
(uint8_t ulChnlIdOverride)
280
{
281
m_ulChnlIdOverride
= ulChnlIdOverride;
282
}
283
284
void
285
RngRsp::SetDlOperBurstProfile
(uint16_t dlOperBurstProfile)
286
{
287
m_dlOperBurstProfile
= dlOperBurstProfile;
288
}
289
290
void
291
RngRsp::SetMacAddress
(
Mac48Address
macAddress)
292
{
293
m_macAddress
= macAddress;
294
}
295
296
void
297
RngRsp::SetBasicCid
(
Cid
basicCid)
298
{
299
m_basicCid
= basicCid;
300
}
301
302
void
303
RngRsp::SetPrimaryCid
(
Cid
primaryCid)
304
{
305
m_primaryCid
= primaryCid;
306
}
307
308
void
309
RngRsp::SetAasBdcastPermission
(uint8_t aasBdcastPermission)
310
{
311
m_aasBdcastPermission
= aasBdcastPermission;
312
}
313
314
void
315
RngRsp::SetFrameNumber
(uint32_t frameNumber)
316
{
317
m_frameNumber
= frameNumber;
318
}
319
320
void
321
RngRsp::SetInitRangOppNumber
(uint8_t initRangOppNumber)
322
{
323
m_initRangOppNumber
= initRangOppNumber;
324
}
325
326
void
327
RngRsp::SetRangSubchnl
(uint8_t rangSubchnl)
328
{
329
m_rangSubchnl
= rangSubchnl;
330
}
331
332
uint32_t
333
RngRsp::GetTimingAdjust
(
void
)
const
334
{
335
return
m_timingAdjust
;
336
}
337
338
uint8_t
339
RngRsp::GetPowerLevelAdjust
(
void
)
const
340
{
341
return
m_powerLevelAdjust
;
342
}
343
344
uint32_t
345
RngRsp::GetOffsetFreqAdjust
(
void
)
const
346
{
347
return
m_offsetFreqAdjust
;
348
}
349
350
uint8_t
351
RngRsp::GetRangStatus
(
void
)
const
352
{
353
return
m_rangStatus
;
354
}
355
356
uint32_t
357
RngRsp::GetDlFreqOverride
(
void
)
const
358
{
359
return
m_dlFreqOverride
;
360
}
361
362
uint8_t
363
RngRsp::GetUlChnlIdOverride
(
void
)
const
364
{
365
return
m_ulChnlIdOverride
;
366
}
367
368
uint16_t
369
RngRsp::GetDlOperBurstProfile
(
void
)
const
370
{
371
return
m_dlOperBurstProfile
;
372
}
373
374
Mac48Address
375
RngRsp::GetMacAddress
(
void
)
const
376
{
377
return
m_macAddress
;
378
}
379
380
Cid
381
RngRsp::GetBasicCid
(
void
)
const
382
{
383
return
m_basicCid
;
384
}
385
386
Cid
387
RngRsp::GetPrimaryCid
(
void
)
const
388
{
389
return
m_primaryCid
;
390
}
391
392
uint8_t
393
RngRsp::GetAasBdcastPermission
(
void
)
const
394
{
395
return
m_aasBdcastPermission
;
396
}
397
398
uint32_t
399
RngRsp::GetFrameNumber
(
void
)
const
400
{
401
return
m_frameNumber
;
402
}
403
404
uint8_t
405
RngRsp::GetInitRangOppNumber
(
void
)
const
406
{
407
return
m_initRangOppNumber
;
408
}
409
410
uint8_t
411
RngRsp::GetRangSubchnl
(
void
)
const
412
{
413
return
m_rangSubchnl
;
414
}
415
416
std::string
417
RngRsp::GetName
(
void
)
const
418
{
419
return
"RNG-RSP"
;
420
}
421
422
TypeId
423
RngRsp::GetTypeId
(
void
)
424
{
425
static
TypeId
tid =
TypeId
(
"ns3::RngRsp"
).
SetParent
<
Header
> ().AddConstructor<RngRsp> ();
426
return
tid;
427
}
428
429
TypeId
430
RngRsp::GetInstanceTypeId
(
void
)
const
431
{
432
return
GetTypeId
();
433
}
434
435
void
436
RngRsp::Print
(std::ostream &os)
const
437
{
438
os <<
" timing adjust = "
<<
m_timingAdjust
<<
", power level adjust = "
<< (uint32_t)
m_powerLevelAdjust
439
<<
", offset freq adjust = "
<<
m_offsetFreqAdjust
<<
", ranging status = "
<< (uint32_t)
m_rangStatus
440
<<
", dl freq override = "
<<
m_dlFreqOverride
<<
", ul channel id override = "
<< (uint32_t)
m_ulChnlIdOverride
441
<<
", dl operational burst profile = "
<< (uint32_t)
m_dlOperBurstProfile
<<
", mac address = "
<<
m_macAddress
442
<<
", basic cid = "
<<
m_basicCid
<<
", primary management cid = "
<<
m_primaryCid
443
<<
", aas broadcast permission = "
<< (uint32_t)
m_aasBdcastPermission
<<
", frame number = "
<<
m_frameNumber
444
<<
", initial ranging opportunity number = "
<< (uint32_t)
m_initRangOppNumber
<<
", ranging subchannel = "
445
<< (uint32_t)
m_rangSubchnl
;
446
}
447
448
uint32_t
449
RngRsp::GetSerializedSize
(
void
)
const
450
{
451
return
1 + 4 + 1 + 4 + 1 + 4 + 1 + 2 + 6 + 2 + 2 + 1 + 4 + 1 + 1;
452
}
453
454
void
455
RngRsp::Serialize
(
Buffer::Iterator
start
)
const
456
{
457
Buffer::Iterator
i =
start
;
458
i.
WriteU8
(
m_reserved
);
459
i.
WriteU32
(
m_timingAdjust
);
460
i.
WriteU8
(
m_powerLevelAdjust
);
461
i.
WriteU32
(
m_offsetFreqAdjust
);
462
i.
WriteU8
(
m_rangStatus
);
463
i.
WriteU32
(
m_dlFreqOverride
);
464
i.
WriteU8
(
m_ulChnlIdOverride
);
465
i.
WriteU16
(
m_dlOperBurstProfile
);
466
WriteTo
(i,
m_macAddress
);
467
i.
WriteU16
(
m_basicCid
.
GetIdentifier
());
468
i.
WriteU16
(
m_primaryCid
.
GetIdentifier
());
469
i.
WriteU8
(
m_aasBdcastPermission
);
470
i.
WriteU32
(
m_frameNumber
);
471
i.
WriteU8
(
m_initRangOppNumber
);
472
i.
WriteU8
(
m_rangSubchnl
);
473
}
474
475
uint32_t
476
RngRsp::Deserialize
(
Buffer::Iterator
start
)
477
{
478
Buffer::Iterator
i =
start
;
479
m_reserved
= i.
ReadU8
();
480
m_timingAdjust
= i.
ReadU32
();
481
m_powerLevelAdjust
= i.
ReadU8
();
482
m_offsetFreqAdjust
= i.
ReadU32
();
483
m_rangStatus
= i.
ReadU8
();
484
m_dlFreqOverride
= i.
ReadU32
();
485
m_ulChnlIdOverride
= i.
ReadU8
();
486
m_dlOperBurstProfile
= i.
ReadU16
();
487
ReadFrom
(i,
m_macAddress
);
// length (6) shall also be written in packet instead of hard coded, see ARP example
488
m_basicCid
= i.
ReadU16
();
489
m_primaryCid
= i.
ReadU16
();
490
m_aasBdcastPermission
= i.
ReadU8
();
491
m_frameNumber
= i.
ReadU32
();
492
m_initRangOppNumber
= i.
ReadU8
();
493
m_rangSubchnl
= i.
ReadU8
();
494
495
return
i.
GetDistanceFrom
(start);
496
}
497
498
// ----------------------------------------------------------------------------------------------------------------------
499
500
NS_OBJECT_ENSURE_REGISTERED
(
DsaReq
);
501
502
DsaReq::DsaReq
(
void
)
503
: m_transactionId (0),
504
m_sfid (0),
505
m_cid (),
506
m_serviceFlow (
ServiceFlow
::SF_DIRECTION_DOWN)
507
{
508
}
509
510
DsaReq::DsaReq
(
ServiceFlow
sf)
511
{
512
m_transactionId
= 0;
513
m_serviceFlow
= sf;
514
}
515
516
DsaReq::~DsaReq
(
void
)
517
{
518
}
519
520
void
521
DsaReq::SetTransactionId
(uint16_t transactionId)
522
{
523
m_transactionId
= transactionId;
524
}
525
526
uint16_t
527
DsaReq::GetTransactionId
(
void
)
const
528
{
529
return
m_transactionId
;
530
}
531
532
void
533
DsaReq::SetSfid
(uint32_t sfid)
534
{
535
m_sfid
= sfid;
536
}
537
538
uint32_t
539
DsaReq::GetSfid
(
void
)
const
540
{
541
return
m_sfid
;
542
}
543
544
void
545
DsaReq::SetCid
(
Cid
cid)
546
{
547
m_cid
= cid;
548
}
549
550
Cid
551
DsaReq::GetCid
(
void
)
const
552
{
553
return
m_cid
;
554
}
555
556
557
std::string
558
DsaReq::GetName
(
void
)
const
559
{
560
return
"DSA-REQ"
;
561
}
562
563
TypeId
564
DsaReq::GetTypeId
(
void
)
565
{
566
static
TypeId
tid =
TypeId
(
"ns3::DsaReq"
).
SetParent
<
Header
> ().AddConstructor<DsaReq> ();
567
return
tid;
568
}
569
570
TypeId
571
DsaReq::GetInstanceTypeId
(
void
)
const
572
{
573
return
GetTypeId
();
574
}
575
576
void
577
DsaReq::Print
(std::ostream &os)
const
578
{
579
os <<
" transaction id = "
<< (uint32_t)
m_transactionId
<<
", m_sfid = "
<<
m_sfid
<<
", cid = "
<<
m_cid
;
580
}
581
582
/*
583
* 0 7 15 23
584
* +-------------+-------------+-------------+
585
* |Mngt msg type| Transaction ID |
586
* +-------------+-------------+-------------+
587
* | Service Flow TLV |
588
* +~~~~~~~~~~~~~+~~~~~~~~~~~~~+~~~~~~~~~~~~~+
589
*
590
*/
591
592
uint32_t
593
DsaReq::GetSerializedSize
(
void
)
const
594
{
595
Tlv
t =
m_serviceFlow
.
ToTlv
();
596
uint32_t size = 2 + t.
GetSerializedSize
();
597
return
size;
598
}
599
600
void
601
DsaReq::Serialize
(
Buffer::Iterator
start
)
const
602
{
603
Buffer::Iterator
i =
start
;
604
i.
WriteU16
(
m_transactionId
);
605
Tlv
t =
m_serviceFlow
.
ToTlv
();
606
t.
Serialize
(i);
607
}
608
609
uint32_t
610
DsaReq::Deserialize
(
Buffer::Iterator
start
)
611
{
612
Buffer::Iterator
i =
start
;
613
m_transactionId
= i.
ReadU16
();
614
Tlv
tlv;
615
uint32_t size = tlv.
Deserialize
(i);
616
m_serviceFlow
=
ServiceFlow
(tlv);
617
return
size + 2;
618
}
619
620
ServiceFlow
621
DsaReq::GetServiceFlow
(
void
)
const
622
{
623
return
m_serviceFlow
;
624
}
625
626
void
627
DsaReq::SetServiceFlow
(
ServiceFlow
sf)
628
{
629
m_serviceFlow
= sf;
630
}
631
632
// ----------------------------------------------------------------------------------------------------------------------
633
634
NS_OBJECT_ENSURE_REGISTERED
(
DsaRsp
);
635
636
DsaRsp::DsaRsp
(
void
)
637
: m_transactionId (0),
638
m_confirmationCode (0),
639
m_sfid (0),
640
m_cid ()
641
{
642
}
643
644
DsaRsp::~DsaRsp
(
void
)
645
{
646
}
647
648
void
649
DsaRsp::SetTransactionId
(uint16_t transactionId)
650
{
651
m_transactionId
= transactionId;
652
}
653
654
uint16_t
655
DsaRsp::GetTransactionId
(
void
)
const
656
{
657
return
m_transactionId
;
658
}
659
660
ServiceFlow
661
DsaRsp::GetServiceFlow
(
void
)
const
662
{
663
return
m_serviceFlow
;
664
}
665
666
void
667
DsaRsp::SetServiceFlow
(
ServiceFlow
sf)
668
{
669
m_serviceFlow
= sf;
670
}
671
672
void
673
DsaRsp::SetConfirmationCode
(uint16_t confirmationCode)
674
{
675
m_confirmationCode
= confirmationCode;
676
}
677
678
uint16_t
679
DsaRsp::GetConfirmationCode
(
void
)
const
680
{
681
return
m_confirmationCode
;
682
}
683
684
void
685
DsaRsp::SetSfid
(uint32_t sfid)
686
{
687
m_sfid
= sfid;
688
}
689
690
uint32_t
691
DsaRsp::GetSfid
(
void
)
const
692
{
693
return
m_sfid
;
694
}
695
696
void
697
DsaRsp::SetCid
(
Cid
cid)
698
{
699
m_cid
= cid;
700
}
701
702
Cid
703
DsaRsp::GetCid
(
void
)
const
704
{
705
return
m_cid
;
706
}
707
708
std::string
709
DsaRsp::GetName
(
void
)
const
710
{
711
return
"DSA-RSP"
;
712
}
713
714
TypeId
715
DsaRsp::GetTypeId
(
void
)
716
{
717
static
TypeId
tid =
TypeId
(
"ns3::DsaRsp"
).
SetParent
<
Header
> ().AddConstructor<DsaRsp> ();
718
return
tid;
719
}
720
721
TypeId
722
DsaRsp::GetInstanceTypeId
(
void
)
const
723
{
724
return
GetTypeId
();
725
}
726
727
void
728
DsaRsp::Print
(std::ostream &os)
const
729
{
730
os <<
" transaction id = "
<< (uint32_t)
m_transactionId
<<
", confirmation code = "
<< (uint32_t)
m_confirmationCode
731
<<
", m_sfid = "
<<
m_sfid
<<
", cid = "
<<
m_cid
;
732
}
733
734
uint32_t
735
DsaRsp::GetSerializedSize
(
void
)
const
736
{
737
return
2 + 1 +
m_serviceFlow
.
ToTlv
().
GetSerializedSize
();
738
}
739
740
/*
741
* 0 7 15 23
742
* +-------------+-------------+-------------+
743
* |Mngt msg type| Transaction ID |
744
* +-------------+-------------+-------------+
745
* | Conf Code | Service Flow TLV |
746
* +~~~~~~~~~~~~~+~~~~~~~~~~~~~+~~~~~~~~~~~~~+
747
*
748
*/
749
void
750
DsaRsp::Serialize
(
Buffer::Iterator
start
)
const
751
{
752
Buffer::Iterator
i =
start
;
753
754
i.
WriteU16
(
m_transactionId
);
755
i.
WriteU8
(
m_confirmationCode
);
756
m_serviceFlow
.
ToTlv
().
Serialize
(i);
757
}
758
759
uint32_t
760
DsaRsp::Deserialize
(
Buffer::Iterator
start
)
761
{
762
Buffer::Iterator
i =
start
;
763
764
m_transactionId
= i.
ReadU16
();
765
m_confirmationCode
= i.
ReadU8
();
766
Tlv
tlv;
767
uint32_t size = tlv.
Deserialize
(i);
768
m_serviceFlow
=
ServiceFlow
(tlv);
769
return
size + 3;
770
}
771
772
// ----------------------------------------------------------------------------------------------------------
773
774
NS_OBJECT_ENSURE_REGISTERED
(
DsaAck
);
775
776
DsaAck::DsaAck
(
void
)
777
: m_transactionId (0),
778
m_confirmationCode (0)
779
{
780
}
781
782
DsaAck::~DsaAck
(
void
)
783
{
784
}
785
786
void
787
DsaAck::SetTransactionId
(uint16_t transactionId)
788
{
789
m_transactionId
= transactionId;
790
}
791
792
uint16_t
793
DsaAck::GetTransactionId
(
void
)
const
794
{
795
return
m_transactionId
;
796
}
797
798
void
799
DsaAck::SetConfirmationCode
(uint16_t confirmationCode)
800
{
801
m_confirmationCode
= confirmationCode;
802
}
803
804
uint16_t
805
DsaAck::GetConfirmationCode
(
void
)
const
806
{
807
return
m_confirmationCode
;
808
}
809
810
std::string
811
DsaAck::GetName
(
void
)
const
812
{
813
return
"DSA-ACK"
;
814
}
815
816
TypeId
817
DsaAck::GetTypeId
(
void
)
818
{
819
static
TypeId
tid =
TypeId
(
"ns3::DsaAck"
).
SetParent
<
Header
> ().AddConstructor<DsaAck> ();
820
return
tid;
821
}
822
823
TypeId
824
DsaAck::GetInstanceTypeId
(
void
)
const
825
{
826
return
GetTypeId
();
827
}
828
829
void
830
DsaAck::Print
(std::ostream &os)
const
831
{
832
os <<
" transaction id = "
<< (uint32_t)
m_transactionId
<<
", confirmation code = "
<< (uint32_t)
m_confirmationCode
;
833
}
834
835
uint32_t
836
DsaAck::GetSerializedSize
(
void
)
const
837
{
838
return
2 + 1;
839
}
840
841
void
842
DsaAck::Serialize
(
Buffer::Iterator
start
)
const
843
{
844
Buffer::Iterator
i =
start
;
845
i.
WriteU16
(
m_transactionId
);
846
i.
WriteU8
(
m_confirmationCode
);
847
}
848
849
uint32_t
850
DsaAck::Deserialize
(
Buffer::Iterator
start
)
851
{
852
Buffer::Iterator
i =
start
;
853
m_transactionId
= i.
ReadU16
();
854
m_confirmationCode
= i.
ReadU8
();
855
856
return
i.
GetDistanceFrom
(start);
857
}
858
859
}
// namespace ns3
src
wimax
model
mac-messages.cc
Generated on Tue May 14 2013 11:08:37 for ns-3 by
1.8.1.2