LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008,2009 IITP RAS | 3 * Copyright (c) 2008,2009 IITP RAS |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Authors: Kirill Andreev <andreev@iitp.ru> | 18 * Authors: Kirill Andreev <andreev@iitp.ru> |
19 * Aleksey Kovalenko <kovalenko@iitp.ru> | 19 * Aleksey Kovalenko <kovalenko@iitp.ru> |
20 */ | 20 */ |
21 | 21 |
22 | |
23 #ifndef MESH_PEER_MAN_ELEMENT | 22 #ifndef MESH_PEER_MAN_ELEMENT |
24 #define MESH_PEER_MAN_ELEMENT | 23 #define MESH_PEER_MAN_ELEMENT |
25 | 24 |
26 #include "ns3/wifi-information-element.h" | 25 #include "ns3/wifi-information-element-vector.h" |
27 | 26 |
28 namespace ns3 { | 27 namespace ns3 { |
29 namespace dot11s { | 28 namespace dot11s { |
30 | 29 |
31 /** | 30 /** |
32 * \ingroup dot11s | 31 * \ingroup dot11s |
33 * \brief Codes used by 802.11s Peer Management Protocol | 32 * \brief Codes used by 802.11s Peer Management Protocol |
34 */ | 33 */ |
35 enum PmpReasonCode { | 34 enum PmpReasonCode |
| 35 { |
36 REASON11S_PEERING_CANCELLED = 2, // according to open80211s | 36 REASON11S_PEERING_CANCELLED = 2, // according to open80211s |
37 REASON11S_MESH_MAX_PEERS, | 37 REASON11S_MESH_MAX_PEERS, |
38 REASON11S_MESH_CAPABILITY_POLICY_VIOLATION, | 38 REASON11S_MESH_CAPABILITY_POLICY_VIOLATION, |
39 REASON11S_MESH_CLOSE_RCVD, | 39 REASON11S_MESH_CLOSE_RCVD, |
40 REASON11S_MESH_MAX_RETRIES, | 40 REASON11S_MESH_MAX_RETRIES, |
41 REASON11S_MESH_CONFIRM_TIMEOUT, | 41 REASON11S_MESH_CONFIRM_TIMEOUT, |
42 REASON11S_MESH_INVALID_GTK, | 42 REASON11S_MESH_INVALID_GTK, |
43 REASON11S_MESH_INCONSISTENT_PARAMETERS, | 43 REASON11S_MESH_INCONSISTENT_PARAMETERS, |
44 REASON11S_MESH_INVALID_SECURITY_CAPABILITY, | 44 REASON11S_MESH_INVALID_SECURITY_CAPABILITY, |
45 REASON11S_RESERVED, | 45 REASON11S_RESERVED, |
46 }; | 46 }; |
47 | 47 |
48 /** | 48 /** |
49 * \ingroup dot11s | 49 * \ingroup dot11s |
50 * \brief See 7.3.2.85 of draft 2.07 | 50 * \brief See 7.3.2.85 of draft 2.07 |
51 */ | 51 */ |
52 class IePeerManagement : public WifiInformationElement | 52 class IePeerManagement : public WifiInformationElement |
53 { | 53 { |
54 public: | 54 public: |
55 IePeerManagement (); | 55 IePeerManagement (); |
56 enum Subtype { | 56 enum Subtype |
57 PEER_OPEN = 0, | 57 { |
58 PEER_CONFIRM, | 58 PEER_OPEN = 0, |
59 PEER_CLOSE, | 59 PEER_CONFIRM, |
60 }; | 60 PEER_CLOSE, |
| 61 }; |
61 void SetPeerOpen (uint16_t localLinkId); | 62 void SetPeerOpen (uint16_t localLinkId); |
62 void SetPeerClose (uint16_t localLinkID, uint16_t peerLinkId, PmpReasonCode
reasonCode); | 63 void SetPeerClose (uint16_t localLinkID, uint16_t peerLinkId, PmpReasonCode
reasonCode); |
63 void SetPeerConfirm (uint16_t localLinkID, uint16_t peerLinkId); | 64 void SetPeerConfirm (uint16_t localLinkID, uint16_t peerLinkId); |
64 | 65 |
65 PmpReasonCode GetReasonCode () const; | 66 PmpReasonCode GetReasonCode () const; |
66 uint16_t GetLocalLinkId () const; | 67 uint16_t GetLocalLinkId () const; |
67 uint16_t GetPeerLinkId () const; | 68 uint16_t GetPeerLinkId () const; |
68 bool SubtypeIsOpen () const; | 69 bool SubtypeIsOpen () const; |
69 bool SubtypeIsClose () const; | 70 bool SubtypeIsClose () const; |
70 bool SubtypeIsConfirm () const ; | 71 bool SubtypeIsConfirm () const ; |
71 uint8_t GetSubtype() const { return m_subtype;}; | 72 uint8_t GetSubtype () const; |
| 73 /** |
| 74 * \name Inherited from WifiInformationElement |
| 75 * \{ |
| 76 */ |
| 77 virtual WifiElementId ElementId () const; |
| 78 virtual uint8_t GetInformationSize (void) const; |
| 79 virtual void SerializeInformation (Buffer::Iterator i) const; |
| 80 virtual uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length); |
| 81 virtual void Print (std::ostream& os) const; |
| 82 ///\} |
72 private: | 83 private: |
73 WifiElementId ElementId () const{ | 84 uint8_t m_length; |
74 return IE11S_PEERING_MANAGEMENT; | 85 uint8_t m_subtype; |
75 } | 86 uint16_t m_localLinkId; |
76 uint8_t GetInformationSize (void) const; | |
77 void SerializeInformation (Buffer::Iterator i) const; | |
78 uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length); | |
79 void PrintInformation (std::ostream& os) const; | |
80 private: | |
81 uint8_t m_length; | |
82 uint8_t m_subtype; | |
83 uint16_t m_localLinkId; | |
84 /** | 87 /** |
85 * Present within confirm and may be present in close | 88 * Present within confirm and may be present in close |
86 */ | 89 */ |
87 uint16_t m_peerLinkId; | 90 uint16_t m_peerLinkId; |
88 /** | 91 /** |
89 * Present only within close frame | 92 * Present only within close frame |
90 */ | 93 */ |
91 PmpReasonCode m_reasonCode; | 94 PmpReasonCode m_reasonCode; |
92 friend bool operator== (const IePeerManagement & a, const IePeerManagement & b
); | 95 friend bool operator== (const IePeerManagement & a, const IePeerManagement & b
); |
93 }; | 96 }; |
94 bool operator== (const IePeerManagement & a, const IePeerManagement & b); | 97 bool operator== (const IePeerManagement & a, const IePeerManagement & b); |
| 98 std::ostream &operator << (std::ostream &os, const IePeerManagement &peerMan); |
95 } // namespace dot11s | 99 } // namespace dot11s |
96 } //namespace ns3 | 100 } //namespace ns3 |
97 #endif | 101 #endif |
LEFT | RIGHT |