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) 2011 Yufei Cheng | 3 * Copyright (c) 2011 Yufei Cheng |
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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "ns3/log.h" | 35 #include "ns3/log.h" |
36 #include "ns3/header.h" | 36 #include "ns3/header.h" |
37 #include "dsr-option-header.h" | 37 #include "dsr-option-header.h" |
38 #include "dsr-options.h" | 38 #include "dsr-options.h" |
39 #include "ns3/ipv4-address.h" | 39 #include "ns3/ipv4-address.h" |
40 #include "ns3/address-utils.h" | 40 #include "ns3/address-utils.h" |
41 #include "ns3/packet.h" | 41 #include "ns3/packet.h" |
42 #include "ns3/enum.h" | 42 #include "ns3/enum.h" |
43 | 43 |
44 namespace ns3 { | 44 namespace ns3 { |
| 45 |
| 46 NS_LOG_COMPONENT_DEFINE ("DsrOptionHeader"); |
| 47 |
45 namespace dsr { | 48 namespace dsr { |
46 NS_LOG_COMPONENT_DEFINE ("DsrOptionHeader"); | |
47 | 49 |
48 NS_OBJECT_ENSURE_REGISTERED (DsrOptionHeader); | 50 NS_OBJECT_ENSURE_REGISTERED (DsrOptionHeader); |
49 | 51 |
50 TypeId DsrOptionHeader::GetTypeId () | 52 TypeId DsrOptionHeader::GetTypeId () |
51 { | 53 { |
52 static TypeId tid = TypeId ("ns3::dsr::DsrOptionHeader") | 54 static TypeId tid = TypeId ("ns3::dsr::DsrOptionHeader") |
53 .AddConstructor<DsrOptionHeader> () | 55 .AddConstructor<DsrOptionHeader> () |
54 .SetParent<Header> () | 56 .SetParent<Header> () |
55 ; | 57 ; |
56 return tid; | 58 return tid; |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 return retVal; | 656 return retVal; |
655 } | 657 } |
656 | 658 |
657 NS_OBJECT_ENSURE_REGISTERED (DsrOptionRerrHeader); | 659 NS_OBJECT_ENSURE_REGISTERED (DsrOptionRerrHeader); |
658 | 660 |
659 TypeId DsrOptionRerrHeader::GetTypeId () | 661 TypeId DsrOptionRerrHeader::GetTypeId () |
660 { | 662 { |
661 static TypeId tid = TypeId ("ns3::dsr::DsrOptionRerrHeader") | 663 static TypeId tid = TypeId ("ns3::dsr::DsrOptionRerrHeader") |
662 .AddConstructor<DsrOptionRerrHeader> () | 664 .AddConstructor<DsrOptionRerrHeader> () |
663 .SetParent<DsrOptionHeader> () | 665 .SetParent<DsrOptionHeader> () |
664 .AddAttribute ("ErrorType","Type of route errors", | |
665 EnumValue (NODE_UNREACHABLE), | |
666 MakeEnumAccessor (&DsrOptionRerrHeader::m_errorType), | |
667 MakeEnumChecker (NODE_UNREACHABLE, "Node unreachable", | |
668 FLOW_STATE_NOT_SUPPORTED, "Flow state not su
pported", | |
669 OPTION_NOT_SUPPORTED, "Option not supported"
)) | |
670 ; | 666 ; |
671 return tid; | 667 return tid; |
672 } | 668 } |
673 | 669 |
674 TypeId DsrOptionRerrHeader::GetInstanceTypeId () const | 670 TypeId DsrOptionRerrHeader::GetInstanceTypeId () const |
675 { | 671 { |
676 return GetTypeId (); | 672 return GetTypeId (); |
677 } | 673 } |
678 | 674 |
679 DsrOptionRerrHeader::DsrOptionRerrHeader () | 675 DsrOptionRerrHeader::DsrOptionRerrHeader () |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 : m_ipv4Address (0) | 1219 : m_ipv4Address (0) |
1224 { | 1220 { |
1225 SetType (dsr::DsrOptionDropRReq::OPT_NUMBER); | 1221 SetType (dsr::DsrOptionDropRReq::OPT_NUMBER); |
1226 SetLength (6 + m_ipv4Address.size () * 4); | 1222 SetLength (6 + m_ipv4Address.size () * 4); |
1227 } | 1223 } |
1228 | 1224 |
1229 DsrOptionDropRReqHeader::~DsrOptionDropRReqHeader () | 1225 DsrOptionDropRReqHeader::~DsrOptionDropRReqHeader () |
1230 { | 1226 { |
1231 } | 1227 } |
1232 | 1228 |
1233 void DsrOptionDropRReqHeader::SetNumberOfAddresses (uint8_t n) | 1229 void DsrOptionDropRReqHeader::SetNumberOfAddresses (uint8_t n) |
1234 { | 1230 { |
1235 m_ipv4Address.clear (); | 1231 m_ipv4Address.clear (); |
1236 m_ipv4Address.assign (n, Ipv4Address ("")); | 1232 m_ipv4Address.assign (n, Ipv4Address ("")); |
1237 } | 1233 } |
1238 | 1234 |
1239 Ipv4Address DsrOptionDropRReqHeader::GetTarget () | 1235 Ipv4Address DsrOptionDropRReqHeader::GetTarget () |
1240 { | 1236 { |
1241 return m_target; | 1237 return m_target; |
1242 } | 1238 } |
1243 | 1239 |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 } | 1762 } |
1767 | 1763 |
1768 DsrOptionHeader::Alignment DsrOptionCancelRCacheHeader::GetAlignment () const | 1764 DsrOptionHeader::Alignment DsrOptionCancelRCacheHeader::GetAlignment () const |
1769 { | 1765 { |
1770 Alignment retVal = { 4, 0 }; | 1766 Alignment retVal = { 4, 0 }; |
1771 return retVal; | 1767 return retVal; |
1772 } | 1768 } |
1773 | 1769 |
1774 } /* namespace dsr */ | 1770 } /* namespace dsr */ |
1775 } /* namespace ns3 */ | 1771 } /* namespace ns3 */ |
LEFT | RIGHT |