--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_mesh.py Wed Dec 02 14:29:43 2009 -0800
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_mesh.py Wed Dec 02 15:11:49 2009 -0800
@@ -341,6 +341,11 @@
'ns3::Mac48Address',
[],
is_const=True)
+ ## mesh-wifi-interface-mac.h: ns3::WifiPhyStandard ns3::MeshWifiInterfaceMac::GetPhyStandard() const [member function]
+ cls.add_method('GetPhyStandard',
+ 'ns3::WifiPhyStandard',
+ [],
+ is_const=True)
## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetPifs() const [member function]
cls.add_method('GetPifs',
'ns3::Time',
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_node.py Wed Dec 02 14:29:43 2009 -0800
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_node.py Wed Dec 02 15:11:49 2009 -0800
@@ -2640,11 +2640,10 @@
'uint32_t',
[param('ns3::Buffer::Iterator', 'end')],
is_virtual=True)
- ## ethernet-trailer.h: static void ns3::EthernetTrailer::EnableFcs(bool enable) [member function]
+ ## ethernet-trailer.h: void ns3::EthernetTrailer::EnableFcs(bool enable) [member function]
cls.add_method('EnableFcs',
'void',
- [param('bool', 'enable')],
- is_static=True)
+ [param('bool', 'enable')])
## ethernet-trailer.h: uint32_t ns3::EthernetTrailer::GetFcs() [member function]
cls.add_method('GetFcs',
'uint32_t',
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_wifi.py Wed Dec 02 14:29:43 2009 -0800
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_wifi.py Wed Dec 02 15:11:49 2009 -0800
@@ -89,6 +89,22 @@
module.add_class('SimpleRefCount', template_parameters=['ns3::InterferenceHelper::Event', 'ns3::empty'], parent=root_module['ns3::empty'])
## propagation-loss-model.h: ns3::ThreeLogDistancePropagationLossModel [class]
module.add_class('ThreeLogDistancePropagationLossModel', parent=root_module['ns3::PropagationLossModel'])
+ ## mgt-headers.h: ns3::WifiActionHeader [class]
+ module.add_class('WifiActionHeader', parent=root_module['ns3::Header'])
+ ## mgt-headers.h: ns3::WifiActionHeader::CategoryValue [enumeration]
+ module.add_enum('CategoryValue', ['MESH_PEERING_MGT', 'MESH_LINK_METRIC', 'MESH_PATH_SELECTION', 'MESH_INTERWORKING', 'MESH_RESOURCE_COORDINATION', 'MESH_PROXY_FORWARDING'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::PeerLinkMgtActionValue [enumeration]
+ module.add_enum('PeerLinkMgtActionValue', ['PEER_LINK_OPEN', 'PEER_LINK_CONFIRM', 'PEER_LINK_CLOSE'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::LinkMetricActionValue [enumeration]
+ module.add_enum('LinkMetricActionValue', ['LINK_METRIC_REQUEST', 'LINK_METRIC_REPORT'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::PathSelectionActionValue [enumeration]
+ module.add_enum('PathSelectionActionValue', ['PATH_SELECTION'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::InterworkActionValue [enumeration]
+ module.add_enum('InterworkActionValue', ['PORTAL_ANNOUNCEMENT'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::ResourceCoordinationActionValue [enumeration]
+ module.add_enum('ResourceCoordinationActionValue', ['CONGESTION_CONTROL_NOTIFICATION', 'MDA_SETUP_REQUEST', 'MDA_SETUP_REPLY', 'MDAOP_ADVERTISMENT_REQUEST', 'MDAOP_ADVERTISMENTS', 'MDAOP_SET_TEARDOWN', 'BEACON_TIMING_REQUEST', 'BEACON_TIMING_RESPONSE', 'TBTT_ADJUSTMENT_REQUEST', 'MESH_CHANNEL_SWITCH_ANNOUNCEMENT'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue [union]
+ module.add_class('ActionValue', outer_class=root_module['ns3::WifiActionHeader'])
## wifi-mac.h: ns3::WifiMac [class]
module.add_class('WifiMac', parent=root_module['ns3::Object'])
## wifi-mac-header.h: ns3::WifiMacHeader [class]
@@ -305,6 +321,8 @@
register_Ns3RandomPropagationLossModel_methods(root_module, root_module['ns3::RandomPropagationLossModel'])
register_Ns3RraaWifiRemoteStation_methods(root_module, root_module['ns3::RraaWifiRemoteStation'])
register_Ns3ThreeLogDistancePropagationLossModel_methods(root_module, root_module['ns3::ThreeLogDistancePropagationLossModel'])
+ register_Ns3WifiActionHeader_methods(root_module, root_module['ns3::WifiActionHeader'])
+ register_Ns3WifiActionHeaderActionValue_methods(root_module, root_module['ns3::WifiActionHeader::ActionValue'])
register_Ns3WifiMac_methods(root_module, root_module['ns3::WifiMac'])
register_Ns3WifiMacHeader_methods(root_module, root_module['ns3::WifiMacHeader'])
register_Ns3WifiPhy_methods(root_module, root_module['ns3::WifiPhy'])
@@ -2145,6 +2163,72 @@
is_const=True, visibility='private', is_virtual=True)
return
+def register_Ns3WifiActionHeader_methods(root_module, cls):
+ ## mgt-headers.h: ns3::WifiActionHeader::WifiActionHeader(ns3::WifiActionHeader const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::WifiActionHeader const &', 'arg0')])
+ ## mgt-headers.h: ns3::WifiActionHeader::WifiActionHeader() [constructor]
+ cls.add_constructor([])
+ ## mgt-headers.h: uint32_t ns3::WifiActionHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
+ cls.add_method('Deserialize',
+ 'uint32_t',
+ [param('ns3::Buffer::Iterator', 'start')],
+ is_virtual=True)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue ns3::WifiActionHeader::GetAction() [member function]
+ cls.add_method('GetAction',
+ 'ns3::WifiActionHeader::ActionValue',
+ [])
+ ## mgt-headers.h: ns3::WifiActionHeader::CategoryValue ns3::WifiActionHeader::GetCategory() [member function]
+ cls.add_method('GetCategory',
+ 'ns3::WifiActionHeader::CategoryValue',
+ [])
+ ## mgt-headers.h: ns3::TypeId ns3::WifiActionHeader::GetInstanceTypeId() const [member function]
+ cls.add_method('GetInstanceTypeId',
+ 'ns3::TypeId',
+ [],
+ is_const=True, is_virtual=True)
+ ## mgt-headers.h: uint32_t ns3::WifiActionHeader::GetSerializedSize() const [member function]
+ cls.add_method('GetSerializedSize',
+ 'uint32_t',
+ [],
+ is_const=True, is_virtual=True)
+ ## mgt-headers.h: static ns3::TypeId ns3::WifiActionHeader::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## mgt-headers.h: void ns3::WifiActionHeader::Print(std::ostream & os) const [member function]
+ cls.add_method('Print',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True, is_virtual=True)
+ ## mgt-headers.h: void ns3::WifiActionHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
+ cls.add_method('Serialize',
+ 'void',
+ [param('ns3::Buffer::Iterator', 'start')],
+ is_const=True, is_virtual=True)
+ ## mgt-headers.h: void ns3::WifiActionHeader::SetAction(ns3::WifiActionHeader::CategoryValue type, ns3::WifiActionHeader::ActionValue action) [member function]
+ cls.add_method('SetAction',
+ 'void',
+ [param('ns3::WifiActionHeader::CategoryValue', 'type'), param('ns3::WifiActionHeader::ActionValue', 'action')])
+ return
+
+def register_Ns3WifiActionHeaderActionValue_methods(root_module, cls):
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::ActionValue() [constructor]
+ cls.add_constructor([])
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::ActionValue(ns3::WifiActionHeader::ActionValue const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::WifiActionHeader::ActionValue const &', 'arg0')])
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::interwork [variable]
+ cls.add_instance_attribute('interwork', 'ns3::WifiActionHeader::InterworkActionValue', is_const=False)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::linkMetrtic [variable]
+ cls.add_instance_attribute('linkMetrtic', 'ns3::WifiActionHeader::LinkMetricActionValue', is_const=False)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::pathSelection [variable]
+ cls.add_instance_attribute('pathSelection', 'ns3::WifiActionHeader::PathSelectionActionValue', is_const=False)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::peerLink [variable]
+ cls.add_instance_attribute('peerLink', 'ns3::WifiActionHeader::PeerLinkMgtActionValue', is_const=False)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::resourceCoordination [variable]
+ cls.add_instance_attribute('resourceCoordination', 'ns3::WifiActionHeader::ResourceCoordinationActionValue', is_const=False)
+ return
+
def register_Ns3WifiMac_methods(root_module, cls):
## wifi-mac.h: ns3::WifiMac::WifiMac() [constructor]
cls.add_constructor([])
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_mesh.py Wed Dec 02 14:29:43 2009 -0800
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_mesh.py Wed Dec 02 15:11:49 2009 -0800
@@ -341,6 +341,11 @@
'ns3::Mac48Address',
[],
is_const=True)
+ ## mesh-wifi-interface-mac.h: ns3::WifiPhyStandard ns3::MeshWifiInterfaceMac::GetPhyStandard() const [member function]
+ cls.add_method('GetPhyStandard',
+ 'ns3::WifiPhyStandard',
+ [],
+ is_const=True)
## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetPifs() const [member function]
cls.add_method('GetPifs',
'ns3::Time',
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_node.py Wed Dec 02 14:29:43 2009 -0800
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_node.py Wed Dec 02 15:11:49 2009 -0800
@@ -2640,11 +2640,10 @@
'uint32_t',
[param('ns3::Buffer::Iterator', 'end')],
is_virtual=True)
- ## ethernet-trailer.h: static void ns3::EthernetTrailer::EnableFcs(bool enable) [member function]
+ ## ethernet-trailer.h: void ns3::EthernetTrailer::EnableFcs(bool enable) [member function]
cls.add_method('EnableFcs',
'void',
- [param('bool', 'enable')],
- is_static=True)
+ [param('bool', 'enable')])
## ethernet-trailer.h: uint32_t ns3::EthernetTrailer::GetFcs() [member function]
cls.add_method('GetFcs',
'uint32_t',
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_wifi.py Wed Dec 02 14:29:43 2009 -0800
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_wifi.py Wed Dec 02 15:11:49 2009 -0800
@@ -89,6 +89,22 @@
module.add_class('SimpleRefCount', template_parameters=['ns3::InterferenceHelper::Event', 'ns3::empty'], parent=root_module['ns3::empty'])
## propagation-loss-model.h: ns3::ThreeLogDistancePropagationLossModel [class]
module.add_class('ThreeLogDistancePropagationLossModel', parent=root_module['ns3::PropagationLossModel'])
+ ## mgt-headers.h: ns3::WifiActionHeader [class]
+ module.add_class('WifiActionHeader', parent=root_module['ns3::Header'])
+ ## mgt-headers.h: ns3::WifiActionHeader::CategoryValue [enumeration]
+ module.add_enum('CategoryValue', ['MESH_PEERING_MGT', 'MESH_LINK_METRIC', 'MESH_PATH_SELECTION', 'MESH_INTERWORKING', 'MESH_RESOURCE_COORDINATION', 'MESH_PROXY_FORWARDING'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::PeerLinkMgtActionValue [enumeration]
+ module.add_enum('PeerLinkMgtActionValue', ['PEER_LINK_OPEN', 'PEER_LINK_CONFIRM', 'PEER_LINK_CLOSE'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::LinkMetricActionValue [enumeration]
+ module.add_enum('LinkMetricActionValue', ['LINK_METRIC_REQUEST', 'LINK_METRIC_REPORT'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::PathSelectionActionValue [enumeration]
+ module.add_enum('PathSelectionActionValue', ['PATH_SELECTION'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::InterworkActionValue [enumeration]
+ module.add_enum('InterworkActionValue', ['PORTAL_ANNOUNCEMENT'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::ResourceCoordinationActionValue [enumeration]
+ module.add_enum('ResourceCoordinationActionValue', ['CONGESTION_CONTROL_NOTIFICATION', 'MDA_SETUP_REQUEST', 'MDA_SETUP_REPLY', 'MDAOP_ADVERTISMENT_REQUEST', 'MDAOP_ADVERTISMENTS', 'MDAOP_SET_TEARDOWN', 'BEACON_TIMING_REQUEST', 'BEACON_TIMING_RESPONSE', 'TBTT_ADJUSTMENT_REQUEST', 'MESH_CHANNEL_SWITCH_ANNOUNCEMENT'], outer_class=root_module['ns3::WifiActionHeader'])
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue [union]
+ module.add_class('ActionValue', outer_class=root_module['ns3::WifiActionHeader'])
## wifi-mac.h: ns3::WifiMac [class]
module.add_class('WifiMac', parent=root_module['ns3::Object'])
## wifi-mac-header.h: ns3::WifiMacHeader [class]
@@ -305,6 +321,8 @@
register_Ns3RandomPropagationLossModel_methods(root_module, root_module['ns3::RandomPropagationLossModel'])
register_Ns3RraaWifiRemoteStation_methods(root_module, root_module['ns3::RraaWifiRemoteStation'])
register_Ns3ThreeLogDistancePropagationLossModel_methods(root_module, root_module['ns3::ThreeLogDistancePropagationLossModel'])
+ register_Ns3WifiActionHeader_methods(root_module, root_module['ns3::WifiActionHeader'])
+ register_Ns3WifiActionHeaderActionValue_methods(root_module, root_module['ns3::WifiActionHeader::ActionValue'])
register_Ns3WifiMac_methods(root_module, root_module['ns3::WifiMac'])
register_Ns3WifiMacHeader_methods(root_module, root_module['ns3::WifiMacHeader'])
register_Ns3WifiPhy_methods(root_module, root_module['ns3::WifiPhy'])
@@ -2145,6 +2163,72 @@
is_const=True, visibility='private', is_virtual=True)
return
+def register_Ns3WifiActionHeader_methods(root_module, cls):
+ ## mgt-headers.h: ns3::WifiActionHeader::WifiActionHeader(ns3::WifiActionHeader const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::WifiActionHeader const &', 'arg0')])
+ ## mgt-headers.h: ns3::WifiActionHeader::WifiActionHeader() [constructor]
+ cls.add_constructor([])
+ ## mgt-headers.h: uint32_t ns3::WifiActionHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
+ cls.add_method('Deserialize',
+ 'uint32_t',
+ [param('ns3::Buffer::Iterator', 'start')],
+ is_virtual=True)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue ns3::WifiActionHeader::GetAction() [member function]
+ cls.add_method('GetAction',
+ 'ns3::WifiActionHeader::ActionValue',
+ [])
+ ## mgt-headers.h: ns3::WifiActionHeader::CategoryValue ns3::WifiActionHeader::GetCategory() [member function]
+ cls.add_method('GetCategory',
+ 'ns3::WifiActionHeader::CategoryValue',
+ [])
+ ## mgt-headers.h: ns3::TypeId ns3::WifiActionHeader::GetInstanceTypeId() const [member function]
+ cls.add_method('GetInstanceTypeId',
+ 'ns3::TypeId',
+ [],
+ is_const=True, is_virtual=True)
+ ## mgt-headers.h: uint32_t ns3::WifiActionHeader::GetSerializedSize() const [member function]
+ cls.add_method('GetSerializedSize',
+ 'uint32_t',
+ [],
+ is_const=True, is_virtual=True)
+ ## mgt-headers.h: static ns3::TypeId ns3::WifiActionHeader::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## mgt-headers.h: void ns3::WifiActionHeader::Print(std::ostream & os) const [member function]
+ cls.add_method('Print',
+ 'void',
+ [param('std::ostream &', 'os')],
+ is_const=True, is_virtual=True)
+ ## mgt-headers.h: void ns3::WifiActionHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
+ cls.add_method('Serialize',
+ 'void',
+ [param('ns3::Buffer::Iterator', 'start')],
+ is_const=True, is_virtual=True)
+ ## mgt-headers.h: void ns3::WifiActionHeader::SetAction(ns3::WifiActionHeader::CategoryValue type, ns3::WifiActionHeader::ActionValue action) [member function]
+ cls.add_method('SetAction',
+ 'void',
+ [param('ns3::WifiActionHeader::CategoryValue', 'type'), param('ns3::WifiActionHeader::ActionValue', 'action')])
+ return
+
+def register_Ns3WifiActionHeaderActionValue_methods(root_module, cls):
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::ActionValue() [constructor]
+ cls.add_constructor([])
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::ActionValue(ns3::WifiActionHeader::ActionValue const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::WifiActionHeader::ActionValue const &', 'arg0')])
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::interwork [variable]
+ cls.add_instance_attribute('interwork', 'ns3::WifiActionHeader::InterworkActionValue', is_const=False)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::linkMetrtic [variable]
+ cls.add_instance_attribute('linkMetrtic', 'ns3::WifiActionHeader::LinkMetricActionValue', is_const=False)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::pathSelection [variable]
+ cls.add_instance_attribute('pathSelection', 'ns3::WifiActionHeader::PathSelectionActionValue', is_const=False)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::peerLink [variable]
+ cls.add_instance_attribute('peerLink', 'ns3::WifiActionHeader::PeerLinkMgtActionValue', is_const=False)
+ ## mgt-headers.h: ns3::WifiActionHeader::ActionValue::resourceCoordination [variable]
+ cls.add_instance_attribute('resourceCoordination', 'ns3::WifiActionHeader::ResourceCoordinationActionValue', is_const=False)
+ return
+
def register_Ns3WifiMac_methods(root_module, cls):
## wifi-mac.h: ns3::WifiMac::WifiMac() [constructor]
cls.add_constructor([])
--- a/src/devices/csma/csma-net-device.cc Wed Dec 02 14:29:43 2009 -0800
+++ b/src/devices/csma/csma-net-device.cc Wed Dec 02 15:11:49 2009 -0800
@@ -429,15 +429,14 @@
p->AddTrailer (trailer);
}
+#if 0
bool
CsmaNetDevice::ProcessHeader (Ptr<Packet> p, uint16_t & param)
{
NS_LOG_FUNCTION (p << param);
EthernetTrailer trailer;
-
p->RemoveTrailer (trailer);
- trailer.CheckFcs (p);
EthernetHeader header (false);
p->RemoveHeader (header);
@@ -467,6 +466,7 @@
}
return true;
}
+#endif
void
CsmaNetDevice::TransmitStart (void)
@@ -755,7 +755,15 @@
{
trailer.EnableFcs (true);
}
+
trailer.CheckFcs (packet);
+ bool crcGood = trailer.CheckFcs (packet);
+ if (!crcGood)
+ {
+ NS_LOG_INFO ("CRC error on Packet " << packet);
+ m_phyRxDropTrace (packet);
+ return;
+ }
EthernetHeader header (false);
packet->RemoveHeader (header);
--- a/src/devices/csma/csma-net-device.h Wed Dec 02 14:29:43 2009 -0800
+++ b/src/devices/csma/csma-net-device.h Wed Dec 02 15:11:49 2009 -0800
@@ -48,11 +48,6 @@
* The Csma net device class is analogous to layer 1 and 2 of the
* TCP stack. The NetDevice takes a raw packet of bytes and creates a
* protocol specific packet from them.
- *
- * Each Csma net device will receive all packets written to the Csma link.
- * The ProcessHeader function can be used to filter out the packets such that
- * higher level layers only receive packets that are addressed to their
- * associated net devices
*/
class CsmaNetDevice : public NetDevice
{
@@ -440,18 +435,6 @@
*/
void AddHeader (Ptr<Packet> p, Mac48Address source, Mac48Address dest, uint16_t protocolNumber);
- /**
- * Removes, from a packet of data, all headers and trailers that
- * relate to the packet type
- *
- * \param p Packet whose headers need to be processed
- * \param param An integer parameter that can be set by the function
- * to return information gathered in the header
- * \return Returns true if the packet should be forwarded up the
- * protocol stack.
- */
- bool ProcessHeader (Ptr<Packet> p, uint16_t & param);
-
private:
/**
--- a/src/node/ethernet-trailer.cc Wed Dec 02 14:29:43 2009 -0800
+++ b/src/node/ethernet-trailer.cc Wed Dec 02 15:11:49 2009 -0800
@@ -41,7 +41,7 @@
}
bool
-EthernetTrailer::CheckFcs (Ptr<Packet> p) const
+EthernetTrailer::CheckFcs (Ptr<const Packet> p) const
{
int len = p->GetSize ();
uint8_t *buffer;
@@ -60,7 +60,7 @@
}
void
-EthernetTrailer::CalcFcs (Ptr<Packet> p)
+EthernetTrailer::CalcFcs (Ptr<const Packet> p)
{
int len = p->GetSize ();
uint8_t *buffer;
@@ -142,7 +142,7 @@
// This code is copied from /lib/crc32.c in the linux kernel.
// It assumes little endian ordering.
uint32_t
-EthernetTrailer::DoCalcFcs (uint8_t *buffer, size_t len) const
+EthernetTrailer::DoCalcFcs (uint8_t const *buffer, size_t len) const
{
uint32_t crc = 0xffffffff;
int i;
--- a/src/node/ethernet-trailer.h Wed Dec 02 14:29:43 2009 -0800
+++ b/src/node/ethernet-trailer.h Wed Dec 02 15:11:49 2009 -0800
@@ -34,8 +34,7 @@
* \brief Packet trailer for Ethernet
*
* This class can be used to add and verify the FCS at the end of an
- * ethernet packet. The actual FCS functionality is not yet coded and
- * so this acts more as a placeholder.
+ * Ethernet packet.
*/
class EthernetTrailer : public Trailer
{
@@ -50,32 +49,41 @@
* \param enable If true, enables FCS calculations.
*/
void EnableFcs (bool enable);
+
/**
* \brief Updates the Fcs Field to the correct FCS
* \param p Reference to a packet on which the FCS should be
- * calculated. The packet should not currently contain an FCS
- * trailer.
+ * calculated. The packet should not currently contain an
+ * EthernetTrailer.
*/
- void CalcFcs (Ptr<Packet> p);
+ void CalcFcs (Ptr<const Packet> p);
+
/**
* \brief Sets the FCS to a new value
* \param fcs New FCS value
*/
void SetFcs (uint32_t fcs);
+
/**
* \return the FCS contained in this trailer
*/
uint32_t GetFcs ();
/**
- * \param p Reference to the packet on which the FCS should be
- * calculated. The packet should not contain an FCS trailer.
- * \return Returns true if the packet fcs is correct, false otherwise.
+ * Calculate an FCS on the provided packet and check this value against
+ * the FCS found when the trailer was deserialized (the one in the transmitted
+ * packet).
*
* If FCS checking is disabled, this method will always
* return true.
+ *
+ * \param p Reference to the packet on which the FCS should be
+ * calculated. The packet should not contain an EthernetTrailer.
+ *
+ * \return Returns true if the Packet FCS matches the FCS in the trailer,
+ * false otherwise.
*/
- bool CheckFcs (Ptr<Packet> p) const;
+ bool CheckFcs (Ptr<const Packet> p) const;
/**
*\return Returns the size of the trailer
@@ -90,17 +98,16 @@
virtual uint32_t Deserialize (Buffer::Iterator end);
private:
/**
- * Enabled FCS calculations. If false, fcs is set to 0 and checkFCS
+ * Enabled FCS calculations. If false, m_fcs is set to 0 and CheckFcs
* returns true.
*/
bool m_calcFcs;
uint32_t m_fcs; /// Value of the fcs contained in the trailer
- uint32_t DoCalcFcs (uint8_t *buffer, size_t len) const;
+ uint32_t DoCalcFcs (uint8_t const *buffer, size_t len) const;
};
} // namespace ns3
-
#endif /* ETHERNET_TRAILER_H */