--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py Fri Feb 12 21:02:49 2010 -0800
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py Tue Feb 23 10:04:31 2010 -0800
@@ -47,8 +47,8 @@
module.add_class('Chunk', parent=root_module['ns3::ObjectBase'])
## header.h: ns3::Header [class]
module.add_class('Header', parent=root_module['ns3::Chunk'])
- ## pcap-file-object.h: ns3::PcapFileObject [class]
- module.add_class('PcapFileObject', parent=root_module['ns3::Object'])
+ ## pcap-file-wrapper.h: ns3::PcapFileWrapper [class]
+ module.add_class('PcapFileWrapper', parent=root_module['ns3::Object'])
## propagation-delay-model.h: ns3::PropagationDelayModel [class]
module.add_class('PropagationDelayModel', parent=root_module['ns3::Object'])
## propagation-loss-model.h: ns3::PropagationLossModel [class]
@@ -197,7 +197,7 @@
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk'])
register_Ns3Header_methods(root_module, root_module['ns3::Header'])
- register_Ns3PcapFileObject_methods(root_module, root_module['ns3::PcapFileObject'])
+ register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
register_Ns3PropagationDelayModel_methods(root_module, root_module['ns3::PropagationDelayModel'])
register_Ns3PropagationLossModel_methods(root_module, root_module['ns3::PropagationLossModel'])
register_Ns3RandomPropagationDelayModel_methods(root_module, root_module['ns3::RandomPropagationDelayModel'])
@@ -987,65 +987,65 @@
is_pure_virtual=True, is_const=True, is_virtual=True)
return
-def register_Ns3PcapFileObject_methods(root_module, cls):
- ## pcap-file-object.h: ns3::PcapFileObject::PcapFileObject(ns3::PcapFileObject const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::PcapFileObject const &', 'arg0')])
- ## pcap-file-object.h: ns3::PcapFileObject::PcapFileObject() [constructor]
+def register_Ns3PcapFileWrapper_methods(root_module, cls):
+ ## pcap-file-wrapper.h: ns3::PcapFileWrapper::PcapFileWrapper(ns3::PcapFileWrapper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PcapFileWrapper const &', 'arg0')])
+ ## pcap-file-wrapper.h: ns3::PcapFileWrapper::PcapFileWrapper() [constructor]
cls.add_constructor([])
- ## pcap-file-object.h: void ns3::PcapFileObject::Close() [member function]
+ ## pcap-file-wrapper.h: void ns3::PcapFileWrapper::Close() [member function]
cls.add_method('Close',
'void',
[])
- ## pcap-file-object.h: uint32_t ns3::PcapFileObject::GetDataLinkType() [member function]
+ ## pcap-file-wrapper.h: uint32_t ns3::PcapFileWrapper::GetDataLinkType() [member function]
cls.add_method('GetDataLinkType',
'uint32_t',
[])
- ## pcap-file-object.h: uint32_t ns3::PcapFileObject::GetMagic() [member function]
+ ## pcap-file-wrapper.h: uint32_t ns3::PcapFileWrapper::GetMagic() [member function]
cls.add_method('GetMagic',
'uint32_t',
[])
- ## pcap-file-object.h: uint32_t ns3::PcapFileObject::GetSigFigs() [member function]
+ ## pcap-file-wrapper.h: uint32_t ns3::PcapFileWrapper::GetSigFigs() [member function]
cls.add_method('GetSigFigs',
'uint32_t',
[])
- ## pcap-file-object.h: uint32_t ns3::PcapFileObject::GetSnapLen() [member function]
+ ## pcap-file-wrapper.h: uint32_t ns3::PcapFileWrapper::GetSnapLen() [member function]
cls.add_method('GetSnapLen',
'uint32_t',
[])
- ## pcap-file-object.h: int32_t ns3::PcapFileObject::GetTimeZoneOffset() [member function]
+ ## pcap-file-wrapper.h: int32_t ns3::PcapFileWrapper::GetTimeZoneOffset() [member function]
cls.add_method('GetTimeZoneOffset',
'int32_t',
[])
- ## pcap-file-object.h: static ns3::TypeId ns3::PcapFileObject::GetTypeId() [member function]
+ ## pcap-file-wrapper.h: static ns3::TypeId ns3::PcapFileWrapper::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
- ## pcap-file-object.h: uint16_t ns3::PcapFileObject::GetVersionMajor() [member function]
+ ## pcap-file-wrapper.h: uint16_t ns3::PcapFileWrapper::GetVersionMajor() [member function]
cls.add_method('GetVersionMajor',
'uint16_t',
[])
- ## pcap-file-object.h: uint16_t ns3::PcapFileObject::GetVersionMinor() [member function]
+ ## pcap-file-wrapper.h: uint16_t ns3::PcapFileWrapper::GetVersionMinor() [member function]
cls.add_method('GetVersionMinor',
'uint16_t',
[])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function]
cls.add_method('Init',
'bool',
[param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT')])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Open(std::string const & filename, std::string const & mode) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Open(std::string const & filename, std::string const & mode) [member function]
cls.add_method('Open',
'bool',
[param('std::string const &', 'filename'), param('std::string const &', 'mode')])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Write(ns3::Time t, ns3::Ptr<ns3::Packet const> p) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('Write',
'bool',
[param('ns3::Time', 't'), param('ns3::Ptr< ns3::Packet const >', 'p')])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Write(ns3::Time t, ns3::Header & header, ns3::Ptr<ns3::Packet const> p) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Header & header, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('Write',
'bool',
[param('ns3::Time', 't'), param('ns3::Header &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function]
cls.add_method('Write',
'bool',
[param('ns3::Time', 't'), param('uint8_t const *', 'buffer'), param('uint32_t', 'length')])
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_core.py Fri Feb 12 21:02:49 2010 -0800
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_core.py Tue Feb 23 10:04:31 2010 -0800
@@ -3060,11 +3060,11 @@
'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[param('void ( * ) ( ns3::Ptr< ns3::OutputStreamKeeper >, ns3::Ptr< ns3::Packet const > ) *', 'fnPtr'), param('ns3::Ptr< ns3::OutputStreamKeeper >', 'a')],
template_parameters=['void', 'ns3::Ptr<ns3::OutputStreamKeeper>', 'ns3::Ptr<ns3::OutputStreamKeeper>', 'ns3::Ptr<ns3::Packet const>'])
- ## callback.h: extern ns3::Callback<void,ns3::Ptr<const ns3::Packet>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::MakeBoundCallback(void (*)( ::ns3::Ptr<ns3::PcapFileObject>,::ns3::Ptr<ns3::Packet const> ) * fnPtr, ns3::Ptr<ns3::PcapFileObject> a) [free function]
+ ## callback.h: extern ns3::Callback<void,ns3::Ptr<const ns3::Packet>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::MakeBoundCallback(void (*)( ::ns3::Ptr<ns3::PcapFileWrapper>,::ns3::Ptr<ns3::Packet const> ) * fnPtr, ns3::Ptr<ns3::PcapFileWrapper> a) [free function]
module.add_function('MakeBoundCallback',
'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
- [param('void ( * ) ( ns3::Ptr< ns3::PcapFileObject >, ns3::Ptr< ns3::Packet const > ) *', 'fnPtr'), param('ns3::Ptr< ns3::PcapFileObject >', 'a')],
- template_parameters=['void', 'ns3::Ptr<ns3::PcapFileObject>', 'ns3::Ptr<ns3::PcapFileObject>', 'ns3::Ptr<ns3::Packet const>'])
+ [param('void ( * ) ( ns3::Ptr< ns3::PcapFileWrapper >, ns3::Ptr< ns3::Packet const > ) *', 'fnPtr'), param('ns3::Ptr< ns3::PcapFileWrapper >', 'a')],
+ template_parameters=['void', 'ns3::Ptr<ns3::PcapFileWrapper>', 'ns3::Ptr<ns3::PcapFileWrapper>', 'ns3::Ptr<ns3::Packet const>'])
## callback.h: extern ns3::Callback<void,std::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<const ns3::Packet>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::MakeBoundCallback(void (*)( ::ns3::Ptr<ns3::OutputStreamKeeper>,::std::basic_string<char,std::char_traits<char>,std::allocator<char> >,::ns3::Ptr<ns3::Packet const> ) * fnPtr, ns3::Ptr<ns3::OutputStreamKeeper> a) [free function]
module.add_function('MakeBoundCallback',
'ns3::Callback< void, std::basic_string< char, std::char_traits< char >, std::allocator< char > >, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_helper.py Fri Feb 12 21:02:49 2010 -0800
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_helper.py Tue Feb 23 10:04:31 2010 -0800
@@ -1336,9 +1336,9 @@
cls.add_constructor([param('ns3::PcapHelper const &', 'arg0')])
## trace-helper.h: ns3::PcapHelper::PcapHelper() [constructor]
cls.add_constructor([])
- ## trace-helper.h: ns3::Ptr<ns3::PcapFileObject> ns3::PcapHelper::CreateFile(std::string filename, std::string filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0) [member function]
+ ## trace-helper.h: ns3::Ptr<ns3::PcapFileWrapper> ns3::PcapHelper::CreateFile(std::string filename, std::string filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0) [member function]
cls.add_method('CreateFile',
- 'ns3::Ptr< ns3::PcapFileObject >',
+ 'ns3::Ptr< ns3::PcapFileWrapper >',
[param('std::string', 'filename'), param('std::string', 'filemode'), param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='65535'), param('int32_t', 'tzCorrection', default_value='0')])
## trace-helper.h: std::string ns3::PcapHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromDevice',
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_common.py Fri Feb 12 21:02:49 2010 -0800
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_common.py Tue Feb 23 10:04:31 2010 -0800
@@ -47,8 +47,8 @@
module.add_class('Chunk', parent=root_module['ns3::ObjectBase'])
## header.h: ns3::Header [class]
module.add_class('Header', parent=root_module['ns3::Chunk'])
- ## pcap-file-object.h: ns3::PcapFileObject [class]
- module.add_class('PcapFileObject', parent=root_module['ns3::Object'])
+ ## pcap-file-wrapper.h: ns3::PcapFileWrapper [class]
+ module.add_class('PcapFileWrapper', parent=root_module['ns3::Object'])
## propagation-delay-model.h: ns3::PropagationDelayModel [class]
module.add_class('PropagationDelayModel', parent=root_module['ns3::Object'])
## propagation-loss-model.h: ns3::PropagationLossModel [class]
@@ -197,7 +197,7 @@
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk'])
register_Ns3Header_methods(root_module, root_module['ns3::Header'])
- register_Ns3PcapFileObject_methods(root_module, root_module['ns3::PcapFileObject'])
+ register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
register_Ns3PropagationDelayModel_methods(root_module, root_module['ns3::PropagationDelayModel'])
register_Ns3PropagationLossModel_methods(root_module, root_module['ns3::PropagationLossModel'])
register_Ns3RandomPropagationDelayModel_methods(root_module, root_module['ns3::RandomPropagationDelayModel'])
@@ -987,65 +987,65 @@
is_pure_virtual=True, is_const=True, is_virtual=True)
return
-def register_Ns3PcapFileObject_methods(root_module, cls):
- ## pcap-file-object.h: ns3::PcapFileObject::PcapFileObject(ns3::PcapFileObject const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::PcapFileObject const &', 'arg0')])
- ## pcap-file-object.h: ns3::PcapFileObject::PcapFileObject() [constructor]
+def register_Ns3PcapFileWrapper_methods(root_module, cls):
+ ## pcap-file-wrapper.h: ns3::PcapFileWrapper::PcapFileWrapper(ns3::PcapFileWrapper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PcapFileWrapper const &', 'arg0')])
+ ## pcap-file-wrapper.h: ns3::PcapFileWrapper::PcapFileWrapper() [constructor]
cls.add_constructor([])
- ## pcap-file-object.h: void ns3::PcapFileObject::Close() [member function]
+ ## pcap-file-wrapper.h: void ns3::PcapFileWrapper::Close() [member function]
cls.add_method('Close',
'void',
[])
- ## pcap-file-object.h: uint32_t ns3::PcapFileObject::GetDataLinkType() [member function]
+ ## pcap-file-wrapper.h: uint32_t ns3::PcapFileWrapper::GetDataLinkType() [member function]
cls.add_method('GetDataLinkType',
'uint32_t',
[])
- ## pcap-file-object.h: uint32_t ns3::PcapFileObject::GetMagic() [member function]
+ ## pcap-file-wrapper.h: uint32_t ns3::PcapFileWrapper::GetMagic() [member function]
cls.add_method('GetMagic',
'uint32_t',
[])
- ## pcap-file-object.h: uint32_t ns3::PcapFileObject::GetSigFigs() [member function]
+ ## pcap-file-wrapper.h: uint32_t ns3::PcapFileWrapper::GetSigFigs() [member function]
cls.add_method('GetSigFigs',
'uint32_t',
[])
- ## pcap-file-object.h: uint32_t ns3::PcapFileObject::GetSnapLen() [member function]
+ ## pcap-file-wrapper.h: uint32_t ns3::PcapFileWrapper::GetSnapLen() [member function]
cls.add_method('GetSnapLen',
'uint32_t',
[])
- ## pcap-file-object.h: int32_t ns3::PcapFileObject::GetTimeZoneOffset() [member function]
+ ## pcap-file-wrapper.h: int32_t ns3::PcapFileWrapper::GetTimeZoneOffset() [member function]
cls.add_method('GetTimeZoneOffset',
'int32_t',
[])
- ## pcap-file-object.h: static ns3::TypeId ns3::PcapFileObject::GetTypeId() [member function]
+ ## pcap-file-wrapper.h: static ns3::TypeId ns3::PcapFileWrapper::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
- ## pcap-file-object.h: uint16_t ns3::PcapFileObject::GetVersionMajor() [member function]
+ ## pcap-file-wrapper.h: uint16_t ns3::PcapFileWrapper::GetVersionMajor() [member function]
cls.add_method('GetVersionMajor',
'uint16_t',
[])
- ## pcap-file-object.h: uint16_t ns3::PcapFileObject::GetVersionMinor() [member function]
+ ## pcap-file-wrapper.h: uint16_t ns3::PcapFileWrapper::GetVersionMinor() [member function]
cls.add_method('GetVersionMinor',
'uint16_t',
[])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function]
cls.add_method('Init',
'bool',
[param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT')])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Open(std::string const & filename, std::string const & mode) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Open(std::string const & filename, std::string const & mode) [member function]
cls.add_method('Open',
'bool',
[param('std::string const &', 'filename'), param('std::string const &', 'mode')])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Write(ns3::Time t, ns3::Ptr<ns3::Packet const> p) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('Write',
'bool',
[param('ns3::Time', 't'), param('ns3::Ptr< ns3::Packet const >', 'p')])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Write(ns3::Time t, ns3::Header & header, ns3::Ptr<ns3::Packet const> p) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Header & header, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('Write',
'bool',
[param('ns3::Time', 't'), param('ns3::Header &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')])
- ## pcap-file-object.h: bool ns3::PcapFileObject::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function]
+ ## pcap-file-wrapper.h: bool ns3::PcapFileWrapper::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function]
cls.add_method('Write',
'bool',
[param('ns3::Time', 't'), param('uint8_t const *', 'buffer'), param('uint32_t', 'length')])
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_core.py Fri Feb 12 21:02:49 2010 -0800
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_core.py Tue Feb 23 10:04:31 2010 -0800
@@ -3060,11 +3060,11 @@
'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[param('void ( * ) ( ns3::Ptr< ns3::OutputStreamKeeper >, ns3::Ptr< ns3::Packet const > ) *', 'fnPtr'), param('ns3::Ptr< ns3::OutputStreamKeeper >', 'a')],
template_parameters=['void', 'ns3::Ptr<ns3::OutputStreamKeeper>', 'ns3::Ptr<ns3::OutputStreamKeeper>', 'ns3::Ptr<ns3::Packet const>'])
- ## callback.h: extern ns3::Callback<void,ns3::Ptr<const ns3::Packet>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::MakeBoundCallback(void (*)( ::ns3::Ptr<ns3::PcapFileObject>,::ns3::Ptr<ns3::Packet const> ) * fnPtr, ns3::Ptr<ns3::PcapFileObject> a) [free function]
+ ## callback.h: extern ns3::Callback<void,ns3::Ptr<const ns3::Packet>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::MakeBoundCallback(void (*)( ::ns3::Ptr<ns3::PcapFileWrapper>,::ns3::Ptr<ns3::Packet const> ) * fnPtr, ns3::Ptr<ns3::PcapFileWrapper> a) [free function]
module.add_function('MakeBoundCallback',
'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
- [param('void ( * ) ( ns3::Ptr< ns3::PcapFileObject >, ns3::Ptr< ns3::Packet const > ) *', 'fnPtr'), param('ns3::Ptr< ns3::PcapFileObject >', 'a')],
- template_parameters=['void', 'ns3::Ptr<ns3::PcapFileObject>', 'ns3::Ptr<ns3::PcapFileObject>', 'ns3::Ptr<ns3::Packet const>'])
+ [param('void ( * ) ( ns3::Ptr< ns3::PcapFileWrapper >, ns3::Ptr< ns3::Packet const > ) *', 'fnPtr'), param('ns3::Ptr< ns3::PcapFileWrapper >', 'a')],
+ template_parameters=['void', 'ns3::Ptr<ns3::PcapFileWrapper>', 'ns3::Ptr<ns3::PcapFileWrapper>', 'ns3::Ptr<ns3::Packet const>'])
## callback.h: extern ns3::Callback<void,std::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<const ns3::Packet>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::MakeBoundCallback(void (*)( ::ns3::Ptr<ns3::OutputStreamKeeper>,::std::basic_string<char,std::char_traits<char>,std::allocator<char> >,::ns3::Ptr<ns3::Packet const> ) * fnPtr, ns3::Ptr<ns3::OutputStreamKeeper> a) [free function]
module.add_function('MakeBoundCallback',
'ns3::Callback< void, std::basic_string< char, std::char_traits< char >, std::allocator< char > >, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_helper.py Fri Feb 12 21:02:49 2010 -0800
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_helper.py Tue Feb 23 10:04:31 2010 -0800
@@ -1336,9 +1336,9 @@
cls.add_constructor([param('ns3::PcapHelper const &', 'arg0')])
## trace-helper.h: ns3::PcapHelper::PcapHelper() [constructor]
cls.add_constructor([])
- ## trace-helper.h: ns3::Ptr<ns3::PcapFileObject> ns3::PcapHelper::CreateFile(std::string filename, std::string filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0) [member function]
+ ## trace-helper.h: ns3::Ptr<ns3::PcapFileWrapper> ns3::PcapHelper::CreateFile(std::string filename, std::string filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0) [member function]
cls.add_method('CreateFile',
- 'ns3::Ptr< ns3::PcapFileObject >',
+ 'ns3::Ptr< ns3::PcapFileWrapper >',
[param('std::string', 'filename'), param('std::string', 'filemode'), param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='65535'), param('int32_t', 'tzCorrection', default_value='0')])
## trace-helper.h: std::string ns3::PcapHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromDevice',
--- a/doc/tutorial/tracing.texi Fri Feb 12 21:02:49 2010 -0800
+++ b/doc/tutorial/tracing.texi Tue Feb 23 10:04:31 2010 -0800
@@ -1944,7 +1944,7 @@
}
static void
- RxDrop (Ptr<PcapFileObject> file, Ptr<const Packet> p)
+ RxDrop (Ptr<PcapFileWrapper> file, Ptr<const Packet> p)
{
NS_LOG_UNCOND ("RxDrop at " << Simulator::Now ().GetSeconds ());
file->Write(Simulator::Now(), p);
@@ -1978,7 +1978,7 @@
any other output stream.
A similar situation happens in @code{RxDrop} except that the object being
-passed around (a @code{Ptr<PcapFileObject>}) represents a pcap file. There
+passed around (a @code{Ptr<PcapFileWrapper>}) represents a pcap file. There
is a one-liner in the trace sink to write a timestamp and the contents of the
packet being dropped to the pcap file:
@@ -1998,7 +1998,7 @@
...
PcapHelper pcapHelper;
- Ptr<PcapFileObject> file = pcapHelper.CreateFile ("sixth.pcap", "w", PcapHelper::DLT_PPP);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile ("sixth.pcap", "w", PcapHelper::DLT_PPP);
devices.Get (1)->TraceConnectWithoutContext("PhyRxDrop", MakeBoundCallback (&RxDrop, file));
@end verbatim
@@ -2030,7 +2030,7 @@
with the @code{AsciiTraceHelper}. The line of code,
@verbatim
- Ptr<PcapFileObject> file = pcapHelper.CreateFile ("sixth.pcap", "w", PcapHelper::DLT_PPP);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile ("sixth.pcap", "w", PcapHelper::DLT_PPP);
@end verbatim
creates a pcap file named ``sixth.pcap'' with file mode ``w''. This means that
@@ -2053,12 +2053,12 @@
objects are declared in very similar ways,
@verbatim
- Ptr<PcapFileObject> file ...
+ Ptr<PcapFileWrapper> file ...
Ptr<OutputStreamKeeper> stream ...
@end verbatim
The underlying objects are entirely different. For example, the
-Ptr<PcapFileObject> is a smart pointer to an @command{ns-3} Object that is a
+Ptr<PcapFileWrapper> is a smart pointer to an @command{ns-3} Object that is a
fairly heaviweight thing that supports @code{Attributes} and is integrated into
the config system. The Ptr<OutputStreamKeeper>, on the other hand, is a smart
pointer to a reference counted object that is a very lightweight thing.
@@ -2069,10 +2069,10 @@
distribution and notice,
@verbatim
- class PcapFileObject : public Object
+ class PcapFileWrapper : public Object
@end verbatim
-that class @code{PcapFileObject} is an @command{ns-3} Object by virtue of
+that class @code{PcapFileWrapper} is an @command{ns-3} Object by virtue of
its inheritance. Then look at @code{src/common/output-stream-keeper.h} and
notice,
@@ -2153,7 +2153,7 @@
...
static void
- RxDrop (Ptr<PcapFileObject> file, Ptr<const Packet> p)
+ RxDrop (Ptr<PcapFileWrapper> file, Ptr<const Packet> p)
{
NS_LOG_UNCOND ("RxDrop at " << Simulator::Now ().GetSeconds ());
file->Write(Simulator::Now(), p);
@@ -2162,7 +2162,7 @@
...
PcapHelper pcapHelper;
- Ptr<PcapFileObject> file = pcapHelper.CreateFile ("sixth.pcap", "w", PcapHelper::DLT_PPP);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile ("sixth.pcap", "w", PcapHelper::DLT_PPP);
devices.Get (1)->TraceConnectWithoutContext("PhyRxDrop", MakeBoundCallback (&RxDrop, file));
@end verbatim
--- a/examples/tutorial/sixth.cc Fri Feb 12 21:02:49 2010 -0800
+++ b/examples/tutorial/sixth.cc Tue Feb 23 10:04:31 2010 -0800
@@ -168,7 +168,7 @@
}
static void
-RxDrop (Ptr<PcapFileObject> file, Ptr<const Packet> p)
+RxDrop (Ptr<PcapFileWrapper> file, Ptr<const Packet> p)
{
NS_LOG_UNCOND ("RxDrop at " << Simulator::Now ().GetSeconds ());
file->Write(Simulator::Now(), p);
@@ -219,7 +219,7 @@
ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeBoundCallback (&CwndChange, stream));
PcapHelper pcapHelper;
- Ptr<PcapFileObject> file = pcapHelper.CreateFile ("sixth.pcap", "w", PcapHelper::DLT_PPP);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile ("sixth.pcap", "w", PcapHelper::DLT_PPP);
devices.Get (1)->TraceConnectWithoutContext("PhyRxDrop", MakeBoundCallback (&RxDrop, file));
Simulator::Stop (Seconds(20));
--- a/src/common/pcap-file-object.cc Fri Feb 12 21:02:49 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2009 University of Washington
- *
- * 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
- */
-
-#include "ns3/log.h"
-#include "ns3/uinteger.h"
-
-#include "buffer.h"
-#include "header.h"
-#include "pcap-file-object.h"
-
-NS_LOG_COMPONENT_DEFINE ("PcapFileObject");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (PcapFileObject);
-
-TypeId
-PcapFileObject::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::PcapFileObject")
- .SetParent<Object> ()
- .AddConstructor<PcapFileObject> ()
- .AddAttribute ("CaptureSize",
- "Maximum length of captured packets (cf. pcap snaplen)",
- UintegerValue (PcapFile::SNAPLEN_DEFAULT),
- MakeUintegerAccessor (&PcapFileObject::m_snapLen),
- MakeUintegerChecker<uint32_t> (0, PcapFile::SNAPLEN_DEFAULT))
- ;
- return tid;
-}
-
-
-PcapFileObject::PcapFileObject ()
-{
-}
-
-PcapFileObject::~PcapFileObject ()
-{
- Close ();
-}
-
-void
-PcapFileObject::Close (void)
-{
- m_file.Close ();
-}
-
-bool
-PcapFileObject::Open (std::string const &filename, std::string const &mode)
-{
- return m_file.Open (filename, mode);
-}
-
-bool
-PcapFileObject::Init (uint32_t dataLinkType, uint32_t snapLen, int32_t tzCorrection)
-{
- //
- // If the user doesn't provide a snaplen, the default value will come in. If
- // this happens, we use the "CaptureSize" Attribute. If the user does provide
- // a snaplen, we use the one provided.
- //
- if (snapLen != std::numeric_limits<uint32_t>::max ())
- {
- return m_file.Init (dataLinkType, snapLen, tzCorrection);
- }
- else
- {
- return m_file.Init (dataLinkType, m_snapLen, tzCorrection);
- }
-
- //
- // Quiet the compiler
- //
- return true;
-}
-
-bool
-PcapFileObject::Write (Time t, Ptr<const Packet> p)
-{
- uint8_t buffer[PcapFile::SNAPLEN_DEFAULT];
-
- uint64_t current = t.GetMicroSeconds ();
- uint64_t s = current / 1000000;
- uint64_t us = current % 1000000;
-
- uint32_t bufferSize = p->GetSize ();
- p->CopyData (buffer, bufferSize);
- bool rc = m_file.Write (s, us, buffer, bufferSize);
- return rc;
-}
-
-bool
-PcapFileObject::Write (Time t, Header &header, Ptr<const Packet> p)
-{
- uint8_t buffer[PcapFile::SNAPLEN_DEFAULT];
-
- uint64_t current = t.GetMicroSeconds ();
- uint64_t s = current / 1000000;
- uint64_t us = current % 1000000;
-
- Buffer headerBuffer;
- uint32_t headerSize = header.GetSerializedSize ();
- uint32_t packetSize = p->GetSize ();
- uint32_t bufferSize = headerSize + packetSize;
-
- headerBuffer.AddAtStart (headerSize);
- header.Serialize (headerBuffer.Begin ());
-
- headerBuffer.Begin ().Read (buffer, headerSize);
- p->CopyData (&buffer[headerSize], packetSize);
- bool rc = m_file.Write (s, us, buffer, bufferSize);
-
- return rc;
-}
-
-bool
-PcapFileObject::Write (Time t, uint8_t const *buffer, uint32_t length)
-{
- uint64_t current = t.GetMicroSeconds ();
- uint64_t s = current / 1000000;
- uint64_t us = current % 1000000;
-
- return m_file.Write (s, us, buffer, length);
-}
-
-uint32_t
-PcapFileObject::GetMagic (void)
-{
- return m_file.GetMagic ();
-}
-
-uint16_t
-PcapFileObject::GetVersionMajor (void)
-{
- return m_file.GetVersionMajor ();
-}
-
-uint16_t
-PcapFileObject::GetVersionMinor (void)
-{
- return m_file.GetVersionMinor ();
-}
-
-int32_t
-PcapFileObject::GetTimeZoneOffset (void)
-{
- return m_file.GetTimeZoneOffset ();
-}
-
-uint32_t
-PcapFileObject::GetSigFigs (void)
-{
- return m_file.GetSigFigs ();
-}
-
-uint32_t
-PcapFileObject::GetSnapLen (void)
-{
- return m_file.GetSnapLen ();
-}
-
-uint32_t
-PcapFileObject::GetDataLinkType (void)
-{
- return m_file.GetDataLinkType ();
-}
-
-} //namespace ns3
--- a/src/common/pcap-file-object.h Fri Feb 12 21:02:49 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2009 University of Washington
- *
- * 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
- */
-
-#ifndef PCAP_FILE_OBJECT_H
-#define PCAP_FILE_OBJECT_H
-
-#include <string.h>
-#include "ns3/ptr.h"
-#include "ns3/packet.h"
-#include "ns3/nstime.h"
-#include "pcap-file.h"
-
-namespace ns3 {
-
-/*
- * A class representing a pcap file tailored for use in model code.
- */
-
-class PcapFileObject : public Object
-{
-public:
- static TypeId GetTypeId (void);
-
- PcapFileObject ();
- ~PcapFileObject ();
-
- /**
- * Create a new pcap file object representing a new or existing pcap file.
- * Semantics are similar to the C standard library function \c fopen
- *
- * Possible modes are:
- *
- * \verbatim
- * "r": Open a file for reading. The file must exist. The pcap header
- * is assumed to exist in the file and will be read and checked.
- * The file seek position indicator is set to point to the first
- * packet on exit.
- *
- * "w": Create an empty file for writing. If a file with the same name
- * already exists its content is erased and the file is treated as a
- * new empty pcap file. The file is assumed not to have a pcap
- * header and the caller is responsible for calling Init before saving
- * any packet data. The file seek position indicator is set to point
- * to the beginning of the file on exit since there will be no pcap
- * header.
- *
- * "a": Append to an existing file. This mode allows for adding packet data
- * to the end of an existing pcap file. The file must exist and have a
- * valid pcap header written (N.B. this is different from standard fopen
- * semantics). The file seek position indicator is set to point
- * to the end of the file on exit.
- *
- * "r+": Open a file for update -- both reading and writing. The file must
- * exist. The pcap header is assumed to have been written to the
- * file and will be read and checked. The file seek position indicator
- * is set to point to the first packet on exit.
- *
- * "w+": Create an empty file for both reading and writing. If a file with
- * the same name already exists, its content is erased and the file is
- * treated as a new empty pcap file. Since this new file will not have
- * a pcap header, the caller is responsible for calling Init before
- * saving any packet data. On exit, the file seek position indicator is
- * set to point to the beginning of the file.
- *
- * "a+" Open a file for reading and appending. The file must exist and have a
- * valid pcap header written (N.B. this is different from standard fopen
- * semantics). The file seek position indicator is set to point
- * to the end of the file on exit. Existing content is preserved.
- * \endverbatim
- *
- * Since a pcap file is always a binary file, the file type is automatically
- * selected as a binary file. For example, providing a mode string "a+"
- * results in the underlying OS file being opened in "a+b" mode.
- *
- * \param filename String containing the name of the file.
- *
- * \param mode String containing the access mode for the file.
- *
- * \returns Error indication that should be interpreted as, "did an error
- * happen"? That is, the method returns false if the open succeeds, true
- * otherwise. The errno variable will be set by the OS to to provide a
- * more descriptive failure indication.
- */
- bool Open (std::string const &filename, std::string const &mode);
-
- /**
- * Close the underlying pcap file.
- */
- void Close (void);
-
- /**
- * Initialize the pcap file associated with this object. This file must have
- * been previously opened with write permissions.
- *
- * \param dataLinkType A data link type as defined in the pcap library. If
- * you want to make resulting pcap files visible in existing tools, the
- * data link type must match existing definitions, such as PCAP_ETHERNET,
- * PCAP_PPP, PCAP_80211, etc. If you are storing different kinds of packet
- * data, such as naked TCP headers, you are at liberty to locally define your
- * own data link types. According to the pcap-linktype man page, "well-known"
- * pcap linktypes range from 0 to 177. If you use a large random number for
- * your type, chances are small for a collision.
- *
- * \param snapLen An optional maximum size for packets written to the file.
- * Defaults to 65535. If packets exceed this length they are truncated.
- *
- * \param tzCorrection An integer describing the offset of your local
- * time zone from UTC/GMT. For example, Pacific Standard Time in the US is
- * GMT-8, so one would enter -8 for that correction. Defaults to 0 (UTC).
- *
- * \return false if the open succeeds, true otherwise.
- *
- * \warning Calling this method on an existing file will result in the loss
- * any existing data.
- */
- bool Init (uint32_t dataLinkType,
- uint32_t snapLen = std::numeric_limits<uint32_t>::max (),
- int32_t tzCorrection = PcapFile::ZONE_DEFAULT);
-
- /**
- * \brief Write the next packet to file
- *
- * \param t Packet timestamp as ns3::Time.
- * \param p Packet to write to the pcap file.
- *
- * \return true on error, false otherwise
- */
- bool Write (Time t, Ptr<const Packet> p);
-
- /**
- * \brief Write the provided header along with the packet to the pcap file.
- *
- * It is the case that adding a header to a packet prior to writing it to a
- * file must trigger a deep copy in the Packet. By providing the header
- * separately, we can avoid that copy.
- *
- * \param t Packet timestamp as ns3::Time.
- * \param header The Header to prepend to the packet.
- * \param p Packet to write to the pcap file.
- *
- * \return true on error, false otherwise
- */
- bool Write (Time t, Header &header, Ptr<const Packet> p);
-
- /**
- * \brief Write the provided data buffer to the pcap file.
- *
- * \param t Packet timestamp as ns3::Time.
- * \param buffer The buffer to write.
- * \param length The size of the buffer.
- *
- * \return true on error, false otherwise
- */
- bool Write (Time t, uint8_t const *buffer, uint32_t length);
-
- /*
- * \brief Returns the magic number of the pcap file as defined by the magic_number
- * field in the pcap global header.
- *
- * See http://wiki.wireshark.org/Development/LibpcapFileFormat
- */
- uint32_t GetMagic (void);
-
- /*
- * \brief Returns the major version of the pcap file as defined by the version_major
- * field in the pcap global header.
- *
- * See http://wiki.wireshark.org/Development/LibpcapFileFormat
- */
- uint16_t GetVersionMajor (void);
-
- /*
- * \brief Returns the minor version of the pcap file as defined by the version_minor
- * field in the pcap global header.
- *
- * See http://wiki.wireshark.org/Development/LibpcapFileFormat
- */
- uint16_t GetVersionMinor (void);
-
- /*
- * \brief Returns the time zone offset of the pcap file as defined by the thiszone
- * field in the pcap global header.
- *
- * See http://wiki.wireshark.org/Development/LibpcapFileFormat
- */
- int32_t GetTimeZoneOffset (void);
-
- /*
- * \brief Returns the accuracy of timestamps field of the pcap file as defined
- * by the sigfigs field in the pcap global header.
- *
- * See http://wiki.wireshark.org/Development/LibpcapFileFormat
- */
- uint32_t GetSigFigs (void);
-
- /*
- * \brief Returns the max length of saved packets field of the pcap file as
- * defined by the snaplen field in the pcap global header.
- *
- * See http://wiki.wireshark.org/Development/LibpcapFileFormat
- */
- uint32_t GetSnapLen (void);
-
- /*
- * \brief Returns the data link type field of the pcap file as defined by the
- * network field in the pcap global header.
- *
- * See http://wiki.wireshark.org/Development/LibpcapFileFormat
- */
- uint32_t GetDataLinkType (void);
-
-private:
- PcapFile m_file;
- uint32_t m_snapLen;
-};
-
-} //namespace ns3
-
-#endif // PCAP_FILE_OBJECT_H
-
--- a/src/common/pcap-file-test-suite.cc Fri Feb 12 21:02:49 2010 -0800
+++ b/src/common/pcap-file-test-suite.cc Tue Feb 23 10:04:31 2010 -0800
@@ -1013,7 +1013,7 @@
};
PcapFileTestSuite::PcapFileTestSuite ()
- : TestSuite ("pcap-file-object", UNIT)
+ : TestSuite ("pcap-file", UNIT)
{
AddTestCase (new WriteModeCreateTestCase);
AddTestCase (new ReadModeCreateTestCase);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/common/pcap-file-wrapper.cc Tue Feb 23 10:04:31 2010 -0800
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2009 University of Washington
+ *
+ * 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
+ */
+
+#include "ns3/log.h"
+#include "ns3/uinteger.h"
+
+#include "buffer.h"
+#include "header.h"
+#include "pcap-file-wrapper.h"
+
+NS_LOG_COMPONENT_DEFINE ("PcapFileWrapper");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (PcapFileWrapper);
+
+TypeId
+PcapFileWrapper::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::PcapFileWrapper")
+ .SetParent<Object> ()
+ .AddConstructor<PcapFileWrapper> ()
+ .AddAttribute ("CaptureSize",
+ "Maximum length of captured packets (cf. pcap snaplen)",
+ UintegerValue (PcapFile::SNAPLEN_DEFAULT),
+ MakeUintegerAccessor (&PcapFileWrapper::m_snapLen),
+ MakeUintegerChecker<uint32_t> (0, PcapFile::SNAPLEN_DEFAULT))
+ ;
+ return tid;
+}
+
+
+PcapFileWrapper::PcapFileWrapper ()
+{
+}
+
+PcapFileWrapper::~PcapFileWrapper ()
+{
+ Close ();
+}
+
+void
+PcapFileWrapper::Close (void)
+{
+ m_file.Close ();
+}
+
+bool
+PcapFileWrapper::Open (std::string const &filename, std::string const &mode)
+{
+ return m_file.Open (filename, mode);
+}
+
+bool
+PcapFileWrapper::Init (uint32_t dataLinkType, uint32_t snapLen, int32_t tzCorrection)
+{
+ //
+ // If the user doesn't provide a snaplen, the default value will come in. If
+ // this happens, we use the "CaptureSize" Attribute. If the user does provide
+ // a snaplen, we use the one provided.
+ //
+ if (snapLen != std::numeric_limits<uint32_t>::max ())
+ {
+ return m_file.Init (dataLinkType, snapLen, tzCorrection);
+ }
+ else
+ {
+ return m_file.Init (dataLinkType, m_snapLen, tzCorrection);
+ }
+
+ //
+ // Quiet the compiler
+ //
+ return true;
+}
+
+bool
+PcapFileWrapper::Write (Time t, Ptr<const Packet> p)
+{
+ uint8_t buffer[PcapFile::SNAPLEN_DEFAULT];
+
+ uint64_t current = t.GetMicroSeconds ();
+ uint64_t s = current / 1000000;
+ uint64_t us = current % 1000000;
+
+ uint32_t bufferSize = p->GetSize ();
+ p->CopyData (buffer, bufferSize);
+ bool rc = m_file.Write (s, us, buffer, bufferSize);
+ return rc;
+}
+
+bool
+PcapFileWrapper::Write (Time t, Header &header, Ptr<const Packet> p)
+{
+ uint8_t buffer[PcapFile::SNAPLEN_DEFAULT];
+
+ uint64_t current = t.GetMicroSeconds ();
+ uint64_t s = current / 1000000;
+ uint64_t us = current % 1000000;
+
+ Buffer headerBuffer;
+ uint32_t headerSize = header.GetSerializedSize ();
+ uint32_t packetSize = p->GetSize ();
+ uint32_t bufferSize = headerSize + packetSize;
+
+ headerBuffer.AddAtStart (headerSize);
+ header.Serialize (headerBuffer.Begin ());
+
+ headerBuffer.Begin ().Read (buffer, headerSize);
+ p->CopyData (&buffer[headerSize], packetSize);
+ bool rc = m_file.Write (s, us, buffer, bufferSize);
+
+ return rc;
+}
+
+bool
+PcapFileWrapper::Write (Time t, uint8_t const *buffer, uint32_t length)
+{
+ uint64_t current = t.GetMicroSeconds ();
+ uint64_t s = current / 1000000;
+ uint64_t us = current % 1000000;
+
+ return m_file.Write (s, us, buffer, length);
+}
+
+uint32_t
+PcapFileWrapper::GetMagic (void)
+{
+ return m_file.GetMagic ();
+}
+
+uint16_t
+PcapFileWrapper::GetVersionMajor (void)
+{
+ return m_file.GetVersionMajor ();
+}
+
+uint16_t
+PcapFileWrapper::GetVersionMinor (void)
+{
+ return m_file.GetVersionMinor ();
+}
+
+int32_t
+PcapFileWrapper::GetTimeZoneOffset (void)
+{
+ return m_file.GetTimeZoneOffset ();
+}
+
+uint32_t
+PcapFileWrapper::GetSigFigs (void)
+{
+ return m_file.GetSigFigs ();
+}
+
+uint32_t
+PcapFileWrapper::GetSnapLen (void)
+{
+ return m_file.GetSnapLen ();
+}
+
+uint32_t
+PcapFileWrapper::GetDataLinkType (void)
+{
+ return m_file.GetDataLinkType ();
+}
+
+} //namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/common/pcap-file-wrapper.h Tue Feb 23 10:04:31 2010 -0800
@@ -0,0 +1,234 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2009 University of Washington
+ *
+ * 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
+ */
+
+#ifndef PCAP_FILE_WRAPPER_H
+#define PCAP_FILE_WRAPPER_H
+
+#include <string.h>
+#include "ns3/ptr.h"
+#include "ns3/packet.h"
+#include "ns3/nstime.h"
+#include "pcap-file.h"
+
+namespace ns3 {
+
+/*
+ * A class representing a pcap file tailored for use in model code.
+ */
+
+class PcapFileWrapper : public Object
+{
+public:
+ static TypeId GetTypeId (void);
+
+ PcapFileWrapper ();
+ ~PcapFileWrapper ();
+
+ /**
+ * Create a new pcap file wrapper representing a new or existing pcap file.
+ * Semantics are similar to the C standard library function \c fopen
+ *
+ * Possible modes are:
+ *
+ * \verbatim
+ * "r": Open a file for reading. The file must exist. The pcap header
+ * is assumed to exist in the file and will be read and checked.
+ * The file seek position indicator is set to point to the first
+ * packet on exit.
+ *
+ * "w": Create an empty file for writing. If a file with the same name
+ * already exists its content is erased and the file is treated as a
+ * new empty pcap file. The file is assumed not to have a pcap
+ * header and the caller is responsible for calling Init before saving
+ * any packet data. The file seek position indicator is set to point
+ * to the beginning of the file on exit since there will be no pcap
+ * header.
+ *
+ * "a": Append to an existing file. This mode allows for adding packet data
+ * to the end of an existing pcap file. The file must exist and have a
+ * valid pcap header written (N.B. this is different from standard fopen
+ * semantics). The file seek position indicator is set to point
+ * to the end of the file on exit.
+ *
+ * "r+": Open a file for update -- both reading and writing. The file must
+ * exist. The pcap header is assumed to have been written to the
+ * file and will be read and checked. The file seek position indicator
+ * is set to point to the first packet on exit.
+ *
+ * "w+": Create an empty file for both reading and writing. If a file with
+ * the same name already exists, its content is erased and the file is
+ * treated as a new empty pcap file. Since this new file will not have
+ * a pcap header, the caller is responsible for calling Init before
+ * saving any packet data. On exit, the file seek position indicator is
+ * set to point to the beginning of the file.
+ *
+ * "a+" Open a file for reading and appending. The file must exist and have a
+ * valid pcap header written (N.B. this is different from standard fopen
+ * semantics). The file seek position indicator is set to point
+ * to the end of the file on exit. Existing content is preserved.
+ * \endverbatim
+ *
+ * Since a pcap file is always a binary file, the file type is automatically
+ * selected as a binary file. For example, providing a mode string "a+"
+ * results in the underlying OS file being opened in "a+b" mode.
+ *
+ * \param filename String containing the name of the file.
+ *
+ * \param mode String containing the access mode for the file.
+ *
+ * \returns Error indication that should be interpreted as, "did an error
+ * happen"? That is, the method returns false if the open succeeds, true
+ * otherwise. The errno variable will be set by the OS to to provide a
+ * more descriptive failure indication.
+ */
+ bool Open (std::string const &filename, std::string const &mode);
+
+ /**
+ * Close the underlying pcap file.
+ */
+ void Close (void);
+
+ /**
+ * Initialize the pcap file associated with this wrapper. This file must have
+ * been previously opened with write permissions.
+ *
+ * \param dataLinkType A data link type as defined in the pcap library. If
+ * you want to make resulting pcap files visible in existing tools, the
+ * data link type must match existing definitions, such as PCAP_ETHERNET,
+ * PCAP_PPP, PCAP_80211, etc. If you are storing different kinds of packet
+ * data, such as naked TCP headers, you are at liberty to locally define your
+ * own data link types. According to the pcap-linktype man page, "well-known"
+ * pcap linktypes range from 0 to 177. If you use a large random number for
+ * your type, chances are small for a collision.
+ *
+ * \param snapLen An optional maximum size for packets written to the file.
+ * Defaults to 65535. If packets exceed this length they are truncated.
+ *
+ * \param tzCorrection An integer describing the offset of your local
+ * time zone from UTC/GMT. For example, Pacific Standard Time in the US is
+ * GMT-8, so one would enter -8 for that correction. Defaults to 0 (UTC).
+ *
+ * \return false if the open succeeds, true otherwise.
+ *
+ * \warning Calling this method on an existing file will result in the loss
+ * any existing data.
+ */
+ bool Init (uint32_t dataLinkType,
+ uint32_t snapLen = std::numeric_limits<uint32_t>::max (),
+ int32_t tzCorrection = PcapFile::ZONE_DEFAULT);
+
+ /**
+ * \brief Write the next packet to file
+ *
+ * \param t Packet timestamp as ns3::Time.
+ * \param p Packet to write to the pcap file.
+ *
+ * \return true on error, false otherwise
+ */
+ bool Write (Time t, Ptr<const Packet> p);
+
+ /**
+ * \brief Write the provided header along with the packet to the pcap file.
+ *
+ * It is the case that adding a header to a packet prior to writing it to a
+ * file must trigger a deep copy in the Packet. By providing the header
+ * separately, we can avoid that copy.
+ *
+ * \param t Packet timestamp as ns3::Time.
+ * \param header The Header to prepend to the packet.
+ * \param p Packet to write to the pcap file.
+ *
+ * \return true on error, false otherwise
+ */
+ bool Write (Time t, Header &header, Ptr<const Packet> p);
+
+ /**
+ * \brief Write the provided data buffer to the pcap file.
+ *
+ * \param t Packet timestamp as ns3::Time.
+ * \param buffer The buffer to write.
+ * \param length The size of the buffer.
+ *
+ * \return true on error, false otherwise
+ */
+ bool Write (Time t, uint8_t const *buffer, uint32_t length);
+
+ /*
+ * \brief Returns the magic number of the pcap file as defined by the magic_number
+ * field in the pcap global header.
+ *
+ * See http://wiki.wireshark.org/Development/LibpcapFileFormat
+ */
+ uint32_t GetMagic (void);
+
+ /*
+ * \brief Returns the major version of the pcap file as defined by the version_major
+ * field in the pcap global header.
+ *
+ * See http://wiki.wireshark.org/Development/LibpcapFileFormat
+ */
+ uint16_t GetVersionMajor (void);
+
+ /*
+ * \brief Returns the minor version of the pcap file as defined by the version_minor
+ * field in the pcap global header.
+ *
+ * See http://wiki.wireshark.org/Development/LibpcapFileFormat
+ */
+ uint16_t GetVersionMinor (void);
+
+ /*
+ * \brief Returns the time zone offset of the pcap file as defined by the thiszone
+ * field in the pcap global header.
+ *
+ * See http://wiki.wireshark.org/Development/LibpcapFileFormat
+ */
+ int32_t GetTimeZoneOffset (void);
+
+ /*
+ * \brief Returns the accuracy of timestamps field of the pcap file as defined
+ * by the sigfigs field in the pcap global header.
+ *
+ * See http://wiki.wireshark.org/Development/LibpcapFileFormat
+ */
+ uint32_t GetSigFigs (void);
+
+ /*
+ * \brief Returns the max length of saved packets field of the pcap file as
+ * defined by the snaplen field in the pcap global header.
+ *
+ * See http://wiki.wireshark.org/Development/LibpcapFileFormat
+ */
+ uint32_t GetSnapLen (void);
+
+ /*
+ * \brief Returns the data link type field of the pcap file as defined by the
+ * network field in the pcap global header.
+ *
+ * See http://wiki.wireshark.org/Development/LibpcapFileFormat
+ */
+ uint32_t GetDataLinkType (void);
+
+private:
+ PcapFile m_file;
+ uint32_t m_snapLen;
+};
+
+} //namespace ns3
+
+#endif // PCAP_FILE_WRAPPER_H
--- a/src/common/wscript Fri Feb 12 21:02:49 2010 -0800
+++ b/src/common/wscript Tue Feb 23 10:04:31 2010 -0800
@@ -19,7 +19,7 @@
'nix-vector.cc',
'pcap-file.cc',
'pcap-file-test-suite.cc',
- 'pcap-file-object.cc',
+ 'pcap-file-wrapper.cc',
'output-stream-keeper.cc',
'propagation-delay-model.cc',
'propagation-loss-model.cc',
@@ -45,7 +45,7 @@
'nix-vector.h',
'sgi-hashmap.h',
'pcap-file.h',
- 'pcap-file-object.h',
+ 'pcap-file-wrapper.h',
'output-stream-keeper.h',
'propagation-delay-model.h',
'propagation-loss-model.h',
--- a/src/helper/csma-helper.cc Fri Feb 12 21:02:49 2010 -0800
+++ b/src/helper/csma-helper.cc Tue Feb 23 10:04:31 2010 -0800
@@ -88,7 +88,7 @@
PcapHelper pcapHelper;
std::string filename = pcapHelper.GetFilenameFromDevice (prefix, device);
- Ptr<PcapFileObject> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_EN10MB);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_EN10MB);
if (promiscuous)
{
pcapHelper.HookDefaultSink<CsmaNetDevice> (device, "PromiscSniffer", file);
--- a/src/helper/emu-helper.cc Fri Feb 12 21:02:49 2010 -0800
+++ b/src/helper/emu-helper.cc Tue Feb 23 10:04:31 2010 -0800
@@ -81,7 +81,7 @@
PcapHelper pcapHelper;
std::string filename = pcapHelper.GetFilenameFromDevice (prefix, device);
- Ptr<PcapFileObject> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_EN10MB);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_EN10MB);
if (promiscuous)
{
pcapHelper.HookDefaultSink<EmuNetDevice> (device, "PromiscSniffer", file);
--- a/src/helper/internet-stack-helper.cc Fri Feb 12 21:02:49 2010 -0800
+++ b/src/helper/internet-stack-helper.cc Tue Feb 23 10:04:31 2010 -0800
@@ -193,7 +193,7 @@
// are going to multiplex receive and transmit callbacks for all Ipv4 and
// interface pairs through one callback. We want packets to or from each
// distinct pair to go to an individual file, so we have got to demultiplex the
-// Ipv4 and interface pair into a corresponding Ptr<PcapFileObject> at the
+// Ipv4 and interface pair into a corresponding Ptr<PcapFileWrapper> at the
// callback.
//
// A complication in this situation is that the trace sources are hooked on
@@ -211,14 +211,14 @@
// bill.
//
typedef std::pair<Ptr<Ipv4>, uint32_t> InterfacePairIpv4;
-typedef std::map<InterfacePairIpv4, Ptr<PcapFileObject> > InterfaceFileMapIpv4;
+typedef std::map<InterfacePairIpv4, Ptr<PcapFileWrapper> > InterfaceFileMapIpv4;
typedef std::map<InterfacePairIpv4, Ptr<OutputStreamKeeper> > InterfaceStreamMapIpv4;
static InterfaceFileMapIpv4 g_interfaceFileMapIpv4; /**< A mapping of Ipv4/interface pairs to pcap files */
static InterfaceStreamMapIpv4 g_interfaceStreamMapIpv4; /**< A mapping of Ipv4/interface pairs to ascii streams */
typedef std::pair<Ptr<Ipv6>, uint32_t> InterfacePairIpv6;
-typedef std::map<InterfacePairIpv6, Ptr<PcapFileObject> > InterfaceFileMapIpv6;
+typedef std::map<InterfacePairIpv6, Ptr<PcapFileWrapper> > InterfaceFileMapIpv6;
typedef std::map<InterfacePairIpv6, Ptr<OutputStreamKeeper> > InterfaceStreamMapIpv6;
static InterfaceFileMapIpv6 g_interfaceFileMapIpv6; /**< A mapping of Ipv6/interface pairs to pcap files */
@@ -424,7 +424,7 @@
return;
}
- Ptr<PcapFileObject> file = g_interfaceFileMapIpv4[pair];
+ Ptr<PcapFileWrapper> file = g_interfaceFileMapIpv4[pair];
file->Write(Simulator::Now(), p);
}
@@ -460,7 +460,7 @@
//
PcapHelper pcapHelper;
std::string filename = pcapHelper.GetFilenameFromInterfacePair (prefix, ipv4, interface);
- Ptr<PcapFileObject> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_RAW);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_RAW);
//
// However, we only hook the trace source once to avoid multiple trace sink
@@ -506,7 +506,7 @@
return;
}
- Ptr<PcapFileObject> file = g_interfaceFileMapIpv6[pair];
+ Ptr<PcapFileWrapper> file = g_interfaceFileMapIpv6[pair];
file->Write(Simulator::Now(), p);
}
@@ -542,7 +542,7 @@
//
PcapHelper pcapHelper;
std::string filename = pcapHelper.GetFilenameFromInterfacePair (prefix, ipv6, interface);
- Ptr<PcapFileObject> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_RAW);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_RAW);
//
// However, we only hook the trace source once to avoid multiple trace sink
--- a/src/helper/point-to-point-helper.cc Fri Feb 12 21:02:49 2010 -0800
+++ b/src/helper/point-to-point-helper.cc Tue Feb 23 10:04:31 2010 -0800
@@ -85,7 +85,7 @@
PcapHelper pcapHelper;
std::string filename = pcapHelper.GetFilenameFromDevice (prefix, device);
- Ptr<PcapFileObject> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_PPP);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_PPP);
pcapHelper.HookDefaultSink<PointToPointNetDevice> (device, "PromiscSniffer", file);
}
--- a/src/helper/trace-helper.cc Fri Feb 12 21:02:49 2010 -0800
+++ b/src/helper/trace-helper.cc Tue Feb 23 10:04:31 2010 -0800
@@ -27,7 +27,7 @@
#include "ns3/node.h"
#include "ns3/names.h"
#include "ns3/net-device.h"
-#include "ns3/pcap-file-object.h"
+#include "ns3/pcap-file-wrapper.h"
#include "trace-helper.h"
@@ -45,7 +45,7 @@
NS_LOG_FUNCTION_NOARGS ();
}
-Ptr<PcapFileObject>
+Ptr<PcapFileWrapper>
PcapHelper::CreateFile (
std::string filename,
std::string filemode,
@@ -55,7 +55,7 @@
{
NS_LOG_FUNCTION (filename << filemode << dataLinkType << snapLen << tzCorrection);
- Ptr<PcapFileObject> file = CreateObject<PcapFileObject> ();
+ Ptr<PcapFileWrapper> file = CreateObject<PcapFileWrapper> ();
bool err = file->Open (filename, filemode);
NS_ABORT_MSG_IF (err, "Unable to Open " << filename << " for mode " << filemode);
@@ -164,7 +164,7 @@
// file which is good enough for most kinds of captures.
//
void
-PcapHelper::DefaultSink (Ptr<PcapFileObject> file, Ptr<const Packet> p)
+PcapHelper::DefaultSink (Ptr<PcapFileWrapper> file, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (file << p);
file->Write(Simulator::Now(), p);
--- a/src/helper/trace-helper.h Fri Feb 12 21:02:49 2010 -0800
+++ b/src/helper/trace-helper.h Tue Feb 23 10:04:31 2010 -0800
@@ -25,7 +25,7 @@
#include "ns3/ipv6-interface-container.h"
#include "ns3/node-container.h"
#include "ns3/simulator.h"
-#include "ns3/pcap-file-object.h"
+#include "ns3/pcap-file-wrapper.h"
#include "ns3/output-stream-keeper.h"
#include "ns3/ipv4.h"
#include "ns3/ipv6.h"
@@ -84,19 +84,19 @@
/**
* @brief Create and initialize a pcap file.
*/
- Ptr<PcapFileObject> CreateFile (std::string filename, std::string filemode,
+ Ptr<PcapFileWrapper> CreateFile (std::string filename, std::string filemode,
uint32_t dataLinkType, uint32_t snapLen = 65535, int32_t tzCorrection = 0);
/**
* @brief Hook a trace source to the default trace sink
*/
- template <typename T> void HookDefaultSink (Ptr<T> object, std::string traceName, Ptr<PcapFileObject> file);
+ template <typename T> void HookDefaultSink (Ptr<T> object, std::string traceName, Ptr<PcapFileWrapper> file);
private:
- static void DefaultSink (Ptr<PcapFileObject> file, Ptr<const Packet> p);
+ static void DefaultSink (Ptr<PcapFileWrapper> file, Ptr<const Packet> p);
};
template <typename T> void
-PcapHelper::HookDefaultSink (Ptr<T> object, std::string tracename, Ptr<PcapFileObject> file)
+PcapHelper::HookDefaultSink (Ptr<T> object, std::string tracename, Ptr<PcapFileWrapper> file)
{
bool __attribute__ ((unused)) result =
object->TraceConnectWithoutContext (tracename.c_str (), MakeBoundCallback (&DefaultSink, file));
--- a/src/helper/yans-wifi-helper.cc Fri Feb 12 21:02:49 2010 -0800
+++ b/src/helper/yans-wifi-helper.cc Tue Feb 23 10:04:31 2010 -0800
@@ -27,7 +27,7 @@
#include "ns3/yans-wifi-phy.h"
#include "ns3/wifi-net-device.h"
#include "ns3/radiotap-header.h"
-#include "ns3/pcap-file-object.h"
+#include "ns3/pcap-file-wrapper.h"
#include "ns3/simulator.h"
#include "ns3/config.h"
#include "ns3/names.h"
@@ -241,7 +241,7 @@
static void
PcapSniffTxEvent (
- Ptr<PcapFileObject> file,
+ Ptr<PcapFileWrapper> file,
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
@@ -299,7 +299,7 @@
static void
PcapSniffRxEvent (
- Ptr<PcapFileObject> file,
+ Ptr<PcapFileWrapper> file,
Ptr<const Packet> packet,
uint16_t channelFreqMhz,
uint16_t channelNumber,
@@ -400,7 +400,7 @@
PcapHelper pcapHelper;
std::string filename = pcapHelper.GetFilenameFromDevice (prefix, device);
- Ptr<PcapFileObject> file = pcapHelper.CreateFile (filename, "w", m_pcapDlt);
+ Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", m_pcapDlt);
phy->TraceConnectWithoutContext ("PromiscSnifferTx", MakeBoundCallback (&PcapSniffTxEvent, file));
phy->TraceConnectWithoutContext ("PromiscSnifferRx", MakeBoundCallback (&PcapSniffRxEvent, file));