src/internet/model/udp-header.h
changeset 7717 cfa1741013dd
parent 7385 10beb0e53130
child 10440 1e48ff9185f1
equal deleted inserted replaced
7714:6ee8ada63117 7717:cfa1741013dd
    23 
    23 
    24 #include <stdint.h>
    24 #include <stdint.h>
    25 #include <string>
    25 #include <string>
    26 #include "ns3/header.h"
    26 #include "ns3/header.h"
    27 #include "ns3/ipv4-address.h"
    27 #include "ns3/ipv4-address.h"
       
    28 #include "ns3/ipv6-address.h"
    28 
    29 
    29 namespace ns3 {
    30 namespace ns3 {
    30 /**
    31 /**
    31  * \ingroup udp
    32  * \ingroup udp
    32  * \brief Packet header for UDP packets
    33  * \brief Packet header for UDP packets
    77    *        ip packet.
    78    *        ip packet.
    78    *
    79    *
    79    * If you want to use udp checksums, you should call this
    80    * If you want to use udp checksums, you should call this
    80    * method prior to adding the header to a packet.
    81    * method prior to adding the header to a packet.
    81    */
    82    */
       
    83   void InitializeChecksum (Address source, 
       
    84                            Address destination,
       
    85                            uint8_t protocol);
       
    86 
       
    87   /**
       
    88    * \param source the ip source to use in the underlying
       
    89    *        ip packet.
       
    90    * \param destination the ip destination to use in the
       
    91    *        underlying ip packet.
       
    92    * \param protocol the protocol number to use in the underlying
       
    93    *        ip packet.
       
    94    *
       
    95    * If you want to use udp checksums, you should call this
       
    96    * method prior to adding the header to a packet.
       
    97    */
    82   void InitializeChecksum (Ipv4Address source, 
    98   void InitializeChecksum (Ipv4Address source, 
    83                            Ipv4Address destination,
    99                            Ipv4Address destination,
       
   100                            uint8_t protocol);
       
   101 
       
   102   /**
       
   103    * \param source the ip source to use in the underlying
       
   104    *        ip packet.
       
   105    * \param destination the ip destination to use in the
       
   106    *        underlying ip packet.
       
   107    * \param protocol the protocol number to use in the underlying
       
   108    *        ip packet.
       
   109    *
       
   110    * If you want to use udp checksums, you should call this
       
   111    * method prior to adding the header to a packet.
       
   112    */
       
   113   void InitializeChecksum (Ipv6Address source, 
       
   114                            Ipv6Address destination,
    84                            uint8_t protocol);
   115                            uint8_t protocol);
    85 
   116 
    86   static TypeId GetTypeId (void);
   117   static TypeId GetTypeId (void);
    87   virtual TypeId GetInstanceTypeId (void) const;
   118   virtual TypeId GetInstanceTypeId (void) const;
    88   virtual void Print (std::ostream &os) const;
   119   virtual void Print (std::ostream &os) const;
   100   uint16_t CalculateHeaderChecksum (uint16_t size) const;
   131   uint16_t CalculateHeaderChecksum (uint16_t size) const;
   101   uint16_t m_sourcePort;
   132   uint16_t m_sourcePort;
   102   uint16_t m_destinationPort;
   133   uint16_t m_destinationPort;
   103   uint16_t m_payloadSize;
   134   uint16_t m_payloadSize;
   104 
   135 
   105   Ipv4Address m_source;
   136   Address m_source;
   106   Ipv4Address m_destination;
   137   Address m_destination;
   107   uint8_t m_protocol;
   138   uint8_t m_protocol;
   108   bool m_calcChecksum;
   139   bool m_calcChecksum;
   109   bool m_goodChecksum;
   140   bool m_goodChecksum;
   110 };
   141 };
   111 
   142