src/internet-node/ipv4-header.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 17 Mar 2008 14:49:52 -0700
changeset 2646 c1fef7686472
parent 2643 2a3324f4dabe
child 2834 1aab57845b07
permissions -rw-r--r--
remove dead code.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
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
 * All rights reserved.
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
 *
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
 * 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
     7
 * 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
     8
 * 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
     9
 *
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
 * 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
    11
 * 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
    12
 * 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
    13
 * 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
    14
 *
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
 * 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
    16
 * 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
    17
 * 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
    18
 *
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
 * 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
    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
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
#ifndef IPV4_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
#define IPV4_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
    24
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
    25
#include "ns3/header.h"
524
082ffdd8fbd7 move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 463
diff changeset
    26
#include "ns3/ipv4-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
    27
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
    28
namespace ns3 {
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    29
/**
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    30
 * \brief Packet header for IPv4
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    31
 */
1126
06484dd65e76 add GetUid methods to all headers and trailers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 795
diff changeset
    32
class Ipv4Header : public Header 
06484dd65e76 add GetUid methods to all headers and trailers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 795
diff changeset
    33
{
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
    34
public:
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    35
  /**
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    36
   * \brief Construct a null IPv4 header
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    37
   */
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
    38
  Ipv4Header ();
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    39
  /**
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    40
   * \brief Enable checksum calculation for IP (XXX currently has no effect)
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    41
   */
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
    42
  static void EnableChecksums (void);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    43
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    44
   * \param size the size of the payload in bytes
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    45
   */
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
    46
  void SetPayloadSize (uint16_t size);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    47
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    48
   * \param identification the Identification field of IPv4 packets.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    49
   *
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    50
   * By default, set to zero.
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    51
   */
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
    52
  void SetIdentification (uint16_t identification);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    53
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    54
   * \param tos the 8 bits of Ipv4 TOS.
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
  void SetTos (uint8_t tos);
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    57
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    58
   * This packet is not the last packet of a fragmented ipv4 packet.
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    59
   */
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
    60
  void SetMoreFragments (void);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    61
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    62
   * This packet is the last packet of a fragmented ipv4 packet.
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    63
   */
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
    64
  void SetLastFragment (void);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    65
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    66
   * Don't fragment this packet: if you need to anyway, drop it.
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    67
   */
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
    68
  void SetDontFragment (void);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    69
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    70
   * If you need to fragment this packet, you can do it.
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    71
   */
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
    72
  void SetMayFragment (void);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    73
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    74
   * \param offset the ipv4 fragment offset
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    75
   */
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
    76
  void SetFragmentOffset (uint16_t offset);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    77
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    78
   * \param ttl the ipv4 TTL
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    79
   */
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    80
  void SetTtl (uint8_t ttl);
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    81
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    82
   * \param num the ipv4 protocol field
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    83
   */
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    84
  void SetProtocol (uint8_t num);
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    85
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    86
   * \param source the source of this packet
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    87
   */
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
    88
  void SetSource (Ipv4Address source);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    89
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    90
   * \param destination the destination of this packet.
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    91
   */
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
    92
  void SetDestination (Ipv4Address destination);
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    93
  /**
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    94
   * \returns the size of the payload in bytes
632
1e419ebb4012 Internet-node module dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 524
diff changeset
    95
   */
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
    96
  uint16_t GetPayloadSize (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    97
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    98
   * \returns the identification field of this packet.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
    99
   */
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
   100
  uint16_t GetIdentification (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   101
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   102
   * \returns the TOS field of this packet.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   103
   */
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
   104
  uint8_t GetTos (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   105
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   106
   * \returns true if this is the last fragment of a packet, false otherwise.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   107
   */
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
   108
  bool IsLastFragment (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   109
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   110
   * \returns true if this is this packet can be fragmented.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   111
   */  
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
   112
  bool IsDontFragment (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   113
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   114
   * \returns the offset of this fragment.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   115
   */
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
   116
  uint16_t GetFragmentOffset (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   117
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   118
   * \returns the TTL field of this packet
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   119
   */
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
   120
  uint8_t GetTtl (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   121
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   122
   * \returns the protocol field of this packet
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   123
   */
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
   124
  uint8_t GetProtocol (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   125
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   126
   * \returns the source address of this packet
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   127
   */
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
   128
  Ipv4Address GetSource (void) const;
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   129
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   130
   * \returns the destination address of this packet
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   131
   */
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
   132
  Ipv4Address GetDestination (void) const;
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
   133
  
640
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   134
  /**
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   135
   * \returns true if the upv4 checksum is correct, false otherwise.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   136
   *
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   137
   * If Ipv4Header::EnableChecksums has not been called prior to
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   138
   * creating this packet, this method will always return true.
028db47a657f beautify the dox output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 632
diff changeset
   139
   */
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
   140
  bool IsChecksumOk (void) const;
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
   141
2646
c1fef7686472 remove dead code.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2643
diff changeset
   142
  static TypeId GetTypeId (void);
c1fef7686472 remove dead code.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2643
diff changeset
   143
  virtual TypeId GetInstanceTypeId (void) const;
c1fef7686472 remove dead code.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2643
diff changeset
   144
  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
   145
  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
   146
  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
   147
  virtual uint32_t Deserialize (Buffer::Iterator start);
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
   148
private:
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
   149
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
  enum FlagsE {
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
    DONT_FRAGMENT = (1<<0),
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
   152
    MORE_FRAGMENTS = (1<<1)
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
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
   155
  static bool m_calcChecksum;
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
   156
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
   157
  uint16_t m_payloadSize;
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
   158
  uint16_t m_identification;
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
   159
  uint32_t m_tos : 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
   160
  uint32_t m_ttl : 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
   161
  uint32_t m_protocol : 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
   162
  uint32_t m_flags : 3;
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
   163
  uint16_t m_fragmentOffset : 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
   164
  Ipv4Address m_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
   165
  Ipv4Address m_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
   166
  bool m_goodChecksum;
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
   167
};
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
   168
1232
2e8c3f8bb77f remove Chunk base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1151
diff changeset
   169
} // 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
   170
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
   171
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
   172
#endif /* IPV4_HEADER_H */