src/internet/model/udp-header.h
author Tommaso Pecorella <tommaso.pecorella@unifi.it>
Wed, 20 Nov 2013 20:15:02 +0100
changeset 10440 1e48ff9185f1
parent 7717 cfa1741013dd
child 10479 fc4ee8106e4a
permissions -rw-r--r--
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Mileti? <rivanvx@gmail.com>
parents: 6834
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005 INRIA
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#ifndef UDP_HEADER_H
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#define UDP_HEADER_H
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <stdint.h>
1133
2878564d62ff fix valgrind warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1126
diff changeset
    25
#include <string>
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
#include "ns3/header.h"
524
082ffdd8fbd7 move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 463
diff changeset
    27
#include "ns3/ipv4-address.h"
7717
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    28
#include "ns3/ipv6-address.h"
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
namespace ns3 {
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    31
/**
3691
372f4475dc47 Doxygen for internet-stack
Tom Henderson <tomh@tomh.org>
parents: 3404
diff changeset
    32
 * \ingroup udp
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    33
 * \brief Packet header for UDP packets
3266
1ae7df5cf87b Update the internet-stack documentation
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3260
diff changeset
    34
 *
1ae7df5cf87b Update the internet-stack documentation
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3260
diff changeset
    35
 * This class has fields corresponding to those in a network UDP header
1ae7df5cf87b Update the internet-stack documentation
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3260
diff changeset
    36
 * (port numbers, payload size, checksum) as well as methods for serialization
1ae7df5cf87b Update the internet-stack documentation
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3260
diff changeset
    37
 * to and deserialization from a byte buffer.
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    38
 */
1126
06484dd65e76 add GetUid methods to all headers and trailers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 795
diff changeset
    39
class UdpHeader : public Header 
06484dd65e76 add GetUid methods to all headers and trailers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 795
diff changeset
    40
{
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
public:
1126
06484dd65e76 add GetUid methods to all headers and trailers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 795
diff changeset
    42
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    43
  /**
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    44
   * \brief Constructor
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    45
   *
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    46
   * Creates a null header
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    47
   */
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
  UdpHeader ();
1232
2e8c3f8bb77f remove Chunk base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1151
diff changeset
    49
  ~UdpHeader ();
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    51
  /**
4564
d44aeedf416a remove obsolete XXX from UdpHeader API
Tom Henderson <tomh@tomh.org>
parents: 3691
diff changeset
    52
   * \brief Enable checksum calculation for UDP 
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    53
   */
3363
33d1ca2e4ba4 bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 3266
diff changeset
    54
  void EnableChecksums (void);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    55
  /**
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    56
   * \param port the destination port for this UdpHeader
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    57
   */
3238
3b24ac252fba bug 195: naming inconsistency.
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
    58
  void SetDestinationPort (uint16_t port);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    59
  /**
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    60
   * \param port The source port for this UdpHeader
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    61
   */
3238
3b24ac252fba bug 195: naming inconsistency.
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
    62
  void SetSourcePort (uint16_t port);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    63
  /**
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    64
   * \return The source port for this UdpHeader
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    65
   */
3238
3b24ac252fba bug 195: naming inconsistency.
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
    66
  uint16_t GetSourcePort (void) const;
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    67
  /**
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    68
   * \return the destination port for this UdpHeader
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    69
   */
3238
3b24ac252fba bug 195: naming inconsistency.
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
    70
  uint16_t GetDestinationPort (void) const;
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    72
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    73
   * \param source the ip source to use in the underlying
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    74
   *        ip packet.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    75
   * \param destination the ip destination to use in the
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    76
   *        underlying ip packet.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    77
   * \param protocol the protocol number to use in the underlying
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    78
   *        ip packet.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    79
   *
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    80
   * If you want to use udp checksums, you should call this
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    81
   * method prior to adding the header to a packet.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    82
   */
7717
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    83
  void InitializeChecksum (Address source, 
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    84
                           Address destination,
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    85
                           uint8_t protocol);
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    86
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    87
  /**
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    88
   * \param source the ip source to use in the underlying
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    89
   *        ip packet.
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    90
   * \param destination the ip destination to use in the
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    91
   *        underlying ip packet.
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    92
   * \param protocol the protocol number to use in the underlying
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    93
   *        ip packet.
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    94
   *
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    95
   * If you want to use udp checksums, you should call this
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    96
   * method prior to adding the header to a packet.
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
    97
   */
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
  void InitializeChecksum (Ipv4Address source, 
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
                           Ipv4Address destination,
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
                           uint8_t protocol);
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
7717
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   102
  /**
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   103
   * \param source the ip source to use in the underlying
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   104
   *        ip packet.
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   105
   * \param destination the ip destination to use in the
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   106
   *        underlying ip packet.
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   107
   * \param protocol the protocol number to use in the underlying
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   108
   *        ip packet.
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   109
   *
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   110
   * If you want to use udp checksums, you should call this
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   111
   * method prior to adding the header to a packet.
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   112
   */
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   113
  void InitializeChecksum (Ipv6Address source, 
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   114
                           Ipv6Address destination,
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   115
                           uint8_t protocol);
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7385
diff changeset
   116
10440
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   117
  /**
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   118
   * \brief Get the type ID.
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   119
   * \return the object TypeId
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   120
   */
2646
c1fef7686472 remove dead code.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2643
diff changeset
   121
  static TypeId GetTypeId (void);
c1fef7686472 remove dead code.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2643
diff changeset
   122
  virtual TypeId GetInstanceTypeId (void) const;
c1fef7686472 remove dead code.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2643
diff changeset
   123
  virtual void Print (std::ostream &os) const;
2643
2a3324f4dabe define a TypeId for each Header/Trailer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1232
diff changeset
   124
  virtual uint32_t GetSerializedSize (void) const;
2a3324f4dabe define a TypeId for each Header/Trailer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1232
diff changeset
   125
  virtual void Serialize (Buffer::Iterator start) const;
2a3324f4dabe define a TypeId for each Header/Trailer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1232
diff changeset
   126
  virtual uint32_t Deserialize (Buffer::Iterator start);
1232
2e8c3f8bb77f remove Chunk base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1151
diff changeset
   127
3363
33d1ca2e4ba4 bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 3266
diff changeset
   128
  /**
33d1ca2e4ba4 bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 3266
diff changeset
   129
   * \brief Is the UDP checksum correct ?
33d1ca2e4ba4 bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 3266
diff changeset
   130
   * \returns true if the checksum is correct, false otherwise.
33d1ca2e4ba4 bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 3266
diff changeset
   131
   */
33d1ca2e4ba4 bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 3266
diff changeset
   132
  bool IsChecksumOk (void) const;
33d1ca2e4ba4 bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 3266
diff changeset
   133
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
private:
10440
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   135
  /**
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   136
   * \brief Calculate the header checksum
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   137
   * \param size packet size
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   138
   * \returns the checksum
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   139
   */
3404
b5d4a04c7b68 bug 247: tcp checksum crashes when enabled.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3363
diff changeset
   140
  uint16_t CalculateHeaderChecksum (uint16_t size) const;
10440
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   141
  uint16_t m_sourcePort;      //!< Source port
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   142
  uint16_t m_destinationPort; //!< Destination port
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   143
  uint16_t m_payloadSize;     //!< Payload size
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   144
10440
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   145
  Address m_source;           //!< Source IP address
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   146
  Address m_destination;      //!< Destination IP address
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   147
  uint8_t m_protocol;         //!< Protocol number
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   148
  bool m_calcChecksum;        //!< Flag to calculate checksum
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7717
diff changeset
   149
  bool m_goodChecksum;        //!< Flag to indicate that checksum is correct
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
};
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
1232
2e8c3f8bb77f remove Chunk base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1151
diff changeset
   152
} // namespace ns3
235
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
190d5bef3254 add ipv4 and udp header, add ipv4 checksum support to make the udp header compile. Need to be fixed in UdpHeader later.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   154
#endif /* UDP_HEADER */