author | Tom Henderson <tomh@tomh.org> |
Mon, 28 Sep 2015 20:27:25 -0700 | |
changeset 11676 | 05ea1489e509 |
parent 11450 | 9f4ae69f12b7 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7141
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2006 INRIA |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
*/ |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
|
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#include "status-code.h" |
2077
8ff95ff1ed2e
fix optimized builds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2013
diff
changeset
|
22 |
#include <string> |
8ff95ff1ed2e
fix optimized builds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2013
diff
changeset
|
23 |
#include <ostream> |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
|
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
namespace ns3 { |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
|
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
StatusCode::StatusCode () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
28 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
29 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
30 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
31 |
void |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
StatusCode::SetSuccess (void) |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
{ |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
m_code = 0; |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
36 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
37 |
void |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
StatusCode::SetFailure (void) |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
39 |
{ |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
m_code = 1; |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
} |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
43 |
bool |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
StatusCode::IsSuccess (void) const |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
{ |
5819
514ec98954ab
Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents:
2077
diff
changeset
|
46 |
return (m_code == 0); |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
48 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
49 |
uint32_t |
1939
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
50 |
StatusCode::GetSerializedSize (void) const |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
{ |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
return 2; |
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
54 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
55 |
Buffer::Iterator |
1939
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
56 |
StatusCode::Serialize (Buffer::Iterator start) const |
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
57 |
{ |
6602
0aae670ceff3
Bug 979: Use LSB ordering for multi-octet fields in wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
5819
diff
changeset
|
58 |
start.WriteHtolsbU16 (m_code); |
1939
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
59 |
return start; |
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
60 |
} |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
61 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
62 |
Buffer::Iterator |
1939
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
63 |
StatusCode::Deserialize (Buffer::Iterator start) |
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
64 |
{ |
6602
0aae670ceff3
Bug 979: Use LSB ordering for multi-octet fields in wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
5819
diff
changeset
|
65 |
m_code = start.ReadLsbtohU16 (); |
1939
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
66 |
return start; |
40af0232df83
add management frame implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1937
diff
changeset
|
67 |
} |
1937
996383a87ae3
add new code to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
69 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
70 |
* Serialize StatusCode to the given ostream. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
71 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
72 |
* \param os |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
73 |
* \param code |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
74 |
* |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
75 |
* \return std::ostream |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
76 |
*/ |
2013
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
77 |
std::ostream & |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
78 |
operator << (std::ostream &os, const StatusCode &code) |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
79 |
{ |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
80 |
if (code.IsSuccess ()) |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
81 |
{ |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
82 |
os << "success"; |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
83 |
} |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
84 |
else |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
85 |
{ |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
86 |
os << "failure"; |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
87 |
} |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
88 |
return os; |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
89 |
} |
4a5335c67eac
add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1939
diff
changeset
|
90 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
91 |
} //namespace ns3 |