merge with HEAD
This commit is contained in:
commit
ef46e8a27c
163 files changed
+2925
-2784
No files matched your search
+44
-8
@@ -166,27 +166,63 @@ bool operator < (const Address &a, const Address &b)
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, const Address & address)
|
||||
{
|
||||
if (address.m_len == 0)
|
||||
{
|
||||
os << "NULL-ADDRESS";
|
||||
return os;
|
||||
}
|
||||
os.setf (std::ios::hex, std::ios::basefield);
|
||||
os.fill('0');
|
||||
for (uint8_t i=0; i < (address.m_len-1); i++)
|
||||
os << std::setw(2) << (uint32_t) address.m_type << "-" << std::setw(2) << (uint32_t) address.m_len << "-";
|
||||
for (uint8_t i = 0; i < (address.m_len-1); ++i)
|
||||
{
|
||||
os << std::setw(2) << (uint32_t)address.m_data[i] << ":";
|
||||
}
|
||||
// Final byte not suffixed by ":"
|
||||
os << std::setw(2) << (uint32_t)address.m_data[address.m_len-1];
|
||||
os << std::setw(2) << (uint32_t) address.m_data[address.m_len-1];
|
||||
os.setf (std::ios::dec, std::ios::basefield);
|
||||
os.fill(' ');
|
||||
return os;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
AsInt (std::string v)
|
||||
{
|
||||
std::istringstream iss;
|
||||
iss.str (v);
|
||||
uint32_t retval;
|
||||
iss >> std::hex >> retval >> std::dec;
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::istream& operator>> (std::istream& is, Address & address)
|
||||
{
|
||||
// XXX: need to be able to parse this.
|
||||
std::string v;
|
||||
is >> v;
|
||||
std::string::size_type firstDash, secondDash;
|
||||
firstDash = v.find ("-");
|
||||
secondDash = v.find ("-", firstDash+1);
|
||||
std::string type = v.substr (0, firstDash-0);
|
||||
std::string len = v.substr (firstDash+1, secondDash-(firstDash+1));
|
||||
|
||||
address.m_type = AsInt (type);
|
||||
address.m_len = AsInt (len);
|
||||
NS_ASSERT (address.m_len <= Address::MAX_SIZE);
|
||||
|
||||
std::string::size_type col = secondDash + 1;
|
||||
for (uint8_t i = 0; i < address.m_len; ++i)
|
||||
{
|
||||
std::string tmp;
|
||||
std::string::size_type next;
|
||||
next = v.find (":", col);
|
||||
if (next == std::string::npos)
|
||||
{
|
||||
tmp = v.substr (col, v.size ()-col);
|
||||
address.m_data[i] = AsInt (tmp);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = v.substr (col, next-col);
|
||||
address.m_data[i] = AsInt (tmp);
|
||||
col = next + 1;
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,12 +159,18 @@ private:
|
||||
friend bool operator == (const Address &a, const Address &b);
|
||||
friend bool operator < (const Address &a, const Address &b);
|
||||
friend std::ostream& operator<< (std::ostream& os, const Address & address);
|
||||
friend std::istream& operator>> (std::istream& is, Address & address);
|
||||
|
||||
uint8_t m_type;
|
||||
uint8_t m_len;
|
||||
uint8_t m_data[MAX_SIZE];
|
||||
};
|
||||
|
||||
/**
|
||||
* \class ns3::AddressValue
|
||||
* \brief hold objects of type ns3::Address
|
||||
*/
|
||||
|
||||
ATTRIBUTE_HELPER_HEADER_2 (Address);
|
||||
|
||||
bool operator == (const Address &a, const Address &b);
|
||||
|
||||
@@ -32,7 +32,7 @@ TypeId DropTailQueue::GetTypeId (void)
|
||||
.SetParent<Queue> ()
|
||||
.AddConstructor<DropTailQueue> ()
|
||||
.AddAttribute ("MaxPackets", "The maximum number of packets accepted by this DropTailQueue.",
|
||||
Uinteger (100),
|
||||
UintegerValue (100),
|
||||
MakeUintegerAccessor (&DropTailQueue::m_maxPackets),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
;
|
||||
@@ -129,7 +129,7 @@ DropTailQueueTest::RunTests (void)
|
||||
bool result = true;
|
||||
|
||||
Ptr<DropTailQueue> queue = CreateObject<DropTailQueue> ();
|
||||
NS_TEST_ASSERT (queue->SetAttributeFailSafe ("MaxPackets", Uinteger (3)));
|
||||
NS_TEST_ASSERT (queue->SetAttributeFailSafe ("MaxPackets", UintegerValue (3)));
|
||||
|
||||
Ptr<Packet> p1, p2, p3, p4;
|
||||
p1 = Create<Packet> ();
|
||||
|
||||
@@ -185,6 +185,15 @@ private:
|
||||
uint32_t m_mask;
|
||||
};
|
||||
|
||||
/**
|
||||
* \class ns3::Ipv4AddressValue
|
||||
* \brief hold objects of type ns3::Ipv4Address
|
||||
*/
|
||||
/**
|
||||
* \class ns3::Ipv4MaskValue
|
||||
* \brief hold objects of type ns3::Ipv4Mask
|
||||
*/
|
||||
|
||||
ATTRIBUTE_HELPER_HEADER_2 (Ipv4Address);
|
||||
ATTRIBUTE_HELPER_HEADER_2 (Ipv4Mask);
|
||||
|
||||
|
||||
@@ -200,9 +200,40 @@ std::ostream& operator<< (std::ostream& os, const Mac48Address & address)
|
||||
return os;
|
||||
}
|
||||
|
||||
std::istream& operator>> (std::istream& is, const Mac48Address & address)
|
||||
static uint8_t
|
||||
AsInt (std::string v)
|
||||
{
|
||||
// XXX !
|
||||
std::istringstream iss;
|
||||
iss.str (v);
|
||||
uint32_t retval;
|
||||
iss >> std::hex >> retval >> std::dec;
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::istream& operator>> (std::istream& is, Mac48Address & address)
|
||||
{
|
||||
std::string v;
|
||||
is >> v;
|
||||
|
||||
std::string::size_type col = 0;
|
||||
for (uint8_t i = 0; i < 6; ++i)
|
||||
{
|
||||
std::string tmp;
|
||||
std::string::size_type next;
|
||||
next = v.find (":", col);
|
||||
if (next == std::string::npos)
|
||||
{
|
||||
tmp = v.substr (col, v.size ()-col);
|
||||
address.m_address[i] = AsInt (tmp);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = v.substr (col, next-col);
|
||||
address.m_address[i] = AsInt (tmp);
|
||||
col = next + 1;
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,17 +107,23 @@ private:
|
||||
static uint8_t GetType (void);
|
||||
friend bool operator < (const Mac48Address &a, const Mac48Address &b);
|
||||
friend bool operator == (const Mac48Address &a, const Mac48Address &b);
|
||||
friend std::istream& operator>> (std::istream& is, Mac48Address & address);
|
||||
|
||||
uint8_t m_address[6];
|
||||
};
|
||||
|
||||
/**
|
||||
* \class ns3::Mac48AddressValue
|
||||
* \brief hold objects of type ns3::Mac48Address
|
||||
*/
|
||||
|
||||
ATTRIBUTE_HELPER_HEADER_2 (Mac48Address);
|
||||
|
||||
bool operator == (const Mac48Address &a, const Mac48Address &b);
|
||||
bool operator != (const Mac48Address &a, const Mac48Address &b);
|
||||
bool operator < (const Mac48Address &a, const Mac48Address &b);
|
||||
std::ostream& operator<< (std::ostream& os, const Mac48Address & address);
|
||||
std::istream& operator>> (std::istream& is, const Mac48Address & address);
|
||||
std::istream& operator>> (std::istream& is, Mac48Address & address);
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
@@ -30,9 +30,8 @@ namespace ns3 {
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("NodeList");
|
||||
|
||||
|
||||
/**
|
||||
* The private node list used by the static-based API
|
||||
* \brief private implementation detail of the NodeList API.
|
||||
*/
|
||||
class NodeListPriv : public Object
|
||||
{
|
||||
@@ -55,15 +54,17 @@ private:
|
||||
std::vector<Ptr<Node> > m_nodes;
|
||||
};
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (NodeListPriv);
|
||||
|
||||
TypeId
|
||||
NodeListPriv::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("NodeListPriv")
|
||||
static TypeId tid = TypeId ("ns3::NodeListPriv")
|
||||
.SetParent<Object> ()
|
||||
.AddAttribute ("NodeList", "The list of all nodes created during the simulation.",
|
||||
ObjectVector (),
|
||||
ObjectVectorValue (),
|
||||
MakeObjectVectorAccessor (&NodeListPriv::m_nodes),
|
||||
MakeObjectVectorChecker ())
|
||||
MakeObjectVectorChecker<Node> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
+5
-5
@@ -37,16 +37,16 @@ Node::GetTypeId (void)
|
||||
static TypeId tid = TypeId ("ns3::Node")
|
||||
.SetParent<Object> ()
|
||||
.AddAttribute ("DeviceList", "The list of devices associated to this Node.",
|
||||
ObjectVector (),
|
||||
ObjectVectorValue (),
|
||||
MakeObjectVectorAccessor (&Node::m_devices),
|
||||
MakeObjectVectorChecker ())
|
||||
MakeObjectVectorChecker<NetDevice> ())
|
||||
.AddAttribute ("ApplicationList", "The list of applications associated to this Node.",
|
||||
ObjectVector (),
|
||||
ObjectVectorValue (),
|
||||
MakeObjectVectorAccessor (&Node::m_applications),
|
||||
MakeObjectVectorChecker ())
|
||||
MakeObjectVectorChecker<Application> ())
|
||||
.AddAttribute ("Id", "The id (unique integer) of this Node.",
|
||||
TypeId::ATTR_GET, // allow only getting it.
|
||||
Uinteger (0),
|
||||
UintegerValue (0),
|
||||
MakeUintegerAccessor (&Node::m_id),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
;
|
||||
|
||||
+3
-3
@@ -31,11 +31,11 @@ Queue::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Queue")
|
||||
.SetParent<Object> ()
|
||||
.AddTraceSource ("Enqueue", "XXX",
|
||||
.AddTraceSource ("Enqueue", "Enqueue a packet in the queue.",
|
||||
MakeTraceSourceAccessor (&Queue::m_traceEnqueue))
|
||||
.AddTraceSource ("Dequeue", "XXX",
|
||||
.AddTraceSource ("Dequeue", "Dequeue a packet from the queue.",
|
||||
MakeTraceSourceAccessor (&Queue::m_traceDequeue))
|
||||
.AddTraceSource ("Drop", "XXX",
|
||||
.AddTraceSource ("Drop", "Drop a packet stored in the queue.",
|
||||
MakeTraceSourceAccessor (&Queue::m_traceDrop))
|
||||
;
|
||||
return tid;
|
||||
|
||||
+10
-10
@@ -32,52 +32,52 @@ Tcp::GetTypeId (void)
|
||||
.SetParent<SocketFactory> ()
|
||||
.AddAttribute ("DefaultSegmentSize",
|
||||
"Default TCP maximum segment size in bytes (may be adjusted based on MTU discovery)",
|
||||
Uinteger (536),
|
||||
UintegerValue (536),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultSegSize),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultAdvertisedWindowSize",
|
||||
"Default TCP advertised window size (bytes)",
|
||||
Uinteger (0xffff),
|
||||
UintegerValue (0xffff),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultAdvWin),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultSlowStartThreshold",
|
||||
"Default TCP slow start threshold (bytes)",
|
||||
Uinteger (0xffff),
|
||||
UintegerValue (0xffff),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultSsThresh),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultTxBufferSize",
|
||||
"Default TCP maximum transmit buffer size (bytes)",
|
||||
Uinteger (0xffffffffl),
|
||||
UintegerValue (0xffffffffl),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultTxBuffer),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultRxBufferSize",
|
||||
"Default TCP maximum receive buffer size (bytes)",
|
||||
Uinteger (0xffffffffl),
|
||||
UintegerValue (0xffffffffl),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultRxBuffer),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultInitialCongestionWindowSize",
|
||||
"Default TCP initial congestion window size (segments)",
|
||||
Uinteger (1),
|
||||
UintegerValue (1),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultInitialCwnd),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultConnTimeout",
|
||||
"Default TCP retransmission timeout when opening connection (seconds)",
|
||||
Uinteger (3),
|
||||
UintegerValue (3),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultConnTimeout),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultConnCount",
|
||||
"Default number of connection attempts (SYN retransmissions) before returning failure",
|
||||
Uinteger (6),
|
||||
UintegerValue (6),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultConnCount),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultDelAckTimeout",
|
||||
"Default timeout value for TCP delayed acks, in seconds",
|
||||
Double (0.2),
|
||||
DoubleValue (0.2),
|
||||
MakeDoubleAccessor (&Tcp::m_defaultDelAckTimeout),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("DefaultDelAckCount",
|
||||
"Default number of packets to wait before sending a TCP ack",
|
||||
Uinteger (2),
|
||||
UintegerValue (2),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultDelAckCount),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
;
|
||||
|
||||
Reference in new issue
Block a user