Merge branch 'release-0.5'
diff --git a/PyNDN/Data.py b/PyNDN/Data.py
new file mode 100644
index 0000000..99a3d07
--- /dev/null
+++ b/PyNDN/Data.py
@@ -0,0 +1,151 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+import ns.ndnSIM
+from Name import Name
+
+class DataError (Exception):
+ pass
+
+class Data (object):
+ _data = None
+
+ def __init__(self,
+ name = None, content = None, signed_info = None,
+ data = None):
+ if data:
+ if type (data) is Data:
+ self._data = data._data
+ elif type (data) is ns.ndnSIM.ndn.ContentObject:
+ self._data = data
+ else:
+ raise TypeError ("Invalid type supplied for 'data' parameter [%s]" % type (data))
+ else:
+ self._data = ns.ndnSIM.ndn.ContentObject ()
+
+ self.name = name
+ self.content = content
+ self.signedInfo = signed_info or SignedInfo ()
+
+ @staticmethod
+ def fromWire (wire):
+ data = Data (data = ns.ndnSIM.ndn.Wire.ToData (wire))
+ # timestamp
+ data.signedInfo.freshnessSeconds = data._data.GetFreshness ()
+ if data._data.GetKeyLocator ():
+ data.keyLocator = Name (_name = data._data.GetKeyLocator ())
+
+ def sign (self, key):
+ """There is no actual signing in ndnSIM for now, but we will assign signature bits based on key"""
+ self._data.SetSignature (key.fakeKey)
+
+ def toWire (self):
+ if self._data.GetSignature () == 0:
+ raise DataError ("Data packet has not been signed, cannot create wire format")
+
+ return ns.ndnSIM.ndn.Wire.FromData (self._data)
+
+ def verify_signature (self, key):
+ """There is no actual signing in ndnSIM for now, but we will check if signature matches the key"""
+ return self._data.GetSignature () == key.fakeKey
+
+ def __getattr__ (self, name):
+ if name == "_data":
+ return object.__getattr__ (self, name)
+
+ elif name == "signedInfo":
+ return object.__getattr__ (self, name)
+ elif name == "name":
+ return Name (self._data.GetName ())
+ elif name == "scope":
+ return self._data.GetScope ()
+ elif name == "interestLifetime":
+ return self._data.GetInterestLifetime ().ToDouble (ns.core.Time.S)
+ elif name == "content":
+ pkt = self._data.GetContent ()
+ return ns.ndnSIM.ndn.PacketToBuffer (pkt)
+ else:
+ return self._data.__getattribute__ (name)
+
+ def __setattr__(self, name, value):
+ if name == "_data":
+ return object.__setattr__ (self, name, value)
+
+ elif name == 'signedInfo':
+ if not value:
+ return
+ if type (value) is SignedInfo:
+ object.__setattr__ (self, name, value)
+
+ if value.timestamp:
+ # ?
+ pass
+ if value.freshnessSeconds:
+ self._data.SetFreshness (ns.core.Seconds (value))
+ if value.keyLocator:
+ self._data.SetKeyLocator (value._name)
+ else:
+ raise TypeError ("signedInfo can be assigned either None or SignedInfo object, [%s] supplied" % type (value))
+ elif name == "name":
+ if not value:
+ return self._data.SetName (ns.ndnSIM.ndn.Name ())
+ elif type (value) is Name:
+ return self._data.SetName (value._name)
+ elif type (value) is ns.ndnSIM.ndn.Name:
+ return self._data.SetName (value)
+ elif type (value) is str:
+ return self._data.SetName (ns.ndnSIM.ndn.Name (value))
+ else:
+ raise ValueError ("Invalid name parameter")
+ elif name == "content":
+ if not value:
+ pkt = ns.network.Packet ()
+ self._data.SetPayload (pkt)
+ else:
+ pkt = ns.ndnSIM.ndn.BufferToPacket (bytes (value))
+ self._data.SetPayload (pkt)
+ else:
+ raise NameError ("Unknown attribute [%s]" % name)
+
+ def __repr__(self):
+ return "ndn.Data(%s)" % str (self._data)
+
+class SignedInfo (object):
+ def __init__(self, keyLocator = None, freshness = None, timestamp = None):
+
+ self.timestamp = timestamp
+ self.freshnessSeconds = freshness
+ self.keyLocator = keyLocator
+
+ def __repr__(self):
+ args = []
+
+ if self.keyLocator is not None:
+ args += ["keyLocator=%r" % self.keyLocator]
+ if self.freshnessSeconds is not None:
+ args += ["freshness=%r" % self.freshnessSeconds]
+ if self.timeStamp is not None:
+ args += ["timestamp=%r" % self.timestamp]
+
+ return "ndn.SignedInfo(%s)" % ", ".join(args)
+
+class ContentObject (Data):
+ """For backwards compatibility"""
+ pass
+
diff --git a/PyNDN/Face.py b/PyNDN/Face.py
new file mode 100644
index 0000000..6186569
--- /dev/null
+++ b/PyNDN/Face.py
@@ -0,0 +1,103 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+import ns.core
+import ns.network
+import ns.ndnSIM
+from Data import Data
+from Interest import Interest
+
+import functools
+
+class Face (ns.ndnSIM.ndn.ApiFace):
+ def __init__(self):
+ self.nodeId = ns.core.Simulator.GetContext ()
+ self.node = ns.network.NodeList.GetNode (self.nodeId)
+ super(Face, self).__init__ (self.node)
+
+ def connect (self):
+ pass
+
+ def disconnect (self):
+ self.Shutdown ()
+
+ def defer_verification (self, deferVerification = True):
+ pass
+
+ def expressInterestSimple (self, name, onData, onTimeout, template = None):
+ """
+ onData: void <interest, name>
+ onTimeout: void <interest>
+ """
+
+ interest = Interest (interest = template)
+ interest.name = name
+
+ class OnDataConvert:
+ def __init__ (self, onData):
+ self.onData = onData
+ def __call__ (self, interest, data):
+ if self.onData:
+ return self.onData (Interest (interest=interest), Data (data = data))
+
+ class OnTimeoutConvert:
+ def __init__ (self, onTimeout):
+ self.onTimeout = onTimeout
+ def __call__ (self, interest):
+ if self.onTimeout:
+ self.onTimeout (Interest (interest=interest))
+
+ self.ExpressInterest (interest, OnDataConvert (onData), OnTimeoutConvert (onTimeout))
+
+ def setInterestFilterSimple (self, name, onInterest, flags = None):
+ """
+ onInterest: void <name, interest>
+ """
+
+ class OnInterestConvert:
+ def __init__ (self, onInterest):
+ self.onInterest = onInterest
+ def __call__ (self, name, interest):
+ if self.onInterest:
+ self.onInterest (Name (name = name), Interest (interest = interest))
+
+ self.SetInterestFilter (name, OnInterestConvert (onInterest))
+
+ def clearInterestFilter (self, name):
+ if type (name) is Name:
+ self.ClearInterestFilter (name._name)
+ elif type (name) is ns.ndnSIM.ndn.Name:
+ self.ClearInterestFilter (name)
+ else:
+ raise TypeError ("Wrong type for 'name' parameter [%s]" % type (name))
+
+ def get (self, name, template = None, timeoutms = 3000):
+ raise NotImplementedError ("NS-3 simulation cannot have syncrhonous operations")
+
+ def put (self, data):
+ self.Put (data)
+
+class EventLoop(object):
+ def execute (self, event):
+ ns.core.Simulator.ScheduleNow (event)
+
+ def run (self, timeoutMs):
+ ns.core.Simulator.Stop (ns.core.MilliSeconds (timeoutMs))
+ ns.core.Simulator.Run ()
+ ns.core.Simulator.Destroy ()
diff --git a/PyNDN/Interest.py b/PyNDN/Interest.py
new file mode 100644
index 0000000..571bc36
--- /dev/null
+++ b/PyNDN/Interest.py
@@ -0,0 +1,97 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+import ns.ndnSIM
+import ns.core
+from Name import Name
+
+class Interest (object):
+ _interest = None
+
+ def __init__(self,
+ name = None, scope = None, interestLifetime = None,
+ interest = None):
+ if interest:
+ if type (interest) is Interest:
+ self._interest = interest._interest
+ elif type (interest) is ns.ndnSIM.ndn.Interest:
+ self._interest = interest
+ else:
+ raise TypeError ("Invalid type supplied for 'interest' parameter [%s]" % type (interest))
+ else:
+ self._interest = ns.ndnSIM.ndn.Interest ()
+
+ self.name = name
+ self.scope = scope
+ self.interestLifetime = interestLifetime
+
+ @staticmethod
+ def fromWire (wire):
+ return Interest (interest = ns.ndnSIM.ndn.Wire.ToInterest (wire))
+
+ def toWire (self):
+ return ns.ndnSIM.ndn.Wire.FromInterest (self._interest)
+
+ def __getattr__ (self, name):
+ if name == "_interest":
+ return object.__getattr__ (self, name)
+
+ elif name == "name":
+ return Name (self._interest.GetName ())
+ elif name == "scope":
+ return self._interest.GetScope ()
+ elif name == "interestLifetime":
+ return self._interest.GetInterestLifetime ().ToDouble (ns.core.Time.S)
+ else:
+ return self._interest.__getattribute__ (name)
+
+ def __setattr__(self, name, value):
+ if name == "_interest":
+ return object.__setattr__ (self, name, value)
+
+ elif name == "name":
+ if not value:
+ return self._interest.SetName (ns.ndnSIM.ndn.Name ())
+ elif type (value) is Name:
+ return self._interest.SetName (value._name)
+ elif type (value) is ns.ndnSIM.ndn.Name:
+ return self._interest.SetName (value)
+ elif type (value) is str:
+ return self._interest.SetName (ns.ndnSIM.ndn.Name (value))
+ else:
+ raise ValueError ("Invalid name parameter")
+ elif name == "scope":
+ if not value:
+ return self._interest.SetScope (-1)
+ elif type (value) is int:
+ return self._interest.SetScope (value)
+ else:
+ raise ValueError ("Scope parameter should be int, [%s] supplied" % type (value))
+ elif name == "interestLifetime":
+ if not value:
+ return self._interest.SetInterestLifetime (ns.core.Time ())
+ elif type (value) is float or type (value) is int:
+ return self._interest.SetInterestLifetime (ns.core.Seconds (value))
+ else:
+ raise ValueError ("interestLifetime parameter should be fload or int, [%s] supplied" % type (value))
+ else:
+ raise ValueError ("Unknown or unsupported attribute [%s]" % name)
+
+ def __repr__(self):
+ return "ndnSIM.Interest(%s)" % str (self._interest)
diff --git a/PyNDN/Key.py b/PyNDN/Key.py
new file mode 100644
index 0000000..b5c065b
--- /dev/null
+++ b/PyNDN/Key.py
@@ -0,0 +1,98 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+import ns.core
+import ns.ndnSIM
+from Name import Name
+
+class Key(object):
+ def __init__ (self):
+ # self.publicKeyID = None # SHA256 hash
+ self.fakeKey = None
+
+ def generateRSA(self, numbits):
+ randVar = ns.core.UniformVariable ()
+ self.fakeKey = randVar.GetInteger (0, 2147483647)
+
+ def privateToDER(self):
+ return self.fakeKey
+
+ def publicToDER(self):
+ return self.privateToDER ()
+
+ def privateToPEM(self, filename = None, password = None):
+ if filename:
+ f = open(filename, 'w')
+ f.write (self.fakeKey)
+ f.close()
+ else:
+ return self.fakeKey
+
+ def publicToPEM(self, filename = None):
+ return privateToPEM (filename)
+
+ def fromDER(self, private = None, public = None):
+ if private:
+ self.fakeKey = private
+ elif public:
+ self.fakeKey = public
+
+ def fromPEM(self, filename = None, private = None, public = None, password = None):
+ if filename:
+ f = open(filename, 'r')
+ self.fakeKey = f.read ()
+ f.close()
+ elif private:
+ self.fakeKey = private
+ elif public:
+ self.fakeKey = public
+
+ @staticmethod
+ def createFromDER (private = None, public = None):
+ key = Key ()
+ key.fromDER (private, public)
+ return key
+
+ @staticmethod
+ def createFromPEM (filename = None, private = None, public = None, password = None):
+ key = Key ()
+ key.fromPEM (filename, private, public, password)
+ return key
+
+ @staticmethod
+ def getDefaultKey ():
+ context = ns.core.Simulator.GetContext ()
+ key = Key ()
+ key.fakeKey = context
+ return key
+
+
+class KeyLocator(object):
+ def __init__(self, keyName = None):
+ self.keyName = keyName
+
+ @staticmethod
+ def getDefaultKeyLocator():
+ context = ns.core.Simulator.GetContext ()
+ keyLocator = ns.ndnSIM.ndn.Name ()
+ keyLocator.\
+ append ("default-key").\
+ append (str (context))
+
+ return Name (keyLocator)
diff --git a/PyNDN/Name.py b/PyNDN/Name.py
new file mode 100644
index 0000000..05c34b0
--- /dev/null
+++ b/PyNDN/Name.py
@@ -0,0 +1,73 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+import ns.ndnSIM
+
+class Name ():
+ _name = None
+
+ def __init__ (self,
+ value = None,
+ name = None):
+ if name:
+ if type (name) is ns.ndnSIM.ndn.Name:
+ self._name = name
+ elif type (name) is Name:
+ self._name = name._name
+ else:
+ raise TypeError ("Incorrect type for 'name' parameter [%s]" % type (name))
+ else:
+ if value:
+ self._name = ns.ndnSIM.ndn.Name (value)
+ else:
+ self._name = ns.ndnSIM.ndn.Name ()
+
+ @staticmethod
+ def fromWire (wire):
+ return Name (name = ns.ndnSIM.ndn.Wire.ToName (wire))
+
+ def toWire (self):
+ return ns.ndnSIM.ndn.Wire.FromName (self._name)
+
+ def __getattr__ (self, name):
+ return self._name.__getattribute__ (name)
+
+ def __len__ (self):
+ return self._name.size ()
+
+ def __add__ (self, other):
+ return self._name.append (other)
+
+ def __getitem__(self, key):
+ if type (key) is int:
+ if abs(key) < self._name.size ():
+ return self._name.get (key)
+ else:
+ raise IndexError ("index out of range")
+ elif type (key) is slice:
+ name = ns.ndnSIM.ndn.Name ()
+ for component in xrange (*key.indices (self.size ())):
+ name.append (self._name.get (component))
+ return name
+ else:
+ raise ValueError("Unknown __getitem__ type: %s" % type (key))
+
+ def __repr__ (self):
+ return "ndnSIM.Name('" + self._name.toUri () + "')"
+
diff --git a/PyNDN/__init__.py b/PyNDN/__init__.py
new file mode 100644
index 0000000..0c0e288
--- /dev/null
+++ b/PyNDN/__init__.py
@@ -0,0 +1,36 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+__all__ = ['Face', 'Name', 'Interest', 'Data', 'Key', 'ContentObject']
+
+VERSION = 0.3
+NDNSIM = True
+
+import sys as _sys
+
+try:
+ from Face import Face, EventLoop
+ from Name import Name
+ from Interest import Interest
+ from Data import Data, ContentObject, SignedInfo
+ from Key import Key
+
+except ImportError:
+ del _sys.modules[__name__]
+ raise
diff --git a/PyNDN/impl/__init__.py b/PyNDN/impl/__init__.py
new file mode 100644
index 0000000..e048223
--- /dev/null
+++ b/PyNDN/impl/__init__.py
@@ -0,0 +1,18 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
diff --git a/PyNDN/impl/ccnb.py b/PyNDN/impl/ccnb.py
new file mode 100644
index 0000000..b95b3fa
--- /dev/null
+++ b/PyNDN/impl/ccnb.py
@@ -0,0 +1,129 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+__TT_BITS__ = 3
+__TT_MASK__ = (1 << __TT_BITS__) - 1
+__TT_HBIT__ = (1 << 7)
+__TT_LBIT__ = __TT_HBIT__ - 1
+
+DTAG_NAME = 14
+DTAG_COLLECTION = 17
+DTAG_LINK = 31
+
+def blob(value):
+ return _encode(len(value), 5) + value
+
+def dtag(tag, value):
+ return _encode(tag, 2) + value + '\x00'
+
+def _encode(value, tt):
+ global __TT_BITS__, __TT_HBIT__, __TT_LBIT__
+
+ header = (value << __TT_BITS__) | tt
+
+ blocks = []
+ blocks.append((header & __TT_LBIT__) | __TT_HBIT__)
+ header >>= 7
+
+ while header != 0:
+ blocks.append(header & __TT_LBIT__)
+ header >>= 7
+
+ blocks.reverse()
+
+ return bytearray(blocks)
+
+class CCNBDecoder(object):
+ def __init__(self, ccnb_data):
+ self.ccnb_data = ccnb_data
+ self.reset()
+
+ def reset(self):
+ self.position = 0
+ self.decoded = 0
+ self.stack = []
+
+ def _process_next_byte(self):
+ global __TT_HBIT__, __TT_LBIT__
+
+ assert self.position < len(self.ccnb_data)
+
+ char = ord(self.ccnb_data[self.position])
+ self.position += 1
+
+ if self.decoded == 0 and char == 0:
+ return None, True
+
+ decoded = (self.decoded << 7) | (char & __TT_LBIT__)
+ complete = (char & __TT_HBIT__) == __TT_HBIT__
+
+ self.decoded = decoded if not complete else 0
+
+ return decoded, complete
+
+ def print_element(self, tt, value, data = None):
+ if tt == 2:
+ print "DTAG",
+
+ if value == 14:
+ print "Name"
+ elif value == 15:
+ print "Component"
+ elif value == 17:
+ print "Collection"
+ elif value == 31:
+ print "Link"
+ else:
+ print value
+
+ elif tt == 5:
+ print "BLOB",
+ print value,
+ print repr(data)
+ else:
+ print tt,
+ print value,
+ print repr(data)
+
+ def get_tags(self):
+ global __TT_MASK__, __TT_BITS__
+
+ while self.position < len(self.ccnb_data):
+ while True:
+ decoded, complete = self._process_next_byte()
+ if complete:
+ break
+
+ if decoded is None:
+ tt, value = self.stack.pop()
+ print "Close",
+ else:
+ tt = decoded & __TT_MASK__
+ value = decoded >> __TT_BITS__
+
+ data = None
+ if decoded is not None:
+ if tt == 2:
+ self.stack.append((tt, value))
+ elif tt == 5:
+ data = self.ccnb_data[self.position:self.position + value]
+ self.position += value
+
+ self.print_element(tt, value, data)
+
diff --git a/PyNDN/impl/enumeration.py b/PyNDN/impl/enumeration.py
new file mode 100644
index 0000000..851e43c
--- /dev/null
+++ b/PyNDN/impl/enumeration.py
@@ -0,0 +1,29 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+import ndn
+from ndn.impl import ccnb
+
+def ccnb_enumerate(names):
+ out = bytearray()
+
+ for name in names:
+ out += ccnb.dtag(ccnb.DTAG_LINK, name.get_ccnb())
+
+ return ccnb.dtag(ccnb.DTAG_COLLECTION, out)
diff --git a/PyNDN/impl/segmenting.py b/PyNDN/impl/segmenting.py
new file mode 100644
index 0000000..fb2d253
--- /dev/null
+++ b/PyNDN/impl/segmenting.py
@@ -0,0 +1,55 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+import math
+import ndn
+
+class Wrapper(object):
+ def __init__(self, name, key):
+ self.name = name
+ self.key = key
+
+ kl = ndn.KeyLocator(key)
+ self.signed_info = ndn.SignedInfo(key_locator = kl, key_digest = key.publicKeyID)
+
+ def __call__(self, chunk, segment, segments):
+ name = self.name + ndn.Name.num2seg(segment)
+ self.signed_info.finalBlockID = ndn.Name.num2seg(segments - 1)
+
+ co = ndn.ContentObject(name = name, content = chunk, signed_info = self.signed_info)
+ co.sign(self.key)
+
+ return co
+
+def segmenter(data, wrapper = None, chunk_size = 4096):
+ segment = 0
+ segments = math.ceil(len(data) / float(chunk_size))
+
+ while segment < segments:
+ start = segment * chunk_size
+ end = min(start + chunk_size, len(data))
+ chunk = data[start : end]
+
+ if wrapper is not None:
+ chunk = wrapper(chunk, segment, segments)
+
+ yield chunk
+
+ segment += 1
+
diff --git a/PyNDN/utils.py b/PyNDN/utils.py
new file mode 100644
index 0000000..7cfe514
--- /dev/null
+++ b/PyNDN/utils.py
@@ -0,0 +1,98 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# Alexander Afanasyev
+#
+# GNU 3.0 license, See the LICENSE file for more information
+#
+# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+#
+
+#
+# Based on PyCCN code, copyrighted and licensed as follows
+#
+# Copyright (c) 2011-2013, Regents of the University of California
+# BSD license, See the COPYING file for more information
+# Written by: Derek Kulinski <takeda@takeda.tk>
+# Jeff Burke <jburke@ucla.edu>
+#
+
+import struct
+
+class Flag(int):
+ __initialized = False
+ _flags = None
+ _prefix = None
+ __flags_values__ = None
+
+ @classmethod
+ def initialize(cls):
+ cls._flags = {}
+ cls.__flags_values__ = {}
+ cls.__initialized = True
+
+ @classmethod
+ def new_flag(cls, name, value):
+ if not cls.__initialized:
+ cls.initialize()
+
+ cls._flags[value] = name
+
+ obj = cls(value)
+ cls.__flags_values__[value] = obj
+
+ return obj
+
+ def __new__(cls, value):
+ if cls.__flags_values__.has_key(value):
+ return cls.__flags_values__[value]
+
+ return super(Flag, cls).__new__(cls, value)
+
+ def generate_repr(self):
+ val = long(self)
+ flags = [name for i, name in self._flags.items() if i & val]
+ return " | ".join(flags)
+
+ def __repr__(self):
+ if self._prefix:
+ return self._prefix + "." + self.generate_repr()
+
+ t = type(self)
+ type_name = "%s.%s" % (t.__module__, t.__name__)
+ return "<flags %s of type %s>" % (self.generate_repr(), type_name)
+
+ def __and__(self, other):
+ cls = type(self)
+ return cls(long(self) & long(other))
+
+ def __xor__(self, other):
+ cls = type(self)
+ return cls(long(self) ^ long(other))
+
+ def __or__(self, other):
+ cls = type(self)
+ return cls(long(self) | long(other))
+
+class Enum(Flag):
+ def __new__(cls, value):
+ if cls.__flags_values__.has_key(value):
+ return cls.__flags_values__[value]
+
+ if cls._flags.has_key(value):
+ return super(Enum, cls).__new__(cls, value)
+
+ raise ValueError("invalid flag value: %d" % value)
+
+ def generate_repr(self):
+ return self._flags[long(self)]
+
+def ccn2py_time(value):
+ bintime = b'\x00' * (8 - len(value)) + value
+ inttime = struct.unpack("!Q", bintime)[0]
+ return inttime / 4096.0
+
+def py2ccn_time(value):
+ inttime = int(value * 4096 + 0.5)
+ bintime = struct.pack("!Q", inttime)
+ return bintime.lstrip(b'\x00')
diff --git a/apps/callback-based-app.cc b/apps/callback-based-app.cc
new file mode 100644
index 0000000..34c3de6
--- /dev/null
+++ b/apps/callback-based-app.cc
@@ -0,0 +1,79 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ * Zhenkai Zhu
+ *
+ * GNU v3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "callback-based-app.h"
+
+#include <ns3/log.h>
+
+NS_LOG_COMPONENT_DEFINE ("CallbackBasedApp");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (CallbackBasedApp);
+
+TypeId
+CallbackBasedApp::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::CallbackBasedApp")
+ .SetGroupName ("Ndn")
+ .SetParent<Application> ()
+ .AddConstructor<CallbackBasedApp> ()
+
+ .AddAttribute ("OnStart", "OnStart callback",
+ CallbackValue (),
+ MakeCallbackAccessor (&CallbackBasedApp::m_onStart),
+ MakeCallbackChecker ())
+
+ .AddAttribute ("OnStop", "OnStop callback",
+ CallbackValue (),
+ MakeCallbackAccessor (&CallbackBasedApp::m_onStop),
+ MakeCallbackChecker ())
+ ;
+ return tid;
+}
+
+CallbackBasedApp::CallbackBasedApp ()
+{
+}
+
+CallbackBasedApp::~CallbackBasedApp ()
+{
+}
+
+void
+CallbackBasedApp::SetOnStartCallback (Callback< void, Ptr<Application> > onStart)
+{
+ m_onStart = onStart;
+}
+
+void
+CallbackBasedApp::SetOnStopCallback (Callback< void, Ptr<Application> > onStop)
+{
+ m_onStop = onStop;
+}
+
+void
+CallbackBasedApp::StartApplication ()
+{
+ NS_LOG_FUNCTION (this);
+ if (!m_onStart.IsNull ())
+ m_onStart (this);
+}
+
+void
+CallbackBasedApp::StopApplication ()
+{
+ NS_LOG_FUNCTION (this);
+ if (!m_onStop.IsNull ())
+ m_onStop (this);
+}
+
+}
diff --git a/apps/callback-based-app.h b/apps/callback-based-app.h
new file mode 100644
index 0000000..8cec638
--- /dev/null
+++ b/apps/callback-based-app.h
@@ -0,0 +1,68 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ * Zhenkai Zhu
+ *
+ * GNU v3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_CALLBACK_BASED_APP_H
+#define NDN_CALLBACK_BASED_APP_H
+
+#include "ns3/application.h"
+#include "ns3/ptr.h"
+#include "ns3/callback.h"
+
+namespace ns3 {
+
+/**
+ * @ingroup ndn
+ * @brief A meta application that can be used to create custom apps within Python bindings
+ */
+class CallbackBasedApp: public Application
+{
+public:
+ static TypeId GetTypeId ();
+
+ /**
+ * @brief Default constructor
+ */
+ CallbackBasedApp ();
+
+ /**
+ * @brief Virtual destructor
+ */
+ virtual
+ ~CallbackBasedApp ();
+
+ /**
+ * @brief Define callback that will be fired when application need to start its work
+ */
+ void
+ SetOnStartCallback (Callback< void, Ptr<Application> > onStart);
+
+ /**
+ * @brief Define callback that will be fired when application need to stop its work
+ */
+ void
+ SetOnStopCallback (Callback< void, Ptr<Application> > onStart);
+
+protected:
+ // inherited from Application base class. Originally they were private
+ virtual void
+ StartApplication (); ///< @brief Called at time specified by Start
+
+ virtual void
+ StopApplication (); ///< @brief Called at time specified by Stop
+
+private:
+ Callback< void, Ptr<Application> > m_onStart;
+ Callback< void, Ptr<Application> > m_onStop;
+};
+
+} // ns3
+
+#endif // NDN_CALLBACK_BASED_APP_H
diff --git a/apps/ndn-app.cc b/apps/ndn-app.cc
index d29f509..35db66e 100644
--- a/apps/ndn-app.cc
+++ b/apps/ndn-app.cc
@@ -64,8 +64,7 @@
}
App::App ()
- : m_protocolHandler (0)
- , m_active (false)
+ : m_active (false)
, m_face (0)
{
}
@@ -85,12 +84,6 @@
Application::DoDispose ();
}
-void
-App::RegisterProtocolHandler (ProtocolHandler handler)
-{
- m_protocolHandler = handler;
-}
-
uint32_t
App::GetId () const
{
@@ -101,25 +94,24 @@
}
void
-App::OnInterest (const Ptr<const Interest> &interest, Ptr<Packet> packet)
+App::OnInterest (Ptr<const Interest> interest)
{
NS_LOG_FUNCTION (this << interest);
m_receivedInterests (interest, this, m_face);
}
void
-App::OnNack (const Ptr<const Interest> &interest, Ptr<Packet> packet)
+App::OnNack (Ptr<const Interest> interest)
{
NS_LOG_FUNCTION (this << interest);
m_receivedNacks (interest, this, m_face);
}
void
-App::OnContentObject (const Ptr<const ContentObject> &contentObject,
- Ptr<Packet> payload)
+App::OnContentObject (Ptr<const ContentObject> contentObject)
{
- NS_LOG_FUNCTION (this << contentObject << payload);
- m_receivedContentObjects (contentObject, payload, this, m_face);
+ NS_LOG_FUNCTION (this << contentObject);
+ m_receivedContentObjects (contentObject, this, m_face);
}
// Application Methods
@@ -164,7 +156,7 @@
// step 3. Destroy face
if (m_face->GetReferenceCount () != 1)
{
- NS_LOG_ERROR ("Please a bug report on https://github.com/NDN-Routing/ndnSIM/issues:");
+ NS_LOG_ERROR ("Please a bug report on https://github.com/NDN-Routing/ndnSIM/issues");
NS_LOG_ERROR ("At this point, nobody else should have referenced this face, but we have "
<< m_face->GetReferenceCount () << " references");
diff --git a/apps/ndn-app.h b/apps/ndn-app.h
index 57d1d83..fd29ab0 100644
--- a/apps/ndn-app.h
+++ b/apps/ndn-app.h
@@ -35,9 +35,6 @@
class Interest;
class ContentObject;
-typedef Interest InterestHeader;
-typedef ContentObject ContentObjectHeader;
-
class Face;
/**
@@ -49,11 +46,6 @@
class App: public Application
{
public:
- /**
- * @brief A callback to pass packets to underlying NDN protocol
- */
- typedef Callback<bool, const Ptr<const Packet>&> ProtocolHandler;
-
static TypeId GetTypeId ();
/**
@@ -63,12 +55,6 @@
virtual ~App ();
/**
- * @brief Register lower layer callback (to send interests from the application)
- */
- void
- RegisterProtocolHandler (ProtocolHandler handler);
-
- /**
* @brief Get application ID (ID of applications face)
*/
uint32_t
@@ -81,14 +67,14 @@
* may be useful to get packet tags
*/
virtual void
- OnInterest (const Ptr<const Interest> &interest, Ptr<Packet> packet);
+ OnInterest (Ptr<const Interest> interest);
/**
* @brief Method that will be called every time new NACK arrives
* @param interest Interest header
*/
virtual void
- OnNack (const Ptr<const Interest> &interest, Ptr<Packet> packet);
+ OnNack (Ptr<const Interest> interest);
/**
* @brief Method that will be called every time new ContentObject arrives
@@ -96,8 +82,7 @@
* @param payload payload (potentially virtual) of the ContentObject packet (may include packet tags of original packet)
*/
virtual void
- OnContentObject (const Ptr<const ContentObject> &contentObject,
- Ptr<Packet> payload);
+ OnContentObject (Ptr<const ContentObject> contentObject);
protected:
/**
@@ -114,7 +99,6 @@
StopApplication (); ///< @brief Called at time specified by Stop
protected:
- ProtocolHandler m_protocolHandler; ///< @brief A callback to pass packets to underlying NDN protocol
bool m_active; ///< @brief Flag to indicate that application is active (set by StartApplication and StopApplication)
Ptr<Face> m_face; ///< @brief automatically created application face through which application communicates
@@ -124,14 +108,14 @@
TracedCallback<Ptr<const Interest>,
Ptr<App>, Ptr<Face> > m_receivedNacks; ///< @brief App-level trace of received NACKs
- TracedCallback<Ptr<const ContentObject>, Ptr<const Packet>,
+ TracedCallback<Ptr<const ContentObject>,
Ptr<App>, Ptr<Face> > m_receivedContentObjects; ///< @brief App-level trace of received Data
TracedCallback<Ptr<const Interest>,
Ptr<App>, Ptr<Face> > m_transmittedInterests; ///< @brief App-level trace of transmitted Interests
- TracedCallback<Ptr<const ContentObject>, Ptr<const Packet>,
+ TracedCallback<Ptr<const ContentObject>,
Ptr<App>, Ptr<Face> > m_transmittedContentObjects; ///< @brief App-level trace of transmitted Data
};
diff --git a/apps/ndn-consumer-cbr.cc b/apps/ndn-consumer-cbr.cc
index 431f9ba..9a0a638 100644
--- a/apps/ndn-consumer-cbr.cc
+++ b/apps/ndn-consumer-cbr.cc
@@ -27,6 +27,7 @@
#include "ns3/string.h"
#include "ns3/boolean.h"
#include "ns3/uinteger.h"
+#include "ns3/integer.h"
#include "ns3/double.h"
#include "ns3/ndn-app-face.h"
diff --git a/apps/ndn-consumer-window.cc b/apps/ndn-consumer-window.cc
index 474c4fc..ae4a0c9 100644
--- a/apps/ndn-consumer-window.cc
+++ b/apps/ndn-consumer-window.cc
@@ -27,6 +27,8 @@
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/double.h"
+#include "ns3/ndn-content-object.h"
+#include "ns3/ndn-interest.h"
NS_LOG_COMPONENT_DEFINE ("ndn.ConsumerWindow");
@@ -184,10 +186,9 @@
///////////////////////////////////////////////////
void
-ConsumerWindow::OnContentObject (const Ptr<const ContentObject> &contentObject,
- Ptr<Packet> payload)
+ConsumerWindow::OnContentObject (Ptr<const ContentObject> contentObject)
{
- Consumer::OnContentObject (contentObject, payload);
+ Consumer::OnContentObject (contentObject);
m_window = m_window + 1;
@@ -198,9 +199,9 @@
}
void
-ConsumerWindow::OnNack (const Ptr<const Interest> &interest, Ptr<Packet> payload)
+ConsumerWindow::OnNack (Ptr<const Interest> interest)
{
- Consumer::OnNack (interest, payload);
+ Consumer::OnNack (interest);
if (m_inFlight > static_cast<uint32_t> (0)) m_inFlight--;
diff --git a/apps/ndn-consumer-window.h b/apps/ndn-consumer-window.h
index e89d0a7..42ee006 100644
--- a/apps/ndn-consumer-window.h
+++ b/apps/ndn-consumer-window.h
@@ -50,11 +50,10 @@
// OnInterest (const Ptr<const Interest> &interest);
virtual void
- OnNack (const Ptr<const Interest> &interest, Ptr<Packet> payload);
+ OnNack (Ptr<const Interest> interest);
virtual void
- OnContentObject (const Ptr<const ContentObject> &contentObject,
- Ptr<Packet> payload);
+ OnContentObject (Ptr<const ContentObject> contentObject);
virtual void
OnTimeout (uint32_t sequenceNumber);
diff --git a/apps/ndn-consumer-zipf-mandelbrot.cc b/apps/ndn-consumer-zipf-mandelbrot.cc
index e15cf3a..3f863f5 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.cc
+++ b/apps/ndn-consumer-zipf-mandelbrot.cc
@@ -176,22 +176,15 @@
//
Ptr<Name> nameWithSequence = Create<Name> (m_interestName);
- (*nameWithSequence) (seq);
+ nameWithSequence->appendSeqNum (seq);
//
- Interest interestHeader;
- interestHeader.SetNonce (m_rand.GetValue ());
- interestHeader.SetName (nameWithSequence);
+ Ptr<Interest> interest = Create<Interest> ();
+ interest->SetNonce (m_rand.GetValue ());
+ interest->SetName (nameWithSequence);
- // NS_LOG_INFO ("Requesting Interest: \n" << interestHeader);
+ // NS_LOG_INFO ("Requesting Interest: \n" << *interest);
NS_LOG_INFO ("> Interest for " << seq<<", Total: "<<m_seq<<", face: "<<m_face->GetId());
-
- Ptr<Packet> packet = Create<Packet> ();
-
- //NS_LOG_DEBUG ("= Interest for " << seq<<", Total: "<<m_seq<<", face: "<<m_face->GetId());
- packet->AddHeader (interestHeader);
- //NS_LOG_DEBUG ("Interest packet size: " << packet->GetSize ());
-
NS_LOG_DEBUG ("Trying to add " << seq << " with " << Simulator::Now () << ". already " << m_seqTimeouts.size () << " items");
m_seqTimeouts.insert (SeqTimeout (seq, Simulator::Now ()));
@@ -202,14 +195,13 @@
m_seqRetxCounts[seq] ++;
- m_transmittedInterests (&interestHeader, this, m_face);
-
m_rtt->SentSeq (SequenceNumber32 (seq), 1);
FwHopCountTag hopCountTag;
- packet->AddPacketTag (hopCountTag);
+ interest->GetPayload ()->AddPacketTag (hopCountTag);
- m_protocolHandler (packet);
+ m_transmittedInterests (interest, this, m_face);
+ m_face->ReceiveInterest (interest);
ConsumerZipfMandelbrot::ScheduleNextPacket ();
}
diff --git a/apps/ndn-consumer.cc b/apps/ndn-consumer.cc
index e5c2a44..619e2f1 100644
--- a/apps/ndn-consumer.cc
+++ b/apps/ndn-consumer.cc
@@ -27,6 +27,7 @@
#include "ns3/string.h"
#include "ns3/boolean.h"
#include "ns3/uinteger.h"
+#include "ns3/integer.h"
#include "ns3/double.h"
#include "ns3/ndn-app-face.h"
@@ -36,14 +37,9 @@
#include "ns3/ndnSIM/utils/ndn-rtt-mean-deviation.h"
#include <boost/ref.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
#include "ns3/names.h"
-namespace ll = boost::lambda;
-
NS_LOG_COMPONENT_DEFINE ("ndn.Consumer");
namespace ns3 {
@@ -199,28 +195,24 @@
//
Ptr<Name> nameWithSequence = Create<Name> (m_interestName);
- (*nameWithSequence) (seq);
+ nameWithSequence->appendSeqNum (seq);
//
- Interest interestHeader;
- interestHeader.SetNonce (m_rand.GetValue ());
- interestHeader.SetName (nameWithSequence);
- interestHeader.SetInterestLifetime (m_interestLifeTime);
+ Ptr<Interest> interest = Create<Interest> ();
+ interest->SetNonce (m_rand.GetValue ());
+ interest->SetName (nameWithSequence);
+ interest->SetInterestLifetime (m_interestLifeTime);
- // NS_LOG_INFO ("Requesting Interest: \n" << interestHeader);
+ // NS_LOG_INFO ("Requesting Interest: \n" << *interest);
NS_LOG_INFO ("> Interest for " << seq);
- Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader (interestHeader);
- NS_LOG_DEBUG ("Interest packet size: " << packet->GetSize ());
-
WillSendOutInterest (seq);
FwHopCountTag hopCountTag;
- packet->AddPacketTag (hopCountTag);
+ interest->GetPayload ()->AddPacketTag (hopCountTag);
- m_transmittedInterests (&interestHeader, this, m_face);
- m_protocolHandler (packet);
+ m_transmittedInterests (interest, this, m_face);
+ m_face->ReceiveInterest (interest);
ScheduleNextPacket ();
}
@@ -231,23 +223,22 @@
void
-Consumer::OnContentObject (const Ptr<const ContentObject> &contentObject,
- Ptr<Packet> payload)
+Consumer::OnContentObject (Ptr<const ContentObject> data)
{
if (!m_active) return;
- App::OnContentObject (contentObject, payload); // tracing inside
+ App::OnContentObject (data); // tracing inside
- NS_LOG_FUNCTION (this << contentObject << payload);
+ NS_LOG_FUNCTION (this << data);
- // NS_LOG_INFO ("Received content object: " << boost::cref(*contentObject));
+ // NS_LOG_INFO ("Received content object: " << boost::cref(*data));
- uint32_t seq = boost::lexical_cast<uint32_t> (contentObject->GetName ().GetComponents ().back ());
+ uint32_t seq = data->GetName ().get (-1).toSeqNum ();
NS_LOG_INFO ("< DATA for " << seq);
int hopCount = -1;
FwHopCountTag hopCountTag;
- if (payload->RemovePacketTag (hopCountTag))
+ if (data->GetPayload ()->PeekPacketTag (hopCountTag))
{
hopCount = hopCountTag.Get ();
}
@@ -275,18 +266,18 @@
}
void
-Consumer::OnNack (const Ptr<const Interest> &interest, Ptr<Packet> origPacket)
+Consumer::OnNack (Ptr<const Interest> interest)
{
if (!m_active) return;
- App::OnNack (interest, origPacket); // tracing inside
+ App::OnNack (interest); // tracing inside
// NS_LOG_DEBUG ("Nack type: " << interest->GetNack ());
// NS_LOG_FUNCTION (interest->GetName ());
// NS_LOG_INFO ("Received NACK: " << boost::cref(*interest));
- uint32_t seq = boost::lexical_cast<uint32_t> (interest->GetName ().GetComponents ().back ());
+ uint32_t seq = interest->GetName ().get (-1).toSeqNum ();
NS_LOG_INFO ("< NACK for " << seq);
// std::cout << Simulator::Now ().ToDouble (Time::S) << "s -> " << "NACK for " << seq << "\n";
diff --git a/apps/ndn-consumer.h b/apps/ndn-consumer.h
index 7dd4cdc..bb9e30a 100644
--- a/apps/ndn-consumer.h
+++ b/apps/ndn-consumer.h
@@ -61,11 +61,10 @@
// OnInterest (const Ptr<const Interest> &interest);
virtual void
- OnNack (const Ptr<const Interest> &interest, Ptr<Packet> packet);
+ OnNack (Ptr<const Interest> interest);
virtual void
- OnContentObject (const Ptr<const ContentObject> &contentObject,
- Ptr<Packet> payload);
+ OnContentObject (Ptr<const ContentObject> contentObject);
/**
* @brief Timeout event
diff --git a/apps/ndn-producer.cc b/apps/ndn-producer.cc
index 90ccce0..e224841 100644
--- a/apps/ndn-producer.cc
+++ b/apps/ndn-producer.cc
@@ -44,7 +44,7 @@
namespace ndn {
NS_OBJECT_ENSURE_REGISTERED (Producer);
-
+
TypeId
Producer::GetTypeId (void)
{
@@ -56,19 +56,30 @@
StringValue ("/"),
MakeNameAccessor (&Producer::m_prefix),
MakeNameChecker ())
+ .AddAttribute ("Postfix", "Postfix that is added to the output data (e.g., for adding producer-uniqueness)",
+ StringValue ("/"),
+ MakeNameAccessor (&Producer::m_postfix),
+ MakeNameChecker ())
.AddAttribute ("PayloadSize", "Virtual payload size for Content packets",
UintegerValue (1024),
- MakeUintegerAccessor(&Producer::m_virtualPayloadSize),
- MakeUintegerChecker<uint32_t>())
+ MakeUintegerAccessor (&Producer::m_virtualPayloadSize),
+ MakeUintegerChecker<uint32_t> ())
.AddAttribute ("Freshness", "Freshness of data packets, if 0, then unlimited freshness",
TimeValue (Seconds (0)),
MakeTimeAccessor (&Producer::m_freshness),
MakeTimeChecker ())
+ .AddAttribute ("Signature", "Fake signature, 0 valid signature (default), other values application-specific",
+ UintegerValue (0),
+ MakeUintegerAccessor (&Producer::m_signature),
+ MakeUintegerChecker<uint32_t> ())
+ .AddAttribute ("KeyLocator", "Name to be used for key locator. If root, then key locator is not used",
+ NameValue (),
+ MakeNameAccessor (&Producer::m_keyLocator),
+ MakeNameChecker ())
;
-
return tid;
}
-
+
Producer::Producer ()
{
// NS_LOG_FUNCTION_NOARGS ();
@@ -84,13 +95,13 @@
App::StartApplication ();
NS_LOG_DEBUG ("NodeID: " << GetNode ()->GetId ());
-
+
Ptr<Fib> fib = GetNode ()->GetObject<Fib> ();
-
+
Ptr<fib::Entry> fibEntry = fib->Add (m_prefix, m_face, 0);
fibEntry->UpdateStatus (m_face, fib::FaceMetric::NDN_FIB_GREEN);
-
+
// // make face green, so it will be used primarily
// StaticCast<fib::FibImpl> (fib)->modify (fibEntry,
// ll::bind (&fib::Entry::UpdateStatus,
@@ -108,36 +119,37 @@
void
-Producer::OnInterest (const Ptr<const Interest> &interest, Ptr<Packet> origPacket)
+Producer::OnInterest (Ptr<const Interest> interest)
{
- App::OnInterest (interest, origPacket); // tracing inside
+ App::OnInterest (interest); // tracing inside
NS_LOG_FUNCTION (this << interest);
if (!m_active) return;
-
- static ContentObjectTail tail;
- Ptr<ContentObject> header = Create<ContentObject> ();
- header->SetName (Create<Name> (interest->GetName ()));
- header->SetFreshness (m_freshness);
- NS_LOG_INFO ("node("<< GetNode()->GetId() <<") respodning with ContentObject:\n" << boost::cref(*header));
-
- Ptr<Packet> packet = Create<Packet> (m_virtualPayloadSize);
-
- packet->AddHeader (*header);
- packet->AddTrailer (tail);
+ Ptr<ContentObject> data = Create<ContentObject> (Create<Packet> (m_virtualPayloadSize));
+ Ptr<Name> dataName = Create<Name> (interest->GetName ());
+ dataName->append (m_postfix);
+ data->SetName (dataName);
+ data->SetFreshness (m_freshness);
+
+ data->SetSignature (m_signature);
+ if (m_keyLocator.size () > 0)
+ {
+ data->SetKeyLocator (Create<Name> (m_keyLocator));
+ }
+
+ NS_LOG_INFO ("node("<< GetNode()->GetId() <<") respodning with ContentObject: " << data->GetName ());
// Echo back FwHopCountTag if exists
FwHopCountTag hopCountTag;
- if (origPacket->RemovePacketTag (hopCountTag))
+ if (interest->GetPayload ()->PeekPacketTag (hopCountTag))
{
- packet->AddPacketTag (hopCountTag);
+ data->GetPayload ()->AddPacketTag (hopCountTag);
}
- m_protocolHandler (packet);
-
- m_transmittedContentObjects (header, packet, this, m_face);
+ m_face->ReceiveData (data);
+ m_transmittedContentObjects (data, this, m_face);
}
} // namespace ndn
diff --git a/apps/ndn-producer.h b/apps/ndn-producer.h
index bce01d3..8349ea2 100644
--- a/apps/ndn-producer.h
+++ b/apps/ndn-producer.h
@@ -41,14 +41,14 @@
*/
class Producer : public App
{
-public:
+public:
static TypeId
GetTypeId (void);
-
+
Producer ();
// inherited from NdnApp
- void OnInterest (const Ptr<const Interest> &interest, Ptr<Packet> packet);
+ void OnInterest (Ptr<const Interest> interest);
protected:
// inherited from Application base class.
@@ -60,8 +60,12 @@
private:
Name m_prefix;
+ Name m_postfix;
uint32_t m_virtualPayloadSize;
Time m_freshness;
+
+ uint32_t m_signature;
+ Name m_keyLocator;
};
} // namespace ndn
diff --git a/bindings/callbacks_list.py b/bindings/callbacks_list.py
index 51e879c..fac2186 100644
--- a/bindings/callbacks_list.py
+++ b/bindings/callbacks_list.py
@@ -1,6 +1,10 @@
callback_classes = [
- ['bool', 'ns3::Ptr<ns3::Packet const> const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::Ptr<ns3::ndn::Face> const&', 'ns3::Ptr<ns3::Packet const> const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Ptr<ns3::ndn::Name const>', 'ns3::Ptr<ns3::ndn::Interest const>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Ptr<ns3::ndn::Interest const>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Ptr<ns3::ndn::Interest const>', 'ns3::Ptr<ns3::ndn::ContentObject const>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Ptr<ns3::ndn::Face>', 'ns3::Ptr<ns3::ndn::ContentObject>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Ptr<ns3::ndn::Face>', 'ns3::Ptr<ns3::ndn::Interest>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Ptr<ns3::Application>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
]
diff --git a/bindings/modulegen__gcc_ILP32.py b/bindings/modulegen__gcc_ILP32.py
index 3d83839..c072610 100644
--- a/bindings/modulegen__gcc_ILP32.py
+++ b/bindings/modulegen__gcc_ILP32.py
@@ -96,6 +96,8 @@
module.add_class('SequentialVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
+ ## simulator.h (module 'core'): ns3::Simulator [class]
+ module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core')
## tag.h (module 'network'): ns3::Tag [class]
module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
@@ -170,12 +172,12 @@
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TopologyReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TopologyReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> > [class]
- module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::ContentObject', 'ns3::Header', 'ns3::DefaultDeleter<ns3::ndn::ContentObject>'], parent=root_module['ns3::Header'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> > [class]
+ module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::ContentObject', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::ContentObject>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::FaceContainer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::FaceContainer> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::FaceContainer', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::FaceContainer>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> > [class]
- module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::ndn::Interest', 'ns3::Header', 'ns3::DefaultDeleter<ns3::ndn::Interest>'], parent=root_module['ns3::Header'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> > [class]
+ module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::ndn::Interest', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::Interest>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Name, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Name> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::Name', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::Name>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::cs::Entry, ns3::empty, ns3::DefaultDeleter<ns3::ndn::cs::Entry> > [class]
@@ -210,6 +212,8 @@
module.add_class('BooleanChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## boolean.h (module 'core'): ns3::BooleanValue [class]
module.add_class('BooleanValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
+ ## callback-based-app.h (module 'ndnSIM'): ns3::CallbackBasedApp [class]
+ module.add_class('CallbackBasedApp', parent=root_module['ns3::Application'])
## callback.h (module 'core'): ns3::CallbackChecker [class]
module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## callback.h (module 'core'): ns3::CallbackImplBase [class]
@@ -326,16 +330,20 @@
module.add_class('App', parent=root_module['ns3::Application'])
## ndn-app-helper.h (module 'ndnSIM'): ns3::ndn::AppHelper [class]
module.add_class('AppHelper')
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob [class]
+ module.add_class('Blob')
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject [class]
- module.add_class('ContentObject', parent=root_module['ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >'])
+ module.add_class('ContentObject', parent=root_module['ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >'])
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObjectException [class]
module.add_class('ContentObjectException')
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObjectTail [class]
- module.add_class('ContentObjectTail', parent=root_module['ns3::Trailer'])
## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::ContentStore [class]
module.add_class('ContentStore', parent=root_module['ns3::Object'])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude [class]
+ module.add_class('Exclude')
## ndn-face.h (module 'ndnSIM'): ns3::ndn::Face [class]
module.add_class('Face', parent=root_module['ns3::Object'])
+ ## ndn-face.h (module 'ndnSIM'): ns3::ndn::Face::Flags [enumeration]
+ module.add_enum('Flags', ['APPLICATION'], outer_class=root_module['ns3::ndn::Face'])
## ndn-face-container.h (module 'ndnSIM'): ns3::ndn::FaceContainer [class]
module.add_class('FaceContainer', parent=root_module['ns3::SimpleRefCount< ns3::ndn::FaceContainer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::FaceContainer> >'])
## ndn-fib.h (module 'ndnSIM'): ns3::ndn::Fib [class]
@@ -349,7 +357,7 @@
## ndn-header-helper.h (module 'ndnSIM'): ns3::ndn::HeaderHelper::Type [enumeration]
module.add_enum('Type', ['INTEREST_CCNB', 'CONTENT_OBJECT_CCNB', 'INTEREST_NDNSIM', 'CONTENT_OBJECT_NDNSIM'], outer_class=root_module['ns3::ndn::HeaderHelper'])
## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest [class]
- module.add_class('Interest', parent=root_module['ns3::SimpleRefCount< ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >'])
+ module.add_class('Interest', parent=root_module['ns3::SimpleRefCount< ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >'])
## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest [enumeration]
module.add_enum('', ['NORMAL_INTEREST', 'NACK_LOOP', 'NACK_CONGESTION', 'NACK_GIVEUP_PIT'], outer_class=root_module['ns3::ndn::Interest'])
## ndn-interest.h (module 'ndnSIM'): ns3::ndn::InterestException [class]
@@ -358,11 +366,11 @@
module.add_class('L3Protocol', parent=root_module['ns3::Object'])
## ndn-limits.h (module 'ndnSIM'): ns3::ndn::Limits [class]
module.add_class('Limits', parent=root_module['ns3::Object'])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name [class]
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name [class]
module.add_class('Name', parent=root_module['ns3::SimpleRefCount< ns3::ndn::Name, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Name> >'])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameChecker [class]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameChecker [class]
module.add_class('NameChecker', parent=root_module['ns3::AttributeChecker'])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameValue [class]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameValue [class]
module.add_class('NameValue', parent=root_module['ns3::AttributeValue'])
## ndn-net-device-face.h (module 'ndnSIM'): ns3::ndn::NetDeviceFace [class]
module.add_class('NetDeviceFace', parent=root_module['ns3::ndn::Face'])
@@ -376,26 +384,36 @@
module.add_class('StackHelper')
## ndn-header-helper.h (module 'ndnSIM'): ns3::ndn::UnknownHeaderException [class]
module.add_class('UnknownHeaderException')
+ ## ndn-wire.h (module 'ndnSIM'): ns3::ndn::Wire [struct]
+ module.add_class('Wire')
+ ## ndn-wire.h (module 'ndnSIM'): ns3::ndn::Wire [enumeration]
+ module.add_enum('', ['WIRE_FORMAT_DEFAULT', 'WIRE_FORMAT_AUTODETECT', 'WIRE_FORMAT_NDNSIM', 'WIRE_FORMAT_CCNB'], outer_class=root_module['ns3::ndn::Wire'])
+ ## ndn-api-face.h (module 'ndnSIM'): ns3::ndn::ApiFace [class]
+ module.add_class('ApiFace', parent=root_module['ns3::ndn::Face'])
## ndn-app-face.h (module 'ndnSIM'): ns3::ndn::AppFace [class]
module.add_class('AppFace', parent=root_module['ns3::ndn::Face'])
+ module.add_container('std::vector< char >', 'char', container_type='vector')
+ module.add_container('std::map< ns3::ndn::name::Component, bool, std::greater< ns3::ndn::name::Component >, std::allocator< std::pair< ns3::ndn::name::Component const, bool > > >', ('ns3::ndn::name::Component', 'bool'), container_type='map')
module.add_container('std::vector< ns3::Ptr< ns3::ndn::Face > >', 'ns3::Ptr< ns3::ndn::Face >', container_type='vector')
- module.add_container('std::list< boost::reference_wrapper< std::string const > >', 'boost::reference_wrapper< std::basic_string< char, std::char_traits< char >, std::allocator< char > > const >', container_type='list')
- module.add_container('std::list< std::string >', 'std::string', container_type='list')
typehandlers.add_type_alias('ns3::ndn::ContentObject', 'ns3::ndn::ContentObjectHeader')
typehandlers.add_type_alias('ns3::ndn::ContentObject*', 'ns3::ndn::ContentObjectHeader*')
typehandlers.add_type_alias('ns3::ndn::ContentObject&', 'ns3::ndn::ContentObjectHeader&')
module.add_typedef(root_module['ns3::ndn::ContentObject'], 'ContentObjectHeader')
- typehandlers.add_type_alias('ns3::ndn::Interest', 'ns3::ndn::InterestHeader')
- typehandlers.add_type_alias('ns3::ndn::Interest*', 'ns3::ndn::InterestHeader*')
- typehandlers.add_type_alias('ns3::ndn::Interest&', 'ns3::ndn::InterestHeader&')
- module.add_typedef(root_module['ns3::ndn::Interest'], 'InterestHeader')
typehandlers.add_type_alias('std::deque< ns3::ndn::RttHistory, std::allocator< ns3::ndn::RttHistory > >', 'ns3::ndn::RttHistory_t')
typehandlers.add_type_alias('std::deque< ns3::ndn::RttHistory, std::allocator< ns3::ndn::RttHistory > >*', 'ns3::ndn::RttHistory_t*')
typehandlers.add_type_alias('std::deque< ns3::ndn::RttHistory, std::allocator< ns3::ndn::RttHistory > >&', 'ns3::ndn::RttHistory_t&')
+ typehandlers.add_type_alias('ns3::Time', 'ns3::ndn::TimeInterval')
+ typehandlers.add_type_alias('ns3::Time*', 'ns3::ndn::TimeInterval*')
+ typehandlers.add_type_alias('ns3::Time&', 'ns3::ndn::TimeInterval&')
+ module.add_typedef(root_module['ns3::Time'], 'TimeInterval')
typehandlers.add_type_alias('ns3::ndn::Name', 'ns3::ndn::NameComponents')
typehandlers.add_type_alias('ns3::ndn::Name*', 'ns3::ndn::NameComponents*')
typehandlers.add_type_alias('ns3::ndn::Name&', 'ns3::ndn::NameComponents&')
module.add_typedef(root_module['ns3::ndn::Name'], 'NameComponents')
+ typehandlers.add_type_alias('ns3::ndn::Interest', 'ns3::ndn::InterestHeader')
+ typehandlers.add_type_alias('ns3::ndn::Interest*', 'ns3::ndn::InterestHeader*')
+ typehandlers.add_type_alias('ns3::ndn::Interest&', 'ns3::ndn::InterestHeader&')
+ module.add_typedef(root_module['ns3::ndn::Interest'], 'InterestHeader')
## Register a nested module for the namespace cs
@@ -415,11 +433,23 @@
register_types_ns3_ndn_fw(nested_module)
+ ## Register a nested module for the namespace name
+
+ nested_module = module.add_cpp_namespace('name')
+ register_types_ns3_ndn_name(nested_module)
+
+
## Register a nested module for the namespace pit
nested_module = module.add_cpp_namespace('pit')
register_types_ns3_ndn_pit(nested_module)
+
+ ## Register a nested module for the namespace time
+
+ nested_module = module.add_cpp_namespace('time')
+ register_types_ns3_ndn_time(nested_module)
+
def register_types_ns3_ndn_cs(module):
root_module = module.get_root()
@@ -453,6 +483,12 @@
## ndn-fw-tag.h (module 'ndnSIM'): ns3::ndn::fw::Tag [class]
module.add_class('Tag')
+def register_types_ns3_ndn_name(module):
+ root_module = module.get_root()
+
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component [class]
+ module.add_class('Component', parent=root_module['ns3::ndn::Blob'])
+
def register_types_ns3_ndn_pit(module):
root_module = module.get_root()
@@ -472,6 +508,10 @@
module.add_container('std::set< ns3::ndn::pit::OutgoingFace >', 'ns3::ndn::pit::OutgoingFace', container_type='set')
module.add_container('std::set< unsigned int >', 'unsigned int', container_type='set')
+def register_types_ns3_ndn_time(module):
+ root_module = module.get_root()
+
+
def register_methods(root_module):
register_Ns3Address_methods(root_module, root_module['ns3::Address'])
register_Ns3ApplicationContainer_methods(root_module, root_module['ns3::ApplicationContainer'])
@@ -507,6 +547,7 @@
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
+ register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3TracedValue__Ns3NdnFibFaceMetricStatus_methods(root_module, root_module['ns3::TracedValue< ns3::ndn::fib::FaceMetric::Status >'])
@@ -543,9 +584,9 @@
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
- register_Ns3SimpleRefCount__Ns3NdnContentObject_Ns3Header_Ns3DefaultDeleter__lt__ns3NdnContentObject__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >'])
+ register_Ns3SimpleRefCount__Ns3NdnContentObject_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnContentObject__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >'])
register_Ns3SimpleRefCount__Ns3NdnFaceContainer_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnFaceContainer__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::FaceContainer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::FaceContainer> >'])
- register_Ns3SimpleRefCount__Ns3NdnInterest_Ns3Header_Ns3DefaultDeleter__lt__ns3NdnInterest__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >'])
+ register_Ns3SimpleRefCount__Ns3NdnInterest_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnInterest__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >'])
register_Ns3SimpleRefCount__Ns3NdnName_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnName__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::Name, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Name> >'])
register_Ns3SimpleRefCount__Ns3NdnCsEntry_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnCsEntry__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::cs::Entry, ns3::empty, ns3::DefaultDeleter<ns3::ndn::cs::Entry> >'])
register_Ns3SimpleRefCount__Ns3NdnPitEntry_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnPitEntry__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::pit::Entry, ns3::empty, ns3::DefaultDeleter<ns3::ndn::pit::Entry> >'])
@@ -561,6 +602,7 @@
register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
register_Ns3BooleanChecker_methods(root_module, root_module['ns3::BooleanChecker'])
register_Ns3BooleanValue_methods(root_module, root_module['ns3::BooleanValue'])
+ register_Ns3CallbackBasedApp_methods(root_module, root_module['ns3::CallbackBasedApp'])
register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker'])
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
@@ -596,10 +638,11 @@
register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue'])
register_Ns3NdnApp_methods(root_module, root_module['ns3::ndn::App'])
register_Ns3NdnAppHelper_methods(root_module, root_module['ns3::ndn::AppHelper'])
+ register_Ns3NdnBlob_methods(root_module, root_module['ns3::ndn::Blob'])
register_Ns3NdnContentObject_methods(root_module, root_module['ns3::ndn::ContentObject'])
register_Ns3NdnContentObjectException_methods(root_module, root_module['ns3::ndn::ContentObjectException'])
- register_Ns3NdnContentObjectTail_methods(root_module, root_module['ns3::ndn::ContentObjectTail'])
register_Ns3NdnContentStore_methods(root_module, root_module['ns3::ndn::ContentStore'])
+ register_Ns3NdnExclude_methods(root_module, root_module['ns3::ndn::Exclude'])
register_Ns3NdnFace_methods(root_module, root_module['ns3::ndn::Face'])
register_Ns3NdnFaceContainer_methods(root_module, root_module['ns3::ndn::FaceContainer'])
register_Ns3NdnFib_methods(root_module, root_module['ns3::ndn::Fib'])
@@ -619,6 +662,8 @@
register_Ns3NdnRttHistory_methods(root_module, root_module['ns3::ndn::RttHistory'])
register_Ns3NdnStackHelper_methods(root_module, root_module['ns3::ndn::StackHelper'])
register_Ns3NdnUnknownHeaderException_methods(root_module, root_module['ns3::ndn::UnknownHeaderException'])
+ register_Ns3NdnWire_methods(root_module, root_module['ns3::ndn::Wire'])
+ register_Ns3NdnApiFace_methods(root_module, root_module['ns3::ndn::ApiFace'])
register_Ns3NdnAppFace_methods(root_module, root_module['ns3::ndn::AppFace'])
register_Ns3NdnCsEntry_methods(root_module, root_module['ns3::ndn::cs::Entry'])
register_Ns3NdnFibEntry_methods(root_module, root_module['ns3::ndn::fib::Entry'])
@@ -629,6 +674,7 @@
register_Ns3NdnFibI_metric_methods(root_module, root_module['ns3::ndn::fib::i_metric'])
register_Ns3NdnFibI_nth_methods(root_module, root_module['ns3::ndn::fib::i_nth'])
register_Ns3NdnFwTag_methods(root_module, root_module['ns3::ndn::fw::Tag'])
+ register_Ns3NdnNameComponent_methods(root_module, root_module['ns3::ndn::name::Component'])
register_Ns3NdnPitEntry_methods(root_module, root_module['ns3::ndn::pit::Entry'])
register_Ns3NdnPitEntryIsNotEmpty_methods(root_module, root_module['ns3::ndn::pit::EntryIsNotEmpty'])
register_Ns3NdnPitIncomingFace_methods(root_module, root_module['ns3::ndn::pit::IncomingFace'])
@@ -1728,6 +1774,29 @@
'uint32_t',
[],
is_const=True)
+ ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::begin() const [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
+ [],
+ is_const=True)
+ ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::begin() [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node >, std::vector< ns3::Ptr< ns3::Node > > >',
+ [])
+ ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::end() const [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
+ [],
+ is_const=True)
+ ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::end() [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node >, std::vector< ns3::Ptr< ns3::Node > > >',
+ [])
+ ## node-container.h (module 'network'): uint32_t ns3::NodeContainer::size() const [member function]
+ cls.add_method('size',
+ 'uint32_t',
+ [],
+ is_const=True)
return
def register_Ns3ObjectBase_methods(root_module, cls):
@@ -2122,6 +2191,86 @@
is_static=True)
return
+def register_Ns3Simulator_methods(root_module, cls):
+ ## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::Simulator const &', 'arg0')])
+ ## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function]
+ cls.add_method('Cancel',
+ 'void',
+ [param('ns3::EventId const &', 'id')],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function]
+ cls.add_method('Destroy',
+ 'void',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function]
+ cls.add_method('GetContext',
+ 'uint32_t',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function]
+ cls.add_method('GetDelayLeft',
+ 'ns3::Time',
+ [param('ns3::EventId const &', 'id')],
+ is_static=True)
+ ## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function]
+ cls.add_method('GetImplementation',
+ 'ns3::Ptr< ns3::SimulatorImpl >',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function]
+ cls.add_method('GetMaximumSimulationTime',
+ 'ns3::Time',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function]
+ cls.add_method('GetSystemId',
+ 'uint32_t',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function]
+ cls.add_method('IsExpired',
+ 'bool',
+ [param('ns3::EventId const &', 'id')],
+ is_static=True)
+ ## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function]
+ cls.add_method('IsFinished',
+ 'bool',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function]
+ cls.add_method('Now',
+ 'ns3::Time',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function]
+ cls.add_method('Remove',
+ 'void',
+ [param('ns3::EventId const &', 'id')],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function]
+ cls.add_method('SetImplementation',
+ 'void',
+ [param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
+ cls.add_method('SetScheduler',
+ 'void',
+ [param('ns3::ObjectFactory', 'schedulerFactory')],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function]
+ cls.add_method('Stop',
+ 'void',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & time) [member function]
+ cls.add_method('Stop',
+ 'void',
+ [param('ns3::Time const &', 'time')],
+ is_static=True)
+ return
+
def register_Ns3Tag_methods(root_module, cls):
## tag.h (module 'network'): ns3::Tag::Tag() [constructor]
cls.add_constructor([])
@@ -2967,12 +3116,12 @@
is_static=True)
return
-def register_Ns3SimpleRefCount__Ns3NdnContentObject_Ns3Header_Ns3DefaultDeleter__lt__ns3NdnContentObject__gt___methods(root_module, cls):
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::SimpleRefCount() [constructor]
+def register_Ns3SimpleRefCount__Ns3NdnContentObject_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnContentObject__gt___methods(root_module, cls):
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::SimpleRefCount() [constructor]
cls.add_constructor([])
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::SimpleRefCount(ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> > const & o) [copy constructor]
- cls.add_constructor([param('ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter< ns3::ndn::ContentObject > > const &', 'o')])
- ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::Cleanup() [member function]
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::SimpleRefCount(ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> > const & o) [copy constructor]
+ cls.add_constructor([param('ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter< ns3::ndn::ContentObject > > const &', 'o')])
+ ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
@@ -2991,12 +3140,12 @@
is_static=True)
return
-def register_Ns3SimpleRefCount__Ns3NdnInterest_Ns3Header_Ns3DefaultDeleter__lt__ns3NdnInterest__gt___methods(root_module, cls):
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >::SimpleRefCount() [constructor]
+def register_Ns3SimpleRefCount__Ns3NdnInterest_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnInterest__gt___methods(root_module, cls):
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >::SimpleRefCount() [constructor]
cls.add_constructor([])
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >::SimpleRefCount(ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> > const & o) [copy constructor]
- cls.add_constructor([param('ns3::SimpleRefCount< ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter< ns3::ndn::Interest > > const &', 'o')])
- ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >::Cleanup() [member function]
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >::SimpleRefCount(ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> > const & o) [copy constructor]
+ cls.add_constructor([param('ns3::SimpleRefCount< ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter< ns3::ndn::Interest > > const &', 'o')])
+ ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
@@ -3375,33 +3524,42 @@
cls.add_method('GetNodes',
'ns3::NodeContainer',
[],
- is_const=True)
+ is_const=True, is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): std::list<ns3::TopologyReader::Link, std::allocator<ns3::TopologyReader::Link> > const & ns3::AnnotatedTopologyReader::GetLinks() const [member function]
cls.add_method('GetLinks',
'std::list< ns3::TopologyReader::Link > const &',
[],
- is_const=True)
+ is_const=True, is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::AssignIpv4Addresses(ns3::Ipv4Address base) [member function]
cls.add_method('AssignIpv4Addresses',
'void',
- [param('ns3::Ipv4Address', 'base')])
+ [param('ns3::Ipv4Address', 'base')],
+ is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SetBoundingBox(double ulx, double uly, double lrx, double lry) [member function]
cls.add_method('SetBoundingBox',
'void',
- [param('double', 'ulx'), param('double', 'uly'), param('double', 'lrx'), param('double', 'lry')])
+ [param('double', 'ulx'), param('double', 'uly'), param('double', 'lrx'), param('double', 'lry')],
+ is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SetMobilityModel(std::string const & model) [member function]
cls.add_method('SetMobilityModel',
'void',
- [param('std::string const &', 'model')])
+ [param('std::string const &', 'model')],
+ is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::ApplyOspfMetric() [member function]
cls.add_method('ApplyOspfMetric',
'void',
- [])
- ## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SaveTopology(std::string const & file) const [member function]
+ [],
+ is_virtual=True)
+ ## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SaveTopology(std::string const & file) [member function]
cls.add_method('SaveTopology',
'void',
[param('std::string const &', 'file')],
- is_const=True)
+ is_virtual=True)
+ ## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SaveGraphviz(std::string const & file) [member function]
+ cls.add_method('SaveGraphviz',
+ 'void',
+ [param('std::string const &', 'file')],
+ is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): ns3::Ptr<ns3::Node> ns3::AnnotatedTopologyReader::CreateNode(std::string const name, uint32_t systemId) [member function]
cls.add_method('CreateNode',
'ns3::Ptr< ns3::Node >',
@@ -3600,6 +3758,36 @@
[param('bool', 'value')])
return
+def register_Ns3CallbackBasedApp_methods(root_module, cls):
+ ## callback-based-app.h (module 'ndnSIM'): ns3::CallbackBasedApp::CallbackBasedApp(ns3::CallbackBasedApp const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::CallbackBasedApp const &', 'arg0')])
+ ## callback-based-app.h (module 'ndnSIM'): ns3::CallbackBasedApp::CallbackBasedApp() [constructor]
+ cls.add_constructor([])
+ ## callback-based-app.h (module 'ndnSIM'): static ns3::TypeId ns3::CallbackBasedApp::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## callback-based-app.h (module 'ndnSIM'): void ns3::CallbackBasedApp::SetOnStartCallback(ns3::Callback<void, ns3::Ptr<ns3::Application>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onStart) [member function]
+ cls.add_method('SetOnStartCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::Ptr< ns3::Application >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onStart')])
+ ## callback-based-app.h (module 'ndnSIM'): void ns3::CallbackBasedApp::SetOnStopCallback(ns3::Callback<void, ns3::Ptr<ns3::Application>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onStart) [member function]
+ cls.add_method('SetOnStopCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::Ptr< ns3::Application >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onStart')])
+ ## callback-based-app.h (module 'ndnSIM'): void ns3::CallbackBasedApp::StartApplication() [member function]
+ cls.add_method('StartApplication',
+ 'void',
+ [],
+ visibility='protected', is_virtual=True)
+ ## callback-based-app.h (module 'ndnSIM'): void ns3::CallbackBasedApp::StopApplication() [member function]
+ cls.add_method('StopApplication',
+ 'void',
+ [],
+ visibility='protected', is_virtual=True)
+ return
+
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
@@ -4308,7 +4496,7 @@
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
- ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function]
+ ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
@@ -4533,6 +4721,24 @@
cls.add_method('Commit',
'void',
[])
+ ## rocketfuel-weights-reader.h (module 'ndnSIM'): void ns3::RocketfuelWeightsReader::SetDefaultBandwidth(std::string const & bw) [member function]
+ cls.add_method('SetDefaultBandwidth',
+ 'void',
+ [param('std::string const &', 'bw')])
+ ## rocketfuel-weights-reader.h (module 'ndnSIM'): std::string ns3::RocketfuelWeightsReader::GetDefaultBandwidth() const [member function]
+ cls.add_method('GetDefaultBandwidth',
+ 'std::string',
+ [],
+ is_const=True)
+ ## rocketfuel-weights-reader.h (module 'ndnSIM'): void ns3::RocketfuelWeightsReader::SetDefaultQueue(std::string const & queue) [member function]
+ cls.add_method('SetDefaultQueue',
+ 'void',
+ [param('std::string const &', 'queue')])
+ ## rocketfuel-weights-reader.h (module 'ndnSIM'): std::string ns3::RocketfuelWeightsReader::GetDefaultQueue() const [member function]
+ cls.add_method('GetDefaultQueue',
+ 'std::string',
+ [],
+ is_const=True)
return
def register_Ns3TimeChecker_methods(root_module, cls):
@@ -4703,25 +4909,21 @@
'ns3::TypeId',
[],
is_static=True)
- ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnContentObject(ns3::Ptr<ns3::ndn::ContentObject const> const & contentObject, ns3::Ptr<ns3::Packet> payload) [member function]
+ ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnContentObject(ns3::Ptr<ns3::ndn::ContentObject const> contentObject) [member function]
cls.add_method('OnContentObject',
'void',
- [param('ns3::Ptr< ns3::ndn::ContentObject const > const &', 'contentObject'), param('ns3::Ptr< ns3::Packet >', 'payload')],
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'contentObject')],
is_virtual=True)
- ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnInterest(ns3::Ptr<ns3::ndn::Interest const> const & interest, ns3::Ptr<ns3::Packet> packet) [member function]
+ ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnInterest(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
cls.add_method('OnInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Interest const > const &', 'interest'), param('ns3::Ptr< ns3::Packet >', 'packet')],
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
is_virtual=True)
- ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnNack(ns3::Ptr<ns3::ndn::Interest const> const & interest, ns3::Ptr<ns3::Packet> packet) [member function]
+ ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnNack(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
cls.add_method('OnNack',
'void',
- [param('ns3::Ptr< ns3::ndn::Interest const > const &', 'interest'), param('ns3::Ptr< ns3::Packet >', 'packet')],
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
is_virtual=True)
- ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::RegisterProtocolHandler(ns3::Callback<bool, ns3::Ptr<ns3::Packet const> const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
- cls.add_method('RegisterProtocolHandler',
- 'void',
- [param('ns3::Callback< bool, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'handler')])
## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
@@ -4766,26 +4968,90 @@
[param('std::string const &', 'prefix')])
return
-def register_Ns3NdnContentObject_methods(root_module, cls):
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::ndn::ContentObject const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::ndn::ContentObject const &', 'arg0')])
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject() [constructor]
+def register_Ns3NdnBlob_methods(root_module, cls):
+ cls.add_binary_comparison_operator('<=')
+ cls.add_binary_comparison_operator('==')
+ cls.add_binary_comparison_operator('>=')
+ cls.add_binary_comparison_operator('<')
+ cls.add_binary_comparison_operator('>')
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob::Blob(ns3::ndn::Blob const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::Blob const &', 'arg0')])
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob::Blob() [constructor]
cls.add_constructor([])
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObject::Deserialize(ns3::Buffer::Iterator start) [member function]
- cls.add_method('Deserialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')],
- is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): ns3::Time ns3::ndn::ContentObject::GetFreshness() const [member function]
- cls.add_method('GetFreshness',
- 'ns3::Time',
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob::Blob(std::string const & data) [constructor]
+ cls.add_constructor([param('std::string const &', 'data')])
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob::Blob(void const * buf, size_t length) [constructor]
+ cls.add_constructor([param('void const *', 'buf'), param('size_t', 'length')])
+ ## blob.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > > ns3::ndn::Blob::begin() [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< char *, std::vector< char > >',
+ [])
+ ## blob.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator<char> > > ns3::ndn::Blob::begin() const [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< char const *, std::vector< char > >',
[],
is_const=True)
- ## ndn-content-object.h (module 'ndnSIM'): ns3::TypeId ns3::ndn::ContentObject::GetInstanceTypeId() const [member function]
- cls.add_method('GetInstanceTypeId',
- 'ns3::TypeId',
+ ## blob.h (module 'ndnSIM'): char * ns3::ndn::Blob::buf() [member function]
+ cls.add_method('buf',
+ 'char *',
+ [])
+ ## blob.h (module 'ndnSIM'): char const * ns3::ndn::Blob::buf() const [member function]
+ cls.add_method('buf',
+ 'char const *',
[],
- is_const=True, is_virtual=True)
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): void ns3::ndn::Blob::clear() [member function]
+ cls.add_method('clear',
+ 'void',
+ [])
+ ## blob.h (module 'ndnSIM'): bool ns3::ndn::Blob::empty() const [member function]
+ cls.add_method('empty',
+ 'bool',
+ [],
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > > ns3::ndn::Blob::end() [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< char *, std::vector< char > >',
+ [])
+ ## blob.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator<char> > > ns3::ndn::Blob::end() const [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< char const *, std::vector< char > >',
+ [],
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): char ns3::ndn::Blob::getItem(size_t pos) const [member function]
+ cls.add_method('getItem',
+ 'char',
+ [param('size_t', 'pos')],
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): void ns3::ndn::Blob::push_back(char val) [member function]
+ cls.add_method('push_back',
+ 'void',
+ [param('char', 'val')])
+ ## blob.h (module 'ndnSIM'): size_t ns3::ndn::Blob::size() const [member function]
+ cls.add_method('size',
+ 'size_t',
+ [],
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): void ns3::ndn::Blob::swap(ns3::ndn::Blob & x) [member function]
+ cls.add_method('swap',
+ 'void',
+ [param('ns3::ndn::Blob &', 'x')])
+ return
+
+def register_Ns3NdnContentObject_methods(root_module, cls):
+ cls.add_output_stream_operator()
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::Ptr<ns3::Packet> payload=ns3::Create( )) [constructor]
+ cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'payload', default_value='ns3::Create( )')])
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::ndn::ContentObject const & other) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::ContentObject const &', 'other')])
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetName(ns3::Ptr<ns3::ndn::Name> name) [member function]
+ cls.add_method('SetName',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::Name >', 'name')])
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetName(ns3::ndn::Name const & name) [member function]
+ cls.add_method('SetName',
+ 'void',
+ [param('ns3::ndn::Name const &', 'name')])
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::Name const & ns3::ndn::ContentObject::GetName() const [member function]
cls.add_method('GetName',
'ns3::ndn::Name const &',
@@ -4796,56 +5062,66 @@
'ns3::Ptr< ns3::ndn::Name const >',
[],
is_const=True)
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObject::GetSerializedSize() const [member function]
- cls.add_method('GetSerializedSize',
- 'uint32_t',
- [],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObject::GetSignature() const [member function]
- cls.add_method('GetSignature',
- 'uint32_t',
- [],
- is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetTimestamp(ns3::Time const & timestamp) [member function]
+ cls.add_method('SetTimestamp',
+ 'void',
+ [param('ns3::Time const &', 'timestamp')])
## ndn-content-object.h (module 'ndnSIM'): ns3::Time ns3::ndn::ContentObject::GetTimestamp() const [member function]
cls.add_method('GetTimestamp',
'ns3::Time',
[],
is_const=True)
- ## ndn-content-object.h (module 'ndnSIM'): static ns3::TypeId ns3::ndn::ContentObject::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::Print(std::ostream & os) const [member function]
- cls.add_method('Print',
- 'void',
- [param('std::ostream &', 'os')],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::Serialize(ns3::Buffer::Iterator start) const [member function]
- cls.add_method('Serialize',
- 'void',
- [param('ns3::Buffer::Iterator', 'start')],
- is_const=True, is_virtual=True)
## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetFreshness(ns3::Time const & freshness) [member function]
cls.add_method('SetFreshness',
'void',
[param('ns3::Time const &', 'freshness')])
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetName(ns3::Ptr<ns3::ndn::Name> name) [member function]
- cls.add_method('SetName',
- 'void',
- [param('ns3::Ptr< ns3::ndn::Name >', 'name')])
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetName(ns3::ndn::Name const & name) [member function]
- cls.add_method('SetName',
- 'void',
- [param('ns3::ndn::Name const &', 'name')])
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::Time ns3::ndn::ContentObject::GetFreshness() const [member function]
+ cls.add_method('GetFreshness',
+ 'ns3::Time',
+ [],
+ is_const=True)
## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetSignature(uint32_t signature) [member function]
cls.add_method('SetSignature',
'void',
[param('uint32_t', 'signature')])
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetTimestamp(ns3::Time const & timestamp) [member function]
- cls.add_method('SetTimestamp',
+ ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObject::GetSignature() const [member function]
+ cls.add_method('GetSignature',
+ 'uint32_t',
+ [],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetKeyLocator(ns3::Ptr<ns3::ndn::Name> keyLocator) [member function]
+ cls.add_method('SetKeyLocator',
'void',
- [param('ns3::Time const &', 'timestamp')])
+ [param('ns3::Ptr< ns3::ndn::Name >', 'keyLocator')])
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::Name const> ns3::ndn::ContentObject::GetKeyLocator() const [member function]
+ cls.add_method('GetKeyLocator',
+ 'ns3::Ptr< ns3::ndn::Name const >',
+ [],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetPayload(ns3::Ptr<ns3::Packet> payload) [member function]
+ cls.add_method('SetPayload',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'payload')])
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet const> ns3::ndn::ContentObject::GetPayload() const [member function]
+ cls.add_method('GetPayload',
+ 'ns3::Ptr< ns3::Packet const >',
+ [],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet const> ns3::ndn::ContentObject::GetWire() const [member function]
+ cls.add_method('GetWire',
+ 'ns3::Ptr< ns3::Packet const >',
+ [],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetWire(ns3::Ptr<ns3::Packet const> packet) const [member function]
+ cls.add_method('SetWire',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet')],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::Print(std::ostream & os) const [member function]
+ cls.add_method('Print',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True)
return
def register_Ns3NdnContentObjectException_methods(root_module, cls):
@@ -4855,53 +5131,16 @@
cls.add_constructor([param('ns3::ndn::ContentObjectException const &', 'arg0')])
return
-def register_Ns3NdnContentObjectTail_methods(root_module, cls):
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObjectTail::ContentObjectTail(ns3::ndn::ContentObjectTail const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::ndn::ContentObjectTail const &', 'arg0')])
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObjectTail::ContentObjectTail() [constructor]
- cls.add_constructor([])
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObjectTail::Deserialize(ns3::Buffer::Iterator start) [member function]
- cls.add_method('Deserialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')],
- is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): ns3::TypeId ns3::ndn::ContentObjectTail::GetInstanceTypeId() const [member function]
- cls.add_method('GetInstanceTypeId',
- 'ns3::TypeId',
- [],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObjectTail::GetSerializedSize() const [member function]
- cls.add_method('GetSerializedSize',
- 'uint32_t',
- [],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): static ns3::TypeId ns3::ndn::ContentObjectTail::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObjectTail::Print(std::ostream & os) const [member function]
- cls.add_method('Print',
- 'void',
- [param('std::ostream &', 'os')],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObjectTail::Serialize(ns3::Buffer::Iterator start) const [member function]
- cls.add_method('Serialize',
- 'void',
- [param('ns3::Buffer::Iterator', 'start')],
- is_const=True, is_virtual=True)
- return
-
def register_Ns3NdnContentStore_methods(root_module, cls):
cls.add_output_stream_operator()
## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::ContentStore::ContentStore() [constructor]
cls.add_constructor([])
## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::ContentStore::ContentStore(ns3::ndn::ContentStore const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::ContentStore const &', 'arg0')])
- ## ndn-content-store.h (module 'ndnSIM'): bool ns3::ndn::ContentStore::Add(ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> packet) [member function]
+ ## ndn-content-store.h (module 'ndnSIM'): bool ns3::ndn::ContentStore::Add(ns3::Ptr<ns3::ndn::ContentObject const> data) [member function]
cls.add_method('Add',
'bool',
- [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'packet')],
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')],
is_pure_virtual=True, is_virtual=True)
## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::cs::Entry> ns3::ndn::ContentStore::Begin() [member function]
cls.add_method('Begin',
@@ -4928,9 +5167,9 @@
'ns3::TypeId',
[],
is_static=True)
- ## ndn-content-store.h (module 'ndnSIM'): boost::tuples::tuple<ns3::Ptr<ns3::Packet>,ns3::Ptr<const ns3::ndn::ContentObject>,ns3::Ptr<const ns3::Packet>,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type> ns3::ndn::ContentStore::Lookup(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
+ ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::ContentObject> ns3::ndn::ContentStore::Lookup(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
cls.add_method('Lookup',
- 'boost::tuples::tuple< ns3::Ptr< ns3::Packet >, ns3::Ptr< ns3::ndn::ContentObject const >, ns3::Ptr< ns3::Packet const >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type >',
+ 'ns3::Ptr< ns3::ndn::ContentObject >',
[param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
is_pure_virtual=True, is_virtual=True)
## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::cs::Entry> ns3::ndn::ContentStore::Next(ns3::Ptr<ns3::ndn::cs::Entry> arg0) [member function]
@@ -4945,6 +5184,64 @@
is_pure_virtual=True, is_const=True, is_virtual=True)
return
+def register_Ns3NdnExclude_methods(root_module, cls):
+ cls.add_output_stream_operator()
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude::Exclude(ns3::ndn::Exclude const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::Exclude const &', 'arg0')])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude::Exclude() [constructor]
+ cls.add_constructor([])
+ ## exclude.h (module 'ndnSIM'): void ns3::ndn::Exclude::appendExclude(ns3::ndn::name::Component const & name, bool any) [member function]
+ cls.add_method('appendExclude',
+ 'void',
+ [param('ns3::ndn::name::Component const &', 'name'), param('bool', 'any')])
+ ## exclude.h (module 'ndnSIM'): std::_Rb_tree_const_iterator<std::pair<ns3::ndn::name::Component const, bool> > ns3::ndn::Exclude::begin() const [member function]
+ cls.add_method('begin',
+ 'std::_Rb_tree_const_iterator< std::pair< ns3::ndn::name::Component const, bool > >',
+ [],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): std::_Rb_tree_const_iterator<std::pair<ns3::ndn::name::Component const, bool> > ns3::ndn::Exclude::end() const [member function]
+ cls.add_method('end',
+ 'std::_Rb_tree_const_iterator< std::pair< ns3::ndn::name::Component const, bool > >',
+ [],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude & ns3::ndn::Exclude::excludeAfter(ns3::ndn::name::Component const & from) [member function]
+ cls.add_method('excludeAfter',
+ 'ns3::ndn::Exclude &',
+ [param('ns3::ndn::name::Component const &', 'from')])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude & ns3::ndn::Exclude::excludeBefore(ns3::ndn::name::Component const & to) [member function]
+ cls.add_method('excludeBefore',
+ 'ns3::ndn::Exclude &',
+ [param('ns3::ndn::name::Component const &', 'to')])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude & ns3::ndn::Exclude::excludeOne(ns3::ndn::name::Component const & comp) [member function]
+ cls.add_method('excludeOne',
+ 'ns3::ndn::Exclude &',
+ [param('ns3::ndn::name::Component const &', 'comp')])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude & ns3::ndn::Exclude::excludeRange(ns3::ndn::name::Component const & from, ns3::ndn::name::Component const & to) [member function]
+ cls.add_method('excludeRange',
+ 'ns3::ndn::Exclude &',
+ [param('ns3::ndn::name::Component const &', 'from'), param('ns3::ndn::name::Component const &', 'to')])
+ ## exclude.h (module 'ndnSIM'): bool ns3::ndn::Exclude::isExcluded(ns3::ndn::name::Component const & comp) const [member function]
+ cls.add_method('isExcluded',
+ 'bool',
+ [param('ns3::ndn::name::Component const &', 'comp')],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): std::reverse_iterator<std::_Rb_tree_const_iterator<std::pair<ns3::ndn::name::Component const, bool> > > ns3::ndn::Exclude::rbegin() const [member function]
+ cls.add_method('rbegin',
+ 'std::reverse_iterator< std::_Rb_tree_const_iterator< std::pair< ns3::ndn::name::Component const, bool > > >',
+ [],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): std::reverse_iterator<std::_Rb_tree_const_iterator<std::pair<ns3::ndn::name::Component const, bool> > > ns3::ndn::Exclude::rend() const [member function]
+ cls.add_method('rend',
+ 'std::reverse_iterator< std::_Rb_tree_const_iterator< std::pair< ns3::ndn::name::Component const, bool > > >',
+ [],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): size_t ns3::ndn::Exclude::size() const [member function]
+ cls.add_method('size',
+ 'size_t',
+ [],
+ is_const=True)
+ return
+
def register_Ns3NdnFace_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('!=')
@@ -4952,6 +5249,11 @@
cls.add_binary_comparison_operator('==')
## ndn-face.h (module 'ndnSIM'): ns3::ndn::Face::Face(ns3::Ptr<ns3::Node> node) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')])
+ ## ndn-face.h (module 'ndnSIM'): uint32_t ns3::ndn::Face::GetFlags() const [member function]
+ cls.add_method('GetFlags',
+ 'uint32_t',
+ [],
+ is_const=True)
## ndn-face.h (module 'ndnSIM'): uint32_t ns3::ndn::Face::GetId() const [member function]
cls.add_method('GetId',
'uint32_t',
@@ -4976,25 +5278,37 @@
cls.add_method('IsUp',
'bool',
[],
- is_const=True, is_virtual=True)
+ is_const=True)
## ndn-face.h (module 'ndnSIM'): std::ostream & ns3::ndn::Face::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'std::ostream &',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
- ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::Receive(ns3::Ptr<const ns3::Packet> const & p) [member function]
- cls.add_method('Receive',
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::ReceiveData(ns3::Ptr<ns3::ndn::ContentObject> data) [member function]
+ cls.add_method('ReceiveData',
'bool',
- [param('ns3::Ptr< ns3::Packet const > const &', 'p')])
- ## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face> const&, ns3::Ptr<ns3::Packet const> const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
- cls.add_method('RegisterProtocolHandler',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'handler')],
+ [param('ns3::Ptr< ns3::ndn::ContentObject >', 'data')],
is_virtual=True)
- ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::Send(ns3::Ptr<ns3::Packet> p) [member function]
- cls.add_method('Send',
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::ReceiveInterest(ns3::Ptr<ns3::ndn::Interest> interest) [member function]
+ cls.add_method('ReceiveInterest',
'bool',
- [param('ns3::Ptr< ns3::Packet >', 'p')])
+ [param('ns3::Ptr< ns3::ndn::Interest >', 'interest')],
+ is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::RegisterProtocolHandlers(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face>, ns3::Ptr<ns3::ndn::Interest>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & interestHandler, ns3::Callback<void, ns3::Ptr<ns3::ndn::Face>, ns3::Ptr<ns3::ndn::ContentObject>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & dataHandler) [member function]
+ cls.add_method('RegisterProtocolHandlers',
+ 'void',
+ [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::ndn::Interest >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'interestHandler'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::ndn::ContentObject >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'dataHandler')],
+ is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::SendData(ns3::Ptr<ns3::ndn::ContentObject const> data) [member function]
+ cls.add_method('SendData',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')],
+ is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::SendInterest(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
+ cls.add_method('SendInterest',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
+ is_virtual=True)
## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::SetId(uint32_t id) [member function]
cls.add_method('SetId',
'void',
@@ -5007,13 +5321,27 @@
## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::SetUp(bool up=true) [member function]
cls.add_method('SetUp',
'void',
- [param('bool', 'up', default_value='true')],
+ [param('bool', 'up', default_value='true')])
+ ## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::UnRegisterProtocolHandlers() [member function]
+ cls.add_method('UnRegisterProtocolHandlers',
+ 'void',
+ [],
is_virtual=True)
- ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::SendImpl(ns3::Ptr<ns3::Packet> p) [member function]
- cls.add_method('SendImpl',
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::Receive(ns3::Ptr<ns3::Packet const> p) [member function]
+ cls.add_method('Receive',
'bool',
- [param('ns3::Ptr< ns3::Packet >', 'p')],
- is_pure_virtual=True, visibility='protected', is_virtual=True)
+ [param('ns3::Ptr< ns3::Packet const >', 'p')],
+ visibility='protected', is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::Send(ns3::Ptr<ns3::Packet> packet) [member function]
+ cls.add_method('Send',
+ 'bool',
+ [param('ns3::Ptr< ns3::Packet >', 'packet')],
+ visibility='protected', is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::SetFlags(uint32_t flags) [member function]
+ cls.add_method('SetFlags',
+ 'void',
+ [param('uint32_t', 'flags')],
+ visibility='protected')
return
def register_Ns3NdnFaceContainer_methods(root_module, cls):
@@ -5171,15 +5499,15 @@
'ns3::TypeId',
[],
is_static=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::OnData(ns3::Ptr<ns3::ndn::Face> face, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::OnData(ns3::Ptr<ns3::ndn::Face> face, ns3::Ptr<ns3::ndn::ContentObject> data) [member function]
cls.add_method('OnData',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'face'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'face'), param('ns3::Ptr< ns3::ndn::ContentObject >', 'data')],
is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::OnInterest(ns3::Ptr<ns3::ndn::Face> face, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::OnInterest(ns3::Ptr<ns3::ndn::Face> face, ns3::Ptr<ns3::ndn::Interest> interest) [member function]
cls.add_method('OnInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'face'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'face'), param('ns3::Ptr< ns3::ndn::Interest >', 'interest')],
is_virtual=True)
## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::RemoveFace(ns3::Ptr<ns3::ndn::Face> face) [member function]
cls.add_method('RemoveFace',
@@ -5196,100 +5524,100 @@
'void',
[param('ns3::Ptr< ns3::ndn::fib::Entry >', 'fibEntry')],
is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::CanSendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::CanSendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('CanSendOutInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::DetectRetransmittedInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::DetectRetransmittedInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DetectRetransmittedInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidCreatePitEntry(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidCreatePitEntry(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidCreatePitEntry',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidExhaustForwardingOptions(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidExhaustForwardingOptions(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidExhaustForwardingOptions',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidForwardSimilarInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidForwardSimilarInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidForwardSimilarInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveDuplicateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveDuplicateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidReceiveDuplicateInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveSolicitedData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket, bool didCreateCacheEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveSolicitedData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> data, bool didCreateCacheEntry) [member function]
cls.add_method('DidReceiveSolicitedData',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('bool', 'didCreateCacheEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('bool', 'didCreateCacheEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveUnsolicitedData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket, bool didCreateCacheEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveUnsolicitedData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> data, bool didCreateCacheEntry) [member function]
cls.add_method('DidReceiveUnsolicitedData',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('bool', 'didCreateCacheEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('bool', 'didCreateCacheEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSendOutData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSendOutData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::ContentObject const> data, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidSendOutData',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidSendOutInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSuppressSimilarInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSuppressSimilarInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidSuppressSimilarInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::DoPropagateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::DoPropagateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DoPropagateInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::FailedToCreatePitEntry(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::FailedToCreatePitEntry(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
cls.add_method('FailedToCreatePitEntry',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
visibility='protected', is_virtual=True)
## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::PropagateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::PropagateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('PropagateInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::SatisfyPendingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::SatisfyPendingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> data, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('SatisfyPendingInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::ShouldSuppressIncomingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::ShouldSuppressIncomingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('ShouldSuppressIncomingInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::TrySendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::TrySendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('TrySendOutInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::WillSatisfyPendingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('WillSatisfyPendingInterest',
@@ -5348,12 +5676,7 @@
cls.add_constructor([])
## ndn-header-helper.h (module 'ndnSIM'): ns3::ndn::HeaderHelper::HeaderHelper(ns3::ndn::HeaderHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::HeaderHelper const &', 'arg0')])
- ## ndn-header-helper.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Name const> ns3::ndn::HeaderHelper::GetName(ns3::Ptr<const ns3::Packet> packet) [member function]
- cls.add_method('GetName',
- 'ns3::Ptr< ns3::ndn::Name const >',
- [param('ns3::Ptr< ns3::Packet const >', 'packet')],
- is_static=True)
- ## ndn-header-helper.h (module 'ndnSIM'): static ns3::ndn::HeaderHelper::Type ns3::ndn::HeaderHelper::GetNdnHeaderType(ns3::Ptr<const ns3::Packet> packet) [member function]
+ ## ndn-header-helper.h (module 'ndnSIM'): static ns3::ndn::HeaderHelper::Type ns3::ndn::HeaderHelper::GetNdnHeaderType(ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('GetNdnHeaderType',
'ns3::ndn::HeaderHelper::Type',
[param('ns3::Ptr< ns3::Packet const >', 'packet')],
@@ -5361,25 +5684,11 @@
return
def register_Ns3NdnInterest_methods(root_module, cls):
- ## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest::Interest() [constructor]
- cls.add_constructor([])
+ cls.add_output_stream_operator()
+ ## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest::Interest(ns3::Ptr<ns3::Packet> payload=ns3::Create( )) [constructor]
+ cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'payload', default_value='ns3::Create( )')])
## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest::Interest(ns3::ndn::Interest const & interest) [copy constructor]
cls.add_constructor([param('ns3::ndn::Interest const &', 'interest')])
- ## ndn-interest.h (module 'ndnSIM'): uint32_t ns3::ndn::Interest::Deserialize(ns3::Buffer::Iterator start) [member function]
- cls.add_method('Deserialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')],
- is_virtual=True)
- ## ndn-interest.h (module 'ndnSIM'): ns3::TypeId ns3::ndn::Interest::GetInstanceTypeId() const [member function]
- cls.add_method('GetInstanceTypeId',
- 'ns3::TypeId',
- [],
- is_const=True, is_virtual=True)
- ## ndn-interest.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Interest> ns3::ndn::Interest::GetInterest(ns3::Ptr<ns3::Packet> packet) [member function]
- cls.add_method('GetInterest',
- 'ns3::Ptr< ns3::ndn::Interest >',
- [param('ns3::Ptr< ns3::Packet >', 'packet')],
- is_static=True)
## ndn-interest.h (module 'ndnSIM'): ns3::Time ns3::ndn::Interest::GetInterestLifetime() const [member function]
cls.add_method('GetInterestLifetime',
'ns3::Time',
@@ -5405,31 +5714,26 @@
'uint32_t',
[],
is_const=True)
+ ## ndn-interest.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet const> ns3::ndn::Interest::GetPayload() const [member function]
+ cls.add_method('GetPayload',
+ 'ns3::Ptr< ns3::Packet const >',
+ [],
+ is_const=True)
## ndn-interest.h (module 'ndnSIM'): int8_t ns3::ndn::Interest::GetScope() const [member function]
cls.add_method('GetScope',
'int8_t',
[],
is_const=True)
- ## ndn-interest.h (module 'ndnSIM'): uint32_t ns3::ndn::Interest::GetSerializedSize() const [member function]
- cls.add_method('GetSerializedSize',
- 'uint32_t',
+ ## ndn-interest.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet const> ns3::ndn::Interest::GetWire() const [member function]
+ cls.add_method('GetWire',
+ 'ns3::Ptr< ns3::Packet const >',
[],
- is_const=True, is_virtual=True)
- ## ndn-interest.h (module 'ndnSIM'): static ns3::TypeId ns3::ndn::Interest::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
+ is_const=True)
## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
- is_const=True, is_virtual=True)
- ## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::Serialize(ns3::Buffer::Iterator start) const [member function]
- cls.add_method('Serialize',
- 'void',
- [param('ns3::Buffer::Iterator', 'start')],
- is_const=True, is_virtual=True)
+ is_const=True)
## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::SetInterestLifetime(ns3::Time time) [member function]
cls.add_method('SetInterestLifetime',
'void',
@@ -5450,10 +5754,19 @@
cls.add_method('SetNonce',
'void',
[param('uint32_t', 'nonce')])
+ ## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::SetPayload(ns3::Ptr<ns3::Packet> payload) [member function]
+ cls.add_method('SetPayload',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'payload')])
## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::SetScope(int8_t scope) [member function]
cls.add_method('SetScope',
'void',
[param('int8_t', 'scope')])
+ ## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::SetWire(ns3::Ptr<ns3::Packet const> packet) const [member function]
+ cls.add_method('SetWire',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet')],
+ is_const=True)
return
def register_Ns3NdnInterestException_methods(root_module, cls):
@@ -5503,16 +5816,6 @@
'ns3::Ptr< ns3::ndn::Face >',
[param('ns3::Ptr< ns3::NetDevice >', 'netDevice')],
is_const=True, is_virtual=True)
- ## ndn-l3-protocol.h (module 'ndnSIM'): static uint64_t ns3::ndn::L3Protocol::GetInterestCounter() [member function]
- cls.add_method('GetInterestCounter',
- 'uint64_t',
- [],
- is_static=True)
- ## ndn-l3-protocol.h (module 'ndnSIM'): static uint64_t ns3::ndn::L3Protocol::GetDataCounter() [member function]
- cls.add_method('GetDataCounter',
- 'uint64_t',
- [],
- is_static=True)
## ndn-l3-protocol.h (module 'ndnSIM'): void ns3::ndn::L3Protocol::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
@@ -5613,119 +5916,191 @@
def register_Ns3NdnName_methods(root_module, cls):
cls.add_output_stream_operator()
+ cls.add_binary_comparison_operator('!=')
+ cls.add_binary_numeric_operator('+', root_module['ns3::ndn::Name'], root_module['ns3::ndn::Name'], param('ns3::ndn::Name const &', 'right'))
cls.add_binary_comparison_operator('<')
+ cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(ns3::ndn::Name const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::ndn::Name const &', 'arg0')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name() [constructor]
+ cls.add_binary_comparison_operator('>')
+ cls.add_binary_comparison_operator('>=')
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::Name() [constructor]
cls.add_constructor([])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(std::list<boost::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,std::allocator<boost::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const & components) [constructor]
- cls.add_constructor([param('std::list< boost::reference_wrapper< std::string const > > const &', 'components')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(std::list<std::string, std::allocator<std::string> > const & components) [constructor]
- cls.add_constructor([param('std::list< std::string > const &', 'components')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(std::string const & prefix) [constructor]
- cls.add_constructor([param('std::string const &', 'prefix')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(char const * prefix) [constructor]
- cls.add_constructor([param('char const *', 'prefix')])
- ## ndn-name.h (module 'ndnSIM'): uint32_t ns3::ndn::Name::Deserialize(ns3::Buffer::Iterator start) [member function]
- cls.add_method('Deserialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')])
- ## ndn-name.h (module 'ndnSIM'): std::list<std::string, std::allocator<std::string> > const & ns3::ndn::Name::GetComponents() const [member function]
- cls.add_method('GetComponents',
- 'std::list< std::string > const &',
- [],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::string ns3::ndn::Name::GetLastComponent() const [member function]
- cls.add_method('GetLastComponent',
- 'std::string',
- [],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): size_t ns3::ndn::Name::GetSerializedSize() const [member function]
- cls.add_method('GetSerializedSize',
- 'size_t',
- [],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::list<boost::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,std::allocator<boost::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > ns3::ndn::Name::GetSubComponents(size_t num) const [member function]
- cls.add_method('GetSubComponents',
- 'std::list< boost::reference_wrapper< std::string const > >',
- [param('size_t', 'num')],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): void ns3::ndn::Name::Print(std::ostream & os) const [member function]
- cls.add_method('Print',
- 'void',
- [param('std::ostream &', 'os')],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): uint32_t ns3::ndn::Name::Serialize(ns3::Buffer::Iterator start) const [member function]
- cls.add_method('Serialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::_List_iterator<std::string> ns3::ndn::Name::begin() [member function]
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::Name(ns3::ndn::Name const & other) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::Name const &', 'other')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::Name(std::string const & url) [constructor]
+ cls.add_constructor([param('std::string const &', 'url')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::Name(__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > begin, __gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > end) [constructor]
+ cls.add_constructor([param('__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >', 'begin'), param('__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >', 'end')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(ns3::ndn::name::Component const & comp) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('ns3::ndn::name::Component const &', 'comp')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > begin, __gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > end) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >', 'begin'), param('__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >', 'end')],
+ template_parameters=['__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > >'])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(ns3::ndn::Name const & comp) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('ns3::ndn::Name const &', 'comp')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(std::string const & compStr) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('std::string const &', 'compStr')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(void const * buf, size_t size) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('void const *', 'buf'), param('size_t', 'size')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendBlkId(uint64_t blkid) [member function]
+ cls.add_method('appendBlkId',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'blkid')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendBySwap(ns3::ndn::name::Component & comp) [member function]
+ cls.add_method('appendBySwap',
+ 'ns3::ndn::Name &',
+ [param('ns3::ndn::name::Component &', 'comp')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendControlNum(uint64_t control) [member function]
+ cls.add_method('appendControlNum',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'control')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendNumber(uint64_t number) [member function]
+ cls.add_method('appendNumber',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'number')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendNumberWithMarker(uint64_t number, unsigned char marker) [member function]
+ cls.add_method('appendNumberWithMarker',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'number'), param('unsigned char', 'marker')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendSeqNum(uint64_t seqno) [member function]
+ cls.add_method('appendSeqNum',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'seqno')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendVersion(uint64_t version=ns3::ndn::Name::nversion) [member function]
+ cls.add_method('appendVersion',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'version', default_value='ns3::ndn::Name::nversion')])
+ ## name.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > ns3::ndn::Name::begin() const [member function]
cls.add_method('begin',
- 'std::_List_iterator< std::string >',
+ '__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >',
+ [],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<ns3::ndn::name::Component*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > ns3::ndn::Name::begin() [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< ns3::ndn::name::Component *, std::vector< ns3::ndn::name::Component > >',
[])
- ## ndn-name.h (module 'ndnSIM'): std::_List_const_iterator<std::string> ns3::ndn::Name::begin() const [member function]
- cls.add_method('begin',
- 'std::_List_const_iterator< std::string >',
+ ## name.h (module 'ndnSIM'): int ns3::ndn::Name::compare(ns3::ndn::Name const & name) const [member function]
+ cls.add_method('compare',
+ 'int',
+ [param('ns3::ndn::Name const &', 'name')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > ns3::ndn::Name::end() const [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >',
[],
is_const=True)
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::Name::cut(size_t minusComponents) const [member function]
- cls.add_method('cut',
+ ## name.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<ns3::ndn::name::Component*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > ns3::ndn::Name::end() [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< ns3::ndn::name::Component *, std::vector< ns3::ndn::name::Component > >',
+ [])
+ ## name.h (module 'ndnSIM'): ns3::ndn::name::Component const & ns3::ndn::Name::get(int index) const [member function]
+ cls.add_method('get',
+ 'ns3::ndn::name::Component const &',
+ [param('int', 'index')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::Name::get(int index) [member function]
+ cls.add_method('get',
+ 'ns3::ndn::name::Component &',
+ [param('int', 'index')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::Name::getPostfix(size_t len, size_t skip=0) const [member function]
+ cls.add_method('getPostfix',
'ns3::ndn::Name',
- [param('size_t', 'minusComponents')],
+ [param('size_t', 'len'), param('size_t', 'skip', default_value='0')],
is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::_List_iterator<std::string> ns3::ndn::Name::end() [member function]
- cls.add_method('end',
- 'std::_List_iterator< std::string >',
- [])
- ## ndn-name.h (module 'ndnSIM'): std::_List_const_iterator<std::string> ns3::ndn::Name::end() const [member function]
- cls.add_method('end',
- 'std::_List_const_iterator< std::string >',
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::Name::getPrefix(size_t len, size_t skip=0) const [member function]
+ cls.add_method('getPrefix',
+ 'ns3::ndn::Name',
+ [param('size_t', 'len'), param('size_t', 'skip', default_value='0')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::Name::getSubName(size_t pos=0, size_t len=ns3::ndn::Name::npos) const [member function]
+ cls.add_method('getSubName',
+ 'ns3::ndn::Name',
+ [param('size_t', 'pos', default_value='0'), param('size_t', 'len', default_value='ns3::ndn::Name::npos')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): std::reverse_iterator<__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > > ns3::ndn::Name::rbegin() const [member function]
+ cls.add_method('rbegin',
+ 'std::reverse_iterator< __gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > > >',
[],
is_const=True)
- ## ndn-name.h (module 'ndnSIM'): size_t ns3::ndn::Name::size() const [member function]
+ ## name.h (module 'ndnSIM'): std::reverse_iterator<__gnu_cxx::__normal_iterator<ns3::ndn::name::Component*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > > ns3::ndn::Name::rbegin() [member function]
+ cls.add_method('rbegin',
+ 'std::reverse_iterator< __gnu_cxx::__normal_iterator< ns3::ndn::name::Component *, std::vector< ns3::ndn::name::Component > > >',
+ [])
+ ## name.h (module 'ndnSIM'): std::reverse_iterator<__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > > ns3::ndn::Name::rend() const [member function]
+ cls.add_method('rend',
+ 'std::reverse_iterator< __gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > > >',
+ [],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): std::reverse_iterator<__gnu_cxx::__normal_iterator<ns3::ndn::name::Component*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > > ns3::ndn::Name::rend() [member function]
+ cls.add_method('rend',
+ 'std::reverse_iterator< __gnu_cxx::__normal_iterator< ns3::ndn::name::Component *, std::vector< ns3::ndn::name::Component > > >',
+ [])
+ ## name.h (module 'ndnSIM'): size_t ns3::ndn::Name::size() const [member function]
cls.add_method('size',
'size_t',
[],
is_const=True)
+ ## name.h (module 'ndnSIM'): std::string ns3::ndn::Name::toUri() const [member function]
+ cls.add_method('toUri',
+ 'std::string',
+ [],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): void ns3::ndn::Name::toUri(std::ostream & os) const [member function]
+ cls.add_method('toUri',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::npos [variable]
+ cls.add_static_attribute('npos', 'size_t const', is_const=True)
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::nversion [variable]
+ cls.add_static_attribute('nversion', 'uint64_t const', is_const=True)
return
def register_Ns3NdnNameChecker_methods(root_module, cls):
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameChecker::NameChecker() [constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameChecker::NameChecker() [constructor]
cls.add_constructor([])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameChecker::NameChecker(ns3::ndn::NameChecker const & arg0) [copy constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameChecker::NameChecker(ns3::ndn::NameChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::NameChecker const &', 'arg0')])
return
def register_Ns3NdnNameValue_methods(root_module, cls):
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue() [constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue() [constructor]
cls.add_constructor([])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue(ns3::ndn::NameValue const & arg0) [copy constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue(ns3::ndn::NameValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::NameValue const &', 'arg0')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue(ns3::ndn::Name const & value) [constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue(ns3::ndn::Name const & value) [constructor]
cls.add_constructor([param('ns3::ndn::Name const &', 'value')])
- ## ndn-name.h (module 'ndnSIM'): ns3::Ptr<ns3::AttributeValue> ns3::ndn::NameValue::Copy() const [member function]
+ ## name.h (module 'ndnSIM'): ns3::Ptr<ns3::AttributeValue> ns3::ndn::NameValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
- ## ndn-name.h (module 'ndnSIM'): bool ns3::ndn::NameValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
+ ## name.h (module 'ndnSIM'): bool ns3::ndn::NameValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::NameValue::Get() const [member function]
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::NameValue::Get() const [member function]
cls.add_method('Get',
'ns3::ndn::Name',
[],
is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::string ns3::ndn::NameValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
+ ## name.h (module 'ndnSIM'): std::string ns3::ndn::NameValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
- ## ndn-name.h (module 'ndnSIM'): void ns3::ndn::NameValue::Set(ns3::ndn::Name const & value) [member function]
+ ## name.h (module 'ndnSIM'): void ns3::ndn::NameValue::Set(ns3::ndn::Name const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::ndn::Name const &', 'value')])
@@ -5739,10 +6114,15 @@
is_static=True)
## ndn-net-device-face.h (module 'ndnSIM'): ns3::ndn::NetDeviceFace::NetDeviceFace(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::NetDevice> const & netDevice) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::NetDevice > const &', 'netDevice')])
- ## ndn-net-device-face.h (module 'ndnSIM'): void ns3::ndn::NetDeviceFace::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face> const&, ns3::Ptr<ns3::Packet const> const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
- cls.add_method('RegisterProtocolHandler',
+ ## ndn-net-device-face.h (module 'ndnSIM'): void ns3::ndn::NetDeviceFace::RegisterProtocolHandlers(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face>, ns3::Ptr<ns3::ndn::Interest>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & interestHandler, ns3::Callback<void, ns3::Ptr<ns3::ndn::Face>, ns3::Ptr<ns3::ndn::ContentObject>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & dataHandler) [member function]
+ cls.add_method('RegisterProtocolHandlers',
'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'handler')],
+ [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::ndn::Interest >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'interestHandler'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::ndn::ContentObject >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'dataHandler')],
+ is_virtual=True)
+ ## ndn-net-device-face.h (module 'ndnSIM'): void ns3::ndn::NetDeviceFace::UnRegisterProtocolHandlers() [member function]
+ cls.add_method('UnRegisterProtocolHandlers',
+ 'void',
+ [],
is_virtual=True)
## ndn-net-device-face.h (module 'ndnSIM'): std::ostream & ns3::ndn::NetDeviceFace::Print(std::ostream & os) const [member function]
cls.add_method('Print',
@@ -5754,8 +6134,8 @@
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
- ## ndn-net-device-face.h (module 'ndnSIM'): bool ns3::ndn::NetDeviceFace::SendImpl(ns3::Ptr<ns3::Packet> p) [member function]
- cls.add_method('SendImpl',
+ ## ndn-net-device-face.h (module 'ndnSIM'): bool ns3::ndn::NetDeviceFace::Send(ns3::Ptr<ns3::Packet> p) [member function]
+ cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='protected', is_virtual=True)
@@ -5863,6 +6243,11 @@
'ns3::Time',
[],
is_const=True)
+ ## ndn-rtt-estimator.h (module 'ndnSIM'): ns3::TypeId ns3::ndn::RttEstimator::GetInstanceTypeId() const [member function]
+ cls.add_method('GetInstanceTypeId',
+ 'ns3::TypeId',
+ [],
+ is_const=True, is_virtual=True)
## ndn-rtt-estimator.h (module 'ndnSIM'): ns3::Time ns3::ndn::RttEstimator::GetMaxRto() const [member function]
cls.add_method('GetMaxRto',
'ns3::Time',
@@ -5964,6 +6349,14 @@
cls.add_method('AddNetDeviceFaceCreateCallback',
'void',
[param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::ndn::L3Protocol >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
+ ## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::UpdateNetDeviceFaceCreateCallback(ns3::TypeId netDeviceType, ns3::Callback<ns3::Ptr<ns3::ndn::NetDeviceFace>,ns3::Ptr<ns3::Node>,ns3::Ptr<ns3::ndn::L3Protocol>,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
+ cls.add_method('UpdateNetDeviceFaceCreateCallback',
+ 'void',
+ [param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::ndn::L3Protocol >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
+ ## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::RemoveNetDeviceFaceCreateCallback(ns3::TypeId netDeviceType, ns3::Callback<ns3::Ptr<ns3::ndn::NetDeviceFace>,ns3::Ptr<ns3::Node>,ns3::Ptr<ns3::ndn::L3Protocol>,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
+ cls.add_method('RemoveNetDeviceFaceCreateCallback',
+ 'void',
+ [param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::ndn::L3Protocol >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::EnableLimits(bool enable=true, ns3::Time avgRtt=ns3::Seconds( ), uint32_t avgContentObject=1100, uint32_t avgInterest=40) [member function]
cls.add_method('EnableLimits',
'void',
@@ -6026,6 +6419,104 @@
cls.add_constructor([param('ns3::ndn::UnknownHeaderException const &', 'arg0')])
return
+def register_Ns3NdnWire_methods(root_module, cls):
+ ## ndn-wire.h (module 'ndnSIM'): ns3::ndn::Wire::Wire() [constructor]
+ cls.add_constructor([])
+ ## ndn-wire.h (module 'ndnSIM'): ns3::ndn::Wire::Wire(ns3::ndn::Wire const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::Wire const &', 'arg0')])
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::Packet> ns3::ndn::Wire::FromData(ns3::Ptr<ns3::ndn::ContentObject const> data, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromData',
+ 'ns3::Ptr< ns3::Packet >',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static std::string ns3::ndn::Wire::FromDataStr(ns3::Ptr<ns3::ndn::ContentObject const> data, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromDataStr',
+ 'std::string',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::Packet> ns3::ndn::Wire::FromInterest(ns3::Ptr<ns3::ndn::Interest const> interest, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromInterest',
+ 'ns3::Ptr< ns3::Packet >',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static std::string ns3::ndn::Wire::FromInterestStr(ns3::Ptr<ns3::ndn::Interest const> interest, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromInterestStr',
+ 'std::string',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static std::string ns3::ndn::Wire::FromName(ns3::Ptr<ns3::ndn::Name const> name, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromName',
+ 'std::string',
+ [param('ns3::Ptr< ns3::ndn::Name const >', 'name'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::ContentObject> ns3::ndn::Wire::ToData(ns3::Ptr<ns3::Packet> packet, int8_t type=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)) [member function]
+ cls.add_method('ToData',
+ 'ns3::Ptr< ns3::ndn::ContentObject >',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('int8_t', 'type', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::ContentObject> ns3::ndn::Wire::ToDataStr(std::string const & wire, int8_t type=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)) [member function]
+ cls.add_method('ToDataStr',
+ 'ns3::Ptr< ns3::ndn::ContentObject >',
+ [param('std::string const &', 'wire'), param('int8_t', 'type', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Interest> ns3::ndn::Wire::ToInterest(ns3::Ptr<ns3::Packet> packet, int8_t type=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)) [member function]
+ cls.add_method('ToInterest',
+ 'ns3::Ptr< ns3::ndn::Interest >',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('int8_t', 'type', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Interest> ns3::ndn::Wire::ToInterestStr(std::string const & wire, int8_t type=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)) [member function]
+ cls.add_method('ToInterestStr',
+ 'ns3::Ptr< ns3::ndn::Interest >',
+ [param('std::string const &', 'wire'), param('int8_t', 'type', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Name> ns3::ndn::Wire::ToName(std::string const & wire, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('ToName',
+ 'ns3::Ptr< ns3::ndn::Name >',
+ [param('std::string const &', 'wire'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ return
+
+def register_Ns3NdnApiFace_methods(root_module, cls):
+ ## ndn-api-face.h (module 'ndnSIM'): ns3::ndn::ApiFace::ApiFace(ns3::Ptr<ns3::Node> node) [constructor]
+ cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')])
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::Shutdown() [member function]
+ cls.add_method('Shutdown',
+ 'void',
+ [],
+ is_virtual=True)
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::ExpressInterest(ns3::Ptr<ns3::ndn::Interest> interest, ns3::Callback<void, ns3::Ptr<ns3::ndn::Interest const>, ns3::Ptr<ns3::ndn::ContentObject const>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onData, ns3::Callback<void, ns3::Ptr<ns3::ndn::Interest const>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onTimeout) [member function]
+ cls.add_method('ExpressInterest',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::Interest >', 'interest'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Interest const >, ns3::Ptr< ns3::ndn::ContentObject const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onData'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Interest const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onTimeout')])
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::SetInterestFilter(ns3::Ptr<ns3::ndn::Name const> prefix, ns3::Callback<void, ns3::Ptr<ns3::ndn::Name const>, ns3::Ptr<ns3::ndn::Interest const>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onInterest) [member function]
+ cls.add_method('SetInterestFilter',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::Name const >', 'prefix'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Name const >, ns3::Ptr< ns3::ndn::Interest const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onInterest')])
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::ClearInterestFilter(ns3::Ptr<ns3::ndn::Name const> prefix) [member function]
+ cls.add_method('ClearInterestFilter',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::Name const >', 'prefix')])
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::Put(ns3::Ptr<ns3::ndn::ContentObject> data) [member function]
+ cls.add_method('Put',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::ContentObject >', 'data')])
+ ## ndn-api-face.h (module 'ndnSIM'): bool ns3::ndn::ApiFace::SendInterest(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
+ cls.add_method('SendInterest',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
+ is_virtual=True)
+ ## ndn-api-face.h (module 'ndnSIM'): bool ns3::ndn::ApiFace::SendData(ns3::Ptr<ns3::ndn::ContentObject const> data) [member function]
+ cls.add_method('SendData',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')],
+ is_virtual=True)
+ ## ndn-api-face.h (module 'ndnSIM'): std::ostream & ns3::ndn::ApiFace::Print(std::ostream & os) const [member function]
+ cls.add_method('Print',
+ 'std::ostream &',
+ [param('std::ostream &', 'os')],
+ is_const=True, is_virtual=True)
+ return
+
def register_Ns3NdnAppFace_methods(root_module, cls):
## ndn-app-face.h (module 'ndnSIM'): static ns3::TypeId ns3::ndn::AppFace::GetTypeId() [member function]
cls.add_method('GetTypeId',
@@ -6034,39 +6525,34 @@
is_static=True)
## ndn-app-face.h (module 'ndnSIM'): ns3::ndn::AppFace::AppFace(ns3::Ptr<ns3::ndn::App> app) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::ndn::App >', 'app')])
- ## ndn-app-face.h (module 'ndnSIM'): void ns3::ndn::AppFace::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face> const&, ns3::Ptr<ns3::Packet const> const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
- cls.add_method('RegisterProtocolHandler',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'handler')],
+ ## ndn-app-face.h (module 'ndnSIM'): bool ns3::ndn::AppFace::SendInterest(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
+ cls.add_method('SendInterest',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
+ is_virtual=True)
+ ## ndn-app-face.h (module 'ndnSIM'): bool ns3::ndn::AppFace::SendData(ns3::Ptr<ns3::ndn::ContentObject const> data) [member function]
+ cls.add_method('SendData',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')],
is_virtual=True)
## ndn-app-face.h (module 'ndnSIM'): std::ostream & ns3::ndn::AppFace::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'std::ostream &',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
- ## ndn-app-face.h (module 'ndnSIM'): bool ns3::ndn::AppFace::SendImpl(ns3::Ptr<ns3::Packet> p) [member function]
- cls.add_method('SendImpl',
- 'bool',
- [param('ns3::Ptr< ns3::Packet >', 'p')],
- visibility='protected', is_virtual=True)
return
def register_Ns3NdnCsEntry_methods(root_module, cls):
## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::cs::Entry::Entry(ns3::ndn::cs::Entry const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::cs::Entry const &', 'arg0')])
- ## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::cs::Entry::Entry(ns3::Ptr<ns3::ndn::ContentStore> cs, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> packet) [constructor]
- cls.add_constructor([param('ns3::Ptr< ns3::ndn::ContentStore >', 'cs'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'packet')])
+ ## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::cs::Entry::Entry(ns3::Ptr<ns3::ndn::ContentStore> cs, ns3::Ptr<ns3::ndn::ContentObject const> data) [constructor]
+ cls.add_constructor([param('ns3::Ptr< ns3::ndn::ContentStore >', 'cs'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')])
## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::ContentStore> ns3::ndn::cs::Entry::GetContentStore() [member function]
cls.add_method('GetContentStore',
'ns3::Ptr< ns3::ndn::ContentStore >',
[])
- ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet> ns3::ndn::cs::Entry::GetFullyFormedNdnPacket() const [member function]
- cls.add_method('GetFullyFormedNdnPacket',
- 'ns3::Ptr< ns3::Packet >',
- [],
- is_const=True)
- ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::ContentObject const> ns3::ndn::cs::Entry::GetHeader() const [member function]
- cls.add_method('GetHeader',
+ ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::ContentObject const> ns3::ndn::cs::Entry::GetData() const [member function]
+ cls.add_method('GetData',
'ns3::Ptr< ns3::ndn::ContentObject const >',
[],
is_const=True)
@@ -6075,11 +6561,6 @@
'ns3::ndn::Name const &',
[],
is_const=True)
- ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<const ns3::Packet> ns3::ndn::cs::Entry::GetPacket() const [member function]
- cls.add_method('GetPacket',
- 'ns3::Ptr< ns3::Packet const >',
- [],
- is_const=True)
return
def register_Ns3NdnFibEntry_methods(root_module, cls):
@@ -6227,6 +6708,95 @@
cls.add_constructor([param('ns3::ndn::fw::Tag const &', 'arg0')])
return
+def register_Ns3NdnNameComponent_methods(root_module, cls):
+ cls.add_output_stream_operator()
+ cls.add_binary_comparison_operator('<')
+ cls.add_binary_comparison_operator('<=')
+ cls.add_binary_comparison_operator('>')
+ cls.add_binary_comparison_operator('>=')
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component(ns3::ndn::name::Component const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::name::Component const &', 'arg0')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component() [constructor]
+ cls.add_constructor([])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component(std::string const & uri) [constructor]
+ cls.add_constructor([param('std::string const &', 'uri')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component(__gnu_cxx::__normal_iterator<char const*, std::string> begin, __gnu_cxx::__normal_iterator<char const*, std::string> end) [constructor]
+ cls.add_constructor([param('__gnu_cxx::__normal_iterator< char const *, std::string >', 'begin'), param('__gnu_cxx::__normal_iterator< char const *, std::string >', 'end')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component(void const * buf, size_t length) [constructor]
+ cls.add_constructor([param('void const *', 'buf'), param('size_t', 'length')])
+ ## name-component.h (module 'ndnSIM'): int ns3::ndn::name::Component::compare(ns3::ndn::name::Component const & other) const [member function]
+ cls.add_method('compare',
+ 'int',
+ [param('ns3::ndn::name::Component const &', 'other')],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::name::Component::fromNumber(uint64_t number) [member function]
+ cls.add_method('fromNumber',
+ 'ns3::ndn::name::Component &',
+ [param('uint64_t', 'number')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::name::Component::fromNumberWithMarker(uint64_t number, unsigned char marker) [member function]
+ cls.add_method('fromNumberWithMarker',
+ 'ns3::ndn::name::Component &',
+ [param('uint64_t', 'number'), param('unsigned char', 'marker')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::name::Component::fromUri(std::string const & uri) [member function]
+ cls.add_method('fromUri',
+ 'ns3::ndn::name::Component &',
+ [param('std::string const &', 'uri')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::name::Component::fromUri(__gnu_cxx::__normal_iterator<char const*, std::string> begin, __gnu_cxx::__normal_iterator<char const*, std::string> end) [member function]
+ cls.add_method('fromUri',
+ 'ns3::ndn::name::Component &',
+ [param('__gnu_cxx::__normal_iterator< char const *, std::string >', 'begin'), param('__gnu_cxx::__normal_iterator< char const *, std::string >', 'end')])
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toBlkId() const [member function]
+ cls.add_method('toBlkId',
+ 'uint64_t',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): std::string ns3::ndn::name::Component::toBlob() const [member function]
+ cls.add_method('toBlob',
+ 'std::string',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): void ns3::ndn::name::Component::toBlob(std::ostream & os) const [member function]
+ cls.add_method('toBlob',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toControlNum() const [member function]
+ cls.add_method('toControlNum',
+ 'uint64_t',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toNumber() const [member function]
+ cls.add_method('toNumber',
+ 'uint64_t',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toNumberWithMarker(unsigned char marker) const [member function]
+ cls.add_method('toNumberWithMarker',
+ 'uint64_t',
+ [param('unsigned char', 'marker')],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toSeqNum() const [member function]
+ cls.add_method('toSeqNum',
+ 'uint64_t',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): std::string ns3::ndn::name::Component::toUri() const [member function]
+ cls.add_method('toUri',
+ 'std::string',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): void ns3::ndn::name::Component::toUri(std::ostream & os) const [member function]
+ cls.add_method('toUri',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toVersion() const [member function]
+ cls.add_method('toVersion',
+ 'uint64_t',
+ [],
+ is_const=True)
+ return
+
def register_Ns3NdnPitEntry_methods(root_module, cls):
cls.add_output_stream_operator()
## ndn-pit-entry.h (module 'ndnSIM'): ns3::ndn::pit::Entry::Entry(ns3::ndn::pit::Entry const & arg0) [copy constructor]
@@ -6426,14 +6996,24 @@
return
def register_functions_ns3_ndn(module, root_module):
- ## ndn-name.h (module 'ndnSIM'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::ndn::MakeNameChecker() [free function]
+ ## ndn-wire.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet> ns3::ndn::BufferToPacket(std::string const & buffer) [free function]
+ module.add_function('BufferToPacket',
+ 'ns3::Ptr< ns3::Packet >',
+ [param('std::string const &', 'buffer')])
+ ## name.h (module 'ndnSIM'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::ndn::MakeNameChecker() [free function]
module.add_function('MakeNameChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
+ ## ndn-wire.h (module 'ndnSIM'): std::string ns3::ndn::PacketToBuffer(ns3::Ptr<ns3::Packet const> pkt) [free function]
+ module.add_function('PacketToBuffer',
+ 'std::string',
+ [param('ns3::Ptr< ns3::Packet const >', 'pkt')])
register_functions_ns3_ndn_cs(module.get_submodule('cs'), root_module)
register_functions_ns3_ndn_fib(module.get_submodule('fib'), root_module)
register_functions_ns3_ndn_fw(module.get_submodule('fw'), root_module)
+ register_functions_ns3_ndn_name(module.get_submodule('name'), root_module)
register_functions_ns3_ndn_pit(module.get_submodule('pit'), root_module)
+ register_functions_ns3_ndn_time(module.get_submodule('time'), root_module)
return
def register_functions_ns3_ndn_cs(module, root_module):
@@ -6445,9 +7025,19 @@
def register_functions_ns3_ndn_fw(module, root_module):
return
+def register_functions_ns3_ndn_name(module, root_module):
+ return
+
def register_functions_ns3_ndn_pit(module, root_module):
return
+def register_functions_ns3_ndn_time(module, root_module):
+ ## ndn-common.h (module 'ndnSIM'): ns3::Time ns3::ndn::time::NowUnixTimestamp() [free function]
+ module.add_function('NowUnixTimestamp',
+ 'ns3::Time',
+ [])
+ return
+
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
diff --git a/bindings/modulegen__gcc_LP64.py b/bindings/modulegen__gcc_LP64.py
index 3d83839..c072610 100644
--- a/bindings/modulegen__gcc_LP64.py
+++ b/bindings/modulegen__gcc_LP64.py
@@ -96,6 +96,8 @@
module.add_class('SequentialVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
+ ## simulator.h (module 'core'): ns3::Simulator [class]
+ module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core')
## tag.h (module 'network'): ns3::Tag [class]
module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
@@ -170,12 +172,12 @@
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TopologyReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TopologyReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> > [class]
- module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::ContentObject', 'ns3::Header', 'ns3::DefaultDeleter<ns3::ndn::ContentObject>'], parent=root_module['ns3::Header'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> > [class]
+ module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::ContentObject', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::ContentObject>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::FaceContainer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::FaceContainer> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::FaceContainer', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::FaceContainer>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> > [class]
- module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::ndn::Interest', 'ns3::Header', 'ns3::DefaultDeleter<ns3::ndn::Interest>'], parent=root_module['ns3::Header'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> > [class]
+ module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::ndn::Interest', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::Interest>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Name, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Name> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::Name', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::Name>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::cs::Entry, ns3::empty, ns3::DefaultDeleter<ns3::ndn::cs::Entry> > [class]
@@ -210,6 +212,8 @@
module.add_class('BooleanChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## boolean.h (module 'core'): ns3::BooleanValue [class]
module.add_class('BooleanValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
+ ## callback-based-app.h (module 'ndnSIM'): ns3::CallbackBasedApp [class]
+ module.add_class('CallbackBasedApp', parent=root_module['ns3::Application'])
## callback.h (module 'core'): ns3::CallbackChecker [class]
module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## callback.h (module 'core'): ns3::CallbackImplBase [class]
@@ -326,16 +330,20 @@
module.add_class('App', parent=root_module['ns3::Application'])
## ndn-app-helper.h (module 'ndnSIM'): ns3::ndn::AppHelper [class]
module.add_class('AppHelper')
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob [class]
+ module.add_class('Blob')
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject [class]
- module.add_class('ContentObject', parent=root_module['ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >'])
+ module.add_class('ContentObject', parent=root_module['ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >'])
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObjectException [class]
module.add_class('ContentObjectException')
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObjectTail [class]
- module.add_class('ContentObjectTail', parent=root_module['ns3::Trailer'])
## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::ContentStore [class]
module.add_class('ContentStore', parent=root_module['ns3::Object'])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude [class]
+ module.add_class('Exclude')
## ndn-face.h (module 'ndnSIM'): ns3::ndn::Face [class]
module.add_class('Face', parent=root_module['ns3::Object'])
+ ## ndn-face.h (module 'ndnSIM'): ns3::ndn::Face::Flags [enumeration]
+ module.add_enum('Flags', ['APPLICATION'], outer_class=root_module['ns3::ndn::Face'])
## ndn-face-container.h (module 'ndnSIM'): ns3::ndn::FaceContainer [class]
module.add_class('FaceContainer', parent=root_module['ns3::SimpleRefCount< ns3::ndn::FaceContainer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::FaceContainer> >'])
## ndn-fib.h (module 'ndnSIM'): ns3::ndn::Fib [class]
@@ -349,7 +357,7 @@
## ndn-header-helper.h (module 'ndnSIM'): ns3::ndn::HeaderHelper::Type [enumeration]
module.add_enum('Type', ['INTEREST_CCNB', 'CONTENT_OBJECT_CCNB', 'INTEREST_NDNSIM', 'CONTENT_OBJECT_NDNSIM'], outer_class=root_module['ns3::ndn::HeaderHelper'])
## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest [class]
- module.add_class('Interest', parent=root_module['ns3::SimpleRefCount< ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >'])
+ module.add_class('Interest', parent=root_module['ns3::SimpleRefCount< ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >'])
## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest [enumeration]
module.add_enum('', ['NORMAL_INTEREST', 'NACK_LOOP', 'NACK_CONGESTION', 'NACK_GIVEUP_PIT'], outer_class=root_module['ns3::ndn::Interest'])
## ndn-interest.h (module 'ndnSIM'): ns3::ndn::InterestException [class]
@@ -358,11 +366,11 @@
module.add_class('L3Protocol', parent=root_module['ns3::Object'])
## ndn-limits.h (module 'ndnSIM'): ns3::ndn::Limits [class]
module.add_class('Limits', parent=root_module['ns3::Object'])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name [class]
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name [class]
module.add_class('Name', parent=root_module['ns3::SimpleRefCount< ns3::ndn::Name, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Name> >'])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameChecker [class]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameChecker [class]
module.add_class('NameChecker', parent=root_module['ns3::AttributeChecker'])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameValue [class]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameValue [class]
module.add_class('NameValue', parent=root_module['ns3::AttributeValue'])
## ndn-net-device-face.h (module 'ndnSIM'): ns3::ndn::NetDeviceFace [class]
module.add_class('NetDeviceFace', parent=root_module['ns3::ndn::Face'])
@@ -376,26 +384,36 @@
module.add_class('StackHelper')
## ndn-header-helper.h (module 'ndnSIM'): ns3::ndn::UnknownHeaderException [class]
module.add_class('UnknownHeaderException')
+ ## ndn-wire.h (module 'ndnSIM'): ns3::ndn::Wire [struct]
+ module.add_class('Wire')
+ ## ndn-wire.h (module 'ndnSIM'): ns3::ndn::Wire [enumeration]
+ module.add_enum('', ['WIRE_FORMAT_DEFAULT', 'WIRE_FORMAT_AUTODETECT', 'WIRE_FORMAT_NDNSIM', 'WIRE_FORMAT_CCNB'], outer_class=root_module['ns3::ndn::Wire'])
+ ## ndn-api-face.h (module 'ndnSIM'): ns3::ndn::ApiFace [class]
+ module.add_class('ApiFace', parent=root_module['ns3::ndn::Face'])
## ndn-app-face.h (module 'ndnSIM'): ns3::ndn::AppFace [class]
module.add_class('AppFace', parent=root_module['ns3::ndn::Face'])
+ module.add_container('std::vector< char >', 'char', container_type='vector')
+ module.add_container('std::map< ns3::ndn::name::Component, bool, std::greater< ns3::ndn::name::Component >, std::allocator< std::pair< ns3::ndn::name::Component const, bool > > >', ('ns3::ndn::name::Component', 'bool'), container_type='map')
module.add_container('std::vector< ns3::Ptr< ns3::ndn::Face > >', 'ns3::Ptr< ns3::ndn::Face >', container_type='vector')
- module.add_container('std::list< boost::reference_wrapper< std::string const > >', 'boost::reference_wrapper< std::basic_string< char, std::char_traits< char >, std::allocator< char > > const >', container_type='list')
- module.add_container('std::list< std::string >', 'std::string', container_type='list')
typehandlers.add_type_alias('ns3::ndn::ContentObject', 'ns3::ndn::ContentObjectHeader')
typehandlers.add_type_alias('ns3::ndn::ContentObject*', 'ns3::ndn::ContentObjectHeader*')
typehandlers.add_type_alias('ns3::ndn::ContentObject&', 'ns3::ndn::ContentObjectHeader&')
module.add_typedef(root_module['ns3::ndn::ContentObject'], 'ContentObjectHeader')
- typehandlers.add_type_alias('ns3::ndn::Interest', 'ns3::ndn::InterestHeader')
- typehandlers.add_type_alias('ns3::ndn::Interest*', 'ns3::ndn::InterestHeader*')
- typehandlers.add_type_alias('ns3::ndn::Interest&', 'ns3::ndn::InterestHeader&')
- module.add_typedef(root_module['ns3::ndn::Interest'], 'InterestHeader')
typehandlers.add_type_alias('std::deque< ns3::ndn::RttHistory, std::allocator< ns3::ndn::RttHistory > >', 'ns3::ndn::RttHistory_t')
typehandlers.add_type_alias('std::deque< ns3::ndn::RttHistory, std::allocator< ns3::ndn::RttHistory > >*', 'ns3::ndn::RttHistory_t*')
typehandlers.add_type_alias('std::deque< ns3::ndn::RttHistory, std::allocator< ns3::ndn::RttHistory > >&', 'ns3::ndn::RttHistory_t&')
+ typehandlers.add_type_alias('ns3::Time', 'ns3::ndn::TimeInterval')
+ typehandlers.add_type_alias('ns3::Time*', 'ns3::ndn::TimeInterval*')
+ typehandlers.add_type_alias('ns3::Time&', 'ns3::ndn::TimeInterval&')
+ module.add_typedef(root_module['ns3::Time'], 'TimeInterval')
typehandlers.add_type_alias('ns3::ndn::Name', 'ns3::ndn::NameComponents')
typehandlers.add_type_alias('ns3::ndn::Name*', 'ns3::ndn::NameComponents*')
typehandlers.add_type_alias('ns3::ndn::Name&', 'ns3::ndn::NameComponents&')
module.add_typedef(root_module['ns3::ndn::Name'], 'NameComponents')
+ typehandlers.add_type_alias('ns3::ndn::Interest', 'ns3::ndn::InterestHeader')
+ typehandlers.add_type_alias('ns3::ndn::Interest*', 'ns3::ndn::InterestHeader*')
+ typehandlers.add_type_alias('ns3::ndn::Interest&', 'ns3::ndn::InterestHeader&')
+ module.add_typedef(root_module['ns3::ndn::Interest'], 'InterestHeader')
## Register a nested module for the namespace cs
@@ -415,11 +433,23 @@
register_types_ns3_ndn_fw(nested_module)
+ ## Register a nested module for the namespace name
+
+ nested_module = module.add_cpp_namespace('name')
+ register_types_ns3_ndn_name(nested_module)
+
+
## Register a nested module for the namespace pit
nested_module = module.add_cpp_namespace('pit')
register_types_ns3_ndn_pit(nested_module)
+
+ ## Register a nested module for the namespace time
+
+ nested_module = module.add_cpp_namespace('time')
+ register_types_ns3_ndn_time(nested_module)
+
def register_types_ns3_ndn_cs(module):
root_module = module.get_root()
@@ -453,6 +483,12 @@
## ndn-fw-tag.h (module 'ndnSIM'): ns3::ndn::fw::Tag [class]
module.add_class('Tag')
+def register_types_ns3_ndn_name(module):
+ root_module = module.get_root()
+
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component [class]
+ module.add_class('Component', parent=root_module['ns3::ndn::Blob'])
+
def register_types_ns3_ndn_pit(module):
root_module = module.get_root()
@@ -472,6 +508,10 @@
module.add_container('std::set< ns3::ndn::pit::OutgoingFace >', 'ns3::ndn::pit::OutgoingFace', container_type='set')
module.add_container('std::set< unsigned int >', 'unsigned int', container_type='set')
+def register_types_ns3_ndn_time(module):
+ root_module = module.get_root()
+
+
def register_methods(root_module):
register_Ns3Address_methods(root_module, root_module['ns3::Address'])
register_Ns3ApplicationContainer_methods(root_module, root_module['ns3::ApplicationContainer'])
@@ -507,6 +547,7 @@
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
+ register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3TracedValue__Ns3NdnFibFaceMetricStatus_methods(root_module, root_module['ns3::TracedValue< ns3::ndn::fib::FaceMetric::Status >'])
@@ -543,9 +584,9 @@
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
- register_Ns3SimpleRefCount__Ns3NdnContentObject_Ns3Header_Ns3DefaultDeleter__lt__ns3NdnContentObject__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >'])
+ register_Ns3SimpleRefCount__Ns3NdnContentObject_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnContentObject__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >'])
register_Ns3SimpleRefCount__Ns3NdnFaceContainer_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnFaceContainer__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::FaceContainer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::FaceContainer> >'])
- register_Ns3SimpleRefCount__Ns3NdnInterest_Ns3Header_Ns3DefaultDeleter__lt__ns3NdnInterest__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >'])
+ register_Ns3SimpleRefCount__Ns3NdnInterest_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnInterest__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >'])
register_Ns3SimpleRefCount__Ns3NdnName_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnName__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::Name, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Name> >'])
register_Ns3SimpleRefCount__Ns3NdnCsEntry_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnCsEntry__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::cs::Entry, ns3::empty, ns3::DefaultDeleter<ns3::ndn::cs::Entry> >'])
register_Ns3SimpleRefCount__Ns3NdnPitEntry_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnPitEntry__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::ndn::pit::Entry, ns3::empty, ns3::DefaultDeleter<ns3::ndn::pit::Entry> >'])
@@ -561,6 +602,7 @@
register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
register_Ns3BooleanChecker_methods(root_module, root_module['ns3::BooleanChecker'])
register_Ns3BooleanValue_methods(root_module, root_module['ns3::BooleanValue'])
+ register_Ns3CallbackBasedApp_methods(root_module, root_module['ns3::CallbackBasedApp'])
register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker'])
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
@@ -596,10 +638,11 @@
register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue'])
register_Ns3NdnApp_methods(root_module, root_module['ns3::ndn::App'])
register_Ns3NdnAppHelper_methods(root_module, root_module['ns3::ndn::AppHelper'])
+ register_Ns3NdnBlob_methods(root_module, root_module['ns3::ndn::Blob'])
register_Ns3NdnContentObject_methods(root_module, root_module['ns3::ndn::ContentObject'])
register_Ns3NdnContentObjectException_methods(root_module, root_module['ns3::ndn::ContentObjectException'])
- register_Ns3NdnContentObjectTail_methods(root_module, root_module['ns3::ndn::ContentObjectTail'])
register_Ns3NdnContentStore_methods(root_module, root_module['ns3::ndn::ContentStore'])
+ register_Ns3NdnExclude_methods(root_module, root_module['ns3::ndn::Exclude'])
register_Ns3NdnFace_methods(root_module, root_module['ns3::ndn::Face'])
register_Ns3NdnFaceContainer_methods(root_module, root_module['ns3::ndn::FaceContainer'])
register_Ns3NdnFib_methods(root_module, root_module['ns3::ndn::Fib'])
@@ -619,6 +662,8 @@
register_Ns3NdnRttHistory_methods(root_module, root_module['ns3::ndn::RttHistory'])
register_Ns3NdnStackHelper_methods(root_module, root_module['ns3::ndn::StackHelper'])
register_Ns3NdnUnknownHeaderException_methods(root_module, root_module['ns3::ndn::UnknownHeaderException'])
+ register_Ns3NdnWire_methods(root_module, root_module['ns3::ndn::Wire'])
+ register_Ns3NdnApiFace_methods(root_module, root_module['ns3::ndn::ApiFace'])
register_Ns3NdnAppFace_methods(root_module, root_module['ns3::ndn::AppFace'])
register_Ns3NdnCsEntry_methods(root_module, root_module['ns3::ndn::cs::Entry'])
register_Ns3NdnFibEntry_methods(root_module, root_module['ns3::ndn::fib::Entry'])
@@ -629,6 +674,7 @@
register_Ns3NdnFibI_metric_methods(root_module, root_module['ns3::ndn::fib::i_metric'])
register_Ns3NdnFibI_nth_methods(root_module, root_module['ns3::ndn::fib::i_nth'])
register_Ns3NdnFwTag_methods(root_module, root_module['ns3::ndn::fw::Tag'])
+ register_Ns3NdnNameComponent_methods(root_module, root_module['ns3::ndn::name::Component'])
register_Ns3NdnPitEntry_methods(root_module, root_module['ns3::ndn::pit::Entry'])
register_Ns3NdnPitEntryIsNotEmpty_methods(root_module, root_module['ns3::ndn::pit::EntryIsNotEmpty'])
register_Ns3NdnPitIncomingFace_methods(root_module, root_module['ns3::ndn::pit::IncomingFace'])
@@ -1728,6 +1774,29 @@
'uint32_t',
[],
is_const=True)
+ ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::begin() const [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
+ [],
+ is_const=True)
+ ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::begin() [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node >, std::vector< ns3::Ptr< ns3::Node > > >',
+ [])
+ ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::end() const [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
+ [],
+ is_const=True)
+ ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::end() [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node >, std::vector< ns3::Ptr< ns3::Node > > >',
+ [])
+ ## node-container.h (module 'network'): uint32_t ns3::NodeContainer::size() const [member function]
+ cls.add_method('size',
+ 'uint32_t',
+ [],
+ is_const=True)
return
def register_Ns3ObjectBase_methods(root_module, cls):
@@ -2122,6 +2191,86 @@
is_static=True)
return
+def register_Ns3Simulator_methods(root_module, cls):
+ ## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::Simulator const &', 'arg0')])
+ ## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function]
+ cls.add_method('Cancel',
+ 'void',
+ [param('ns3::EventId const &', 'id')],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function]
+ cls.add_method('Destroy',
+ 'void',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function]
+ cls.add_method('GetContext',
+ 'uint32_t',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function]
+ cls.add_method('GetDelayLeft',
+ 'ns3::Time',
+ [param('ns3::EventId const &', 'id')],
+ is_static=True)
+ ## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function]
+ cls.add_method('GetImplementation',
+ 'ns3::Ptr< ns3::SimulatorImpl >',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function]
+ cls.add_method('GetMaximumSimulationTime',
+ 'ns3::Time',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function]
+ cls.add_method('GetSystemId',
+ 'uint32_t',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function]
+ cls.add_method('IsExpired',
+ 'bool',
+ [param('ns3::EventId const &', 'id')],
+ is_static=True)
+ ## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function]
+ cls.add_method('IsFinished',
+ 'bool',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function]
+ cls.add_method('Now',
+ 'ns3::Time',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function]
+ cls.add_method('Remove',
+ 'void',
+ [param('ns3::EventId const &', 'id')],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function]
+ cls.add_method('SetImplementation',
+ 'void',
+ [param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
+ cls.add_method('SetScheduler',
+ 'void',
+ [param('ns3::ObjectFactory', 'schedulerFactory')],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function]
+ cls.add_method('Stop',
+ 'void',
+ [],
+ is_static=True)
+ ## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & time) [member function]
+ cls.add_method('Stop',
+ 'void',
+ [param('ns3::Time const &', 'time')],
+ is_static=True)
+ return
+
def register_Ns3Tag_methods(root_module, cls):
## tag.h (module 'network'): ns3::Tag::Tag() [constructor]
cls.add_constructor([])
@@ -2967,12 +3116,12 @@
is_static=True)
return
-def register_Ns3SimpleRefCount__Ns3NdnContentObject_Ns3Header_Ns3DefaultDeleter__lt__ns3NdnContentObject__gt___methods(root_module, cls):
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::SimpleRefCount() [constructor]
+def register_Ns3SimpleRefCount__Ns3NdnContentObject_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnContentObject__gt___methods(root_module, cls):
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::SimpleRefCount() [constructor]
cls.add_constructor([])
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::SimpleRefCount(ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> > const & o) [copy constructor]
- cls.add_constructor([param('ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter< ns3::ndn::ContentObject > > const &', 'o')])
- ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::Header, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::Cleanup() [member function]
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::SimpleRefCount(ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> > const & o) [copy constructor]
+ cls.add_constructor([param('ns3::SimpleRefCount< ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter< ns3::ndn::ContentObject > > const &', 'o')])
+ ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::ndn::ContentObject, ns3::empty, ns3::DefaultDeleter<ns3::ndn::ContentObject> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
@@ -2991,12 +3140,12 @@
is_static=True)
return
-def register_Ns3SimpleRefCount__Ns3NdnInterest_Ns3Header_Ns3DefaultDeleter__lt__ns3NdnInterest__gt___methods(root_module, cls):
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >::SimpleRefCount() [constructor]
+def register_Ns3SimpleRefCount__Ns3NdnInterest_Ns3Empty_Ns3DefaultDeleter__lt__ns3NdnInterest__gt___methods(root_module, cls):
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >::SimpleRefCount() [constructor]
cls.add_constructor([])
- ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >::SimpleRefCount(ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> > const & o) [copy constructor]
- cls.add_constructor([param('ns3::SimpleRefCount< ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter< ns3::ndn::Interest > > const &', 'o')])
- ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::ndn::Interest, ns3::Header, ns3::DefaultDeleter<ns3::ndn::Interest> >::Cleanup() [member function]
+ ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >::SimpleRefCount(ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> > const & o) [copy constructor]
+ cls.add_constructor([param('ns3::SimpleRefCount< ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter< ns3::ndn::Interest > > const &', 'o')])
+ ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::ndn::Interest, ns3::empty, ns3::DefaultDeleter<ns3::ndn::Interest> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
@@ -3375,33 +3524,42 @@
cls.add_method('GetNodes',
'ns3::NodeContainer',
[],
- is_const=True)
+ is_const=True, is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): std::list<ns3::TopologyReader::Link, std::allocator<ns3::TopologyReader::Link> > const & ns3::AnnotatedTopologyReader::GetLinks() const [member function]
cls.add_method('GetLinks',
'std::list< ns3::TopologyReader::Link > const &',
[],
- is_const=True)
+ is_const=True, is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::AssignIpv4Addresses(ns3::Ipv4Address base) [member function]
cls.add_method('AssignIpv4Addresses',
'void',
- [param('ns3::Ipv4Address', 'base')])
+ [param('ns3::Ipv4Address', 'base')],
+ is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SetBoundingBox(double ulx, double uly, double lrx, double lry) [member function]
cls.add_method('SetBoundingBox',
'void',
- [param('double', 'ulx'), param('double', 'uly'), param('double', 'lrx'), param('double', 'lry')])
+ [param('double', 'ulx'), param('double', 'uly'), param('double', 'lrx'), param('double', 'lry')],
+ is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SetMobilityModel(std::string const & model) [member function]
cls.add_method('SetMobilityModel',
'void',
- [param('std::string const &', 'model')])
+ [param('std::string const &', 'model')],
+ is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::ApplyOspfMetric() [member function]
cls.add_method('ApplyOspfMetric',
'void',
- [])
- ## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SaveTopology(std::string const & file) const [member function]
+ [],
+ is_virtual=True)
+ ## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SaveTopology(std::string const & file) [member function]
cls.add_method('SaveTopology',
'void',
[param('std::string const &', 'file')],
- is_const=True)
+ is_virtual=True)
+ ## annotated-topology-reader.h (module 'ndnSIM'): void ns3::AnnotatedTopologyReader::SaveGraphviz(std::string const & file) [member function]
+ cls.add_method('SaveGraphviz',
+ 'void',
+ [param('std::string const &', 'file')],
+ is_virtual=True)
## annotated-topology-reader.h (module 'ndnSIM'): ns3::Ptr<ns3::Node> ns3::AnnotatedTopologyReader::CreateNode(std::string const name, uint32_t systemId) [member function]
cls.add_method('CreateNode',
'ns3::Ptr< ns3::Node >',
@@ -3600,6 +3758,36 @@
[param('bool', 'value')])
return
+def register_Ns3CallbackBasedApp_methods(root_module, cls):
+ ## callback-based-app.h (module 'ndnSIM'): ns3::CallbackBasedApp::CallbackBasedApp(ns3::CallbackBasedApp const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::CallbackBasedApp const &', 'arg0')])
+ ## callback-based-app.h (module 'ndnSIM'): ns3::CallbackBasedApp::CallbackBasedApp() [constructor]
+ cls.add_constructor([])
+ ## callback-based-app.h (module 'ndnSIM'): static ns3::TypeId ns3::CallbackBasedApp::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## callback-based-app.h (module 'ndnSIM'): void ns3::CallbackBasedApp::SetOnStartCallback(ns3::Callback<void, ns3::Ptr<ns3::Application>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onStart) [member function]
+ cls.add_method('SetOnStartCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::Ptr< ns3::Application >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onStart')])
+ ## callback-based-app.h (module 'ndnSIM'): void ns3::CallbackBasedApp::SetOnStopCallback(ns3::Callback<void, ns3::Ptr<ns3::Application>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onStart) [member function]
+ cls.add_method('SetOnStopCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::Ptr< ns3::Application >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onStart')])
+ ## callback-based-app.h (module 'ndnSIM'): void ns3::CallbackBasedApp::StartApplication() [member function]
+ cls.add_method('StartApplication',
+ 'void',
+ [],
+ visibility='protected', is_virtual=True)
+ ## callback-based-app.h (module 'ndnSIM'): void ns3::CallbackBasedApp::StopApplication() [member function]
+ cls.add_method('StopApplication',
+ 'void',
+ [],
+ visibility='protected', is_virtual=True)
+ return
+
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
@@ -4308,7 +4496,7 @@
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
- ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function]
+ ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
@@ -4533,6 +4721,24 @@
cls.add_method('Commit',
'void',
[])
+ ## rocketfuel-weights-reader.h (module 'ndnSIM'): void ns3::RocketfuelWeightsReader::SetDefaultBandwidth(std::string const & bw) [member function]
+ cls.add_method('SetDefaultBandwidth',
+ 'void',
+ [param('std::string const &', 'bw')])
+ ## rocketfuel-weights-reader.h (module 'ndnSIM'): std::string ns3::RocketfuelWeightsReader::GetDefaultBandwidth() const [member function]
+ cls.add_method('GetDefaultBandwidth',
+ 'std::string',
+ [],
+ is_const=True)
+ ## rocketfuel-weights-reader.h (module 'ndnSIM'): void ns3::RocketfuelWeightsReader::SetDefaultQueue(std::string const & queue) [member function]
+ cls.add_method('SetDefaultQueue',
+ 'void',
+ [param('std::string const &', 'queue')])
+ ## rocketfuel-weights-reader.h (module 'ndnSIM'): std::string ns3::RocketfuelWeightsReader::GetDefaultQueue() const [member function]
+ cls.add_method('GetDefaultQueue',
+ 'std::string',
+ [],
+ is_const=True)
return
def register_Ns3TimeChecker_methods(root_module, cls):
@@ -4703,25 +4909,21 @@
'ns3::TypeId',
[],
is_static=True)
- ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnContentObject(ns3::Ptr<ns3::ndn::ContentObject const> const & contentObject, ns3::Ptr<ns3::Packet> payload) [member function]
+ ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnContentObject(ns3::Ptr<ns3::ndn::ContentObject const> contentObject) [member function]
cls.add_method('OnContentObject',
'void',
- [param('ns3::Ptr< ns3::ndn::ContentObject const > const &', 'contentObject'), param('ns3::Ptr< ns3::Packet >', 'payload')],
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'contentObject')],
is_virtual=True)
- ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnInterest(ns3::Ptr<ns3::ndn::Interest const> const & interest, ns3::Ptr<ns3::Packet> packet) [member function]
+ ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnInterest(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
cls.add_method('OnInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Interest const > const &', 'interest'), param('ns3::Ptr< ns3::Packet >', 'packet')],
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
is_virtual=True)
- ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnNack(ns3::Ptr<ns3::ndn::Interest const> const & interest, ns3::Ptr<ns3::Packet> packet) [member function]
+ ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::OnNack(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
cls.add_method('OnNack',
'void',
- [param('ns3::Ptr< ns3::ndn::Interest const > const &', 'interest'), param('ns3::Ptr< ns3::Packet >', 'packet')],
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
is_virtual=True)
- ## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::RegisterProtocolHandler(ns3::Callback<bool, ns3::Ptr<ns3::Packet const> const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
- cls.add_method('RegisterProtocolHandler',
- 'void',
- [param('ns3::Callback< bool, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'handler')])
## ndn-app.h (module 'ndnSIM'): void ns3::ndn::App::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
@@ -4766,26 +4968,90 @@
[param('std::string const &', 'prefix')])
return
-def register_Ns3NdnContentObject_methods(root_module, cls):
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::ndn::ContentObject const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::ndn::ContentObject const &', 'arg0')])
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject() [constructor]
+def register_Ns3NdnBlob_methods(root_module, cls):
+ cls.add_binary_comparison_operator('<=')
+ cls.add_binary_comparison_operator('==')
+ cls.add_binary_comparison_operator('>=')
+ cls.add_binary_comparison_operator('<')
+ cls.add_binary_comparison_operator('>')
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob::Blob(ns3::ndn::Blob const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::Blob const &', 'arg0')])
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob::Blob() [constructor]
cls.add_constructor([])
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObject::Deserialize(ns3::Buffer::Iterator start) [member function]
- cls.add_method('Deserialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')],
- is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): ns3::Time ns3::ndn::ContentObject::GetFreshness() const [member function]
- cls.add_method('GetFreshness',
- 'ns3::Time',
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob::Blob(std::string const & data) [constructor]
+ cls.add_constructor([param('std::string const &', 'data')])
+ ## blob.h (module 'ndnSIM'): ns3::ndn::Blob::Blob(void const * buf, size_t length) [constructor]
+ cls.add_constructor([param('void const *', 'buf'), param('size_t', 'length')])
+ ## blob.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > > ns3::ndn::Blob::begin() [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< char *, std::vector< char > >',
+ [])
+ ## blob.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator<char> > > ns3::ndn::Blob::begin() const [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< char const *, std::vector< char > >',
[],
is_const=True)
- ## ndn-content-object.h (module 'ndnSIM'): ns3::TypeId ns3::ndn::ContentObject::GetInstanceTypeId() const [member function]
- cls.add_method('GetInstanceTypeId',
- 'ns3::TypeId',
+ ## blob.h (module 'ndnSIM'): char * ns3::ndn::Blob::buf() [member function]
+ cls.add_method('buf',
+ 'char *',
+ [])
+ ## blob.h (module 'ndnSIM'): char const * ns3::ndn::Blob::buf() const [member function]
+ cls.add_method('buf',
+ 'char const *',
[],
- is_const=True, is_virtual=True)
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): void ns3::ndn::Blob::clear() [member function]
+ cls.add_method('clear',
+ 'void',
+ [])
+ ## blob.h (module 'ndnSIM'): bool ns3::ndn::Blob::empty() const [member function]
+ cls.add_method('empty',
+ 'bool',
+ [],
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > > ns3::ndn::Blob::end() [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< char *, std::vector< char > >',
+ [])
+ ## blob.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator<char> > > ns3::ndn::Blob::end() const [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< char const *, std::vector< char > >',
+ [],
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): char ns3::ndn::Blob::getItem(size_t pos) const [member function]
+ cls.add_method('getItem',
+ 'char',
+ [param('size_t', 'pos')],
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): void ns3::ndn::Blob::push_back(char val) [member function]
+ cls.add_method('push_back',
+ 'void',
+ [param('char', 'val')])
+ ## blob.h (module 'ndnSIM'): size_t ns3::ndn::Blob::size() const [member function]
+ cls.add_method('size',
+ 'size_t',
+ [],
+ is_const=True)
+ ## blob.h (module 'ndnSIM'): void ns3::ndn::Blob::swap(ns3::ndn::Blob & x) [member function]
+ cls.add_method('swap',
+ 'void',
+ [param('ns3::ndn::Blob &', 'x')])
+ return
+
+def register_Ns3NdnContentObject_methods(root_module, cls):
+ cls.add_output_stream_operator()
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::Ptr<ns3::Packet> payload=ns3::Create( )) [constructor]
+ cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'payload', default_value='ns3::Create( )')])
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::ndn::ContentObject const & other) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::ContentObject const &', 'other')])
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetName(ns3::Ptr<ns3::ndn::Name> name) [member function]
+ cls.add_method('SetName',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::Name >', 'name')])
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetName(ns3::ndn::Name const & name) [member function]
+ cls.add_method('SetName',
+ 'void',
+ [param('ns3::ndn::Name const &', 'name')])
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::Name const & ns3::ndn::ContentObject::GetName() const [member function]
cls.add_method('GetName',
'ns3::ndn::Name const &',
@@ -4796,56 +5062,66 @@
'ns3::Ptr< ns3::ndn::Name const >',
[],
is_const=True)
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObject::GetSerializedSize() const [member function]
- cls.add_method('GetSerializedSize',
- 'uint32_t',
- [],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObject::GetSignature() const [member function]
- cls.add_method('GetSignature',
- 'uint32_t',
- [],
- is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetTimestamp(ns3::Time const & timestamp) [member function]
+ cls.add_method('SetTimestamp',
+ 'void',
+ [param('ns3::Time const &', 'timestamp')])
## ndn-content-object.h (module 'ndnSIM'): ns3::Time ns3::ndn::ContentObject::GetTimestamp() const [member function]
cls.add_method('GetTimestamp',
'ns3::Time',
[],
is_const=True)
- ## ndn-content-object.h (module 'ndnSIM'): static ns3::TypeId ns3::ndn::ContentObject::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::Print(std::ostream & os) const [member function]
- cls.add_method('Print',
- 'void',
- [param('std::ostream &', 'os')],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::Serialize(ns3::Buffer::Iterator start) const [member function]
- cls.add_method('Serialize',
- 'void',
- [param('ns3::Buffer::Iterator', 'start')],
- is_const=True, is_virtual=True)
## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetFreshness(ns3::Time const & freshness) [member function]
cls.add_method('SetFreshness',
'void',
[param('ns3::Time const &', 'freshness')])
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetName(ns3::Ptr<ns3::ndn::Name> name) [member function]
- cls.add_method('SetName',
- 'void',
- [param('ns3::Ptr< ns3::ndn::Name >', 'name')])
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetName(ns3::ndn::Name const & name) [member function]
- cls.add_method('SetName',
- 'void',
- [param('ns3::ndn::Name const &', 'name')])
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::Time ns3::ndn::ContentObject::GetFreshness() const [member function]
+ cls.add_method('GetFreshness',
+ 'ns3::Time',
+ [],
+ is_const=True)
## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetSignature(uint32_t signature) [member function]
cls.add_method('SetSignature',
'void',
[param('uint32_t', 'signature')])
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetTimestamp(ns3::Time const & timestamp) [member function]
- cls.add_method('SetTimestamp',
+ ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObject::GetSignature() const [member function]
+ cls.add_method('GetSignature',
+ 'uint32_t',
+ [],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetKeyLocator(ns3::Ptr<ns3::ndn::Name> keyLocator) [member function]
+ cls.add_method('SetKeyLocator',
'void',
- [param('ns3::Time const &', 'timestamp')])
+ [param('ns3::Ptr< ns3::ndn::Name >', 'keyLocator')])
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::Name const> ns3::ndn::ContentObject::GetKeyLocator() const [member function]
+ cls.add_method('GetKeyLocator',
+ 'ns3::Ptr< ns3::ndn::Name const >',
+ [],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetPayload(ns3::Ptr<ns3::Packet> payload) [member function]
+ cls.add_method('SetPayload',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'payload')])
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet const> ns3::ndn::ContentObject::GetPayload() const [member function]
+ cls.add_method('GetPayload',
+ 'ns3::Ptr< ns3::Packet const >',
+ [],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet const> ns3::ndn::ContentObject::GetWire() const [member function]
+ cls.add_method('GetWire',
+ 'ns3::Ptr< ns3::Packet const >',
+ [],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::SetWire(ns3::Ptr<ns3::Packet const> packet) const [member function]
+ cls.add_method('SetWire',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet')],
+ is_const=True)
+ ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObject::Print(std::ostream & os) const [member function]
+ cls.add_method('Print',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True)
return
def register_Ns3NdnContentObjectException_methods(root_module, cls):
@@ -4855,53 +5131,16 @@
cls.add_constructor([param('ns3::ndn::ContentObjectException const &', 'arg0')])
return
-def register_Ns3NdnContentObjectTail_methods(root_module, cls):
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObjectTail::ContentObjectTail(ns3::ndn::ContentObjectTail const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::ndn::ContentObjectTail const &', 'arg0')])
- ## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObjectTail::ContentObjectTail() [constructor]
- cls.add_constructor([])
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObjectTail::Deserialize(ns3::Buffer::Iterator start) [member function]
- cls.add_method('Deserialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')],
- is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): ns3::TypeId ns3::ndn::ContentObjectTail::GetInstanceTypeId() const [member function]
- cls.add_method('GetInstanceTypeId',
- 'ns3::TypeId',
- [],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): uint32_t ns3::ndn::ContentObjectTail::GetSerializedSize() const [member function]
- cls.add_method('GetSerializedSize',
- 'uint32_t',
- [],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): static ns3::TypeId ns3::ndn::ContentObjectTail::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObjectTail::Print(std::ostream & os) const [member function]
- cls.add_method('Print',
- 'void',
- [param('std::ostream &', 'os')],
- is_const=True, is_virtual=True)
- ## ndn-content-object.h (module 'ndnSIM'): void ns3::ndn::ContentObjectTail::Serialize(ns3::Buffer::Iterator start) const [member function]
- cls.add_method('Serialize',
- 'void',
- [param('ns3::Buffer::Iterator', 'start')],
- is_const=True, is_virtual=True)
- return
-
def register_Ns3NdnContentStore_methods(root_module, cls):
cls.add_output_stream_operator()
## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::ContentStore::ContentStore() [constructor]
cls.add_constructor([])
## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::ContentStore::ContentStore(ns3::ndn::ContentStore const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::ContentStore const &', 'arg0')])
- ## ndn-content-store.h (module 'ndnSIM'): bool ns3::ndn::ContentStore::Add(ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> packet) [member function]
+ ## ndn-content-store.h (module 'ndnSIM'): bool ns3::ndn::ContentStore::Add(ns3::Ptr<ns3::ndn::ContentObject const> data) [member function]
cls.add_method('Add',
'bool',
- [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'packet')],
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')],
is_pure_virtual=True, is_virtual=True)
## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::cs::Entry> ns3::ndn::ContentStore::Begin() [member function]
cls.add_method('Begin',
@@ -4928,9 +5167,9 @@
'ns3::TypeId',
[],
is_static=True)
- ## ndn-content-store.h (module 'ndnSIM'): boost::tuples::tuple<ns3::Ptr<ns3::Packet>,ns3::Ptr<const ns3::ndn::ContentObject>,ns3::Ptr<const ns3::Packet>,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type> ns3::ndn::ContentStore::Lookup(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
+ ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::ContentObject> ns3::ndn::ContentStore::Lookup(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
cls.add_method('Lookup',
- 'boost::tuples::tuple< ns3::Ptr< ns3::Packet >, ns3::Ptr< ns3::ndn::ContentObject const >, ns3::Ptr< ns3::Packet const >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type >',
+ 'ns3::Ptr< ns3::ndn::ContentObject >',
[param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
is_pure_virtual=True, is_virtual=True)
## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::cs::Entry> ns3::ndn::ContentStore::Next(ns3::Ptr<ns3::ndn::cs::Entry> arg0) [member function]
@@ -4945,6 +5184,64 @@
is_pure_virtual=True, is_const=True, is_virtual=True)
return
+def register_Ns3NdnExclude_methods(root_module, cls):
+ cls.add_output_stream_operator()
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude::Exclude(ns3::ndn::Exclude const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::Exclude const &', 'arg0')])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude::Exclude() [constructor]
+ cls.add_constructor([])
+ ## exclude.h (module 'ndnSIM'): void ns3::ndn::Exclude::appendExclude(ns3::ndn::name::Component const & name, bool any) [member function]
+ cls.add_method('appendExclude',
+ 'void',
+ [param('ns3::ndn::name::Component const &', 'name'), param('bool', 'any')])
+ ## exclude.h (module 'ndnSIM'): std::_Rb_tree_const_iterator<std::pair<ns3::ndn::name::Component const, bool> > ns3::ndn::Exclude::begin() const [member function]
+ cls.add_method('begin',
+ 'std::_Rb_tree_const_iterator< std::pair< ns3::ndn::name::Component const, bool > >',
+ [],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): std::_Rb_tree_const_iterator<std::pair<ns3::ndn::name::Component const, bool> > ns3::ndn::Exclude::end() const [member function]
+ cls.add_method('end',
+ 'std::_Rb_tree_const_iterator< std::pair< ns3::ndn::name::Component const, bool > >',
+ [],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude & ns3::ndn::Exclude::excludeAfter(ns3::ndn::name::Component const & from) [member function]
+ cls.add_method('excludeAfter',
+ 'ns3::ndn::Exclude &',
+ [param('ns3::ndn::name::Component const &', 'from')])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude & ns3::ndn::Exclude::excludeBefore(ns3::ndn::name::Component const & to) [member function]
+ cls.add_method('excludeBefore',
+ 'ns3::ndn::Exclude &',
+ [param('ns3::ndn::name::Component const &', 'to')])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude & ns3::ndn::Exclude::excludeOne(ns3::ndn::name::Component const & comp) [member function]
+ cls.add_method('excludeOne',
+ 'ns3::ndn::Exclude &',
+ [param('ns3::ndn::name::Component const &', 'comp')])
+ ## exclude.h (module 'ndnSIM'): ns3::ndn::Exclude & ns3::ndn::Exclude::excludeRange(ns3::ndn::name::Component const & from, ns3::ndn::name::Component const & to) [member function]
+ cls.add_method('excludeRange',
+ 'ns3::ndn::Exclude &',
+ [param('ns3::ndn::name::Component const &', 'from'), param('ns3::ndn::name::Component const &', 'to')])
+ ## exclude.h (module 'ndnSIM'): bool ns3::ndn::Exclude::isExcluded(ns3::ndn::name::Component const & comp) const [member function]
+ cls.add_method('isExcluded',
+ 'bool',
+ [param('ns3::ndn::name::Component const &', 'comp')],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): std::reverse_iterator<std::_Rb_tree_const_iterator<std::pair<ns3::ndn::name::Component const, bool> > > ns3::ndn::Exclude::rbegin() const [member function]
+ cls.add_method('rbegin',
+ 'std::reverse_iterator< std::_Rb_tree_const_iterator< std::pair< ns3::ndn::name::Component const, bool > > >',
+ [],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): std::reverse_iterator<std::_Rb_tree_const_iterator<std::pair<ns3::ndn::name::Component const, bool> > > ns3::ndn::Exclude::rend() const [member function]
+ cls.add_method('rend',
+ 'std::reverse_iterator< std::_Rb_tree_const_iterator< std::pair< ns3::ndn::name::Component const, bool > > >',
+ [],
+ is_const=True)
+ ## exclude.h (module 'ndnSIM'): size_t ns3::ndn::Exclude::size() const [member function]
+ cls.add_method('size',
+ 'size_t',
+ [],
+ is_const=True)
+ return
+
def register_Ns3NdnFace_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('!=')
@@ -4952,6 +5249,11 @@
cls.add_binary_comparison_operator('==')
## ndn-face.h (module 'ndnSIM'): ns3::ndn::Face::Face(ns3::Ptr<ns3::Node> node) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')])
+ ## ndn-face.h (module 'ndnSIM'): uint32_t ns3::ndn::Face::GetFlags() const [member function]
+ cls.add_method('GetFlags',
+ 'uint32_t',
+ [],
+ is_const=True)
## ndn-face.h (module 'ndnSIM'): uint32_t ns3::ndn::Face::GetId() const [member function]
cls.add_method('GetId',
'uint32_t',
@@ -4976,25 +5278,37 @@
cls.add_method('IsUp',
'bool',
[],
- is_const=True, is_virtual=True)
+ is_const=True)
## ndn-face.h (module 'ndnSIM'): std::ostream & ns3::ndn::Face::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'std::ostream &',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
- ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::Receive(ns3::Ptr<const ns3::Packet> const & p) [member function]
- cls.add_method('Receive',
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::ReceiveData(ns3::Ptr<ns3::ndn::ContentObject> data) [member function]
+ cls.add_method('ReceiveData',
'bool',
- [param('ns3::Ptr< ns3::Packet const > const &', 'p')])
- ## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face> const&, ns3::Ptr<ns3::Packet const> const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
- cls.add_method('RegisterProtocolHandler',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'handler')],
+ [param('ns3::Ptr< ns3::ndn::ContentObject >', 'data')],
is_virtual=True)
- ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::Send(ns3::Ptr<ns3::Packet> p) [member function]
- cls.add_method('Send',
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::ReceiveInterest(ns3::Ptr<ns3::ndn::Interest> interest) [member function]
+ cls.add_method('ReceiveInterest',
'bool',
- [param('ns3::Ptr< ns3::Packet >', 'p')])
+ [param('ns3::Ptr< ns3::ndn::Interest >', 'interest')],
+ is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::RegisterProtocolHandlers(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face>, ns3::Ptr<ns3::ndn::Interest>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & interestHandler, ns3::Callback<void, ns3::Ptr<ns3::ndn::Face>, ns3::Ptr<ns3::ndn::ContentObject>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & dataHandler) [member function]
+ cls.add_method('RegisterProtocolHandlers',
+ 'void',
+ [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::ndn::Interest >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'interestHandler'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::ndn::ContentObject >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'dataHandler')],
+ is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::SendData(ns3::Ptr<ns3::ndn::ContentObject const> data) [member function]
+ cls.add_method('SendData',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')],
+ is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::SendInterest(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
+ cls.add_method('SendInterest',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
+ is_virtual=True)
## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::SetId(uint32_t id) [member function]
cls.add_method('SetId',
'void',
@@ -5007,13 +5321,27 @@
## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::SetUp(bool up=true) [member function]
cls.add_method('SetUp',
'void',
- [param('bool', 'up', default_value='true')],
+ [param('bool', 'up', default_value='true')])
+ ## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::UnRegisterProtocolHandlers() [member function]
+ cls.add_method('UnRegisterProtocolHandlers',
+ 'void',
+ [],
is_virtual=True)
- ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::SendImpl(ns3::Ptr<ns3::Packet> p) [member function]
- cls.add_method('SendImpl',
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::Receive(ns3::Ptr<ns3::Packet const> p) [member function]
+ cls.add_method('Receive',
'bool',
- [param('ns3::Ptr< ns3::Packet >', 'p')],
- is_pure_virtual=True, visibility='protected', is_virtual=True)
+ [param('ns3::Ptr< ns3::Packet const >', 'p')],
+ visibility='protected', is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): bool ns3::ndn::Face::Send(ns3::Ptr<ns3::Packet> packet) [member function]
+ cls.add_method('Send',
+ 'bool',
+ [param('ns3::Ptr< ns3::Packet >', 'packet')],
+ visibility='protected', is_virtual=True)
+ ## ndn-face.h (module 'ndnSIM'): void ns3::ndn::Face::SetFlags(uint32_t flags) [member function]
+ cls.add_method('SetFlags',
+ 'void',
+ [param('uint32_t', 'flags')],
+ visibility='protected')
return
def register_Ns3NdnFaceContainer_methods(root_module, cls):
@@ -5171,15 +5499,15 @@
'ns3::TypeId',
[],
is_static=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::OnData(ns3::Ptr<ns3::ndn::Face> face, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::OnData(ns3::Ptr<ns3::ndn::Face> face, ns3::Ptr<ns3::ndn::ContentObject> data) [member function]
cls.add_method('OnData',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'face'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'face'), param('ns3::Ptr< ns3::ndn::ContentObject >', 'data')],
is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::OnInterest(ns3::Ptr<ns3::ndn::Face> face, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::OnInterest(ns3::Ptr<ns3::ndn::Face> face, ns3::Ptr<ns3::ndn::Interest> interest) [member function]
cls.add_method('OnInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'face'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'face'), param('ns3::Ptr< ns3::ndn::Interest >', 'interest')],
is_virtual=True)
## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::RemoveFace(ns3::Ptr<ns3::ndn::Face> face) [member function]
cls.add_method('RemoveFace',
@@ -5196,100 +5524,100 @@
'void',
[param('ns3::Ptr< ns3::ndn::fib::Entry >', 'fibEntry')],
is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::CanSendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::CanSendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('CanSendOutInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::DetectRetransmittedInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::DetectRetransmittedInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DetectRetransmittedInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidCreatePitEntry(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidCreatePitEntry(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidCreatePitEntry',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidExhaustForwardingOptions(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidExhaustForwardingOptions(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidExhaustForwardingOptions',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidForwardSimilarInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidForwardSimilarInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidForwardSimilarInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveDuplicateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveDuplicateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidReceiveDuplicateInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveSolicitedData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket, bool didCreateCacheEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveSolicitedData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> data, bool didCreateCacheEntry) [member function]
cls.add_method('DidReceiveSolicitedData',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('bool', 'didCreateCacheEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('bool', 'didCreateCacheEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveUnsolicitedData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket, bool didCreateCacheEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidReceiveUnsolicitedData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> data, bool didCreateCacheEntry) [member function]
cls.add_method('DidReceiveUnsolicitedData',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('bool', 'didCreateCacheEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('bool', 'didCreateCacheEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSendOutData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSendOutData(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::ContentObject const> data, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidSendOutData',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidSendOutInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSuppressSimilarInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DidSuppressSimilarInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DidSuppressSimilarInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::DoPropagateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::DoPropagateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('DoPropagateInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::FailedToCreatePitEntry(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::FailedToCreatePitEntry(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
cls.add_method('FailedToCreatePitEntry',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
visibility='protected', is_virtual=True)
## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::PropagateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::PropagateInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('PropagateInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::SatisfyPendingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> payload, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::SatisfyPendingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::ContentObject const> data, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('SatisfyPendingInterest',
'void',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'payload'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::ShouldSuppressIncomingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::ShouldSuppressIncomingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('ShouldSuppressIncomingInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
- ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::TrySendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> header, ns3::Ptr<const ns3::Packet> origPacket, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
+ ## ndn-forwarding-strategy.h (module 'ndnSIM'): bool ns3::ndn::ForwardingStrategy::TrySendOutInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::Face> outFace, ns3::Ptr<ns3::ndn::Interest const> interest, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('TrySendOutInterest',
'bool',
- [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'origPacket'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
+ [param('ns3::Ptr< ns3::ndn::Face >', 'inFace'), param('ns3::Ptr< ns3::ndn::Face >', 'outFace'), param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('ns3::Ptr< ns3::ndn::pit::Entry >', 'pitEntry')],
visibility='protected', is_virtual=True)
## ndn-forwarding-strategy.h (module 'ndnSIM'): void ns3::ndn::ForwardingStrategy::WillSatisfyPendingInterest(ns3::Ptr<ns3::ndn::Face> inFace, ns3::Ptr<ns3::ndn::pit::Entry> pitEntry) [member function]
cls.add_method('WillSatisfyPendingInterest',
@@ -5348,12 +5676,7 @@
cls.add_constructor([])
## ndn-header-helper.h (module 'ndnSIM'): ns3::ndn::HeaderHelper::HeaderHelper(ns3::ndn::HeaderHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::HeaderHelper const &', 'arg0')])
- ## ndn-header-helper.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Name const> ns3::ndn::HeaderHelper::GetName(ns3::Ptr<const ns3::Packet> packet) [member function]
- cls.add_method('GetName',
- 'ns3::Ptr< ns3::ndn::Name const >',
- [param('ns3::Ptr< ns3::Packet const >', 'packet')],
- is_static=True)
- ## ndn-header-helper.h (module 'ndnSIM'): static ns3::ndn::HeaderHelper::Type ns3::ndn::HeaderHelper::GetNdnHeaderType(ns3::Ptr<const ns3::Packet> packet) [member function]
+ ## ndn-header-helper.h (module 'ndnSIM'): static ns3::ndn::HeaderHelper::Type ns3::ndn::HeaderHelper::GetNdnHeaderType(ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('GetNdnHeaderType',
'ns3::ndn::HeaderHelper::Type',
[param('ns3::Ptr< ns3::Packet const >', 'packet')],
@@ -5361,25 +5684,11 @@
return
def register_Ns3NdnInterest_methods(root_module, cls):
- ## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest::Interest() [constructor]
- cls.add_constructor([])
+ cls.add_output_stream_operator()
+ ## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest::Interest(ns3::Ptr<ns3::Packet> payload=ns3::Create( )) [constructor]
+ cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'payload', default_value='ns3::Create( )')])
## ndn-interest.h (module 'ndnSIM'): ns3::ndn::Interest::Interest(ns3::ndn::Interest const & interest) [copy constructor]
cls.add_constructor([param('ns3::ndn::Interest const &', 'interest')])
- ## ndn-interest.h (module 'ndnSIM'): uint32_t ns3::ndn::Interest::Deserialize(ns3::Buffer::Iterator start) [member function]
- cls.add_method('Deserialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')],
- is_virtual=True)
- ## ndn-interest.h (module 'ndnSIM'): ns3::TypeId ns3::ndn::Interest::GetInstanceTypeId() const [member function]
- cls.add_method('GetInstanceTypeId',
- 'ns3::TypeId',
- [],
- is_const=True, is_virtual=True)
- ## ndn-interest.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Interest> ns3::ndn::Interest::GetInterest(ns3::Ptr<ns3::Packet> packet) [member function]
- cls.add_method('GetInterest',
- 'ns3::Ptr< ns3::ndn::Interest >',
- [param('ns3::Ptr< ns3::Packet >', 'packet')],
- is_static=True)
## ndn-interest.h (module 'ndnSIM'): ns3::Time ns3::ndn::Interest::GetInterestLifetime() const [member function]
cls.add_method('GetInterestLifetime',
'ns3::Time',
@@ -5405,31 +5714,26 @@
'uint32_t',
[],
is_const=True)
+ ## ndn-interest.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet const> ns3::ndn::Interest::GetPayload() const [member function]
+ cls.add_method('GetPayload',
+ 'ns3::Ptr< ns3::Packet const >',
+ [],
+ is_const=True)
## ndn-interest.h (module 'ndnSIM'): int8_t ns3::ndn::Interest::GetScope() const [member function]
cls.add_method('GetScope',
'int8_t',
[],
is_const=True)
- ## ndn-interest.h (module 'ndnSIM'): uint32_t ns3::ndn::Interest::GetSerializedSize() const [member function]
- cls.add_method('GetSerializedSize',
- 'uint32_t',
+ ## ndn-interest.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet const> ns3::ndn::Interest::GetWire() const [member function]
+ cls.add_method('GetWire',
+ 'ns3::Ptr< ns3::Packet const >',
[],
- is_const=True, is_virtual=True)
- ## ndn-interest.h (module 'ndnSIM'): static ns3::TypeId ns3::ndn::Interest::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
+ is_const=True)
## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
- is_const=True, is_virtual=True)
- ## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::Serialize(ns3::Buffer::Iterator start) const [member function]
- cls.add_method('Serialize',
- 'void',
- [param('ns3::Buffer::Iterator', 'start')],
- is_const=True, is_virtual=True)
+ is_const=True)
## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::SetInterestLifetime(ns3::Time time) [member function]
cls.add_method('SetInterestLifetime',
'void',
@@ -5450,10 +5754,19 @@
cls.add_method('SetNonce',
'void',
[param('uint32_t', 'nonce')])
+ ## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::SetPayload(ns3::Ptr<ns3::Packet> payload) [member function]
+ cls.add_method('SetPayload',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'payload')])
## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::SetScope(int8_t scope) [member function]
cls.add_method('SetScope',
'void',
[param('int8_t', 'scope')])
+ ## ndn-interest.h (module 'ndnSIM'): void ns3::ndn::Interest::SetWire(ns3::Ptr<ns3::Packet const> packet) const [member function]
+ cls.add_method('SetWire',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet')],
+ is_const=True)
return
def register_Ns3NdnInterestException_methods(root_module, cls):
@@ -5503,16 +5816,6 @@
'ns3::Ptr< ns3::ndn::Face >',
[param('ns3::Ptr< ns3::NetDevice >', 'netDevice')],
is_const=True, is_virtual=True)
- ## ndn-l3-protocol.h (module 'ndnSIM'): static uint64_t ns3::ndn::L3Protocol::GetInterestCounter() [member function]
- cls.add_method('GetInterestCounter',
- 'uint64_t',
- [],
- is_static=True)
- ## ndn-l3-protocol.h (module 'ndnSIM'): static uint64_t ns3::ndn::L3Protocol::GetDataCounter() [member function]
- cls.add_method('GetDataCounter',
- 'uint64_t',
- [],
- is_static=True)
## ndn-l3-protocol.h (module 'ndnSIM'): void ns3::ndn::L3Protocol::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
@@ -5613,119 +5916,191 @@
def register_Ns3NdnName_methods(root_module, cls):
cls.add_output_stream_operator()
+ cls.add_binary_comparison_operator('!=')
+ cls.add_binary_numeric_operator('+', root_module['ns3::ndn::Name'], root_module['ns3::ndn::Name'], param('ns3::ndn::Name const &', 'right'))
cls.add_binary_comparison_operator('<')
+ cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(ns3::ndn::Name const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::ndn::Name const &', 'arg0')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name() [constructor]
+ cls.add_binary_comparison_operator('>')
+ cls.add_binary_comparison_operator('>=')
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::Name() [constructor]
cls.add_constructor([])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(std::list<boost::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,std::allocator<boost::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const & components) [constructor]
- cls.add_constructor([param('std::list< boost::reference_wrapper< std::string const > > const &', 'components')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(std::list<std::string, std::allocator<std::string> > const & components) [constructor]
- cls.add_constructor([param('std::list< std::string > const &', 'components')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(std::string const & prefix) [constructor]
- cls.add_constructor([param('std::string const &', 'prefix')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name::Name(char const * prefix) [constructor]
- cls.add_constructor([param('char const *', 'prefix')])
- ## ndn-name.h (module 'ndnSIM'): uint32_t ns3::ndn::Name::Deserialize(ns3::Buffer::Iterator start) [member function]
- cls.add_method('Deserialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')])
- ## ndn-name.h (module 'ndnSIM'): std::list<std::string, std::allocator<std::string> > const & ns3::ndn::Name::GetComponents() const [member function]
- cls.add_method('GetComponents',
- 'std::list< std::string > const &',
- [],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::string ns3::ndn::Name::GetLastComponent() const [member function]
- cls.add_method('GetLastComponent',
- 'std::string',
- [],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): size_t ns3::ndn::Name::GetSerializedSize() const [member function]
- cls.add_method('GetSerializedSize',
- 'size_t',
- [],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::list<boost::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,std::allocator<boost::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > ns3::ndn::Name::GetSubComponents(size_t num) const [member function]
- cls.add_method('GetSubComponents',
- 'std::list< boost::reference_wrapper< std::string const > >',
- [param('size_t', 'num')],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): void ns3::ndn::Name::Print(std::ostream & os) const [member function]
- cls.add_method('Print',
- 'void',
- [param('std::ostream &', 'os')],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): uint32_t ns3::ndn::Name::Serialize(ns3::Buffer::Iterator start) const [member function]
- cls.add_method('Serialize',
- 'uint32_t',
- [param('ns3::Buffer::Iterator', 'start')],
- is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::_List_iterator<std::string> ns3::ndn::Name::begin() [member function]
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::Name(ns3::ndn::Name const & other) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::Name const &', 'other')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::Name(std::string const & url) [constructor]
+ cls.add_constructor([param('std::string const &', 'url')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::Name(__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > begin, __gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > end) [constructor]
+ cls.add_constructor([param('__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >', 'begin'), param('__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >', 'end')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(ns3::ndn::name::Component const & comp) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('ns3::ndn::name::Component const &', 'comp')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > begin, __gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > end) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >', 'begin'), param('__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >', 'end')],
+ template_parameters=['__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > >'])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(ns3::ndn::Name const & comp) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('ns3::ndn::Name const &', 'comp')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(std::string const & compStr) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('std::string const &', 'compStr')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::append(void const * buf, size_t size) [member function]
+ cls.add_method('append',
+ 'ns3::ndn::Name &',
+ [param('void const *', 'buf'), param('size_t', 'size')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendBlkId(uint64_t blkid) [member function]
+ cls.add_method('appendBlkId',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'blkid')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendBySwap(ns3::ndn::name::Component & comp) [member function]
+ cls.add_method('appendBySwap',
+ 'ns3::ndn::Name &',
+ [param('ns3::ndn::name::Component &', 'comp')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendControlNum(uint64_t control) [member function]
+ cls.add_method('appendControlNum',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'control')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendNumber(uint64_t number) [member function]
+ cls.add_method('appendNumber',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'number')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendNumberWithMarker(uint64_t number, unsigned char marker) [member function]
+ cls.add_method('appendNumberWithMarker',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'number'), param('unsigned char', 'marker')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendSeqNum(uint64_t seqno) [member function]
+ cls.add_method('appendSeqNum',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'seqno')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name & ns3::ndn::Name::appendVersion(uint64_t version=ns3::ndn::Name::nversion) [member function]
+ cls.add_method('appendVersion',
+ 'ns3::ndn::Name &',
+ [param('uint64_t', 'version', default_value='ns3::ndn::Name::nversion')])
+ ## name.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > ns3::ndn::Name::begin() const [member function]
cls.add_method('begin',
- 'std::_List_iterator< std::string >',
+ '__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >',
+ [],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<ns3::ndn::name::Component*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > ns3::ndn::Name::begin() [member function]
+ cls.add_method('begin',
+ '__gnu_cxx::__normal_iterator< ns3::ndn::name::Component *, std::vector< ns3::ndn::name::Component > >',
[])
- ## ndn-name.h (module 'ndnSIM'): std::_List_const_iterator<std::string> ns3::ndn::Name::begin() const [member function]
- cls.add_method('begin',
- 'std::_List_const_iterator< std::string >',
+ ## name.h (module 'ndnSIM'): int ns3::ndn::Name::compare(ns3::ndn::Name const & name) const [member function]
+ cls.add_method('compare',
+ 'int',
+ [param('ns3::ndn::Name const &', 'name')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > ns3::ndn::Name::end() const [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > >',
[],
is_const=True)
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::Name::cut(size_t minusComponents) const [member function]
- cls.add_method('cut',
+ ## name.h (module 'ndnSIM'): __gnu_cxx::__normal_iterator<ns3::ndn::name::Component*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > ns3::ndn::Name::end() [member function]
+ cls.add_method('end',
+ '__gnu_cxx::__normal_iterator< ns3::ndn::name::Component *, std::vector< ns3::ndn::name::Component > >',
+ [])
+ ## name.h (module 'ndnSIM'): ns3::ndn::name::Component const & ns3::ndn::Name::get(int index) const [member function]
+ cls.add_method('get',
+ 'ns3::ndn::name::Component const &',
+ [param('int', 'index')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::Name::get(int index) [member function]
+ cls.add_method('get',
+ 'ns3::ndn::name::Component &',
+ [param('int', 'index')])
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::Name::getPostfix(size_t len, size_t skip=0) const [member function]
+ cls.add_method('getPostfix',
'ns3::ndn::Name',
- [param('size_t', 'minusComponents')],
+ [param('size_t', 'len'), param('size_t', 'skip', default_value='0')],
is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::_List_iterator<std::string> ns3::ndn::Name::end() [member function]
- cls.add_method('end',
- 'std::_List_iterator< std::string >',
- [])
- ## ndn-name.h (module 'ndnSIM'): std::_List_const_iterator<std::string> ns3::ndn::Name::end() const [member function]
- cls.add_method('end',
- 'std::_List_const_iterator< std::string >',
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::Name::getPrefix(size_t len, size_t skip=0) const [member function]
+ cls.add_method('getPrefix',
+ 'ns3::ndn::Name',
+ [param('size_t', 'len'), param('size_t', 'skip', default_value='0')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::Name::getSubName(size_t pos=0, size_t len=ns3::ndn::Name::npos) const [member function]
+ cls.add_method('getSubName',
+ 'ns3::ndn::Name',
+ [param('size_t', 'pos', default_value='0'), param('size_t', 'len', default_value='ns3::ndn::Name::npos')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): std::reverse_iterator<__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > > ns3::ndn::Name::rbegin() const [member function]
+ cls.add_method('rbegin',
+ 'std::reverse_iterator< __gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > > >',
[],
is_const=True)
- ## ndn-name.h (module 'ndnSIM'): size_t ns3::ndn::Name::size() const [member function]
+ ## name.h (module 'ndnSIM'): std::reverse_iterator<__gnu_cxx::__normal_iterator<ns3::ndn::name::Component*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > > ns3::ndn::Name::rbegin() [member function]
+ cls.add_method('rbegin',
+ 'std::reverse_iterator< __gnu_cxx::__normal_iterator< ns3::ndn::name::Component *, std::vector< ns3::ndn::name::Component > > >',
+ [])
+ ## name.h (module 'ndnSIM'): std::reverse_iterator<__gnu_cxx::__normal_iterator<ns3::ndn::name::Component const*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > > ns3::ndn::Name::rend() const [member function]
+ cls.add_method('rend',
+ 'std::reverse_iterator< __gnu_cxx::__normal_iterator< ns3::ndn::name::Component const *, std::vector< ns3::ndn::name::Component > > >',
+ [],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): std::reverse_iterator<__gnu_cxx::__normal_iterator<ns3::ndn::name::Component*, std::vector<ns3::ndn::name::Component, std::allocator<ns3::ndn::name::Component> > > > ns3::ndn::Name::rend() [member function]
+ cls.add_method('rend',
+ 'std::reverse_iterator< __gnu_cxx::__normal_iterator< ns3::ndn::name::Component *, std::vector< ns3::ndn::name::Component > > >',
+ [])
+ ## name.h (module 'ndnSIM'): size_t ns3::ndn::Name::size() const [member function]
cls.add_method('size',
'size_t',
[],
is_const=True)
+ ## name.h (module 'ndnSIM'): std::string ns3::ndn::Name::toUri() const [member function]
+ cls.add_method('toUri',
+ 'std::string',
+ [],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): void ns3::ndn::Name::toUri(std::ostream & os) const [member function]
+ cls.add_method('toUri',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True)
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::npos [variable]
+ cls.add_static_attribute('npos', 'size_t const', is_const=True)
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name::nversion [variable]
+ cls.add_static_attribute('nversion', 'uint64_t const', is_const=True)
return
def register_Ns3NdnNameChecker_methods(root_module, cls):
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameChecker::NameChecker() [constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameChecker::NameChecker() [constructor]
cls.add_constructor([])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameChecker::NameChecker(ns3::ndn::NameChecker const & arg0) [copy constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameChecker::NameChecker(ns3::ndn::NameChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::NameChecker const &', 'arg0')])
return
def register_Ns3NdnNameValue_methods(root_module, cls):
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue() [constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue() [constructor]
cls.add_constructor([])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue(ns3::ndn::NameValue const & arg0) [copy constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue(ns3::ndn::NameValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::NameValue const &', 'arg0')])
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue(ns3::ndn::Name const & value) [constructor]
+ ## name.h (module 'ndnSIM'): ns3::ndn::NameValue::NameValue(ns3::ndn::Name const & value) [constructor]
cls.add_constructor([param('ns3::ndn::Name const &', 'value')])
- ## ndn-name.h (module 'ndnSIM'): ns3::Ptr<ns3::AttributeValue> ns3::ndn::NameValue::Copy() const [member function]
+ ## name.h (module 'ndnSIM'): ns3::Ptr<ns3::AttributeValue> ns3::ndn::NameValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
- ## ndn-name.h (module 'ndnSIM'): bool ns3::ndn::NameValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
+ ## name.h (module 'ndnSIM'): bool ns3::ndn::NameValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
- ## ndn-name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::NameValue::Get() const [member function]
+ ## name.h (module 'ndnSIM'): ns3::ndn::Name ns3::ndn::NameValue::Get() const [member function]
cls.add_method('Get',
'ns3::ndn::Name',
[],
is_const=True)
- ## ndn-name.h (module 'ndnSIM'): std::string ns3::ndn::NameValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
+ ## name.h (module 'ndnSIM'): std::string ns3::ndn::NameValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
- ## ndn-name.h (module 'ndnSIM'): void ns3::ndn::NameValue::Set(ns3::ndn::Name const & value) [member function]
+ ## name.h (module 'ndnSIM'): void ns3::ndn::NameValue::Set(ns3::ndn::Name const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::ndn::Name const &', 'value')])
@@ -5739,10 +6114,15 @@
is_static=True)
## ndn-net-device-face.h (module 'ndnSIM'): ns3::ndn::NetDeviceFace::NetDeviceFace(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::NetDevice> const & netDevice) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::NetDevice > const &', 'netDevice')])
- ## ndn-net-device-face.h (module 'ndnSIM'): void ns3::ndn::NetDeviceFace::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face> const&, ns3::Ptr<ns3::Packet const> const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
- cls.add_method('RegisterProtocolHandler',
+ ## ndn-net-device-face.h (module 'ndnSIM'): void ns3::ndn::NetDeviceFace::RegisterProtocolHandlers(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face>, ns3::Ptr<ns3::ndn::Interest>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & interestHandler, ns3::Callback<void, ns3::Ptr<ns3::ndn::Face>, ns3::Ptr<ns3::ndn::ContentObject>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & dataHandler) [member function]
+ cls.add_method('RegisterProtocolHandlers',
'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'handler')],
+ [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::ndn::Interest >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'interestHandler'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::ndn::ContentObject >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'dataHandler')],
+ is_virtual=True)
+ ## ndn-net-device-face.h (module 'ndnSIM'): void ns3::ndn::NetDeviceFace::UnRegisterProtocolHandlers() [member function]
+ cls.add_method('UnRegisterProtocolHandlers',
+ 'void',
+ [],
is_virtual=True)
## ndn-net-device-face.h (module 'ndnSIM'): std::ostream & ns3::ndn::NetDeviceFace::Print(std::ostream & os) const [member function]
cls.add_method('Print',
@@ -5754,8 +6134,8 @@
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
- ## ndn-net-device-face.h (module 'ndnSIM'): bool ns3::ndn::NetDeviceFace::SendImpl(ns3::Ptr<ns3::Packet> p) [member function]
- cls.add_method('SendImpl',
+ ## ndn-net-device-face.h (module 'ndnSIM'): bool ns3::ndn::NetDeviceFace::Send(ns3::Ptr<ns3::Packet> p) [member function]
+ cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='protected', is_virtual=True)
@@ -5863,6 +6243,11 @@
'ns3::Time',
[],
is_const=True)
+ ## ndn-rtt-estimator.h (module 'ndnSIM'): ns3::TypeId ns3::ndn::RttEstimator::GetInstanceTypeId() const [member function]
+ cls.add_method('GetInstanceTypeId',
+ 'ns3::TypeId',
+ [],
+ is_const=True, is_virtual=True)
## ndn-rtt-estimator.h (module 'ndnSIM'): ns3::Time ns3::ndn::RttEstimator::GetMaxRto() const [member function]
cls.add_method('GetMaxRto',
'ns3::Time',
@@ -5964,6 +6349,14 @@
cls.add_method('AddNetDeviceFaceCreateCallback',
'void',
[param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::ndn::L3Protocol >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
+ ## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::UpdateNetDeviceFaceCreateCallback(ns3::TypeId netDeviceType, ns3::Callback<ns3::Ptr<ns3::ndn::NetDeviceFace>,ns3::Ptr<ns3::Node>,ns3::Ptr<ns3::ndn::L3Protocol>,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
+ cls.add_method('UpdateNetDeviceFaceCreateCallback',
+ 'void',
+ [param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::ndn::L3Protocol >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
+ ## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::RemoveNetDeviceFaceCreateCallback(ns3::TypeId netDeviceType, ns3::Callback<ns3::Ptr<ns3::ndn::NetDeviceFace>,ns3::Ptr<ns3::Node>,ns3::Ptr<ns3::ndn::L3Protocol>,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
+ cls.add_method('RemoveNetDeviceFaceCreateCallback',
+ 'void',
+ [param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::ndn::L3Protocol >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::EnableLimits(bool enable=true, ns3::Time avgRtt=ns3::Seconds( ), uint32_t avgContentObject=1100, uint32_t avgInterest=40) [member function]
cls.add_method('EnableLimits',
'void',
@@ -6026,6 +6419,104 @@
cls.add_constructor([param('ns3::ndn::UnknownHeaderException const &', 'arg0')])
return
+def register_Ns3NdnWire_methods(root_module, cls):
+ ## ndn-wire.h (module 'ndnSIM'): ns3::ndn::Wire::Wire() [constructor]
+ cls.add_constructor([])
+ ## ndn-wire.h (module 'ndnSIM'): ns3::ndn::Wire::Wire(ns3::ndn::Wire const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::Wire const &', 'arg0')])
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::Packet> ns3::ndn::Wire::FromData(ns3::Ptr<ns3::ndn::ContentObject const> data, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromData',
+ 'ns3::Ptr< ns3::Packet >',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static std::string ns3::ndn::Wire::FromDataStr(ns3::Ptr<ns3::ndn::ContentObject const> data, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromDataStr',
+ 'std::string',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::Packet> ns3::ndn::Wire::FromInterest(ns3::Ptr<ns3::ndn::Interest const> interest, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromInterest',
+ 'ns3::Ptr< ns3::Packet >',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static std::string ns3::ndn::Wire::FromInterestStr(ns3::Ptr<ns3::ndn::Interest const> interest, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromInterestStr',
+ 'std::string',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static std::string ns3::ndn::Wire::FromName(ns3::Ptr<ns3::ndn::Name const> name, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('FromName',
+ 'std::string',
+ [param('ns3::Ptr< ns3::ndn::Name const >', 'name'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::ContentObject> ns3::ndn::Wire::ToData(ns3::Ptr<ns3::Packet> packet, int8_t type=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)) [member function]
+ cls.add_method('ToData',
+ 'ns3::Ptr< ns3::ndn::ContentObject >',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('int8_t', 'type', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::ContentObject> ns3::ndn::Wire::ToDataStr(std::string const & wire, int8_t type=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)) [member function]
+ cls.add_method('ToDataStr',
+ 'ns3::Ptr< ns3::ndn::ContentObject >',
+ [param('std::string const &', 'wire'), param('int8_t', 'type', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Interest> ns3::ndn::Wire::ToInterest(ns3::Ptr<ns3::Packet> packet, int8_t type=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)) [member function]
+ cls.add_method('ToInterest',
+ 'ns3::Ptr< ns3::ndn::Interest >',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('int8_t', 'type', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Interest> ns3::ndn::Wire::ToInterestStr(std::string const & wire, int8_t type=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)) [member function]
+ cls.add_method('ToInterestStr',
+ 'ns3::Ptr< ns3::ndn::Interest >',
+ [param('std::string const &', 'wire'), param('int8_t', 'type', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_AUTODETECT)')],
+ is_static=True)
+ ## ndn-wire.h (module 'ndnSIM'): static ns3::Ptr<ns3::ndn::Name> ns3::ndn::Wire::ToName(std::string const & wire, int8_t wireFormat=::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)) [member function]
+ cls.add_method('ToName',
+ 'ns3::Ptr< ns3::ndn::Name >',
+ [param('std::string const &', 'wire'), param('int8_t', 'wireFormat', default_value='::int8_t(::ns3::ndn::Wire::WIRE_FORMAT_DEFAULT)')],
+ is_static=True)
+ return
+
+def register_Ns3NdnApiFace_methods(root_module, cls):
+ ## ndn-api-face.h (module 'ndnSIM'): ns3::ndn::ApiFace::ApiFace(ns3::Ptr<ns3::Node> node) [constructor]
+ cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')])
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::Shutdown() [member function]
+ cls.add_method('Shutdown',
+ 'void',
+ [],
+ is_virtual=True)
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::ExpressInterest(ns3::Ptr<ns3::ndn::Interest> interest, ns3::Callback<void, ns3::Ptr<ns3::ndn::Interest const>, ns3::Ptr<ns3::ndn::ContentObject const>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onData, ns3::Callback<void, ns3::Ptr<ns3::ndn::Interest const>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onTimeout) [member function]
+ cls.add_method('ExpressInterest',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::Interest >', 'interest'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Interest const >, ns3::Ptr< ns3::ndn::ContentObject const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onData'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Interest const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onTimeout')])
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::SetInterestFilter(ns3::Ptr<ns3::ndn::Name const> prefix, ns3::Callback<void, ns3::Ptr<ns3::ndn::Name const>, ns3::Ptr<ns3::ndn::Interest const>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> onInterest) [member function]
+ cls.add_method('SetInterestFilter',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::Name const >', 'prefix'), param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Name const >, ns3::Ptr< ns3::ndn::Interest const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'onInterest')])
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::ClearInterestFilter(ns3::Ptr<ns3::ndn::Name const> prefix) [member function]
+ cls.add_method('ClearInterestFilter',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::Name const >', 'prefix')])
+ ## ndn-api-face.h (module 'ndnSIM'): void ns3::ndn::ApiFace::Put(ns3::Ptr<ns3::ndn::ContentObject> data) [member function]
+ cls.add_method('Put',
+ 'void',
+ [param('ns3::Ptr< ns3::ndn::ContentObject >', 'data')])
+ ## ndn-api-face.h (module 'ndnSIM'): bool ns3::ndn::ApiFace::SendInterest(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
+ cls.add_method('SendInterest',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
+ is_virtual=True)
+ ## ndn-api-face.h (module 'ndnSIM'): bool ns3::ndn::ApiFace::SendData(ns3::Ptr<ns3::ndn::ContentObject const> data) [member function]
+ cls.add_method('SendData',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')],
+ is_virtual=True)
+ ## ndn-api-face.h (module 'ndnSIM'): std::ostream & ns3::ndn::ApiFace::Print(std::ostream & os) const [member function]
+ cls.add_method('Print',
+ 'std::ostream &',
+ [param('std::ostream &', 'os')],
+ is_const=True, is_virtual=True)
+ return
+
def register_Ns3NdnAppFace_methods(root_module, cls):
## ndn-app-face.h (module 'ndnSIM'): static ns3::TypeId ns3::ndn::AppFace::GetTypeId() [member function]
cls.add_method('GetTypeId',
@@ -6034,39 +6525,34 @@
is_static=True)
## ndn-app-face.h (module 'ndnSIM'): ns3::ndn::AppFace::AppFace(ns3::Ptr<ns3::ndn::App> app) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::ndn::App >', 'app')])
- ## ndn-app-face.h (module 'ndnSIM'): void ns3::ndn::AppFace::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::ndn::Face> const&, ns3::Ptr<ns3::Packet const> const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
- cls.add_method('RegisterProtocolHandler',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::ndn::Face >, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'handler')],
+ ## ndn-app-face.h (module 'ndnSIM'): bool ns3::ndn::AppFace::SendInterest(ns3::Ptr<ns3::ndn::Interest const> interest) [member function]
+ cls.add_method('SendInterest',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::Interest const >', 'interest')],
+ is_virtual=True)
+ ## ndn-app-face.h (module 'ndnSIM'): bool ns3::ndn::AppFace::SendData(ns3::Ptr<ns3::ndn::ContentObject const> data) [member function]
+ cls.add_method('SendData',
+ 'bool',
+ [param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')],
is_virtual=True)
## ndn-app-face.h (module 'ndnSIM'): std::ostream & ns3::ndn::AppFace::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'std::ostream &',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
- ## ndn-app-face.h (module 'ndnSIM'): bool ns3::ndn::AppFace::SendImpl(ns3::Ptr<ns3::Packet> p) [member function]
- cls.add_method('SendImpl',
- 'bool',
- [param('ns3::Ptr< ns3::Packet >', 'p')],
- visibility='protected', is_virtual=True)
return
def register_Ns3NdnCsEntry_methods(root_module, cls):
## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::cs::Entry::Entry(ns3::ndn::cs::Entry const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ndn::cs::Entry const &', 'arg0')])
- ## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::cs::Entry::Entry(ns3::Ptr<ns3::ndn::ContentStore> cs, ns3::Ptr<ns3::ndn::ContentObject const> header, ns3::Ptr<const ns3::Packet> packet) [constructor]
- cls.add_constructor([param('ns3::Ptr< ns3::ndn::ContentStore >', 'cs'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'header'), param('ns3::Ptr< ns3::Packet const >', 'packet')])
+ ## ndn-content-store.h (module 'ndnSIM'): ns3::ndn::cs::Entry::Entry(ns3::Ptr<ns3::ndn::ContentStore> cs, ns3::Ptr<ns3::ndn::ContentObject const> data) [constructor]
+ cls.add_constructor([param('ns3::Ptr< ns3::ndn::ContentStore >', 'cs'), param('ns3::Ptr< ns3::ndn::ContentObject const >', 'data')])
## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::ContentStore> ns3::ndn::cs::Entry::GetContentStore() [member function]
cls.add_method('GetContentStore',
'ns3::Ptr< ns3::ndn::ContentStore >',
[])
- ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet> ns3::ndn::cs::Entry::GetFullyFormedNdnPacket() const [member function]
- cls.add_method('GetFullyFormedNdnPacket',
- 'ns3::Ptr< ns3::Packet >',
- [],
- is_const=True)
- ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::ContentObject const> ns3::ndn::cs::Entry::GetHeader() const [member function]
- cls.add_method('GetHeader',
+ ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<ns3::ndn::ContentObject const> ns3::ndn::cs::Entry::GetData() const [member function]
+ cls.add_method('GetData',
'ns3::Ptr< ns3::ndn::ContentObject const >',
[],
is_const=True)
@@ -6075,11 +6561,6 @@
'ns3::ndn::Name const &',
[],
is_const=True)
- ## ndn-content-store.h (module 'ndnSIM'): ns3::Ptr<const ns3::Packet> ns3::ndn::cs::Entry::GetPacket() const [member function]
- cls.add_method('GetPacket',
- 'ns3::Ptr< ns3::Packet const >',
- [],
- is_const=True)
return
def register_Ns3NdnFibEntry_methods(root_module, cls):
@@ -6227,6 +6708,95 @@
cls.add_constructor([param('ns3::ndn::fw::Tag const &', 'arg0')])
return
+def register_Ns3NdnNameComponent_methods(root_module, cls):
+ cls.add_output_stream_operator()
+ cls.add_binary_comparison_operator('<')
+ cls.add_binary_comparison_operator('<=')
+ cls.add_binary_comparison_operator('>')
+ cls.add_binary_comparison_operator('>=')
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component(ns3::ndn::name::Component const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ndn::name::Component const &', 'arg0')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component() [constructor]
+ cls.add_constructor([])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component(std::string const & uri) [constructor]
+ cls.add_constructor([param('std::string const &', 'uri')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component(__gnu_cxx::__normal_iterator<char const*, std::string> begin, __gnu_cxx::__normal_iterator<char const*, std::string> end) [constructor]
+ cls.add_constructor([param('__gnu_cxx::__normal_iterator< char const *, std::string >', 'begin'), param('__gnu_cxx::__normal_iterator< char const *, std::string >', 'end')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component::Component(void const * buf, size_t length) [constructor]
+ cls.add_constructor([param('void const *', 'buf'), param('size_t', 'length')])
+ ## name-component.h (module 'ndnSIM'): int ns3::ndn::name::Component::compare(ns3::ndn::name::Component const & other) const [member function]
+ cls.add_method('compare',
+ 'int',
+ [param('ns3::ndn::name::Component const &', 'other')],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::name::Component::fromNumber(uint64_t number) [member function]
+ cls.add_method('fromNumber',
+ 'ns3::ndn::name::Component &',
+ [param('uint64_t', 'number')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::name::Component::fromNumberWithMarker(uint64_t number, unsigned char marker) [member function]
+ cls.add_method('fromNumberWithMarker',
+ 'ns3::ndn::name::Component &',
+ [param('uint64_t', 'number'), param('unsigned char', 'marker')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::name::Component::fromUri(std::string const & uri) [member function]
+ cls.add_method('fromUri',
+ 'ns3::ndn::name::Component &',
+ [param('std::string const &', 'uri')])
+ ## name-component.h (module 'ndnSIM'): ns3::ndn::name::Component & ns3::ndn::name::Component::fromUri(__gnu_cxx::__normal_iterator<char const*, std::string> begin, __gnu_cxx::__normal_iterator<char const*, std::string> end) [member function]
+ cls.add_method('fromUri',
+ 'ns3::ndn::name::Component &',
+ [param('__gnu_cxx::__normal_iterator< char const *, std::string >', 'begin'), param('__gnu_cxx::__normal_iterator< char const *, std::string >', 'end')])
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toBlkId() const [member function]
+ cls.add_method('toBlkId',
+ 'uint64_t',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): std::string ns3::ndn::name::Component::toBlob() const [member function]
+ cls.add_method('toBlob',
+ 'std::string',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): void ns3::ndn::name::Component::toBlob(std::ostream & os) const [member function]
+ cls.add_method('toBlob',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toControlNum() const [member function]
+ cls.add_method('toControlNum',
+ 'uint64_t',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toNumber() const [member function]
+ cls.add_method('toNumber',
+ 'uint64_t',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toNumberWithMarker(unsigned char marker) const [member function]
+ cls.add_method('toNumberWithMarker',
+ 'uint64_t',
+ [param('unsigned char', 'marker')],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toSeqNum() const [member function]
+ cls.add_method('toSeqNum',
+ 'uint64_t',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): std::string ns3::ndn::name::Component::toUri() const [member function]
+ cls.add_method('toUri',
+ 'std::string',
+ [],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): void ns3::ndn::name::Component::toUri(std::ostream & os) const [member function]
+ cls.add_method('toUri',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True)
+ ## name-component.h (module 'ndnSIM'): uint64_t ns3::ndn::name::Component::toVersion() const [member function]
+ cls.add_method('toVersion',
+ 'uint64_t',
+ [],
+ is_const=True)
+ return
+
def register_Ns3NdnPitEntry_methods(root_module, cls):
cls.add_output_stream_operator()
## ndn-pit-entry.h (module 'ndnSIM'): ns3::ndn::pit::Entry::Entry(ns3::ndn::pit::Entry const & arg0) [copy constructor]
@@ -6426,14 +6996,24 @@
return
def register_functions_ns3_ndn(module, root_module):
- ## ndn-name.h (module 'ndnSIM'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::ndn::MakeNameChecker() [free function]
+ ## ndn-wire.h (module 'ndnSIM'): ns3::Ptr<ns3::Packet> ns3::ndn::BufferToPacket(std::string const & buffer) [free function]
+ module.add_function('BufferToPacket',
+ 'ns3::Ptr< ns3::Packet >',
+ [param('std::string const &', 'buffer')])
+ ## name.h (module 'ndnSIM'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::ndn::MakeNameChecker() [free function]
module.add_function('MakeNameChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
+ ## ndn-wire.h (module 'ndnSIM'): std::string ns3::ndn::PacketToBuffer(ns3::Ptr<ns3::Packet const> pkt) [free function]
+ module.add_function('PacketToBuffer',
+ 'std::string',
+ [param('ns3::Ptr< ns3::Packet const >', 'pkt')])
register_functions_ns3_ndn_cs(module.get_submodule('cs'), root_module)
register_functions_ns3_ndn_fib(module.get_submodule('fib'), root_module)
register_functions_ns3_ndn_fw(module.get_submodule('fw'), root_module)
+ register_functions_ns3_ndn_name(module.get_submodule('name'), root_module)
register_functions_ns3_ndn_pit(module.get_submodule('pit'), root_module)
+ register_functions_ns3_ndn_time(module.get_submodule('time'), root_module)
return
def register_functions_ns3_ndn_cs(module, root_module):
@@ -6445,9 +7025,19 @@
def register_functions_ns3_ndn_fw(module, root_module):
return
+def register_functions_ns3_ndn_name(module, root_module):
+ return
+
def register_functions_ns3_ndn_pit(module, root_module):
return
+def register_functions_ns3_ndn_time(module, root_module):
+ ## ndn-common.h (module 'ndnSIM'): ns3::Time ns3::ndn::time::NowUnixTimestamp() [free function]
+ module.add_function('NowUnixTimestamp',
+ 'ns3::Time',
+ [])
+ return
+
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
diff --git a/bindings/modulegen_customizations.py b/bindings/modulegen_customizations.py
new file mode 100644
index 0000000..d81a727
--- /dev/null
+++ b/bindings/modulegen_customizations.py
@@ -0,0 +1,37 @@
+import re
+import os
+import sys
+
+from pybindgen.typehandlers import base as typehandlers
+from pybindgen import ReturnValue, Parameter
+from pybindgen.cppmethod import CustomCppMethodWrapper, CustomCppConstructorWrapper
+from pybindgen.typehandlers.codesink import MemoryCodeSink
+from pybindgen.typehandlers import ctypeparser
+from pybindgen import cppclass, param, retval
+import warnings
+
+from pybindgen.typehandlers.base import CodeGenerationError
+
+def add_vector_defs (module):
+ # mod = module.get_submodule('ndn')
+ # nested_module = mod.add_cpp_namespace('error')
+ # nested_module.add_class ('Name')
+
+
+ # # module.add_class ('Name',
+ # # module.add_exception ('Error', foreign_cpp_namespace='ns3::ndn::error', message_rvalue='ns3::ndn::error::get_msg (%(EXC)s)')
+ # # module.add_exception ('Uri', foreign_cpp_namespace='ns3::ndn::error', message_rvalue='ns3::ndn::error::get_msg (%(EXC)s)')
+ # # module.add_exception ('StringTransform', foreign_cpp_namespace='ns3::ndn::error', message_rvalue='ns3::ndn::error::get_msg (%(EXC)s)')
+ # nested_module.add_exception ('Name', message_rvalue='fuck you')
+ # # message_rvalue='ns3::ndn::error::get_msg (%(EXC)s)')
+ # # module.add_exception ('Component', foreign_cpp_namespace='ns3::ndn::error::name', message_rvalue='ns3::ndn::error::get_msg (%(EXC)s)')
+ # # module.add_exception ('Exclude', foreign_cpp_namespace='ns3::ndn::error', message_rvalue='ns3::ndn::error::get_msg (%(EXC)s)')
+ # # module.add_exception ('KeyLocator', foreign_cpp_namespace='ns3::ndn::error', message_rvalue='ns3::ndn::error::get_msg (%(EXC)s)')
+ # # print dir(module)
+ # # module.add_container ('ns3::ndn::Blob', 'char', container_type='vector')
+ # # module.add_stl_container('ns3::ndn::Blob', 'char', 'vector', custom_name="Blob2")
+ pass
+
+
+def post_register_types (root_module):
+ add_vector_defs (root_module)
diff --git a/bindings/scan-header.h b/bindings/scan-header.h
new file mode 100644
index 0000000..7d35e18
--- /dev/null
+++ b/bindings/scan-header.h
@@ -0,0 +1,58 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU 3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ns3/ndnSIM-module.h"
+
+using namespace ns3;
+using namespace ndn;
+
+static inline void
+__dummy_function_on_interest_callback_instantiation (Ptr<const Name>, Ptr<const Interest>)
+{
+}
+
+static inline void
+__dummy_function_on_data_callback_instantiation (Ptr<const Interest>, Ptr<const ContentObject>)
+{
+}
+
+static inline void
+__dummy_function_on_timeout_callback_instantiation (Ptr<const Interest>)
+{
+}
+
+static inline void
+__dummy_function_to_force_ndn_api_face_callback_instantiations ()
+{
+ ApiFace face (0);
+ Ptr<Interest> interest;
+ Ptr<Name> prefix;
+
+ face.ExpressInterest (interest,
+ MakeCallback (__dummy_function_on_data_callback_instantiation),
+ MakeCallback (__dummy_function_on_timeout_callback_instantiation)
+ );
+
+ face.SetInterestFilter (prefix,
+ MakeCallback (__dummy_function_on_interest_callback_instantiation));
+
+ std::string tmp ("bla");
+ char &test = tmp[0];
+}
+
+
+// /// @cond include_hidden
+// #ifdef PYTHON_SCAN
+// struct CallbackVoidNameInterest : public Callback<void, Ptr<const Name>, Ptr<const Interest> > { };
+// struct CallbackVoidInterestContentObject : public Callback<void, Ptr<const Interest>, Ptr<const ContentObject> > { };
+// struct CallbackVoidInterest : public Callback<void, Ptr<const Interest> > { };
+// #endif
+// /// @endcond
+
diff --git a/disabled/ccnb-parser/visitors/interest-visitor.cc b/disabled/ccnb-parser/visitors/interest-visitor.cc
deleted file mode 100644
index 4e7b8ca..0000000
--- a/disabled/ccnb-parser/visitors/interest-visitor.cc
+++ /dev/null
@@ -1,188 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "interest-visitor.h"
-
-#include "../syntax-tree/block.h"
-#include "../syntax-tree/dtag.h"
-
-#include "ns3/ndn-name.h"
-#include "ns3/ndn-interest-header.h"
-
-#include "ns3/assert.h"
-#include "ns3/nstime.h"
-
-#include "name-components-visitor.h"
-#include "non-negative-integer-visitor.h"
-#include "timestamp-visitor.h"
-#include "uint32t-blob-visitor.h"
-
-#include <boost/foreach.hpp>
-
-#include "ns3/log.h"
-
-NS_LOG_COMPONENT_DEFINE ("ndn.CcnbParser.InterestVisitor");
-
-namespace ns3 {
-namespace ndn {
-namespace CcnbParser {
-
-// We don't care about any other fields
-void
-InterestVisitor::visit (Dtag &n, boost::any param/*should be Interest* */)
-{
- // uint32_t n.m_dtag;
- // std::list<Ptr<Block> > n.m_nestedBlocks;
-
- static NonNegativeIntegerVisitor nonNegativeIntegerVisitor;
- static NameVisitor nameComponentsVisitor;
- static TimestampVisitor timestampVisitor;
- static Uint32tBlobVisitor nonceVisitor;
-
- Interest &interest = *(boost::any_cast<Interest*> (param));
-
- switch (n.m_dtag)
- {
- case CCN_DTAG_Interest:
- NS_LOG_DEBUG ("Interest");
-
- // process nested blocks
- BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
- {
- block->accept (*this, param);
- }
- break;
- case CCN_DTAG_Name:
- {
- NS_LOG_DEBUG ("Name");
-
- // process name components
- Ptr<Name> name = Create<Name> ();
-
- BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
- {
- block->accept (nameComponentsVisitor, &(*name));
- }
- interest.SetName (name);
- break;
- }
- case CCN_DTAG_MinSuffixComponents:
- NS_LOG_DEBUG ("MinSuffixComponents");
- if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
- interest.SetMinSuffixComponents (
- boost::any_cast<uint32_t> (
- (*n.m_nestedTags.begin())->accept(
- nonNegativeIntegerVisitor
- )));
- break;
- case CCN_DTAG_MaxSuffixComponents:
- NS_LOG_DEBUG ("MaxSuffixComponents");
- if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
- interest.SetMaxSuffixComponents (
- boost::any_cast<uint32_t> (
- (*n.m_nestedTags.begin())->accept(
- nonNegativeIntegerVisitor
- )));
- break;
- case CCN_DTAG_Exclude:
- {
- NS_LOG_DEBUG ("Exclude");
- // process exclude components
- Ptr<Name> exclude = Create<Name> ();
-
- BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
- {
- block->accept (nameComponentsVisitor, &(*exclude));
- }
- interest.SetExclude (exclude);
- break;
- }
- case CCN_DTAG_ChildSelector:
- NS_LOG_DEBUG ("ChildSelector");
- if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
-
- interest.SetChildSelector (
- 1 == boost::any_cast<uint32_t> (
- (*n.m_nestedTags.begin())->accept(
- nonNegativeIntegerVisitor
- )));
- break;
- case CCN_DTAG_AnswerOriginKind:
- NS_LOG_DEBUG ("AnswerOriginKind");
- if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
- interest.SetAnswerOriginKind (
- 1 == boost::any_cast<uint32_t> (
- (*n.m_nestedTags.begin())->accept(
- nonNegativeIntegerVisitor
- )));
- break;
- case CCN_DTAG_Scope:
- NS_LOG_DEBUG ("Scope");
- if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
- interest.SetScope (
- boost::any_cast<uint32_t> (
- (*n.m_nestedTags.begin())->accept(
- nonNegativeIntegerVisitor
- )));
- break;
- case CCN_DTAG_InterestLifetime:
- NS_LOG_DEBUG ("InterestLifetime");
- if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
-
- interest.SetInterestLifetime (
- boost::any_cast<Time> (
- (*n.m_nestedTags.begin())->accept(
- timestampVisitor
- )));
- break;
- case CCN_DTAG_Nonce:
- NS_LOG_DEBUG ("Nonce");
- if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
-
- interest.SetNonce (
- boost::any_cast<uint32_t> (
- (*n.m_nestedTags.begin())->accept(
- nonceVisitor
- )));
- break;
-
-
- case CCN_DTAG_Nack:
- NS_LOG_DEBUG ("Nack");
- if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
-
- interest.SetNack (
- boost::any_cast<uint32_t> (
- (*n.m_nestedTags.begin())->accept(nonNegativeIntegerVisitor)));
- break;
- }
-}
-
-} // namespace CcnbParser
-} // namespace ndn
-} // namespace ns3
diff --git a/disabled/ccnb-parser/visitors/interest-visitor.h b/disabled/ccnb-parser/visitors/interest-visitor.h
deleted file mode 100644
index 38a969d..0000000
--- a/disabled/ccnb-parser/visitors/interest-visitor.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef _CCNB_PARSER_INTEREST_VISITOR_H_
-#define _CCNB_PARSER_INTEREST_VISITOR_H_
-
-#include "void-depth-first-visitor.h"
-
-namespace ns3 {
-namespace ndn {
-namespace CcnbParser {
-
-/**
- * \ingroup ccnx-ccnb
- * \brief Visitor that fills fields in CcnxInterest
- *
- * Usage example:
- * \code
- * Ptr<CcnxInterest> header = Create<CcnxInterest> ();
- * Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
- * InterestVisitor visitor;
- * root->accept (visitor, *header);
- * \endcode
- */
-class InterestVisitor : public VoidDepthFirstVisitor
-{
-public:
- virtual void visit (Dtag &n, boost::any param/*should be CcnxInterest* */);
-};
-
-} // namespace CcnbParser
-} // namespace ndn
-} // namespace ns3
-
-#endif // _CCNB_PARSER_INTEREST_VISITOR_H_
diff --git a/disabled/ndn-content-object-header-ccnb.cc b/disabled/ndn-content-object-header-ccnb.cc
deleted file mode 100644
index 1f1a9f3..0000000
--- a/disabled/ndn-content-object-header-ccnb.cc
+++ /dev/null
@@ -1,555 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndn-content-object-header-ccnb.h"
-
-#include "ns3/log.h"
-#include "../helper/ndn-encoding-helper.h"
-#include "../helper/ndn-decoding-helper.h"
-
-#include "../helper/ccnb-parser/common.h"
-#include "../helper/ccnb-parser/visitors/void-depth-first-visitor.h"
-#include "../helper/ccnb-parser/visitors/name-components-visitor.h"
-#include "../helper/ccnb-parser/visitors/non-negative-integer-visitor.h"
-#include "../helper/ccnb-parser/visitors/timestamp-visitor.h"
-#include "../helper/ccnb-parser/visitors/string-visitor.h"
-#include "../helper/ccnb-parser/visitors/uint32t-blob-visitor.h"
-#include "../helper/ccnb-parser/visitors/content-type-visitor.h"
-
-#include "../helper/ccnb-parser/syntax-tree/block.h"
-#include "../helper/ccnb-parser/syntax-tree/dtag.h"
-
-#include <boost/foreach.hpp>
-
-NS_LOG_COMPONENT_DEFINE ("ndn.ContentObject");
-
-namespace ns3 {
-namespace ndn {
-
-using namespace CcnbParser;
-
-const std::string ContentObject::Signature::DefaultDigestAlgorithm = "2.16.840.1.101.3.4.2.1";
-
-NS_OBJECT_ENSURE_REGISTERED (ContentObject);
-NS_OBJECT_ENSURE_REGISTERED (ContentObjectTail);
-
-TypeId
-ContentObject::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::ndn::ContentObject")
- .SetGroupName ("Ndn")
- .SetParent<Header> ()
- .AddConstructor<ContentObject> ()
- ;
- return tid;
-}
-
-ContentObject::ContentObject ()
-{
-}
-
-void
-ContentObject::SetName (const Ptr<Name> &name)
-{
- m_name = name;
-}
-
-const Name&
-ContentObject::GetName () const
-{
- if (m_name==0) throw ContentObjectException();
- return *m_name;
-}
-
-Ptr<const Name>
-ContentObject::GetNamePtr () const
-{
- return m_name;
-}
-
-#define CCNB EncodingHelper // just to simplify writing
-
-void
-ContentObject::Serialize (Buffer::Iterator start) const
-{
- size_t written = 0;
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_ContentObject, CCN_DTAG); // <ContentObject>
-
- // fake signature
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_Signature, CCN_DTAG); // <Signature>
- // Signature ::= √DigestAlgorithm?
- // Witness?
- // √SignatureBits
- if (GetSignature ().GetDigestAlgorithm () != Signature::DefaultDigestAlgorithm)
- {
- written += CCNB::AppendString (start, CCN_DTAG_DigestAlgorithm, GetSignature ().GetDigestAlgorithm ());
- }
- written += CCNB::AppendTaggedBlob (start, CCN_DTAG_SignatureBits, GetSignature ().GetSignatureBits ()); // <SignatureBits />
- written += CCNB::AppendCloser (start); // </Signature>
-
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_Name, CCN_DTAG); // <Name>
- written += CCNB::AppendName (start, GetName()); // <Component>...</Component>...
- written += CCNB::AppendCloser (start); // </Name>
-
- // fake signature
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_SignedInfo, CCN_DTAG); // <SignedInfo>
- // SignedInfo ::= √PublisherPublicKeyDigest
- // √Timestamp
- // √Type?
- // √FreshnessSeconds?
- // FinalBlockID?
- // KeyLocator?
- written += CCNB::AppendTaggedBlob (start, CCN_DTAG_PublisherPublicKeyDigest, // <PublisherPublicKeyDigest>...
- GetSignedInfo ().GetPublisherPublicKeyDigest ());
-
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_Timestamp, CCN_DTAG); // <Timestamp>...
- written += CCNB::AppendTimestampBlob (start, GetSignedInfo ().GetTimestamp ());
- written += CCNB::AppendCloser (start);
-
- if (GetSignedInfo ().GetContentType () != DATA)
- {
- uint8_t type[3];
- type[0] = (GetSignedInfo ().GetContentType () >> 16) & 0xFF;
- type[1] = (GetSignedInfo ().GetContentType () >> 8 ) & 0xFF;
- type[2] = (GetSignedInfo ().GetContentType () ) & 0xFF;
-
- written += CCNB::AppendTaggedBlob (start, CCN_DTAG_Type, type, 3);
- }
- if (GetSignedInfo ().GetFreshness () > Seconds(0))
- {
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_FreshnessSeconds, CCN_DTAG);
- written += CCNB::AppendNumber (start, GetSignedInfo ().GetFreshness ().ToInteger (Time::S));
- written += CCNB::AppendCloser (start);
- }
- if (GetSignedInfo ().GetKeyLocator () != 0)
- {
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_KeyLocator, CCN_DTAG); // <KeyLocator>
- {
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_KeyName, CCN_DTAG); // <KeyName>
- {
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_Name, CCN_DTAG); // <Name>
- written += CCNB::AppendName (start, GetName()); // <Component>...</Component>...
- written += CCNB::AppendCloser (start); // </Name>
- }
- written += CCNB::AppendCloser (start); // </KeyName>
- }
- written += CCNB::AppendCloser (start); // </KeyLocator>
- }
-
- written += CCNB::AppendCloser (start); // </SignedInfo>
-
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_Content, CCN_DTAG); // <Content>
-
- // there are no closing tags !!!
- // The closing tag is handled by ContentObjectTail
-}
-
-uint32_t
-ContentObject::GetSerializedSize () const
-{
- size_t written = 0;
- written += CCNB::EstimateBlockHeader (CCN_DTAG_ContentObject); // <ContentObject>
-
- // fake signature
- written += CCNB::EstimateBlockHeader (CCN_DTAG_Signature); // <Signature>
- // Signature ::= DigestAlgorithm?
- // Witness?
- // SignatureBits
- if (GetSignature ().GetDigestAlgorithm () != Signature::DefaultDigestAlgorithm)
- {
- written += CCNB::EstimateString (CCN_DTAG_DigestAlgorithm, GetSignature ().GetDigestAlgorithm ());
- }
- written += CCNB::EstimateTaggedBlob (CCN_DTAG_SignatureBits,
- sizeof (GetSignature ().GetSignatureBits ())); // <SignatureBits />
- written += 1; // </Signature>
-
- written += CCNB::EstimateBlockHeader (CCN_DTAG_Name); // <Name>
- written += CCNB::EstimateName (GetName()); // <Component>...</Component>...
- written += 1; // </Name>
-
- // fake signature
- written += CCNB::EstimateBlockHeader (CCN_DTAG_SignedInfo); // <SignedInfo>
- // SignedInfo ::= √PublisherPublicKeyDigest
- // √Timestamp
- // √Type?
- // √FreshnessSeconds?
- // FinalBlockID?
- // KeyLocator?
-
- written += CCNB::EstimateTaggedBlob (CCN_DTAG_PublisherPublicKeyDigest, // <PublisherPublicKeyDigest>...
- sizeof (GetSignedInfo ().GetPublisherPublicKeyDigest ()));
-
- written += CCNB::EstimateBlockHeader (CCN_DTAG_Timestamp); // <Timestamp>...
- written += CCNB::EstimateTimestampBlob (GetSignedInfo ().GetTimestamp ());
- written += 1;
-
- if (GetSignedInfo ().GetContentType () != DATA)
- {
- written += CCNB::EstimateTaggedBlob (CCN_DTAG_Type, 3);
- }
- if (GetSignedInfo ().GetFreshness () > Seconds(0))
- {
- written += CCNB::EstimateBlockHeader (CCN_DTAG_FreshnessSeconds);
- written += CCNB::EstimateNumber (GetSignedInfo ().GetFreshness ().ToInteger (Time::S));
- written += 1;
- }
-
- if (GetSignedInfo ().GetKeyLocator () != 0)
- {
- written += CCNB::EstimateBlockHeader (CCN_DTAG_KeyLocator); // <KeyLocator>
- {
- written += CCNB::EstimateBlockHeader (CCN_DTAG_KeyName); // <KeyName>
- {
- written += CCNB::EstimateBlockHeader (CCN_DTAG_Name); // <Name>
- written += CCNB::EstimateName (GetName()); // <Component>...</Component>...
- written += 1; // </Name>
- }
- written += 1; // </KeyName>
- }
- written += 1; // </KeyLocator>
- }
-
- written += 1; // </SignedInfo>
-
- written += CCNB::EstimateBlockHeader (CCN_DTAG_Content); // <Content>
-
- // there are no closing tags !!!
- // The closing tag is handled by ContentObjectTail
- return written;
-}
-#undef CCNB
-
-class ContentObjectVisitor : public VoidDepthFirstVisitor
-{
-public:
- virtual void visit (Dtag &n, boost::any param/*should be ContentObject* */)
- {
- // uint32_t n.m_dtag;
- // std::list<Ptr<Block> > n.m_nestedBlocks;
- static NameVisitor nameComponentsVisitor;
- static NonNegativeIntegerVisitor nonNegativeIntegerVisitor;
- static TimestampVisitor timestampVisitor;
- static StringVisitor stringVisitor;
- static Uint32tBlobVisitor uint32tBlobVisitor;
- static ContentTypeVisitor contentTypeVisitor;
-
- ContentObject &contentObject = *(boost::any_cast<ContentObject*> (param));
-
- switch (n.m_dtag)
- {
- case CCN_DTAG_ContentObject:
- // process nested blocks
- BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
- {
- block->accept (*this, param);
- }
- break;
- case CCN_DTAG_Name:
- {
- // process name components
- Ptr<Name> name = Create<Name> ();
-
- BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
- {
- block->accept (nameComponentsVisitor, &(*name));
- }
- contentObject.SetName (name);
- break;
- }
-
- case CCN_DTAG_Signature:
- // process nested blocks
- BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
- {
- block->accept (*this, param);
- }
- break;
-
- case CCN_DTAG_DigestAlgorithm:
- NS_LOG_DEBUG ("DigestAlgorithm");
- if (n.m_nestedTags.size ()!=1) // should be exactly one UDATA inside this tag
- throw CcnbDecodingException ();
-
- contentObject.GetSignature ().SetDigestAlgorithm
- (boost::any_cast<std::string> ((*n.m_nestedTags.begin())->accept
- (stringVisitor)));
- break;
-
- case CCN_DTAG_SignatureBits:
- NS_LOG_DEBUG ("SignatureBits");
- if (n.m_nestedTags.size ()!=1) // should be only one nested tag
- throw CcnbDecodingException ();
-
- contentObject.GetSignature ().SetSignatureBits
- (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
- (uint32tBlobVisitor)));
- break;
-
- case CCN_DTAG_SignedInfo:
- // process nested blocks
- BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
- {
- block->accept (*this, param);
- }
- break;
-
- case CCN_DTAG_PublisherPublicKeyDigest:
- NS_LOG_DEBUG ("PublisherPublicKeyDigest");
- if (n.m_nestedTags.size ()!=1) // should be only one nested tag
- throw CcnbDecodingException ();
-
- contentObject.GetSignedInfo ().SetPublisherPublicKeyDigest
- (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
- (uint32tBlobVisitor)));
- break;
-
- case CCN_DTAG_Timestamp:
- NS_LOG_DEBUG ("Timestamp");
- if (n.m_nestedTags.size()!=1) // should be exactly one nested tag
- throw CcnbDecodingException ();
-
- contentObject.GetSignedInfo ().SetTimestamp
- (boost::any_cast<Time> ((*n.m_nestedTags.begin())->accept
- (timestampVisitor)));
- break;
-
- case CCN_DTAG_Type:
- NS_LOG_DEBUG ("Type");
- if (n.m_nestedTags.size ()!=1) // should be only one nested tag
- throw CcnbDecodingException ();
-
- contentObject.GetSignedInfo ().SetContentType
- (static_cast<ContentObject::ContentType>
- (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
- (contentTypeVisitor))));
- break;
-
- case CCN_DTAG_FreshnessSeconds:
- NS_LOG_DEBUG ("FreshnessSeconds");
-
- if (n.m_nestedTags.size()!=1) // should be exactly one nested tag
- throw CcnbDecodingException ();
-
- contentObject.GetSignedInfo ().SetFreshness
- (Seconds
- (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
- (nonNegativeIntegerVisitor))));
- break;
-
- case CCN_DTAG_KeyLocator:
- // process nested blocks
- BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
- {
- block->accept (*this, param);
- }
- break;
-
- case CCN_DTAG_KeyName:
- {
- if (n.m_nestedTags.size ()!=1) // should be exactly one nested tag
- throw CcnbDecodingException ();
-
- Ptr<BaseTag> nameTag = DynamicCast<BaseTag>(n.m_nestedTags.front ());
- if (nameTag == 0)
- throw CcnbDecodingException ();
-
- // process name components
- Ptr<Name> name = Create<Name> ();
-
- BOOST_FOREACH (Ptr<Block> block, nameTag->m_nestedTags)
- {
- block->accept (nameComponentsVisitor, &(*name));
- }
- contentObject.GetSignedInfo ().SetKeyLocator (name);
- break;
- }
-
- case CCN_DTAG_Content: // !!! HACK
- // This hack was necessary for memory optimizations (i.e., content is virtual payload)
- NS_ASSERT_MSG (n.m_nestedTags.size() == 0, "Parser should have stopped just after processing <Content> tag");
- break;
-
- default: // ignore all other stuff
- break;
- }
- }
-};
-
-uint32_t
-ContentObject::Deserialize (Buffer::Iterator start)
-{
- static ContentObjectVisitor contentObjectVisitor;
-
- Buffer::Iterator i = start;
- Ptr<Block> root = Block::ParseBlock (i);
- root->accept (contentObjectVisitor, this);
-
- return i.GetDistanceFrom (start);
-}
-
-TypeId
-ContentObject::GetInstanceTypeId (void) const
-{
- return GetTypeId ();
-}
-
-void
-ContentObject::Print (std::ostream &os) const
-{
- os << "D: " << GetName ();
- // os << "<ContentObject><Name>" << GetName () << "</Name><Content>";
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ContentObjectTail::ContentObjectTail ()
-{
-}
-
-TypeId
-ContentObjectTail::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::ndn::ContentObjectTail")
- .SetParent<Trailer> ()
- .AddConstructor<ContentObjectTail> ()
- ;
- return tid;
-}
-
-TypeId
-ContentObjectTail::GetInstanceTypeId (void) const
-{
- return GetTypeId ();
-}
-
-void
-ContentObjectTail::Print (std::ostream &os) const
-{
- os << "</Content></ContentObject>";
-}
-
-uint32_t
-ContentObjectTail::GetSerializedSize (void) const
-{
- return 2;
-}
-
-void
-ContentObjectTail::Serialize (Buffer::Iterator start) const
-{
- Buffer::Iterator i = start;
- i.Prev (2); // Trailer interface requires us to go backwards
-
- i.WriteU8 (0x00); // </Content>
- i.WriteU8 (0x00); // </ContentObject>
-}
-
-uint32_t
-ContentObjectTail::Deserialize (Buffer::Iterator start)
-{
- Buffer::Iterator i = start;
- i.Prev (2); // Trailer interface requires us to go backwards
-
- uint8_t closing_tag_content = i.ReadU8 ();
- NS_ASSERT_MSG (closing_tag_content==0, "Should be a closing tag </Content> (0x00)");
-
- uint8_t closing_tag_content_object = i.ReadU8 ();
- NS_ASSERT_MSG (closing_tag_content_object==0, "Should be a closing tag </ContentObject> (0x00)");
-
- return 2;
-}
-
-///////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////
-
-ContentObject::SignedInfo::SignedInfo ()
- : m_publisherPublicKeyDigest (0)
- // , m_timestamp
- , m_type (DATA)
- // , m_freshness
- // , FinalBlockID
- // , KeyLocator
-{
-}
-
-void
-ContentObject::SignedInfo::SetPublisherPublicKeyDigest (uint32_t digest)
-{
- m_publisherPublicKeyDigest = digest;
-}
-
-uint32_t
-ContentObject::SignedInfo::GetPublisherPublicKeyDigest () const
-{
- return m_publisherPublicKeyDigest;
-}
-
-void
-ContentObject::SignedInfo::SetTimestamp (const Time ×tamp)
-{
- m_timestamp = timestamp;
-}
-
-Time
-ContentObject::SignedInfo::GetTimestamp () const
-{
- return m_timestamp;
-}
-
-void
-ContentObject::SignedInfo::SetContentType (ContentObject::ContentType type)
-{
- m_type = type;
-}
-
-ContentObject::ContentType
-ContentObject::SignedInfo::GetContentType () const
-{
- return m_type;
-}
-
-void
-ContentObject::SignedInfo::SetFreshness (const Time &freshness)
-{
- m_freshness = freshness;
-}
-
-Time
-ContentObject::SignedInfo::GetFreshness () const
-{
- return m_freshness;
-}
-
-void
-ContentObject::SignedInfo::SetKeyLocator (Ptr<const Name> keyLocator)
-{
- m_keyLocator = keyLocator;
-}
-
-Ptr<const Name>
-ContentObject::SignedInfo::GetKeyLocator () const
-{
- return m_keyLocator;
-}
-
-} // namespace ndn
-} // namespace ns3
diff --git a/disabled/ndn-content-object-header-ccnb.h b/disabled/ndn-content-object-header-ccnb.h
deleted file mode 100644
index 8d58a65..0000000
--- a/disabled/ndn-content-object-header-ccnb.h
+++ /dev/null
@@ -1,373 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef _NDN_CONTENT_OBJECT_HEADER_CCNB_H_
-#define _NDN_CONTENT_OBJECT_HEADER_CCNB_H_
-
-#include "ns3/integer.h"
-#include "ns3/header.h"
-#include "ns3/simple-ref-count.h"
-#include "ns3/trailer.h"
-#include "ns3/nstime.h"
-
-#include <string>
-#include <vector>
-#include <list>
-
-#include "ndn-name.h"
-
-namespace ns3 {
-namespace ndn {
-
-/**
- * Ndn XML definition of ContentObject
- *
- * Only few important fields are actually implemented in the simulation
- *
- *
- * ContentObject serializes/deserializes header up-to and including <Content> tags
- * Necessary closing tags should be added using ContentObjectTail
- *
- * This hacks are necessary to optimize memory use (i.e., virtual payload)
- *
- * "<ContentObject><Signature>..</Signature><Name>...</Name><SignedInfo>...</SignedInfo><Content>"
- *
- */
-class ContentObject : public SimpleRefCount<ContentObject,Header>
-{
-public:
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- /**
- * @brief Class representing Signature section of the content object
- */
- class Signature
- {
- public:
- /**
- * @brief Default constructor. Creates a fake-type signature
- */
- inline Signature ();
-
- /**
- * @brief Get digest algorithm
- */
- inline const std::string &
- GetDigestAlgorithm () const;
-
- /**
- * @brief Set digest algorithm
- */
- inline void
- SetDigestAlgorithm (const std::string &digestAlgorithm);
-
- /**
- * @brief Get signature bits
- */
- inline uint32_t
- GetSignatureBits () const;
-
- /**
- * @brief Set signature bits
- */
- inline void
- SetSignatureBits (uint32_t signatureBits);
-
- /**
- * @brief Default digest algorithm ("2.16.840.1.101.3.4.2.1")
- */
- static const std::string DefaultDigestAlgorithm; // = "2.16.840.1.101.3.4.2.1";
-
- private:
- std::string m_digestAlgorithm; // if value is `2.16.840.1.101.3.4.2.1`, then SHA-256 (not supported)
- // in NS-3 value `99.0` represents a fake digest
- // Witness // not used in NS-3
- uint32_t m_signatureBits; // in NS-3 a fake signature is a just 32-bits
- };
-
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
-
- /**
- * @brief Options for the data packet Type
- */
- enum ContentType
- {
- DATA = 0x0C04C0, // default value. If ContentObject is type of DATA, then ContentType tag will be omitted
- ENCR = 0x10D091,
- GONE = 0x18E344,
- KEY = 0x28463F,
- LINK = 0x2C834A,
- NACK = 0x34008A
- };
-
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
-
- /**
- * @brief Class representing SignedInfo section of the content object
- */
- class SignedInfo
- {
- public:
- /**
- * @brief Default constructor
- */
- SignedInfo ();
-
- /**
- * @brief Set PublisherPublicKey digest
- * @param digest a fake 32-bit digest is supported
- */
- void
- SetPublisherPublicKeyDigest (uint32_t digest);
-
- /**
- * @brief Get PublisherPublicKey digest
- */
- uint32_t
- GetPublisherPublicKeyDigest () const;
-
- /**
- * @brief Set content object timestamp
- * @param timestamp timestamp
- */
- void
- SetTimestamp (const Time ×tamp);
-
- /**
- * @brief Get timestamp of the content object
- */
- Time
- GetTimestamp () const;
-
- /**
- * @brief Set ContentObject type
- * @param type type of the content object
- */
- void
- SetContentType (ContentType type);
-
- /**
- * @brief Get ContentObject type
- */
- ContentType
- GetContentType () const;
-
- /**
- * @brief Set freshness of the content object
- * @param freshness Freshness, 0s means infinity
- */
- void
- SetFreshness (const Time &freshness);
-
- /**
- * @brief Get freshness of the content object
- */
- Time
- GetFreshness () const;
-
- /**
- * @brief Set key locator
- * @param keyLocator name of the key
- *
- * Note that only <KeyName> option for the key locator is supported
- */
- void
- SetKeyLocator (Ptr<const Name> keyLocator);
-
- /**
- * @brief Get key locator
- *
- * Note that only <KeyName> option for the key locator is supported
- */
- Ptr<const Name>
- GetKeyLocator () const;
-
- private:
- uint32_t m_publisherPublicKeyDigest; // fake publisher key digest
- Time m_timestamp;
- ContentType m_type;
- Time m_freshness;
- // FinalBlockID
- Ptr<const Name> m_keyLocator; // support only <KeyName> option for KeyLocator
- };
-
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
-
- /**
- * Constructor
- *
- * Creates a null header
- **/
- ContentObject ();
-
- /**
- * \brief Set content object name
- *
- * Sets name of the content object. For example, SetName( Name("prefix")("postfix") );
- **/
- void
- SetName (const Ptr<Name> &name);
-
- /**
- * @brief Get name of the content object
- */
- const Name&
- GetName () const;
-
- /**
- * @brief Get smart pointer to the interest name (to avoid extra memory usage)
- */
- Ptr<const Name>
- GetNamePtr () const;
-
- /**
- * @brief Get editable reference to content object's Signature
- */
- inline Signature &
- GetSignature ();
-
- /**
- * @brief Get read-only reference to content object's Signature
- */
- inline const Signature &
- GetSignature () const;
-
- /**
- * @brief Get editable reference to content object's SignedInfo
- */
- inline SignedInfo &
- GetSignedInfo ();
-
- /**
- * @brief Get read-only reference to content object's SignedInfo
- */
- inline const SignedInfo &
- GetSignedInfo () const;
-
- //////////////////////////////////////////////////////////////////
-
- static TypeId GetTypeId (void); ///< @brief Get TypeId
- virtual TypeId GetInstanceTypeId (void) const; ///< @brief Get TypeId of the instance
- virtual void Print (std::ostream &os) const; ///< @brief Print out information about the Header into the stream
- virtual uint32_t GetSerializedSize (void) const; ///< @brief Get size necessary to serialize the Header
- virtual void Serialize (Buffer::Iterator start) const; ///< @brief Serialize the Header
- virtual uint32_t Deserialize (Buffer::Iterator start); ///< @brief Deserialize the Header
-
-private:
- Signature m_signature;
- Ptr<Name> m_name;
- SignedInfo m_signedInfo;
-};
-
-/**
- * ContentObjectTail should always be 2 bytes, representing two closing tags:
- * "</Content><ContentObject>"
- */
-class ContentObjectTail : public Trailer
-{
-public:
- ContentObjectTail ();
- //////////////////////////////////////////////////////////////////
-
- static TypeId GetTypeId (void); ///< @brief Get TypeId
- virtual TypeId GetInstanceTypeId (void) const; ///< @brief Get TypeId of the instance
- virtual void Print (std::ostream &os) const; ///< @brief Print out information about Tail into the stream
- virtual uint32_t GetSerializedSize (void) const; ///< @brief Get size necessary to serialize the Tail
- virtual void Serialize (Buffer::Iterator start) const; ///< @brief Serialize the Tail
- virtual uint32_t Deserialize (Buffer::Iterator start); ///< @brief Deserialize the Tail
-};
-
-
-ContentObject::Signature::Signature ()
- : m_digestAlgorithm ("99.0")
- , m_signatureBits (0)
-{
-}
-
-const std::string &
-ContentObject::Signature::GetDigestAlgorithm () const
-{
- return m_digestAlgorithm;
-}
-
-void
-ContentObject::Signature::SetDigestAlgorithm (const std::string &digestAlgorithm)
-{
- m_digestAlgorithm = digestAlgorithm;
-}
-
-uint32_t
-ContentObject::Signature::GetSignatureBits () const
-{
- return m_signatureBits;
-}
-
-inline void
-ContentObject::Signature::SetSignatureBits (uint32_t signature)
-{
- m_signatureBits = signature;
-}
-
-
-ContentObject::Signature &
-ContentObject::GetSignature ()
-{
- return m_signature;
-}
-
-const ContentObject::Signature &
-ContentObject::GetSignature () const
-{
- return m_signature;
-}
-
-ContentObject::SignedInfo &
-ContentObject::GetSignedInfo ()
-{
- return m_signedInfo;
-}
-
-const ContentObject::SignedInfo &
-ContentObject::GetSignedInfo () const
-{
- return m_signedInfo;
-}
-
-/**
- * @ingroup ndn-exceptions
- * @brief Class for ContentObject parsing exception
- */
-class ContentObjectException {};
-
-} // namespace ndn
-} // namespace ns3
-
-#endif // _NDN_CONTENT_OBJECT_HEADER_CCNB_H_
diff --git a/disabled/ndn-decoding-helper.cc b/disabled/ndn-decoding-helper.cc
deleted file mode 100644
index 3984540..0000000
--- a/disabled/ndn-decoding-helper.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndn-decoding-helper.h"
-
-#include "ns3/ndn-interest-header.h"
-
-#include "ccnb-parser/visitors/interest-visitor.h"
-
-#include "ccnb-parser/syntax-tree/block.h"
-#include "ccnb-parser/syntax-tree/dtag.h"
-
-#include "ns3/log.h"
-
-NS_LOG_COMPONENT_DEFINE ("ndn.DecodingHelper");
-
-namespace ns3 {
-namespace ndn {
-
-size_t
-DecodingHelper::Deserialize (Buffer::Iterator start, Interest &interest)
-{
- static CcnbParser::InterestVisitor interestVisitor;
-
- Buffer::Iterator i = start;
- Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
- root->accept (interestVisitor, &interest);
-
- return i.GetDistanceFrom (start);
-}
-
-// size_t
-// NdnDecodingHelper::Deserialize (Buffer::Iterator start, NdnContentObject &contentObject)
-// {
-// static CcnbParser::ContentObjectVisitor contentObjectVisitor;
-
-// Buffer::Iterator i = start;
-// Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
-// root->accept (contentObjectVisitor, &contentObject);
-
-// return i.GetDistanceFrom (start);
-// }
-
-} // namespace ndn
-} // namespace ns3
diff --git a/disabled/ndn-decoding-helper.h b/disabled/ndn-decoding-helper.h
deleted file mode 100644
index 8a33be3..0000000
--- a/disabled/ndn-decoding-helper.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef _NDN_DECODING_HELPER_H_
-#define _NDN_DECODING_HELPER_H_
-
-#include <cstring>
-#include "ns3/buffer.h"
-
-namespace ns3 {
-namespace ndn {
-
-class Interest;
-class ContentObject;
-
-typedef Interest InterestHeader;
-typedef ContentObject ContentObjectHeader;
-
-/**
- * \brief Helper class to decode ccnb formatted Ndn message
- */
-class DecodingHelper
-{
-public:
- /**
- * \brief Deserialize Buffer::Iterator to NdnInterest
- * @param start Buffer containing serialized Ndn message
- * @param interest Pointer to the NdnInterest to hold deserialized value
- * @return Number of bytes used for deserialization
- */
- static size_t
- Deserialize (Buffer::Iterator start, Interest &interest);
-
- /**
- * \brief Deserialize Buffer::Iterator to NdnContentObject
- * @param start Buffer containing serialized Ndn message
- * @param contentObject Pointer to the NdnContentObject to hold deserialized value
- * @return Number of bytes used for deserialization
- */
- // static size_t
- // Deserialize (Buffer::Iterator start, ContentObject &contentObject);
-};
-
-} // namespace ndn
-} // namespace ns3
-
-#endif // _NDN_DECODING_HELPER_H_
diff --git a/disabled/ndn-encoding-helper.cc b/disabled/ndn-encoding-helper.cc
deleted file mode 100644
index 644ef7b..0000000
--- a/disabled/ndn-encoding-helper.cc
+++ /dev/null
@@ -1,352 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndn-encoding-helper.h"
-
-#include "ns3/ndn-name.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
-
-#include <sstream>
-#include <boost/foreach.hpp>
-
-namespace ns3 {
-namespace ndn {
-
-size_t
-EncodingHelper::Serialize (Buffer::Iterator start, const Interest &interest)
-{
- size_t written = 0;
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Interest, CcnbParser::CCN_DTAG); // <Interest>
-
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Name, CcnbParser::CCN_DTAG); // <Name>
- written += AppendName (start, interest.GetName()); // <Component>...</Component>...
- written += AppendCloser (start); // </Name>
-
- if (interest.GetMinSuffixComponents() >= 0)
- {
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_MinSuffixComponents, CcnbParser::CCN_DTAG);
- written += AppendNumber (start, interest.GetMinSuffixComponents ());
- written += AppendCloser (start);
- }
- if (interest.GetMaxSuffixComponents() >= 0)
- {
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_MaxSuffixComponents, CcnbParser::CCN_DTAG);
- written += AppendNumber (start, interest.GetMaxSuffixComponents ());
- written += AppendCloser (start);
- }
- if (interest.IsEnabledExclude() && interest.GetExclude().size() > 0)
- {
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Exclude, CcnbParser::CCN_DTAG); // <Exclude>
- written += AppendName (start, interest.GetExclude()); // <Component>...</Component>...
- written += AppendCloser (start); // </Exclude>
- }
- if (interest.IsEnabledChildSelector())
- {
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_ChildSelector, CcnbParser::CCN_DTAG);
- written += AppendNumber (start, 1);
- written += AppendCloser (start);
- }
- if (interest.IsEnabledAnswerOriginKind())
- {
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_AnswerOriginKind, CcnbParser::CCN_DTAG);
- written += AppendNumber (start, 1);
- written += AppendCloser (start);
- }
- if (interest.GetScope() >= 0)
- {
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Scope, CcnbParser::CCN_DTAG);
- written += AppendNumber (start, interest.GetScope ());
- written += AppendCloser (start);
- }
- if (!interest.GetInterestLifetime().IsZero())
- {
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_InterestLifetime, CcnbParser::CCN_DTAG);
- written += AppendTimestampBlob (start, interest.GetInterestLifetime ());
- written += AppendCloser (start);
- }
- if (interest.GetNonce()>0)
- {
- uint32_t nonce = interest.GetNonce();
- written += AppendTaggedBlob (start, CcnbParser::CCN_DTAG_Nonce, nonce);
- }
-
- if (interest.GetNack ()>0)
- {
- written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Nack, CcnbParser::CCN_DTAG);
- written += AppendNumber (start, interest.GetNack ());
- written += AppendCloser (start);
- }
- written += AppendCloser (start); // </Interest>
-
- return written;
-}
-
-size_t
-EncodingHelper::GetSerializedSize (const Interest &interest)
-{
- size_t written = 0;
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Interest); // <Interest>
-
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Name); // <Name>
- written += EstimateName (interest.GetName()); // <Component>...</Component>...
- written += 1; // </Name>
-
- if (interest.GetMinSuffixComponents() >= 0)
- {
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_MinSuffixComponents);
- written += EstimateNumber (interest.GetMinSuffixComponents ());
- written += 1;
- }
- if (interest.GetMaxSuffixComponents() >= 0)
- {
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_MaxSuffixComponents);
- written += EstimateNumber (interest.GetMaxSuffixComponents ());
- written += 1;
- }
- if (interest.IsEnabledExclude() && interest.GetExclude().size() > 0)
- {
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Exclude);
- written += EstimateName (interest.GetExclude()); // <Component>...</Component>...
- written += 1; // </Exclude>
- }
- if (interest.IsEnabledChildSelector())
- {
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_ChildSelector);
- written += EstimateNumber (1);
- written += 1;
- }
- if (interest.IsEnabledAnswerOriginKind())
- {
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_AnswerOriginKind);
- written += EstimateNumber (1);
- written += 1;
- }
- if (interest.GetScope() >= 0)
- {
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Scope);
- written += EstimateNumber (interest.GetScope ());
- written += 1;
- }
- if (!interest.GetInterestLifetime().IsZero())
- {
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_InterestLifetime);
- written += EstimateTimestampBlob (interest.GetInterestLifetime());
- written += 1;
- }
- if (interest.GetNonce()>0)
- {
- written += EstimateTaggedBlob (CcnbParser::CCN_DTAG_Nonce, sizeof(uint32_t));
- }
- if (interest.GetNack ()>0)
- {
- written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Nack);
- written += EstimateNumber (interest.GetNack ());
- written += 1;
- }
-
- written += 1; // </Interest>
-
- return written;
-}
-
-//////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////
-
-#define CCN_TT_BITS 3
-#define CCN_TT_MASK ((1 << CCN_TT_BITS) - 1)
-#define CCN_MAX_TINY ((1 << (7-CCN_TT_BITS)) - 1)
-#define CCN_TT_HBIT ((unsigned char)(1 << 7))
-
-size_t
-EncodingHelper::AppendBlockHeader (Buffer::Iterator &start, size_t val, CcnbParser::ccn_tt tt)
-{
- unsigned char buf[1+8*((sizeof(val)+6)/7)];
- unsigned char *p = &(buf[sizeof(buf)-1]);
- size_t n = 1;
- p[0] = (CCN_TT_HBIT & ~CcnbParser::CCN_CLOSE) |
- ((val & CCN_MAX_TINY) << CCN_TT_BITS) |
- (CCN_TT_MASK & tt);
- val >>= (7-CCN_TT_BITS);
- while (val != 0) {
- (--p)[0] = (((unsigned char)val) & ~CCN_TT_HBIT) | CcnbParser::CCN_CLOSE;
- n++;
- val >>= 7;
- }
- start.Write (p,n);
- return n;
-}
-
-size_t
-EncodingHelper::EstimateBlockHeader (size_t value)
-{
- value >>= (7-CCN_TT_BITS);
- size_t n = 1;
- while (value>0)
- {
- value >>= 7;
- n++;
- }
- return n;
-}
-
-size_t
-EncodingHelper::AppendNumber (Buffer::Iterator &start, uint32_t number)
-{
- std::ostringstream os;
- os << number;
-
- size_t written = 0;
- written += AppendBlockHeader (start, os.str().size(), CcnbParser::CCN_UDATA);
- written += os.str().size();
- start.Write (reinterpret_cast<const unsigned char*>(os.str().c_str()), os.str().size());
-
- return written;
-}
-
-size_t
-EncodingHelper::EstimateNumber (uint32_t number)
-{
- std::ostringstream os;
- os << number;
- return EstimateBlockHeader (os.str ().size ()) + os.str ().size ();
-}
-
-size_t
-EncodingHelper::AppendCloser (Buffer::Iterator &start)
-{
- start.WriteU8 (CcnbParser::CCN_CLOSE);
- return 1;
-}
-
-size_t
-EncodingHelper::AppendName (Buffer::Iterator &start, const Name &name)
-{
- size_t written = 0;
- BOOST_FOREACH (const std::string &component, name.GetComponents())
- {
- written += AppendTaggedBlob (start, CcnbParser::CCN_DTAG_Component,
- reinterpret_cast<const uint8_t*>(component.c_str()), component.size());
- }
- return written;
-}
-
-size_t
-EncodingHelper::EstimateName (const Name &name)
-{
- size_t written = 0;
- BOOST_FOREACH (const std::string &component, name.GetComponents())
- {
- written += EstimateTaggedBlob (CcnbParser::CCN_DTAG_Component, component.size());
- }
- return written;
-}
-
-size_t
-EncodingHelper::AppendTimestampBlob (Buffer::Iterator &start, const Time &time)
-{
- // the original function implements Markers... thought not sure what are these markers for...
-
- // Determine miminal number of bytes required to store the timestamp
- int required_bytes = 2; // 12 bits for fractions of a second, 4 bits left for seconds. Sometimes it is enough
- intmax_t ts = time.ToInteger (Time::S) >> 4;
- for (; required_bytes < 7 && ts != 0; ts >>= 8) // not more than 6 bytes?
- required_bytes++;
-
- size_t len = AppendBlockHeader(start, required_bytes, CcnbParser::CCN_BLOB);
-
- // write part with seconds
- ts = time.ToInteger (Time::S) >> 4;
- for (int i = 0; i < required_bytes - 2; i++)
- start.WriteU8 ( ts >> (8 * (required_bytes - 3 - i)) );
-
- /* arithmetic contortions are to avoid overflowing 31 bits */
- ts = ((time.ToInteger (Time::S) & 15) << 12) +
- (((time.ToInteger (Time::NS) % 1000000000) / 5 * 8 + 195312) / 390625);
- for (int i = required_bytes - 2; i < required_bytes; i++)
- start.WriteU8 ( ts >> (8 * (required_bytes - 1 - i)) );
-
- return len + required_bytes;
-}
-
-size_t
-EncodingHelper::EstimateTimestampBlob (const Time &time)
-{
- int required_bytes = 2; // 12 bits for fractions of a second, 4 bits left for seconds. Sometimes it is enough
- intmax_t ts = time.ToInteger (Time::S) >> 4;
- for (; required_bytes < 7 && ts != 0; ts >>= 8) // not more than 6 bytes?
- required_bytes++;
-
- return EstimateBlockHeader (required_bytes) + required_bytes;
-}
-
-size_t
-EncodingHelper::AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
- const uint8_t *data, size_t size)
-{
- size_t written = AppendBlockHeader (start, dtag, CcnbParser::CCN_DTAG);
- /* 2 */
- if (size>0)
- {
- written += AppendBlockHeader (start, size, CcnbParser::CCN_BLOB);
- start.Write (data, size);
- written += size;
- /* size */
- }
- written += AppendCloser (start);
- /* 1 */
-
- return written;
-}
-
-size_t
-EncodingHelper::EstimateTaggedBlob (CcnbParser::ccn_dtag dtag, size_t size)
-{
- if (size>0)
- return EstimateBlockHeader (dtag) + EstimateBlockHeader (size) + size + 1;
- else
- return EstimateBlockHeader (dtag) + 1;
-}
-
-size_t
-EncodingHelper::AppendString (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
- const std::string &string)
-{
- size_t written = AppendBlockHeader (start, dtag, CcnbParser::CCN_DTAG);
- {
- written += AppendBlockHeader (start, string.size (), CcnbParser::CCN_UDATA);
- start.Write (reinterpret_cast<const uint8_t*> (string.c_str ()), string.size ());
- written += string.size ();
- }
- written += AppendCloser (start);
-
- return written;
-}
-
-size_t
-EncodingHelper::EstimateString (CcnbParser::ccn_dtag dtag, const std::string &string)
-{
- return EstimateBlockHeader (dtag) + EstimateBlockHeader (string.size ()) + string.size () + 1;
-}
-
-
-} // namespace ndn
-} // namespace ns3
diff --git a/disabled/ndn-interest-header-ccnb.cc b/disabled/ndn-interest-header-ccnb.cc
deleted file mode 100644
index 1c4e3d6..0000000
--- a/disabled/ndn-interest-header-ccnb.cc
+++ /dev/null
@@ -1,296 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-///< #CCN_PR_SCOPE0 (0x20) local scope,
-///< #CCN_PR_SCOPE1 (0x40) this host,
-///< #CCN_PR_SCOPE2 (0x80) immediate neighborhood
-
-#include "ndn-interest-header-ccnb.h"
-
-#include "ns3/log.h"
-#include "ns3/unused.h"
-#include "ns3/packet.h"
-#include "../helper/ndn-encoding-helper.h"
-#include "../helper/ndn-decoding-helper.h"
-
-NS_LOG_COMPONENT_DEFINE ("ndn.Interest");
-
-namespace ns3 {
-namespace ndn {
-
-NS_OBJECT_ENSURE_REGISTERED (Interest);
-
-TypeId
-Interest::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::ndn::Interest")
- .SetGroupName ("Ndn")
- .SetParent<Header> ()
- .AddConstructor<Interest> ()
- ;
- return tid;
-}
-
-
-Interest::Interest ()
- : m_name ()
- , m_minSuffixComponents (-1)
- , m_maxSuffixComponents (-1)
- , m_exclude ()
- , m_childSelector (false)
- , m_answerOriginKind (false)
- , m_scope (-1)
- , m_interestLifetime (Seconds (0))
- , m_nonce (0)
- , m_nackType (NORMAL_INTEREST)
-{
-}
-
-Interest::Interest (const Interest &interest)
- : m_name (Create<Name> (interest.GetName ()))
- , m_minSuffixComponents (interest.m_minSuffixComponents)
- , m_maxSuffixComponents (interest.m_maxSuffixComponents)
- , m_exclude (interest.IsEnabledExclude () ? Create<Name> (interest.GetExclude ()) : 0)
- , m_childSelector (interest.m_childSelector)
- , m_answerOriginKind (interest.m_answerOriginKind)
- , m_scope (interest.m_scope)
- , m_interestLifetime (interest.m_interestLifetime)
- , m_nonce (interest.m_nonce)
- , m_nackType (interest.m_nackType)
-{
-}
-
-Ptr<Interest>
-Interest::GetInterest (Ptr<Packet> packet)
-{
- Ptr<Interest> interest = Create<Interest> ();
- packet->RemoveHeader (*interest);
-
- return interest;
-}
-
-void
-Interest::SetName (Ptr<Name> name)
-{
- m_name = name;
-}
-
-const Name&
-Interest::GetName () const
-{
- if (m_name==0) throw InterestException();
- return *m_name;
-}
-
-Ptr<const Name>
-Interest::GetNamePtr () const
-{
- return m_name;
-}
-
-void
-Interest::SetMinSuffixComponents (int32_t value)
-{
- m_minSuffixComponents = value;
-}
-
-int32_t
-Interest::GetMinSuffixComponents () const
-{
- return m_minSuffixComponents;
-}
-
-void
-Interest::SetMaxSuffixComponents (int32_t value)
-{
- m_maxSuffixComponents = value;
-}
-
-int32_t
-Interest::GetMaxSuffixComponents () const
-{
- return m_maxSuffixComponents;
-}
-
-void
-Interest::SetExclude (Ptr<Name> exclude)
-{
- m_exclude = exclude;
-}
-
-bool
-Interest::IsEnabledExclude () const
-{
- return m_exclude!=0;
-}
-
-const Name&
-Interest::GetExclude () const
-{
- if (m_exclude==0) throw InterestException();
- return *m_exclude;
-}
-
-void
-Interest::SetChildSelector (bool value)
-{
- m_childSelector = value;
-}
-
-bool
-Interest::IsEnabledChildSelector () const
-{
- return m_childSelector;
-}
-
-void
-Interest::SetAnswerOriginKind (bool value)
-{
- m_answerOriginKind = value;
-}
-
-bool
-Interest::IsEnabledAnswerOriginKind () const
-{
- return m_answerOriginKind;
-}
-
-void
-Interest::SetScope (int8_t scope)
-{
- m_scope = scope;
-}
-
-int8_t
-Interest::GetScope () const
-{
- return m_scope;
-}
-
-void
-Interest::SetInterestLifetime (Time lifetime)
-{
- m_interestLifetime = lifetime;
-}
-
-Time
-Interest::GetInterestLifetime () const
-{
- return m_interestLifetime;
-}
-
-void
-Interest::SetNonce (uint32_t nonce)
-{
- m_nonce = nonce;
-}
-
-uint32_t
-Interest::GetNonce () const
-{
- return m_nonce;
-}
-
-void
-Interest::SetNack (uint32_t nackType)
-{
- m_nackType = nackType;
-}
-
-uint32_t
-Interest::GetNack () const
-{
- return m_nackType;
-}
-
-uint32_t
-Interest::GetSerializedSize (void) const
-{
- // unfortunately, we don't know exact header size in advance
- return EncodingHelper::GetSerializedSize (*this);
-}
-
-void
-Interest::Serialize (Buffer::Iterator start) const
-{
- size_t size = EncodingHelper::Serialize (start, *this);
- NS_UNUSED (size);
- NS_LOG_INFO ("Serialize size = " << size);
-}
-
-uint32_t
-Interest::Deserialize (Buffer::Iterator start)
-{
- return DecodingHelper::Deserialize (start, *this); // \todo Debugging is necessary
-}
-
-TypeId
-Interest::GetInstanceTypeId (void) const
-{
- return GetTypeId ();
-}
-
-void
-Interest::Print (std::ostream &os) const
-{
- os << "I: " << GetName ();
-
- return;
- os << "<Interest>\n <Name>" << GetName () << "</Name>\n";
- if (GetNack ()>0)
- {
- os << " <NACK>";
- switch (GetNack ())
- {
- case NACK_LOOP:
- os << "loop";
- break;
- case NACK_CONGESTION:
- os << "congestion";
- break;
- default:
- os << "unknown";
- break;
- }
- os << "</NACK>\n";
- }
- if (GetMinSuffixComponents () >= 0)
- os << " <MinSuffixComponents>" << GetMinSuffixComponents () << "</MinSuffixComponents>\n";
- if (GetMaxSuffixComponents () >= 0)
- os << " <MaxSuffixComponents>" << m_maxSuffixComponents << "</MaxSuffixComponents>\n";
- if (IsEnabledExclude () && GetExclude ().size()>0)
- os << " <Exclude>" << GetExclude () << "</Exclude>\n";
- if (IsEnabledChildSelector ())
- os << " <ChildSelector />\n";
- if (IsEnabledAnswerOriginKind ())
- os << " <AnswerOriginKind />\n";
- if (GetScope () >= 0)
- os << " <Scope>" << GetScope () << "</Scope>\n";
- if ( !GetInterestLifetime ().IsZero() )
- os << " <InterestLifetime>" << GetInterestLifetime () << "</InterestLifetime>\n";
- if (GetNonce ()>0)
- os << " <Nonce>" << GetNonce () << "</Nonce>\n";
- os << "</Interest>";
-}
-
-} // namespace ndn
-} // namespace ns3
-
diff --git a/disabled/ndn-interest-header-ccnb.h b/disabled/ndn-interest-header-ccnb.h
deleted file mode 100644
index 1daa7d1..0000000
--- a/disabled/ndn-interest-header-ccnb.h
+++ /dev/null
@@ -1,419 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef _NDN_INTEREST_HEADER_CCNB_H_
-#define _NDN_INTEREST_HEADER_CCNB_H_
-
-#include "ns3/integer.h"
-#include "ns3/header.h"
-#include "ns3/simple-ref-count.h"
-#include "ns3/nstime.h"
-
-#include <string>
-#include <vector>
-#include <list>
-
-#include "ndn-name.h"
-
-namespace ns3 {
-
-class Packet;
-
-namespace ndn {
-
-/**
- * Ndn XML definition of Interest
- *
- * Only few important fields are actually implemented in the simulation
- *
- * <xs:element name="Interest" type="InterestType"/>
- * <xs:complexType name="InterestType">
- * <xs:sequence>
- * <xs:element name="Name" type="NameType"/>
- * <xs:element name="MinSuffixComponents" type="xs:nonNegativeInteger"
- * minOccurs="0" maxOccurs="1"/>
- * <xs:element name="MaxSuffixComponents" type="xs:nonNegativeInteger"
- * minOccurs="0" maxOccurs="1"/>
- * <xs:choice minOccurs="0" maxOccurs="1">
- * <xs:element name="PublisherPublicKeyDigest" type="DigestType"/>
- * <xs:element name="PublisherCertificateDigest" type="DigestType"/>
- * <xs:element name="PublisherIssuerKeyDigest" type="DigestType"/>
- * <xs:element name="PublisherIssuerCertificateDigest" type="DigestType"/>
- * </xs:choice>
- * <xs:element name="Exclude" type="ExcludeType"
- * minOccurs="0" maxOccurs="1"/>
- * <xs:element name="ChildSelector" type="xs:nonNegativeInteger"
- * minOccurs="0" maxOccurs="1"/>
- * <xs:element name="AnswerOriginKind" type="xs:nonNegativeInteger"
- * minOccurs="0" maxOccurs="1"/>
- * <xs:element name="Scope" type="xs:nonNegativeInteger"
- * minOccurs="0" maxOccurs="1"/>
- * <xs:element name="InterestLifetime" type="FinegrainLifetimeType"
- * minOccurs="0" maxOccurs="1"/>
- * <xs:element name="Nonce" type="Base64BinaryType"
- * minOccurs="0" maxOccurs="1"/>
- * </xs:sequence>
- * </xs:complexType>
- *
- * <xs:complexType name="NameType">
- * <xs:sequence>
- * <xs:element name="Component" type="Base64BinaryType"
- * minOccurs="0" maxOccurs="unbounded"/>
- * </xs:sequence>
- * </xs:complexType>
- *
- * <xs:complexType name="ExcludeType">
- * <xs:sequence>
- * <xs:choice minOccurs="0" maxOccurs="1">
- * <xs:element name="Any" type="EmptyType"/>
- * <xs:element name="Bloom" type="Base64BinaryType"/> <!-- Bloom is deprecated --!>
- * </xs:choice>
- * <xs:sequence minOccurs="0" maxOccurs="unbounded">
- * <xs:element name="Component" type="Base64BinaryType"/>
- * <xs:choice minOccurs="0" maxOccurs="1">
- * <xs:element name="Any" type="EmptyType"/>
- * <xs:element name="Bloom" type="Base64BinaryType"/> <!-- Bloom is deprecated --!>
- * </xs:choice>
- * </xs:sequence>
- * </xs:sequence>
- * </xs:complexType>
- *
- * <!-- Binary representation of time, Unix time epoch, units 2**-12 sec (0.000244140625 sec) -->
- * <!-- The length limit limit of 6 bytes is not actually to be enforced, but
- * it will be a loooooooong time before anyone cares. -->
- *
- * <!-- Binary representation of relative time, relative to "now" -->
- * <xs:complexType name="FinegrainLifetimeType">
- * <xs:simpleContent>
- * <xs:extension base="BinaryTime12">
- * <xs:attribute name="ccnbencoding" type="xs:string" fixed="base64Binary"/>
- * </xs:extension>
- * </xs:simpleContent>
- * </xs:complexType>
- *
- * <xs:simpleType name="BinaryTime12">
- * <xs:restriction base="xs:base64Binary">
- * <xs:length value="6" fixed="true"/>
- * </xs:restriction>
- * </xs:simpleType>
- *
- **/
-
-/**
- * @brief NDN Interest and routines to serialize/deserialize
- *
- * Simplifications:
- * - Name: binary name components are not supported
- * - MinSuffixComponents and MasSuffixComponents: if value is negative (default), will not be serialized
- * - ChildSelector, AnswerOriginKind: 0 - false, 1 - true, -1 not set
- * - Publisher* elements are not supported
- * - Exclude: only simple name matching is supported (Bloom support has been deprecated in Ndn)
- * - InterestLifetime: ?
- * - Nonce: 32 bit random integer. If value is 0, will not be serialized
- **/
-class Interest : public SimpleRefCount<Interest, Header>
-{
-public:
- /**
- * \brief Constructor
- *
- * Creates a null header
- **/
- Interest ();
-
- /**
- * @brief Copy constructor
- */
- Interest (const Interest &interest);
-
- /**
- * \brief Set interest name
- *
- * Sets name of the interest. For example, SetName( ndnName("prefix")("postfix") );
- * @param[in] name const pointer to ndnName object that contains an interest name
- **/
- void
- SetName (Ptr<Name> name);
-
-
- /**
- * \brief Get interest name
- *
- * Gets name of the interest.
- **/
- const Name&
- GetName () const;
-
- /**
- * @brief Get smart pointer to the interest name (to avoid extra memory usage)
- */
- Ptr<const Name>
- GetNamePtr () const;
-
- /**
- * \brief Set interest MinSuffixComponents
- *
- * MinSuffixComponents refer to the number of name components beyond those in the prefix,
- * and counting the implicit digest, that may occur in the matching ContentObject.
- * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
- * @param[in] value minimum length of suffix components
- **/
- void
- SetMinSuffixComponents (int32_t value);
-
- /**
- * \brief Get interest MinSuffixComponents
- *
- * MinSuffixComponents refer to the number of name components beyond those in the prefix,
- * and counting the implicit digest, that may occur in the matching ContentObject.
- * For more information, see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html
- **/
- int32_t
- GetMinSuffixComponents () const;
-
-
- /**
- * \brief Set interest MaxSuffixComponents
- *
- * MaxSuffixComponents refer to the number of name components beyond those in the prefix,
- * and counting the implicit digest, that may occur in the matching ContentObject.
- * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
- * @param[in] value maximum length of suffix components
- **/
- void
- SetMaxSuffixComponents (int32_t value);
-
- /**
- * \brief Get interest MaxSuffixComponents
- *
- * MaxSuffixComponents refer to the number of name components beyond those in the prefix,
- * and counting the implicit digest, that may occur in the matching ContentObject.
- * For more information, see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html
- **/
- int32_t
- GetMaxSuffixComponents () const;
-
- /**
- * \brief Set exclude filer
- *
- * For example, SetExclude (ndnName("exclude1")("exclude2")("exclude3"))
- * @param[in] exclude const pointer to ndnName to be excluded
- **/
- void
- SetExclude (Ptr<Name> exclude);
-
- /**
- * \brief Check if interest conatins exclude filter
- *
- */
- bool
- IsEnabledExclude () const;
-
- /**
- * \brief Get exclude filter
- */
- const Name&
- GetExclude () const;
-
- /**
- * \brief Set ChildSelector
- * Often a given interest will match more than one ContentObject within a given content store.
- * The ChildSelector provides a way of expressing a preference for which of these should be returned.
- * If the value is false, the leftmost child is preferred. If true, the rightmost child is preferred.
- * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
- * @param[in] value boolean ChildSelector value
- */
- void
- SetChildSelector (bool value);
-
- /**
- * \brief Return ChildSelector value
- * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
- *
- */
- bool
- IsEnabledChildSelector () const;
-
- /**
- * \brief Set AnswerOriginKind
- * Default value for AnswerOriginKind is false.
- * @param[in] value boolean AnswerOriginKind value
- */
- void
- SetAnswerOriginKind (bool value);
-
- /**
- * \brief Check the value of AnswerOriginKind
- *
- */
- bool
- IsEnabledAnswerOriginKind () const;
-
- /**
- * \brief Set Scope
- * Scope limits where the Interest may propagate.
- * Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host).
- * Scope 1 limits propagation to the applications on the originating host.
- * Scope 2 limits propagation to no further than the next host.
- * Other values are not defined, and will cause the Interest message to be dropped.
- * Note that this is not a hop count - the value is not decremented as the interest is forwarded.
- * @param[in] scope interest scope
- */
- void
- SetScope (int8_t scope);
-
- /**
- * \brief Get Scope value
- * Scope limits where the Interest may propagate.
- * Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host).
- * Scope 1 limits propagation to the applications on the originating host.
- * Scope 2 limits propagation to no further than the next host.
- * Other values are not defined, and will cause the Interest message to be dropped.
- * Note that this is not a hop count - the value is not decremented as the interest is forwarded.
- */
- int8_t
- GetScope () const;
-
- /**
- * \brief Set InterestLifetime
- * InterestLifetime indicates the (approximate) time remaining before the interest times out.
- * The timeout is relative to the arrival time of the interest at the current node.
- * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
- * @param[in] time interest lifetime
- */
- void
- SetInterestLifetime (Time time);
-
- /**
- * \brief Get InterestLifetime value
- * InterestLifetime indicates the (approximate) time remaining before the interest times out.
- * The timeout is relative to the arrival time of the interest at the current node.
- * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
- */
- Time
- GetInterestLifetime () const;
-
- /**
- * \brief Set Nonce
- * Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages.
- * @param[in] nonce Unique packet identification number
- */
- void
- SetNonce (uint32_t nonce);
-
- /**
- * \brief Get Nonce value
- * Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages.
- *
- */
- uint32_t
- GetNonce () const;
-
- /**
- * @brief NACK Type
- * Specifies the type of Interest packet
- */
- enum
- {
- NORMAL_INTEREST = 0,
- NACK_LOOP = 10,
- NACK_CONGESTION = 11,
- NACK_GIVEUP_PIT = 12,
- };
-
- /**
- * \brief Mark the Interest as a Negative Acknowledgement
- * Three types of NACKs are supported
- * 1. NACK_LOOP
- * 2. NACK_CONGESTION
- * 3. NACK_GIVEUP_PIT
- * @param[in] nackType NACK_LOOP or NACK_CONGESTION or NACK_GIVEUP_PIT or NORMAL_INTEREST
- */
- void
- SetNack (uint32_t nackType);
-
- /**
- * \brief Get NACK type
- * Returns NACK_LOOP, NACK_CONGESTION or NACK_GIVEUP_PIT.
- * Otherwise, in case of normal interest packet, returns NORMAL_INTEREST (equals 0).
- */
- uint32_t
- GetNack () const;
-
- //////////////////////////////////////////////////////////////////
-
- static TypeId GetTypeId (void); ///< @brief Get TypeId of the class
- virtual TypeId GetInstanceTypeId (void) const; ///< @brief Get TypeId of the instance
-
- /**
- * \brief Print Interest packet
- */
- virtual void Print (std::ostream &os) const;
-
- /**
- * \brief Get the size of Interest packet
- * Returns the Interest packet size after serialization
- */
- virtual uint32_t GetSerializedSize (void) const;
-
- /**
- * \brief Serialize Interest packet
- * Serializes Interest packet into Buffer::Iterator
- * @param[in] start buffer to contain serialized Interest packet
- */
- virtual void Serialize (Buffer::Iterator start) const;
-
- /**
- * \brief Deserialize Interest packet
- * Deserializes Buffer::Iterator into Interest packet
- * @param[in] start buffer that contains serialized Interest packet
- */
- virtual uint32_t Deserialize (Buffer::Iterator start);
-
- /**
- * @brief Cheat for python bindings
- */
- static Ptr<Interest>
- GetInterest (Ptr<Packet> packet);
-
-private:
- Ptr<Name> m_name; ///< Interest name
- int32_t m_minSuffixComponents; ///< Minimum suffix components. not used if negative
- int32_t m_maxSuffixComponents; ///< Maximum suffix components. not used if negative
- Ptr<Name> m_exclude; ///< Exclude filter
- bool m_childSelector; ///< Default value for ChildSelector is false
- bool m_answerOriginKind; ///< Default value for AnswerOriginKind is false
- int8_t m_scope; ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood
- Time m_interestLifetime; ///< InterestLifetime
- uint32_t m_nonce; ///< Nonce. not used if zero
- uint32_t m_nackType; ///< Negative Acknowledgement type
-};
-
-/**
- * @ingroup ndn-exceptions
- * @brief Class for Interest parsing exception
- */
-class InterestException {};
-
-} // namespace ndn
-} // namespace ns3
-
-#endif // _NDN_INTEREST_HEADER_CCNB_H_
diff --git a/docs/source/examples.rst b/docs/source/examples.rst
index be27f0b..41142c9 100644
--- a/docs/source/examples.rst
+++ b/docs/source/examples.rst
@@ -6,6 +6,9 @@
.. note::
:red:`!!! This page only shows up examples of how to config topology and perform basic operations in ndnSIM (an example equivalent to "Hello, world1") !!! These are **NOT** examples of real experimentations (just like "Hello, world!" is not a real program).`
+.. note::
+ If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder.
+
.. _simple-scenario:
Simple scenario
@@ -46,6 +49,9 @@
NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-simple
+.. note::
+ If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder.
+
.. _9-node-grid-example:
9-node grid example
@@ -95,6 +101,9 @@
NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-grid
+.. note::
+ If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder.
+
.. _9-node-grid-example-using-topology-plugin:
9-node grid example using topology plugin
@@ -155,6 +164,8 @@
NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-grid-topo-plugin
+.. note::
+ If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder.
6-node bottleneck topology
--------------------------
@@ -195,6 +206,9 @@
NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-congestion-topo-plugin
+.. note::
+ If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder.
+
.. _11-node 2-bottleneck topology with custom forwarding strategy:
11-node 2-bottleneck topology with custom forwarding strategy
@@ -260,6 +274,9 @@
./waf --run=ndn-congestion-alt-topo-plugin --visualize
+.. note::
+ If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder.
+
3-level binary tree with packet-level trace helpers
---------------------------------------------------
@@ -309,6 +326,33 @@
tcpdump -r ndn-simple-trace.pcap
+.. note::
+ If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder.
+
+.. _Simple scenario with link failures:
+
+Simple scenario with link failures
+----------------------------------
+
+The following example (``ndn-simple-with-link-failure.cc``) shows how to "fail" links in ndnSIM simulation.
+The basic idea is to set ndn::Faces that correspond to the failed link to DOWN state.
+ndnSIM now includes a simple helper that simplifies this process.
+
+.. literalinclude:: ../../examples/ndn-simple-with-link-failure.cc
+ :language: c++
+ :linenos:
+ :lines: 21-31,52-
+ :emphasize-lines: 54-56
+
+If this code is placed into ``scratch/ndn-simple-with-link-failure.cc`` and NS-3 is compiled in debug mode, you can run and see progress of the
+simulation using the following command (in optimized mode nothing will be printed out)::
+
+ NS_LOG=ndn.Consumer:ndn.Producer:ndn.LinkControlHelper ./waf --run=ndn-simple-with-link-failure
+
+.. note::
+ If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder.
+
+
25-node tree topology with L2Tracer
-----------------------------------
diff --git a/docs/source/faq.rst b/docs/source/faq.rst
index c660492..a7ce4bd 100644
--- a/docs/source/faq.rst
+++ b/docs/source/faq.rst
@@ -133,47 +133,7 @@
Right now, NS-3 does not provide ability to actually "break" the link between nodes in NS-3.
However, exactly the same effect can be achieved by making an interface (:ndnsim:`ndn::Face`) up or down (:ndnsim:`ndn::Face::SetUp(true)` or :ndnsim:`ndn::Face::SetUp(false)`).
-Here is an example of function to "fail" a point-to-point link between two NDN nodes:
-
-.. code-block:: c++
-
- // hijacker is more than an application. just disable all faces
- void
- FailLinks (Ptr<Node> node1, Ptr<Node> node2)
- {
- Ptr<ndn::L3Protocol> ndn1 = node1->GetObject<ndn::L3Protocol> ();
- Ptr<ndn::L3Protocol> ndn2 = node2->GetObject<ndn::L3Protocol> ();
-
- // iterate over all faces to find the right one
- for (uint32_t faceId = 0; faceId < ndn1->GetNFaces (); faceId++)
- {
- Ptr<ndn::NetDeviceFace> ndFace = ndn1->GetFace (faceId)->GetObject<ndn::NetDeviceFace> ();
- if (ndFace == 0) continue;
-
- Ptr<PointToPointNetDevice> nd1 = ndFace->GetNetDevice ()->GetObject<PointToPointNetDevice> ();
- if (nd1 == 0) continue;
-
- Ptr<Channel> channel = nd1->GetChannel ();
- if (channel == 0) continue;
-
- Ptr<PointToPointChannel> ppChannel = DynamicCast<PointToPointChannel> (channel);
-
- Ptr<NetDevice> nd2 = ppChannel->GetDevice (0);
- if (nd2->GetNode () == node1)
- nd2 = ppChannel->GetDevice (1);
-
- if (nd2->GetNode () == node2)
- {
- Ptr<ndn::Face> face1 = ndn1->GetFaceByNetDevice (nd1);
- Ptr<ndn::Face> face2 = ndn2->GetFaceByNetDevice (nd2);
-
- face1->SetUp (false);
- face2->SetUp (false);
- break;
- }
- }
- }
-
+You can use :ndnsim:`ndn::LinkControlHelper` to schedule failing links. For example, refer to :ref:`Simple scenario with link failures` example.
General questions
-----------------
diff --git a/docs/source/getting-started.rst b/docs/source/getting-started.rst
index ef30fb6..262530d 100644
--- a/docs/source/getting-started.rst
+++ b/docs/source/getting-started.rst
@@ -161,7 +161,7 @@
While it is possible to write simulations directly inside NS-3 (in ``scratch/`` folder) or ndnSIM (in ``examples/``), the recommended way is to write your simulation scenarios, as well as any custom extensions, separately from the NS-3 or ndnSIM core.
-For example, you can you can use the following template to write your extensions, simulation scenarios, and metric processing scripts: `<http://github.com/cawka/ndnSIM-scenario-template>`_:
+For example, you can use the following template to write your extensions, simulation scenarios, and metric processing scripts: `<http://github.com/cawka/ndnSIM-scenario-template>`_:
.. code-block:: bash
diff --git a/docs/source/ndnsim-packet-formats.rst b/docs/source/ndnsim-packet-formats.rst
index cde727b..666eca0 100644
--- a/docs/source/ndnsim-packet-formats.rst
+++ b/docs/source/ndnsim-packet-formats.rst
@@ -170,11 +170,31 @@
::
- Selectors ::= Length (Selector)*
+ Selectors ::= Length (SelectorType Selector)*
+
+ SelectorType ::= uint8_t
Selector ::= MinSuffixComponents | MaxSuffixComponents | Publisher | Exclude | ChildSelector | AnswerOriginKind
-All selectors are for now undefined
+Currently, ndnSIM defines following SelectorTypes:
+
+- 0x01: Exclude
+
+Other types are currently undefined
+
+Exclude
+~~~~~~~
+
+::
+
+ Exclude ::= Length (ExcludeComponent)*
+
+ ExcludeComponent ::= ExcludeNameType NameComponent ExcludeAnyType? |
+ ExcludeAnyType
+
+ ExcludeNameType ::= uint8_t (==0x01)
+
+ ExcludeAnyType ::= uint8_t (==0x02)
Options
~~~~~~~
diff --git a/docs/source/ndnsim-research-papers.rst b/docs/source/ndnsim-research-papers.rst
index 7c8becc..d22e59e 100644
--- a/docs/source/ndnsim-research-papers.rst
+++ b/docs/source/ndnsim-research-papers.rst
@@ -12,25 +12,25 @@
- **A. Afanasyev, I. Moiseenko, and L. Zhang, "ndnSIM: NDN simulator for NS-3," NDN, Technical Report NDN-0005, 2012** (`PDF <http://named-data.net/techreport/TR005-ndnsim.pdf>`_, `BibTex <http://lasr.cs.ucla.edu/afanasyev/bibwiki/bibtex/367>`_)
Named Data Networking (NDN) is a newly proposed Internet architecture.
- NDN retains the Internet's hourglass architecture but evolves the thin waist.
- Instead of pushing data to specific locations, NDN retrieves data by name.
- On one hand, this simple change allows NDN networks to use almost all of the Internet's well tested engineering properties to solve not only IP's communication problems but also digital distribution and control problems.
- On the other hand, a distribution architecture differs in fundamental ways from a point-to-point communication architecture of today's Internet and raises many new research challenges.
- Simulation can serve as a flexible tool to examine and evaluate various aspects of this new architecture.
- To provide the research community at large with a common simulation platform, we have developed an open source NS-3 based simulator, ndnSIM, which faithfully implemented the basic components of a NDN network in a modular way.
+ NDN retains the Internet's hourglass architecture but evolves the thin waist.
+ Instead of pushing data to specific locations, NDN retrieves data by name.
+ On one hand, this simple change allows NDN networks to use almost all of the Internet's well tested engineering properties to solve not only IP's communication problems but also digital distribution and control problems.
+ On the other hand, a distribution architecture differs in fundamental ways from a point-to-point communication architecture of today's Internet and raises many new research challenges.
+ Simulation can serve as a flexible tool to examine and evaluate various aspects of this new architecture.
+ To provide the research community at large with a common simulation platform, we have developed an open source NS-3 based simulator, ndnSIM, which faithfully implemented the basic components of a NDN network in a modular way.
This paper provides an overview of ndnSIM.
-
+
Research papers that use ndnSIM
-------------------------------
- **L. Wang, A. Afanasyev, R. Kuntz, R. Vuyyuru, R. Wakikawa, and L. Zhang, "Rapid Traffic Information Dissemination Using Named Data," in Proceedings of the 1st ACM workshop on Emerging Name-Oriented Mobile Networking Design - Architecture, Algorithms, and Applications (NoM'12), Hilton Head Island, South Carolina, June 2012, pp. 7–12.** (`PDF <http://lasr.cs.ucla.edu/afanasyev/data/files/Wang/nom.pdf>`_, `BibTex <http://lasr.cs.ucla.edu/afanasyev/bibwiki/bibtex/365>`_, `simulation code <https://github.com/cawka/ndnSIM-nom-rapid-car2car>`_)
- Our previous work applied the Named Data Networking approach to vehicle-to-vehicle (V2V) communications and developed a simple design for traffic information dissemination applications. This paper uses simulations to evaluate the feasibility of the design as described in [1].
- Our results show that data names can greatly facilitate the forwarding process for Interest and data packets.
+ Our previous work applied the Named Data Networking approach to vehicle-to-vehicle (V2V) communications and developed a simple design for traffic information dissemination applications. This paper uses simulations to evaluate the feasibility of the design as described in [1].
+ Our results show that data names can greatly facilitate the forwarding process for Interest and data packets.
With adequate vehicle density, data can propagate over long distances robustly at tens of kilometers per second and a requester can retrieve the desired traffic information 10km away in a matter of seconds.
-- **Z. Zhu, C. Bian, A. Afanasyev, V. Jacobson, and L. Zhang, "Chronos: Serverless Multi-User Chat Over NDN," NDN, Technical Report NDN-0008, 2012.** (`PDF <http://named-data.net/techreport/TR008-chronos.pdf>`_, `BibTex <http://lasr.cs.ucla.edu/afanasyev/bibwiki/bibtex/371>`_)
+- **Z. Zhu, C. Bian, A. Afanasyev, V. Jacobson, and L. Zhang, "Chronos: Serverless Multi-User Chat Over NDN," NDN, Technical Report NDN-0008, 2012.** (`PDF <http://named-data.net/techreport/TR008-chronos.pdf>`_, `BibTex <http://lasr.cs.ucla.edu/afanasyev/bibwiki/bibtex/371>`_)
Multi-user applications are commonly implemented using a centralized server.
This paper presents a new design for multi-user chat applications (Chronos) that works in a distributed, serverless fashion over Named Data Networking.
@@ -47,45 +47,57 @@
- **C. Yi, A. Afanasyev, I. Moiseenko, L. Wang, B. Zhang, and L. Zhang, "A Case for Stateful Forwarding Plane," Computer Communications, vol. 36, no. 7, pp. 779–791, 2013. ISSN 0140-3664** (`PDF <http://lasr.cs.ucla.edu/afanasyev/data/files/Yi/comcom-stateful-forwarding.pdf>`_, `BibTex <http://lasr.cs.ucla.edu/afanasyev/bibwiki/bibtex/380>`_, `simulation code <https://github.com/cawka/ndnSIM-comcom-stateful-fw>`_)
- In Named Data Networking (NDN), packets carry data names instead of source and destination addresses.
+ In Named Data Networking (NDN), packets carry data names instead of source and destination addresses.
This paradigm shift leads to a new network forwarding plane: data consumers send *Interest* packets to request desired data, routers forward Interest packets and maintain the state of all pending Interests, which is then used to guide *Data* packets back to the consumers.
Maintaining the pending Interest state, together with the two-way Interest and Data exchange, enables NDN routers' *forwarding* process to measure performance of different paths, quickly detect failures and retry alternative paths.
In this paper we describe an initial design of NDN's forwarding plane and evaluate its data delivery performance under adverse conditions.
- Our results show that this stateful forwarding plane can successfully circumvent prefix hijackers, avoid failed links, and utilize multiple paths to mitigate congestion.
+ Our results show that this stateful forwarding plane can successfully circumvent prefix hijackers, avoid failed links, and utilize multiple paths to mitigate congestion.
We also compare NDN's performance with that of IP-based solutions to highlight the advantages of a stateful forwarding plane.
- **A. Afanasyev, P. Mahadevan, I. Moiseenko, E. Uzun, and L. Zhang, "Interest Flooding Attack and Countermeasures in Named Data Networking," in Proc. of IFIP Networking 2013, May 2013.** (`PDF <http://lasr.cs.ucla.edu/afanasyev/data/files/Afanasyev/ifip-interest-flooding-ndn.pdf>`_, `BibTex <http://lasr.cs.ucla.edu/afanasyev/bibwiki/bibtex/381>`_, `simulation code <https://github.com/cawka/ndnSIM-ddos-interest-flooding>`_)
- Distributed Denial of Service (DDoS) attacks are an ongoing problem in today's Internet, where packets from a large number of compromised hosts thwart the paths to the victim site and/or overload the victim machines.
- In a newly proposed future Internet architecture, Named Data Networking (NDN), end users request desired data by sending Interest packets, and the network delivers Data packets upon request only, effectively eliminating many existing DDoS attacks.
- However, an NDN network can be subject to a new type of DDoS attack, namely Interest packet flooding.
+ Distributed Denial of Service (DDoS) attacks are an ongoing problem in today's Internet, where packets from a large number of compromised hosts thwart the paths to the victim site and/or overload the victim machines.
+ In a newly proposed future Internet architecture, Named Data Networking (NDN), end users request desired data by sending Interest packets, and the network delivers Data packets upon request only, effectively eliminating many existing DDoS attacks.
+ However, an NDN network can be subject to a new type of DDoS attack, namely Interest packet flooding.
In this paper we investigate effective solutions to mitigate Interest flooding.
We show that NDN's inherent properties of storing per packet state on each router and maintaining flow balance (i.e., one Interest packet retrieves at most one Data packet) provides the basis for effective DDoS mitigation algorithms.
Our evaluation through simulations shows that the solution can quickly and effectively respond and mitigate Interest flooding.
- **B. Zhou, C. Wu, X. Hong, and M. Jiang, "Algorithms for Distributed Programmable Controllers", Technical Report, March 2013.** (`PDF <http://hong.cs.ua.edu/DCP-techReport-March2013.pdf>`_)
- A few works on SDN (Software-Defined Networking) like those in Onix improve programmability of the distributed network control.
- The asynchronism and Byzantine issues of the control challenge the re-configurability of the service that is to safely program the control in atomic so as to avoid the transient control issues like the routing loops and black holes.
+ A few works on SDN (Software-Defined Networking) like those in Onix improve programmability of the distributed network control.
+ The asynchronism and Byzantine issues of the control challenge the re-configurability of the service that is to safely program the control in atomic so as to avoid the transient control issues like the routing loops and black holes.
We propose two important algorithms of the distributed control to enable the programmability: (1) the reconfiguration primitive allows the network control of the services being able to safely react to an external event; and (2) the reuse primitive allows the control states of a service being accessible for all services. We give concepts and algorithms of two primitives.
- In addition, we provide the concrete cases of the current approaches for ICN (Information-Centric Networking) and CDN (Content Distribution Networks) for quests of the reconfigurability and programmability.
- Then, we evaluate the performance of ICN in both simulation and the PlanetLab testbed.
- The evaluation results show that the layer improves the lowers 19.6% of the Interest delays in the ICN that is heavily congested and lowers 97% delays in the PlanetLab with 9 nodes on usual case.
+ In addition, we provide the concrete cases of the current approaches for ICN (Information-Centric Networking) and CDN (Content Distribution Networks) for quests of the reconfigurability and programmability.
+ Then, we evaluate the performance of ICN in both simulation and the PlanetLab testbed.
+ The evaluation results show that the layer improves the lowers 19.6% of the Interest delays in the ICN that is heavily congested and lowers 97% delays in the PlanetLab with 9 nodes on usual case.
In addition, the evaluation of CDN on the PlanetLab shows that it reduces 81% request delay on usual case.
- **M. Tortelli, L. A. Grieco, and G. Boggia, "Performance Assessment of Routing Strategies in Named Data Networking", in Proc. of GTTI 2013 Session on Telecommunication Networks, 2013** (`PDF <http://www.gtti.it/GTTI13/papers/Tortelli_et_al_GTTI2013.pdf>`_)
- Information Centric Networking (ICN) architectures are currently being investigated to orient the Future Internet towards a content centric paradigm, thus allowing the provisioning of more secure, efficient, and scalable services.
- In this work, we focus on the Named Data Networking (NDN) proposal to analyze the impact of several routing and forwarding strategies, which play a fundamental role in ICN.
- In particular, thanks to the recently devised ns-3 based NDN simulator, namely ndnSIM, we conduce an extensive simulation campaign using the GEANT topology as a core network.
- We monitor different distinctive metrics, such as file download time, server load reduction, hit ratio, hit distance, and communication overhead, in different topologies and traffic conditions.
- Simulation results show that the election of a single best forwarding strategy is a difficult task.
+ Information Centric Networking (ICN) architectures are currently being investigated to orient the Future Internet towards a content centric paradigm, thus allowing the provisioning of more secure, efficient, and scalable services.
+ In this work, we focus on the Named Data Networking (NDN) proposal to analyze the impact of several routing and forwarding strategies, which play a fundamental role in ICN.
+ In particular, thanks to the recently devised ns-3 based NDN simulator, namely ndnSIM, we conduce an extensive simulation campaign using the GEANT topology as a core network.
+ We monitor different distinctive metrics, such as file download time, server load reduction, hit ratio, hit distance, and communication overhead, in different topologies and traffic conditions.
+ Simulation results show that the election of a single best forwarding strategy is a difficult task.
Indeed, the pros and cons of each strategy are heavily influenced by the popularity distribution of contents, which, in turn, affects the effectiveness of the distributed caching mechanisms typically used in the NDN architecture.
-- **, "Secure and Efficient Context Data Collection using Content-Centric Networking", in Proc. of International Workshop on Smart Communication Protocols and Algorithms (SCPA), 2013** (`PDF <http://dpnm.postech.ac.kr/papers/SCPA/13/sesise/scpa13.pdf>`_)
+- **S. Seo, J.-M. Kang, A. Leon-Garcia, Y. Han, and J. W.-K. Hong, "Secure and Efficient Context Data Collection using Content-Centric Networking", in Proc. of International Workshop on Smart Communication Protocols and Algorithms (SCPA), 2013** (`PDF <http://dpnm.postech.ac.kr/papers/SCPA/13/sesise/scpa13.pdf>`_)
- Context data collection is a fundamental and important process for realizing context-aware recommender or personalization systems.
- The existing context data collection approaches are based-on traditional TCP/IP that has several disadvantages such as lack of mobility and security.
- On the other hand, Content-Centric Networking (CCN) provides advantages in terms of mobility, security, and bandwidth efficiency compared to TCP/IP.
- In this paper, we propose a secure and efficient context data collection and provision approach based on CCN.
+ Context data collection is a fundamental and important process for realizing context-aware recommender or personalization systems.
+ The existing context data collection approaches are based-on traditional TCP/IP that has several disadvantages such as lack of mobility and security.
+ On the other hand, Content-Centric Networking (CCN) provides advantages in terms of mobility, security, and bandwidth efficiency compared to TCP/IP.
+ In this paper, we propose a secure and efficient context data collection and provision approach based on CCN.
Simulation results show that this approach can reduce bandwidth consumption by 52.7%–98.9% in comparison to a TCP/IP-based one.
+
+- **J. Ran, N. Lv, D. Zhang, Y. Ma, and Z. Xie, "On Performance of Cache Policies in Named Data Networking", in International Conference on Advanced Computer Science and Electronics Information (ICACSEI 2013), 2013** (`PDF <http://www.atlantis-press.com/php/download_paper.php?id=7640>`_)
+
+ Named Data Network (NDN) is gaining increasingly concerns, as an important direction of the future Internet architecture research centered on content.
+ Content caching has played a key role in NDN.
+ Existing cache replacement policies like Least Frequently Used (LFU) and Least Recently Used (LRU) have failed to make full use of the popularity of contents, which leads to a low cache efficiency in the dynamic network.
+ In order to make the best use of content popularity in the cache strategy, this paper has proposed a cache replacement policy based on content popularity (CCP), and designed the data structure format and replacement algorithm.
+ For fully studying and analyzing the performance of different cache policies in NDN in terms of network throughput, server load and cache hit ratio, we have done a lot of simulations to show how they will improve the network.
+ The simulation results show that our proposed CCP can significantly decrease the server load with a higher cache hit ratio and increase the network capacity at the same time compared with LRU and LFU.
+ And the average throughput is reduced significantly by nearly 47% in comparison to that of the case without in-networking caching.
+ Moreover, it also shows the performance under different sizes of content store.
+ The effectiveness of the CCP strategy is proved during the simulation.
diff --git a/examples/custom-apps/custom-app.cc b/examples/custom-apps/custom-app.cc
index 9abd7bb..4e83095 100644
--- a/examples/custom-apps/custom-app.cc
+++ b/examples/custom-apps/custom-app.cc
@@ -59,8 +59,8 @@
// Create a name components object for name ``/prefix/sub``
Ptr<ndn::Name> prefix = Create<ndn::Name> (); // now prefix contains ``/``
- prefix->Add ("prefix"); // now prefix contains ``/prefix``
- prefix->Add ("sub"); // now prefix contains ``/prefix/sub``
+ prefix->append ("prefix"); // now prefix contains ``/prefix``
+ prefix->append ("sub"); // now prefix contains ``/prefix/sub``
/////////////////////////////////////////////////////////////////////////////
// Creating FIB entry that ensures that we will receive incoming Interests //
@@ -94,29 +94,26 @@
Ptr<ndn::Name> prefix = Create<ndn::Name> ("/prefix/sub"); // another way to create name
// Create and configure ndn::Interest
- ndn::Interest interestHeader;
+ Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
UniformVariable rand (0,std::numeric_limits<uint32_t>::max ());
- interestHeader.SetNonce (rand.GetValue ());
- interestHeader.SetName (prefix);
- interestHeader.SetInterestLifetime (Seconds (1.0));
-
- // Create packet and add ndn::Interest
- Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader (interestHeader);
+ interest->SetNonce (rand.GetValue ());
+ interest->SetName (prefix);
+ interest->SetInterestLifetime (Seconds (1.0));
NS_LOG_DEBUG ("Sending Interest packet for " << *prefix);
- // Forward packet to lower (network) layer
- m_protocolHandler (packet);
-
// Call trace (for logging purposes)
- m_transmittedInterests (&interestHeader, this, m_face);
+ m_transmittedInterests (interest, this, m_face);
+
+ m_face->ReceiveInterest (interest);
}
// Callback that will be called when Interest arrives
void
-CustomApp::OnInterest (const Ptr<const ndn::Interest> &interest, Ptr<Packet> origPacket)
+CustomApp::OnInterest (Ptr<const ndn::Interest> interest)
{
+ ndn::App::OnInterest (interest);
+
NS_LOG_DEBUG ("Received Interest packet for " << interest->GetName ());
// Create and configure ndn::ContentObject and ndn::ContentObjectTail
@@ -124,34 +121,24 @@
// Note that Interests send out by the app will not be sent back to the app !
- ndn::ContentObject data;
- data.SetName (Create<ndn::Name> (interest->GetName ())); // data will have the same name as Interests
+ Ptr<ndn::ContentObject> data = Create<ndn::ContentObject> (Create<Packet> (1024));
+ data->SetName (Create<ndn::Name> (interest->GetName ())); // data will have the same name as Interests
- ndn::ContentObjectTail trailer; // doesn't require any configuration
-
- // Create packet and add header and trailer
- Ptr<Packet> packet = Create<Packet> (1024);
- packet->AddHeader (data);
- packet->AddTrailer (trailer);
-
- NS_LOG_DEBUG ("Sending ContentObject packet for " << data.GetName ());
-
- // Forward packet to lower (network) layer
- m_protocolHandler (packet);
+ NS_LOG_DEBUG ("Sending ContentObject packet for " << data->GetName ());
// Call trace (for logging purposes)
- m_transmittedContentObjects (&data, packet, this, m_face);
+ m_transmittedContentObjects (data, this, m_face);
+
+ m_face->ReceiveData (data);
}
// Callback that will be called when Data arrives
void
-CustomApp::OnContentObject (const Ptr<const ndn::ContentObject> &contentObject,
- Ptr<Packet> payload)
+CustomApp::OnContentObject (Ptr<const ndn::ContentObject> contentObject)
{
NS_LOG_DEBUG ("Receiving ContentObject packet for " << contentObject->GetName ());
std::cout << "DATA received for name " << contentObject->GetName () << std::endl;
}
-
} // namespace ns3
diff --git a/examples/custom-apps/custom-app.h b/examples/custom-apps/custom-app.h
index 0d33bd8..ed21a2c 100644
--- a/examples/custom-apps/custom-app.h
+++ b/examples/custom-apps/custom-app.h
@@ -54,12 +54,11 @@
// (overridden from ndn::App) Callback that will be called when Interest arrives
virtual void
- OnInterest (const Ptr<const ndn::Interest> &interest, Ptr<Packet> origPacket);
+ OnInterest (Ptr<const ndn::Interest> interest);
// (overridden from ndn::App) Callback that will be called when Data arrives
virtual void
- OnContentObject (const Ptr<const ndn::ContentObject> &contentObject,
- Ptr<Packet> payload);
+ OnContentObject (Ptr<const ndn::ContentObject> contentObject);
private:
void
diff --git a/examples/custom-apps/dumb-requester.cc b/examples/custom-apps/dumb-requester.cc
index 643e24c..b1a0592 100644
--- a/examples/custom-apps/dumb-requester.cc
+++ b/examples/custom-apps/dumb-requester.cc
@@ -91,29 +91,26 @@
Ptr<ndn::Name> prefix = Create<ndn::Name> (m_name); // another way to create name
// Create and configure ndn::Interest
- ndn::Interest interestHeader;
+ Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
UniformVariable rand (0,std::numeric_limits<uint32_t>::max ());
- interestHeader.SetNonce (rand.GetValue ());
- interestHeader.SetName (prefix);
- interestHeader.SetInterestLifetime (Seconds (1.0));
-
- // Create packet and add ndn::Interest
- Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader (interestHeader);
+ interest->SetNonce (rand.GetValue ());
+ interest->SetName (prefix);
+ interest->SetInterestLifetime (Seconds (1.0));
NS_LOG_DEBUG ("Sending Interest packet for " << *prefix);
- // Forward packet to lower (network) layer
- m_protocolHandler (packet);
// Call trace (for logging purposes)
- m_transmittedInterests (&interestHeader, this, m_face);
+ m_transmittedInterests (interest, this, m_face);
+
+ // Forward packet to lower (network) layer
+ m_face->ReceiveInterest (interest);
+
Simulator::Schedule (Seconds (1.0), &DumbRequester::SendInterest, this);
}
void
-DumbRequester::OnContentObject (const Ptr<const ndn::ContentObject> &contentObject,
- Ptr<Packet> payload)
+DumbRequester::OnContentObject (Ptr<const ndn::ContentObject> contentObject)
{
NS_LOG_DEBUG ("Receiving ContentObject packet for " << contentObject->GetName ());
}
diff --git a/examples/custom-apps/dumb-requester.h b/examples/custom-apps/dumb-requester.h
index 06ed812..c2340e0 100644
--- a/examples/custom-apps/dumb-requester.h
+++ b/examples/custom-apps/dumb-requester.h
@@ -52,8 +52,7 @@
// (overridden from ndn::App) Callback that will be called when Data arrives
virtual void
- OnContentObject (const Ptr<const ndn::ContentObject> &contentObject,
- Ptr<Packet> payload);
+ OnContentObject (Ptr<const ndn::ContentObject> contentObject);
private:
void
diff --git a/examples/custom-apps/hijacker.cc b/examples/custom-apps/hijacker.cc
index 4213f97..a908dd0 100644
--- a/examples/custom-apps/hijacker.cc
+++ b/examples/custom-apps/hijacker.cc
@@ -21,6 +21,7 @@
// hijacker.cc
#include "hijacker.h"
+#include "ns3/ndn-name.h"
NS_LOG_COMPONENT_DEFINE ("Hijacker");
@@ -45,9 +46,9 @@
}
void
-Hijacker::OnInterest (const Ptr<const ndn::Interest> &interest, Ptr<Packet> packet)
+Hijacker::OnInterest (Ptr<const ndn::Interest> interest)
{
- ndn::App::OnInterest (interest, packet); // forward call to perform app-level tracing
+ ndn::App::OnInterest (interest); // forward call to perform app-level tracing
// do nothing else (hijack interest)
NS_LOG_DEBUG ("Do nothing for incoming interest for" << interest->GetName ());
@@ -60,7 +61,7 @@
// equivalent to setting interest filter for "/" prefix
Ptr<ndn::Fib> fib = GetNode ()->GetObject<ndn::Fib> ();
- Ptr<ndn::fib::Entry> fibEntry = fib->Add ("/", m_face, 0);
+ Ptr<ndn::fib::Entry> fibEntry = fib->Add (ndn::Name ("/"), m_face, 0);
fibEntry->UpdateStatus (m_face, ndn::fib::FaceMetric::NDN_FIB_GREEN);
}
diff --git a/examples/custom-apps/hijacker.h b/examples/custom-apps/hijacker.h
index 07185de..a90166d 100644
--- a/examples/custom-apps/hijacker.h
+++ b/examples/custom-apps/hijacker.h
@@ -39,7 +39,7 @@
// Receive all Interests but do nothing in response
void
- OnInterest (const Ptr<const ndn::Interest> &interest, Ptr<Packet> packet);
+ OnInterest (Ptr<const ndn::Interest> interest);
protected:
// inherited from Application base class.
diff --git a/examples/custom-apps/ndn-api-app.cc b/examples/custom-apps/ndn-api-app.cc
new file mode 100644
index 0000000..db55bb6
--- /dev/null
+++ b/examples/custom-apps/ndn-api-app.cc
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ndn-api-app.h"
+
+NS_LOG_COMPONENT_DEFINE ("ndn.ApiApp");
+
+namespace ns3 {
+namespace ndn {
+
+// Necessary if you are planning to use ndn::AppHelper
+NS_OBJECT_ENSURE_REGISTERED (ApiApp);
+
+TypeId
+ApiApp::GetTypeId ()
+{
+ static TypeId tid = TypeId ("ns3::ndn::ApiApp")
+ .SetParent<Application> ()
+ .AddConstructor<ApiApp> ()
+
+ .AddAttribute ("Prefix","Name of the Interest",
+ StringValue ("/"),
+ MakeNameAccessor (&ApiApp::m_name),
+ MakeNameChecker ())
+ .AddAttribute ("LifeTime", "LifeTime for interest packet",
+ StringValue ("2s"),
+ MakeTimeAccessor (&ApiApp::m_interestLifetime),
+ MakeTimeChecker ())
+ ;
+
+ return tid;
+}
+
+ApiApp::ApiApp ()
+ : m_face (0)
+{
+}
+
+void
+ApiApp::RequestData ()
+{
+ NS_LOG_FUNCTION (this);
+
+ Ptr<Interest> interest = Create<Interest> ();
+ interest->SetName (m_name);
+ interest->SetInterestLifetime (m_interestLifetime);
+
+ Ptr<Exclude> exclude = Create<Exclude> ();
+ exclude->excludeOne (name::Component ("unique"));
+ interest->SetExclude (exclude);
+
+ m_face->ExpressInterest (interest,
+ MakeCallback (&ApiApp::GotData, this),
+ MakeNullCallback< void, Ptr<const Interest> > ());
+}
+
+void
+ApiApp::GotData (Ptr<const Interest> origInterest, Ptr<const ContentObject> data)
+{
+ NS_LOG_FUNCTION (this << origInterest->GetName () << data->GetName ());
+ // do nothing else
+}
+
+void
+ApiApp::StartApplication ()
+{
+ m_face = CreateObject<ApiFace> (GetNode ());
+
+ Simulator::Schedule (Seconds (1), &::ns3::ndn::ApiApp::RequestData, this);
+ Simulator::Schedule (Seconds (10), &::ns3::ndn::ApiApp::RequestData, this);
+}
+
+void
+ApiApp::StopApplication ()
+{
+ NS_LOG_FUNCTION (this);
+ m_face->Shutdown ();
+ m_face = 0;
+}
+
+} // namespace ndn
+} // namespace ns3
+
diff --git a/examples/custom-apps/ndn-api-app.h b/examples/custom-apps/ndn-api-app.h
new file mode 100644
index 0000000..7709b80
--- /dev/null
+++ b/examples/custom-apps/ndn-api-app.h
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_EXAMPLES_API_APP_H
+#define NDN_EXAMPLES_API_APP_H
+
+#include "ns3/core-module.h"
+#include "ns3/network-module.h"
+#include "ns3/ndnSIM-module.h"
+
+#include "ns3/ndnSIM/ndn.cxx/ndn-api-face.h"
+
+namespace ns3 {
+namespace ndn {
+
+class ApiApp : public Application
+{
+public:
+ static TypeId
+ GetTypeId ();
+
+ ApiApp ();
+
+private:
+ void
+ RequestData ();
+
+ void
+ GotData (Ptr<const Interest> origInterest, Ptr<const ContentObject> data);
+
+protected:
+ // inherited from Application base class.
+ virtual void
+ StartApplication ();
+
+ virtual void
+ StopApplication ();
+
+private:
+ Ptr<ApiFace> m_face;
+
+ Name m_name;
+ Time m_interestLifetime;
+};
+
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDN_EXAMPLES_API_APP_H
diff --git a/examples/custom-strategies/custom-strategy.cc b/examples/custom-strategies/custom-strategy.cc
index 05e7e83..b1bb6c2 100644
--- a/examples/custom-strategies/custom-strategy.cc
+++ b/examples/custom-strategies/custom-strategy.cc
@@ -44,8 +44,7 @@
bool
CustomStrategy::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
typedef fib::FaceMetricContainer::type::index<fib::i_metric>::type FacesByMetric;
@@ -57,7 +56,7 @@
// forward to best-metric face
if (faceIterator != faces.end ())
{
- if (TrySendOutInterest (inFace, faceIterator->GetFace (), header, origPacket, pitEntry))
+ if (TrySendOutInterest (inFace, faceIterator->GetFace (), interest, pitEntry))
propagatedCount ++;
faceIterator ++;
@@ -66,7 +65,7 @@
// forward to second-best-metric face
if (faceIterator != faces.end ())
{
- if (TrySendOutInterest (inFace, faceIterator->GetFace (), header, origPacket, pitEntry))
+ if (TrySendOutInterest (inFace, faceIterator->GetFace (), interest, pitEntry))
propagatedCount ++;
faceIterator ++;
@@ -76,8 +75,7 @@
void
CustomStrategy::DidSendOutInterest (Ptr<Face> inFace, Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
m_counter ++;
diff --git a/examples/custom-strategies/custom-strategy.h b/examples/custom-strategies/custom-strategy.h
index 057669a..051901c 100644
--- a/examples/custom-strategies/custom-strategy.h
+++ b/examples/custom-strategies/custom-strategy.h
@@ -30,15 +30,13 @@
protected:
virtual bool
DoPropagateInterest (Ptr<Face> incomingFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
public:
virtual void
DidSendOutInterest (Ptr<Face> inFace, Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
virtual void
diff --git a/examples/ndn-simple-api.cc b/examples/ndn-simple-api.cc
new file mode 100644
index 0000000..6580fbe
--- /dev/null
+++ b/examples/ndn-simple-api.cc
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2012 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+// ndn-simple.cc
+#include "ns3/core-module.h"
+#include "ns3/network-module.h"
+#include "ns3/point-to-point-module.h"
+#include "ns3/ndnSIM-module.h"
+
+using namespace ns3;
+
+/**
+ * This scenario simulates a very simple network topology:
+ *
+ *
+ * +----------+ 1Mbps +--------+ 1Mbps +----------+
+ * | consumer | <------------> | router | <------------> | producer |
+ * +----------+ 10ms +--------+ 10ms +----------+
+ *
+ *
+ * Consumer requests data from producer with frequency 10 interests per second
+ * (interests contain constantly increasing sequence number).
+ *
+ * For every received interest, producer replies with a data packet, containing
+ * 1024 bytes of virtual payload.
+ *
+ * To run scenario and see what is happening, use the following command:
+ *
+ * NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-simple
+ */
+
+int
+main (int argc, char *argv[])
+{
+ // setting default parameters for PointToPoint links and channels
+ Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
+ Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
+ Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
+
+ // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
+ CommandLine cmd;
+ cmd.Parse (argc, argv);
+
+ // Creating nodes
+ NodeContainer nodes;
+ nodes.Create (3);
+
+ // Connecting nodes using two links
+ PointToPointHelper p2p;
+ p2p.Install (nodes.Get (0), nodes.Get (1));
+ p2p.Install (nodes.Get (1), nodes.Get (2));
+
+ // Install NDN stack on all nodes
+ ndn::StackHelper ndnHelper;
+ ndnHelper.SetDefaultRoutes (true);
+ ndnHelper.InstallAll ();
+
+ // Installing applications
+
+ // Consumer
+ ndn::AppHelper consumerHelper ("ns3::ndn::ApiApp");
+ consumerHelper.SetPrefix ("/prefix");
+ ApplicationContainer app = consumerHelper.Install (nodes.Get (0)); // first node
+ app.Stop (Seconds (15.0));
+
+ // Producer
+ ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ // Producer will reply to all requests starting with /prefix
+ producerHelper.SetPrefix ("/");
+ producerHelper.SetAttribute ("Postfix", StringValue ("/unique/postfix"));
+ producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ producerHelper.Install (nodes.Get (2)); // last node
+
+ Simulator::Stop (Seconds (20.0));
+
+ Simulator::Run ();
+ Simulator::Destroy ();
+
+ return 0;
+}
diff --git a/examples/ndn-simple-with-cs-lfu.cc b/examples/ndn-simple-with-cs-lfu.cc
index 59c9a46..c184863 100644
--- a/examples/ndn-simple-with-cs-lfu.cc
+++ b/examples/ndn-simple-with-cs-lfu.cc
@@ -47,8 +47,8 @@
{
os << "SimulationTime" << "\t"
<< "RealTime" << "\t"
- << "NumberOfProcessedData" << "\t"
- << "NumberOfProcessedInterests" << "\t"
+ // << "NumberOfProcessedData" << "\t"
+ // << "NumberOfProcessedInterests" << "\t"
<< "NumberPitEntries" << "\t"
<< "NumberCsEntries" << "\t"
<< "MemUsage" << "\n";
@@ -64,8 +64,8 @@
os << Simulator::Now ().ToDouble (Time::S) << "\t";
os << realTime << "\t";
- os << ndn::L3Protocol::GetDataCounter () << "\t";
- os << ndn::L3Protocol::GetInterestCounter () << "\t";
+ // os << ndn::L3Protocol::GetDataCounter () << "\t";
+ // os << ndn::L3Protocol::GetInterestCounter () << "\t";
uint64_t pitCount = 0;
uint64_t csCount = 0;
diff --git a/examples/ndn-simple-with-link-failure.cc b/examples/ndn-simple-with-link-failure.cc
new file mode 100644
index 0000000..161e735
--- /dev/null
+++ b/examples/ndn-simple-with-link-failure.cc
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2012 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * : Saran Tarnoi <saran.tarnoi@gmail.com>
+ */
+// ndn-simple-with-link-failure.cc
+#include "ns3/core-module.h"
+#include "ns3/network-module.h"
+#include "ns3/point-to-point-module.h"
+#include "ns3/ndnSIM-module.h"
+
+// for LinkStatusControl::FailLinks and LinkStatusControl::UpLinks
+#include "ns3/ndn-link-control-helper.h"
+
+using namespace ns3;
+
+/**
+ * This scenario simulates a very simple network topology:
+ *
+ *
+ * +----------+ 1Mbps +--------+ 1Mbps +----------+
+ * | consumer | <------------> | router | <------------> | producer |
+ * +----------+ 10ms +--------+ 10ms +----------+
+ *
+ *
+ * Consumer requests data from producer with frequency 10 interests per second
+ * (interests contain constantly increasing sequence number).
+ *
+ * For every received interest, producer replies with a data packet, containing
+ * 1024 bytes of virtual payload.
+ *
+ * To run scenario and see what is happening, use the following command:
+ *
+ * NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-simple
+ */
+
+int
+main (int argc, char *argv[])
+{
+ // setting default parameters for PointToPoint links and channels
+ Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
+ Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
+ Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
+
+ // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
+ CommandLine cmd;
+ cmd.Parse (argc, argv);
+
+ // Creating nodes
+ NodeContainer nodes;
+ nodes.Create (3);
+
+ // Connecting nodes using two links
+ PointToPointHelper p2p;
+ p2p.Install (nodes.Get (0), nodes.Get (1));
+ p2p.Install (nodes.Get (1), nodes.Get (2));
+
+ // Install NDN stack on all nodes
+ ndn::StackHelper ndnHelper;
+ ndnHelper.SetDefaultRoutes (true);
+ ndnHelper.InstallAll ();
+
+ // Installing applications
+
+ // Consumer
+ ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
+ // Consumer will request /prefix/0, /prefix/1, ...
+ consumerHelper.SetPrefix ("/prefix");
+ consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 10 interests a second
+ consumerHelper.Install (nodes.Get (0)); // first node
+
+ // Producer
+ ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ // Producer will reply to all requests starting with /prefix
+ producerHelper.SetPrefix ("/prefix");
+ producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ producerHelper.Install (nodes.Get (2)); // last node
+
+ // The failure of the link connecting consumer and router will start from seconds 10.0 to 15.0
+ Simulator::Schedule (Seconds (10.0), ndn::LinkControlHelper::FailLink, nodes.Get (0), nodes.Get (1));
+ Simulator::Schedule (Seconds (15.0), ndn::LinkControlHelper::UpLink, nodes.Get (0), nodes.Get (1));
+
+ Simulator::Stop (Seconds (20.0));
+
+ Simulator::Run ();
+ Simulator::Destroy ();
+
+ return 0;
+}
diff --git a/examples/ndn-simple-with-pcap.cc b/examples/ndn-simple-with-pcap.cc
index 03f3ef4..6065624 100644
--- a/examples/ndn-simple-with-pcap.cc
+++ b/examples/ndn-simple-with-pcap.cc
@@ -56,6 +56,8 @@
Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
+ Config::SetGlobal ("ndn::WireFormat", StringValue ("1"));
+
// Creating nodes
NodeContainer nodes;
nodes.Create (3);
@@ -84,10 +86,12 @@
// Producer will reply to all requests starting with /prefix
producerHelper.SetPrefix ("/prefix");
producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ producerHelper.SetAttribute ("Signature", UintegerValue (100));
+ producerHelper.SetAttribute ("KeyLocator", StringValue ("/unique/key/locator"));
producerHelper.Install (nodes.Get (2)); // last node
PcapWriter trace ("ndn-simple-trace.pcap");
- Config::ConnectWithoutContext ("/NodeList/*/$ns3::ndn::L3Protocol/FaceList/*/NdnTx",
+ Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/MacTx",
MakeCallback (&PcapWriter::TracePacket, &trace));
Simulator::Stop (Seconds (20.0));
diff --git a/examples/ndn-simple-with-pit-count-stats.cc b/examples/ndn-simple-with-pit-count-stats.cc
index d7983c9..725da66 100644
--- a/examples/ndn-simple-with-pit-count-stats.cc
+++ b/examples/ndn-simple-with-pit-count-stats.cc
@@ -108,7 +108,7 @@
consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 10 interests a second
consumerHelper.Install (nodes.Get (0)); // first node
- // Producer
+ // // Producer
ndn::AppHelper producerHelper ("ns3::ndn::Producer");
// Producer will reply to all requests starting with /prefix
producerHelper.SetPrefix ("/prefix");
diff --git a/examples/wscript b/examples/wscript
index c9850ae..49a0c5c 100644
--- a/examples/wscript
+++ b/examples/wscript
@@ -85,3 +85,12 @@
obj = bld.create_ns3_program('ndn-simple-with-pit-count-stats', all_modules)
obj.source = 'ndn-simple-with-pit-count-stats.cc'
+
+ obj = bld.create_ns3_program('ndn-simple-api', all_modules)
+ obj.source = [
+ 'ndn-simple-api.cc',
+ 'custom-apps/ndn-api-app.cc'
+ ]
+
+ obj = bld.create_ns3_program('ndn-simple-with-link-failure', all_modules)
+ obj.source = 'ndn-simple-with-link-failure.cc'
diff --git a/helper/ndn-app-helper.cc b/helper/ndn-app-helper.cc
index 58f62d3..d835da4 100644
--- a/helper/ndn-app-helper.cc
+++ b/helper/ndn-app-helper.cc
@@ -94,7 +94,7 @@
}
#endif
- Ptr<App> app = m_factory.Create<App> ();
+ Ptr<Application> app = m_factory.Create<Application> ();
node->AddApplication (app);
return app;
diff --git a/helper/ndn-header-helper.cc b/helper/ndn-header-helper.cc
index f9145cc..97d282a 100644
--- a/helper/ndn-header-helper.cc
+++ b/helper/ndn-header-helper.cc
@@ -70,51 +70,5 @@
throw UnknownHeaderException();
}
-Ptr<const Name>
-HeaderHelper::GetName (Ptr<const Packet> p)
-{
- Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
- try
- {
- HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (p);
- switch (type)
- {
- case HeaderHelper::INTEREST_NDNSIM:
- {
- Ptr<Interest> header = Create<Interest> ();
-
- // Deserialization. Exception may be thrown
- packet->RemoveHeader (*header);
- NS_ASSERT_MSG (packet->GetSize () == 0, "Payload of Interests should be zero");
-
- return header->GetNamePtr ();
- break;
- }
- case HeaderHelper::CONTENT_OBJECT_NDNSIM:
- {
- Ptr<ContentObject> header = Create<ContentObject> ();
-
- // Deserialization. Exception may be thrown
- packet->RemoveHeader (*header);
- return header->GetNamePtr ();
- break;
- }
- case HeaderHelper::INTEREST_CCNB:
- case HeaderHelper::CONTENT_OBJECT_CCNB:
- NS_FATAL_ERROR ("ccnb support is broken in this implementation");
- break;
- }
-
- // exception will be thrown if packet is not recognized
- }
- catch (UnknownHeaderException)
- {
- return 0;
- }
-
- return 0;
-}
-
-
} // namespace ndn
} // namespace ns3
diff --git a/helper/ndn-header-helper.h b/helper/ndn-header-helper.h
index c8c46c9..0e39c0c 100644
--- a/helper/ndn-header-helper.h
+++ b/helper/ndn-header-helper.h
@@ -91,14 +91,6 @@
static Type
GetNdnHeaderType (Ptr<const Packet> packet);
-
- /**
- * @brief A heavy-weight operation to get name of the packet
- *
- * This function returns name of the packet by deserializing a copy of the packet to a right header
- */
- static Ptr<const Name>
- GetName (Ptr<const Packet> packet);
};
/**
diff --git a/helper/ndn-link-control-helper.cc b/helper/ndn-link-control-helper.cc
new file mode 100644
index 0000000..cf2b99d
--- /dev/null
+++ b/helper/ndn-link-control-helper.cc
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * : Saran Tarnoi <saran.tarnoi@gmail.com>
+ */
+
+#include "ndn-link-control-helper.h"
+
+#include "ns3/assert.h"
+#include "ns3/names.h"
+#include "ns3/point-to-point-net-device.h"
+#include "ns3/point-to-point-channel.h"
+#include "ns3/channel.h"
+#include "ns3/log.h"
+
+#include "ns3/ndn-l3-protocol.h"
+#include "ns3/ndn-net-device-face.h"
+
+NS_LOG_COMPONENT_DEFINE ("ndn.LinkControlHelper");
+
+namespace ns3 {
+namespace ndn {
+
+void
+LinkControlHelper::FailLink (Ptr<Node> node1, Ptr<Node> node2)
+{
+ NS_LOG_FUNCTION (node1 << node2);
+
+ NS_ASSERT (node1 != 0);
+ NS_ASSERT (node2 != 0);
+
+ Ptr<ndn::L3Protocol> ndn1 = node1->GetObject<ndn::L3Protocol> ();
+ Ptr<ndn::L3Protocol> ndn2 = node2->GetObject<ndn::L3Protocol> ();
+
+ NS_ASSERT (ndn1 != 0);
+ NS_ASSERT (ndn2 != 0);
+
+ // iterate over all faces to find the right one
+ for (uint32_t faceId = 0; faceId < ndn1->GetNFaces (); faceId++)
+ {
+ Ptr<ndn::NetDeviceFace> ndFace = ndn1->GetFace (faceId)->GetObject<ndn::NetDeviceFace> ();
+ if (ndFace == 0) continue;
+
+ Ptr<PointToPointNetDevice> nd1 = ndFace->GetNetDevice ()->GetObject<PointToPointNetDevice> ();
+ if (nd1 == 0) continue;
+
+ Ptr<Channel> channel = nd1->GetChannel ();
+ if (channel == 0) continue;
+
+ Ptr<PointToPointChannel> ppChannel = DynamicCast<PointToPointChannel> (channel);
+
+ Ptr<NetDevice> nd2 = ppChannel->GetDevice (0);
+ if (nd2->GetNode () == node1)
+ nd2 = ppChannel->GetDevice (1);
+
+ if (nd2->GetNode () == node2)
+ {
+ Ptr<ndn::Face> face1 = ndn1->GetFaceByNetDevice (nd1);
+ Ptr<ndn::Face> face2 = ndn2->GetFaceByNetDevice (nd2);
+
+ face1->SetUp (false);
+ face2->SetUp (false);
+ break;
+ }
+ }
+}
+void
+LinkControlHelper::FailLinkByName (const std::string &node1, const std::string &node2)
+{
+ FailLink (Names::Find<Node> (node1), Names::Find<Node> (node2));
+}
+
+void
+LinkControlHelper::UpLink (Ptr<Node> node1, Ptr<Node> node2)
+{
+ NS_LOG_FUNCTION (node1 << node2);
+
+ NS_ASSERT (node1 != 0);
+ NS_ASSERT (node2 != 0);
+
+ Ptr<ndn::L3Protocol> ndn1 = node1->GetObject<ndn::L3Protocol> ();
+ Ptr<ndn::L3Protocol> ndn2 = node2->GetObject<ndn::L3Protocol> ();
+
+ NS_ASSERT (ndn1 != 0);
+ NS_ASSERT (ndn2 != 0);
+
+ // iterate over all faces to find the right one
+ for (uint32_t faceId = 0; faceId < ndn1->GetNFaces (); faceId++)
+ {
+ Ptr<ndn::NetDeviceFace> ndFace = ndn1->GetFace (faceId)->GetObject<ndn::NetDeviceFace> ();
+ if (ndFace == 0) continue;
+
+ Ptr<PointToPointNetDevice> nd1 = ndFace->GetNetDevice ()->GetObject<PointToPointNetDevice> ();
+ if (nd1 == 0) continue;
+
+ Ptr<Channel> channel = nd1->GetChannel ();
+ if (channel == 0) continue;
+
+ Ptr<PointToPointChannel> ppChannel = DynamicCast<PointToPointChannel> (channel);
+
+ Ptr<NetDevice> nd2 = ppChannel->GetDevice (0);
+ if (nd2->GetNode () == node1)
+ nd2 = ppChannel->GetDevice (1);
+
+ if (nd2->GetNode () == node2)
+ {
+ Ptr<ndn::Face> face1 = ndn1->GetFaceByNetDevice (nd1);
+ Ptr<ndn::Face> face2 = ndn2->GetFaceByNetDevice (nd2);
+
+ face1->SetUp (true);
+ face2->SetUp (true);
+ break;
+ }
+ }
+}
+
+void
+LinkControlHelper::UpLinkByName (const std::string &node1, const std::string &node2)
+{
+ UpLink (Names::Find<Node> (node1), Names::Find<Node> (node2));
+}
+
+}
+}
diff --git a/helper/ndn-link-control-helper.h b/helper/ndn-link-control-helper.h
new file mode 100644
index 0000000..619fb1c
--- /dev/null
+++ b/helper/ndn-link-control-helper.h
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * : Saran Tarnoi <saran.tarnoi@gmail.com>
+ */
+
+#ifndef NDN_LINK_CONTROL_HELPER_H
+#define NDN_LINK_CONTROL_HELPER_H
+
+#include "ns3/ptr.h"
+#include "ns3/node.h"
+
+namespace ns3 {
+namespace ndn {
+
+/**
+ * @brief Helper class to control the up or down statuss of an NDN link connecting two specific nodes
+ * @ingroup Ndn
+ */
+class LinkControlHelper
+{
+public:
+ /**
+ * @brief Fail NDN link between two nodes
+ *
+ * The helper will attempt to find NDN link between node1 and
+ * node2 and set NDN face to DOWN state
+ *
+ * Note that only PointToPointChannels are supported by this helper method
+ *
+ * @param node1 one node
+ * @param node2 another node
+ */
+ static void
+ FailLink (Ptr<Node> node1, Ptr<Node> node2);
+
+ /**
+ * @brief Fail NDN link between two nodes
+ *
+ * The helper will attempt to find NDN link between node1 and
+ * node2 and set NDN face to DOWN state
+ *
+ * Note that only PointToPointChannels are supported by this helper method
+ *
+ * This variant uses node names registered by Names class
+ *
+ * @param node1 one node's name
+ * @param node2 another node's name
+ */
+ static void
+ FailLinkByName (const std::string &node1, const std::string &node2);
+
+ /**
+ * @brief Re-enable NDN link between two nodes
+ *
+ * The helper will attempt to find NDN link between node1 and
+ * node2 and set NDN face to UP state
+ *
+ * Note that only PointToPointChannels are supported by this helper method
+ *
+ * @param node1 one node
+ * @param node2 another node
+ */
+ static void
+ UpLink (Ptr<Node> node1, Ptr<Node> node2);
+
+ /**
+ * @brief Re-enable NDN link between two nodes
+ *
+ * The helper will attempt to find NDN link between node1 and
+ * node2 and set NDN face to UP state
+ *
+ * Note that only PointToPointChannels are supported by this helper method
+ *
+ * This variant uses node names registered by Names class
+ *
+ * @param node1 one node's name
+ * @param node2 another node's name
+ */
+ static void
+ UpLinkByName (const std::string &node1, const std::string &node2);
+}; // end: LinkControlHelper
+
+
+} // ndn
+} // ns3
+
+#endif // NDN_LINK_CONTROL_HELPER_H
diff --git a/model/cs/content-store-impl.h b/model/cs/content-store-impl.h
index ffe8038..90d0c95 100644
--- a/model/cs/content-store-impl.h
+++ b/model/cs/content-store-impl.h
@@ -44,8 +44,8 @@
typedef Entry base_type;
public:
- EntryImpl (Ptr<ContentStore> cs, Ptr<const ContentObject> header, Ptr<const Packet> packet)
- : Entry (cs, header, packet)
+ EntryImpl (Ptr<ContentStore> cs, Ptr<const ContentObject> data)
+ : Entry (cs, data)
, item_ (0)
{
}
@@ -86,11 +86,11 @@
// from ContentStore
- virtual inline boost::tuple<Ptr<Packet>, Ptr<const ContentObject>, Ptr<const Packet> >
+ virtual inline Ptr<ContentObject>
Lookup (Ptr<const Interest> interest);
virtual inline bool
- Add (Ptr<const ContentObject> header, Ptr<const Packet> packet);
+ Add (Ptr<const ContentObject> data);
// virtual bool
// Remove (Ptr<Interest> header);
@@ -155,40 +155,65 @@
return tid;
}
+struct isNotExcluded
+{
+ inline
+ isNotExcluded (const Exclude &exclude)
+ : m_exclude (exclude)
+ {
+ }
+
+ bool
+ operator () (const name::Component &comp) const
+ {
+ return !m_exclude.isExcluded (comp);
+ }
+
+private:
+ const Exclude &m_exclude;
+};
+
template<class Policy>
-boost::tuple<Ptr<Packet>, Ptr<const ContentObject>, Ptr<const Packet> >
+Ptr<ContentObject>
ContentStoreImpl<Policy>::Lookup (Ptr<const Interest> interest)
{
NS_LOG_FUNCTION (this << interest->GetName ());
/// @todo Change to search with predicate
- typename super::const_iterator node = this->deepest_prefix_match (interest->GetName ());
-
- if (node != this->end ())
+ typename super::const_iterator node;
+ if (interest->GetExclude () == 0)
{
- this->m_cacheHitsTrace (interest, node->payload ()->GetHeader ());
-
- // NS_LOG_DEBUG ("cache hit with " << node->payload ()->GetHeader ()->GetName ());
- return boost::make_tuple (node->payload ()->GetFullyFormedNdnPacket (),
- node->payload ()->GetHeader (),
- node->payload ()->GetPacket ());
+ node = this->deepest_prefix_match (interest->GetName ());
}
else
{
- // NS_LOG_DEBUG ("cache miss for " << interest->GetName ());
+ node = this->deepest_prefix_match_if_next_level (interest->GetName (),
+ isNotExcluded (*interest->GetExclude ()));
+ }
+
+ if (node != this->end ())
+ {
+ this->m_cacheHitsTrace (interest, node->payload ()->GetData ());
+
+ Ptr<ContentObject> copy = Create<ContentObject> (*node->payload ()->GetData ());
+ ConstCast<Packet> (copy->GetPayload ())->RemoveAllPacketTags ();
+ return copy;
+ }
+ else
+ {
this->m_cacheMissesTrace (interest);
- return boost::tuple<Ptr<Packet>, Ptr<ContentObject>, Ptr<Packet> > (0, 0, 0);
+ return 0;
}
}
template<class Policy>
bool
-ContentStoreImpl<Policy>::Add (Ptr<const ContentObject> header, Ptr<const Packet> packet)
+ContentStoreImpl<Policy>::Add (Ptr<const ContentObject> data)
{
- NS_LOG_FUNCTION (this << header->GetName ());
+ NS_LOG_FUNCTION (this << data->GetName ());
- Ptr< entry > newEntry = Create< entry > (this, header, packet);
- std::pair< typename super::iterator, bool > result = super::insert (header->GetName (), newEntry);
+ Ptr< entry > newEntry = Create< entry > (this, data);
+ std::pair< typename super::iterator, bool > result = super::insert (data->GetName (), newEntry);
if (result.first != super::end ())
{
diff --git a/model/cs/content-store-nocache.cc b/model/cs/content-store-nocache.cc
index 8814c13..c5749e2 100644
--- a/model/cs/content-store-nocache.cc
+++ b/model/cs/content-store-nocache.cc
@@ -55,15 +55,15 @@
{
}
-boost::tuple<Ptr<Packet>, Ptr<const ContentObject>, Ptr<const Packet> >
+Ptr<ContentObject>
Nocache::Lookup (Ptr<const Interest> interest)
{
this->m_cacheMissesTrace (interest);
- return boost::tuple<Ptr<Packet>, Ptr<const ContentObject>, Ptr<const Packet> > (0, 0, 0);
+ return 0;
}
bool
-Nocache::Add (Ptr<const ContentObject> header, Ptr<const Packet> packet)
+Nocache::Add (Ptr<const ContentObject> data)
{
return false;
}
diff --git a/model/cs/content-store-nocache.h b/model/cs/content-store-nocache.h
index 6d38f40..79d1284 100644
--- a/model/cs/content-store-nocache.h
+++ b/model/cs/content-store-nocache.h
@@ -54,11 +54,11 @@
virtual
~Nocache ();
- virtual boost::tuple<Ptr<Packet>, Ptr<const ContentObject>, Ptr<const Packet> >
+ virtual Ptr<ContentObject>
Lookup (Ptr<const Interest> interest);
virtual bool
- Add (Ptr<const ContentObject> header, Ptr<const Packet> packet);
+ Add (Ptr<const ContentObject> data);
virtual void
Print (std::ostream &os) const;
diff --git a/model/cs/content-store-with-freshness.h b/model/cs/content-store-with-freshness.h
index 81f8856..22242b9 100644
--- a/model/cs/content-store-with-freshness.h
+++ b/model/cs/content-store-with-freshness.h
@@ -46,7 +46,7 @@
Print (std::ostream &os) const;
virtual inline bool
- Add (Ptr<const ContentObject> header, Ptr<const Packet> packet);
+ Add (Ptr<const ContentObject> data);
private:
inline void
@@ -90,12 +90,12 @@
template<class Policy>
inline bool
-ContentStoreWithFreshness< Policy >::Add (Ptr<const ContentObject> header, Ptr<const Packet> packet)
+ContentStoreWithFreshness< Policy >::Add (Ptr<const ContentObject> data)
{
- bool ok = super::Add (header, packet);
+ bool ok = super::Add (data);
if (!ok) return false;
- NS_LOG_DEBUG (header->GetName () << " added to cache");
+ NS_LOG_DEBUG (data->GetName () << " added to cache");
RescheduleCleaning ();
return true;
}
diff --git a/model/cs/custom-policies/freshness-policy.h b/model/cs/custom-policies/freshness-policy.h
index 5fa2a34..b85635e 100644
--- a/model/cs/custom-policies/freshness-policy.h
+++ b/model/cs/custom-policies/freshness-policy.h
@@ -103,7 +103,7 @@
insert (typename parent_trie::iterator item)
{
// get_time (item) = Simulator::Now ();
- Time freshness = item->payload ()->GetHeader ()->GetFreshness ();
+ Time freshness = item->payload ()->GetData ()->GetFreshness ();
if (!freshness.IsZero ())
{
get_freshness (item) = Simulator::Now () + freshness;
@@ -125,7 +125,7 @@
inline void
erase (typename parent_trie::iterator item)
{
- if (!item->payload ()->GetHeader ()->GetFreshness ().IsZero ())
+ if (!item->payload ()->GetData ()->GetFreshness ().IsZero ())
{
// erase only if freshness is non zero (otherwise an item is not in the policy
policy_container::erase (policy_container::s_iterator_to (*item));
diff --git a/model/cs/ndn-content-store.cc b/model/cs/ndn-content-store.cc
index c99d7ed..f1c25b7 100644
--- a/model/cs/ndn-content-store.cc
+++ b/model/cs/ndn-content-store.cc
@@ -34,7 +34,7 @@
NS_OBJECT_ENSURE_REGISTERED (ContentStore);
-TypeId
+TypeId
ContentStore::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ndn::ContentStore")
@@ -60,40 +60,22 @@
//////////////////////////////////////////////////////////////////////
-Entry::Entry (Ptr<ContentStore> cs, Ptr<const ContentObject> header, Ptr<const Packet> packet)
+Entry::Entry (Ptr<ContentStore> cs, Ptr<const ContentObject> data)
: m_cs (cs)
- , m_header (header)
- , m_packet (packet->Copy ())
+ , m_data (data)
{
}
-Ptr<Packet>
-Entry::GetFullyFormedNdnPacket () const
-{
- static ContentObjectTail tail; ///< \internal for optimization purposes
-
- Ptr<Packet> packet = m_packet->Copy ();
- packet->AddHeader (*m_header);
- packet->AddTrailer (tail);
- return packet;
-}
-
const Name&
Entry::GetName () const
{
- return m_header->GetName ();
+ return m_data->GetName ();
}
Ptr<const ContentObject>
-Entry::GetHeader () const
+Entry::GetData () const
{
- return m_header;
-}
-
-Ptr<const Packet>
-Entry::GetPacket () const
-{
- return m_packet;
+ return m_data;
}
Ptr<ContentStore>
diff --git a/model/cs/ndn-content-store.h b/model/cs/ndn-content-store.h
index 54901d9..66e7667 100644
--- a/model/cs/ndn-content-store.h
+++ b/model/cs/ndn-content-store.h
@@ -36,13 +36,7 @@
class ContentObject;
class Interest;
-
-typedef Interest InterestHeader;
-typedef ContentObject ContentObjectHeader;
-
class Name;
-typedef Name NameComponents;
-
class ContentStore;
namespace cs {
@@ -50,13 +44,6 @@
/**
* \ingroup ndn
* \brief NDN content store entry
- *
- * Content store entry stores separately pseudo header and content of
- * ContentObject packet. It is responsibility of the caller to
- * construct a fully formed NDN Packet by calling Copy(), AddHeader(),
- * AddTail() on the packet received by GetPacket() method.
- *
- * GetFullyFormedNdnPacket method provided as a convenience
*/
class Entry : public SimpleRefCount<Entry>
{
@@ -70,7 +57,7 @@
* The constructor will make a copy of the supplied packet and calls
* RemoveHeader and RemoveTail on the copy.
*/
- Entry (Ptr<ContentStore> cs, Ptr<const ContentObject> header, Ptr<const Packet> packet);
+ Entry (Ptr<ContentStore> cs, Ptr<const ContentObject> data);
/**
* \brief Get prefix of the stored entry
@@ -84,21 +71,7 @@
* \returns ContentObject of the stored entry
*/
Ptr<const ContentObject>
- GetHeader () const;
-
- /**
- * \brief Get content of the stored entry
- * \returns content of the stored entry
- */
- Ptr<const Packet>
- GetPacket () const;
-
- /**
- * \brief Convenience method to create a fully formed Ndn packet from stored header and content
- * \returns A read-write copy of the packet with ContentObject and ContentObjectTail
- */
- Ptr<Packet>
- GetFullyFormedNdnPacket () const;
+ GetData () const;
/**
* @brief Get pointer to access store, to which this entry is added
@@ -108,8 +81,7 @@
private:
Ptr<ContentStore> m_cs; ///< \brief content store to which entry is added
- Ptr<const ContentObject> m_header; ///< \brief non-modifiable ContentObject
- Ptr<Packet> m_packet; ///< \brief non-modifiable content of the ContentObject packet
+ Ptr<const ContentObject> m_data; ///< \brief non-modifiable ContentObject
};
} // namespace cs
@@ -147,7 +119,7 @@
* If an entry is found, it is promoted to the top of most recent
* used entries index, \see m_contentStore
*/
- virtual boost::tuple<Ptr<Packet>, Ptr<const ContentObject>, Ptr<const Packet> >
+ virtual Ptr<ContentObject>
Lookup (Ptr<const Interest> interest) = 0;
/**
@@ -159,7 +131,7 @@
* @returns true if an existing entry was updated, false otherwise
*/
virtual bool
- Add (Ptr<const ContentObject> header, Ptr<const Packet> packet) = 0;
+ Add (Ptr<const ContentObject> data) = 0;
// /*
// * \brief Add a new content to the content store.
diff --git a/model/fw/best-route.cc b/model/fw/best-route.cc
index 21a6b57..f5ab205 100644
--- a/model/fw/best-route.cc
+++ b/model/fw/best-route.cc
@@ -65,17 +65,16 @@
bool
BestRoute::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
- NS_LOG_FUNCTION (this << header->GetName ());
+ NS_LOG_FUNCTION (this << interest->GetName ());
// No real need to call parent's (green-yellow-red's strategy) method, since it is incorporated
// in the logic of the BestRoute strategy
//
// // Try to work out with just green faces
- // bool greenOk = super::DoPropagateInterest (inFace, header, origPacket, pitEntry);
+ // bool greenOk = super::DoPropagateInterest (inFace, interest, origPacket, pitEntry);
// if (greenOk)
// return true;
@@ -87,7 +86,7 @@
if (metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in front
break;
- if (!TrySendOutInterest (inFace, metricFace.GetFace (), header, origPacket, pitEntry))
+ if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
{
continue;
}
diff --git a/model/fw/best-route.h b/model/fw/best-route.h
index f7caa19..6648acb 100644
--- a/model/fw/best-route.h
+++ b/model/fw/best-route.h
@@ -58,8 +58,7 @@
// from super
virtual bool
DoPropagateInterest (Ptr<Face> incomingFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
protected:
static LogComponent g_log;
diff --git a/model/fw/flooding.cc b/model/fw/flooding.cc
index 3672b24..3d93248 100644
--- a/model/fw/flooding.cc
+++ b/model/fw/flooding.cc
@@ -66,8 +66,7 @@
bool
Flooding::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
@@ -80,7 +79,7 @@
if (metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
- if (!TrySendOutInterest (inFace, metricFace.GetFace (), header, origPacket, pitEntry))
+ if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
{
continue;
}
diff --git a/model/fw/flooding.h b/model/fw/flooding.h
index 5eadabb..f7ce55a 100644
--- a/model/fw/flooding.h
+++ b/model/fw/flooding.h
@@ -60,8 +60,7 @@
// inherited from Nacks/ForwardingStrategy
virtual bool
DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
protected:
diff --git a/model/fw/green-yellow-red.cc b/model/fw/green-yellow-red.cc
index 5d6a001..cb7fd89 100644
--- a/model/fw/green-yellow-red.cc
+++ b/model/fw/green-yellow-red.cc
@@ -64,8 +64,7 @@
bool
GreenYellowRed::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
@@ -79,7 +78,7 @@
metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_YELLOW)
break; //propagate only to green faces
- if (!TrySendOutInterest (inFace, metricFace.GetFace (), header, origPacket, pitEntry))
+ if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
{
continue;
}
@@ -123,11 +122,10 @@
void
GreenYellowRed::DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> nack,
Ptr<pit::Entry> pitEntry)
{
- super::DidReceiveValidNack (inFace, nackCode, header, origPacket, pitEntry);
+ super::DidReceiveValidNack (inFace, nackCode, nack, pitEntry);
if (inFace != 0 &&
(nackCode == Interest::NACK_CONGESTION ||
diff --git a/model/fw/green-yellow-red.h b/model/fw/green-yellow-red.h
index 1c4dcde..11817bf 100644
--- a/model/fw/green-yellow-red.h
+++ b/model/fw/green-yellow-red.h
@@ -44,8 +44,7 @@
virtual bool
DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
virtual void
@@ -54,8 +53,7 @@
virtual void
DidReceiveValidNack (Ptr<Face> incomingFace,
uint32_t nackCode,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> nack,
Ptr<pit::Entry> pitEntry);
private:
typedef Nacks super;
diff --git a/model/fw/nacks.cc b/model/fw/nacks.cc
index 6bafefb..bda2582 100644
--- a/model/fw/nacks.cc
+++ b/model/fw/nacks.cc
@@ -75,82 +75,74 @@
void
Nacks::OnInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket)
+ Ptr<Interest> interest)
{
- if (header->GetNack () > 0)
- OnNack (inFace, header, origPacket/*original packet*/);
+ if (interest->GetNack () > 0)
+ OnNack (inFace, interest);
else
- super::OnInterest (inFace, header, origPacket/*original packet*/);
+ super::OnInterest (inFace, interest);
}
void
Nacks::OnNack (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket)
+ Ptr<Interest> nack)
{
- // NS_LOG_FUNCTION (inFace << header->GetName ());
- m_inNacks (header, inFace);
+ // NS_LOG_FUNCTION (inFace << nack->GetName ());
+ m_inNacks (nack, inFace);
- Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
+ Ptr<pit::Entry> pitEntry = m_pit->Lookup (*nack);
if (pitEntry == 0)
{
// somebody is doing something bad
- m_dropNacks (header, inFace);
+ m_dropNacks (nack, inFace);
return;
}
- DidReceiveValidNack (inFace, header->GetNack (), header, origPacket, pitEntry);
+ DidReceiveValidNack (inFace, nack->GetNack (), nack, pitEntry);
}
void
Nacks::DidReceiveDuplicateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
- super::DidReceiveDuplicateInterest (inFace, header, origPacket, pitEntry);
+ super::DidReceiveDuplicateInterest (inFace, interest, pitEntry);
if (m_nacksEnabled)
{
NS_LOG_DEBUG ("Sending NACK_LOOP");
- Ptr<Interest> nackHeader = Create<Interest> (*header);
- nackHeader->SetNack (Interest::NACK_LOOP);
- Ptr<Packet> nack = Create<Packet> ();
- nack->AddHeader (*nackHeader);
+ Ptr<Interest> nack = Create<Interest> (*interest);
+ nack->SetNack (Interest::NACK_LOOP);
FwHopCountTag hopCountTag;
- if (origPacket->PeekPacketTag (hopCountTag))
+ if (interest->GetPayload ()->PeekPacketTag (hopCountTag))
{
- nack->AddPacketTag (hopCountTag);
+ nack->GetPayload ()->AddPacketTag (hopCountTag);
}
else
{
NS_LOG_DEBUG ("No FwHopCountTag tag associated with received duplicated Interest");
}
- inFace->Send (nack);
- m_outNacks (nackHeader, inFace);
+ inFace->SendInterest (nack);
+ m_outNacks (nack, inFace);
}
}
void
Nacks::DidExhaustForwardingOptions (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
if (m_nacksEnabled)
{
- Ptr<Packet> packet = Create<Packet> ();
- Ptr<Interest> nackHeader = Create<Interest> (*header);
- nackHeader->SetNack (Interest::NACK_GIVEUP_PIT);
- packet->AddHeader (*nackHeader);
+ Ptr<Interest> nack = Create<Interest> (*interest);
+ nack->SetNack (Interest::NACK_GIVEUP_PIT);
FwHopCountTag hopCountTag;
- if (origPacket->PeekPacketTag (hopCountTag))
+ if (interest->GetPayload ()->PeekPacketTag (hopCountTag))
{
- packet->AddPacketTag (hopCountTag);
+ nack->GetPayload ()->AddPacketTag (hopCountTag);
}
else
{
@@ -159,26 +151,24 @@
BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
{
- NS_LOG_DEBUG ("Send NACK for " << boost::cref (nackHeader->GetName ()) << " to " << boost::cref (*incoming.m_face));
- incoming.m_face->Send (packet->Copy ());
-
- m_outNacks (nackHeader, incoming.m_face);
+ NS_LOG_DEBUG ("Send NACK for " << boost::cref (nack->GetName ()) << " to " << boost::cref (*incoming.m_face));
+ incoming.m_face->SendInterest (nack);
+ m_outNacks (nack, incoming.m_face);
}
pitEntry->ClearOutgoing (); // to force erasure of the record
}
- super::DidExhaustForwardingOptions (inFace, header, origPacket, pitEntry);
+ super::DidExhaustForwardingOptions (inFace, interest, pitEntry);
}
void
Nacks::DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> nack,
Ptr<pit::Entry> pitEntry)
{
- NS_LOG_DEBUG ("nackCode: " << nackCode << " for [" << header->GetName () << "]");
+ NS_LOG_DEBUG ("nackCode: " << nackCode << " for [" << nack->GetName () << "]");
// If NACK is NACK_GIVEUP_PIT, then neighbor gave up trying to and removed it's PIT entry.
// So, if we had an incoming entry to this neighbor, then we can remove it now
@@ -198,29 +188,27 @@
NS_LOG_DEBUG ("Not all outgoing are in vain");
// suppress
// Don't do anything, we are still expecting data from some other face
- m_dropNacks (header, inFace);
+ m_dropNacks (nack, inFace);
return;
}
- Ptr<Packet> nonNackInterest = Create<Packet> ();
- Ptr<Interest> nonNackHeader = Create<Interest> (*header);
- nonNackHeader->SetNack (Interest::NORMAL_INTEREST);
- nonNackInterest->AddHeader (*nonNackHeader);
+ Ptr<Interest> interest = Create<Interest> (*nack);
+ interest->SetNack (Interest::NORMAL_INTEREST);
FwHopCountTag hopCountTag;
- if (origPacket->PeekPacketTag (hopCountTag))
+ if (nack->GetPayload ()->PeekPacketTag (hopCountTag))
{
- nonNackInterest->AddPacketTag (hopCountTag);
+ interest->GetPayload ()->AddPacketTag (hopCountTag);
}
else
{
NS_LOG_DEBUG ("No FwHopCountTag tag associated with received NACK");
}
- bool propagated = DoPropagateInterest (inFace, nonNackHeader, nonNackInterest, pitEntry);
+ bool propagated = DoPropagateInterest (inFace, interest, pitEntry);
if (!propagated)
{
- DidExhaustForwardingOptions (inFace, nonNackHeader, nonNackInterest, pitEntry);
+ DidExhaustForwardingOptions (inFace, interest, pitEntry);
}
}
}
diff --git a/model/fw/nacks.h b/model/fw/nacks.h
index 19a9ecb..7855e19 100644
--- a/model/fw/nacks.h
+++ b/model/fw/nacks.h
@@ -43,34 +43,29 @@
// from super
virtual void
OnInterest (Ptr<Face> face,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket);
+ Ptr<Interest> interest);
protected:
// from super
virtual void
DidReceiveDuplicateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> packet,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
// from super
virtual void
DidExhaustForwardingOptions (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> packet,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
virtual void
OnNack (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket);
+ Ptr<Interest> nack);
virtual void
DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> nack,
Ptr<pit::Entry> pitEntry);
protected:
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
index 9d72e74..2275a8c 100644
--- a/model/fw/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -143,53 +143,49 @@
void
ForwardingStrategy::OnInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket)
+ Ptr<Interest> interest)
{
- m_inInterests (header, inFace);
+ NS_LOG_FUNCTION (inFace << interest->GetName ());
+ m_inInterests (interest, inFace);
- Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
+ Ptr<pit::Entry> pitEntry = m_pit->Lookup (*interest);
bool similarInterest = true;
if (pitEntry == 0)
{
similarInterest = false;
- pitEntry = m_pit->Create (header);
+ pitEntry = m_pit->Create (interest);
if (pitEntry != 0)
{
- DidCreatePitEntry (inFace, header, origPacket, pitEntry);
+ DidCreatePitEntry (inFace, interest, pitEntry);
}
else
{
- FailedToCreatePitEntry (inFace, header, origPacket);
+ FailedToCreatePitEntry (inFace, interest);
return;
}
}
bool isDuplicated = true;
- if (!pitEntry->IsNonceSeen (header->GetNonce ()))
+ if (!pitEntry->IsNonceSeen (interest->GetNonce ()))
{
- pitEntry->AddSeenNonce (header->GetNonce ());
+ pitEntry->AddSeenNonce (interest->GetNonce ());
isDuplicated = false;
}
if (isDuplicated)
{
- DidReceiveDuplicateInterest (inFace, header, origPacket, pitEntry);
+ DidReceiveDuplicateInterest (inFace, interest, pitEntry);
return;
}
- Ptr<Packet> contentObject;
- Ptr<const ContentObject> contentObjectHeader; // used for tracing
- Ptr<const Packet> payload; // used for tracing
- boost::tie (contentObject, contentObjectHeader, payload) = m_contentStore->Lookup (header);
+ Ptr<ContentObject> contentObject;
+ contentObject = m_contentStore->Lookup (interest);
if (contentObject != 0)
{
- NS_ASSERT (contentObjectHeader != 0);
-
FwHopCountTag hopCountTag;
- if (origPacket->PeekPacketTag (hopCountTag))
+ if (interest->GetPayload ()->PeekPacketTag (hopCountTag))
{
- contentObject->AddPacketTag (hopCountTag);
+ contentObject->GetPayload ()->AddPacketTag (hopCountTag);
}
pitEntry->AddIncoming (inFace/*, Seconds (1.0)*/);
@@ -198,56 +194,49 @@
WillSatisfyPendingInterest (0, pitEntry);
// Actually satisfy pending interest
- SatisfyPendingInterest (0, contentObjectHeader, payload, contentObject, pitEntry);
+ SatisfyPendingInterest (0, contentObject, pitEntry);
return;
}
- if (similarInterest && ShouldSuppressIncomingInterest (inFace, header, origPacket, pitEntry))
+ if (similarInterest && ShouldSuppressIncomingInterest (inFace, interest, pitEntry))
{
- pitEntry->AddIncoming (inFace/*, header->GetInterestLifetime ()*/);
+ pitEntry->AddIncoming (inFace/*, interest->GetInterestLifetime ()*/);
// update PIT entry lifetime
- pitEntry->UpdateLifetime (header->GetInterestLifetime ());
+ pitEntry->UpdateLifetime (interest->GetInterestLifetime ());
// Suppress this interest if we're still expecting data from some other face
NS_LOG_DEBUG ("Suppress interests");
- m_dropInterests (header, inFace);
+ m_dropInterests (interest, inFace);
- DidSuppressSimilarInterest (inFace, header, origPacket, pitEntry);
+ DidSuppressSimilarInterest (inFace, interest, pitEntry);
return;
}
if (similarInterest)
{
- DidForwardSimilarInterest (inFace, header, origPacket, pitEntry);
+ DidForwardSimilarInterest (inFace, interest, pitEntry);
}
- PropagateInterest (inFace, header, origPacket, pitEntry);
+ PropagateInterest (inFace, interest, pitEntry);
}
void
ForwardingStrategy::OnData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<Packet> payload,
- Ptr<const Packet> origPacket)
+ Ptr<ContentObject> data)
{
- NS_LOG_FUNCTION (inFace << header->GetName () << payload << origPacket);
- m_inData (header, payload, inFace);
+ NS_LOG_FUNCTION (inFace << data->GetName ());
+ m_inData (data, inFace);
// Lookup PIT entry
- Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
+ Ptr<pit::Entry> pitEntry = m_pit->Lookup (*data);
if (pitEntry == 0)
{
bool cached = false;
if (m_cacheUnsolicitedData || (m_cacheUnsolicitedDataFromApps && (inFace->GetFlags () | Face::APPLICATION)))
{
- FwHopCountTag hopCountTag;
-
- Ptr<Packet> payloadCopy = payload->Copy ();
- payloadCopy->RemovePacketTag (hopCountTag);
-
// Optimistically add or update entry in the content store
- cached = m_contentStore->Add (header, payloadCopy);
+ cached = m_contentStore->Add (data);
}
else
{
@@ -255,32 +244,16 @@
// (unsolicited data packets should not "poison" content store)
//drop dulicated or not requested data packet
- m_dropData (header, payload, inFace);
+ m_dropData (data, inFace);
}
- DidReceiveUnsolicitedData (inFace, header, payload, origPacket, cached);
+ DidReceiveUnsolicitedData (inFace, data, cached);
return;
}
else
{
- bool cached = false;
-
- FwHopCountTag hopCountTag;
- if (payload->PeekPacketTag (hopCountTag))
- {
- Ptr<Packet> payloadCopy = payload->Copy ();
- payloadCopy->RemovePacketTag (hopCountTag);
-
- // Add or update entry in the content store
- cached = m_contentStore->Add (header, payloadCopy);
- }
- else
- {
- // Add or update entry in the content store
- cached = m_contentStore->Add (header, payload); // no need for extra copy
- }
-
- DidReceiveSolicitedData (inFace, header, payload, origPacket, cached);
+ bool cached = m_contentStore->Add (data);
+ DidReceiveSolicitedData (inFace, data, cached);
}
while (pitEntry != 0)
@@ -289,33 +262,30 @@
WillSatisfyPendingInterest (inFace, pitEntry);
// Actually satisfy pending interest
- SatisfyPendingInterest (inFace, header, payload, origPacket, pitEntry);
+ SatisfyPendingInterest (inFace, data, pitEntry);
// Lookup another PIT entry
- pitEntry = m_pit->Lookup (*header);
+ pitEntry = m_pit->Lookup (*data);
}
}
void
ForwardingStrategy::DidCreatePitEntry (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntrypitEntry)
{
}
void
ForwardingStrategy::FailedToCreatePitEntry (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket)
+ Ptr<const Interest> interest)
{
- m_dropInterests (header, inFace);
+ m_dropInterests (interest, inFace);
}
void
ForwardingStrategy::DidReceiveDuplicateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
/////////////////////////////////////////////////////////////////////////////////////////
@@ -324,35 +294,32 @@
// //
/////////////////////////////////////////////////////////////////////////////////////////
pitEntry->AddIncoming (inFace);
- m_dropInterests (header, inFace);
+ m_dropInterests (interest, inFace);
}
void
ForwardingStrategy::DidSuppressSimilarInterest (Ptr<Face> face,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
}
void
ForwardingStrategy::DidForwardSimilarInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
}
void
ForwardingStrategy::DidExhaustForwardingOptions (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << boost::cref (*inFace));
if (pitEntry->AreAllOutgoingInVain ())
{
- m_dropInterests (header, inFace);
+ m_dropInterests (interest, inFace);
// All incoming interests cannot be satisfied. Remove them
pitEntry->ClearIncoming ();
@@ -369,8 +336,7 @@
bool
ForwardingStrategy::DetectRetransmittedInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> packet,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
pit::Entry::in_iterator existingInFace = pitEntry->GetIncoming ().find (inFace);
@@ -388,9 +354,7 @@
void
ForwardingStrategy::SatisfyPendingInterest (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
- Ptr<const Packet> origPacket,
+ Ptr<const ContentObject> data,
Ptr<pit::Entry> pitEntry)
{
if (inFace != 0)
@@ -399,14 +363,14 @@
//satisfy all pending incoming Interests
BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
{
- bool ok = incoming.m_face->Send (origPacket->Copy ());
+ bool ok = incoming.m_face->SendData (data);
- DidSendOutData (inFace, incoming.m_face, header, payload, origPacket, pitEntry);
+ DidSendOutData (inFace, incoming.m_face, data, pitEntry);
NS_LOG_DEBUG ("Satisfy " << *incoming.m_face);
if (!ok)
{
- m_dropData (header, payload, incoming.m_face);
+ m_dropData (data, incoming.m_face);
NS_LOG_DEBUG ("Cannot satisfy data to " << *incoming.m_face);
}
}
@@ -423,9 +387,7 @@
void
ForwardingStrategy::DidReceiveSolicitedData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
- Ptr<const Packet> origPacket,
+ Ptr<const ContentObject> data,
bool didCreateCacheEntry)
{
// do nothing
@@ -433,9 +395,7 @@
void
ForwardingStrategy::DidReceiveUnsolicitedData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
- Ptr<const Packet> origPacket,
+ Ptr<const ContentObject> data,
bool didCreateCacheEntry)
{
// do nothing
@@ -458,8 +418,7 @@
bool
ForwardingStrategy::ShouldSuppressIncomingInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
bool isNew = pitEntry->GetIncoming ().size () == 0 && pitEntry->GetOutgoing ().size () == 0;
@@ -467,7 +426,7 @@
if (isNew) return false; // never suppress new interests
bool isRetransmitted = m_detectRetransmissions && // a small guard
- DetectRetransmittedInterest (inFace, header, origPacket, pitEntry);
+ DetectRetransmittedInterest (inFace, interest, pitEntry);
if (pitEntry->GetOutgoing ().find (inFace) != pitEntry->GetOutgoing ().end ())
{
@@ -493,18 +452,17 @@
void
ForwardingStrategy::PropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
bool isRetransmitted = m_detectRetransmissions && // a small guard
- DetectRetransmittedInterest (inFace, header, origPacket, pitEntry);
+ DetectRetransmittedInterest (inFace, interest, pitEntry);
- pitEntry->AddIncoming (inFace/*, header->GetInterestLifetime ()*/);
+ pitEntry->AddIncoming (inFace/*, interest->GetInterestLifetime ()*/);
/// @todo Make lifetime per incoming interface
- pitEntry->UpdateLifetime (header->GetInterestLifetime ());
+ pitEntry->UpdateLifetime (interest->GetInterestLifetime ());
- bool propagated = DoPropagateInterest (inFace, header, origPacket, pitEntry);
+ bool propagated = DoPropagateInterest (inFace, interest, pitEntry);
if (!propagated && isRetransmitted) //give another chance if retransmitted
{
@@ -512,13 +470,13 @@
pitEntry->IncreaseAllowedRetxCount ();
// try again
- propagated = DoPropagateInterest (inFace, header, origPacket, pitEntry);
+ propagated = DoPropagateInterest (inFace, interest, pitEntry);
}
// if (!propagated)
// {
// NS_LOG_DEBUG ("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
- // NS_LOG_DEBUG ("+++ Not propagated ["<< header->GetName () <<"], but number of outgoing faces: " << pitEntry->GetOutgoing ().size ());
+ // NS_LOG_DEBUG ("+++ Not propagated ["<< interest->GetName () <<"], but number of outgoing faces: " << pitEntry->GetOutgoing ().size ());
// NS_LOG_DEBUG ("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
// }
@@ -527,15 +485,14 @@
// ForwardingStrategy failed to find it.
if (!propagated && pitEntry->AreAllOutgoingInVain ())
{
- DidExhaustForwardingOptions (inFace, header, origPacket, pitEntry);
+ DidExhaustForwardingOptions (inFace, interest, pitEntry);
}
}
bool
ForwardingStrategy::CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
if (outFace == inFace)
@@ -565,11 +522,10 @@
bool
ForwardingStrategy::TrySendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
- if (!CanSendOutInterest (inFace, outFace, header, origPacket, pitEntry))
+ if (!CanSendOutInterest (inFace, outFace, interest, pitEntry))
{
return false;
}
@@ -577,14 +533,13 @@
pitEntry->AddOutgoing (outFace);
//transmission
- Ptr<Packet> packetToSend = origPacket->Copy ();
- bool successSend = outFace->Send (packetToSend);
+ bool successSend = outFace->SendInterest (interest);
if (!successSend)
{
- m_dropInterests (header, outFace);
+ m_dropInterests (interest, outFace);
}
- DidSendOutInterest (inFace, outFace, header, origPacket, pitEntry);
+ DidSendOutInterest (inFace, outFace, interest, pitEntry);
return true;
}
@@ -592,22 +547,19 @@
void
ForwardingStrategy::DidSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
- m_outInterests (header, outFace);
+ m_outInterests (interest, outFace);
}
void
ForwardingStrategy::DidSendOutData (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
- Ptr<const Packet> origPacket,
+ Ptr<const ContentObject> data,
Ptr<pit::Entry> pitEntry)
{
- m_outData (header, payload, inFace == 0, outFace);
+ m_outData (data, inFace == 0, outFace);
}
void
diff --git a/model/fw/ndn-forwarding-strategy.h b/model/fw/ndn-forwarding-strategy.h
index f077332..49b034b 100644
--- a/model/fw/ndn-forwarding-strategy.h
+++ b/model/fw/ndn-forwarding-strategy.h
@@ -34,9 +34,6 @@
class Interest;
class ContentObject;
-typedef Interest InterestHeader;
-typedef ContentObject ContentObjectHeader;
-
class Pit;
namespace pit { class Entry; }
class FibFaceMetric;
@@ -52,7 +49,7 @@
public Object
{
public:
- static TypeId GetTypeId (void);
+ static TypeId GetTypeId ();
/**
* @brief Helper function to retrieve logging name for the forwarding strategy
@@ -69,29 +66,23 @@
* \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
*
* Processing Interest packets
- * @param face incoming face
- * @param header deserialized Interest header
- * @param origPacket original packet
+ * @param face incoming face
+ * @param interest Interest packet
*/
virtual void
OnInterest (Ptr<Face> face,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket);
+ Ptr<Interest> interest);
/**
* \brief Actual processing of incoming Ndn content objects
*
* Processing ContentObject packets
* @param face incoming face
- * @param header deserialized ContentObject header
- * @param payload data packet payload
- * @param origPacket original packet
+ * @param data Data packet
*/
virtual void
OnData (Ptr<Face> face,
- Ptr<const ContentObject> header,
- Ptr<Packet> payload,
- Ptr<const Packet> origPacket);
+ Ptr<ContentObject> data);
/**
* @brief Event fired just before PIT entry is removed by timeout
@@ -142,15 +133,13 @@
*
* @param inFace incoming face
* @param header deserialized Interest header
- * @param origPacket original packet
* @param pitEntry created PIT entry (incoming and outgoing face sets are empty)
*
* @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
*/
virtual void
DidCreatePitEntry (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -159,14 +148,12 @@
* Note that this call can be called only for non-similar Interest (i.e., there is an attempt to create a new PIT entry).
* For any non-similar Interests, either FailedToCreatePitEntry or DidCreatePitEntry is called.
*
- * @param inFace incoming face
- * @param header deserialized Interest header
- * @param origPacket original packet
+ * @param inFace incoming face
+ * @param interest Interest packet
*/
virtual void
FailedToCreatePitEntry (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket);
+ Ptr<const Interest> interest);
/**
* @brief An event that is fired every time a duplicated Interest is received
@@ -174,16 +161,14 @@
* This even is the last action that is performed before the Interest processing is halted
*
* @param inFace incoming face
- * @param header deserialized Interest header
- * @param origPacket original packet
+ * @param interest Interest packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*
* @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
*/
virtual void
DidReceiveDuplicateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -192,16 +177,14 @@
* This even is the last action that is performed before the Interest processing is halted
*
* @param inFace incoming face
- * @param header deserialized Interest header
- * @param origPacket original packet
+ * @param interest Interest packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*
* @see DidReceiveDuplicateInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
*/
virtual void
DidSuppressSimilarInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -210,16 +193,14 @@
* This even is fired just before handling the Interest to PropagateInterest method
*
* @param inFace incoming face
- * @param header deserialized Interest header
- * @param origPacket original packet
+ * @param interest Interest packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*
* @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, ShouldSuppressIncomingInterest
*/
virtual void
DidForwardSimilarInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -229,16 +210,14 @@
* and retransmitted Interest cannot by forwarded. For more details, refer to the implementation.
*
* @param inFace incoming face
- * @param header deserialized Interest header
- * @param origPacket original packet
+ * @param interest Interest header
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*
* @see DetectRetransmittedInterest
*/
virtual void
DidExhaustForwardingOptions (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -250,15 +229,13 @@
* already has inFace (i.e., a similar interest is received on the same face more than once).
*
* @param inFace incoming face
- * @param header deserialized Interest header
- * @param origPacket original packet
+ * @param interest Interest header
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
* @return true if Interest should be considered as retransmitted
*/
virtual bool
DetectRetransmittedInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -279,50 +256,38 @@
* Note that when Interest is satisfied from the cache, incoming face will be 0
*
* @param inFace incoming face
- * @param header deserialized ContentObject header
- * @param payload ContentObject payload
- * @param origPacket original packet
+ * @param data Data packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*/
virtual void
SatisfyPendingInterest (Ptr<Face> inFace, // 0 allowed (from cache)
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
- Ptr<const Packet> origPacket,
+ Ptr<const ContentObject> data,
Ptr<pit::Entry> pitEntry);
/**
* @brief Event which is fired just after data was send out on the face
*
- * @param inFace incoming face of the ContentObject
+ * @param inFace incoming face of the ContentObject
* @param outFace outgoing face
- * @param header deserialized ContentObject header
- * @param payload ContentObject payload
- * @param origPacket original packet
+ * @param data Data packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*/
virtual void
DidSendOutData (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
- Ptr<const Packet> origPacket,
+ Ptr<const ContentObject> data,
Ptr<pit::Entry> pitEntry);
/**
* @brief Event which is fired every time a requested (solicited) DATA packet (there is an active PIT entry) is received
*
* @param inFace incoming face
- * @param header deserialized ContentObject header
- * @param payload ContentObject payload
- * @param origPacket original packet
+ * @param data Data packet
* @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
*/
virtual void
DidReceiveSolicitedData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
- Ptr<const Packet> origPacket,
+ Ptr<const ContentObject> data,
bool didCreateCacheEntry);
/**
@@ -332,16 +297,12 @@
* attribute CacheUnsolicitedData true
*
* @param inFace incoming face
- * @param header deserialized ContentObject header
- * @param payload ContentObject payload
- * @param origPacket original packet
+ * @param data Data packet
* @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
*/
virtual void
DidReceiveUnsolicitedData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
- Ptr<const Packet> origPacket,
+ Ptr<const ContentObject> data,
bool didCreateCacheEntry);
/**
@@ -353,14 +314,12 @@
* For more details, refer to the source code.
*
* @param inFace incoming face
- * @param header deserialized ContentObject header
+ * @param interest Interest packet
* @param payload ContentObject payload
- * @param origPacket original packet
*/
virtual bool
ShouldSuppressIncomingInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -373,8 +332,7 @@
*
* @param inFace incoming face of the Interest
* @param outFace proposed outgoing face of the Interest
- * @param header parsed Interest header
- * @param origPacket original Interest packet
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*
* @see DetectRetransmittedInterest
@@ -382,8 +340,7 @@
virtual bool
CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -393,8 +350,7 @@
*
* @param inFace incoming face of the Interest
* @param outFace proposed outgoing face of the Interest
- * @param header parsed Interest header
- * @param origPacket original Interest packet
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*
* @see CanSendOutInterest
@@ -402,8 +358,7 @@
virtual bool
TrySendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -411,15 +366,13 @@
*
* @param inFace incoming face of the Interest
* @param outFace outgoing face of the Interest
- * @param header parsed Interest header
- * @param origPacket original Interest packet
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*/
virtual void
DidSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -429,16 +382,14 @@
* PIT entry lifetime, calling DoPropagateInterest, and retransmissions (enabled by default).
*
* @param inFace incoming face
- * @param header Interest header
- * @param origPacket original Interest packet
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*
* @see DoPropagateInterest
*/
virtual void
PropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -452,8 +403,7 @@
* PIT entry lifetime, calling DoPropagateInterest, as well as perform retransmissions (enabled by default).
*
* @param inFace incoming face
- * @param header Interest header
- * @param origPacket original Interest packet
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*
* @return true if interest was successfully propagated, false if all options have failed
@@ -462,8 +412,7 @@
*/
virtual bool
DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry) = 0;
protected:
@@ -493,14 +442,14 @@
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
- TracedCallback<Ptr<const ContentObject>, Ptr<const Packet>,
+ TracedCallback<Ptr<const ContentObject>,
bool /*from cache*/,
Ptr<const Face> > m_outData; ///< @brief trace of outgoing Data
- TracedCallback<Ptr<const ContentObject>, Ptr<const Packet>,
+ TracedCallback<Ptr<const ContentObject>,
Ptr<const Face> > m_inData; ///< @brief trace of incoming Data
- TracedCallback<Ptr<const ContentObject>, Ptr<const Packet>,
+ TracedCallback<Ptr<const ContentObject>,
Ptr<const Face> > m_dropData; ///< @brief trace of dropped Data
////////////////////////////////////////////////////////////////////
diff --git a/model/fw/per-fib-limits.h b/model/fw/per-fib-limits.h
index 633bd5e..560432a 100644
--- a/model/fw/per-fib-limits.h
+++ b/model/fw/per-fib-limits.h
@@ -99,8 +99,7 @@
virtual bool
CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/// \copydoc ForwardingStrategy::WillSatisfyPendingInterest
@@ -141,8 +140,7 @@
bool
PerFibLimits<Parent>::CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
@@ -152,7 +150,7 @@
if (fibLimits->IsBelowLimit ())
{
- if (super::CanSendOutInterest (inFace, outFace, header, origPacket, pitEntry))
+ if (super::CanSendOutInterest (inFace, outFace, interest, pitEntry))
{
fibLimits->BorrowLimit ();
return true;
@@ -185,7 +183,7 @@
template<class Parent>
void
PerFibLimits<Parent>::WillSatisfyPendingInterest (Ptr<Face> inFace,
- Ptr<pit::Entry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
diff --git a/model/fw/per-out-face-limits.h b/model/fw/per-out-face-limits.h
index 08e892b..fcdd43f 100644
--- a/model/fw/per-out-face-limits.h
+++ b/model/fw/per-out-face-limits.h
@@ -87,8 +87,7 @@
virtual bool
CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/// \copydoc ForwardingStrategy::WillSatisfyPendingInterest
@@ -134,8 +133,7 @@
bool
PerOutFaceLimits<Parent>::CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
@@ -143,7 +141,7 @@
Ptr<Limits> faceLimits = outFace->template GetObject<Limits> ();
if (faceLimits->IsBelowLimit ())
{
- if (super::CanSendOutInterest (inFace, outFace, header, origPacket, pitEntry))
+ if (super::CanSendOutInterest (inFace, outFace, interest, pitEntry))
{
faceLimits->BorrowLimit ();
return true;
@@ -175,7 +173,7 @@
template<class Parent>
void
PerOutFaceLimits<Parent>::WillSatisfyPendingInterest (Ptr<Face> inFace,
- Ptr<pit::Entry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
diff --git a/model/fw/smart-flooding.cc b/model/fw/smart-flooding.cc
index 97faaf7..86ec8ee 100644
--- a/model/fw/smart-flooding.cc
+++ b/model/fw/smart-flooding.cc
@@ -66,14 +66,13 @@
bool
SmartFlooding::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
// Try to work out with just green faces
- bool greenOk = super::DoPropagateInterest (inFace, header, origPacket, pitEntry);
+ bool greenOk = super::DoPropagateInterest (inFace, interest, pitEntry);
if (greenOk)
return true;
@@ -85,7 +84,7 @@
if (metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
- if (!TrySendOutInterest (inFace, metricFace.GetFace (), header, origPacket, pitEntry))
+ if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
{
continue;
}
diff --git a/model/fw/smart-flooding.h b/model/fw/smart-flooding.h
index e1637aa..9263172 100644
--- a/model/fw/smart-flooding.h
+++ b/model/fw/smart-flooding.h
@@ -55,8 +55,7 @@
// inherited
virtual bool
DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
protected:
diff --git a/model/ndn-app-face.cc b/model/ndn-app-face.cc
index 669f9a8..b66fa92 100644
--- a/model/ndn-app-face.cc
+++ b/model/ndn-app-face.cc
@@ -76,66 +76,42 @@
{
}
-AppFace& AppFace::operator= (const AppFace &)
+AppFace&
+AppFace::operator= (const AppFace &)
{
return *((AppFace*)0);
}
-
-void
-AppFace::RegisterProtocolHandler (ProtocolHandler handler)
+bool
+AppFace::SendInterest (Ptr<const Interest> interest)
{
- NS_LOG_FUNCTION (this);
+ NS_LOG_FUNCTION (this << interest);
- Face::RegisterProtocolHandler (handler);
+ if (!IsUp ())
+ {
+ return false;
+ }
- m_app->RegisterProtocolHandler (MakeCallback (&Face::Receive, this));
+ if (interest->GetNack () > 0)
+ m_app->OnNack (interest);
+ else
+ m_app->OnInterest (interest);
+
+ return true;
}
bool
-AppFace::SendImpl (Ptr<Packet> p)
+AppFace::SendData (Ptr<const ContentObject> data)
{
- NS_LOG_FUNCTION (this << p);
+ NS_LOG_FUNCTION (this << data);
- try
+ if (!IsUp ())
{
- HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (p);
- switch (type)
- {
- case HeaderHelper::INTEREST_NDNSIM:
- {
- Ptr<Interest> header = Create<Interest> ();
- p->RemoveHeader (*header);
-
- if (header->GetNack () > 0)
- m_app->OnNack (header, p);
- else
- m_app->OnInterest (header, p);
-
- break;
- }
- case HeaderHelper::CONTENT_OBJECT_NDNSIM:
- {
- static ContentObjectTail tail;
- Ptr<ContentObject> header = Create<ContentObject> ();
- p->RemoveHeader (*header);
- p->RemoveTrailer (tail);
- m_app->OnContentObject (header, p/*payload*/);
-
- break;
- }
- default:
- NS_FATAL_ERROR ("ccnb support is currently broken");
- break;
- }
-
- return true;
- }
- catch (UnknownHeaderException)
- {
- NS_LOG_ERROR ("Unknown header type");
return false;
}
+
+ m_app->OnContentObject (data);
+ return true;
}
std::ostream&
diff --git a/model/ndn-app-face.h b/model/ndn-app-face.h
index 3a90f11..5c88b4e 100644
--- a/model/ndn-app-face.h
+++ b/model/ndn-app-face.h
@@ -63,12 +63,11 @@
////////////////////////////////////////////////////////////////////
// methods overloaded from Face
- virtual void
- RegisterProtocolHandler (ProtocolHandler handler);
-
-protected:
virtual bool
- SendImpl (Ptr<Packet> p);
+ SendInterest (Ptr<const Interest> interest);
+
+ virtual bool
+ SendData (Ptr<const ContentObject> data);
public:
virtual std::ostream&
diff --git a/model/ndn-common.h b/model/ndn-common.h
new file mode 100644
index 0000000..de21c29
--- /dev/null
+++ b/model/ndn-common.h
@@ -0,0 +1,39 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * BSD license, See the doc/LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_COMMON_H
+#define NDN_COMMON_H
+
+#include "ns3/nstime.h"
+#include "ns3/simulator.h"
+
+#define NDNSIM_MODE 1
+
+#define NDN_NAMESPACE_BEGIN namespace ns3 { namespace ndn {
+#define NDN_NAMESPACE_END } /*ndn*/ } /*ns3*/
+
+NDN_NAMESPACE_BEGIN
+
+typedef Time TimeInterval;
+
+namespace time
+{
+
+inline Time
+NowUnixTimestamp ()
+{
+ return Simulator::Now ();
+}
+
+}
+
+NDN_NAMESPACE_END
+
+#endif // NDN_COMMON_H
diff --git a/model/ndn-content-object.cc b/model/ndn-content-object.cc
index 052cd4a..9df1d27 100644
--- a/model/ndn-content-object.cc
+++ b/model/ndn-content-object.cc
@@ -30,22 +30,25 @@
namespace ns3 {
namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (ContentObject);
-NS_OBJECT_ENSURE_REGISTERED (ContentObjectTail);
-
-TypeId
-ContentObject::GetTypeId (void)
+ContentObject::ContentObject (Ptr<Packet> payload/* = Create<Packet> ()*/)
+ : m_name (Create<Name> ())
+ , m_signature (0)
+ , m_payload (payload)
+ , m_wire (0)
{
- static TypeId tid = TypeId ("ns3::ndn::ContentObject")
- .SetGroupName ("Ndn")
- .SetParent<Header> ()
- .AddConstructor<ContentObject> ()
- ;
- return tid;
+ if (m_payload == 0) // just in case
+ {
+ m_payload = Create<Packet> ();
+ }
}
-ContentObject::ContentObject ()
- : m_signature (0)
+ContentObject::ContentObject (const ContentObject &other)
+ : m_name (Create<Name> (other.GetName ()))
+ , m_freshness (other.GetFreshness ())
+ , m_timestamp (other.GetTimestamp ())
+ , m_signature (other.GetSignature ())
+ , m_payload (other.GetPayload ()->Copy ())
+ , m_wire (0)
{
}
@@ -53,12 +56,14 @@
ContentObject::SetName (Ptr<Name> name)
{
m_name = name;
+ m_wire = 0;
}
void
ContentObject::SetName (const Name &name)
{
m_name = Create<Name> (name);
+ m_wire = 0;
}
const Name&
@@ -79,6 +84,7 @@
ContentObject::SetTimestamp (const Time ×tamp)
{
m_timestamp = timestamp;
+ m_wire = 0;
}
Time
@@ -91,8 +97,10 @@
ContentObject::SetFreshness (const Time &freshness)
{
m_freshness = freshness;
+ m_wire = 0;
}
+
Time
ContentObject::GetFreshness () const
{
@@ -103,6 +111,7 @@
ContentObject::SetSignature (uint32_t signature)
{
m_signature = signature;
+ m_wire = 0;
}
uint32_t
@@ -111,114 +120,18 @@
return m_signature;
}
-uint32_t
-ContentObject::GetSerializedSize () const
-{
- uint32_t size = 1 + 1 + 2 +
- ((2 + 2) + (m_name->GetSerializedSize ()) + (2 + 2 + 4 + 2 + 2 + (2 + 0)));
- if (m_signature != 0)
- size += 4;
-
- NS_LOG_INFO ("Serialize size = " << size);
- return size;
-}
-
void
-ContentObject::Serialize (Buffer::Iterator start) const
+ContentObject::SetKeyLocator (Ptr<Name> keyLocator)
{
- start.WriteU8 (0x80); // version
- start.WriteU8 (0x01); // packet type
- start.WriteU16 (GetSerializedSize () - 4); // length
-
- if (m_signature != 0)
- {
- start.WriteU16 (6); // signature length
- start.WriteU16 (0xFF00); // "fake" simulator signature
- start.WriteU32 (m_signature);
- }
- else
- {
- start.WriteU16 (2); // signature length
- start.WriteU16 (0); // empty signature
- }
-
- // name
- uint32_t offset = m_name->Serialize (start);
- NS_LOG_DEBUG ("Offset: " << offset);
- start.Next (offset);
-
- // content
- // for now assume that contentdata length is zero
- start.WriteU16 (2 + 4 + 2 + 2 + (2 + 0));
- start.WriteU16 (4 + 2 + 2 + (2 + 0));
- start.WriteU32 (static_cast<uint32_t> (m_timestamp.ToInteger (Time::S)));
- start.WriteU16 (static_cast<uint16_t> (m_freshness.ToInteger (Time::S)));
- start.WriteU16 (0); // reserved
- start.WriteU16 (0); // Length (ContentInfoOptions)
-
- // that's it folks
+ m_keyLocator = keyLocator;
}
-
-uint32_t
-ContentObject::Deserialize (Buffer::Iterator start)
+Ptr<const Name>
+ContentObject::GetKeyLocator () const
{
- Buffer::Iterator i = start;
-
- if (i.ReadU8 () != 0x80)
- throw new ContentObjectException ();
-
- if (i.ReadU8 () != 0x01)
- throw new ContentObjectException ();
-
- i.ReadU16 (); // length
-
- uint32_t signatureLength = i.ReadU16 ();
- if (signatureLength == 6)
- {
- if (i.ReadU16 () != 0xFF00) // signature type
- throw new ContentObjectException ();
- m_signature = i.ReadU32 ();
- }
- else if (signatureLength == 2)
- {
- if (i.ReadU16 () != 0) // signature type
- throw new ContentObjectException ();
- m_signature = 0;
- }
- else
- throw new ContentObjectException ();
-
- m_name = Create<Name> ();
- uint32_t offset = m_name->Deserialize (i);
- i.Next (offset);
-
- if (i.ReadU16 () != (2 + 4 + 2 + 2 + (2 + 0))) // content length
- throw new ContentObjectException ();
-
- if (i.ReadU16 () != (4 + 2 + 2 + (2 + 0))) // Length (content Info)
- throw new ContentObjectException ();
-
- m_timestamp = Seconds (i.ReadU32 ());
- m_freshness = Seconds (i.ReadU16 ());
-
- if (i.ReadU16 () != 0) // Reserved
- throw new ContentObjectException ();
- if (i.ReadU16 () != 0) // Length (ContentInfoOptions)
- throw new ContentObjectException ();
-
- NS_ASSERT_MSG (i.GetDistanceFrom (start) == GetSerializedSize (),
- "Something wrong with ContentObject::Deserialize");
-
- return i.GetDistanceFrom (start);
+ return m_keyLocator;
}
-
-TypeId
-ContentObject::GetInstanceTypeId (void) const
-{
- return GetTypeId ();
-}
-
+
void
ContentObject::Print (std::ostream &os) const
{
@@ -226,49 +139,17 @@
// os << "<ContentObject><Name>" << GetName () << "</Name><Content>";
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ContentObjectTail::ContentObjectTail ()
-{
-}
-
-TypeId
-ContentObjectTail::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::ndn::ContentObjectTail")
- .SetParent<Trailer> ()
- .AddConstructor<ContentObjectTail> ()
- ;
- return tid;
-}
-
-TypeId
-ContentObjectTail::GetInstanceTypeId (void) const
-{
- return GetTypeId ();
-}
-
void
-ContentObjectTail::Print (std::ostream &os) const
+ContentObject::SetPayload (Ptr<Packet> payload)
{
- // os << "</Content></ContentObject>";
+ m_payload = payload;
+ m_wire = 0;
}
-uint32_t
-ContentObjectTail::GetSerializedSize (void) const
+Ptr<const Packet>
+ContentObject::GetPayload () const
{
- return 0;
-}
-
-void
-ContentObjectTail::Serialize (Buffer::Iterator start) const
-{
-}
-
-uint32_t
-ContentObjectTail::Deserialize (Buffer::Iterator start)
-{
- return 0;
+ return m_payload;
}
} // namespace ndn
diff --git a/model/ndn-content-object.h b/model/ndn-content-object.h
index 9803efe..58e88a3 100644
--- a/model/ndn-content-object.h
+++ b/model/ndn-content-object.h
@@ -22,66 +22,34 @@
#ifndef _NDN_CONTENT_OBJECT_HEADER_H_
#define _NDN_CONTENT_OBJECT_HEADER_H_
-#include "ns3/integer.h"
-#include "ns3/header.h"
#include "ns3/simple-ref-count.h"
-#include "ns3/trailer.h"
#include "ns3/nstime.h"
+#include "ns3/packet.h"
+#include "ns3/ptr.h"
-#include <string>
-#include <vector>
-#include <list>
-
-#include "ndn-name.h"
+#include <ns3/ndn-name.h>
namespace ns3 {
namespace ndn {
/**
- * ContentObject header
- *
- * Only few important fields are actually implemented in the simulation
- *
- * @see http://ndnsim.net/new-packet-formats.html
- *
- * Optimized and simplified formatting of Interest packets
- *
- * ContentObject ::= Signature
- * Name
- * Content
- *
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
- * ~ ~
- * ~ Signature ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
- * ~ ~
- * ~ Name ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
- * ~ ~
- * ~ Content ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
+ * @ingroup Ndn
+ * @brief ContentObject header
*/
-class ContentObject : public SimpleRefCount<ContentObject,Header>
+class ContentObject : public SimpleRefCount<ContentObject>
{
public:
/**
- * Constructor
+ * @brief Constructor
*
* Creates a null header
**/
- ContentObject ();
+ ContentObject (Ptr<Packet> payload = Create<Packet> ());
+
+ /**
+ * @brief Copy constructor
+ */
+ ContentObject (const ContentObject &other);
/**
* \brief Set content object name
@@ -154,41 +122,80 @@
uint32_t
GetSignature () const;
+ /**
+ * @brief Set key locator
+ * @param keyLocator name of the key
+ */
+ void
+ SetKeyLocator (Ptr<Name> keyLocator);
+
+ /**
+ * @brief Get key locator
+ *
+ * Note that only <KeyName> option for the key locator is supported
+ */
+ Ptr<const Name>
+ GetKeyLocator () const;
+
//////////////////////////////////////////////////////////////////
+ /**
+ * @brief Get payload of data packet
+ *
+ * This payload can also carry packet tags
+ */
+ void
+ SetPayload (Ptr<Packet> payload);
- static TypeId GetTypeId (void); ///< @brief Get TypeId
- virtual TypeId GetInstanceTypeId (void) const; ///< @brief Get TypeId of the instance
- virtual void Print (std::ostream &os) const; ///< @brief Print out information about the Header into the stream
- virtual uint32_t GetSerializedSize (void) const; ///< @brief Get size necessary to serialize the Header
- virtual void Serialize (Buffer::Iterator start) const; ///< @brief Serialize the Header
- virtual uint32_t Deserialize (Buffer::Iterator start); ///< @brief Deserialize the Header
+ /**
+ * @brief Set payload of data packet
+ *
+ * This payload can also carry packet tags
+ */
+ Ptr<const Packet>
+ GetPayload () const;
+
+ /**
+ * @brief Get wire formatted packet
+ *
+ * If wire formatted packet has not been set before, 0 will be returned
+ */
+ inline Ptr<const Packet>
+ GetWire () const;
+ /**
+ * @brief Set (cache) wire formatted packet
+ */
+ inline void
+ SetWire (Ptr<const Packet> packet) const;
+
+ /**
+ * @brief Print Interest in plain-text to the specified output stream
+ */
+ void
+ Print (std::ostream &os) const;
+
+private:
+ // NO_ASSIGN
+ ContentObject &
+ operator = (const ContentObject &other) { return *this; }
+
private:
Ptr<Name> m_name;
Time m_freshness;
Time m_timestamp;
uint32_t m_signature; // 0, means no signature, any other value application dependent (not a real signature)
+ Ptr<Packet> m_payload;
+ Ptr<Name> m_keyLocator;
+
+ mutable Ptr<const Packet> m_wire;
};
-typedef ContentObject ContentObjectHeader;
-
-/**
- * ContentObjectTail for compatibility with other packet formats
- */
-class ContentObjectTail : public Trailer
+inline std::ostream &
+operator << (std::ostream &os, const ContentObject &d)
{
-public:
- ContentObjectTail ();
- //////////////////////////////////////////////////////////////////
-
- static TypeId GetTypeId (void); ///< @brief Get TypeId
- virtual TypeId GetInstanceTypeId (void) const; ///< @brief Get TypeId of the instance
- virtual void Print (std::ostream &os) const; ///< @brief Print out information about Tail into the stream
- virtual uint32_t GetSerializedSize (void) const; ///< @brief Get size necessary to serialize the Tail
- virtual void Serialize (Buffer::Iterator start) const; ///< @brief Serialize the Tail
- virtual uint32_t Deserialize (Buffer::Iterator start); ///< @brief Deserialize the Tail
-};
-
+ d.Print (os);
+ return os;
+}
/**
* @ingroup ndn-exceptions
@@ -196,6 +203,19 @@
*/
class ContentObjectException {};
+inline Ptr<const Packet>
+ContentObject::GetWire () const
+{
+ return m_wire;
+}
+
+inline void
+ContentObject::SetWire (Ptr<const Packet> packet) const
+{
+ m_wire = packet;
+}
+
+
} // namespace ndn
} // namespace ns3
diff --git a/model/ndn-face.cc b/model/ndn-face.cc
index 625af55..57a8c4d 100644
--- a/model/ndn-face.cc
+++ b/model/ndn-face.cc
@@ -32,8 +32,11 @@
#include "ns3/random-variable.h"
#include "ns3/pointer.h"
+#include "ns3/ndn-header-helper.h"
#include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.h"
+#include "ns3/ndn-wire.h"
+
#include <boost/ref.hpp>
NS_LOG_COMPONENT_DEFINE ("ndn.Face");
@@ -54,13 +57,6 @@
UintegerValue (0),
MakeUintegerAccessor (&Face::m_id),
MakeUintegerChecker<uint32_t> ())
-
- .AddTraceSource ("NdnTx", "Transmitted packet trace",
- MakeTraceSourceAccessor (&Face::m_txTrace))
- .AddTraceSource ("NdnRx", "Received packet trace",
- MakeTraceSourceAccessor (&Face::m_rxTrace))
- .AddTraceSource ("NdnDrop", "Dropped packet trace",
- MakeTraceSourceAccessor (&Face::m_dropTrace))
;
return tid;
}
@@ -72,7 +68,8 @@
*/
Face::Face (Ptr<Node> node)
: m_node (node)
- , m_protocolHandler (MakeNullCallback<void,const Ptr<Face>&,const Ptr<const Packet>&> ())
+ , m_upstreamInterestHandler (MakeNullCallback< void, Ptr<Face>, Ptr<Interest> > ())
+ , m_upstreamDataHandler (MakeNullCallback< void, Ptr<Face>, Ptr<ContentObject> > ())
, m_ifup (false)
, m_id ((uint32_t)-1)
, m_metric (0)
@@ -104,25 +101,53 @@
}
void
-Face::RegisterProtocolHandler (ProtocolHandler handler)
+Face::RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler)
{
NS_LOG_FUNCTION_NOARGS ();
- m_protocolHandler = handler;
+ m_upstreamInterestHandler = interestHandler;
+ m_upstreamDataHandler = dataHandler;
+}
+
+void
+Face::UnRegisterProtocolHandlers ()
+{
+ NS_LOG_FUNCTION_NOARGS ();
+
+ m_upstreamInterestHandler = MakeNullCallback< void, Ptr<Face>, Ptr<Interest> > ();
+ m_upstreamDataHandler = MakeNullCallback< void, Ptr<Face>, Ptr<ContentObject> > ();
+}
+
+
+bool
+Face::SendInterest (Ptr<const Interest> interest)
+{
+ NS_LOG_FUNCTION (this << boost::cref (*this) << interest->GetName ());
+
+ if (!IsUp ())
+ {
+ return false;
+ }
+
+ return Send (Wire::FromInterest (interest));
+}
+
+bool
+Face::SendData (Ptr<const ContentObject> data)
+{
+ NS_LOG_FUNCTION (this << data);
+
+ if (!IsUp ())
+ {
+ return false;
+ }
+
+ return Send (Wire::FromData (data));
}
bool
Face::Send (Ptr<Packet> packet)
{
- NS_LOG_FUNCTION (boost::cref (*this) << packet << packet->GetSize ());
- NS_LOG_DEBUG (*packet);
-
- if (!IsUp ())
- {
- m_dropTrace (packet);
- return false;
- }
-
FwHopCountTag hopCount;
bool tagExists = packet->RemovePacketTag (hopCount);
if (tagExists)
@@ -131,23 +156,13 @@
packet->AddPacketTag (hopCount);
}
- bool ok = SendImpl (packet);
- if (ok)
- {
- m_txTrace (packet);
- return true;
- }
- else
- {
- m_dropTrace (packet);
- return false;
- }
+ return true;
}
bool
-Face::Receive (const Ptr<const Packet> &packet)
+Face::Receive (Ptr<const Packet> p)
{
- NS_LOG_FUNCTION (boost::cref (*this) << packet << packet->GetSize ());
+ NS_LOG_FUNCTION (this << p << p->GetSize ());
if (!IsUp ())
{
@@ -155,9 +170,59 @@
return false;
}
- m_rxTrace (packet);
- m_protocolHandler (this, packet);
+ Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
+ try
+ {
+ HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (packet);
+ switch (type)
+ {
+ case HeaderHelper::INTEREST_NDNSIM:
+ return ReceiveInterest (Wire::ToInterest (packet, Wire::WIRE_FORMAT_NDNSIM));
+ case HeaderHelper::INTEREST_CCNB:
+ return ReceiveInterest (Wire::ToInterest (packet, Wire::WIRE_FORMAT_CCNB));
+ case HeaderHelper::CONTENT_OBJECT_NDNSIM:
+ return ReceiveData (Wire::ToData (packet, Wire::WIRE_FORMAT_NDNSIM));
+ case HeaderHelper::CONTENT_OBJECT_CCNB:
+ return ReceiveData (Wire::ToData (packet, Wire::WIRE_FORMAT_CCNB));
+ default:
+ NS_FATAL_ERROR ("Not supported NDN header");
+ return false;
+ }
+ // exception will be thrown if packet is not recognized
+ }
+ catch (UnknownHeaderException)
+ {
+ NS_FATAL_ERROR ("Unknown NDN header. Should not happen");
+ return false;
+ }
+
+ return false;
+}
+
+bool
+Face::ReceiveInterest (Ptr<Interest> interest)
+{
+ if (!IsUp ())
+ {
+ // no tracing here. If we were off while receiving, we shouldn't even know that something was there
+ return false;
+ }
+
+ m_upstreamInterestHandler (this, interest);
+ return true;
+}
+
+bool
+Face::ReceiveData (Ptr<ContentObject> data)
+{
+ if (!IsUp ())
+ {
+ // no tracing here. If we were off while receiving, we shouldn't even know that something was there
+ return false;
+ }
+
+ m_upstreamDataHandler (this, data);
return true;
}
@@ -171,37 +236,15 @@
uint16_t
Face::GetMetric (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
return m_metric;
}
-/**
- * These are face states and may be distinct from
- * NetDevice states, such as found in real implementations
- * (where the device may be down but face state is still up).
- */
-
-bool
-Face::IsUp (void) const
-{
- NS_LOG_FUNCTION_NOARGS ();
- return m_ifup;
-}
-
-void
-Face::SetUp (bool up/* = true*/)
-{
- NS_LOG_FUNCTION_NOARGS ();
- m_ifup = up;
-}
-
void
Face::SetFlags (uint32_t flags)
{
m_flags = flags;
}
-
bool
Face::operator== (const Face &face) const
{
diff --git a/model/ndn-face.h b/model/ndn-face.h
index 97c75f9..1fdc7f0 100644
--- a/model/ndn-face.h
+++ b/model/ndn-face.h
@@ -29,7 +29,7 @@
#include "ns3/nstime.h"
#include "ns3/type-id.h"
#include "ns3/traced-callback.h"
-#include "ns3/ndn-limits.h"
+#include "ns3/ndn-name.h"
namespace ns3 {
@@ -38,6 +38,9 @@
namespace ndn {
+class Interest;
+class ContentObject;
+
/**
* \ingroup ndn
* \defgroup ndn-face Faces
@@ -60,12 +63,13 @@
GetTypeId ();
/**
- * \brief NDN protocol handler
+ * \brief NDN protocol handlers
*
* \param face Face from which packet has been received
* \param packet Original packet
*/
- typedef Callback<void,const Ptr<Face>&,const Ptr<const Packet>& > ProtocolHandler;
+ typedef Callback<void, Ptr<Face>, Ptr<Interest> > InterestHandler;
+ typedef Callback<void, Ptr<Face>, Ptr<ContentObject> > DataHandler;
/**
* \brief Default constructor
@@ -87,27 +91,51 @@
* This method should call protocol-dependent registration function
*/
virtual void
- RegisterProtocolHandler (ProtocolHandler handler);
+ RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler);
/**
- * \brief Send packet on a face
+ * \brief Un-Register callback to call when new packet arrives on the face
*
- * This method will be called by lower layers to send data to device or application
- *
- * \param p smart pointer to a packet to send
- *
- * @return false if either limit is reached
+ * This method should call protocol-dependent registration function
*/
- bool
- Send (Ptr<Packet> p);
+ virtual void
+ UnRegisterProtocolHandlers ();
/**
- * \brief Receive packet from application or another node and forward it to the Ndn stack
+ * @brief Send out interest through the face
+ * @param interest Interest to send out
+ * @param packet "payload" that is attached to the interest (can carry some packet tags)
*
- * \todo The only reason for this call is to handle tracing, if requested
+ * @returns true if interest is considered to be send out (enqueued)
*/
- bool
- Receive (const Ptr<const Packet> &p);
+ virtual bool
+ SendInterest (Ptr<const Interest> interest);
+
+ /**
+ * @brief Send out Dat packet through the face
+ * @param data Data packet to send out
+ * @param packet Data packet payload, can also carry packet tags
+ *
+ * @returns true if Data packet is considered to be send out (enqueued)
+ */
+ virtual bool
+ SendData (Ptr<const ContentObject> data);
+
+ /**
+ * \brief Receive interest from application or another node and forward it up to the NDN stack
+ *
+ * By default it is called from inside Receive method, but can be used directly, if appropriate
+ */
+ virtual bool
+ ReceiveInterest (Ptr<Interest> interest);
+
+ /**
+ * \brief Receive Data packet from application or another node and forward it up to the NDN stack
+ *
+ * By default it is called from inside Receive method, but can be used directly, if appropriate
+ */
+ virtual bool
+ ReceiveData (Ptr<ContentObject> data);
////////////////////////////////////////////////////////////////////
/**
@@ -135,13 +163,13 @@
/**
* \brief Enable or disable this face
*/
- virtual void
+ inline void
SetUp (bool up = true);
/**
* \brief Returns true if this face is enabled, false otherwise.
*/
- virtual bool
+ inline bool
IsUp () const;
/**
@@ -162,7 +190,7 @@
{
APPLICATION = 1 ///< @brief An application face
};
-
+
/**
* @brief Print information about the face into the stream
* @param os stream to write information to
@@ -216,13 +244,20 @@
protected:
/**
- * \brief Send packet on a face (actual implementation)
- *
- * \param p smart pointer to a packet to send
+ * @brief Send packet down to the stack (towards app or network)
*/
virtual bool
- SendImpl (Ptr<Packet> p) = 0;
+ Send (Ptr<Packet> packet);
+ /**
+ * @brief Send packet up to the stack (towards forwarding strategy)
+ */
+ virtual bool
+ Receive (Ptr<const Packet> p);
+
+ /**
+ * @brief Set face flags
+ */
void
SetFlags (uint32_t flags);
@@ -234,20 +269,29 @@
Ptr<Node> m_node; ///< \brief Smart pointer to Node
private:
- ProtocolHandler m_protocolHandler; ///< Callback via which packets are getting send to Ndn stack
- bool m_ifup; ///< \brief flag indicating that the interface is UP
+ InterestHandler m_upstreamInterestHandler;
+ DataHandler m_upstreamDataHandler;
+ bool m_ifup;
uint32_t m_id; ///< \brief id of the interface in NDN stack (per-node uniqueness)
uint32_t m_metric; ///< \brief metric of the face
- uint32_t m_flags;
-
- TracedCallback<Ptr<const Packet> > m_txTrace;
- TracedCallback<Ptr<const Packet> > m_rxTrace;
- TracedCallback<Ptr<const Packet> > m_dropTrace;
+ uint32_t m_flags; ///< @brief faces flags (e.g., APPLICATION)
};
std::ostream&
operator<< (std::ostream& os, const Face &face);
+inline bool
+Face::IsUp (void) const
+{
+ return m_ifup;
+}
+
+inline void
+Face::SetUp (bool up/* = true*/)
+{
+ m_ifup = up;
+}
+
inline uint32_t
Face::GetFlags () const
{
diff --git a/model/ndn-interest.cc b/model/ndn-interest.cc
index f0a4f29..3b09fde 100644
--- a/model/ndn-interest.cc
+++ b/model/ndn-interest.cc
@@ -29,57 +29,47 @@
namespace ns3 {
namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (Interest);
-
-TypeId
-Interest::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::ndn::Interest")
- .SetGroupName ("Ndn")
- .SetParent<Header> ()
- .AddConstructor<Interest> ()
- ;
- return tid;
-}
-
-
-Interest::Interest ()
+Interest::Interest (Ptr<Packet> payload/* = Create<Packet> ()*/)
: m_name ()
, m_scope (0xFF)
, m_interestLifetime (Seconds (0))
, m_nonce (0)
, m_nackType (NORMAL_INTEREST)
+ , m_exclude (0)
+ , m_payload (payload)
+ , m_wire (0)
{
+ if (m_payload == 0) // just in case
+ {
+ m_payload = Create<Packet> ();
+ }
}
Interest::Interest (const Interest &interest)
- : m_name (Create<Name> (interest.GetName ()))
- , m_scope (interest.m_scope)
- , m_interestLifetime (interest.m_interestLifetime)
- , m_nonce (interest.m_nonce)
- , m_nackType (interest.m_nackType)
+ : m_name (Create<Name> (interest.GetName ()))
+ , m_scope (interest.m_scope)
+ , m_interestLifetime (interest.m_interestLifetime)
+ , m_nonce (interest.m_nonce)
+ , m_nackType (interest.m_nackType)
+ , m_exclude (interest.m_exclude ? Create<Exclude> (*interest.GetExclude ()) : 0)
+ , m_payload (interest.GetPayload ()->Copy ())
+ , m_wire (0)
{
-}
-
-Ptr<Interest>
-Interest::GetInterest (Ptr<Packet> packet)
-{
- Ptr<Interest> interest = Create<Interest> ();
- packet->RemoveHeader (*interest);
-
- return interest;
+ NS_LOG_FUNCTION ("correct copy constructor");
}
void
Interest::SetName (Ptr<Name> name)
{
m_name = name;
+ m_wire = 0;
}
void
Interest::SetName (const Name &name)
{
m_name = Create<Name> (name);
+ m_wire = 0;
}
const Name&
@@ -99,6 +89,7 @@
Interest::SetScope (int8_t scope)
{
m_scope = scope;
+ m_wire = 0;
}
int8_t
@@ -111,6 +102,7 @@
Interest::SetInterestLifetime (Time lifetime)
{
m_interestLifetime = lifetime;
+ m_wire = 0;
}
Time
@@ -123,6 +115,7 @@
Interest::SetNonce (uint32_t nonce)
{
m_nonce = nonce;
+ m_wire = 0;
}
uint32_t
@@ -135,6 +128,7 @@
Interest::SetNack (uint8_t nackType)
{
m_nackType = nackType;
+ m_wire = 0;
}
uint8_t
@@ -143,82 +137,32 @@
return m_nackType;
}
-uint32_t
-Interest::GetSerializedSize (void) const
-{
- size_t size =
- 1/*version*/ + 1 /*type*/ + 2/*length*/ +
- (4/*nonce*/ + 1/*scope*/ + 1/*nack type*/ + 2/*timestamp*/ +
- (m_name->GetSerializedSize ()) +
- (2 + 0)/* selectors */ +
- (2 + 0)/* options */);
- NS_LOG_INFO ("Serialize size = " << size);
-
- return size;
-}
-
void
-Interest::Serialize (Buffer::Iterator start) const
+Interest::SetExclude (Ptr<Exclude> exclude)
{
- start.WriteU8 (0x80); // version
- start.WriteU8 (0x00); // packet type
-
- start.WriteU16 (GetSerializedSize () - 4);
-
- start.WriteU32 (m_nonce);
- start.WriteU8 (m_scope);
- start.WriteU8 (m_nackType);
-
- NS_ASSERT_MSG (0 <= m_interestLifetime.ToInteger (Time::S) && m_interestLifetime.ToInteger (Time::S) < 65535,
- "Incorrect InterestLifetime (should not be smaller than 0 and larger than 65535");
-
- // rounding timestamp value to seconds
- start.WriteU16 (static_cast<uint16_t> (m_interestLifetime.ToInteger (Time::S)));
-
- uint32_t offset = m_name->Serialize (start);
- start.Next (offset);
-
- start.WriteU16 (0); // no selectors
- start.WriteU16 (0); // no options
+ m_exclude = exclude;
+ m_wire = 0;
}
-uint32_t
-Interest::Deserialize (Buffer::Iterator start)
+Ptr<const Exclude>
+Interest::GetExclude () const
{
- Buffer::Iterator i = start;
-
- if (i.ReadU8 () != 0x80)
- throw new InterestException ();
-
- if (i.ReadU8 () != 0x00)
- throw new InterestException ();
-
- i.ReadU16 (); // length, don't need it right now
-
- m_nonce = i.ReadU32 ();
- m_scope = i.ReadU8 ();
- m_nackType = i.ReadU8 ();
-
- m_interestLifetime = Seconds (i.ReadU16 ());
-
- m_name = Create<Name> ();
- uint32_t offset = m_name->Deserialize (i);
- i.Next (offset);
-
- i.ReadU16 ();
- i.ReadU16 ();
-
- NS_ASSERT (GetSerializedSize () == (i.GetDistanceFrom (start)));
-
- return i.GetDistanceFrom (start);
+ return m_exclude;
}
-TypeId
-Interest::GetInstanceTypeId (void) const
+void
+Interest::SetPayload (Ptr<Packet> payload)
{
- return GetTypeId ();
+ m_payload = payload;
+ m_wire = 0;
}
-
+
+Ptr<const Packet>
+Interest::GetPayload () const
+{
+ return m_payload;
+}
+
void
Interest::Print (std::ostream &os) const
{
diff --git a/model/ndn-interest.h b/model/ndn-interest.h
index c5808f7..748e2d9 100644
--- a/model/ndn-interest.h
+++ b/model/ndn-interest.h
@@ -22,16 +22,13 @@
#ifndef _NDN_INTEREST_HEADER_H_
#define _NDN_INTEREST_HEADER_H_
-#include "ns3/integer.h"
-#include "ns3/header.h"
#include "ns3/simple-ref-count.h"
#include "ns3/nstime.h"
+#include "ns3/packet.h"
+#include "ns3/ptr.h"
-#include <string>
-#include <vector>
-#include <list>
-
-#include "ndn-name.h"
+#include <ns3/ndnSIM/ndn.cxx/name.h>
+#include <ns3/ndnSIM/ndn.cxx/exclude.h>
namespace ns3 {
@@ -40,50 +37,10 @@
namespace ndn {
/**
- * @brief NDN Interest and routines to serialize/deserialize
- *
- * Optimized and simplified formatting of Interest packets
- *
- * Interest ::= Nonce
- * Scope
- * InterestLifetime
- * Name
- * Selectors
- * Options
- *
- * Minumum size of the Interest packet: 1 + 4 + 2 + 1 + (2 + 0) + (2 + 0) + (2 + 0) = 14
- *
- * Maximum size of the Interest packet: 1 + 4 + 2 + 1 + (2 + 65535) + (2 + 65535) + (2 + 65535) = 196619
- *
- * ::
- *
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Nonce |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Scope | Reserved | InterestLifetime |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
- * ~ ~
- * ~ Name ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
- * ~ ~
- * ~ Selectors ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
- * ~ ~
- * ~ Options ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * **/
-class Interest : public SimpleRefCount<Interest, Header>
+ * @brief NDN Interest (wire formats are defined in wire)
+ *
+ **/
+class Interest : public SimpleRefCount<Interest>
{
public:
/**
@@ -91,7 +48,7 @@
*
* Creates a null header
**/
- Interest ();
+ Interest (Ptr<Packet> payload = Create<Packet> ());
/**
* @brief Copy constructor
@@ -221,51 +178,92 @@
uint8_t
GetNack () const;
- //////////////////////////////////////////////////////////////////
-
- static TypeId GetTypeId (void); ///< @brief Get TypeId of the class
- virtual TypeId GetInstanceTypeId (void) const; ///< @brief Get TypeId of the instance
-
/**
- * \brief Print Interest packet
+ * @brief Set exclude filter of interest packet
+ *
+ * Empty or 0 means no exclude filter
*/
- virtual void Print (std::ostream &os) const;
-
- /**
- * \brief Get the size of Interest packet
- * Returns the Interest packet size after serialization
- */
- virtual uint32_t GetSerializedSize (void) const;
-
- /**
- * \brief Serialize Interest packet
- * Serializes Interest packet into Buffer::Iterator
- * @param[in] start buffer to contain serialized Interest packet
- */
- virtual void Serialize (Buffer::Iterator start) const;
-
- /**
- * \brief Deserialize Interest packet
- * Deserializes Buffer::Iterator into Interest packet
- * @param[in] start buffer that contains serialized Interest packet
- */
- virtual uint32_t Deserialize (Buffer::Iterator start);
+ void
+ SetExclude (Ptr<Exclude> exclude);
/**
- * @brief Cheat for python bindings
+ * @brief Get exclude filter of interest packet
*/
- static Ptr<Interest>
- GetInterest (Ptr<Packet> packet);
+ Ptr<const Exclude>
+ GetExclude () const;
+
+ /**
+ * @brief Set virtual "payload" of interest packet
+ *
+ * This payload can carry packet tags
+ */
+ void
+ SetPayload (Ptr<Packet> payload);
+
+ /**
+ * @brief Get virtual "payload" to interest packet
+ *
+ * This payload can carry packet tags
+ */
+ Ptr<const Packet>
+ GetPayload () const;
+
+ /**
+ * @brief Get wire formatted packet
+ *
+ * If wire formatted packet has not been set before, 0 will be returned
+ */
+ inline Ptr<const Packet>
+ GetWire () const;
+
+ /**
+ * @brief Set (cache) wire formatted packet
+ */
+ inline void
+ SetWire (Ptr<const Packet> packet) const;
+
+ /**
+ * @brief Print Interest in plain-text to the specified output stream
+ */
+ void
+ Print (std::ostream &os) const;
private:
- Ptr<Name> m_name; ///< Interest name
- uint8_t m_scope; ///< 0xFF not set, 0 local scope, 1 this host, 2 immediate neighborhood
- Time m_interestLifetime; ///< InterestLifetime
- uint32_t m_nonce; ///< Nonce. not used if zero
- uint8_t m_nackType; ///< Negative Acknowledgement type
+ // NO_ASSIGN
+ Interest &
+ operator = (const Interest &other) { return *this; }
+
+private:
+ Ptr<Name> m_name; ///< @brief Interest name
+ uint8_t m_scope; ///< @brief 0xFF not set, 0 local scope, 1 this host, 2 immediate neighborhood
+ Time m_interestLifetime; ///< @brief InterestLifetime
+ uint32_t m_nonce; ///< @brief Nonce. not used if zero
+ uint8_t m_nackType; ///< @brief Negative Acknowledgement type
+
+ Ptr<Exclude> m_exclude; ///< @brief Exclude filter
+ Ptr<Packet> m_payload; ///< @brief virtual payload
+
+ mutable Ptr<const Packet> m_wire;
};
-typedef Interest InterestHeader;
+inline std::ostream &
+operator << (std::ostream &os, const Interest &i)
+{
+ i.Print (os);
+ return os;
+}
+
+inline Ptr<const Packet>
+Interest::GetWire () const
+{
+ return m_wire;
+}
+
+inline void
+Interest::SetWire (Ptr<const Packet> packet) const
+{
+ m_wire = packet;
+}
/**
* @ingroup ndn-exceptions
diff --git a/model/ndn-l3-protocol.cc b/model/ndn-l3-protocol.cc
index 5593040..e89c9ea 100644
--- a/model/ndn-l3-protocol.cc
+++ b/model/ndn-l3-protocol.cc
@@ -32,7 +32,6 @@
#include "ns3/simulator.h"
#include "ns3/random-variable.h"
-#include "ns3/ndn-header-helper.h"
#include "ns3/ndn-pit.h"
#include "ns3/ndn-interest.h"
#include "ns3/ndn-content-object.h"
@@ -51,24 +50,8 @@
const uint16_t L3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
-uint64_t L3Protocol::s_interestCounter = 0;
-uint64_t L3Protocol::s_dataCounter = 0;
-
NS_OBJECT_ENSURE_REGISTERED (L3Protocol);
-uint64_t
-L3Protocol::GetInterestCounter ()
-{
- return s_interestCounter;
-}
-
-uint64_t
-L3Protocol::GetDataCounter ()
-{
- return s_dataCounter;
-}
-
-
TypeId
L3Protocol::GetTypeId (void)
{
@@ -84,7 +67,7 @@
return tid;
}
-L3Protocol::L3Protocol()
+L3Protocol::L3Protocol ()
: m_faceCounter (0)
{
NS_LOG_FUNCTION (this);
@@ -108,28 +91,14 @@
m_node = GetObject<Node> ();
if (m_node != 0)
{
- // NS_ASSERT_MSG (m_pit != 0 && m_fib != 0 && m_contentStore != 0 && m_forwardingStrategy != 0,
- // "PIT, FIB, and ContentStore should be aggregated before L3Protocol");
NS_ASSERT_MSG (m_forwardingStrategy != 0,
"Forwarding strategy should be aggregated before L3Protocol");
}
}
- // if (m_pit == 0)
- // {
- // m_pit = GetObject<Pit> ();
- // }
- // if (m_fib == 0)
- // {
- // m_fib = GetObject<Fib> ();
- // }
if (m_forwardingStrategy == 0)
{
m_forwardingStrategy = GetObject<ForwardingStrategy> ();
}
- // if (m_contentStore == 0)
- // {
- // m_contentStore = GetObject<ContentStore> ();
- // }
Object::NotifyNewAggregate ();
}
@@ -139,10 +108,10 @@
{
NS_LOG_FUNCTION (this);
- for (FaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
- {
- *i = 0;
- }
+ // for (FaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
+ // {
+ // *i = 0;
+ // }
m_faces.clear ();
m_node = 0;
@@ -160,7 +129,8 @@
face->SetId (m_faceCounter); // sets a unique ID of the face. This ID serves only informational purposes
// ask face to register in lower-layer stack
- face->RegisterProtocolHandler (MakeCallback (&L3Protocol::Receive, this));
+ face->RegisterProtocolHandlers (MakeCallback (&ForwardingStrategy::OnInterest, m_forwardingStrategy),
+ MakeCallback (&ForwardingStrategy::OnData, m_forwardingStrategy));
m_faces.push_back (face);
m_faceCounter++;
@@ -172,8 +142,9 @@
void
L3Protocol::RemoveFace (Ptr<Face> face)
{
+ NS_LOG_FUNCTION (this << boost::cref (*face));
// ask face to register in lower-layer stack
- face->RegisterProtocolHandler (MakeNullCallback<void,const Ptr<Face>&,const Ptr<const Packet>&> ());
+ face->UnRegisterProtocolHandlers ();
Ptr<Pit> pit = GetObject<Pit> ();
// just to be on a safe side. Do the process in two steps
@@ -196,7 +167,10 @@
}
FaceList::iterator face_it = find (m_faces.begin(), m_faces.end(), face);
- NS_ASSERT_MSG (face_it != m_faces.end (), "Attempt to remove face that doesn't exist");
+ if (face_it == m_faces.end ())
+ {
+ return;
+ }
m_faces.erase (face_it);
GetObject<Fib> ()->RemoveFromAll (face);
@@ -241,76 +215,5 @@
return m_faces.size ();
}
-// Callback from lower layer
-void
-L3Protocol::Receive (const Ptr<Face> &face, const Ptr<const Packet> &p)
-{
- if (!face->IsUp ())
- return;
-
- NS_LOG_DEBUG (*p);
-
- NS_LOG_LOGIC ("Packet from face " << *face << " received on node " << m_node->GetId ());
-
- Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
- try
- {
- HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (p);
- switch (type)
- {
- case HeaderHelper::INTEREST_NDNSIM:
- {
- s_interestCounter ++;
- Ptr<Interest> header = Create<Interest> ();
-
- // Deserialization. Exception may be thrown
- packet->RemoveHeader (*header);
-
- // this assert is legitimately failing with CSMA-style devices, when interest size is less then
- // minimally required 46 bytes. At the same time, it is safe to ignore the fact
- if (packet->GetSize () != 0)
- {
- NS_LOG_WARN ("Payload size is not zero. Valid only for CSMA (Ethernet) devices");
- }
- // NS_ASSERT_MSG (packet->GetSize () == 0, "Payload of Interests should be zero");
-
- m_forwardingStrategy->OnInterest (face, header, p/*original packet*/);
- // if (header->GetNack () > 0)
- // OnNack (face, header, p/*original packet*/);
- // else
- // OnInterest (face, header, p/*original packet*/);
- break;
- }
- case HeaderHelper::CONTENT_OBJECT_NDNSIM:
- {
- s_dataCounter ++;
- Ptr<ContentObject> header = Create<ContentObject> ();
-
- static ContentObjectTail contentObjectTrailer; //there is no data in this object
-
- // Deserialization. Exception may be thrown
- packet->RemoveHeader (*header);
- packet->RemoveTrailer (contentObjectTrailer);
-
- m_forwardingStrategy->OnData (face, header, packet/*payload*/, p/*original packet*/);
- break;
- }
- case HeaderHelper::INTEREST_CCNB:
- case HeaderHelper::CONTENT_OBJECT_CCNB:
- NS_FATAL_ERROR ("ccnb support is broken in this implementation");
- break;
- }
-
- // exception will be thrown if packet is not recognized
- }
- catch (UnknownHeaderException)
- {
- NS_ASSERT_MSG (false, "Unknown NDN header. Should not happen");
- NS_LOG_ERROR ("Unknown NDN header. Should not happen");
- return;
- }
-}
-
-
} //namespace ndn
} //namespace ns3
diff --git a/model/ndn-l3-protocol.h b/model/ndn-l3-protocol.h
index 2505a63..406e194 100644
--- a/model/ndn-l3-protocol.h
+++ b/model/ndn-l3-protocol.h
@@ -39,16 +39,11 @@
class Face;
class ForwardingStrategy;
-class Interest;
-class ContentObject;
-
-typedef Interest InterestHeader;
-typedef ContentObject ContentObjectHeader;
/**
* \defgroup ndn ndnSIM: NDN simulation module
*
- * This is a simplified modular implementation of NDN protocol
+ * This is a modular implementation of NDN protocol for NS-3
*/
/**
* \ingroup ndn
@@ -137,16 +132,6 @@
virtual Ptr<Face>
GetFaceByNetDevice (Ptr<NetDevice> netDevice) const;
- static uint64_t
- GetInterestCounter ();
-
- static uint64_t
- GetDataCounter ();
-
-private:
- void
- Receive (const Ptr<Face> &face, const Ptr<const Packet> &p);
-
protected:
virtual void DoDispose (void); ///< @brief Do cleanup
@@ -164,9 +149,6 @@
uint32_t m_faceCounter; ///< \brief counter of faces. Increased every time a new face is added to the stack
FaceList m_faces; ///< \brief list of faces that belongs to ndn stack on this node
- static uint64_t s_interestCounter;
- static uint64_t s_dataCounter;
-
// These objects are aggregated, but for optimization, get them here
Ptr<Node> m_node; ///< \brief node on which ndn stack is installed
Ptr<ForwardingStrategy> m_forwardingStrategy; ///< \brief smart pointer to the selected forwarding strategy
diff --git a/model/ndn-name.cc b/model/ndn-name.cc
deleted file mode 100644
index 1a3da80..0000000
--- a/model/ndn-name.cc
+++ /dev/null
@@ -1,215 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- * Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#include "ndn-name.h"
-#include <boost/foreach.hpp>
-#include "ns3/log.h"
-
-#include <iostream>
-
-using namespace std;
-
-NS_LOG_COMPONENT_DEFINE ("ndn.Name");
-
-namespace ns3 {
-namespace ndn {
-
-ATTRIBUTE_HELPER_CPP (Name);
-
-Name::Name (/* root */)
-{
-}
-
-Name::Name (const std::list<boost::reference_wrapper<const std::string> > &components)
-{
- BOOST_FOREACH (const boost::reference_wrapper<const std::string> &component, components)
- {
- Add (component.get ());
- }
-}
-
-Name::Name (const std::list<std::string> &components)
-{
- BOOST_FOREACH (const std::string &component, components)
- {
- Add (component);
- }
-}
-
-Name::Name (const std::string &prefix)
-{
- istringstream is (prefix);
- is >> *this;
-}
-
-Name::Name (const char *prefix)
-{
- NS_ASSERT (prefix != 0);
-
- istringstream is (prefix);
- is >> *this;
-}
-
-const std::list<std::string> &
-Name::GetComponents () const
-{
- return m_prefix;
-}
-
-std::string
-Name::GetLastComponent () const
-{
- if (m_prefix.size () == 0)
- {
- return "";
- }
-
- return m_prefix.back ();
-}
-
-std::list<boost::reference_wrapper<const std::string> >
-Name::GetSubComponents (size_t num) const
-{
- NS_ASSERT_MSG (0<=num && num<=m_prefix.size (), "Invalid number of subcomponents requested");
-
- std::list<boost::reference_wrapper<const std::string> > subComponents;
- std::list<std::string>::const_iterator component = m_prefix.begin();
- for (size_t i=0; i<num; i++, component++)
- {
- subComponents.push_back (boost::ref (*component));
- }
-
- return subComponents;
-}
-
-Name
-Name::cut (size_t minusComponents) const
-{
- Name retval;
- std::list<std::string>::const_iterator component = m_prefix.begin ();
- for (uint32_t i = 0; i < m_prefix.size () - minusComponents; i++, component++)
- {
- retval.Add (*component);
- }
-
- return retval;
-}
-
-size_t
-Name::GetSerializedSize () const
-{
- size_t nameSerializedSize = 2;
-
- for (std::list<std::string>::const_iterator i = this->begin ();
- i != this->end ();
- i++)
- {
- nameSerializedSize += 2 + i->size ();
- }
- NS_ASSERT_MSG (nameSerializedSize < 30000, "Name is too long (> 30kbytes)");
-
- return nameSerializedSize;
-}
-
-uint32_t
-Name::Serialize (Buffer::Iterator start) const
-{
- Buffer::Iterator i = start;
-
- i.WriteU16 (static_cast<uint16_t> (this->GetSerializedSize ()-2));
-
- for (std::list<std::string>::const_iterator item = this->begin ();
- item != this->end ();
- item++)
- {
- i.WriteU16 (static_cast<uint16_t> (item->size ()));
- i.Write (reinterpret_cast<const uint8_t*> (item->c_str ()), item->size ());
- }
-
- return i.GetDistanceFrom (start);
-}
-
-uint32_t
-Name::Deserialize (Buffer::Iterator start)
-{
- Buffer::Iterator i = start;
-
- uint16_t nameLength = i.ReadU16 ();
- while (nameLength > 0)
- {
- uint16_t length = i.ReadU16 ();
- nameLength = nameLength - 2 - length;
-
- uint8_t tmp[length];
- i.Read (tmp, length);
-
- this->Add (string (reinterpret_cast<const char*> (tmp), length));
- }
-
- return i.GetDistanceFrom (start);
-}
-
-void
-Name::Print (std::ostream &os) const
-{
- for (const_iterator i=m_prefix.begin(); i!=m_prefix.end(); i++)
- {
- os << "/" << *i;
- }
- if (m_prefix.size ()==0) os << "/";
-}
-
-std::ostream &
-operator << (std::ostream &os, const Name &components)
-{
- components.Print (os);
- return os;
-}
-
-std::istream &
-operator >> (std::istream &is, Name &components)
-{
- istream_iterator<char> eos; // end of stream
-
- std::string component = "";
- istream_iterator<char> it (is);
- for (; it != eos; it++)
- {
- if (*it == '/')
- {
- if (component != "")
- components.Add (component);
- component = "";
- }
- else
- component.push_back (*it);
- }
- if (component != "")
- components.Add (component);
-
- is.clear ();
- // NS_LOG_ERROR (components << ", bad: " << is.bad () <<", fail: " << is.fail ());
-
- return is;
-}
-
-} // ndn
-} // ns3
diff --git a/model/ndn-name.h b/model/ndn-name.h
index db39ccf..797de98 100644
--- a/model/ndn-name.h
+++ b/model/ndn-name.h
@@ -1,320 +1,2 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- * Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#ifndef _NDN_NAME_H_
-#define _NDN_NAME_H_
-
-#include "ns3/simple-ref-count.h"
-#include "ns3/attribute.h"
-#include "ns3/attribute-helper.h"
-
-#include <string>
-#include <algorithm>
-#include <list>
-#include "ns3/object.h"
-#include "ns3/buffer.h"
-
-#include <boost/ref.hpp>
-
-namespace ns3 {
-namespace ndn {
-
-/**
- * \ingroup ndn
- * \brief Hierarchical NDN name
- * A Name element represents a hierarchical name for Ndn content.
- * It simply contains a sequence of Component elements.
- * Each Component element contains a sequence of zero or more bytes.
- * There are no restrictions on what byte sequences may be used.
- * The Name element in an Interest is often referred to with the term name prefix or simply prefix.
- */
-class Name : public SimpleRefCount<Name>
-{
-public:
- typedef std::list<std::string>::iterator iterator;
- typedef std::list<std::string>::const_iterator const_iterator;
-
- /**
- * \brief Constructor
- * Creates a prefix with zero components (can be looked as root "/")
- */
- Name ();
-
- /**
- * \brief Constructor
- * Creates a prefix from a list of strings where every string represents a prefix component
- * @param[in] components A list of strings
- */
- Name (const std::list<boost::reference_wrapper<const std::string> > &components);
-
- /**
- * \brief Constructor
- * Creates a prefix from a list of strings where every string represents a prefix component
- * @param[in] components A list of strings
- */
- Name (const std::list<std::string> &components);
-
- /**
- * @brief Constructor
- * Creates a prefix from the string (string is parsed using operator>>)
- * @param[in] prefix A string representation of a prefix
- */
- Name (const std::string &prefix);
-
- /**
- * @brief Constructor
- * Creates a prefix from the string (string is parsed using operator>>)
- * @param[in] prefix A string representation of a prefix
- */
- Name (const char *prefix);
-
- /**
- * \brief Generic Add method
- * Appends object of type T to the list of components
- * @param[in] value The object to be appended
- */
- template<class T>
- inline Name&
- Add (const T &value);
-
- /**
- * \brief Generic constructor operator
- * The object of type T will be appended to the list of components
- */
- template<class T>
- inline Name&
- operator () (const T &value);
-
- /**
- * \brief Get a name
- * Returns a list of components (strings)
- */
- const std::list<std::string> &
- GetComponents () const;
-
- /**
- * @brief Helper call to get the last component of the name
- */
- std::string
- GetLastComponent () const;
-
- /**
- * \brief Get subcomponents of the name, starting with first component
- * @param[in] num Number of components to return. Valid value is in range [1, GetComponents ().size ()]
- */
- std::list<boost::reference_wrapper<const std::string> >
- GetSubComponents (size_t num) const;
-
- /**
- * @brief Get prefix of the name, containing less minusComponents right components
- */
- Name
- cut (size_t minusComponents) const;
-
- /**
- * \brief Print name
- * @param[in] os Stream to print
- */
- void Print (std::ostream &os) const;
-
- /**
- * @brief Get serialized size for ndnSIM packet encoding
- */
- size_t
- GetSerializedSize () const;
-
- /**
- * @brief Serialize Name in ndnSIM packet encoding
- * @param[in] start buffer to contain serialized name
- */
- uint32_t
- Serialize (Buffer::Iterator start) const;
-
- /**
- * \brief Deserialize Name in ndnSIM packet encoding
- * @param[in] start buffer that contains serialized name
- */
- uint32_t
- Deserialize (Buffer::Iterator start);
-
- /**
- * \brief Returns the size of Name
- */
- inline size_t
- size () const;
-
- /**
- * @brief Get read-write begin() iterator
- */
- inline iterator
- begin ();
-
- /**
- * @brief Get read-only begin() iterator
- */
- inline const_iterator
- begin () const;
-
- /**
- * @brief Get read-write end() iterator
- */
- inline iterator
- end ();
-
- /**
- * @brief Get read-only end() iterator
- */
- inline const_iterator
- end () const;
-
- /**
- * \brief Equality operator for Name
- */
- inline bool
- operator== (const Name &prefix) const;
-
- /**
- * \brief Less than operator for Name
- */
- inline bool
- operator< (const Name &prefix) const;
-
- typedef std::string partial_type;
-
-private:
- std::list<std::string> m_prefix; ///< \brief a list of strings (components)
-};
-
-/**
- * \brief Print out name components separated by slashes, e.g., /first/second/third
- */
-std::ostream &
-operator << (std::ostream &os, const Name &components);
-
-/**
- * \brief Read components from input and add them to components. Will read input stream till eof
- * Substrings separated by slashes will become separate components
- */
-std::istream &
-operator >> (std::istream &is, Name &components);
-
-/**
- * \brief Returns the size of Name object
- */
-size_t
-Name::size () const
-{
- return m_prefix.size ();
-}
-
-Name::iterator
-Name::begin ()
-{
- return m_prefix.begin ();
-}
-
-/**
- * @brief Get read-only begin() iterator
- */
-Name::const_iterator
-Name::begin () const
-{
- return m_prefix.begin ();
-}
-
-/**
- * @brief Get read-write end() iterator
- */
-Name::iterator
-Name::end ()
-{
- return m_prefix.end ();
-}
-
-/**
- * @brief Get read-only end() iterator
- */
-Name::const_iterator
-Name::end () const
-{
- return m_prefix.end ();
-}
-
-
-/**
- * \brief Generic constructor operator
- * The object of type T will be appended to the list of components
- */
-template<class T>
-Name&
-Name::operator () (const T &value)
-{
- return Add (value);
-}
-
-/**
- * \brief Generic Add method
- * Appends object of type T to the list of components
- * @param[in] value The object to be appended
- */
-template<class T>
-Name&
-Name::Add (const T &value)
-{
- std::ostringstream os;
- os << value;
- m_prefix.push_back (os.str ());
-
- return *this;
-}
-
-/**
- * \brief Equality operator for Name
- */
-bool
-Name::operator== (const Name &prefix) const
-{
- if (m_prefix.size () != prefix.m_prefix.size ())
- return false;
-
- return std::equal (m_prefix.begin (), m_prefix.end (), prefix.m_prefix.begin ());
-}
-
-/**
- * \brief Less than operator for Name
- */
-bool
-Name::operator< (const Name &prefix) const
-{
- return std::lexicographical_compare (m_prefix.begin (), m_prefix.end (),
- prefix.m_prefix.begin (), prefix.m_prefix.end ());
-}
-
-ATTRIBUTE_HELPER_HEADER (Name);
-
-// for backwards compatibility
-typedef Name NameComponents;
-
-} // namespace ndn
-} // namespace ns3
-
-#endif // _NDN_NAME_H_
-
+// backwards compatibility header
+#include "ns3/ndnSIM/ndn.cxx/name.h"
diff --git a/model/ndn-net-device-face.cc b/model/ndn-net-device-face.cc
index 67dc659..eb2b357 100644
--- a/model/ndn-net-device-face.cc
+++ b/model/ndn-net-device-face.cc
@@ -82,19 +82,31 @@
}
void
-NetDeviceFace::RegisterProtocolHandler (ProtocolHandler handler)
+NetDeviceFace::RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler)
{
NS_LOG_FUNCTION (this);
- Face::RegisterProtocolHandler (handler);
+ Face::RegisterProtocolHandlers (interestHandler, dataHandler);
m_node->RegisterProtocolHandler (MakeCallback (&NetDeviceFace::ReceiveFromNetDevice, this),
L3Protocol::ETHERNET_FRAME_TYPE, m_netDevice, true/*promiscuous mode*/);
}
-bool
-NetDeviceFace::SendImpl (Ptr<Packet> packet)
+void
+NetDeviceFace:: UnRegisterProtocolHandlers ()
{
+ m_node->UnregisterProtocolHandler (MakeCallback (&NetDeviceFace::ReceiveFromNetDevice, this));
+ Face::UnRegisterProtocolHandlers ();
+}
+
+bool
+NetDeviceFace::Send (Ptr<Packet> packet)
+{
+ if (!Face::Send (packet))
+ {
+ return false;
+ }
+
NS_LOG_FUNCTION (this << packet);
NS_ASSERT_MSG (packet->GetSize () <= m_netDevice->GetMtu (),
diff --git a/model/ndn-net-device-face.h b/model/ndn-net-device-face.h
index 651a7ae..d001015 100644
--- a/model/ndn-net-device-face.h
+++ b/model/ndn-net-device-face.h
@@ -60,12 +60,14 @@
////////////////////////////////////////////////////////////////////
// methods overloaded from NdnFace
virtual void
- RegisterProtocolHandler (ProtocolHandler handler);
+ RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler);
+
+ virtual void
+ UnRegisterProtocolHandlers ();
protected:
- // also from NdnFace
virtual bool
- SendImpl (Ptr<Packet> p);
+ Send (Ptr<Packet> p);
public:
/**
diff --git a/model/pit/custom-policies/serialized-size-policy.h b/model/pit/custom-policies/serialized-size-policy.h
index 7cfb506..61f6306 100644
--- a/model/pit/custom-policies/serialized-size-policy.h
+++ b/model/pit/custom-policies/serialized-size-policy.h
@@ -96,7 +96,14 @@
current_space_used_ -= get_size (item);
policy_container::erase (*item);
- get_order (item) = item->payload ()->GetInterest ()->GetSerializedSize ();
+ if (item->payload ()->GetInterest ()->GetWire ())
+ {
+ get_order (item) = item->payload ()->GetInterest ()->GetWire ()->GetSize ();
+ }
+ else
+ {
+ get_order (item) = 0;
+ }
current_space_used_ += get_size (item); // this operation can violate policy constraint, so in some case
// it may be necessary to remove some other element
policy_container::insert (*item);
@@ -105,7 +112,11 @@
inline bool
insert (typename parent_trie::iterator item)
{
- uint32_t interestSize = item->payload ()->GetInterest ()->GetSerializedSize ();
+ uint32_t interestSize = 0;
+ if (item->payload ()->GetInterest ()->GetWire ())
+ {
+ interestSize = item->payload ()->GetInterest ()->GetWire ()->GetSize ();
+ }
// can't use logging here
NS_LOG_DEBUG ("Number of entries: " << policy_container::size ()
diff --git a/model/pit/ndn-pit-entry.cc b/model/pit/ndn-pit-entry.cc
index 906fcdd..1908dd0 100644
--- a/model/pit/ndn-pit-entry.cc
+++ b/model/pit/ndn-pit-entry.cc
@@ -25,6 +25,7 @@
#include "ns3/ndn-name.h"
#include "ns3/ndn-interest.h"
+#include "ns3/packet.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
diff --git a/model/pit/ndn-pit.cc b/model/pit/ndn-pit.cc
index ea84496..079cf3f 100644
--- a/model/pit/ndn-pit.cc
+++ b/model/pit/ndn-pit.cc
@@ -27,6 +27,7 @@
#include "ns3/nstime.h"
#include "ns3/uinteger.h"
#include "ns3/simulator.h"
+#include "ns3/packet.h"
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
diff --git a/model/wire/ccnb.h b/model/wire/ccnb.h
new file mode 100644
index 0000000..893d481
--- /dev/null
+++ b/model/wire/ccnb.h
@@ -0,0 +1,94 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * BSD license, See the doc/LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_WIRE_CCNB_H
+#define NDN_WIRE_CCNB_H
+
+#include "ns3/ndn-common.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace ccnb {
+
+/**
+ * @brief Routines to serialize/deserialize NDN interest in ccnb format
+ *
+ * @see http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html
+ **/
+class Interest : public Header
+{
+public:
+ Interest ();
+ Interest (Ptr<ndn::Interest> interest);
+
+ Ptr<ndn::Interest>
+ GetInterest ();
+
+ static Ptr<Packet>
+ ToWire (Ptr<const ndn::Interest> interest);
+
+ static Ptr<ndn::Interest>
+ FromWire (Ptr<Packet> packet);
+
+ //////////////////////////////////////////////////////////////////
+ // from Header
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (Buffer::Iterator start) const;
+ virtual uint32_t Deserialize (Buffer::Iterator start);
+
+private:
+ Ptr<ndn::Interest> m_interest;
+};
+
+
+/**
+ * @brief Routines to serialize/deserialize NDN Data packet in ccnb format
+ *
+ * @see http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html
+ **/
+class Data : public Header
+{
+public:
+ Data ();
+ Data (Ptr<ndn::ContentObject> data);
+
+ Ptr<ndn::ContentObject>
+ GetData ();
+
+ static Ptr<Packet>
+ ToWire (Ptr<const ndn::ContentObject> data);
+
+ static Ptr<ndn::ContentObject>
+ FromWire (Ptr<Packet> packet);
+
+ // from Header
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (Buffer::Iterator start) const;
+ virtual uint32_t Deserialize (Buffer::Iterator start);
+
+private:
+ Ptr<ndn::ContentObject> m_data;
+};
+
+} // ccnb
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // NDN_WIRE_CCNB_H
diff --git a/disabled/ccnb-parser/common.h b/model/wire/ccnb/ccnb-parser/common.h
similarity index 96%
rename from disabled/ccnb-parser/common.h
rename to model/wire/ccnb/ccnb-parser/common.h
index 260ae74..aa3f68a 100644
--- a/disabled/ccnb-parser/common.h
+++ b/model/wire/ccnb/ccnb-parser/common.h
@@ -21,8 +21,15 @@
#ifndef _CCNB_PARSER_COMMON_H_
#define _CCNB_PARSER_COMMON_H_
-namespace ns3 {
-namespace ndn {
+#include "ns3/ndn-common.h"
+
+#ifndef NDN_NAMESPACE_BEGIN
+#error "dafaq"
+#endif
+
+NDN_NAMESPACE_BEGIN;
+
+namespace wire {
/**
* \ingroup ndn
@@ -174,8 +181,9 @@
CCN_DTAG_CCNProtocolDataUnit = 17702112
};
-} // namespace CcnxParser
-} // namespace ndn
-} // namespace ns3
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_COMMON_H_
diff --git a/disabled/ccnb-parser/syntax-tree/attr.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/attr.cc
similarity index 93%
rename from disabled/ccnb-parser/syntax-tree/attr.cc
rename to model/wire/ccnb/ccnb-parser/syntax-tree/attr.cc
index fda4c77..f661186 100644
--- a/disabled/ccnb-parser/syntax-tree/attr.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/attr.cc
@@ -21,8 +21,9 @@
#include "attr.h"
#include "../common.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
// length length in octets of UTF-8 encoding of tag name - 1 (minimum tag name length is 1)
@@ -41,6 +42,7 @@
throw CcnbDecodingException (); // "ATTR must be followed by UDATA field"
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/syntax-tree/attr.h b/model/wire/ccnb/ccnb-parser/syntax-tree/attr.h
similarity index 94%
rename from disabled/ccnb-parser/syntax-tree/attr.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/attr.h
index 6238aee..37882ad 100644
--- a/disabled/ccnb-parser/syntax-tree/attr.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/attr.h
@@ -24,8 +24,9 @@
#include "base-attr.h"
#include <string>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -55,8 +56,9 @@
std::string m_attr; ///< field holding name of the attribute
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_ATTR_H_
diff --git a/disabled/ccnb-parser/syntax-tree/base-attr.h b/model/wire/ccnb/ccnb-parser/syntax-tree/base-attr.h
similarity index 92%
rename from disabled/ccnb-parser/syntax-tree/base-attr.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/base-attr.h
index d6890a1..c2b2627 100644
--- a/disabled/ccnb-parser/syntax-tree/base-attr.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/base-attr.h
@@ -23,8 +23,9 @@
#include "udata.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -40,8 +41,9 @@
Ptr<Udata> m_value; ///< \brief Value of the attribute
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_BASE_ATTR_H_
diff --git a/disabled/ccnb-parser/syntax-tree/base-tag.h b/model/wire/ccnb/ccnb-parser/syntax-tree/base-tag.h
similarity index 93%
rename from disabled/ccnb-parser/syntax-tree/base-tag.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/base-tag.h
index 403dcb4..1449d9f 100644
--- a/disabled/ccnb-parser/syntax-tree/base-tag.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/base-tag.h
@@ -24,8 +24,9 @@
#include "block.h"
#include <list>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -48,9 +49,10 @@
BaseTag() { }
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_BASE_TAG_H_
diff --git a/disabled/ccnb-parser/syntax-tree/blob.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/blob.cc
similarity index 92%
rename from disabled/ccnb-parser/syntax-tree/blob.cc
rename to model/wire/ccnb/ccnb-parser/syntax-tree/blob.cc
index 6df6012..6c2ab2e 100644
--- a/disabled/ccnb-parser/syntax-tree/blob.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/blob.cc
@@ -20,8 +20,9 @@
#include "blob.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
Blob::Blob (Buffer::Iterator &start, uint32_t length)
@@ -46,6 +47,7 @@
delete [] m_blob;
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/syntax-tree/blob.h b/model/wire/ccnb/ccnb-parser/syntax-tree/blob.h
similarity index 95%
rename from disabled/ccnb-parser/syntax-tree/blob.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/blob.h
index 1745b1d..2b480ca 100644
--- a/disabled/ccnb-parser/syntax-tree/blob.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/blob.h
@@ -23,8 +23,9 @@
#include "block.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -56,8 +57,9 @@
uint32_t m_blobSize; ///< @brief field representing size of the BLOB field stored
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_BLOB_H_
diff --git a/disabled/ccnb-parser/syntax-tree/block.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/block.cc
similarity index 95%
rename from disabled/ccnb-parser/syntax-tree/block.cc
rename to model/wire/ccnb/ccnb-parser/syntax-tree/block.cc
index 0d425dd..67882a9 100644
--- a/disabled/ccnb-parser/syntax-tree/block.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/block.cc
@@ -32,8 +32,9 @@
NS_LOG_COMPONENT_DEFINE ("ndn.CcnbParser.Block");
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/// @cond include_hidden
@@ -54,7 +55,7 @@
uint8_t byte = 0;
while (!start.IsEnd() && !(byte & CCN_TT_HBIT))
{
- value <<= 8;
+ value <<= 7;
value += byte;
byte = start.ReadU8 ();
// Block::counter ++;
@@ -94,6 +95,7 @@
{
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/syntax-tree/block.h b/model/wire/ccnb/ccnb-parser/syntax-tree/block.h
similarity index 95%
rename from disabled/ccnb-parser/syntax-tree/block.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/block.h
index 23604f5..caf227f 100644
--- a/disabled/ccnb-parser/syntax-tree/block.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/block.h
@@ -31,8 +31,9 @@
#include "../visitors/no-argu-visitor.h"
#include "../visitors/visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -80,8 +81,9 @@
return ret;
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_BLOCK_H_
diff --git a/disabled/ccnb-parser/syntax-tree/dattr.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/dattr.cc
similarity index 91%
rename from disabled/ccnb-parser/syntax-tree/dattr.cc
rename to model/wire/ccnb/ccnb-parser/syntax-tree/dattr.cc
index dde424c..a37db84 100644
--- a/disabled/ccnb-parser/syntax-tree/dattr.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/dattr.cc
@@ -20,8 +20,9 @@
#include "dattr.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
// dictionary attributes are not used (yet?) in CCNx
@@ -33,6 +34,7 @@
throw CcnbDecodingException (); // "ATTR must be followed by UDATA field"
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/syntax-tree/dattr.h b/model/wire/ccnb/ccnb-parser/syntax-tree/dattr.h
similarity index 94%
rename from disabled/ccnb-parser/syntax-tree/dattr.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/dattr.h
index e4c622c..3728d6e 100644
--- a/disabled/ccnb-parser/syntax-tree/dattr.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/dattr.h
@@ -23,8 +23,9 @@
#include "base-attr.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -54,8 +55,9 @@
uint32_t m_dattr; ///< \brief Dictionary code of DATTR
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_DATTR_H_
diff --git a/disabled/ccnb-parser/syntax-tree/dtag.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/dtag.cc
similarity index 96%
rename from disabled/ccnb-parser/syntax-tree/dtag.cc
rename to model/wire/ccnb/ccnb-parser/syntax-tree/dtag.cc
index 129b363..b7af79b 100644
--- a/disabled/ccnb-parser/syntax-tree/dtag.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/dtag.cc
@@ -23,8 +23,9 @@
#include "base-attr.h"
#include "base-tag.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
Dtag::Dtag (Buffer::Iterator &start, uint32_t dtag)
@@ -84,6 +85,7 @@
// Block::counter ++;
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/syntax-tree/dtag.h b/model/wire/ccnb/ccnb-parser/syntax-tree/dtag.h
similarity index 95%
rename from disabled/ccnb-parser/syntax-tree/dtag.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/dtag.h
index cf9871e..0d00f50 100644
--- a/disabled/ccnb-parser/syntax-tree/dtag.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/dtag.h
@@ -23,8 +23,9 @@
#include "base-tag.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -59,8 +60,9 @@
uint32_t m_dtag; ///< \brief Dictionary code for DTAG
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_DTAG_H_
diff --git a/disabled/ccnb-parser/syntax-tree/ext.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/ext.cc
similarity index 90%
rename from disabled/ccnb-parser/syntax-tree/ext.cc
rename to model/wire/ccnb/ccnb-parser/syntax-tree/ext.cc
index b80743c..79ac738 100644
--- a/disabled/ccnb-parser/syntax-tree/ext.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/ext.cc
@@ -20,8 +20,9 @@
#include "ext.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
Ext::Ext (Buffer::Iterator &start, uint32_t extSubtype)
@@ -29,6 +30,7 @@
m_extSubtype = extSubtype;
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/syntax-tree/ext.h b/model/wire/ccnb/ccnb-parser/syntax-tree/ext.h
similarity index 94%
rename from disabled/ccnb-parser/syntax-tree/ext.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/ext.h
index 072405c..532eb87 100644
--- a/disabled/ccnb-parser/syntax-tree/ext.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/ext.h
@@ -23,8 +23,9 @@
#include "block.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -54,8 +55,9 @@
uint64_t m_extSubtype; ///< \brief Extension type
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_EXT_H_
diff --git a/disabled/ccnb-parser/syntax-tree/tag.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/tag.cc
similarity index 94%
rename from disabled/ccnb-parser/syntax-tree/tag.cc
rename to model/wire/ccnb/ccnb-parser/syntax-tree/tag.cc
index 5a0d96c..8cd7fd1 100644
--- a/disabled/ccnb-parser/syntax-tree/tag.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/tag.cc
@@ -22,8 +22,9 @@
#include "base-attr.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
Tag::Tag (Buffer::Iterator &start, uint32_t length)
@@ -63,6 +64,7 @@
start.ReadU8 (); // read CCN_CLOSE
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/syntax-tree/tag.h b/model/wire/ccnb/ccnb-parser/syntax-tree/tag.h
similarity index 94%
rename from disabled/ccnb-parser/syntax-tree/tag.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/tag.h
index 94f4d32..8949119 100644
--- a/disabled/ccnb-parser/syntax-tree/tag.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/tag.h
@@ -24,8 +24,9 @@
#include "base-tag.h"
#include <string>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -55,8 +56,9 @@
std::string m_tag; ///< \brief Name of TAG block
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_TAG_H_
diff --git a/disabled/ccnb-parser/syntax-tree/udata.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/udata.cc
similarity index 93%
rename from disabled/ccnb-parser/syntax-tree/udata.cc
rename to model/wire/ccnb/ccnb-parser/syntax-tree/udata.cc
index cd69aba..9d3c8df 100644
--- a/disabled/ccnb-parser/syntax-tree/udata.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/udata.cc
@@ -20,8 +20,9 @@
#include "udata.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
Udata::Udata (Buffer::Iterator &start, uint32_t length)
@@ -43,6 +44,7 @@
throw CcnbDecodingException ();
}
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/syntax-tree/udata.h b/model/wire/ccnb/ccnb-parser/syntax-tree/udata.h
similarity index 94%
rename from disabled/ccnb-parser/syntax-tree/udata.h
rename to model/wire/ccnb/ccnb-parser/syntax-tree/udata.h
index b589ea4..463898f 100644
--- a/disabled/ccnb-parser/syntax-tree/udata.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/udata.h
@@ -24,8 +24,9 @@
#include "block.h"
#include <string>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -53,8 +54,9 @@
std::string m_udata; ///< \brief field holding a parsed UDATA value of the block
};
-}
-}
-}
+} // namespace CcnbParser
+} // namespace wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_UDATA_H_
diff --git a/disabled/ccnb-parser/visitors/content-type-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.cc
similarity index 93%
rename from disabled/ccnb-parser/visitors/content-type-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.cc
index a89b99c..91112da 100644
--- a/disabled/ccnb-parser/visitors/content-type-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.cc
@@ -21,8 +21,9 @@
#include "content-type-visitor.h"
#include "../syntax-tree/blob.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
boost::any
@@ -47,6 +48,7 @@
throw CcnbDecodingException ();
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/content-type-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.h
similarity index 94%
rename from disabled/ccnb-parser/visitors/content-type-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.h
index 2cbd883..aa9abbf 100644
--- a/disabled/ccnb-parser/visitors/content-type-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.h
@@ -23,8 +23,9 @@
#include "no-argu-depth-first-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -43,8 +44,9 @@
virtual boost::any visit (Udata &n); ///< Throws parsing error if BLOB object is encountered
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/depth-first-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.cc
similarity index 96%
rename from disabled/ccnb-parser/visitors/depth-first-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.cc
index 305fff6..b82b140 100644
--- a/disabled/ccnb-parser/visitors/depth-first-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.cc
@@ -30,8 +30,9 @@
#include <boost/foreach.hpp>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
boost::any
@@ -105,6 +106,7 @@
return n.m_extSubtype;
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/depth-first-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.h
similarity index 94%
rename from disabled/ccnb-parser/visitors/depth-first-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.h
index 2257802..be701b1 100644
--- a/disabled/ccnb-parser/visitors/depth-first-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.h
@@ -23,8 +23,9 @@
#include "visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -43,8 +44,9 @@
virtual boost::any visit (Ext&, boost::any);
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_DEPTH_FIRST_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/name-components-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/name-visitor.cc
similarity index 85%
rename from disabled/ccnb-parser/visitors/name-components-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/name-visitor.cc
index ffb242e..998e4e2 100644
--- a/disabled/ccnb-parser/visitors/name-components-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/name-visitor.cc
@@ -18,15 +18,16 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "name-components-visitor.h"
+#include "name-visitor.h"
#include "string-visitor.h"
#include "../syntax-tree/dtag.h"
#include "ns3/ndn-name.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
void
@@ -43,18 +44,18 @@
case CCN_DTAG_Component:
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
- components.Add (
+ components.append (
boost::any_cast<std::string> ((*n.m_nestedTags.begin())->accept(
- stringVisitor
- )));
+ stringVisitor
+ )));
break;
default:
- // ignore any other components
- // when parsing Exclude, there could be <Any /> and <Bloom /> tags
+ VoidDepthFirstVisitor::visit (n, param);
break;
}
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/name-components-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/name-visitor.h
similarity index 88%
rename from disabled/ccnb-parser/visitors/name-components-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/name-visitor.h
index 332d95d..f71e202 100644
--- a/disabled/ccnb-parser/visitors/name-components-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/name-visitor.h
@@ -23,8 +23,9 @@
#include "void-depth-first-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -34,12 +35,13 @@
class NameVisitor : public VoidDepthFirstVisitor
{
public:
- virtual void visit (Dtag &n, boost::any param/*should be CcnxName* */);
+ virtual void visit (Dtag &n, boost::any param/*should be Name* */);
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_NAME_COMPONENTS_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/no-argu-depth-first-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
similarity index 96%
rename from disabled/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
index 53f1122..6393e7e 100644
--- a/disabled/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
@@ -30,8 +30,9 @@
#include <boost/foreach.hpp>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
boost::any
@@ -105,6 +106,7 @@
return n.m_extSubtype;
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/no-argu-depth-first-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.h
similarity index 94%
rename from disabled/ccnb-parser/visitors/no-argu-depth-first-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.h
index 4b6c2e9..c400083 100644
--- a/disabled/ccnb-parser/visitors/no-argu-depth-first-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.h
@@ -23,8 +23,9 @@
#include "no-argu-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -43,8 +44,9 @@
virtual boost::any visit (Ext& );
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_NO_ARGU_DEPTH_FIRST_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/no-argu-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/no-argu-visitor.h
similarity index 95%
rename from disabled/ccnb-parser/visitors/no-argu-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/no-argu-visitor.h
index abbf843..d603a0a 100644
--- a/disabled/ccnb-parser/visitors/no-argu-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/no-argu-visitor.h
@@ -24,8 +24,9 @@
#include "../common.h"
#include <boost/any.hpp>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -49,8 +50,9 @@
virtual ~NoArguVisitor () { }
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_NO_ARGU_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/non-negative-integer-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.cc
similarity index 94%
rename from disabled/ccnb-parser/visitors/non-negative-integer-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.cc
index d5fc041..9c2fee3 100644
--- a/disabled/ccnb-parser/visitors/non-negative-integer-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.cc
@@ -24,8 +24,9 @@
#include "../syntax-tree/udata.h"
#include <sstream>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
boost::any
@@ -48,6 +49,7 @@
return static_cast<uint32_t> (value);
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/non-negative-integer-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.h
similarity index 94%
rename from disabled/ccnb-parser/visitors/non-negative-integer-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.h
index 2bb9f91..027e0eb 100644
--- a/disabled/ccnb-parser/visitors/non-negative-integer-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.h
@@ -23,8 +23,9 @@
#include "no-argu-depth-first-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -40,8 +41,9 @@
virtual boost::any visit (Udata &n);
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_NON_NEGATIVE_INTEGER_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/string-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/string-visitor.cc
similarity index 93%
rename from disabled/ccnb-parser/visitors/string-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/string-visitor.cc
index 5f44bf3..5c41779 100644
--- a/disabled/ccnb-parser/visitors/string-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/string-visitor.cc
@@ -22,8 +22,9 @@
#include "../syntax-tree/udata.h"
#include "../syntax-tree/blob.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
boost::any
@@ -40,6 +41,7 @@
return n.m_udata;
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/string-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/string-visitor.h
similarity index 93%
rename from disabled/ccnb-parser/visitors/string-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/string-visitor.h
index ea285d1..b6a74fd 100644
--- a/disabled/ccnb-parser/visitors/string-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/string-visitor.h
@@ -23,8 +23,9 @@
#include "no-argu-depth-first-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -40,8 +41,9 @@
virtual boost::any visit (Udata &n);
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_STRING_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/timestamp-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.cc
similarity index 95%
rename from disabled/ccnb-parser/visitors/timestamp-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.cc
index 5917711..efea82a 100644
--- a/disabled/ccnb-parser/visitors/timestamp-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.cc
@@ -23,8 +23,9 @@
#include "ns3/nstime.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
boost::any/*Time*/
@@ -60,6 +61,7 @@
throw CcnbDecodingException ();
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/timestamp-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.h
similarity index 94%
rename from disabled/ccnb-parser/visitors/timestamp-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.h
index 3884ff6..a5ad224 100644
--- a/disabled/ccnb-parser/visitors/timestamp-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.h
@@ -23,8 +23,9 @@
#include "no-argu-depth-first-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -40,8 +41,9 @@
virtual boost::any/*Time*/ visit (Udata &n); ///< Throws parsing error if UDATA object is encountered
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_TIMESTAMP_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/uint32t-blob-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.cc
similarity index 93%
rename from disabled/ccnb-parser/visitors/uint32t-blob-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.cc
index 351cc36..f5620ae 100644
--- a/disabled/ccnb-parser/visitors/uint32t-blob-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.cc
@@ -21,8 +21,9 @@
#include "uint32t-blob-visitor.h"
#include "../syntax-tree/blob.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
boost::any
@@ -42,6 +43,7 @@
throw CcnbDecodingException ();
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/uint32t-blob-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.h
similarity index 94%
rename from disabled/ccnb-parser/visitors/uint32t-blob-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.h
index de5f374..5d30405 100644
--- a/disabled/ccnb-parser/visitors/uint32t-blob-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.h
@@ -23,8 +23,9 @@
#include "no-argu-depth-first-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -43,8 +44,9 @@
virtual boost::any visit (Udata &n); ///< Throws parsing error if BLOB object is encountered
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/visitor.h b/model/wire/ccnb/ccnb-parser/visitors/visitor.h
similarity index 95%
rename from disabled/ccnb-parser/visitors/visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/visitor.h
index 76744ee..ee9f831 100644
--- a/disabled/ccnb-parser/visitors/visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/visitor.h
@@ -24,8 +24,9 @@
#include "../common.h"
#include <boost/any.hpp>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -49,8 +50,9 @@
virtual ~Visitor () { }
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/void-depth-first-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.cc
similarity index 96%
rename from disabled/ccnb-parser/visitors/void-depth-first-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.cc
index 1a1770a..8a8adde 100644
--- a/disabled/ccnb-parser/visitors/void-depth-first-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.cc
@@ -30,8 +30,9 @@
#include <boost/foreach.hpp>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
void
@@ -98,6 +99,7 @@
// uint64_t n.m_extSubtype;
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/void-depth-first-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.h
similarity index 94%
rename from disabled/ccnb-parser/visitors/void-depth-first-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.h
index 2e1862e..96f8b6f 100644
--- a/disabled/ccnb-parser/visitors/void-depth-first-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.h
@@ -23,8 +23,9 @@
#include "void-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -43,8 +44,9 @@
virtual void visit (Ext&, boost::any);
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_VOID_DEPTH_FIRST_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
similarity index 96%
rename from disabled/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
rename to model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
index 439bf93..5bcecb8 100644
--- a/disabled/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
@@ -30,8 +30,9 @@
#include <boost/foreach.hpp>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
void
@@ -98,6 +99,7 @@
// uint64_t n.m_extSubtype;
}
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
similarity index 94%
rename from disabled/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
index 995f90a..59b59d7 100644
--- a/disabled/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
@@ -23,8 +23,9 @@
#include "void-no-argu-visitor.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -43,8 +44,9 @@
virtual void visit (Ext& );
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_VOID_NO_ARGU_DEPTH_FIRST_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/void-no-argu-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-visitor.h
similarity index 95%
rename from disabled/ccnb-parser/visitors/void-no-argu-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/void-no-argu-visitor.h
index 6dccf4e..a98d933 100644
--- a/disabled/ccnb-parser/visitors/void-no-argu-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-visitor.h
@@ -23,8 +23,9 @@
#include "../common.h"
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -48,8 +49,9 @@
virtual ~VoidNoArguVisitor () { }
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_VOID_NO_ARGU_VISITOR_H_
diff --git a/disabled/ccnb-parser/visitors/void-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/void-visitor.h
similarity index 95%
rename from disabled/ccnb-parser/visitors/void-visitor.h
rename to model/wire/ccnb/ccnb-parser/visitors/void-visitor.h
index 6ad7eed..8c51e21 100644
--- a/disabled/ccnb-parser/visitors/void-visitor.h
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-visitor.h
@@ -24,8 +24,9 @@
#include "../common.h"
#include <boost/any.hpp>
-namespace ns3 {
-namespace ndn {
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
namespace CcnbParser {
/**
@@ -49,8 +50,9 @@
virtual ~VoidVisitor () { }
};
-}
-}
-}
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
#endif // _CCNB_PARSER_VOID_VISITOR_H_
diff --git a/model/wire/ccnb/wire-ccnb-data.cc b/model/wire/ccnb/wire-ccnb-data.cc
new file mode 100644
index 0000000..0770c3d
--- /dev/null
+++ b/model/wire/ccnb/wire-ccnb-data.cc
@@ -0,0 +1,493 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "../ccnb.h"
+
+#include "wire-ccnb.h"
+
+#include "ns3/log.h"
+
+#include "ccnb-parser/common.h"
+#include "ccnb-parser/visitors/void-depth-first-visitor.h"
+#include "ccnb-parser/visitors/name-visitor.h"
+#include "ccnb-parser/visitors/non-negative-integer-visitor.h"
+#include "ccnb-parser/visitors/timestamp-visitor.h"
+#include "ccnb-parser/visitors/string-visitor.h"
+#include "ccnb-parser/visitors/uint32t-blob-visitor.h"
+#include "ccnb-parser/visitors/content-type-visitor.h"
+
+#include "ccnb-parser/syntax-tree/block.h"
+#include "ccnb-parser/syntax-tree/dtag.h"
+
+#include <boost/foreach.hpp>
+
+NS_LOG_COMPONENT_DEFINE ("ndn.wire.Ccnb.Data");
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace ccnb {
+
+// const std::string DefaultDigestAlgorithm = "2.16.840.1.101.3.4.2.1";
+
+class DataTrailer : public Trailer
+{
+public:
+ DataTrailer ()
+ {
+ }
+
+ static TypeId GetTypeId ()
+ {
+ static TypeId tid = TypeId ("ns3::ndn::Data::Ccnb::Closer")
+ .SetGroupName ("Ndn")
+ .SetParent<Trailer> ()
+ .AddConstructor<DataTrailer> ()
+ ;
+ return tid;
+ }
+
+ virtual TypeId GetInstanceTypeId (void) const
+ {
+ return GetTypeId ();
+ }
+
+ virtual void Print (std::ostream &os) const
+ {
+ }
+
+ virtual uint32_t GetSerializedSize (void) const
+ {
+ return 2;
+ }
+
+ virtual void Serialize (Buffer::Iterator end) const
+ {
+ Buffer::Iterator i = end;
+ i.Prev (2); // Trailer interface requires us to go backwards
+
+ i.WriteU8 (0x00); // </Content>
+ i.WriteU8 (0x00); // </ContentObject>
+ }
+
+ virtual uint32_t Deserialize (Buffer::Iterator end)
+ {
+ Buffer::Iterator i = end;
+ i.Prev (2); // Trailer interface requires us to go backwards
+
+ uint8_t closing_tag_content = i.ReadU8 ();
+ NS_ASSERT_MSG (closing_tag_content==0, "Should be a closing tag </Content> (0x00)");
+
+ uint8_t closing_tag_content_object = i.ReadU8 ();
+ NS_ASSERT_MSG (closing_tag_content_object==0, "Should be a closing tag </ContentObject> (0x00)");
+
+ return 2;
+ }
+};
+
+NS_OBJECT_ENSURE_REGISTERED (Data);
+NS_OBJECT_ENSURE_REGISTERED (DataTrailer);
+
+TypeId
+Data::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ndn::Data::Ccnb")
+ .SetGroupName ("Ndn")
+ .SetParent<Header> ()
+ .AddConstructor<Data> ()
+ ;
+ return tid;
+}
+
+TypeId
+Data::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
+
+Data::Data ()
+ : m_data (Create<ndn::ContentObject> ())
+{
+}
+
+Data::Data (Ptr<ndn::ContentObject> data)
+ : m_data (data)
+{
+}
+
+Ptr<ndn::ContentObject>
+Data::GetData ()
+{
+ return m_data;
+}
+
+Ptr<Packet>
+Data::ToWire (Ptr<const ndn::ContentObject> data)
+{
+ static DataTrailer trailer;
+
+ Ptr<const Packet> p = data->GetWire ();
+ if (!p)
+ {
+ Ptr<Packet> packet = Create<Packet> (*data->GetPayload ());
+ Data wireEncoding (ConstCast<ndn::ContentObject> (data));
+ packet->AddHeader (wireEncoding);
+ packet->AddTrailer (trailer);
+ data->SetWire (packet);
+
+ p = packet;
+ }
+
+ return p->Copy ();
+}
+
+Ptr<ndn::ContentObject>
+Data::FromWire (Ptr<Packet> packet)
+{
+ static DataTrailer trailer;
+
+ Ptr<ndn::ContentObject> data = Create<ndn::ContentObject> ();
+ data->SetWire (packet->Copy ());
+
+ Data wireEncoding (data);
+ packet->RemoveHeader (wireEncoding);
+ packet->RemoveTrailer (trailer);
+
+ data->SetPayload (packet);
+
+ return data;
+}
+
+void
+Data::Serialize (Buffer::Iterator start) const
+{
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_ContentObject, CcnbParser::CCN_DTAG); // <ContentObject>
+
+ // fake signature
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Signature, CcnbParser::CCN_DTAG); // <Signature>
+ // Signature ::= √DigestAlgorithm?
+ // Witness?
+ // √SignatureBits
+ // if (GetSignature ().GetDigestAlgorithm () != Signature::DefaultDigestAlgorithm)
+ // {
+ // Ccnb::AppendString (start, CcnbParser::CCN_DTAG_DigestAlgorithm, GetSignature ().GetDigestAlgorithm ());
+ // }
+ Ccnb::AppendTaggedBlob (start, CcnbParser::CCN_DTAG_SignatureBits, m_data->GetSignature ()); // <SignatureBits />
+ Ccnb::AppendCloser (start); // </Signature>
+
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Name, CcnbParser::CCN_DTAG); // <Name>
+ Ccnb::SerializeName (start, m_data->GetName()); // <Component>...</Component>...
+ Ccnb::AppendCloser (start); // </Name>
+
+ // fake signature
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_SignedInfo, CcnbParser::CCN_DTAG); // <SignedInfo>
+ // SignedInfo ::= √PublisherPublicKeyDigest
+ // √Timestamp
+ // √Type?
+ // √FreshnessSeconds?
+ // FinalBlockID?
+ // KeyLocator?
+ // Ccnb::AppendTaggedBlob (start, CcnbParser::CCN_DTAG_PublisherPublicKeyDigest, // <PublisherPublicKeyDigest>...
+ // GetSignedInfo ().GetPublisherPublicKeyDigest ());
+
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Timestamp, CcnbParser::CCN_DTAG); // <Timestamp>...
+ Ccnb::AppendTimestampBlob (start, m_data->GetTimestamp ());
+ Ccnb::AppendCloser (start);
+
+ // if (GetSignedInfo ().GetContentType () != DATA)
+ // {
+ // uint8_t type[3];
+ // type[0] = (GetSignedInfo ().GetContentType () >> 16) & 0xFF;
+ // type[1] = (GetSignedInfo ().GetContentType () >> 8 ) & 0xFF;
+ // type[2] = (GetSignedInfo ().GetContentType () ) & 0xFF;
+
+ // Ccnb::AppendTaggedBlob (start, CCN_DTAG_Type, type, 3);
+ // }
+ if (m_data->GetFreshness () > Seconds(0))
+ {
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_FreshnessSeconds, CcnbParser::CCN_DTAG);
+ Ccnb::AppendNumber (start, m_data->GetFreshness ().ToInteger (Time::S));
+ Ccnb::AppendCloser (start);
+ }
+ if (m_data->GetKeyLocator () != 0)
+ {
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_KeyLocator, CcnbParser::CCN_DTAG); // <KeyLocator>
+ {
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_KeyName, CcnbParser::CCN_DTAG); // <KeyName>
+ {
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Name, CcnbParser::CCN_DTAG); // <Name>
+ Ccnb::SerializeName (start, *m_data->GetKeyLocator ()); // <Component>...</Component>...
+ Ccnb::AppendCloser (start); // </Name>
+ }
+ Ccnb::AppendCloser (start); // </KeyName>
+ }
+ Ccnb::AppendCloser (start); // </KeyLocator>
+ }
+
+ Ccnb::AppendCloser (start); // </SignedInfo>
+
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Content, CcnbParser::CCN_DTAG); // <Content>
+
+ // there are no closing tags !!!
+ // The closing tag is handled by ContentObjectTail
+}
+
+uint32_t
+Data::GetSerializedSize () const
+{
+ size_t written = 0;
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_ContentObject); // <ContentObject>
+
+ // fake signature
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Signature); // <Signature>
+ // Signature ::= DigestAlgorithm?
+ // Witness?
+ // SignatureBits
+ // if (GetSignature ().GetDigestAlgorithm () != Signature::DefaultDigestAlgorithm)
+ // {
+ // written += Ccnb::EstimateString (CcnbParser::CCN_DTAG_DigestAlgorithm, GetSignature ().GetDigestAlgorithm ());
+ // }
+ written += Ccnb::EstimateTaggedBlob (CcnbParser::CCN_DTAG_SignatureBits,
+ sizeof (m_data->GetSignature ())); // <SignatureBits />
+ written += 1; // </Signature>
+
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Name); // <Name>
+ written += Ccnb::SerializedSizeName (m_data->GetName ()); // <Component>...</Component>...
+ written += 1; // </Name>
+
+ // fake signature
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_SignedInfo); // <SignedInfo>
+ // SignedInfo ::= √PublisherPublicKeyDigest
+ // √Timestamp
+ // √Type?
+ // √FreshnessSeconds?
+ // FinalBlockID?
+ // KeyLocator?
+
+ // written += Ccnb::EstimateTaggedBlob (CCN_DTAG_PublisherPublicKeyDigest, // <PublisherPublicKeyDigest>...
+ // sizeof (GetSignedInfo ().GetPublisherPublicKeyDigest ()));
+
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Timestamp); // <Timestamp>...
+ written += Ccnb::EstimateTimestampBlob (m_data->GetTimestamp ());
+ written += 1;
+
+ // if (GetSignedInfo ().GetContentType () != DATA)
+ // {
+ // written += Ccnb::EstimateTaggedBlob (CcnbParser::CCN_DTAG_Type, 3);
+ // }
+ if (m_data->GetFreshness () > Seconds(0))
+ {
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_FreshnessSeconds);
+ written += Ccnb::EstimateNumber (m_data->GetFreshness ().ToInteger (Time::S));
+ written += 1;
+ }
+
+ if (m_data->GetKeyLocator () != 0)
+ {
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_KeyLocator); // <KeyLocator>
+ {
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_KeyName); // <KeyName>
+ {
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Name); // <Name>
+ written += Ccnb::SerializedSizeName (*m_data->GetKeyLocator ()); // <Component>...</Component>...
+ written += 1; // </Name>
+ }
+ written += 1; // </KeyName>
+ }
+ written += 1; // </KeyLocator>
+ }
+
+ written += 1; // </SignedInfo>
+
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Content); // <Content>
+
+ // there are no closing tags !!!
+ // The closing tag is handled by ContentObjectTail
+ return written;
+}
+
+class ContentObjectVisitor : public CcnbParser::VoidDepthFirstVisitor
+{
+public:
+ virtual void visit (CcnbParser::Dtag &n, boost::any param/*should be ContentObject* */)
+ {
+ // uint32_t n.m_dtag;
+ // std::list< Ptr<CcnbParser::Block> > n.m_nestedBlocks;
+ static CcnbParser::NameVisitor nameVisitor;
+ static CcnbParser::NonNegativeIntegerVisitor nonNegativeIntegerVisitor;
+ static CcnbParser::TimestampVisitor timestampVisitor;
+ static CcnbParser::StringVisitor stringVisitor;
+ static CcnbParser::Uint32tBlobVisitor uint32tBlobVisitor;
+ static CcnbParser::ContentTypeVisitor contentTypeVisitor;
+
+ ndn::ContentObject &contentObject = *(boost::any_cast<ndn::ContentObject*> (param));
+
+ switch (n.m_dtag)
+ {
+ case CcnbParser::CCN_DTAG_ContentObject:
+ // process nested blocks
+ BOOST_FOREACH (Ptr<CcnbParser::Block> block, n.m_nestedTags)
+ {
+ block->accept (*this, param);
+ }
+ break;
+ case CcnbParser::CCN_DTAG_Name:
+ {
+ // process name components
+ Ptr<Name> name = Create<Name> ();
+ n.accept (nameVisitor, GetPointer (name));
+ contentObject.SetName (name);
+ break;
+ }
+
+ case CcnbParser::CCN_DTAG_Signature:
+ // process nested blocks
+ BOOST_FOREACH (Ptr<CcnbParser::Block> block, n.m_nestedTags)
+ {
+ block->accept (*this, param);
+ }
+ break;
+
+ // case CCN_DTAG_DigestAlgorithm:
+ // NS_LOG_DEBUG ("DigestAlgorithm");
+ // if (n.m_nestedTags.size ()!=1) // should be exactly one UDATA inside this tag
+ // throw CcnbParser::CcnbDecodingException ();
+
+ // contentObject.GetSignature ().SetDigestAlgorithm
+ // (boost::any_cast<std::string> ((*n.m_nestedTags.begin())->accept
+ // (stringVisitor)));
+ // break;
+
+ case CcnbParser::CCN_DTAG_SignatureBits:
+ NS_LOG_DEBUG ("SignatureBits");
+ if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+ throw CcnbParser::CcnbDecodingException ();
+
+ contentObject.SetSignature
+ (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+ (uint32tBlobVisitor)));
+ break;
+
+ case CcnbParser::CCN_DTAG_SignedInfo:
+ // process nested blocks
+ BOOST_FOREACH (Ptr<CcnbParser::Block> block, n.m_nestedTags)
+ {
+ block->accept (*this, param);
+ }
+ break;
+
+ // case CCN_DTAG_PublisherPublicKeyDigest:
+ // NS_LOG_DEBUG ("PublisherPublicKeyDigest");
+ // if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+ // throw CcnbParser::CcnbDecodingException ();
+
+ // contentObject.GetSignedInfo ().SetPublisherPublicKeyDigest
+ // (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+ // (uint32tBlobVisitor)));
+ // break;
+
+ case CcnbParser::CCN_DTAG_Timestamp:
+ NS_LOG_DEBUG ("Timestamp");
+ if (n.m_nestedTags.size()!=1) // should be exactly one nested tag
+ throw CcnbParser::CcnbDecodingException ();
+
+ contentObject.SetTimestamp
+ (boost::any_cast<Time> ((*n.m_nestedTags.begin())->accept
+ (timestampVisitor)));
+ break;
+
+ // case CCN_DTAG_Type:
+ // NS_LOG_DEBUG ("Type");
+ // if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+ // throw CcnbParser::CcnbDecodingException ();
+
+ // contentObject.GetSignedInfo ().SetContentType
+ // (static_cast<Data::ContentType>
+ // (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+ // (contentTypeVisitor))));
+ // break;
+
+ case CcnbParser::CCN_DTAG_FreshnessSeconds:
+ NS_LOG_DEBUG ("FreshnessSeconds");
+
+ if (n.m_nestedTags.size()!=1) // should be exactly one nested tag
+ throw CcnbParser::CcnbDecodingException ();
+
+ contentObject.SetFreshness
+ (Seconds
+ (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+ (nonNegativeIntegerVisitor))));
+ break;
+
+ case CcnbParser::CCN_DTAG_KeyLocator:
+ // process nested blocks
+ BOOST_FOREACH (Ptr<CcnbParser::Block> block, n.m_nestedTags)
+ {
+ block->accept (*this, param);
+ }
+ break;
+
+ case CcnbParser::CCN_DTAG_KeyName:
+ {
+ if (n.m_nestedTags.size ()!=1) // should be exactly one nested tag
+ throw CcnbParser::CcnbDecodingException ();
+
+ // process name components
+ Ptr<Name> name = Create<Name> ();
+ n.accept (nameVisitor, GetPointer (name));
+ contentObject.SetKeyLocator (name);
+ break;
+ }
+
+ case CcnbParser::CCN_DTAG_Content: // !!! HACK
+ // This hack was necessary for memory optimizations (i.e., content is virtual payload)
+ NS_ASSERT_MSG (n.m_nestedTags.size() == 0, "Parser should have stopped just after processing <Content> tag");
+ break;
+
+ default: // ignore all other stuff
+ break;
+ }
+ }
+};
+
+uint32_t
+Data::Deserialize (Buffer::Iterator start)
+{
+ static ContentObjectVisitor contentObjectVisitor;
+
+ Buffer::Iterator i = start;
+ Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
+ root->accept (contentObjectVisitor, GetPointer (m_data));
+
+ return i.GetDistanceFrom (start);
+}
+
+void
+Data::Print (std::ostream &os) const
+{
+ os << "D: " << m_data->GetName ();
+ // os << "<ContentObject><Name>" << GetName () << "</Name><Content>";
+}
+
+} // ccnb
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/wire-ccnb-interest.cc b/model/wire/ccnb/wire-ccnb-interest.cc
new file mode 100644
index 0000000..8d622a4
--- /dev/null
+++ b/model/wire/ccnb/wire-ccnb-interest.cc
@@ -0,0 +1,447 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "../ccnb.h"
+
+#include "wire-ccnb.h"
+
+#include "ns3/log.h"
+#include "ns3/unused.h"
+#include "ns3/packet.h"
+
+#include "ccnb-parser/visitors/name-visitor.h"
+#include "ccnb-parser/visitors/non-negative-integer-visitor.h"
+#include "ccnb-parser/visitors/timestamp-visitor.h"
+#include "ccnb-parser/visitors/uint32t-blob-visitor.h"
+
+#include "ccnb-parser/syntax-tree/block.h"
+#include "ccnb-parser/syntax-tree/dtag.h"
+
+#include <boost/foreach.hpp>
+
+NS_LOG_COMPONENT_DEFINE ("ndn.wire.Ccnb.Interest");
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace ccnb {
+
+NS_OBJECT_ENSURE_REGISTERED (Interest);
+
+TypeId
+Interest::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ndn::Interest::Ccnb")
+ .SetGroupName ("Ndn")
+ .SetParent<Header> ()
+ .AddConstructor<Interest> ()
+ ;
+ return tid;
+}
+
+TypeId
+Interest::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
+
+Interest::Interest ()
+ : m_interest (Create<ndn::Interest> ())
+{
+}
+
+Interest::Interest (Ptr<ndn::Interest> interest)
+ : m_interest (interest)
+{
+}
+
+Ptr<ndn::Interest>
+Interest::GetInterest ()
+{
+ return m_interest;
+}
+
+Ptr<Packet>
+Interest::ToWire (Ptr<const ndn::Interest> interest)
+{
+ Ptr<const Packet> p = interest->GetWire ();
+ if (!p)
+ {
+ Ptr<Packet> packet = Create<Packet> (*interest->GetPayload ());
+ Interest wireEncoding (ConstCast<ndn::Interest> (interest));
+ packet->AddHeader (wireEncoding);
+ interest->SetWire (packet);
+
+ p = packet;
+ }
+
+ return p->Copy ();
+}
+
+Ptr<ndn::Interest>
+Interest::FromWire (Ptr<Packet> packet)
+{
+ Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
+ interest->SetWire (packet->Copy ());
+
+ Interest wireEncoding (interest);
+ packet->RemoveHeader (wireEncoding);
+
+ interest->SetPayload (packet);
+
+ return interest;
+}
+
+void
+Interest::Serialize (Buffer::Iterator start) const
+{
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Interest, CcnbParser::CCN_DTAG); // <Interest>
+
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Name, CcnbParser::CCN_DTAG); // <Name>
+ Ccnb::SerializeName (start, m_interest->GetName()); // <Component>...</Component>...
+ Ccnb::AppendCloser (start); // </Name>
+
+ // if (m_interest->GetMinSuffixComponents() >= 0)
+ // {
+ // Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_MinSuffixComponents, CcnbParser::CCN_DTAG);
+ // Ccnb::AppendNumber (start, m_interest->GetMinSuffixComponents ());
+ // Ccnb::AppendCloser (start);
+ // }
+ // if (m_interest->GetMaxSuffixComponents() >= 0)
+ // {
+ // Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_MaxSuffixComponents, CcnbParser::CCN_DTAG);
+ // Ccnb::AppendNumber (start, m_interest->GetMaxSuffixComponents ());
+ // Ccnb::AppendCloser (start);
+ // }
+ // if (m_interest->IsEnabledExclude() && m_interest->GetExclude().size() > 0)
+ // {
+ // Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Exclude, CcnbParser::CCN_DTAG); // <Exclude>
+ // Ccnb::AppendName (start, m_interest->GetExclude()); // <Component>...</Component>...
+ // Ccnb::AppendCloser (start); // </Exclude>
+ // }
+ // if (m_interest->IsEnabledChildSelector())
+ // {
+ // Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_ChildSelector, CcnbParser::CCN_DTAG);
+ // Ccnb::AppendNumber (start, 1);
+ // Ccnb::AppendCloser (start);
+ // }
+ // if (m_interest->IsEnabledAnswerOriginKind())
+ // {
+ // Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_AnswerOriginKind, CcnbParser::CCN_DTAG);
+ // Ccnb::AppendNumber (start, 1);
+ // Ccnb::AppendCloser (start);
+ // }
+ if (m_interest->GetScope() >= 0)
+ {
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Scope, CcnbParser::CCN_DTAG);
+ Ccnb::AppendNumber (start, m_interest->GetScope ());
+ Ccnb::AppendCloser (start);
+ }
+ if (!m_interest->GetInterestLifetime().IsZero())
+ {
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_InterestLifetime, CcnbParser::CCN_DTAG);
+ Ccnb::AppendTimestampBlob (start, m_interest->GetInterestLifetime ());
+ Ccnb::AppendCloser (start);
+ }
+ if (m_interest->GetNonce()>0)
+ {
+ uint32_t nonce = m_interest->GetNonce();
+ Ccnb::AppendTaggedBlob (start, CcnbParser::CCN_DTAG_Nonce, nonce);
+ }
+
+ if (m_interest->GetNack ()>0)
+ {
+ Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Nack, CcnbParser::CCN_DTAG);
+ Ccnb::AppendNumber (start, m_interest->GetNack ());
+ Ccnb::AppendCloser (start);
+ }
+ Ccnb::AppendCloser (start); // </Interest>
+}
+
+uint32_t
+Interest::GetSerializedSize () const
+{
+ size_t written = 0;
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Interest); // <Interest>
+
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Name); // <Name>
+ written += Ccnb::SerializedSizeName (m_interest->GetName()); // <Component>...</Component>...
+ written += 1; // </Name>
+
+ // if (m_interest->GetMinSuffixComponents() >= 0)
+ // {
+ // written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_MinSuffixComponents);
+ // written += Ccnb::EstimateNumber (m_interest->GetMinSuffixComponents ());
+ // written += 1;
+ // }
+ // if (m_interest->GetMaxSuffixComponents() >= 0)
+ // {
+ // written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_MaxSuffixComponents);
+ // written += Ccnb::EstimateNumber (m_interest->GetMaxSuffixComponents ());
+ // written += 1;
+ // }
+ // if (m_interest->IsEnabledExclude() && m_interest->GetExclude().size() > 0)
+ // {
+ // written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Exclude);
+ // written += Ccnb::EstimateName (m_interest->GetExclude()); // <Component>...</Component>...
+ // written += 1; // </Exclude>
+ // }
+ // if (m_interest->IsEnabledChildSelector())
+ // {
+ // written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_ChildSelector);
+ // written += Ccnb::EstimateNumber (1);
+ // written += 1;
+ // }
+ // if (m_interest->IsEnabledAnswerOriginKind())
+ // {
+ // written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_AnswerOriginKind);
+ // written += Ccnb::EstimateNumber (1);
+ // written += 1;
+ // }
+ if (m_interest->GetScope() >= 0)
+ {
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Scope);
+ written += Ccnb::EstimateNumber (m_interest->GetScope ());
+ written += 1;
+ }
+ if (!m_interest->GetInterestLifetime().IsZero())
+ {
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_InterestLifetime);
+ written += Ccnb::EstimateTimestampBlob (m_interest->GetInterestLifetime());
+ written += 1;
+ }
+ if (m_interest->GetNonce()>0)
+ {
+ written += Ccnb::EstimateTaggedBlob (CcnbParser::CCN_DTAG_Nonce, sizeof(uint32_t));
+ }
+ if (m_interest->GetNack ()>0)
+ {
+ written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Nack);
+ written += Ccnb::EstimateNumber (m_interest->GetNack ());
+ written += 1;
+ }
+
+ written += 1; // </Interest>
+
+ return written;
+}
+
+class InterestVisitor : public CcnbParser::VoidDepthFirstVisitor
+{
+public:
+ virtual void visit (CcnbParser::Dtag &n, boost::any param/*should be CcnxInterest* */);
+};
+
+// We don't care about any other fields
+void
+InterestVisitor::visit (CcnbParser::Dtag &n, boost::any param/*should be Interest* */)
+{
+ // uint32_t n.m_dtag;
+ // std::list<Ptr<Block> > n.m_nestedBlocks;
+
+ static CcnbParser::NonNegativeIntegerVisitor nonNegativeIntegerVisitor;
+ static CcnbParser::NameVisitor nameVisitor;
+ static CcnbParser::TimestampVisitor timestampVisitor;
+ static CcnbParser::Uint32tBlobVisitor nonceVisitor;
+
+ ndn::Interest &interest = *(boost::any_cast<ndn::Interest*> (param));
+
+ switch (n.m_dtag)
+ {
+ case CcnbParser::CCN_DTAG_Interest:
+ NS_LOG_DEBUG ("Interest");
+
+ // process nested blocks
+ BOOST_FOREACH (Ptr<CcnbParser::Block> block, n.m_nestedTags)
+ {
+ block->accept (*this, param);
+ }
+ break;
+ case CcnbParser::CCN_DTAG_Name:
+ {
+ NS_LOG_DEBUG ("Name");
+
+ // process name components
+ Ptr<Name> name = Create<Name> ();
+ n.accept (nameVisitor, GetPointer (name));
+ interest.SetName (name);
+ break;
+ }
+ // case CcnbParser::CCN_DTAG_MinSuffixComponents:
+ // NS_LOG_DEBUG ("MinSuffixComponents");
+ // if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+ // throw CcnbParser::CcnbDecodingException ();
+ // interest.SetMinSuffixComponents (
+ // boost::any_cast<uint32_t> (
+ // (*n.m_nestedTags.begin())->accept(
+ // nonNegativeIntegerVisitor
+ // )));
+ // break;
+ // case CcnbParser::CCN_DTAG_MaxSuffixComponents:
+ // NS_LOG_DEBUG ("MaxSuffixComponents");
+ // if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+ // throw CcnbParser::CcnbDecodingException ();
+ // interest.SetMaxSuffixComponents (
+ // boost::any_cast<uint32_t> (
+ // (*n.m_nestedTags.begin())->accept(
+ // nonNegativeIntegerVisitor
+ // )));
+ // break;
+ // case CcnbParser::CCN_DTAG_Exclude:
+ // {
+ // NS_LOG_DEBUG ("Exclude");
+ // // process exclude components
+ // Ptr<Name> exclude = Create<Name> ();
+
+ // BOOST_FOREACH (Ptr<CcnbParser::Block> block, n.m_nestedTags)
+ // {
+ // block->accept (nameVisitor, &(*exclude));
+ // }
+ // interest.SetExclude (exclude);
+ // break;
+ // }
+ // case CcnbParser::CCN_DTAG_ChildSelector:
+ // NS_LOG_DEBUG ("ChildSelector");
+ // if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+ // throw CcnbParser::CcnbDecodingException ();
+
+ // interest.SetChildSelector (
+ // 1 == boost::any_cast<uint32_t> (
+ // (*n.m_nestedTags.begin())->accept(
+ // nonNegativeIntegerVisitor
+ // )));
+ // break;
+ // case CCN_DTAG_AnswerOriginKind:
+ // NS_LOG_DEBUG ("AnswerOriginKind");
+ // if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+ // throw CcnbParser::CcnbDecodingException ();
+ // interest.SetAnswerOriginKind (
+ // 1 == boost::any_cast<uint32_t> (
+ // (*n.m_nestedTags.begin())->accept(
+ // nonNegativeIntegerVisitor
+ // )));
+ // break;
+ case CcnbParser::CCN_DTAG_Scope:
+ NS_LOG_DEBUG ("Scope");
+ if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+ throw CcnbParser::CcnbDecodingException ();
+ interest.SetScope (
+ boost::any_cast<uint32_t> (
+ (*n.m_nestedTags.begin())->accept(
+ nonNegativeIntegerVisitor
+ )));
+ break;
+ case CcnbParser::CCN_DTAG_InterestLifetime:
+ NS_LOG_DEBUG ("InterestLifetime");
+ if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+ throw CcnbParser::CcnbDecodingException ();
+
+ interest.SetInterestLifetime (
+ boost::any_cast<Time> (
+ (*n.m_nestedTags.begin())->accept(
+ timestampVisitor
+ )));
+ break;
+ case CcnbParser::CCN_DTAG_Nonce:
+ NS_LOG_DEBUG ("Nonce");
+ if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+ throw CcnbParser::CcnbDecodingException ();
+
+ interest.SetNonce (
+ boost::any_cast<uint32_t> (
+ (*n.m_nestedTags.begin())->accept(
+ nonceVisitor
+ )));
+ break;
+
+
+ case CcnbParser::CCN_DTAG_Nack:
+ NS_LOG_DEBUG ("Nack");
+ if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+ throw CcnbParser::CcnbDecodingException ();
+
+ interest.SetNack (
+ boost::any_cast<uint32_t> (
+ (*n.m_nestedTags.begin())->accept(nonNegativeIntegerVisitor)));
+ break;
+ }
+}
+
+
+uint32_t
+Interest::Deserialize (Buffer::Iterator start)
+{
+ static InterestVisitor interestVisitor;
+
+ Buffer::Iterator i = start;
+ Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
+ root->accept (interestVisitor, GetPointer (m_interest));
+
+ return i.GetDistanceFrom (start);
+}
+
+void
+Interest::Print (std::ostream &os) const
+{
+ os << "I: " << m_interest->GetName ();
+
+ return;
+ // os << "<Interest>\n <Name>" << GetName () << "</Name>\n";
+ // if (GetNack ()>0)
+ // {
+ // os << " <NACK>";
+ // switch (GetNack ())
+ // {
+ // case NACK_LOOP:
+ // os << "loop";
+ // break;
+ // case NACK_CONGESTION:
+ // os << "congestion";
+ // break;
+ // default:
+ // os << "unknown";
+ // break;
+ // }
+ // os << "</NACK>\n";
+ // }
+ // if (GetMinSuffixComponents () >= 0)
+ // os << " <MinSuffixComponents>" << GetMinSuffixComponents () << "</MinSuffixComponents>\n";
+ // if (GetMaxSuffixComponents () >= 0)
+ // os << " <MaxSuffixComponents>" << m_maxSuffixComponents << "</MaxSuffixComponents>\n";
+ // if (IsEnabledExclude () && GetExclude ().size()>0)
+ // os << " <Exclude>" << GetExclude () << "</Exclude>\n";
+ // if (IsEnabledChildSelector ())
+ // os << " <ChildSelector />\n";
+ // if (IsEnabledAnswerOriginKind ())
+ // os << " <AnswerOriginKind />\n";
+ // if (GetScope () >= 0)
+ // os << " <Scope>" << GetScope () << "</Scope>\n";
+ // if ( !GetInterestLifetime ().IsZero() )
+ // os << " <InterestLifetime>" << GetInterestLifetime () << "</InterestLifetime>\n";
+ // if (GetNonce ()>0)
+ // os << " <Nonce>" << GetNonce () << "</Nonce>\n";
+ // os << "</Interest>";
+}
+
+} // ccnb
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/wire-ccnb.cc b/model/wire/ccnb/wire-ccnb.cc
new file mode 100644
index 0000000..e3a9ef1
--- /dev/null
+++ b/model/wire/ccnb/wire-ccnb.cc
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "wire-ccnb.h"
+
+#include <sstream>
+#include <boost/foreach.hpp>
+#include "ccnb-parser/common.h"
+#include "ccnb-parser/visitors/name-visitor.h"
+#include "ccnb-parser/syntax-tree/block.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+
+//////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+
+#define CCN_TT_BITS 3
+#define CCN_TT_MASK ((1 << CCN_TT_BITS) - 1)
+#define CCN_MAX_TINY ((1 << (7-CCN_TT_BITS)) - 1)
+#define CCN_TT_HBIT ((unsigned char)(1 << 7))
+
+size_t
+Ccnb::AppendBlockHeader (Buffer::Iterator &start, size_t val, uint32_t tt)
+{
+ unsigned char buf[1+8*((sizeof(val)+6)/7)];
+ unsigned char *p = &(buf[sizeof(buf)-1]);
+ size_t n = 1;
+ p[0] = (CCN_TT_HBIT & ~CcnbParser::CCN_CLOSE) |
+ ((val & CCN_MAX_TINY) << CCN_TT_BITS) |
+ (CCN_TT_MASK & tt);
+ val >>= (7-CCN_TT_BITS);
+ while (val != 0) {
+ (--p)[0] = (((unsigned char)val) & ~CCN_TT_HBIT) | CcnbParser::CCN_CLOSE;
+ n++;
+ val >>= 7;
+ }
+ start.Write (p,n);
+ return n;
+}
+
+size_t
+Ccnb::EstimateBlockHeader (size_t value)
+{
+ value >>= (7-CCN_TT_BITS);
+ size_t n = 1;
+ while (value>0)
+ {
+ value >>= 7;
+ n++;
+ }
+ return n;
+}
+
+size_t
+Ccnb::AppendNumber (Buffer::Iterator &start, uint32_t number)
+{
+ std::ostringstream os;
+ os << number;
+
+ size_t written = 0;
+ written += AppendBlockHeader (start, os.str().size(), CcnbParser::CCN_UDATA);
+ written += os.str().size();
+ start.Write (reinterpret_cast<const unsigned char*>(os.str().c_str()), os.str().size());
+
+ return written;
+}
+
+size_t
+Ccnb::EstimateNumber (uint32_t number)
+{
+ std::ostringstream os;
+ os << number;
+ return EstimateBlockHeader (os.str ().size ()) + os.str ().size ();
+}
+
+size_t
+Ccnb::AppendCloser (Buffer::Iterator &start)
+{
+ start.WriteU8 (CcnbParser::CCN_CLOSE);
+ return 1;
+}
+
+size_t
+Ccnb::AppendTimestampBlob (Buffer::Iterator &start, const Time &time)
+{
+ // the original function implements Markers... thought not sure what are these markers for...
+
+ // Determine miminal number of bytes required to store the timestamp
+ int required_bytes = 2; // 12 bits for fractions of a second, 4 bits left for seconds. Sometimes it is enough
+ intmax_t ts = time.ToInteger (Time::S) >> 4;
+ for (; required_bytes < 7 && ts != 0; ts >>= 8) // not more than 6 bytes?
+ required_bytes++;
+
+ size_t len = AppendBlockHeader(start, required_bytes, CcnbParser::CCN_BLOB);
+
+ // write part with seconds
+ ts = time.ToInteger (Time::S) >> 4;
+ for (int i = 0; i < required_bytes - 2; i++)
+ start.WriteU8 ( ts >> (8 * (required_bytes - 3 - i)) );
+
+ /* arithmetic contortions are to avoid overflowing 31 bits */
+ ts = ((time.ToInteger (Time::S) & 15) << 12) +
+ (((time.ToInteger (Time::NS) % 1000000000) / 5 * 8 + 195312) / 390625);
+ for (int i = required_bytes - 2; i < required_bytes; i++)
+ start.WriteU8 ( ts >> (8 * (required_bytes - 1 - i)) );
+
+ return len + required_bytes;
+}
+
+size_t
+Ccnb::EstimateTimestampBlob (const Time &time)
+{
+ int required_bytes = 2; // 12 bits for fractions of a second, 4 bits left for seconds. Sometimes it is enough
+ intmax_t ts = time.ToInteger (Time::S) >> 4;
+ for (; required_bytes < 7 && ts != 0; ts >>= 8) // not more than 6 bytes?
+ required_bytes++;
+
+ return EstimateBlockHeader (required_bytes) + required_bytes;
+}
+
+size_t
+Ccnb::AppendTaggedBlob (Buffer::Iterator &start, uint32_t dtag,
+ const uint8_t *data, size_t size)
+{
+ size_t written = AppendBlockHeader (start, dtag, CcnbParser::CCN_DTAG);
+ /* 2 */
+ if (size>0)
+ {
+ written += AppendBlockHeader (start, size, CcnbParser::CCN_BLOB);
+ start.Write (data, size);
+ written += size;
+ /* size */
+ }
+ written += AppendCloser (start);
+ /* 1 */
+
+ return written;
+}
+
+size_t
+Ccnb::EstimateTaggedBlob (uint32_t dtag, size_t size)
+{
+ if (size>0)
+ return EstimateBlockHeader (dtag) + EstimateBlockHeader (size) + size + 1;
+ else
+ return EstimateBlockHeader (dtag) + 1;
+}
+
+size_t
+Ccnb::AppendString (Buffer::Iterator &start, uint32_t dtag,
+ const std::string &string)
+{
+ size_t written = AppendBlockHeader (start, dtag, CcnbParser::CCN_DTAG);
+ {
+ written += AppendBlockHeader (start, string.size (), CcnbParser::CCN_UDATA);
+ start.Write (reinterpret_cast<const uint8_t*> (string.c_str ()), string.size ());
+ written += string.size ();
+ }
+ written += AppendCloser (start);
+
+ return written;
+}
+
+size_t
+Ccnb::EstimateString (uint32_t dtag, const std::string &string)
+{
+ return EstimateBlockHeader (dtag) + EstimateBlockHeader (string.size ()) + string.size () + 1;
+}
+
+size_t
+Ccnb::SerializeName (Buffer::Iterator &start, const Name &name)
+{
+ size_t written = 0;
+ BOOST_FOREACH (const name::Component &component, name)
+ {
+ written += AppendTaggedBlob (start, CcnbParser::CCN_DTAG_Component,
+ reinterpret_cast<const uint8_t*>(component.buf ()), component.size());
+ }
+ return written;
+}
+
+size_t
+Ccnb::SerializedSizeName (const Name &name)
+{
+ size_t written = 0;
+ BOOST_FOREACH (const name::Component &component, name)
+ {
+ written += EstimateTaggedBlob (CcnbParser::CCN_DTAG_Component, component.size ());
+ }
+ return written;
+}
+
+Ptr<Name>
+Ccnb::DeserializeName (Buffer::Iterator &i)
+{
+ Ptr<Name> name = Create<Name> ();
+ CcnbParser::NameVisitor nameVisitor;
+
+ Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
+ root->accept (nameVisitor, GetPointer (name));
+
+ return name;
+}
+
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/disabled/ndn-encoding-helper.h b/model/wire/ccnb/wire-ccnb.h
similarity index 72%
rename from disabled/ndn-encoding-helper.h
rename to model/wire/ccnb/wire-ccnb.h
index d28425c..91d3d9e 100644
--- a/disabled/ndn-encoding-helper.h
+++ b/model/wire/ccnb/wire-ccnb.h
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2011 University of California, Los Angeles
+ * Copyright (c) 2011-2013 University of California, Los Angeles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -18,62 +18,36 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef _NDN_ENCODING_HELPER_H_
-#define _NDN_ENCODING_HELPER_H_
+#ifndef NDN_WIRE_CCNB_SYNTAX_H
+#define NDN_WIRE_CCNB_SYNTAX_H
-#include <sys/types.h>
-
-#include "ccnb-parser/common.h"
#include "ns3/ptr.h"
#include "ns3/nstime.h"
#include "ns3/buffer.h"
-namespace ns3 {
-namespace ndn {
+#include "ns3/ndn-common.h"
+#include "ns3/ndn-name.h"
-class Name;
-typedef Name NameComponents;
+NDN_NAMESPACE_BEGIN
-class Interest;
-class ContentObject;
-
-typedef Interest InterestHeader;
-typedef ContentObject ContentObjectHeader;
+namespace wire {
/**
- * \brief Helper to encode/decode ccnb formatted Ndn message
+ * \brief Helper to encode CCNb blocks
*/
-class EncodingHelper
+class Ccnb
{
public:
/**
- * \brief Serialize NdnInterest to Buffer::Iterator
- * @param start Buffer to store serialized NdnInterest
- * @param interest Pointer to NdnInterest to be serialized
- * @return length of serialized NdnInterest
- */
- static size_t
- Serialize (Buffer::Iterator start, const Interest &interest);
-
- /**
- * \brief Compute the size of serialized NdnInterest
- * @param interest Pointer to NdnInterest
- * @return length
- */
- static size_t
- GetSerializedSize (const Interest &interest);
-
-public:
- /**
* @brief Append CCNB block header
- * @param start Buffer to store serialized NdnInterest
+ * @param start Buffer to store serialized
* @param value dictionary id of the block header
* @param block_type Type of CCNB block
*
* @returns written length
*/
static size_t
- AppendBlockHeader (Buffer::Iterator &start, size_t value, CcnbParser::ccn_tt block_type);
+ AppendBlockHeader (Buffer::Iterator &start, size_t value, uint32_t block_type);
/**
* @brief Estimate size of the CCNB block header
@@ -111,24 +85,6 @@
AppendCloser (Buffer::Iterator &start);
/**
- * @brief Append Name in CCNB encoding
- * @param start Buffer to store serialized Interest
- * @param name constant reference to Name object
- *
- * @returns written length
- */
- static size_t
- AppendName (Buffer::Iterator &start, const Name &name);
-
- /**
- * @brief Estimate size of Name in CCNB encoding
- * @param name constant reference to Name object
- * @returns estimated length
- */
- static size_t
- EstimateName (const Name &name);
-
- /**
* Append a binary timestamp as a BLOB using the ccn binary
* Timestamp representation (12-bit fraction).
*
@@ -161,7 +117,7 @@
* @returns written length
*/
static size_t
- AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
+ AppendTaggedBlob (Buffer::Iterator &start, uint32_t dtag,
const uint8_t *data, size_t size);
/**
@@ -171,7 +127,7 @@
* @returns estimated length
*/
static size_t
- EstimateTaggedBlob (CcnbParser::ccn_dtag dtag, size_t size);
+ EstimateTaggedBlob (uint32_t dtag, size_t size);
/**
* Append value as a tagged BLOB (templated version)
@@ -188,7 +144,7 @@
*/
template<class T>
static inline size_t
- AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag, const T &data);
+ AppendTaggedBlob (Buffer::Iterator &start, uint32_t dtag, const T &data);
/**
* Append a tagged string (should be a valid UTF-8 coded string)
@@ -202,7 +158,7 @@
* @returns written length
*/
static size_t
- AppendString (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
+ AppendString (Buffer::Iterator &start, uint32_t dtag,
const std::string &string);
/**
@@ -212,19 +168,49 @@
* @returns estimated length
*/
static size_t
- EstimateString (CcnbParser::ccn_dtag dtag, const std::string &string);
-};
+ EstimateString (uint32_t dtag, const std::string &string);
+
+ ////////////////////////////////
+ // General use wire formatters
+ ////////////////////////////////
+
+ /**
+ * @brief Append Name in CCNB encoding
+ * @param start Buffer to store serialized Interest
+ * @param name constant reference to Name object
+ *
+ * @returns written length
+ */
+ static size_t
+ SerializeName (Buffer::Iterator &start, const Name &name);
+
+ /**
+ * @brief Estimate size of Name in CCNB encoding
+ * @param name constant reference to Name object
+ * @returns estimated length
+ */
+ static size_t
+ SerializedSizeName (const Name &name);
+
+ /**
+ * @brief Deserialize Name from CCNB encodeing
+ * @param start Buffer that stores serialized Interest
+ * @param name Name object
+ */
+ static Ptr<Name>
+ DeserializeName (Buffer::Iterator &start);
+}; // Ccnb
template<class T>
size_t
-EncodingHelper::AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag, const T &data)
+Ccnb::AppendTaggedBlob (Buffer::Iterator &start, uint32_t dtag, const T &data)
{
return AppendTaggedBlob (start, dtag, reinterpret_cast<const uint8_t*> (&data), sizeof (data));
}
-} // namespace ndn
-} // namespace ns3
+} // wire
-#endif // _NDN_ENCODING_HELPER_H_
+NDN_NAMESPACE_END
+#endif // NDN_WIRE_CCNB_SYNTAX_H
diff --git a/model/wire/ndn-wire.cc b/model/wire/ndn-wire.cc
new file mode 100644
index 0000000..6296aa6
--- /dev/null
+++ b/model/wire/ndn-wire.cc
@@ -0,0 +1,300 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU 3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ndn-wire.h"
+
+#include "ns3/global-value.h"
+#include "ns3/integer.h"
+#include "ns3/ndn-common.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
+#include "ns3/ndn-header-helper.h"
+
+#include "ndnsim.h"
+#include "ndnsim/wire-ndnsim.h"
+#include "ccnb.h"
+#include "ccnb/wire-ccnb.h"
+
+NDN_NAMESPACE_BEGIN
+
+static
+GlobalValue g_wireFormat ("ndn::WireFormat",
+ "Default wire format for ndnSIM. ndnSIM will be accepting packets "
+ "in any supported packet formats, but if encoding requested, it will "
+ "use default wire format to encode (0 for ndnSIM (default), 1 for CCNb)",
+ IntegerValue (Wire::WIRE_FORMAT_NDNSIM),
+ MakeIntegerChecker<int32_t> ());
+
+static inline uint32_t
+GetWireFormat ()
+{
+ static int32_t format = -1;
+ if (format >= 0)
+ return format;
+
+ IntegerValue value;
+ g_wireFormat.GetValue (value);
+ format = value.Get ();
+
+ return format;
+}
+
+Ptr<Packet>
+Wire::FromInterest (Ptr<const Interest> interest, int8_t wireFormat/* = WIRE_FORMAT_DEFAULT*/)
+{
+ if (wireFormat == WIRE_FORMAT_DEFAULT)
+ wireFormat = GetWireFormat ();
+
+ if (wireFormat == WIRE_FORMAT_NDNSIM)
+ return wire::ndnSIM::Interest::ToWire (interest);
+ else if (wireFormat == WIRE_FORMAT_CCNB)
+ return wire::ccnb::Interest::ToWire (interest);
+ else
+ {
+ NS_FATAL_ERROR ("Unsupported format requested");
+ return 0;
+ }
+}
+
+Ptr<Interest>
+Wire::ToInterest (Ptr<Packet> packet, int8_t wireFormat/* = WIRE_FORMAT_AUTODETECT*/)
+{
+ if (wireFormat == WIRE_FORMAT_AUTODETECT)
+ {
+ try
+ {
+ HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (packet);
+ switch (type)
+ {
+ case HeaderHelper::INTEREST_NDNSIM:
+ {
+ return wire::ndnSIM::Interest::FromWire (packet);
+ }
+ case HeaderHelper::INTEREST_CCNB:
+ {
+ return wire::ccnb::Interest::FromWire (packet);
+ }
+ case HeaderHelper::CONTENT_OBJECT_NDNSIM:
+ case HeaderHelper::CONTENT_OBJECT_CCNB:
+ NS_FATAL_ERROR ("Data packet supplied for InterestFromWire function");
+ break;
+ }
+
+ // exception will be thrown if packet is not recognized
+ }
+ catch (UnknownHeaderException)
+ {
+ NS_FATAL_ERROR ("Unknown NDN header");
+ return 0;
+ }
+ }
+ else
+ {
+ if (wireFormat == WIRE_FORMAT_NDNSIM)
+ return wire::ndnSIM::Interest::FromWire (packet);
+ else if (wireFormat == WIRE_FORMAT_CCNB)
+ return wire::ccnb::Interest::FromWire (packet);
+ else
+ {
+ NS_FATAL_ERROR ("Unsupported format requested");
+ return 0;
+ }
+ }
+}
+
+Ptr<Packet>
+Wire::FromData (Ptr<const ContentObject> data, int8_t wireFormat/* = WIRE_FORMAT_DEFAULT*/)
+{
+ if (wireFormat == WIRE_FORMAT_DEFAULT)
+ wireFormat = GetWireFormat ();
+
+ if (wireFormat == WIRE_FORMAT_NDNSIM)
+ return wire::ndnSIM::Data::ToWire (data);
+ else if (wireFormat == WIRE_FORMAT_CCNB)
+ return wire::ccnb::Data::ToWire (data);
+ else
+ {
+ NS_FATAL_ERROR ("Unsupported format requested");
+ return 0;
+ }
+}
+
+Ptr<ContentObject>
+Wire::ToData (Ptr<Packet> packet, int8_t wireFormat/* = WIRE_FORMAT_AUTODETECT*/)
+{
+ if (wireFormat == WIRE_FORMAT_AUTODETECT)
+ {
+ try
+ {
+ HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (packet);
+ switch (type)
+ {
+ case HeaderHelper::CONTENT_OBJECT_NDNSIM:
+ {
+ return wire::ndnSIM::Data::FromWire (packet);
+ }
+ case HeaderHelper::CONTENT_OBJECT_CCNB:
+ {
+ return wire::ccnb::Data::FromWire (packet);
+ }
+ case HeaderHelper::INTEREST_NDNSIM:
+ case HeaderHelper::INTEREST_CCNB:
+ NS_FATAL_ERROR ("Interest supplied for DataFromWire function");
+ break;
+ }
+
+ // exception will be thrown if packet is not recognized
+ }
+ catch (UnknownHeaderException)
+ {
+ NS_FATAL_ERROR ("Unknown NDN header");
+ return 0;
+ }
+ }
+ else
+ {
+ if (wireFormat == WIRE_FORMAT_NDNSIM)
+ return wire::ndnSIM::Data::FromWire (packet);
+ else if (wireFormat == WIRE_FORMAT_CCNB)
+ return wire::ccnb::Data::FromWire (packet);
+ else
+ {
+ NS_FATAL_ERROR ("Unsupported format requested");
+ return 0;
+ }
+ }
+}
+
+
+std::string
+Wire::FromInterestStr (Ptr<const Interest> interest, int8_t wireFormat/* = WIRE_FORMAT_DEFAULT*/)
+{
+ Ptr<Packet> pkt = FromInterest (interest, wireFormat);
+ std::string wire;
+ wire.resize (pkt->GetSize ());
+ pkt->CopyData (reinterpret_cast<uint8_t*> (&wire[0]), wire.size ());
+
+ return wire;
+}
+
+Ptr<Interest>
+Wire::ToInterestStr (const std::string &wire, int8_t type/* = WIRE_FORMAT_AUTODETECT*/)
+{
+ Ptr<Packet> pkt = Create<Packet> (reinterpret_cast<const uint8_t*> (&wire[0]), wire.size ());
+ return ToInterest (pkt, type);
+}
+
+std::string
+Wire::FromDataStr (Ptr<const ContentObject> data, int8_t wireFormat/* = WIRE_FORMAT_DEFAULT*/)
+{
+ Ptr<Packet> pkt = FromData (data, wireFormat);
+ std::string wire;
+ wire.resize (pkt->GetSize ());
+ pkt->CopyData (reinterpret_cast<uint8_t*> (&wire[0]), wire.size ());
+
+ return wire;
+}
+
+Ptr<ContentObject>
+Wire::ToDataStr (const std::string &wire, int8_t type/* = WIRE_FORMAT_AUTODETECT*/)
+{
+ Ptr<Packet> pkt = Create<Packet> (reinterpret_cast<const uint8_t*> (&wire[0]), wire.size ());
+ return ToData (pkt, type);
+}
+
+// uint32_t
+// Wire::FromNameSize (Ptr<const Name> name, int8_t wireFormat/* = WIRE_FORMAT_DEFAULT*/)
+// {
+// if (wireFormat == WIRE_FORMAT_DEFAULT)
+// wireFormat = GetWireFormat ();
+
+// if (wireFormat == WIRE_FORMAT_NDNSIM)
+// {
+// std::cout << wire::NdnSim::SerializedSizeName (*name) << std::endl;
+// return wire::NdnSim::SerializedSizeName (*name);
+// }
+// else if (wireFormat == WIRE_FORMAT_CCNB)
+// return wire::Ccnb::SerializedSizeName (*name);
+// else
+// {
+// NS_FATAL_ERROR ("Unsupported format requested");
+// return 0;
+// }
+// }
+
+std::string
+Wire::FromName (Ptr<const Name> name, int8_t wireFormat/* = WIRE_FORMAT_DEFAULT*/)
+{
+
+ if (wireFormat == WIRE_FORMAT_DEFAULT)
+ wireFormat = GetWireFormat ();
+
+ if (wireFormat == WIRE_FORMAT_NDNSIM)
+ {
+ Buffer buf;
+ buf.AddAtStart (wire::NdnSim::SerializedSizeName (*name));
+ Buffer::Iterator i = buf.Begin ();
+
+ wire::NdnSim::SerializeName (i, *name);
+
+ std::string wire;
+ wire.resize (buf.GetSize ());
+ buf.CopyData (reinterpret_cast<uint8_t *>(&wire[0]), wire.size ());
+
+ return wire;
+ }
+ else if (wireFormat == WIRE_FORMAT_CCNB)
+ {
+ Buffer buf;
+ buf.AddAtStart (wire::NdnSim::SerializedSizeName (*name));
+ Buffer::Iterator i = buf.Begin ();
+
+ wire::Ccnb::SerializeName (i, *name);
+
+ std::string wire;
+ wire.resize (buf.GetSize ());
+ buf.CopyData (reinterpret_cast<uint8_t *>(&wire[0]), wire.size ());
+
+ return wire;
+ }
+ else
+ {
+ NS_FATAL_ERROR ("Unsupported format requested");
+ }
+}
+
+Ptr<Name>
+Wire::ToName (const std::string &name, int8_t wireFormat/* = WIRE_FORMAT_DEFAULT*/)
+{
+ Buffer buf;
+ buf.AddAtStart (name.size ());
+ Buffer::Iterator i = buf.Begin ();
+ i.Write (reinterpret_cast<const uint8_t *> (&name[0]), name.size ());
+
+ i = buf.Begin ();
+
+ if (wireFormat == WIRE_FORMAT_DEFAULT)
+ wireFormat = GetWireFormat ();
+
+ if (wireFormat == WIRE_FORMAT_NDNSIM)
+ {
+ return wire::NdnSim::DeserializeName (i);
+ }
+ else if (wireFormat == WIRE_FORMAT_CCNB)
+ {
+ return wire::Ccnb::DeserializeName (i);
+ }
+ else
+ {
+ NS_FATAL_ERROR ("Unsupported format requested");
+ }
+}
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ndn-wire.h b/model/wire/ndn-wire.h
new file mode 100644
index 0000000..768ccea
--- /dev/null
+++ b/model/wire/ndn-wire.h
@@ -0,0 +1,98 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU 3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_WIRE_H
+#define NDN_WIRE_H
+
+#include "ns3/buffer.h"
+
+#include "ns3/ndn-common.h"
+#include "ns3/ndn-name.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
+
+NDN_NAMESPACE_BEGIN
+
+struct Wire
+{
+ enum
+ {
+ WIRE_FORMAT_DEFAULT = -2,
+ WIRE_FORMAT_AUTODETECT = -1,
+
+ WIRE_FORMAT_NDNSIM = 0,
+ WIRE_FORMAT_CCNB = 1
+ };
+
+ static Ptr<Packet>
+ FromInterest (Ptr<const Interest> interest, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
+
+ static Ptr<Interest>
+ ToInterest (Ptr<Packet> packet, int8_t type = WIRE_FORMAT_AUTODETECT);
+
+ static Ptr<Packet>
+ FromData (Ptr<const ContentObject> data, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
+
+ static Ptr<ContentObject>
+ ToData (Ptr<Packet> packet, int8_t type = WIRE_FORMAT_AUTODETECT);
+
+
+ // Helper methods for Python
+ static std::string
+ FromInterestStr (Ptr<const Interest> interest, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
+
+ static Ptr<Interest>
+ ToInterestStr (const std::string &wire, int8_t type = WIRE_FORMAT_AUTODETECT);
+
+ static std::string
+ FromDataStr (Ptr<const ContentObject> data, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
+
+ static Ptr<ContentObject>
+ ToDataStr (const std::string &wire, int8_t type = WIRE_FORMAT_AUTODETECT);
+
+ // /*
+ // * @brief Get size of buffer to fit wire-formatted name object
+ // */
+ // static uint32_t
+ // FromNameSize (Ptr<const Name> name, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
+
+ /**
+ * @brief Convert name to wire format
+ */
+ static std::string
+ FromName (Ptr<const Name> name, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
+
+ /**
+ * @brief Convert name from wire format
+ */
+ static Ptr<Name>
+ ToName (const std::string &wire, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
+};
+
+inline std::string
+PacketToBuffer (Ptr<const Packet> pkt)
+{
+ std::string buffer;
+ buffer.resize (pkt->GetSize ());
+ pkt->CopyData (reinterpret_cast<uint8_t*> (&buffer[0]), buffer.size ());
+
+ return buffer;
+}
+
+inline Ptr<Packet>
+BufferToPacket (const std::string &buffer)
+{
+ return Create<Packet> (reinterpret_cast<const uint8_t*> (&buffer[0]), buffer.size ());
+}
+
+
+NDN_NAMESPACE_END
+
+#endif // NDN_WIRE_H
diff --git a/model/wire/ndnsim.cc b/model/wire/ndnsim.cc
new file mode 100644
index 0000000..1c2d778
--- /dev/null
+++ b/model/wire/ndnsim.cc
@@ -0,0 +1,372 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU 3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ndnsim.h"
+
+using namespace std;
+
+#include <ns3/header.h>
+#include <ns3/packet.h>
+#include <ns3/log.h>
+
+#include "ndnsim/wire-ndnsim.h"
+
+NS_LOG_COMPONENT_DEFINE ("ndn.wire.ndnSIM");
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace ndnSIM {
+
+NS_OBJECT_ENSURE_REGISTERED (Interest);
+NS_OBJECT_ENSURE_REGISTERED (Data);
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+Interest::Interest ()
+ : m_interest (Create<ndn::Interest> ())
+{
+}
+
+Interest::Interest (Ptr<ndn::Interest> interest)
+ : m_interest (interest)
+{
+}
+
+Ptr<ndn::Interest>
+Interest::GetInterest ()
+{
+ return m_interest;
+}
+
+
+TypeId
+Interest::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ndn::Interest::ndnSIM")
+ .SetGroupName ("Ndn")
+ .SetParent<Header> ()
+ .AddConstructor<Interest> ()
+ ;
+ return tid;
+}
+
+TypeId
+Interest::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
+
+Ptr<Packet>
+Interest::ToWire (Ptr<const ndn::Interest> interest)
+{
+ Ptr<const Packet> p = interest->GetWire ();
+ if (!p)
+ {
+ Ptr<Packet> packet = Create<Packet> (*interest->GetPayload ());
+ Interest wireEncoding (ConstCast<ndn::Interest> (interest));
+ packet->AddHeader (wireEncoding);
+ interest->SetWire (packet);
+
+ p = packet;
+ }
+
+ return p->Copy ();
+}
+
+Ptr<ndn::Interest>
+Interest::FromWire (Ptr<Packet> packet)
+{
+ Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
+ interest->SetWire (packet->Copy ());
+
+ Interest wireEncoding (interest);
+ packet->RemoveHeader (wireEncoding);
+
+ interest->SetPayload (packet);
+
+ return interest;
+}
+
+uint32_t
+Interest::GetSerializedSize (void) const
+{
+ size_t size =
+ 1/*version*/ + 1 /*type*/ + 2/*length*/ +
+ (4/*nonce*/ + 1/*scope*/ + 1/*nack type*/ + 2/*timestamp*/ +
+ NdnSim::SerializedSizeName (m_interest->GetName ()) +
+
+ (2 +
+ (m_interest->GetExclude () == 0 ? 0 : (1 + NdnSim::SerializedSizeExclude (*m_interest->GetExclude ())))
+ )/* selectors */ +
+
+ (2 + 0)/* options */);
+
+ NS_LOG_INFO ("Serialize size = " << size);
+ return size;
+}
+
+void
+Interest::Serialize (Buffer::Iterator start) const
+{
+ start.WriteU8 (0x80); // version
+ start.WriteU8 (0x00); // packet type
+
+ start.WriteU16 (GetSerializedSize () - 4);
+
+ start.WriteU32 (m_interest->GetNonce ());
+ start.WriteU8 (m_interest->GetScope ());
+ start.WriteU8 (m_interest->GetNack ());
+
+ NS_ASSERT_MSG (0 <= m_interest->GetInterestLifetime ().ToInteger (Time::S) && m_interest->GetInterestLifetime ().ToInteger (Time::S) < 65535,
+ "Incorrect InterestLifetime (should not be smaller than 0 and larger than 65535");
+
+ // rounding timestamp value to seconds
+ start.WriteU16 (static_cast<uint16_t> (m_interest->GetInterestLifetime ().ToInteger (Time::S)));
+
+ NdnSim::SerializeName (start, m_interest->GetName ());
+
+ if (m_interest->GetExclude () == 0)
+ {
+ start.WriteU16 (0); // no selectors
+ }
+ else
+ {
+ start.WriteU16 (1 + NdnSim::SerializedSizeExclude (*m_interest->GetExclude ()));
+ start.WriteU8 (0x01);
+ NdnSim::SerializeExclude (start, *m_interest->GetExclude ());
+ }
+
+ start.WriteU16 (0); // no options
+}
+
+uint32_t
+Interest::Deserialize (Buffer::Iterator start)
+{
+ Buffer::Iterator i = start;
+
+ if (i.ReadU8 () != 0x80)
+ throw new InterestException ();
+
+ if (i.ReadU8 () != 0x00)
+ throw new InterestException ();
+
+ i.ReadU16 (); // length, don't need it right now
+
+ m_interest->SetNonce (i.ReadU32 ());
+ m_interest->SetScope (i.ReadU8 ());
+ m_interest->SetNack (i.ReadU8 ());
+
+ m_interest->SetInterestLifetime (Seconds (i.ReadU16 ()));
+
+ m_interest->SetName (NdnSim::DeserializeName (i));
+
+ uint32_t selectorsLen = i.ReadU16 ();
+ if (selectorsLen > 0)
+ {
+ if (i.ReadU8 () != 0x01) // exclude filter only
+ throw InterestException ();
+
+ m_interest->SetExclude (NdnSim::DeserializeExclude (i));
+ }
+ i.ReadU16 ();
+
+ NS_ASSERT (GetSerializedSize () == (i.GetDistanceFrom (start)));
+
+ return i.GetDistanceFrom (start);
+}
+
+void
+Interest::Print (std::ostream &os) const
+{
+ m_interest->Print (os);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+TypeId
+Data::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ndn::Data::ndnSIM")
+ .SetGroupName ("Ndn")
+ .SetParent<Header> ()
+ .AddConstructor<Data> ()
+ ;
+ return tid;
+}
+
+TypeId
+Data::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
+
+
+Data::Data ()
+ : m_data (Create<ndn::ContentObject> ())
+{
+}
+
+Data::Data (Ptr<ndn::ContentObject> data)
+ : m_data (data)
+{
+}
+
+Ptr<ndn::ContentObject>
+Data::GetData ()
+{
+ return m_data;
+}
+
+Ptr<Packet>
+Data::ToWire (Ptr<const ndn::ContentObject> data)
+{
+ Ptr<const Packet> p = data->GetWire ();
+ if (!p)
+ {
+ Ptr<Packet> packet = Create<Packet> (*data->GetPayload ());
+ Data wireEncoding (ConstCast<ndn::ContentObject> (data));
+ packet->AddHeader (wireEncoding);
+ data->SetWire (packet);
+
+ p = packet;
+ }
+
+ return p->Copy ();
+}
+
+Ptr<ndn::ContentObject>
+Data::FromWire (Ptr<Packet> packet)
+{
+ Ptr<ndn::ContentObject> data = Create<ndn::ContentObject> ();
+ data->SetWire (packet->Copy ());
+
+ Data wireEncoding (data);
+ packet->RemoveHeader (wireEncoding);
+
+ data->SetPayload (packet);
+
+ return data;
+}
+
+uint32_t
+Data::GetSerializedSize () const
+{
+ uint32_t size = 1 + 1 + 2 +
+ ((2 + 2) +
+ NdnSim::SerializedSizeName (m_data->GetName ()) +
+ (2 + 2 + 4 + 2 + 2 + (2 + 0)));
+ if (m_data->GetSignature () != 0)
+ size += 4;
+
+ NS_LOG_INFO ("Serialize size = " << size);
+ return size;
+}
+
+void
+Data::Serialize (Buffer::Iterator start) const
+{
+ start.WriteU8 (0x80); // version
+ start.WriteU8 (0x01); // packet type
+ start.WriteU16 (GetSerializedSize () - 4); // length
+
+ if (m_data->GetSignature () != 0)
+ {
+ start.WriteU16 (6); // signature length
+ start.WriteU16 (0xFF00); // "fake" simulator signature
+ start.WriteU32 (m_data->GetSignature ());
+ }
+ else
+ {
+ start.WriteU16 (2); // signature length
+ start.WriteU16 (0); // empty signature
+ }
+
+ // name
+ NdnSim::SerializeName (start, m_data->GetName ());
+
+ // content
+ // for now assume that contentdata length is zero
+ start.WriteU16 (2 + 4 + 2 + 2 + (2 + 0));
+ start.WriteU16 (4 + 2 + 2 + (2 + 0));
+ start.WriteU32 (static_cast<uint32_t> (m_data->GetTimestamp ().ToInteger (Time::S)));
+ start.WriteU16 (static_cast<uint16_t> (m_data->GetFreshness ().ToInteger (Time::S)));
+ start.WriteU16 (0); // reserved
+ start.WriteU16 (0); // Length (ContentInfoOptions)
+
+ // that's it folks
+}
+
+uint32_t
+Data::Deserialize (Buffer::Iterator start)
+{
+ Buffer::Iterator i = start;
+
+ if (i.ReadU8 () != 0x80)
+ throw new ContentObjectException ();
+
+ if (i.ReadU8 () != 0x01)
+ throw new ContentObjectException ();
+
+ i.ReadU16 (); // length
+
+ uint32_t signatureLength = i.ReadU16 ();
+ if (signatureLength == 6)
+ {
+ if (i.ReadU16 () != 0xFF00) // signature type
+ throw new ContentObjectException ();
+ m_data->SetSignature (i.ReadU32 ());
+ }
+ else if (signatureLength == 2)
+ {
+ if (i.ReadU16 () != 0) // signature type
+ throw new ContentObjectException ();
+ m_data->SetSignature (0);
+ }
+ else
+ throw new ContentObjectException ();
+
+ m_data->SetName (NdnSim::DeserializeName (i));
+
+ if (i.ReadU16 () != (2 + 4 + 2 + 2 + (2 + 0))) // content length
+ throw new ContentObjectException ();
+
+ if (i.ReadU16 () != (4 + 2 + 2 + (2 + 0))) // Length (content Info)
+ throw new ContentObjectException ();
+
+ m_data->SetTimestamp (Seconds (i.ReadU32 ()));
+ m_data->SetFreshness (Seconds (i.ReadU16 ()));
+
+ if (i.ReadU16 () != 0) // Reserved
+ throw new ContentObjectException ();
+ if (i.ReadU16 () != 0) // Length (ContentInfoOptions)
+ throw new ContentObjectException ();
+
+ NS_ASSERT_MSG (i.GetDistanceFrom (start) == GetSerializedSize (),
+ "Something wrong with ContentObject::Deserialize");
+
+ return i.GetDistanceFrom (start);
+}
+
+void
+Data::Print (std::ostream &os) const
+{
+ m_data->Print (os);
+}
+
+} // ndnSIM
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ndnsim.h b/model/wire/ndnsim.h
new file mode 100644
index 0000000..186335e
--- /dev/null
+++ b/model/wire/ndnsim.h
@@ -0,0 +1,160 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU 3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_WIRE_NDNSIM_H
+#define NDN_WIRE_NDNSIM_H
+
+#include "ns3/ndn-common.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace ndnSIM {
+
+/**
+ * @brief Routines to serialize/deserialize Interest packet in ndnSIM format
+ *
+ * Optimized and simplified formatting of Interest packets
+ *
+ * Interest ::= Nonce
+ * Scope
+ * InterestLifetime
+ * Name
+ * Selectors
+ * Options
+ *
+ * Minumum size of the Interest packet: 1 + 4 + 2 + 1 + (2 + 0) + (2 + 0) + (2 + 0) = 14
+ *
+ * Maximum size of the Interest packet: 1 + 4 + 2 + 1 + (2 + 65535) + (2 + 65535) + (2 + 65535) = 196619
+ *
+ * ::
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Nonce |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Scope | Reserved | InterestLifetime |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ * ~ ~
+ * ~ Name ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ * ~ ~
+ * ~ Selectors ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ * ~ ~
+ * ~ Options ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+class Interest : public Header
+{
+public:
+ Interest ();
+ Interest (Ptr<ndn::Interest> interest);
+
+ Ptr<ndn::Interest>
+ GetInterest ();
+
+ static Ptr<Packet>
+ ToWire (Ptr<const ndn::Interest> interest);
+
+ static Ptr<ndn::Interest>
+ FromWire (Ptr<Packet> packet);
+
+ // from Header
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (Buffer::Iterator start) const;
+ virtual uint32_t Deserialize (Buffer::Iterator start);
+
+private:
+ Ptr<ndn::Interest> m_interest;
+};
+
+/**
+ * @brief Routines to serialize/deserialize Data packet in ndnSIM format
+ *
+ * Only few important fields are actually implemented in the simulation
+ *
+ * @see http://ndnsim.net/new-packet-formats.html
+ *
+ * ContentObject ::= Signature
+ * Name
+ * Content
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
+ * ~ ~
+ * ~ Signature ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ * ~ ~
+ * ~ Name ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ * ~ ~
+ * ~ Content ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ */
+class Data : public Header
+{
+public:
+ Data ();
+ Data (Ptr<ndn::ContentObject> data);
+
+ Ptr<ndn::ContentObject>
+ GetData ();
+
+ static Ptr<Packet>
+ ToWire (Ptr<const ndn::ContentObject> data);
+
+ static Ptr<ndn::ContentObject>
+ FromWire (Ptr<Packet> packet);
+
+ // from Header
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (Buffer::Iterator start) const;
+ virtual uint32_t Deserialize (Buffer::Iterator start);
+
+private:
+ Ptr<ndn::ContentObject> m_data;
+};
+
+} // ndnSIM
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // NDN_WIRE_NDNSIM_H
diff --git a/model/wire/ndnsim/wire-ndnsim.cc b/model/wire/ndnsim/wire-ndnsim.cc
new file mode 100644
index 0000000..013d78d
--- /dev/null
+++ b/model/wire/ndnsim/wire-ndnsim.cc
@@ -0,0 +1,175 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU 3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "wire-ndnsim.h"
+#include <boost/foreach.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+
+//////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+
+size_t
+NdnSim::SerializeName (Buffer::Iterator &i, const Name &name)
+{
+ Buffer::Iterator start = i;
+
+ i.WriteU16 (static_cast<uint16_t> (SerializedSizeName (name)-2));
+
+ for (Name::const_iterator item = name.begin ();
+ item != name.end ();
+ item++)
+ {
+ i.WriteU16 (static_cast<uint16_t> (item->size ()));
+ i.Write (reinterpret_cast<const uint8_t*> (item->buf ()), item->size ());
+ }
+
+ return i.GetDistanceFrom (start);
+}
+
+size_t
+NdnSim::SerializedSizeName (const Name &name)
+{
+ size_t nameSerializedSize = 2;
+
+ for (Name::const_iterator i = name.begin ();
+ i != name.end ();
+ i++)
+ {
+ nameSerializedSize += 2 + i->size ();
+ }
+ NS_ASSERT_MSG (nameSerializedSize < 30000, "Name is too long (> 30kbytes)");
+
+ return nameSerializedSize;
+}
+
+Ptr<Name>
+NdnSim::DeserializeName (Buffer::Iterator &i)
+{
+ Ptr<Name> name = Create<Name> ();
+
+ uint16_t nameLength = i.ReadU16 ();
+ while (nameLength > 0)
+ {
+ uint16_t length = i.ReadU16 ();
+ nameLength = nameLength - 2 - length;
+
+ uint8_t tmp[length];
+ i.Read (tmp, length);
+
+ name->append (tmp, length);
+ }
+
+ return name;
+}
+
+
+size_t
+NdnSim::SerializeExclude (Buffer::Iterator &i, const Exclude &exclude)
+{
+ Buffer::Iterator start = i;
+
+ i.WriteU16 (static_cast<uint16_t> (SerializedSizeExclude (exclude)-2));
+
+ for (Exclude::const_reverse_iterator item = exclude.rbegin ();
+ item != exclude.rend ();
+ item++)
+ {
+ if (!item->first.empty ())
+ {
+ i.WriteU8 (ExcludeNameType);
+ i.WriteU16 (static_cast<uint16_t> (item->first.size ()));
+ i.Write (reinterpret_cast<const uint8_t*> (item->first.buf ()), item->first.size ());
+ }
+ if (item->second)
+ {
+ i.WriteU8 (ExcludeAnyType);
+ }
+ }
+ return i.GetDistanceFrom (start);
+}
+
+size_t
+NdnSim::SerializedSizeExclude (const Exclude &exclude)
+{
+ size_t excludeSerializedSize = 2;
+
+ for (Exclude::const_reverse_iterator item = exclude.rbegin ();
+ item != exclude.rend ();
+ item++)
+ {
+ if (!item->first.empty ())
+ {
+ excludeSerializedSize += 1 + 2 + item->first.size ();
+ }
+ if (item->second)
+ {
+ excludeSerializedSize += 1;
+ }
+ }
+
+ return excludeSerializedSize;
+}
+
+Ptr<Exclude>
+NdnSim::DeserializeExclude (Buffer::Iterator &i)
+{
+ Ptr<Exclude> exclude = Create<Exclude> ();
+
+ uint16_t excludeLength = i.ReadU16 ();
+ while (excludeLength > 0)
+ {
+ uint8_t type = i.ReadU8 ();
+ excludeLength --;
+
+ if (type == ExcludeAnyType)
+ {
+ exclude->appendExclude (name::Component (), true);
+ }
+ else if (type == ExcludeNameType)
+ {
+ uint16_t length = i.ReadU16 ();
+ excludeLength = excludeLength - 2 - length;
+
+ uint8_t tmp[length];
+ i.Read (tmp, length);
+
+ bool any = false;
+ if (excludeLength > 0)
+ {
+ uint8_t type = i.ReadU8 ();
+ if (type != ExcludeAnyType)
+ {
+ i.Prev ();
+ }
+ else
+ {
+ any = true;
+ excludeLength --;
+ }
+ }
+
+ exclude->appendExclude (name::Component (tmp, length), any);
+ }
+ else
+ {
+ NS_FATAL_ERROR ("Incorrect format of Exclude filter");
+ }
+ }
+ return exclude;
+}
+
+
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ndnsim/wire-ndnsim.h b/model/wire/ndnsim/wire-ndnsim.h
new file mode 100644
index 0000000..4ddfb3e
--- /dev/null
+++ b/model/wire/ndnsim/wire-ndnsim.h
@@ -0,0 +1,99 @@
+/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU 3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_WIRE_NDNSIM_SYNTAX_H
+#define NDN_WIRE_NDNSIM_SYNTAX_H
+
+#include "ns3/ptr.h"
+#include "ns3/nstime.h"
+#include "ns3/buffer.h"
+
+#include "ns3/ndn-common.h"
+#include "ns3/ndnSIM/ndn.cxx/name.h"
+#include "ns3/ndnSIM/ndn.cxx/exclude.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+
+/**
+ * \brief Helper to encode ndnSIM wire elements
+ */
+class NdnSim
+{
+public:
+ /**
+ * @brief Append Name in ndnSIM encoding
+ * @param start Buffer to store serialized Interest
+ * @param name constant reference to Name object
+ *
+ * @returns written length
+ */
+ static size_t
+ SerializeName (Buffer::Iterator &start, const Name &name);
+
+ /**
+ * @brief Estimate size of Name in ndnSIM encoding
+ * @param name constant reference to Name object
+ * @returns estimated length
+ */
+ static size_t
+ SerializedSizeName (const Name &name);
+
+ /**
+ * @brief Deserialize Name from ndnSIM encodeing
+ * @param start Buffer that stores serialized Interest
+ * @param name Name object
+ */
+ static Ptr<Name>
+ DeserializeName (Buffer::Iterator &start);
+
+
+ enum Selectors {
+ SelectorExclude = 0x01
+ };
+
+ enum ExcludeTypes {
+ ExcludeNameType = 0x01,
+ ExcludeAnyType = 0x02
+ };
+
+ /**
+ * @brief Append Exclude in ndnSIM encoding
+ * @param start Buffer to store serialized Interest
+ * @param exclude constant reference to Exclude object
+ *
+ * @returns written length
+ */
+ static size_t
+ SerializeExclude (Buffer::Iterator &start, const Exclude &exclude);
+
+ /**
+ * @brief Estimate size of Exclude in ndnSIM encoding
+ * @param exclude constant reference to Exclude object
+ * @returns estimated length
+ */
+ static size_t
+ SerializedSizeExclude (const Exclude &exclude);
+
+ /**
+ * @brief Deserialize Exclude from ndnSIM encodeing
+ * @param start Buffer that stores serialized Interest
+ * @param exclude Exclude object
+ */
+ static Ptr<Exclude>
+ DeserializeExclude (Buffer::Iterator &start);
+}; // NdnSim
+
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // NDN_WIRE_NDNSIM_SYNTAX_H
diff --git a/ndn.cxx/blob.h b/ndn.cxx/blob.h
new file mode 100644
index 0000000..4b488b3
--- /dev/null
+++ b/ndn.cxx/blob.h
@@ -0,0 +1,129 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ * Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_BLOB_H
+#define NDN_BLOB_H
+
+#include "ns3/ndn-common.h"
+
+#include <vector>
+
+NDN_NAMESPACE_BEGIN
+
+/**
+ * @brief Class representing a general-use binary blob
+ */
+class Blob
+{
+public:
+ typedef std::vector<char> base;
+
+ typedef base::value_type value_type;
+ typedef base::pointer pointer;
+ typedef base::const_pointer const_pointer;
+ typedef base::reference reference;
+ typedef base::const_reference const_reference;
+ typedef base::iterator iterator;
+ typedef base::const_iterator const_iterator;
+ typedef base::const_reverse_iterator const_reverse_iterator;
+ typedef base::reverse_iterator reverse_iterator;
+ typedef base::size_type size_type;
+ typedef base::difference_type difference_type;
+ typedef base::allocator_type allocator_type;
+
+public:
+ /**
+ * @brief Creates an empty blob
+ */
+ Blob ()
+ {
+ }
+
+ Blob (const std::string &data)
+ : m_data (data.begin (), data.end ())
+ {
+ }
+
+ Blob (const void *buf, size_t length)
+ : m_data (reinterpret_cast<const char*> (buf), reinterpret_cast<const char*> (buf) + length)
+ {
+ }
+
+ /**
+ * @brief Get pointer to the first byte of the binary blob
+ */
+ inline char*
+ buf ()
+ {
+ return &m_data.front ();
+ }
+
+ /**
+ * @brief Get const pointer to the first byte of the binary blob
+ */
+ inline const char*
+ buf () const
+ {
+ return &m_data.front ();
+ }
+
+ iterator begin () { return m_data.begin (); }
+ const_iterator begin () const { return m_data.begin (); }
+ iterator end () { return m_data.end (); }
+ const_iterator end () const { return m_data.end (); }
+ size_t size () const { return m_data.size (); }
+
+ void swap (Blob &x) { m_data.swap (x.m_data); }
+ void push_back (value_type val) { m_data.push_back (val); }
+
+ bool empty () const { return m_data.empty (); }
+
+ Blob &
+ operator = (const Blob &other) { m_data = other.m_data; return *this; }
+
+ reference operator [] (size_type pos) { return m_data [pos]; }
+ const_reference operator [] (size_type pos) const { return m_data [pos]; }
+
+ char getItem (size_type pos) const { return m_data [pos]; }
+
+ void clear () { m_data.clear (); }
+
+private:
+ friend bool operator == (const Blob &a, const Blob &b);
+ friend bool operator < (const Blob &a, const Blob &b);
+ friend bool operator <= (const Blob &a, const Blob &b);
+ friend bool operator > (const Blob &a, const Blob &b);
+ friend bool operator >= (const Blob &a, const Blob &b);
+
+private:
+ std::vector< char > m_data;
+};
+
+inline bool operator == (const Blob &a, const Blob &b) { return a.m_data == b.m_data; }
+inline bool operator < (const Blob &a, const Blob &b) { return a.m_data < b.m_data; }
+inline bool operator <= (const Blob &a, const Blob &b) { return a.m_data <= b.m_data; }
+inline bool operator > (const Blob &a, const Blob &b) { return a.m_data > b.m_data; }
+inline bool operator >= (const Blob &a, const Blob &b) { return a.m_data >= b.m_data; }
+
+NDN_NAMESPACE_END
+
+#include <boost/functional/hash.hpp>
+namespace boost
+{
+inline std::size_t
+hash_value (const ns3::ndn::Blob v)
+{
+ return boost::hash_range (v.begin(), v.end());
+}
+}
+
+#endif // NDN_BLOB_H
diff --git a/ndn.cxx/detail/error.h b/ndn.cxx/detail/error.h
new file mode 100644
index 0000000..a1f1e34
--- /dev/null
+++ b/ndn.cxx/detail/error.h
@@ -0,0 +1,121 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+/**
+ * @file error.h
+ * @brief This file defines basic elements for the library reporting
+ *
+ * The library throws a number of exceptions.
+ * In general, the following example shows how to print out diagnostic information
+ * when one of the exceptions is thrown
+ * @code
+ * try
+ * {
+ * ... operations with ndn::Name
+ * }
+ * catch (boost::exception &e)
+ * {
+ * std::cerr << boost::diagnostic_information (e) << std::endl;
+ * }
+ * @endcode
+ */
+
+#ifndef NDN_ERROR2_H
+#define NDN_ERROR2_H
+
+#include "ns3/ndn-common.h"
+#include <boost/exception/all.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace error
+{
+
+struct Error : public virtual boost::exception, public virtual std::exception {}; ///< @brief Some error with error reporting engine
+struct Uri : public virtual boost::exception, public virtual std::exception {}; ///< @brief An error with URI processing
+struct StringTransform : public virtual boost::exception, public virtual std::exception {};
+struct Name : public virtual boost::exception, public virtual std::exception {}; ///< @brief An error with Name
+namespace name {
+struct Component : public virtual boost::exception, public virtual std::exception {}; ///< @brief An error with name::Component
+}
+struct Exclude : public virtual boost::exception, public virtual std::exception {}; ///< @brief An error with Exclude
+struct KeyLocator : public virtual boost::exception, public virtual std::exception {}; ///< @brief An error with KeyLocator
+namespace wire {
+struct Ccnb : public virtual boost::exception, public virtual std::exception {}; ///< @brief An error with wire::Ccnb encoding
+}
+struct Keychain : public virtual boost::exception, public virtual std::exception {}; ///< @brief An error with security::Keychain
+
+// Diagnostic information fields
+
+/**
+ * @brief Free-formatted text message explaining the error
+ *
+ * @code
+ * ...
+ * catch (boost::exception &e)
+ * {
+ * if (const std::string *error = boost::get_error_info<error::msg> (e))
+ * ...
+ * }
+ * @endcode
+ *
+ * @see get_msg
+ */
+typedef boost::error_info<struct tag_msg, std::string> msg;
+
+/**
+ * @brief Helper method to get error message from the exception
+ *
+ * Method assumes that message is present, if not, an exception will be thrown
+ */
+inline const std::string &
+get_msg (boost::exception &e)
+{
+ const std::string *error = boost::get_error_info<msg> (e);
+ if (error == 0)
+ BOOST_THROW_EXCEPTION (Error ());
+ return *error;
+}
+
+/**
+ * @brief Report of the position of the error (error-specific meaning)
+ *
+ * @code
+ * ...
+ * catch (boost::exception &e)
+ * {
+ * if (const int *error = boost::get_error_info<error::pos> (e))
+ * ...
+ * }
+ * @endcode
+ *
+ * @see get_pos
+ */
+typedef boost::error_info<struct tag_pos, int> pos;
+
+/**
+ * @brief Helper method to get position of the error from the exception
+ *
+ * Method assumes that position is present, if not, an exception will be thrown
+ */
+inline int
+get_pos (boost::exception &e)
+{
+ const int *position = boost::get_error_info<pos> (e);
+ if (position == 0)
+ BOOST_THROW_EXCEPTION (Error ());
+ return *position;
+}
+
+} // error
+
+NDN_NAMESPACE_END
+
+#endif // NDN_ERROR2_H
diff --git a/ndn.cxx/detail/pending-interests-container.h b/ndn.cxx/detail/pending-interests-container.h
new file mode 100644
index 0000000..4d96ed4
--- /dev/null
+++ b/ndn.cxx/detail/pending-interests-container.h
@@ -0,0 +1,66 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU v3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_NDNCXX_DETAIL_PENDING_INTEREST_CONTAINER_H
+#define NDN_NDNCXX_DETAIL_PENDING_INTEREST_CONTAINER_H
+
+#include <ns3/ndnSIM/utils/trie/trie-with-policy.h>
+#include "timeouts-policy.h"
+
+namespace ns3 {
+namespace ndn {
+namespace detail {
+
+struct PendingInterestEntry : public SimpleRefCount< PendingInterestEntry >
+{
+public:
+ PendingInterestEntry (Ptr<const Interest> interest)
+ : m_interest (interest)
+ { }
+
+ void
+ AddCallbacks (ApiFace::DataCallback onData, ApiFace::TimeoutCallback onTimeout)
+ {
+ m_dataCallback = onData;
+ m_timeoutCallback = onTimeout;
+ }
+
+ void
+ ClearCallbacks ()
+ {
+ m_dataCallback = ApiFace::DataCallback ();
+ m_timeoutCallback = ApiFace::TimeoutCallback ();
+ }
+
+ Ptr<const Interest>
+ GetInterest () const
+ {
+ return m_interest;
+ }
+
+public:
+ ApiFace::DataCallback m_dataCallback;
+ ApiFace::TimeoutCallback m_timeoutCallback;
+ Ptr<const Interest> m_interest;
+};
+
+
+struct PendingInterestContainer :
+ public ndnSIM::trie_with_policy<Name,
+ ndnSIM::smart_pointer_payload_traits< PendingInterestEntry >,
+ timeouts_policy_traits>
+{
+};
+
+} // detail
+} // ndn
+} // ns3
+
+#endif // NDN_NDNCXX_DETAIL_PENDING_INTEREST_CONTAINER_H
diff --git a/ndn.cxx/detail/registered-prefix-container.h b/ndn.cxx/detail/registered-prefix-container.h
new file mode 100644
index 0000000..2e6c151
--- /dev/null
+++ b/ndn.cxx/detail/registered-prefix-container.h
@@ -0,0 +1,63 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU v3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_NDNCXX_DETAIL_REGISTERED_PREFIX_CONTAINER_H
+#define NDN_NDNCXX_DETAIL_REGISTERED_PREFIX_CONTAINER_H
+
+#include <ns3/ndnSIM/utils/trie/trie-with-policy.h>
+#include <ns3/ndnSIM/utils/trie/counting-policy.h>
+
+namespace ns3 {
+namespace ndn {
+namespace detail {
+
+struct RegisteredPrefixEntry : public SimpleRefCount< RegisteredPrefixEntry >
+{
+public:
+ RegisteredPrefixEntry (Ptr<const Name> prefix)
+ : m_prefix (prefix)
+ { }
+
+ void
+ AddCallback (ApiFace::InterestCallback callback)
+ {
+ m_callback = callback;
+ }
+
+ void
+ ClearCallback ()
+ {
+ m_callback = ApiFace::InterestCallback ();
+ }
+
+ Ptr<const Name>
+ GetPrefix () const
+ {
+ return m_prefix;
+ }
+
+public:
+ ApiFace::InterestCallback m_callback;
+ Ptr<const Name> m_prefix;
+};
+
+
+struct RegisteredPrefixContainer :
+ public ndnSIM::trie_with_policy<Name,
+ ndnSIM::smart_pointer_payload_traits< RegisteredPrefixEntry >,
+ ndnSIM::counting_policy_traits>
+{
+};
+
+} // detail
+} // ndn
+} // ns3
+
+#endif // NDN_NDNCXX_DETAIL_REGISTERED_PREFIX_CONTAINER_H
diff --git a/ndn.cxx/detail/timeouts-policy.h b/ndn.cxx/detail/timeouts-policy.h
new file mode 100644
index 0000000..26d0c0f
--- /dev/null
+++ b/ndn.cxx/detail/timeouts-policy.h
@@ -0,0 +1,168 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU v3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_NDNCXX_DETAIL_TIMEOUTS_POLICY_H_
+#define NDN_NDNCXX_DETAIL_TIMEOUTS_POLICY_H_
+
+#include <boost/intrusive/options.hpp>
+#include <boost/intrusive/list.hpp>
+
+#include <ns3/nstime.h>
+#include <ns3/simulator.h>
+
+namespace ns3 {
+namespace ndn {
+namespace detail {
+
+/**
+ * @brief Traits for timeouts policy
+ */
+struct timeouts_policy_traits
+{
+ /// @brief Name that can be used to identify the policy (for NS-3 object model and logging)
+ static std::string GetName () { return "Timeouts"; }
+
+ struct policy_hook_type : public boost::intrusive::set_member_hook<> { Time timeWhenShouldExpire; };
+
+ template<class Container>
+ struct container_hook
+ {
+ typedef boost::intrusive::member_hook< Container,
+ policy_hook_type,
+ &Container::policy_hook_ > type;
+ };
+
+ template<class Base,
+ class Container,
+ class Hook>
+ struct policy
+ {
+ static Time& get_timeout (typename Container::iterator item)
+ {
+ return static_cast<typename policy_container::value_traits::hook_type*>
+ (policy_container::value_traits::to_node_ptr(*item))->timeWhenShouldExpire;
+ }
+
+ static const Time& get_timeout (typename Container::const_iterator item)
+ {
+ return static_cast<const typename policy_container::value_traits::hook_type*>
+ (policy_container::value_traits::to_node_ptr(*item))->timeWhenShouldExpire;
+ }
+
+ template<class Key>
+ struct MemberHookLess
+ {
+ bool operator () (const Key &a, const Key &b) const
+ {
+ return get_timeout (&a) < get_timeout (&b);
+ }
+ };
+
+ typedef boost::intrusive::multiset< Container,
+ boost::intrusive::compare< MemberHookLess< Container > >,
+ Hook > policy_container;
+
+
+ class type : public policy_container
+ {
+ public:
+ typedef policy policy_base; // to get access to get_timeout methods from outside
+ typedef Container parent_trie;
+
+ type (Base &base)
+ : m_base (base)
+ {
+ }
+
+ inline void
+ update (typename parent_trie::iterator item)
+ {
+ // do nothing
+ }
+
+ inline bool
+ insert (typename parent_trie::iterator item)
+ {
+ Time timeout = item->payload ()->GetInterest ()->GetInterestLifetime ();
+ if (timeout.IsZero ()) timeout = Seconds (4.0);
+
+ get_timeout (item) = Simulator::Now () + timeout;
+ policy_container::insert (*item);
+
+ if (policy_container::s_iterator_to (*item) == policy_container::begin ())
+ {
+ if (m_timeoutEvent.IsRunning ())
+ {
+ Simulator::Remove (m_timeoutEvent); // just canceling would not clean up list of events
+ }
+
+ m_timeoutEvent = Simulator::Schedule (timeout, &type::ProcessTimeoutEntry, this, item);
+ }
+
+ return true;
+ }
+
+ inline void
+ lookup (typename parent_trie::iterator item)
+ {
+ // do nothing. it's random policy
+ }
+
+ inline void
+ erase (typename parent_trie::iterator item)
+ {
+ if (policy_container::s_iterator_to (*item) == policy_container::begin ())
+ {
+ if (m_timeoutEvent.IsRunning ())
+ {
+ Simulator::Remove (m_timeoutEvent); // just canceling would not clean up list of events
+ }
+ }
+
+ // erase only if freshness is non zero (otherwise an item is not in the policy
+ policy_container::erase (policy_container::s_iterator_to (*item));
+
+ if (!policy_container::empty ())
+ {
+ Time timeout = get_timeout (&*policy_container::begin ()) - Simulator::Now ();
+ m_timeoutEvent = Simulator::Schedule (timeout, &type::ProcessTimeoutEntry, this, &*policy_container::begin ());
+ }
+ }
+
+ inline void
+ clear ()
+ {
+ policy_container::clear ();
+ }
+
+ inline void
+ ProcessTimeoutEntry (typename parent_trie::iterator item)
+ {
+ if (!item->payload ()->m_timeoutCallback.IsNull ())
+ item->payload ()->m_timeoutCallback (item->payload ()->GetInterest ());
+
+ m_base.erase (item);
+ }
+
+ private:
+ type () : m_base (*((Base*)0)) { };
+
+ private:
+ Base &m_base;
+ EventId m_timeoutEvent;
+ };
+ };
+};
+
+} // detail
+} // ndn
+} // ns3
+
+#endif // NDN_NDNCXX_DETAIL_TIMEOUTS_STATS_POLICY_H
diff --git a/ndn.cxx/detail/uri.h b/ndn.cxx/detail/uri.h
new file mode 100644
index 0000000..ae3844e
--- /dev/null
+++ b/ndn.cxx/detail/uri.h
@@ -0,0 +1,156 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_DETAIL_URI_H
+#define NDN_DETAIL_URI_H
+
+#include "ns3/ndn-common.h"
+
+#include "error.h"
+
+#include <boost/archive/iterators/transform_width.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace detail
+{
+
+static const bool ESCAPE_CHARACTER [256] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 26
+ 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 53
+ 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 107
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, // 134
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 161
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 188
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 215
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 242
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 255
+};
+
+/// @cond include_hidden
+template<class CharType>
+struct hex_from_4_bit
+{
+ typedef CharType result_type;
+ CharType operator () (CharType ch) const
+ {
+ const char lookup_table [16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+ // cout << "New character: " << (int) ch << " (" << (char) ch << ")" << "\n";
+ BOOST_ASSERT (ch < 16);
+ return lookup_table[static_cast<size_t>(ch)];
+ }
+};
+
+typedef boost::transform_iterator<hex_from_4_bit<std::string::const_iterator::value_type>,
+ boost::archive::iterators::transform_width<std::string::const_iterator, 4, 8, std::string::const_iterator::value_type> > string_from_binary;
+
+
+
+template<class CharType>
+struct hex_to_4_bit
+{
+ typedef CharType result_type;
+ CharType operator () (CharType ch) const
+ {
+ const signed char lookup_table [] = {
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1,
+ -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ };
+
+ signed char value = -1;
+ if ((unsigned)ch < 128)
+ value = lookup_table [(unsigned)ch];
+ if (value == -1)
+ boost::throw_exception (error::StringTransform ());
+
+ return value;
+ }
+};
+
+typedef boost::archive::iterators::transform_width<boost::transform_iterator<hex_to_4_bit<std::string::const_iterator::value_type>, std::string::const_iterator>, 8, 4> string_to_binary;
+/// @endcond
+
+} // detail
+
+/**
+ * @brief A helper class to convert to/from URI
+ */
+class Uri
+{
+public:
+ template<class Iterator1, class Iterator2>
+ inline static void
+ fromEscaped (Iterator1 begin, Iterator1 end, Iterator2 inserter)
+ {
+ Iterator1 i = begin;
+ while (i != end)
+ {
+ if (*i == '%')
+ {
+ try
+ {
+ ++i;
+ Iterator1 j = i;
+ advance (i, 2);
+
+ std::copy (detail::string_to_binary (j), detail::string_to_binary (i), inserter);
+ }
+ catch (ndn::error::StringTransform &e)
+ {
+ BOOST_THROW_EXCEPTION (error::Uri ()
+ << error::pos (std::distance (i, begin)));
+ }
+ }
+ else if (!detail::ESCAPE_CHARACTER[static_cast<unsigned char> (*i)])
+ {
+ *inserter = *i;
+ ++inserter; ++i;
+ }
+ else
+ {
+ BOOST_THROW_EXCEPTION (error::Uri ()
+ << error::pos (std::distance (i, begin)));
+ }
+ }
+ }
+
+ template<class Iterator1, class Iterator2>
+ inline static void
+ toEscaped (Iterator1 begin, Iterator1 end, Iterator2 inserter)
+ {
+ const char lookup_table [16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+
+ for (Iterator1 i = begin; i != end; i++)
+ {
+ if (detail::ESCAPE_CHARACTER[static_cast<unsigned char> (*i)])
+ {
+ *inserter = '%'; ++inserter;
+ *inserter = lookup_table [(*i >> 4) & 0x0F]; ++inserter;
+ *inserter = lookup_table [(*i & 0x0F)]; ++inserter;
+ }
+ else
+ {
+ *inserter = *i; ++inserter;
+ }
+ }
+ }
+};
+
+NDN_NAMESPACE_END
+
+#endif // NDN_DETAIL_URI_H
diff --git a/ndn.cxx/exclude.cc b/ndn.cxx/exclude.cc
new file mode 100644
index 0000000..f8137eb
--- /dev/null
+++ b/ndn.cxx/exclude.cc
@@ -0,0 +1,171 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "exclude.h"
+
+#include "detail/error.h"
+
+NDN_NAMESPACE_BEGIN
+
+Exclude::Exclude ()
+{
+}
+
+// example: ANY /b /d ANY /f
+//
+// ordered in map as:
+//
+// /f (false); /d (true); /b (false); / (true)
+//
+// lower_bound (/) -> / (true) <-- excluded (equal)
+// lower_bound (/a) -> / (true) <-- excluded (any)
+// lower_bound (/b) -> /b (false) <--- excluded (equal)
+// lower_bound (/c) -> /b (false) <--- not excluded (not equal and no ANY)
+// lower_bound (/d) -> /d (true) <- excluded
+// lower_bound (/e) -> /d (true) <- excluded
+bool
+Exclude::isExcluded (const name::Component &comp) const
+{
+ const_iterator lowerBound = m_exclude.lower_bound (comp);
+ if (lowerBound == end ())
+ return false;
+
+ if (lowerBound->second)
+ return true;
+ else
+ return lowerBound->first == comp;
+
+ return false;
+}
+
+Exclude &
+Exclude::excludeOne (const name::Component &comp)
+{
+ if (!isExcluded (comp))
+ {
+ m_exclude.insert (std::make_pair (comp, false));
+ }
+ return *this;
+}
+
+
+// example: ANY /b0 /d0 ANY /f0
+//
+// ordered in map as:
+//
+// /f0 (false); /d0 (true); /b0 (false); / (true)
+//
+// lower_bound (/) -> / (true) <-- excluded (equal)
+// lower_bound (/a0) -> / (true) <-- excluded (any)
+// lower_bound (/b0) -> /b0 (false) <--- excluded (equal)
+// lower_bound (/c0) -> /b0 (false) <--- not excluded (not equal and no ANY)
+// lower_bound (/d0) -> /d0 (true) <- excluded
+// lower_bound (/e0) -> /d0 (true) <- excluded
+
+
+// examples with desired outcomes
+// excludeRange (/, /f0) -> ANY /f0
+// /f0 (false); / (true)
+// excludeRange (/, /f1) -> ANY /f1
+// /f1 (false); / (true)
+// excludeRange (/a0, /e0) -> ANY /f0
+// /f0 (false); / (true)
+// excludeRange (/a0, /e0) -> ANY /f0
+// /f0 (false); / (true)
+
+// excludeRange (/b1, /c0) -> ANY /b0 /b1 ANY /c0 /d0 ANY /f0
+// /f0 (false); /d0 (true); /c0 (false); /b1 (true); /b0 (false); / (true)
+
+Exclude &
+Exclude::excludeRange (const name::Component &from, const name::Component &to)
+{
+ if (from >= to)
+ {
+ BOOST_THROW_EXCEPTION (error::Exclude ()
+ << error::msg ("Invalid exclude range (for single name exclude use Exclude::excludeOne)")
+ << error::msg (from.toUri ())
+ << error::msg (to.toUri ()));
+ }
+
+ iterator newFrom = m_exclude.lower_bound (from);
+ if (newFrom == end () || !newFrom->second /*without ANY*/)
+ {
+ std::pair<iterator, bool> fromResult = m_exclude.insert (std::make_pair (from, true));
+ newFrom = fromResult.first;
+ if (!fromResult.second)
+ {
+ // this means that the lower bound is equal to the item itself. So, just update ANY flag
+ newFrom->second = true;
+ }
+ }
+ // else
+ // nothing special if start of the range already exists with ANY flag set
+
+ iterator newTo = m_exclude.lower_bound (to); // !newTo cannot be end ()
+ if (newTo == newFrom || !newTo->second)
+ {
+ std::pair<iterator, bool> toResult = m_exclude.insert (std::make_pair (to, false));
+ newTo = toResult.first;
+ ++ newTo;
+ }
+ else
+ {
+ // nothing to do really
+ }
+
+ m_exclude.erase (newTo, newFrom); // remove any intermediate node, since all of the are excluded
+
+ return *this;
+}
+
+Exclude &
+Exclude::excludeAfter (const name::Component &from)
+{
+ iterator newFrom = m_exclude.lower_bound (from);
+ if (newFrom == end () || !newFrom->second /*without ANY*/)
+ {
+ std::pair<iterator, bool> fromResult = m_exclude.insert (std::make_pair (from, true));
+ newFrom = fromResult.first;
+ if (!fromResult.second)
+ {
+ // this means that the lower bound is equal to the item itself. So, just update ANY flag
+ newFrom->second = true;
+ }
+ }
+ // else
+ // nothing special if start of the range already exists with ANY flag set
+
+ if (newFrom != m_exclude.begin ())
+ {
+ m_exclude.erase (m_exclude.begin (), newFrom); // remove any intermediate node, since all of the are excluded
+ }
+
+ return *this;
+}
+
+void
+Exclude::appendExclude (const name::Component &name, bool any)
+{
+ m_exclude.insert (std::make_pair (name, any));
+}
+
+std::ostream&
+operator << (std::ostream &os, const Exclude &exclude)
+{
+ for (Exclude::const_reverse_iterator i = exclude.rbegin (); i != exclude.rend (); i++)
+ {
+ os << i->first.toUri () << " ";
+ if (i->second)
+ os << "----> ";
+ }
+ return os;
+}
+
+NDN_NAMESPACE_END
diff --git a/ndn.cxx/exclude.h b/ndn.cxx/exclude.h
new file mode 100644
index 0000000..8315f34
--- /dev/null
+++ b/ndn.cxx/exclude.h
@@ -0,0 +1,172 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_EXCLUDE_H
+#define NDN_EXCLUDE_H
+
+#include <ns3/simple-ref-count.h>
+
+#include "name-component.h"
+#include <map>
+
+NDN_NAMESPACE_BEGIN
+
+/**
+ * @brief Class to represent Exclude component in NDN interests
+ */
+class Exclude : public SimpleRefCount<Exclude>
+{
+public:
+ typedef std::map< name::Component, bool /*any*/, std::greater<name::Component> > exclude_type;
+
+ typedef exclude_type::iterator iterator;
+ typedef exclude_type::const_iterator const_iterator;
+ typedef exclude_type::reverse_iterator reverse_iterator;
+ typedef exclude_type::const_reverse_iterator const_reverse_iterator;
+
+ /**
+ * @brief Default constructor an empty exclude
+ */
+ Exclude ();
+
+ // no need for explicit copy constructor
+
+ /**
+ * @brief Check if name component is excluded
+ * @param comp Name component to check against exclude filter
+ */
+ bool
+ isExcluded (const name::Component &comp) const;
+
+ /**
+ * @brief Exclude specific name component
+ * @param comp component to exclude
+ * @returns *this to allow chaining
+ */
+ Exclude &
+ excludeOne (const name::Component &comp);
+
+ /**
+ * @brief Exclude components from range [from, to]
+ * @param from first element of the range
+ * @param to last element of the range
+ * @returns *this to allow chaining
+ */
+ Exclude &
+ excludeRange (const name::Component &from, const name::Component &to);
+
+ /**
+ * @brief Exclude all components from range [/, to]
+ * @param to last element of the range
+ * @returns *this to allow chaining
+ */
+ inline Exclude &
+ excludeBefore (const name::Component &to);
+
+ /**
+ * @brief Exclude all components from range [from, +Inf]
+ * @param to last element of the range
+ * @returns *this to allow chaining
+ */
+ Exclude &
+ excludeAfter (const name::Component &from);
+
+ /**
+ * @brief Method to directly append exclude element
+ * @param name excluded name component
+ * @param any flag indicating if there is a postfix ANY component after the name
+ *
+ * This method is used during conversion from wire format of exclude filter
+ *
+ * If there is an error with ranges (e.g., order of components is wrong) an exception is thrown
+ */
+ void
+ appendExclude (const name::Component &name, bool any);
+
+ /**
+ * @brief Get number of exclude terms
+ */
+ inline size_t
+ size () const;
+
+ /**
+ * @brief Get begin iterator of the exclude terms
+ */
+ inline const_iterator
+ begin () const;
+
+ /**
+ * @brief Get end iterator of the exclude terms
+ */
+ inline const_iterator
+ end () const;
+
+ /**
+ * @brief Get begin iterator of the exclude terms
+ */
+ inline const_reverse_iterator
+ rbegin () const;
+
+ /**
+ * @brief Get end iterator of the exclude terms
+ */
+ inline const_reverse_iterator
+ rend () const;
+
+private:
+ Exclude &
+ excludeRange (iterator fromLowerBound, iterator toLowerBound);
+
+private:
+ exclude_type m_exclude;
+};
+
+std::ostream&
+operator << (std::ostream &os, const Exclude &name);
+
+inline Exclude &
+Exclude::excludeBefore (const name::Component &to)
+{
+ return excludeRange (name::Component (), to);
+}
+
+inline size_t
+Exclude::size () const
+{
+ return m_exclude.size ();
+}
+
+inline Exclude::const_iterator
+Exclude::begin () const
+{
+ return m_exclude.begin ();
+}
+
+inline Exclude::const_iterator
+Exclude::end () const
+{
+ return m_exclude.end ();
+}
+
+inline Exclude::const_reverse_iterator
+Exclude::rbegin () const
+{
+ return m_exclude.rbegin ();
+}
+
+inline Exclude::const_reverse_iterator
+Exclude::rend () const
+{
+ return m_exclude.rend ();
+}
+
+NDN_NAMESPACE_END
+
+#endif // NDN_EXCLUDE_H
diff --git a/ndn.cxx/name-component.cc b/ndn.cxx/name-component.cc
new file mode 100644
index 0000000..084d6be
--- /dev/null
+++ b/ndn.cxx/name-component.cc
@@ -0,0 +1,180 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "name-component.h"
+
+#include "detail/error.h"
+#include "detail/uri.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace name {
+
+Component::Component ()
+{
+}
+
+Component::Component (const std::string &uri)
+{
+ copy (uri.begin (), uri.end (), std::back_inserter (*this));
+}
+
+Component::Component (std::string::const_iterator begin, std::string::const_iterator end)
+{
+ copy (begin, end, std::back_inserter (*this));
+}
+
+Component::Component (const void *buf, size_t length)
+{
+ copy (static_cast<const char*> (buf),
+ static_cast<const char*> (buf)+length,
+ std::back_inserter (*this));
+}
+
+Component &
+Component::fromUri (const std::string &uri)
+{
+ try
+ {
+ Uri::fromEscaped (uri.begin (), uri.end (), std::back_inserter (*this));
+ }
+ catch (error::Uri &err)
+ {
+ // re-throwing different exception
+ BOOST_THROW_EXCEPTION (error::name::Component ()
+ << error::msg (uri)
+ << error::pos (error::get_pos (err)));
+ }
+
+ return *this;
+}
+
+Component &
+Component::fromUri (std::string::const_iterator begin, std::string::const_iterator end)
+{
+ try
+ {
+ Uri::fromEscaped (begin, end, std::back_inserter (*this));
+ }
+ catch (error::Uri &err)
+ {
+ // re-throwing different exception
+ BOOST_THROW_EXCEPTION (error::name::Component ()
+ << error::msg (std::string (begin, end))
+ << error::pos (error::get_pos (err)));
+ }
+ return *this;
+}
+
+int
+Component::compare (const Component &other) const
+{
+ if (size () < other.size ())
+ return -1;
+
+ if (size () > other.size ())
+ return +1;
+
+ // now we know that sizes are equal
+
+ std::pair<const_iterator, const_iterator> diff = mismatch (begin (), end (), other.begin ());
+ if (diff.first == end ()) // components are actually equal
+ return 0;
+
+ return (std::lexicographical_compare (diff.first, end (), diff.second, other.end ())) ? -1 : +1;
+}
+
+Component &
+Component::fromNumber (uint64_t number)
+{
+ while (number > 0)
+ {
+ this->push_back (static_cast<unsigned char> (number & 0xFF));
+ number >>= 8;
+ }
+ std::reverse (this->begin (), this->end ());
+ return *this;
+}
+
+Component &
+Component::fromNumberWithMarker (uint64_t number, unsigned char marker)
+{
+ this->push_back (marker);
+
+ while (number > 0)
+ {
+ this->push_back (static_cast<unsigned char> (number & 0xFF));
+ number >>= 8;
+ }
+
+ std::reverse (this->begin () + 1, this->end ());
+ return *this;
+}
+
+std::string
+Component::toBlob () const
+{
+ return std::string (begin (), end ());
+}
+
+void
+Component::toBlob (std::ostream &os) const
+{
+ os.write (buf (), size ());
+}
+
+std::string
+Component::toUri () const
+{
+ std::ostringstream os;
+ toUri (os);
+ return os.str ();
+}
+
+void
+Component::toUri (std::ostream &os) const
+{
+ Uri::toEscaped (begin (), end (), std::ostream_iterator<char> (os));
+}
+
+uint64_t
+Component::toNumber () const
+{
+ uint64_t ret = 0;
+ for (const_iterator i = begin (); i != end (); i++)
+ {
+ ret <<= 8;
+ ret |= static_cast<unsigned char> (*i);
+ }
+ return ret;
+}
+
+uint64_t
+Component::toNumberWithMarker (unsigned char marker) const
+{
+ if (empty () ||
+ static_cast<unsigned char> (*(begin ())) != marker)
+ {
+ BOOST_THROW_EXCEPTION (error::name::Component ()
+ << error::msg ("Name component does not have required marker [" + toUri () + "]"));
+ }
+
+ uint64_t ret = 0;
+ for (const_iterator i = begin () + 1; i != end (); i++)
+ {
+ ret <<= 8;
+ ret |= static_cast<unsigned char> (*i);
+ }
+ return ret;
+}
+
+} // name
+
+NDN_NAMESPACE_END
diff --git a/ndn.cxx/name-component.h b/ndn.cxx/name-component.h
new file mode 100644
index 0000000..7f523e0
--- /dev/null
+++ b/ndn.cxx/name-component.h
@@ -0,0 +1,300 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_NAME_COMPONENT_H
+#define NDN_NAME_COMPONENT_H
+
+#include "blob.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace name {
+
+/**
+ * @brief Class to representing binary blob of NDN name component
+ *
+ * This class is based on Blob (std::vector<char>) and just provides several helpers
+ * to work with name components, as well as operator to apply canonical
+ * ordering on name components
+ */
+class Component : public Blob
+{
+public:
+ /**
+ * @brief Default constructor an empty exclude
+ */
+ Component ();
+
+ /**
+ * @brief Create component from URI encoded string
+ * @param uri URI encoded name component (convert escaped with % characters)
+ */
+ Component (const std::string &uri);
+
+ /**
+ * @brief Create component from URI encoded string, with string specified by a pair of iterators
+ * @param begin begin iterator pointing to the URI encoded name
+ * @param end end iterator
+ */
+ Component (std::string::const_iterator begin, std::string::const_iterator end);
+
+ /**
+ * @brief Create component using a binary blob
+ * @param buf pointer to first byte of binary blob to store as a name component
+ * @param length length of the binary blob
+ */
+ Component (const void *buf, size_t length);
+
+ /**
+ * @brief Apply canonical ordering on component comparison
+ * @return 0 They compare equal
+ * <0 If *this comes before other in the canonical ordering
+ * >0 If *this comes after in the canonical ordering
+ *
+ * @see http://www.ccnx.org/releases/latest/doc/technical/CanonicalOrder.html
+ */
+ int
+ compare (const Component &other) const;
+
+ /**
+ * @brief Apply canonical ordering on component comparison (less or equal)
+ *
+ * @see http://www.ccnx.org/releases/latest/doc/technical/CanonicalOrder.html
+ */
+ inline bool
+ operator <= (const Component &other) const;
+
+ /**
+ * @brief Apply canonical ordering on component comparison (less)
+ *
+ * @see http://www.ccnx.org/releases/latest/doc/technical/CanonicalOrder.html
+ */
+ inline bool
+ operator < (const Component &other) const;
+
+ /**
+ * @brief Apply canonical ordering on component comparison (greater or equal)
+ *
+ * @see http://www.ccnx.org/releases/latest/doc/technical/CanonicalOrder.html
+ */
+ inline bool
+ operator >= (const Component &other) const;
+
+ /**
+ * @brief Apply canonical ordering on component comparison (greater)
+ *
+ * @see http://www.ccnx.org/releases/latest/doc/technical/CanonicalOrder.html
+ */
+ inline bool
+ operator > (const Component &other) const;
+
+ ////////////////////////////////////
+ // Component construction helpers //
+ ////////////////////////////////////
+
+ /**
+ * @brief Create component from URI encoded string
+ * @param uri URI encoded name component (convert escaped with % characters)
+ * @return *this
+ */
+ Component &
+ fromUri (const std::string &uri);
+
+ /**
+ * @brief Create component from URI encoded string, with string specified by a pair of iterators
+ * @param begin begin iterator pointing to the URI encoded name
+ * @param end end iterator
+ * @return *this
+ */
+ Component &
+ fromUri (std::string::const_iterator begin, std::string::const_iterator end);
+
+ /**
+ * @brief Create network-ordered numeric component
+ *
+ * @param number number to be encoded and added as a component
+ * @return *this
+ *
+ * Number is encoded and added in network order. Tail zero-bytes are not included.
+ * For example, if the number is 1, then 1-byte binary blob will be added 0x01.
+ * If the number is 256, then 2 binary blob will be added: 0x01 0x01
+ *
+ * If the number is zero, an empty component will be created
+ */
+ Component &
+ fromNumber (uint64_t number);
+
+ /**
+ * @brief Create network-ordered numeric component to the name with marker
+ *
+ * @param number number to be encoded and added as a component
+ * @param marker byte marker, specified by the desired naming convention
+ *
+ * Currently defined naming conventions of the marker:
+ * - 0x00 sequence number
+ * - 0xC1 control number
+ * - 0xFB block id
+ * - 0xFD version number
+ *
+ * This version is almost exactly as appendNumber, with exception that it adds initial marker.
+ * The number is formatted in the exactly the same way.
+ *
+ * @see fromNumber
+ */
+ Component &
+ fromNumberWithMarker (uint64_t number, unsigned char marker);
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // helpers
+ //////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @brief Convert binary blob name component to std::string (no conversion is made)
+ * @param comp name component to be converted
+ * @see asUriString
+ */
+ std::string
+ toBlob () const;
+
+ /**
+ * @brief Write blob of the name component to the specified output stream
+ * @param os output stream
+ */
+ void
+ toBlob (std::ostream &os) const;
+
+ /**
+ * @brief Convert binary blob name component to std::string, escaping all non-printable characters in URI format
+ * @param comp name component to be converted
+ * @see asString
+ */
+ std::string
+ toUri () const;
+
+ /**
+ * @brief Write name as URI to the specified output stream
+ * @param os output stream
+ */
+ void
+ toUri (std::ostream &os) const;
+
+ /**
+ * @brief Convert binary blob name component (network-ordered number) to number
+ * @param comp name component to be converted
+ */
+ uint64_t
+ toNumber () const;
+
+ /**
+ * @brief Convert binary blob name component (network-ordered number) to number, using appropriate marker from the naming convention
+ * @param comp name component to be converted
+ * @param marker required marker from the naming convention
+ *
+ * If the required marker does not exist, an exception will be thrown
+ */
+ uint64_t
+ toNumberWithMarker (unsigned char marker) const;
+
+ /**
+ * @brief Convert binary blob name component, assuming sequence number naming convention (marker = 0x00)
+ * @param comp name component to be converted
+ * @see asNumberWithMarker
+ */
+ inline uint64_t
+ toSeqNum () const;
+
+ /**
+ * @brief Convert binary blob name component, assuming control number naming convention (marker = 0xC1)
+ * @param comp name component to be converted
+ * @see asNumberWithMarker
+ */
+ inline uint64_t
+ toControlNum () const;
+
+ /**
+ * @brief Convert binary blob name component, assuming block ID naming convention (marker = 0xFB)
+ * @param comp name component to be converted
+ * @see asNumberWithMarker
+ */
+ inline uint64_t
+ toBlkId () const;
+
+ /**
+ * @brief Convert binary blob name component, assuming time-stamping version naming convention (marker = 0xFD)
+ * @param comp name component to be converted
+ * @see asNumberWithMarker
+ */
+ inline uint64_t
+ toVersion () const;
+};
+
+bool
+Component::operator <= (const Component &other) const
+{
+ return (compare (other) <= 0);
+}
+
+bool
+Component::operator < (const Component &other) const
+{
+ return (compare (other) < 0);
+}
+
+bool
+Component::operator >= (const Component &other) const
+{
+ return (compare (other) >= 0);
+}
+
+bool
+Component::operator > (const Component &other) const
+{
+ return (compare (other) > 0);
+}
+
+inline uint64_t
+Component::toSeqNum () const
+{
+ return toNumberWithMarker (0x00);
+}
+
+inline uint64_t
+Component::toControlNum () const
+{
+ return toNumberWithMarker (0xC1);
+}
+
+inline uint64_t
+Component::toBlkId () const
+{
+ return toNumberWithMarker (0xFB);
+}
+
+inline uint64_t
+Component::toVersion () const
+{
+ return toNumberWithMarker (0xFD);
+}
+
+/**
+ * @brief Stream output operator (output in escaped URI format)
+ */
+inline std::ostream&
+operator <<(std::ostream &os, const Component &name)
+{
+ name.toUri (os);
+ return os;
+}
+
+} // name
+
+NDN_NAMESPACE_END
+
+#endif // NDN_NAME_COMPONENT_H
diff --git a/ndn.cxx/name.cc b/ndn.cxx/name.cc
new file mode 100644
index 0000000..c0a1a57
--- /dev/null
+++ b/ndn.cxx/name.cc
@@ -0,0 +1,273 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ * Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ */
+
+#include "name.h"
+
+#include "detail/error.h"
+#include <boost/algorithm/string.hpp>
+
+#include <ctype.h>
+
+using namespace std;
+
+NDN_NAMESPACE_BEGIN
+
+ATTRIBUTE_HELPER_CPP (Name);
+
+///////////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS //
+///////////////////////////////////////////////////////////////////////////////
+
+Name::Name ()
+{
+}
+
+Name::Name (const string &uri)
+{
+ string::const_iterator i = uri.begin ();
+ string::const_iterator end = uri.end ();
+
+ string::const_iterator firstSlash = std::find (i, end, '/');
+ if (firstSlash == end)
+ {
+ BOOST_THROW_EXCEPTION (error::Name ()
+ << error::msg ("Name should include at least one slash (did you forget to specify initial /?)"));
+ }
+
+ if (firstSlash != i)
+ {
+ string schema (i, firstSlash);
+ if (*schema.rbegin () != ':')
+ {
+ BOOST_THROW_EXCEPTION (error::Name ()
+ << error::msg ("First component of the name does not start with a slash (did you forget to specify initial /?)"));
+ }
+
+ i = firstSlash;
+
+ if (!boost::iequals (schema, "ccnx:") &&
+ !boost::iequals (schema, "ndn:"))
+ {
+ BOOST_THROW_EXCEPTION (error::Name ()
+ << error::msg ("URI schema is not supported (only ccnx: or ndn: is allowed)")
+ << error::msg (schema));
+ }
+ }
+
+ string::const_iterator secondSlash = i;
+ secondSlash ++;
+ if (secondSlash != end && *secondSlash == '/')
+ {
+ // The authority component (the part after the initial "//" in the familiar http and ftp URI schemes) is present,
+ // but it is not relevant to NDN name.
+ // skipping it
+ secondSlash ++;
+ i = std::find (secondSlash, end, '/');
+ }
+
+ if (i == end)
+ {
+ BOOST_THROW_EXCEPTION (error::Name ()
+ << error::msg ("Invalid URI")
+ << error::msg (uri));
+ }
+
+ while (i != end)
+ {
+ // skip any extra slashes
+ while (i != end && *i == '/')
+ {
+ i ++;
+ }
+ if (i == end)
+ break;
+
+ string::const_iterator endOfComponent = std::find (i, end, '/');
+ name::Component comp;
+ appendBySwap (comp.fromUri (i, endOfComponent));
+
+ i = endOfComponent;
+ }
+}
+
+Name::Name (const Name &other)
+{
+ m_comps = other.m_comps;
+}
+
+Name &
+Name::operator= (const Name &other)
+{
+ m_comps = other.m_comps;
+ return *this;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// SETTERS //
+///////////////////////////////////////////////////////////////////////////////
+
+Name &
+Name::appendVersion (uint64_t version/* = Name::nversion*/)
+{
+ if (version != Name::nversion)
+ return appendNumberWithMarker (version, 0xFD);
+ else
+ {
+ TimeInterval now = time::NowUnixTimestamp ();
+#ifdef NDNSIM_MODE
+ int64_t seconds = now.GetSeconds ();
+ int64_t microseconds = now.GetMicroSeconds () - seconds * 1000000;
+
+ version = (seconds << 12) | (0xFFF & (microseconds / 244 /*( 1000,000 microseconds / 4096.0 resolution = last 12 bits)*/));
+#else
+ version = (now.total_seconds () << 12) | (0xFFF & (now.fractional_seconds () / 244 /*( 1000,000 microseconds / 4096.0 resolution = last 12 bits)*/));
+#endif
+ return appendNumberWithMarker (version, 0xFD);
+ }
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// GETTERS //
+///////////////////////////////////////////////////////////////////////////////
+
+const name::Component &
+Name::get (int index) const
+{
+ if (index < 0)
+ {
+ index = size () - (-index);
+ }
+
+ if (static_cast<unsigned int> (index) >= size ())
+ {
+ BOOST_THROW_EXCEPTION (error::Name ()
+ << error::msg ("Index out of range")
+ << error::pos (index));
+ }
+ return m_comps [index];
+}
+
+name::Component &
+Name::get (int index)
+{
+ if (index < 0)
+ {
+ index = size () - (-index);
+ }
+
+ if (static_cast<unsigned int> (index) >= size())
+ {
+ BOOST_THROW_EXCEPTION (error::Name ()
+ << error::msg ("Index out of range")
+ << error::pos (index));
+ }
+ return m_comps [index];
+}
+
+
+/////
+///// Static helpers to convert name component to appropriate value
+/////
+
+
+Name
+Name::getSubName (size_t pos/* = 0*/, size_t len/* = Name::npos*/) const
+{
+ Name retval;
+
+ if (len == npos)
+ {
+ len = size () - pos;
+ }
+
+ if (pos + len > size ())
+ {
+ BOOST_THROW_EXCEPTION (error::Name ()
+ << error::msg ("getSubName parameter out of range")
+ << error::pos (pos)
+ << error::pos (len));
+ }
+
+ for (size_t i = pos; i < pos + len; i++)
+ {
+ retval.append (get (i));
+ }
+
+ return retval;
+}
+
+Name
+Name::operator+ (const Name &name) const
+{
+ Name newName;
+ newName
+ .append (*this)
+ .append (name);
+
+ return newName;
+}
+
+std::string
+Name::toUri () const
+{
+ ostringstream os;
+ toUri (os);
+ return os.str ();
+}
+
+void
+Name::toUri (std::ostream &os) const
+{
+ for (Name::const_iterator comp = begin (); comp != end (); comp++)
+ {
+ os << "/";
+ comp->toUri (os);
+ }
+ if (size () == 0)
+ os << "/";
+}
+
+// ostream &
+// operator << (ostream &os, const Name &name)
+// {
+// for (Name::const_iterator comp = name.begin (); comp != name.end (); comp++)
+// {
+// os << "/" << *comp;
+// }
+// if (name.size () == 0)
+// os << "/";
+// return os;
+// }
+
+int
+Name::compare (const Name &name) const
+{
+ Name::const_iterator i = this->begin ();
+ Name::const_iterator j = name.begin ();
+
+ for (; i != this->end () && j != name.end (); i++, j++)
+ {
+ int res = i->compare (*j);
+ if (res == 0)
+ continue;
+ else
+ return res;
+ }
+
+ if (i == this->end () && j == name.end ())
+ return 0; // prefixes are equal
+
+ return (i == this->end ()) ? -1 : +1;
+}
+
+NDN_NAMESPACE_END
diff --git a/ndn.cxx/name.h b/ndn.cxx/name.h
new file mode 100644
index 0000000..8731323
--- /dev/null
+++ b/ndn.cxx/name.h
@@ -0,0 +1,648 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ * Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ */
+
+#ifndef NDN_NAME_H
+#define NDN_NAME_H
+
+#include "ns3/ndn-common.h"
+#include "ns3/simple-ref-count.h"
+#include "ns3/attribute.h"
+#include "ns3/attribute-helper.h"
+
+#include "name-component.h"
+
+NDN_NAMESPACE_BEGIN
+
+/**
+ * @brief Class for NDN Name
+ */
+class Name : public SimpleRefCount<Name>
+{
+public:
+ typedef std::vector<name::Component>::iterator iterator;
+ typedef std::vector<name::Component>::const_iterator const_iterator;
+ typedef std::vector<name::Component>::reverse_iterator reverse_iterator;
+ typedef std::vector<name::Component>::const_reverse_iterator const_reverse_iterator;
+ typedef std::vector<name::Component>::reference reference;
+ typedef std::vector<name::Component>::const_reference const_reference;
+
+ typedef name::Component partial_type;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS //
+ ///////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @brief Default constructor to create an empty name (zero components, or "/")
+ */
+ Name ();
+
+ /**
+ * @brief Copy constructor
+ *
+ * @param other reference to a NDN name object
+ */
+ Name (const Name &other);
+
+ /**
+ * @brief Create a name from URL string
+ *
+ * @param url URI-represented name
+ */
+ Name (const std::string &url);
+
+ /**
+ * @brief Create a name from a container of elements [begin, end)
+ *
+ * @param begin begin iterator of the container
+ * @param end end iterator of the container
+ */
+ template<class Iterator>
+ Name (Iterator begin, Iterator end);
+
+ /**
+ * @brief Assignment operator
+ */
+ Name &
+ operator= (const Name &other);
+
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // SETTERS //
+ ///////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @brief Append a binary blob as a name component
+ *
+ * @param comp a binary blob
+ * @returns reference to self (to allow chaining of append methods)
+ */
+ inline Name &
+ append (const name::Component &comp);
+
+ /**
+ * @brief Append a binary blob as a name component
+ * @param comp a binary blob
+ *
+ * This version is a little bit more efficient, since it swaps contents of comp and newly added component
+ *
+ * Attention!!! This method has an intended side effect: content of comp becomes empty
+ */
+ inline Name &
+ appendBySwap (name::Component &comp);
+
+ /**
+ * @brief Append components a container of elements [begin, end)
+ *
+ * @param begin begin iterator of the container
+ * @param end end iterator of the container
+ * @returns reference to self (to allow chaining of append methods)
+ */
+ template<class Iterator>
+ inline Name &
+ append (Iterator begin, Iterator end);
+
+ /**
+ * @brief Append components from another ndn::Name object
+ *
+ * @param comp reference to Name object
+ * @returns reference to self (to allow chaining of append methods)
+ */
+ inline Name &
+ append (const Name &comp);
+
+ /**
+ * @brief Append a string as a name component
+ *
+ * @param compStr a string
+ * @returns reference to self (to allow chaining of append methods)
+ *
+ * No conversions will be done to the string. The string is included in raw form,
+ * without any leading '\0' symbols.
+ */
+ inline Name &
+ append (const std::string &compStr);
+
+ /**
+ * @brief Append a binary blob as a name component
+ *
+ * @param buf pointer to the first byte of the binary blob
+ * @param size length of the binary blob
+ * @returns reference to self (to allow chaining of append methods)
+ */
+ inline Name &
+ append (const void *buf, size_t size);
+
+ /**
+ * @brief Append network-ordered numeric component to the name
+ *
+ * @param number number to be encoded and added as a component
+ *
+ * Number is encoded and added in network order. Tail zero-bytes are not included.
+ * For example, if the number is 1, then 1-byte binary blob will be added 0x01.
+ * If the number is 256, then 2 binary blob will be added: 0x01 0x01
+ *
+ * If the number is zero, an empty component will be added
+ */
+ inline Name &
+ appendNumber (uint64_t number);
+
+ /**
+ * @brief Append network-ordered numeric component to the name with marker
+ *
+ * @param number number to be encoded and added as a component
+ * @param marker byte marker, specified by the desired naming convention
+ *
+ * Currently defined naming conventions of the marker:
+ * - 0x00 sequence number
+ * - 0xC1 control number
+ * - 0xFB block id
+ * - 0xFD version number
+ *
+ * This version is almost exactly as appendNumber, with exception that it adds initial marker.
+ * The number is formatted in the exactly the same way.
+ *
+ * @see appendNumber
+ */
+ inline Name &
+ appendNumberWithMarker (uint64_t number, unsigned char marker);
+
+ /**
+ * @brief Helper method to add sequence number to the name (marker = 0x00)
+ * @param seqno sequence number
+ * @see appendNumberWithMarker
+ */
+ inline Name &
+ appendSeqNum (uint64_t seqno);
+
+ /**
+ * @brief Helper method to add control number to the name (marker = 0xC1)
+ * @param control control number
+ * @see appendNumberWithMarker
+ */
+ inline Name &
+ appendControlNum (uint64_t control);
+
+ /**
+ * @brief Helper method to add block ID to the name (marker = 0xFB)
+ * @param blkid block ID
+ * @see appendNumberWithMarker
+ */
+ inline Name &
+ appendBlkId (uint64_t blkid);
+
+ /**
+ * @brief Helper method to add version to the name (marker = 0xFD)
+ * @param version fully formatted version in a desired format (e.g., timestamp).
+ * If version is Name::nversion, then the version number is automatically
+ * assigned based on UTC timestamp
+ * @see appendNumberWithMarker
+ */
+ Name &
+ appendVersion (uint64_t version = Name::nversion);
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // GETTERS //
+ ///////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @brief Get number of the name components
+ * @return number of name components
+ */
+ inline size_t
+ size () const;
+
+ /**
+ * @brief Get binary blob of name component
+ * @param index index of the name component. If less than 0, then getting component from the back:
+ * get(-1) getting the last component, get(-2) is getting second component from back, etc.
+ * @returns const reference to binary blob of the requested name component
+ *
+ * If index is out of range, an exception will be thrown
+ */
+ const name::Component &
+ get (int index) const;
+
+ /**
+ * @brief Get binary blob of name component
+ * @param index index of the name component. If less than 0, then getting component from the back
+ * @returns reference to binary blob of the requested name component
+ *
+ * If index is out of range, an exception will be thrown
+ */
+ name::Component &
+ get (int index);
+
+ /////
+ ///// Iterator interface to name components
+ /////
+ inline Name::const_iterator
+ begin () const; ///< @brief Begin iterator (const)
+
+ inline Name::iterator
+ begin (); ///< @brief Begin iterator
+
+ inline Name::const_iterator
+ end () const; ///< @brief End iterator (const)
+
+ inline Name::iterator
+ end (); ///< @brief End iterator
+
+ inline Name::const_reverse_iterator
+ rbegin () const; ///< @brief Reverse begin iterator (const)
+
+ inline Name::reverse_iterator
+ rbegin (); ///< @brief Reverse begin iterator
+
+ inline Name::const_reverse_iterator
+ rend () const; ///< @brief Reverse end iterator (const)
+
+ inline Name::reverse_iterator
+ rend (); ///< @brief Reverse end iterator
+
+
+ /////
+ ///// Static helpers to convert name component to appropriate value
+ /////
+
+ /**
+ * @brief Get a new name, constructed as a subset of components
+ * @param pos Position of the first component to be copied to the subname
+ * @param len Number of components to be copied. Value Name::npos indicates that all components till the end of the name.
+ */
+ Name
+ getSubName (size_t pos = 0, size_t len = npos) const;
+
+ /**
+ * @brief Get prefix of the name
+ * @param len length of the prefix
+ * @param skip number of components to skip from beginning of the name
+ */
+ inline Name
+ getPrefix (size_t len, size_t skip = 0) const;
+
+ /**
+ * @brief Get postfix of the name
+ * @param len length of the postfix
+ * @param skip number of components to skip from end of the name
+ */
+ inline Name
+ getPostfix (size_t len, size_t skip = 0) const;
+
+ /**
+ * @brief Get text representation of the name (URI)
+ */
+ std::string
+ toUri () const;
+
+ /**
+ * @brief Write name as URI to the specified output stream
+ * @param os output stream
+ */
+ void
+ toUri (std::ostream &os) const;
+
+ /////////////////////////////////////////////////
+ // Helpers and compatibility wrappers
+ /////////////////////////////////////////////////
+
+ /**
+ * @brief Compare two names, using canonical ordering for each component
+ * @return 0 They compare equal
+ * <0 If *this comes before other in the canonical ordering
+ * >0 If *this comes after in the canonical ordering
+ */
+ int
+ compare (const Name &name) const;
+
+ /**
+ * @brief Check if to Name objects are equal (have the same number of components with the same binary data)
+ */
+ inline bool
+ operator == (const Name &name) const;
+
+ /**
+ * @brief Check if two Name objects are not equal
+ */
+ inline bool
+ operator != (const Name &name) const;
+
+ /**
+ * @brief Less or equal comparison of two name objects
+ */
+ inline bool
+ operator <= (const Name &name) const;
+
+ /**
+ * @brief Less comparison of two name objects
+ */
+ inline bool
+ operator < (const Name &name) const;
+
+ /**
+ * @brief Great or equal comparison of two name objects
+ */
+ inline bool
+ operator >= (const Name &name) const;
+
+ /**
+ * @brief Great comparison of two name objects
+ */
+ inline bool
+ operator > (const Name &name) const;
+
+ /**
+ * @brief Operator [] to simplify access to name components
+ * @see get
+ */
+ inline name::Component &
+ operator [] (int index);
+
+ /**
+ * @brief Operator [] to simplify access to name components
+ * @see get
+ */
+ inline const name::Component &
+ operator [] (int index) const;
+
+ /**
+ * @brief Create a new Name object, by copying components from first and second name
+ */
+ Name
+ operator + (const Name &name) const;
+
+ /**
+ * @brief A wrapper for append method
+ */
+ template<class T>
+ inline void
+ push_back (const T &comp);
+
+public:
+ // Data Members (public):
+ /// Value returned by various member functions when they fail.
+ const static size_t npos = static_cast<size_t> (-1);
+ const static uint64_t nversion = static_cast<uint64_t> (-1);
+
+private:
+ std::vector<name::Component> m_comps;
+};
+
+inline std::ostream &
+operator << (std::ostream &os, const Name &name)
+{
+ name.toUri (os);
+ return os;
+}
+
+inline std::istream &
+operator >> (std::istream &is, Name &name)
+{
+ std::string line;
+ is >> line;
+ name = Name (line);
+
+ return is;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+// Definition of inline methods
+/////////////////////////////////////////////////////////////////////////////////////
+
+template<class Iterator>
+Name::Name (Iterator begin, Iterator end)
+{
+ append (begin, end);
+}
+
+inline Name &
+Name::append (const name::Component &comp)
+{
+ if (comp.size () != 0)
+ m_comps.push_back (comp);
+ return *this;
+}
+
+inline Name &
+Name::appendBySwap (name::Component &comp)
+{
+ if (comp.size () != 0)
+ {
+ Name::iterator newComp = m_comps.insert (end (), name::Component ());
+ newComp->swap (comp);
+ }
+ return *this;
+}
+
+template<class Iterator>
+inline Name &
+Name::append (Iterator begin, Iterator end)
+{
+ for (Iterator i = begin; i != end; i++)
+ {
+ append (*i);
+ }
+ return *this;
+}
+
+Name &
+Name::append (const Name &comp)
+{
+ if (this == &comp)
+ {
+ // have to double-copy if the object is self, otherwise results very frustrating (because we use vector...)
+ return append (Name (comp.begin (), comp.end ()));
+ }
+ return append (comp.begin (), comp.end ());
+}
+
+Name &
+Name::append (const std::string &compStr)
+{
+ name::Component comp (compStr);
+ return appendBySwap (comp);
+}
+
+Name &
+Name::append (const void *buf, size_t size)
+{
+ name::Component comp (buf, size);
+ return appendBySwap (comp);
+}
+
+Name &
+Name::appendNumber (uint64_t number)
+{
+ name::Component comp;
+ return appendBySwap (comp.fromNumber (number));
+}
+
+Name &
+Name::appendNumberWithMarker (uint64_t number, unsigned char marker)
+{
+ name::Component comp;
+ return appendBySwap (comp.fromNumberWithMarker (number, marker));
+}
+
+inline Name &
+Name::appendSeqNum (uint64_t seqno)
+{
+ return appendNumberWithMarker (seqno, 0x00);
+}
+
+inline Name &
+Name::appendControlNum (uint64_t control)
+{
+ return appendNumberWithMarker (control, 0xC1);
+}
+
+inline Name &
+Name::appendBlkId (uint64_t blkid)
+{
+ return appendNumberWithMarker (blkid, 0xFB);
+}
+
+inline size_t
+Name::size () const
+{
+ return m_comps.size ();
+}
+
+/////
+///// Iterator interface to name components
+/////
+inline Name::const_iterator
+Name::begin () const
+{
+ return m_comps.begin ();
+}
+
+inline Name::iterator
+Name::begin ()
+{
+ return m_comps.begin ();
+}
+
+inline Name::const_iterator
+Name::end () const
+{
+ return m_comps.end ();
+}
+
+inline Name::iterator
+Name::end ()
+{
+ return m_comps.end ();
+}
+
+inline Name::const_reverse_iterator
+Name::rbegin () const
+{
+ return m_comps.rbegin ();
+}
+
+inline Name::reverse_iterator
+Name::rbegin ()
+{
+ return m_comps.rbegin ();
+}
+
+inline Name::const_reverse_iterator
+Name::rend () const
+{
+ return m_comps.rend ();
+}
+
+
+inline Name::reverse_iterator
+Name::rend ()
+{
+ return m_comps.rend ();
+}
+
+
+//// helpers
+
+
+inline Name
+Name::getPrefix (size_t len, size_t skip/* = 0*/) const
+{
+ return getSubName (skip, len);
+}
+
+inline Name
+Name::getPostfix (size_t len, size_t skip/* = 0*/) const
+{
+ return getSubName (size () - len - skip, len);
+}
+
+
+template<class T>
+inline void
+Name::push_back (const T &comp)
+{
+ append (comp);
+}
+
+inline bool
+Name::operator ==(const Name &name) const
+{
+ return (compare (name) == 0);
+}
+
+inline bool
+Name::operator !=(const Name &name) const
+{
+ return (compare (name) != 0);
+}
+
+inline bool
+Name::operator <= (const Name &name) const
+{
+ return (compare (name) <= 0);
+}
+
+inline bool
+Name::operator < (const Name &name) const
+{
+ return (compare (name) < 0);
+}
+
+inline bool
+Name::operator >= (const Name &name) const
+{
+ return (compare (name) >= 0);
+}
+
+inline bool
+Name::operator > (const Name &name) const
+{
+ return (compare (name) > 0);
+}
+
+inline name::Component &
+Name::operator [] (int index)
+{
+ return get (index);
+}
+
+inline const name::Component &
+Name::operator [] (int index) const
+{
+ return get (index);
+}
+
+ATTRIBUTE_HELPER_HEADER (Name);
+
+NDN_NAMESPACE_END
+
+#endif
diff --git a/ndn.cxx/ndn-api-face.cc b/ndn.cxx/ndn-api-face.cc
new file mode 100644
index 0000000..578f424
--- /dev/null
+++ b/ndn.cxx/ndn-api-face.cc
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ndn-api-face.h"
+#include "detail/pending-interests-container.h"
+#include "detail/registered-prefix-container.h"
+
+#include <ns3/random-variable.h>
+
+#include <ns3/ndn-l3-protocol.h>
+#include <ns3/ndn-interest.h>
+#include <ns3/ndn-content-object.h>
+#include <ns3/ndn-face.h>
+#include <ns3/ndn-fib.h>
+
+#include <ns3/packet.h>
+#include <ns3/log.h>
+
+using namespace std;
+using namespace boost;
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.ApiFace");
+
+namespace ns3 {
+namespace ndn {
+
+using namespace detail;
+
+class ApiFacePriv
+{
+public:
+ ApiFacePriv ()
+ : m_rand (0, std::numeric_limits<uint32_t>::max ())
+ {
+ }
+
+ ns3::UniformVariable m_rand; // nonce generator
+
+ PendingInterestContainer m_pendingInterests;
+ RegisteredPrefixContainer m_expectedInterests;
+};
+
+
+ApiFace::ApiFace (Ptr<Node> node)
+ : Face (node)
+ , m_this (new ApiFacePriv ())
+{
+ NS_ASSERT_MSG (GetNode ()->GetObject<L3Protocol> () != 0,
+ "NDN stack should be installed on the node " << GetNode ());
+
+ GetNode ()->GetObject<L3Protocol> ()->AddFace (this);
+ this->SetUp (true);
+ this->SetFlags (APPLICATION);
+}
+
+ApiFace::~ApiFace ()
+{
+ delete m_this;
+}
+
+void
+ApiFace::Shutdown ()
+{
+ NS_LOG_FUNCTION (this);
+
+ if (!IsUp ())
+ {
+ return;
+ }
+
+ this->SetUp (false);
+
+ m_this->m_pendingInterests.clear ();
+ m_this->m_expectedInterests.clear ();
+
+ GetNode ()->GetObject<L3Protocol> ()->RemoveFace (this);
+}
+
+void
+ApiFace::ExpressInterest (Ptr<Interest> interest,
+ DataCallback onData,
+ TimeoutCallback onTimeout/* = MakeNullCallback< void, Ptr<Interest> > ()*/)
+{
+ NS_LOG_INFO (">> I " << interest->GetName ());
+
+ if (interest->GetNonce () == 0)
+ {
+ interest->SetNonce (m_this->m_rand.GetValue ());
+ }
+
+ // Record the callback
+ PendingInterestContainer::iterator entry = m_this->m_pendingInterests.find_exact (interest->GetName ());
+ if (entry == m_this->m_pendingInterests.end ())
+ {
+ pair<PendingInterestContainer::iterator, bool> status =
+ m_this->m_pendingInterests.insert (interest->GetName (), Create <PendingInterestEntry> (interest));
+
+ entry = status.first;
+ }
+ entry->payload ()->AddCallbacks (onData, onTimeout);
+
+ ReceiveInterest (interest);
+}
+
+void
+ApiFace::SetInterestFilter (Ptr<const Name> prefix, InterestCallback onInterest)
+{
+ NS_LOG_DEBUG ("== setInterestFilter " << *prefix << " (" << GetNode ()->GetId () << ")");
+
+ RegisteredPrefixContainer::iterator entry = m_this->m_expectedInterests.find_exact (*prefix);
+ if (entry == m_this->m_expectedInterests.end ())
+ {
+ pair<RegisteredPrefixContainer::iterator, bool> status =
+ m_this->m_expectedInterests.insert (*prefix, Create < RegisteredPrefixEntry > (prefix));
+
+ entry = status.first;
+ }
+
+ entry->payload ()->AddCallback (onInterest);
+
+ // creating actual face
+ Ptr<ndn::Fib> fib = GetNode ()->GetObject<ndn::Fib> ();
+ Ptr<ndn::fib::Entry> fibEntry = fib->Add (prefix, this, 0);
+ fibEntry->UpdateStatus (this, ndn::fib::FaceMetric::NDN_FIB_GREEN);
+}
+
+void
+ApiFace::ClearInterestFilter (Ptr<const Name> prefix)
+{
+ RegisteredPrefixContainer::iterator entry = m_this->m_expectedInterests.find_exact (*prefix);
+ if (entry == m_this->m_expectedInterests.end ())
+ return;
+
+ entry->payload ()->ClearCallback ();
+ m_this->m_expectedInterests.erase (entry);
+}
+
+void
+ApiFace::Put (Ptr<ContentObject> data)
+{
+ NS_LOG_INFO (">> D " << data->GetName ());
+
+ ReceiveData (data);
+}
+
+
+
+
+///////////////////////////////////////////////
+// private stuff
+
+
+bool
+ApiFace::SendInterest (Ptr<const Interest> interest)
+{
+ NS_LOG_FUNCTION (this << interest);
+
+ NS_LOG_DEBUG ("<< I " << interest->GetName ());
+
+ if (!IsUp ())
+ {
+ return false;
+ }
+
+ // the app cannot set several filters for the same prefix
+ RegisteredPrefixContainer::iterator entry = m_this->m_expectedInterests.longest_prefix_match (interest->GetName ());
+ if (entry == m_this->m_expectedInterests.end ())
+ {
+ return false;
+ }
+
+ if (!entry->payload ()->m_callback.IsNull ())
+ entry->payload ()->m_callback (entry->payload ()->GetPrefix (), interest);
+ return true;
+}
+
+bool
+ApiFace::SendData (Ptr<const ContentObject> data)
+{
+ // data has been send out from NDN stack towards the application
+ NS_LOG_DEBUG ("<< D " << data->GetName ());
+
+ NS_LOG_FUNCTION (this << data);
+
+ if (!IsUp ())
+ {
+ return false;
+ }
+
+ PendingInterestContainer::iterator entry = m_this->m_pendingInterests.longest_prefix_match (data->GetName ());
+ if (entry == m_this->m_pendingInterests.end ())
+ {
+ return false;
+ }
+
+ while (entry != m_this->m_pendingInterests.end ())
+ {
+ if (!entry->payload ()->m_dataCallback.IsNull ())
+ entry->payload ()->m_dataCallback (entry->payload ()->GetInterest (), data);
+ m_this->m_pendingInterests.erase (entry);
+
+ entry = m_this->m_pendingInterests.longest_prefix_match (data->GetName ());
+ }
+ m_this->m_pendingInterests.erase (entry);
+
+ return true;
+}
+
+std::ostream&
+ApiFace::Print (std::ostream &os) const
+{
+ os << "dev=ApiFace(" << GetId () << ")";
+ return os;
+}
+
+
+}
+}
diff --git a/ndn.cxx/ndn-api-face.h b/ndn.cxx/ndn-api-face.h
new file mode 100644
index 0000000..78f482a
--- /dev/null
+++ b/ndn.cxx/ndn-api-face.h
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Chaoyi Bian <bcy@pku.edu.cn>
+ */
+
+#ifndef NDN_API_FACE_H
+#define NDN_API_FACE_H
+
+#include <ns3/ptr.h>
+#include <ns3/node.h>
+#include <ns3/callback.h>
+#include <ns3/ndn-face.h>
+#include <ns3/ndn-name.h>
+#include <ns3/ndn-interest.h>
+#include <ns3/ndn-content-object.h>
+
+namespace ns3 {
+namespace ndn {
+
+class ApiFacePriv;
+
+/**
+ * \ingroup sync
+ * @brief A handler for NDN; clients of this code do not need to deal
+ * with NDN API directly
+ */
+class ApiFace
+ : public ns3::ndn::Face
+{
+public:
+ typedef Callback<void, Ptr<const Name>, Ptr<const Interest> > InterestCallback;
+ typedef Callback<void, Ptr<const Interest>, Ptr<const ContentObject> > DataCallback;
+ typedef Callback<void, Ptr<const Interest> > TimeoutCallback;
+
+ /**
+ * @brief initialize the handler; a lot of things needs to be done. 1) init
+ * keystore 2) init keylocator 3) start a thread to hold a loop of ccn_run
+ *
+ */
+ ApiFace (Ptr<Node> node);
+ ~ApiFace ();
+
+ /**
+ * @brief Shutdown the API face
+ */
+ virtual void
+ Shutdown ();
+
+ /**
+ * @brief Express Interest
+ *
+ * @param name the Interest name
+ * @param onData the callback function to deal with the returned data
+ * @param onTimeout the callback function to deal with timeouts
+ */
+ void
+ ExpressInterest (Ptr<Interest> interest,
+ DataCallback onData,
+ TimeoutCallback onTimeout); // = MakeNullCallback< void, Ptr<Interest> > ()
+
+ /**
+ * @brief set Interest filter (specify what interest you want to receive)
+ *
+ * @param prefix the prefix of Interest
+ * @param onInterest the callback function to deal with the returned data
+ */
+ void
+ SetInterestFilter (Ptr<const Name> prefix, InterestCallback onInterest);
+
+ /**
+ * @brief clear Interest filter
+ * @param prefix the prefix of Interest
+ */
+ void
+ ClearInterestFilter (Ptr<const Name> prefix);
+
+ /**
+ * @brief Publish data
+ * @param data Data packet to publish
+ */
+ void
+ Put (Ptr<ContentObject> data);
+
+public:
+ virtual bool
+ SendInterest (Ptr<const Interest> interest);
+
+ virtual bool
+ SendData (Ptr<const ContentObject> data);
+
+ virtual std::ostream&
+ Print (std::ostream &os) const;
+
+private:
+ ApiFace () : Face (0) {}
+ ApiFace (const ApiFace &) : Face (0) {}
+ ApiFace& operator= (const ApiFace &) { return *this; }
+
+private:
+ ApiFacePriv *m_this;
+};
+
+} // ndn
+} // ns3
+
+#endif // NDN_API_HANDLER_H
diff --git a/test/ndnSIM-api.cc b/test/ndnSIM-api.cc
new file mode 100644
index 0000000..b472850
--- /dev/null
+++ b/test/ndnSIM-api.cc
@@ -0,0 +1,162 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU v3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ndnSIM-api.h"
+#include "ns3/core-module.h"
+#include "ns3/ndnSIM-module.h"
+#include "ns3/point-to-point-module.h"
+
+#include <boost/lexical_cast.hpp>
+
+NS_LOG_COMPONENT_DEFINE ("ndn.ApiTest");
+
+namespace ns3
+{
+
+class ApiTestClient : public Application
+{
+public:
+ static TypeId
+ GetTypeId ()
+ {
+ static TypeId tid = TypeId ("ns3::ndn::test::ApiTestClient")
+ .SetParent<Application> ()
+ .AddConstructor<ApiTestClient> ()
+ ;
+
+ return tid;
+ }
+
+ ApiTestClient ()
+ : datas (0)
+ , timeouts (0)
+ {
+ }
+
+protected:
+ void
+ StartApplication ()
+ {
+ m_face = Create<ndn::ApiFace> (GetNode ());
+
+ Simulator::Schedule (Seconds (0.1), &ApiTestClient::SendPacket, this, std::string ("/1"));
+ Simulator::Schedule (Seconds (5.0), &ApiTestClient::SendPacket, this, std::string ("/2"));
+ }
+
+ void
+ StopApplication ()
+ {
+ m_face->Shutdown ();
+ m_face = 0;
+ }
+
+private:
+ void
+ GotData (Ptr<const ndn::Interest>, Ptr<const ndn::ContentObject>)
+ {
+ datas++;
+ }
+
+ void
+ GotTimeout (Ptr<const ndn::Interest>)
+ {
+ timeouts++;
+ }
+
+ void
+ SendPacket (const std::string &prefix)
+ {
+ Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
+ interest->SetName (Create<ndn::Name> (prefix));
+ interest->SetInterestLifetime (Seconds (0.5));
+
+ m_face->ExpressInterest (interest,
+ MakeCallback (&ApiTestClient::GotData, this),
+ MakeCallback (&ApiTestClient::GotTimeout, this));
+ }
+
+public:
+ uint32_t datas;
+ uint32_t timeouts;
+
+private:
+ Ptr<ndn::ApiFace> m_face;
+};
+
+NS_OBJECT_ENSURE_REGISTERED (ApiTestClient);
+
+void
+ApiTest::Check0 (Ptr<Application> app)
+{
+ NS_TEST_ASSERT_MSG_EQ (DynamicCast<ApiTestClient> (app)->datas, 0, "");
+ NS_TEST_ASSERT_MSG_EQ (DynamicCast<ApiTestClient> (app)->timeouts, 0, "");
+}
+
+void
+ApiTest::Check1 (Ptr<Application> app)
+{
+ NS_TEST_ASSERT_MSG_EQ (DynamicCast<ApiTestClient> (app)->datas, 1, "");
+ NS_TEST_ASSERT_MSG_EQ (DynamicCast<ApiTestClient> (app)->timeouts, 0, "");
+}
+
+void
+ApiTest::Check2 (Ptr<Application> app)
+{
+ NS_TEST_ASSERT_MSG_EQ (DynamicCast<ApiTestClient> (app)->datas, 1, "");
+ NS_TEST_ASSERT_MSG_EQ (DynamicCast<ApiTestClient> (app)->timeouts, 1, "");
+}
+
+
+void
+ApiTest::DoRun ()
+{
+ Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
+ Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
+ Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
+
+ // Creating nodes
+ NodeContainer nodes;
+ nodes.Create (3);
+
+ // Connecting nodes using two links
+ PointToPointHelper p2p;
+ p2p.Install (nodes.Get (0), nodes.Get (1));
+ p2p.Install (nodes.Get (1), nodes.Get (2));
+
+ // Install NDN stack on all nodes
+ ndn::StackHelper ndnHelper;
+ ndnHelper.SetDefaultRoutes (true);
+ ndnHelper.InstallAll ();
+
+ // Installing applications
+
+ // Consumer
+ ndn::AppHelper consumerHelper ("ns3::ndn::test::ApiTestClient");
+ ApplicationContainer apps = consumerHelper.Install (nodes.Get (0)); // first node
+
+ // Producer
+ ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ // Producer will reply to all requests starting with /prefix
+ producerHelper.SetPrefix ("/");
+ producerHelper.SetAttribute ("Postfix", StringValue ("/unique/postfix"));
+ producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ producerHelper.Install (nodes.Get (2)).Stop (Seconds (4.0)); // last node
+
+ Simulator::Schedule (Seconds (0.0001), &ApiTest::Check0, this, apps.Get (0));
+ Simulator::Schedule (Seconds (0.2000), &ApiTest::Check1, this, apps.Get (0));
+ Simulator::Schedule (Seconds (5.6100), &ApiTest::Check2, this, apps.Get (0));
+
+ Simulator::Stop (Seconds (20.0));
+
+ Simulator::Run ();
+ Simulator::Destroy ();
+}
+
+}
diff --git a/test/ndnSIM-api.h b/test/ndnSIM-api.h
new file mode 100644
index 0000000..7df0112
--- /dev/null
+++ b/test/ndnSIM-api.h
@@ -0,0 +1,42 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Alexander Afanasyev
+ *
+ * GNU v3.0 license, See the LICENSE file for more information
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDNSIM_TEST_API_H
+#define NDNSIM_TEST_API_H
+
+#include "ns3/test.h"
+#include "ns3/ptr.h"
+
+namespace ns3 {
+
+class Application;
+
+namespace ndn {
+}
+
+class ApiTest : public TestCase
+{
+public:
+ ApiTest ()
+ : TestCase ("API test")
+ {
+ }
+
+private:
+ virtual void DoRun ();
+
+ void Check0 (Ptr<Application> app);
+ void Check1 (Ptr<Application> app);
+ void Check2 (Ptr<Application> app);
+};
+
+}
+
+#endif // NDNSIM_TEST_API_H
diff --git a/test/ndnSIM-fib-entry.cc b/test/ndnSIM-fib-entry.cc
index 05d0e01..c57cf4d 100644
--- a/test/ndnSIM-fib-entry.cc
+++ b/test/ndnSIM-fib-entry.cc
@@ -36,7 +36,7 @@
namespace ns3
{
-class Client : public ndn::App
+class FibEntryTestApp : public ndn::App
{
protected:
void
@@ -48,8 +48,8 @@
Ptr<ndn::fib::Entry> fibEntry = GetNode ()->GetObject<ndn::Fib> ()->Add (ndn::Name ("/"), m_face, 0);
fibEntry->UpdateStatus (m_face, ndn::fib::FaceMetric::NDN_FIB_GREEN);
- Simulator::Schedule (Seconds (0.5), &Client::SendPacket, this, std::string("/1"), 1);
- Simulator::Schedule (Seconds (4.0), &Client::SendPacket, this, std::string("/2"), 1);
+ Simulator::Schedule (Seconds (0.5), &FibEntryTestApp::SendPacket, this, std::string("/1"), 1);
+ Simulator::Schedule (Seconds (4.0), &FibEntryTestApp::SendPacket, this, std::string("/2"), 1);
}
void
@@ -62,14 +62,12 @@
void
SendPacket (const std::string &prefix, uint32_t nonce)
{
- Ptr<Packet> pkt = Create<Packet> (0);
- ndn::Interest i;
- i.SetName (Create<ndn::Name> (prefix));
- i.SetNonce (nonce);
- i.SetInterestLifetime (Seconds (0.5));
+ Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
+ interest->SetName (Create<ndn::Name> (prefix));
+ interest->SetNonce (nonce);
+ interest->SetInterestLifetime (Seconds (0.5));
- pkt->AddHeader (i);
- m_protocolHandler (pkt);
+ m_face->ReceiveInterest (interest);
}
};
@@ -113,7 +111,7 @@
ndn::StackHelper::AddRoute (node, "/", 0, 0);
- Ptr<Client> app1 = CreateObject<Client> ();
+ Ptr<Application> app1 = CreateObject<FibEntryTestApp> ();
node->AddApplication (app1);
ndn::AppHelper sinkHelper ("ns3::ndn::Producer");
diff --git a/test/ndnSIM-pit.cc b/test/ndnSIM-pit.cc
index 9eb9cbf..db94f6f 100644
--- a/test/ndnSIM-pit.cc
+++ b/test/ndnSIM-pit.cc
@@ -30,7 +30,7 @@
namespace ns3
{
-class Client : public ndn::App
+class PitTestClient : public ndn::App
{
protected:
void
@@ -42,10 +42,10 @@
Ptr<ndn::fib::Entry> fibEntry = GetNode ()->GetObject<ndn::Fib> ()->Add (ndn::Name ("/"), m_face, 0);
fibEntry->UpdateStatus (m_face, ndn::fib::FaceMetric::NDN_FIB_GREEN);
- Simulator::Schedule (Seconds (0.1), &Client::SendPacket, this, std::string("/1"), 1);
- Simulator::Schedule (Seconds (0.2), &Client::SendPacket, this, std::string("/2"), 1);
- Simulator::Schedule (Seconds (0.3), &Client::SendPacket, this, std::string("/3"), 1);
- Simulator::Schedule (Seconds (0.4), &Client::SendPacket, this, std::string("/1"), 2);
+ Simulator::Schedule (Seconds (0.1), &PitTestClient::SendPacket, this, std::string("/1"), 1);
+ Simulator::Schedule (Seconds (0.2), &PitTestClient::SendPacket, this, std::string("/2"), 1);
+ Simulator::Schedule (Seconds (0.3), &PitTestClient::SendPacket, this, std::string("/3"), 1);
+ Simulator::Schedule (Seconds (0.4), &PitTestClient::SendPacket, this, std::string("/1"), 2);
}
void
@@ -58,14 +58,12 @@
void
SendPacket (const std::string &prefix, uint32_t nonce)
{
- Ptr<Packet> pkt = Create<Packet> (0);
- ndn::Interest i;
- i.SetName (Create<ndn::Name> (prefix));
- i.SetNonce (nonce);
- i.SetInterestLifetime (Seconds (0.5));
+ Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
+ interest->SetName (Create<ndn::Name> (prefix));
+ interest->SetNonce (nonce);
+ interest->SetInterestLifetime (Seconds (0.5));
- pkt->AddHeader (i);
- m_protocolHandler (pkt);
+ m_face->ReceiveInterest (interest);
}
};
@@ -120,7 +118,8 @@
ndn::StackHelper::AddRoute (node, "/", 0, 0);
- Ptr<Client> app1 = CreateObject<Client> ();
+ Ptr<Application> app1 = CreateObject<PitTestClient> ();
+ app1->SetStartTime (Seconds (0.0));
node->AddApplication (app1);
Simulator::Schedule (Seconds (0.0001), &PitTest::Test, this, node->GetObject<ndn::Fib> ());
@@ -137,7 +136,7 @@
Simulator::Schedule (Seconds (0.91), &PitTest::Check0, this, node->GetObject<ndn::Pit> ());
- Simulator::Stop (Seconds (1.0));
+ Simulator::Stop (Seconds (10.0));
Simulator::Run ();
Simulator::Destroy ();
}
diff --git a/test/ndnSIM-serialization.cc b/test/ndnSIM-serialization.cc
index 86e9430..70a10a7 100644
--- a/test/ndnSIM-serialization.cc
+++ b/test/ndnSIM-serialization.cc
@@ -24,6 +24,7 @@
#include "ndnSIM-serialization.h"
#include <boost/lexical_cast.hpp>
+#include "ns3/ndnSIM/model/wire/ndnsim.h"
using namespace std;
@@ -36,71 +37,97 @@
void
InterestSerializationTest::DoRun ()
{
- Interest source;
+ Ptr<Interest> source = Create<Interest> ();
- source.SetName (Create<Name> (boost::lexical_cast<Name> ("/test/test2")));
- NS_TEST_ASSERT_MSG_EQ (source.GetName (), boost::lexical_cast<Name> ("/test/test2"), "set/get name failed");
+ source->SetName (Create<Name> (boost::lexical_cast<Name> ("/test/test2")));
+ NS_TEST_ASSERT_MSG_EQ (source->GetName (), boost::lexical_cast<Name> ("/test/test2"), "set/get name failed");
- source.SetScope (2);
- NS_TEST_ASSERT_MSG_EQ (source.GetScope (), 2, "set/get scope failed");
+ source->SetScope (2);
+ NS_TEST_ASSERT_MSG_EQ (source->GetScope (), 2, "set/get scope failed");
- source.SetInterestLifetime (Seconds (100));
- NS_TEST_ASSERT_MSG_EQ (source.GetInterestLifetime (), Seconds (100), "set/get interest lifetime failed");
+ source->SetInterestLifetime (Seconds (100));
+ NS_TEST_ASSERT_MSG_EQ (source->GetInterestLifetime (), Seconds (100), "set/get interest lifetime failed");
- source.SetNonce (200);
- NS_TEST_ASSERT_MSG_EQ (source.GetNonce (), 200, "set/get nonce failed");
+ source->SetNonce (200);
+ NS_TEST_ASSERT_MSG_EQ (source->GetNonce (), 200, "set/get nonce failed");
- source.SetNack (10);
- NS_TEST_ASSERT_MSG_EQ (source.GetNack (), 10, "set/get NACK failed");
+ source->SetNack (10);
+ NS_TEST_ASSERT_MSG_EQ (source->GetNack (), 10, "set/get NACK failed");
- Packet packet (0);
- //serialization
- packet.AddHeader (source);
-
- //deserialization
- Interest target;
- packet.RemoveHeader (target);
+ NS_TEST_ASSERT_MSG_EQ (source->GetWire (), 0, "Wire should be empty");
+ NS_TEST_ASSERT_MSG_NE (source->GetPayload (), 0, "Payload should not be empty");
+
+ Ptr<Packet> packet = wire::ndnSIM::Interest::ToWire (source);
+
+ NS_TEST_ASSERT_MSG_NE (source->GetWire (), 0, "Wire should not be empty now");
+
+ Ptr<Interest> target = wire::ndnSIM::Interest::FromWire (packet);
- NS_TEST_ASSERT_MSG_EQ (source.GetName () , target.GetName () , "source/target name failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetScope () , target.GetScope () , "source/target scope failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetInterestLifetime (), target.GetInterestLifetime (), "source/target interest lifetime failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetNonce () , target.GetNonce () , "source/target nonce failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetNack () , target.GetNack () , "source/target NACK failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetName () , target->GetName () , "source/target name failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetScope () , target->GetScope () , "source/target scope failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetInterestLifetime (), target->GetInterestLifetime (), "source/target interest lifetime failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetNonce () , target->GetNonce () , "source/target nonce failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetNack () , target->GetNack () , "source/target NACK failed");
+
+ NS_TEST_ASSERT_MSG_EQ (source->GetExclude () , 0, "exclude should be empty");
+ NS_TEST_ASSERT_MSG_EQ (target->GetExclude () , 0, "exclude should be empty");
+
+ Ptr<Exclude> exclude = Create<Exclude> ();
+ exclude->excludeAfter (name::Component ());
+ source->SetExclude (exclude);
+
+ NS_TEST_ASSERT_MSG_EQ (boost::lexical_cast<std::string> (*source->GetExclude ()),
+ " ----> ", "exclude should contain only <ANY/>");
+
+ exclude->appendExclude (name::Component ("alex"), false);
+ exclude->excludeAfter (name::Component ("zhenkai"));
+
+ source->SetExclude (exclude);
+ NS_TEST_ASSERT_MSG_EQ (boost::lexical_cast<std::string> (*source->GetExclude ()),
+ " ----> alex zhenkai ----> ", "exclude should contain only <ANY/>");
+
+ NS_TEST_ASSERT_MSG_EQ (source->GetWire (), 0, "Wire should be empty");
+ NS_TEST_ASSERT_MSG_NE (source->GetPayload (), 0, "Payload should not be empty");
+
+ packet = wire::ndnSIM::Interest::ToWire (source);
+ target = wire::ndnSIM::Interest::FromWire (packet);
+ NS_TEST_ASSERT_MSG_NE (target->GetExclude (), 0, "exclude should not be empty");
+
+ NS_TEST_ASSERT_MSG_EQ (boost::lexical_cast<std::string> (*target->GetExclude ()),
+ " ----> alex zhenkai ----> ", "exclude should contain only <ANY/>");
}
void
ContentObjectSerializationTest::DoRun ()
{
- ContentObject source;
+ Ptr<ContentObject> source = Create<ContentObject> (Create<Packet> (1024));
- source.SetName (Create<Name> (boost::lexical_cast<Name> ("/test/test2/1")));
- NS_TEST_ASSERT_MSG_EQ (source.GetName (), boost::lexical_cast<Name> ("/test/test2/1"), "set/get name failed");
+ source->SetName (Create<Name> (boost::lexical_cast<Name> ("/test/test2/1")));
+ NS_TEST_ASSERT_MSG_EQ (source->GetName (), boost::lexical_cast<Name> ("/test/test2/1"), "set/get name failed");
- source.SetFreshness (Seconds (10));
- NS_TEST_ASSERT_MSG_EQ (source.GetFreshness (), Seconds (10), "set/get freshness failed");
+ source->SetFreshness (Seconds (10));
+ NS_TEST_ASSERT_MSG_EQ (source->GetFreshness (), Seconds (10), "set/get freshness failed");
- source.SetTimestamp (Seconds (100));
- NS_TEST_ASSERT_MSG_EQ (source.GetTimestamp (), Seconds (100), "set/get timestamp failed");
+ source->SetTimestamp (Seconds (100));
+ NS_TEST_ASSERT_MSG_EQ (source->GetTimestamp (), Seconds (100), "set/get timestamp failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetSignature (), 0, "initialization of signature failed");
- int size = source.GetSerializedSize ();
- source.SetSignature (10);
- NS_TEST_ASSERT_MSG_EQ (source.GetSignature (), 10, "set/get signature failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetSignature (), 0, "initialization of signature failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetSerializedSize (), static_cast<unsigned int> (size + 4), "Signature size should have increased by 4");
+ Ptr<Packet> packet = wire::ndnSIM::Data::ToWire (source);
+ int size = packet->GetSize ();
+
+ source->SetSignature (10);
+ NS_TEST_ASSERT_MSG_EQ (source->GetSignature (), 10, "set/get signature failed");
+
+ packet = wire::ndnSIM::Data::ToWire (source);
+ NS_TEST_ASSERT_MSG_EQ (packet->GetSize (), static_cast<unsigned int> (size + 4), "Signature size should have increased by 4");
+
+ Ptr<ContentObject> target = wire::ndnSIM::Data::FromWire (packet);
- Packet packet (0);
- //serialization
- packet.AddHeader (source);
-
- //deserialization
- ContentObject target;
- packet.RemoveHeader (target);
-
- NS_TEST_ASSERT_MSG_EQ (source.GetName () , target.GetName () , "source/target name failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetFreshness (), target.GetFreshness (), "source/target freshness failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetTimestamp (), target.GetTimestamp (), "source/target timestamp failed");
- NS_TEST_ASSERT_MSG_EQ (source.GetSignature (), target.GetSignature (), "source/target signature failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetName () , target->GetName () , "source/target name failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetFreshness (), target->GetFreshness (), "source/target freshness failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetTimestamp (), target->GetTimestamp (), "source/target timestamp failed");
+ NS_TEST_ASSERT_MSG_EQ (source->GetSignature (), target->GetSignature (), "source/target signature failed");
}
}
diff --git a/test/ndnSIM-tests.cc b/test/ndnSIM-tests.cc
index 688fca4..face35e 100644
--- a/test/ndnSIM-tests.cc
+++ b/test/ndnSIM-tests.cc
@@ -24,6 +24,7 @@
#include "ndnSIM-serialization.h"
#include "ndnSIM-pit.h"
#include "ndnSIM-fib-entry.h"
+#include "ndnSIM-api.h"
namespace ns3
{
@@ -32,14 +33,15 @@
{
public:
NdnSimTestSuite ()
- : TestSuite ("ndnSIM-suite", UNIT)
+ : TestSuite ("ndnSIM", UNIT)
{
SetDataDir (NS_TEST_SOURCEDIR);
- AddTestCase (new InterestSerializationTest ());
- AddTestCase (new ContentObjectSerializationTest ());
- AddTestCase (new FibEntryTest ());
- // AddTestCase (new PitTest ());
+ AddTestCase (new InterestSerializationTest (), TestCase::QUICK);
+ AddTestCase (new ContentObjectSerializationTest (), TestCase::QUICK);
+ AddTestCase (new FibEntryTest (), TestCase::QUICK);
+ AddTestCase (new PitTest (), TestCase::QUICK);
+ AddTestCase (new ApiTest (), TestCase::QUICK);
}
};
diff --git a/utils/tracers/ndn-l3-aggregate-tracer.cc b/utils/tracers/ndn-l3-aggregate-tracer.cc
index 5ece34c..d1150ae 100644
--- a/utils/tracers/ndn-l3-aggregate-tracer.cc
+++ b/utils/tracers/ndn-l3-aggregate-tracer.cc
@@ -61,7 +61,7 @@
os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
if (!os->is_open ())
- return boost::make_tuple (outputStream, tracers);
+ return boost::make_tuple (outputStream, tracers);
outputStream = os;
}
@@ -102,7 +102,7 @@
os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
if (!os->is_open ())
- return boost::make_tuple (outputStream, tracers);
+ return boost::make_tuple (outputStream, tracers);
outputStream = os;
}
@@ -143,7 +143,7 @@
os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
if (!os->is_open ())
- return boost::make_tuple (outputStream, tracers);
+ return boost::make_tuple (outputStream, tracers);
outputStream = os;
}
@@ -298,69 +298,96 @@
}
void
-L3AggregateTracer::OutInterests (Ptr<const Interest> header, Ptr<const Face> face)
+L3AggregateTracer::OutInterests (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_outInterests ++;
- m_stats[face].get<1> ().m_outInterests += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_outInterests += interest->GetWire ()->GetSize ();
+ }
}
void
-L3AggregateTracer::InInterests (Ptr<const Interest> header, Ptr<const Face> face)
+L3AggregateTracer::InInterests (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_inInterests ++;
- m_stats[face].get<1> ().m_inInterests += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_inInterests += interest->GetWire ()->GetSize ();
+ }
}
void
-L3AggregateTracer::DropInterests (Ptr<const Interest> header, Ptr<const Face> face)
+L3AggregateTracer::DropInterests (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_dropInterests ++;
- m_stats[face].get<1> ().m_dropInterests += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_dropInterests += interest->GetWire ()->GetSize ();
+ }
}
void
-L3AggregateTracer::OutNacks (Ptr<const Interest> header, Ptr<const Face> face)
+L3AggregateTracer::OutNacks (Ptr<const Interest> nack, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_outNacks ++;
- m_stats[face].get<1> ().m_outNacks += header->GetSerializedSize ();
+ if (nack->GetWire ())
+ {
+ m_stats[face].get<1> ().m_outNacks += nack->GetWire ()->GetSize ();
+ }
}
void
-L3AggregateTracer::InNacks (Ptr<const Interest> header, Ptr<const Face> face)
+L3AggregateTracer::InNacks (Ptr<const Interest> nack, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_inNacks ++;
- m_stats[face].get<1> ().m_inNacks += header->GetSerializedSize ();
+ if (nack->GetWire ())
+ {
+ m_stats[face].get<1> ().m_inNacks += nack->GetWire ()->GetSize ();
+ }
}
void
-L3AggregateTracer::DropNacks (Ptr<const Interest> header, Ptr<const Face> face)
+L3AggregateTracer::DropNacks (Ptr<const Interest> nack, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_dropNacks ++;
- m_stats[face].get<1> ().m_dropNacks += header->GetSerializedSize ();
+ if (nack->GetWire ())
+ {
+ m_stats[face].get<1> ().m_dropNacks += nack->GetWire ()->GetSize ();
+ }
}
void
-L3AggregateTracer::OutData (Ptr<const ContentObject> header, Ptr<const Packet> payload,
+L3AggregateTracer::OutData (Ptr<const ContentObject> data,
bool fromCache, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_outData ++;
- m_stats[face].get<1> ().m_outData += header->GetSerializedSize () + payload->GetSize ();
+ if (data->GetWire ())
+ {
+ m_stats[face].get<1> ().m_outData += data->GetWire ()->GetSize ();
+ }
}
void
-L3AggregateTracer::InData (Ptr<const ContentObject> header, Ptr<const Packet> payload,
+L3AggregateTracer::InData (Ptr<const ContentObject> data,
Ptr<const Face> face)
{
m_stats[face].get<0> ().m_inData ++;
- m_stats[face].get<1> ().m_inData += header->GetSerializedSize () + payload->GetSize ();
+ if (data->GetWire ())
+ {
+ m_stats[face].get<1> ().m_inData += data->GetWire ()->GetSize ();
+ }
}
void
-L3AggregateTracer::DropData (Ptr<const ContentObject> header, Ptr<const Packet> payload,
+L3AggregateTracer::DropData (Ptr<const ContentObject> data,
Ptr<const Face> face)
{
m_stats[face].get<0> ().m_dropData ++;
- m_stats[face].get<1> ().m_dropData += header->GetSerializedSize () + payload->GetSize ();
+ if (data->GetWire ())
+ {
+ m_stats[face].get<1> ().m_dropData += data->GetWire ()->GetSize ();
+ }
}
void
diff --git a/utils/tracers/ndn-l3-aggregate-tracer.h b/utils/tracers/ndn-l3-aggregate-tracer.h
index 03f7a9a..98e6731 100644
--- a/utils/tracers/ndn-l3-aggregate-tracer.h
+++ b/utils/tracers/ndn-l3-aggregate-tracer.h
@@ -142,13 +142,13 @@
DropNacks (Ptr<const Interest>, Ptr<const Face>);
virtual void
- OutData (Ptr<const ContentObject>, Ptr<const Packet>, bool fromCache, Ptr<const Face>);
+ OutData (Ptr<const ContentObject>, bool fromCache, Ptr<const Face>);
virtual void
- InData (Ptr<const ContentObject>, Ptr<const Packet>, Ptr<const Face>);
+ InData (Ptr<const ContentObject>, Ptr<const Face>);
virtual void
- DropData (Ptr<const ContentObject>, Ptr<const Packet>, Ptr<const Face>);
+ DropData (Ptr<const ContentObject>, Ptr<const Face>);
virtual void
diff --git a/utils/tracers/ndn-l3-rate-tracer.cc b/utils/tracers/ndn-l3-rate-tracer.cc
index c0b9fff..8f91f6f 100644
--- a/utils/tracers/ndn-l3-rate-tracer.cc
+++ b/utils/tracers/ndn-l3-rate-tracer.cc
@@ -61,7 +61,7 @@
os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
if (!os->is_open ())
- return boost::make_tuple (outputStream, tracers);
+ return boost::make_tuple (outputStream, tracers);
outputStream = os;
}
@@ -315,69 +315,96 @@
void
-L3RateTracer::OutInterests (Ptr<const Interest> header, Ptr<const Face> face)
+L3RateTracer::OutInterests (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_outInterests ++;
- m_stats[face].get<1> ().m_outInterests += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_outInterests += interest->GetWire ()->GetSize ();
+ }
}
void
-L3RateTracer::InInterests (Ptr<const Interest> header, Ptr<const Face> face)
+L3RateTracer::InInterests (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_inInterests ++;
- m_stats[face].get<1> ().m_inInterests += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_inInterests += interest->GetWire ()->GetSize ();
+ }
}
void
-L3RateTracer::DropInterests (Ptr<const Interest> header, Ptr<const Face> face)
+L3RateTracer::DropInterests (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_dropInterests ++;
- m_stats[face].get<1> ().m_dropInterests += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_dropInterests += interest->GetWire ()->GetSize ();
+ }
}
void
-L3RateTracer::OutNacks (Ptr<const Interest> header, Ptr<const Face> face)
+L3RateTracer::OutNacks (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_outNacks ++;
- m_stats[face].get<1> ().m_outNacks += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_outNacks += interest->GetWire ()->GetSize ();
+ }
}
void
-L3RateTracer::InNacks (Ptr<const Interest> header, Ptr<const Face> face)
+L3RateTracer::InNacks (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_inNacks ++;
- m_stats[face].get<1> ().m_inNacks += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_inNacks += interest->GetWire ()->GetSize ();
+ }
}
void
-L3RateTracer::DropNacks (Ptr<const Interest> header, Ptr<const Face> face)
+L3RateTracer::DropNacks (Ptr<const Interest> interest, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_dropNacks ++;
- m_stats[face].get<1> ().m_dropNacks += header->GetSerializedSize ();
+ if (interest->GetWire ())
+ {
+ m_stats[face].get<1> ().m_dropNacks += interest->GetWire ()->GetSize ();
+ }
}
void
-L3RateTracer::OutData (Ptr<const ContentObject> header, Ptr<const Packet> payload,
+L3RateTracer::OutData (Ptr<const ContentObject> data,
bool fromCache, Ptr<const Face> face)
{
m_stats[face].get<0> ().m_outData ++;
- m_stats[face].get<1> ().m_outData += header->GetSerializedSize () + payload->GetSize ();
+ if (data->GetWire ())
+ {
+ m_stats[face].get<1> ().m_outData += data->GetWire ()->GetSize ();
+ }
}
void
-L3RateTracer::InData (Ptr<const ContentObject> header, Ptr<const Packet> payload,
+L3RateTracer::InData (Ptr<const ContentObject> data,
Ptr<const Face> face)
{
m_stats[face].get<0> ().m_inData ++;
- m_stats[face].get<1> ().m_inData += header->GetSerializedSize () + payload->GetSize ();
+ if (data->GetWire ())
+ {
+ m_stats[face].get<1> ().m_inData += data->GetWire ()->GetSize ();
+ }
}
void
-L3RateTracer::DropData (Ptr<const ContentObject> header, Ptr<const Packet> payload,
+L3RateTracer::DropData (Ptr<const ContentObject> data,
Ptr<const Face> face)
{
m_stats[face].get<0> ().m_dropData ++;
- m_stats[face].get<1> ().m_dropData += header->GetSerializedSize () + payload->GetSize ();
+ if (data->GetWire ())
+ {
+ m_stats[face].get<1> ().m_dropData += data->GetWire ()->GetSize ();
+ }
}
void
@@ -391,7 +418,7 @@
i++)
{
m_stats[i->m_face].get<0> ().m_satisfiedInterests ++;
- }
+}
for (pit::Entry::out_container::const_iterator i = entry->GetOutgoing ().begin ();
i != entry->GetOutgoing ().end ();
@@ -412,7 +439,7 @@
i++)
{
m_stats[i->m_face].get<0> ().m_timedOutInterests ++;
- }
+}
for (pit::Entry::out_container::const_iterator i = entry->GetOutgoing ().begin ();
i != entry->GetOutgoing ().end ();
diff --git a/utils/tracers/ndn-l3-rate-tracer.h b/utils/tracers/ndn-l3-rate-tracer.h
index 64e5177..60bb616 100644
--- a/utils/tracers/ndn-l3-rate-tracer.h
+++ b/utils/tracers/ndn-l3-rate-tracer.h
@@ -144,13 +144,13 @@
DropNacks (Ptr<const Interest>, Ptr<const Face>);
virtual void
- OutData (Ptr<const ContentObject>, Ptr<const Packet>, bool fromCache, Ptr<const Face>);
+ OutData (Ptr<const ContentObject>, bool fromCache, Ptr<const Face>);
virtual void
- InData (Ptr<const ContentObject>, Ptr<const Packet>, Ptr<const Face>);
+ InData (Ptr<const ContentObject>, Ptr<const Face>);
virtual void
- DropData (Ptr<const ContentObject>, Ptr<const Packet>, Ptr<const Face>);
+ DropData (Ptr<const ContentObject>, Ptr<const Face>);
virtual void
SatisfiedInterests (Ptr<const pit::Entry>);
diff --git a/utils/tracers/ndn-l3-tracer.h b/utils/tracers/ndn-l3-tracer.h
index c264d49..260fe61 100644
--- a/utils/tracers/ndn-l3-tracer.h
+++ b/utils/tracers/ndn-l3-tracer.h
@@ -103,13 +103,13 @@
virtual void
- OutData (Ptr<const ContentObject>, Ptr<const Packet>, bool fromCache, Ptr<const Face>) = 0;
+ OutData (Ptr<const ContentObject>, bool fromCache, Ptr<const Face>) = 0;
virtual void
- InData (Ptr<const ContentObject>, Ptr<const Packet>, Ptr<const Face>) = 0;
+ InData (Ptr<const ContentObject>, Ptr<const Face>) = 0;
virtual void
- DropData (Ptr<const ContentObject>, Ptr<const Packet>, Ptr<const Face>) = 0;
+ DropData (Ptr<const ContentObject>, Ptr<const Face>) = 0;
virtual void
SatisfiedInterests (Ptr<const pit::Entry>) = 0;
diff --git a/utils/trie/trie-with-policy.h b/utils/trie/trie-with-policy.h
index 2d175a0..2ab147d 100644
--- a/utils/trie/trie-with-policy.h
+++ b/utils/trie/trie-with-policy.h
@@ -47,8 +47,8 @@
typename PolicyTraits::template container_hook<parent_trie>::type >::type policy_container;
inline
- trie_with_policy (size_t bucketSize = 10, size_t bucketIncrement = 10)
- : trie_ ("", bucketSize, bucketIncrement)
+ trie_with_policy (size_t bucketSize = 1, size_t bucketIncrement = 1)
+ : trie_ (name::Component (), bucketSize, bucketIncrement)
, policy_ (*this)
{
}
@@ -210,7 +210,7 @@
*/
template<class Predicate>
inline iterator
- deepest_prefix_match (const FullKey &key, Predicate pred)
+ deepest_prefix_match_if (const FullKey &key, Predicate pred)
{
iterator foundItem, lastItem;
bool reachLast;
@@ -236,6 +236,40 @@
}
}
+ /**
+ * @brief Find a node that has prefix at least as the key
+ *
+ * This version of find checks predicate for the next level and if
+ * predicate is True, returns first deepest match available
+ */
+ template<class Predicate>
+ inline iterator
+ deepest_prefix_match_if_next_level (const FullKey &key, Predicate pred)
+ {
+ iterator foundItem, lastItem;
+ bool reachLast;
+ boost::tie (foundItem, reachLast, lastItem) = trie_.find (key);
+
+ // guard in case we don't have anything in the trie
+ if (lastItem == trie_.end ())
+ return trie_.end ();
+
+ if (reachLast)
+ {
+ foundItem = lastItem->find_if_next_level (pred); // may or may not find something
+ if (foundItem == trie_.end ())
+ {
+ return trie_.end ();
+ }
+ policy_.lookup (s_iterator_to (foundItem));
+ return foundItem;
+ }
+ else
+ { // couldn't find a node that has prefix at least as key
+ return trie_.end ();
+ }
+ }
+
iterator end () const
{
return 0;
diff --git a/utils/trie/trie.h b/utils/trie/trie.h
index 62411d6..1e37cbd 100644
--- a/utils/trie/trie.h
+++ b/utils/trie/trie.h
@@ -151,7 +151,7 @@
typedef PayloadTraits payload_traits;
inline
- trie (const Key &key, size_t bucketSize = 10, size_t bucketIncrement = 10)
+ trie (const Key &key, size_t bucketSize = 1, size_t bucketIncrement = 1)
: key_ (key)
, initialBucketSize_ (bucketSize)
, bucketIncrement_ (bucketIncrement)
@@ -415,6 +415,32 @@
return 0;
}
+ /**
+ * @brief Find next payload of the sub-trie satisfying the predicate
+ * @param pred predicate
+ *
+ * This version check predicate only for the next level children
+ *
+ * @returns end() or a valid iterator pointing to the trie leaf (order is not defined, enumeration )
+ */
+ template<class Predicate>
+ inline const iterator
+ find_if_next_level (Predicate pred)
+ {
+ typedef trie<FullKey, PayloadTraits, PolicyHook> trie;
+ for (typename trie::unordered_set::iterator subnode = children_.begin ();
+ subnode != children_.end ();
+ subnode++ )
+ {
+ if (pred (subnode->key ()))
+ {
+ return subnode->find ();
+ }
+ }
+
+ return 0;
+ }
+
iterator end ()
{
return 0;
diff --git a/wscript b/wscript
index 52f2892..6f200dc 100644
--- a/wscript
+++ b/wscript
@@ -108,12 +108,14 @@
'apps/*.cc',
'utils/**/*.cc',
'helper/**/*.cc',
+ 'ndn.cxx/**/*.cc',
])
module.full_headers = [p.path_from(bld.path) for p in bld.path.ant_glob([
'utils/**/*.h',
'model/**/*.h',
'apps/**/*.h',
'helper/**/*.h',
+ 'ndn.cxx/**/*.h',
])]
headers.source = [
@@ -122,9 +124,11 @@
"helper/ndn-header-helper.h",
"helper/ndn-face-container.h",
"helper/ndn-global-routing-helper.h",
+ "helper/ndn-link-control-helper.h",
"apps/ndn-app.h",
+ "model/ndn-common.h",
"model/ndn-l3-protocol.h",
"model/ndn-face.h",
"model/ndn-app-face.h",
@@ -134,6 +138,12 @@
"model/ndn-name-components.h",
"model/ndn-name.h",
+ "ndn.cxx/blob.h",
+ "ndn.cxx/name-component.h",
+ "ndn.cxx/name.h",
+ "ndn.cxx/exclude.h",
+ "ndn.cxx/ndn-api-face.h",
+
"model/cs/ndn-content-store.h",
"model/fib/ndn-fib.h",
@@ -147,11 +157,12 @@
"model/fw/ndn-forwarding-strategy.h",
"model/fw/ndn-fw-tag.h",
- # "utils/batches.h",
+ "model/wire/ndn-wire.h",
+
"utils/ndn-limits.h",
"utils/ndn-rtt-estimator.h",
- # "utils/weights-path-stretch-tag.h",
+ "apps/callback-based-app.h",
]
if 'topology' in bld.env['NDN_plugins']:
@@ -183,6 +194,10 @@
bld.ns3_python_bindings()
+ bld (features = "pyext",
+ source = bld.path.ant_glob (["PyNDN/**/*.py"]),
+ install_from = "."
+ )
@TaskGen.feature('ns3fullmoduleheaders')
@TaskGen.after_method('process_rule')