From 3a643012d79b731efc35078cfdc82e830fb770b3 Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Tue, 17 Jan 2017 02:23:43 +0100 Subject: [PATCH] sixlowpan: doxygen updates (thanks to Robert Ammon) --- .../test/sixlowpan-fragmentation-test.cc | 90 ++++++++++++++----- src/sixlowpan/test/sixlowpan-hc1-test.cc | 41 ++++++++- src/sixlowpan/test/sixlowpan-iphc-test.cc | 47 +++++++++- 3 files changed, 152 insertions(+), 26 deletions(-) diff --git a/src/sixlowpan/test/sixlowpan-fragmentation-test.cc b/src/sixlowpan/test/sixlowpan-fragmentation-test.cc index d59076ee1..e651dc4e8 100644 --- a/src/sixlowpan/test/sixlowpan-fragmentation-test.cc +++ b/src/sixlowpan/test/sixlowpan-fragmentation-test.cc @@ -44,19 +44,25 @@ using namespace ns3; +/** + * \ingroup sixlowpan-test + * \ingroup tests + * + * \brief 6LoWPAN Fragmentation Test + */ class SixlowpanFragmentationTest : public TestCase { - Ptr m_sentPacketClient; - Ptr m_receivedPacketClient; - Ptr m_receivedPacketServer; + Ptr m_sentPacketClient; //!< Packet sent by client. + Ptr m_receivedPacketClient; //!< Packet received by the client. + Ptr m_receivedPacketServer; //!< packet received by the server. - Ptr m_socketServer; - Ptr m_socketClient; - uint32_t m_dataSize; - uint8_t *m_data; - uint32_t m_size; - uint8_t m_icmpType; - uint8_t m_icmpCode; + Ptr m_socketServer; //!< Socket on the server. + Ptr m_socketClient; //!< Socket on the client. + uint32_t m_dataSize; //!< Size of the data (if any). + uint8_t *m_data; //!< Data to be carried in the packet + uint32_t m_size; //!< Size of the packet if no data has been provided. + uint8_t m_icmpType; //!< ICMP type. + uint8_t m_icmpCode; //!< ICMP code. public: virtual void DoRun (void); @@ -64,16 +70,51 @@ public: ~SixlowpanFragmentationTest (); // server part - void StartServer (Ptr ServerNode); + + /** + * Start the server node. + * \param serverNode The server node. + */ + void StartServer (Ptr serverNode); + /** + * Handles incoming packets in the server. + * \param socket The receiving socket. + */ void HandleReadServer (Ptr socket); // client part - void StartClient (Ptr ClientNode); - void HandleReadClient (Ptr socket); - void HandleReadIcmpClient (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, - uint8_t icmpCode,uint32_t icmpInfo); + /** + * Start the client node. + * \param clientNode The client node. + */ + void StartClient (Ptr clientNode); + /** + * Handles incoming packets in the client. + * \param socket The receiving socket. + */ + void HandleReadClient (Ptr socket); + /** + * Handles incoming ICMP packets in the client. + * \param icmpSource ICMP sender address. + * \param icmpTtl ICMP TTL. + * \param icmpType ICMP type. + * \param icmpCode ICMP code. + * \param icmpInfo ICMP info. + */ + void HandleReadIcmpClient (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, + uint8_t icmpCode, uint32_t icmpInfo); + /** + * Set the packet optional content. + * \param fill Pointer to an array of data. + * \param fillSize Size of the array of data. + * \param dataSize Size of the packet - if fillSize is less than dataSize, the data is repeated. + */ void SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize); + /** + * Send a packet to the server. + * \returns The packet sent. + */ Ptr SendClient (void); }; @@ -102,13 +143,13 @@ SixlowpanFragmentationTest::~SixlowpanFragmentationTest () void -SixlowpanFragmentationTest::StartServer (Ptr ServerNode) +SixlowpanFragmentationTest::StartServer (Ptr serverNode) { if (m_socketServer == 0) { TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); - m_socketServer = Socket::CreateSocket (ServerNode, tid); + m_socketServer = Socket::CreateSocket (serverNode, tid); Inet6SocketAddress local = Inet6SocketAddress (Ipv6Address ("2001:0100::1"), 9); m_socketServer->Bind (local); Ptr udpSocket = DynamicCast (m_socketServer); @@ -135,13 +176,13 @@ SixlowpanFragmentationTest::HandleReadServer (Ptr socket) } void -SixlowpanFragmentationTest::StartClient (Ptr ClientNode) +SixlowpanFragmentationTest::StartClient (Ptr clientNode) { if (m_socketClient == 0) { TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); - m_socketClient = Socket::CreateSocket (ClientNode, tid); + m_socketClient = Socket::CreateSocket (clientNode, tid); m_socketClient->Bind (Inet6SocketAddress (Ipv6Address::GetAny (), 9)); m_socketClient->Connect (Inet6SocketAddress (Ipv6Address ("2001:0100::1"), 9)); CallbackValue cbValue = MakeCallback (&SixlowpanFragmentationTest::HandleReadIcmpClient, this); @@ -416,11 +457,16 @@ SixlowpanFragmentationTest::DoRun (void) // Note that a 6LoWPAN fragment timeout does NOT send any ICMPv6. } - - Simulator::Destroy (); } -//----------------------------------------------------------------------------- + + +/** + * \ingroup sixlowpan-test + * \ingroup tests + * + * \brief 6LoWPAN Fragmentation TestSuite + */ class SixlowpanFragmentationTestSuite : public TestSuite { public: diff --git a/src/sixlowpan/test/sixlowpan-hc1-test.cc b/src/sixlowpan/test/sixlowpan-hc1-test.cc index b4c677e93..ebd4d5f55 100644 --- a/src/sixlowpan/test/sixlowpan-hc1-test.cc +++ b/src/sixlowpan/test/sixlowpan-hc1-test.cc @@ -39,17 +39,49 @@ using namespace ns3; +/** + * \ingroup sixlowpan-test + * \ingroup tests + * + * \brief 6LoWPAN HC1 Test + */ class SixlowpanHc1ImplTest : public TestCase { - Ptr m_receivedPacket; + Ptr m_receivedPacket; //!< received packet + + /** + * Send data function. + * + * \param socket The sending socket. + * \param to The destination. + */ void DoSendData (Ptr socket, std::string to); + + /** + * Send data function. + * + * \param socket The sending socket. + * \param to The destination. + */ void SendData (Ptr socket, std::string to); public: virtual void DoRun (void); SixlowpanHc1ImplTest (); + /** + * Packet receive function. + * + * \param socket The receiving socket. + * \param packet The received packet. + * \param from The sender. + */ void ReceivePacket (Ptr socket, Ptr packet, const Address &from); + /** + * Packet receive function. + * + * \param socket The receiving socket. + */ void ReceivePkt (Ptr socket); }; @@ -178,7 +210,12 @@ SixlowpanHc1ImplTest::DoRun (void) } -//----------------------------------------------------------------------------- +/** + * \ingroup sixlowpan-test + * \ingroup tests + * + * \brief 6LoWPAN HC1 TestSuite + */ class SixlowpanHc1TestSuite : public TestSuite { public: diff --git a/src/sixlowpan/test/sixlowpan-iphc-test.cc b/src/sixlowpan/test/sixlowpan-iphc-test.cc index b4542e001..b0102c46b 100644 --- a/src/sixlowpan/test/sixlowpan-iphc-test.cc +++ b/src/sixlowpan/test/sixlowpan-iphc-test.cc @@ -39,17 +39,55 @@ using namespace ns3; +/** + * \ingroup sixlowpan + * \defgroup sixlowpan-test 6LoWPAN module tests + */ + + +/** + * \ingroup sixlowpan-test + * \ingroup tests + * + * \brief 6LoWPAN IPHC Test + */ class SixlowpanIphcImplTest : public TestCase { - Ptr m_receivedPacket; + Ptr m_receivedPacket; //!< received packet + + /** + * Send data function. + * + * \param socket The sending socket. + * \param to The destination. + */ void DoSendData (Ptr socket, std::string to); + + /** + * Send data function. + * + * \param socket The sending socket. + * \param to The destination. + */ void SendData (Ptr socket, std::string to); public: virtual void DoRun (void); SixlowpanIphcImplTest (); + /** + * Packet receive function. + * + * \param socket The receiving socket. + * \param packet The received packet. + * \param from The sender. + */ void ReceivePacket (Ptr socket, Ptr packet, const Address &from); + /** + * Packet receive function. + * + * \param socket The receiving socket. + */ void ReceivePkt (Ptr socket); }; @@ -176,7 +214,12 @@ SixlowpanIphcImplTest::DoRun (void) } -//----------------------------------------------------------------------------- +/** + * \ingroup sixlowpan-test + * \ingroup tests + * + * \brief 6LoWPAN IPHC TestSuite + */ class SixlowpanIphcTestSuite : public TestSuite { public: