Mesh id cosmetic fixes

This commit is contained in:
Kirill Andreev
2009-06-05 16:06:25 +04:00
parent a24a335900
commit e418326f6a
6 changed files with 17 additions and 15 deletions

View File

@@ -117,7 +117,7 @@ MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c, std::
// Install 802.11s protocols
Ptr<PeerManagementProtocol> pmp = CreateObject<PeerManagementProtocol> ();
pmp->SetMeshId("mesh",4);
pmp->SetMeshId("mesh");
bool install_ok = pmp->Install (mp);
NS_ASSERT (install_ok);

View File

@@ -30,16 +30,19 @@ IeMeshId::IeMeshId ()
m_meshId[i] = 0;
}
}
IeMeshId::IeMeshId (char const meshId[32], uint8_t length)
IeMeshId::IeMeshId (std::string s)
{
NS_ASSERT (length <= 32);
NS_ASSERT (s.size () < 32);
const char *meshid = s.c_str ();
uint8_t len = 0;
while (len < length)
while (*meshid != 0 && len < 32)
{
m_meshId[len] = meshId[len];
m_meshId[len] = *meshid;
meshid++;
len++;
}
while (len < 32)
NS_ASSERT (len <= 32);
while (len < 33)
{
m_meshId[len] = 0;
len++;
@@ -148,7 +151,7 @@ bool IeMeshIdBist::RunTests ()
bool result(true);
// create test information element
IeMeshId a("qwerty",6);
IeMeshId a("qwerty");
result = result && TestRoundtripSerialization (a);
return result;
}

View File

@@ -36,8 +36,7 @@ class IeMeshId : public WifiInformationElement
public:
// broadcast meshId
IeMeshId ();
//IeMeshId (char const meshId[32]);
IeMeshId (char const meshId[32], uint8_t length);
IeMeshId (std::string s);
bool IsEqual (IeMeshId const &o) const;
bool IsBroadcast (void) const;

View File

@@ -204,7 +204,7 @@ bool PeerLinkFrameStartBist::RunTests ()
fields.capability = 0;
fields.aid = 101;
fields.reasonCode = 12;
fields.meshId = IeMeshId("qwertyuiop", 10);
fields.meshId = IeMeshId("qwertyuiop");
a.SetPlinkFrameStart(fields);
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (a);
@@ -220,7 +220,7 @@ bool PeerLinkFrameStartBist::RunTests ()
fields.capability = 0;
fields.aid = 1234;
fields.reasonCode = 12;
fields.meshId = IeMeshId("qwerty", 6);
fields.meshId = IeMeshId("qwerty");
a.SetPlinkFrameStart(fields);
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (a);
@@ -235,7 +235,7 @@ bool PeerLinkFrameStartBist::RunTests ()
fields.subtype = (uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE);
fields.capability = 0;
fields.aid = 10;
fields.meshId = IeMeshId("qqq", 3);
fields.meshId = IeMeshId("qqq");
fields.reasonCode = 12;
a.SetPlinkFrameStart(fields);
Ptr<Packet> packet = Create<Packet> ();

View File

@@ -479,9 +479,9 @@ PeerManagementProtocol::GetMeshId () const
return m_meshId;
}
void
PeerManagementProtocol::SetMeshId(char const meshId[32], uint8_t length)
PeerManagementProtocol::SetMeshId(std::string s)
{
m_meshId = Create<IeMeshId> (meshId, length);
m_meshId = Create<IeMeshId> (s);
}
Mac48Address
PeerManagementProtocol::GetAddress ()

View File

@@ -137,7 +137,7 @@ public:
Mac48Address GetAddress ();
///\Needed to fill mesh configuration
uint8_t GetNumberOfLinks ();
void SetMeshId (char const meshId[32], uint8_t length);
void SetMeshId (std::string s);
Ptr<IeMeshId> GetMeshId() const;
///\brief: Report statistics
void Report (std::ostream &) const;