19 #include "ns3/string.h"
20 #include "nsc-sysctl.h"
22 #include "sim_interface.h"
62 obj->Set (m_name, value->Get ());
78 value->Set (obj->Get (m_name));
91 std::string name =
"ns3::Ns3NscStack<";
106 tid =
TypeId (name.c_str ());
109 for (
int i=0; m_stack->sysctl_getnum (i, buf,
sizeof(buf)) > 0; i++)
112 if (m_stack->sysctl_get (buf, value,
sizeof(value)) > 0)
116 Create<NscStackStringAccessor> (buf),
117 MakeStringChecker ());
125 Ns3NscStack::Get (std::string name)
const
128 if (m_stack->sysctl_get (name.c_str (), buf,
sizeof(buf)) <= 0)
132 return std::string (buf);
136 Ns3NscStack::Set (std::string name, std::string value)
138 int ret = m_stack->sysctl_set (name.c_str (), value.c_str ());
141 NS_FATAL_ERROR (
"setting " << name <<
" to " << value <<
"failed (retval " << ret <<
")");
145 NS_OBJECT_ENSURE_REGISTERED (Ns3NscStack);
148 Ns3NscStack::Ns3NscStack::GetTypeId (
void)
150 static TypeId tid = TypeId (
"ns3::Ns3NscStack")
151 .SetParent<Object> ()
virtual bool HasGetter(void) const
hold variables of type string
Hold a value for an Attribute.
virtual TypeId GetInstanceTypeId(void) const
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
implement the ns-3 type and attribute system
#define NS_FATAL_ERROR(msg)
fatal error handling
virtual const char * get_name()=0
allow setting and getting the value of an attribute.
virtual bool Get(const ObjectBase *object, AttributeValue &val) const
TypeId AddAttribute(std::string name, std::string help, const AttributeValue &initialValue, Ptr< const AttributeAccessor > accessor, Ptr< const AttributeChecker > checker)
virtual bool HasSetter(void) const
virtual bool Set(ObjectBase *object, const AttributeValue &val) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)