forked from tomaszmrugalski/dibbler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOptIA.cpp
63 lines (50 loc) · 1.19 KB
/
OptIA.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Dibbler - a portable DHCPv6
*
* author: Tomasz Mrugalski <[email protected]>
*
* released under GNU GPL v2 licence
*
*/
#include "OptIA.h"
#include "OptStatusCode.h"
#include "DHCPConst.h"
TOptIA::TOptIA(uint16_t code, uint32_t iaid, uint32_t t1, uint32_t t2, TMsg* parent)
:TOpt(code, parent), IAID_(iaid), T1_(t1), T2_(t2) {
}
TOptIA::TOptIA(uint16_t code, TMsg* parent)
:TOpt(code, parent) {
}
void TOptIA::setIAID(uint32_t iaid) {
IAID_ = iaid;
}
unsigned long TOptIA::getIAID() const {
return IAID_;
}
unsigned long TOptIA::getT1() const {
return T1_;
}
void TOptIA::setT1(unsigned long t1) {
T1_ = t1;
}
unsigned long TOptIA::getT2() const {
return T2_;
}
void TOptIA::setT2(unsigned long t2) {
T2_ = t2;
}
int TOptIA::getStatusCode() {
SPtr<TOpt> ptrOpt;
SubOptions.first();
while ( ptrOpt = SubOptions.get() ) {
if ( ptrOpt->getOptType() != OPTION_STATUS_CODE) {
continue;
}
SPtr <TOptStatusCode> ptrStatus = SPtr_cast<TOptStatusCode>(ptrOpt);
if (ptrStatus) {
return ptrStatus->getCode();
}
}
// Missing status code indicates success
return STATUSCODE_SUCCESS;
}