src/internet/model/ipv6-raw-socket-impl.h
author Ken Renard <kdrenard2@gmail.com>
Mon, 20 Feb 2012 14:05:07 +0100
changeset 7717 cfa1741013dd
parent 7696 142e062124f4
child 10405 45c8fceae24e
permissions -rw-r--r--
Add support for IPv6 transport protocols
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Mileti? <rivanvx@gmail.com>
parents: 7176
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     2
/*
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     3
 * Copyright (c) 2007-2009 Strasbourg University
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     4
 *
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     8
 *
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    13
 *
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    17
 *
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    18
 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    19
 */
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    20
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    21
#ifndef IPV6_RAW_SOCKET_IMPL_H
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    22
#define IPV6_RAW_SOCKET_IMPL_H
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    23
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    24
#include <list>
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    25
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    26
#include "ns3/socket.h"
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    27
#include "ns3/ipv6-address.h"
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    28
#include "ns3/ipv6-header.h"
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    29
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    30
namespace ns3
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    31
{
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    32
 
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    33
class NetDevice;
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    34
class Node;
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    35
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    36
/**
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    37
 * \class Ipv6RawSocketImpl
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    38
 * \brief IPv6 raw socket.
7650
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    39
 *
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    40
 * A RAW Socket typically is used to access specific IP layers not usually
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    41
 * available through L4 sockets, e.g., ICMP. The implementer should take
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    42
 * particular care to define the Ipv6RawSocketImpl Attributes, and in
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    43
 * particular the Protocol attribute.
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    44
 * Not setting it will result in a zero protocol at IP level (corresponding
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    45
 * to the HopByHop IPv6 Extension header, i.e., Ipv6ExtensionHopByHopHeader)
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    46
 * when sending data through the socket, which is probably not the intended
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    47
 * behavior.
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    48
 *
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    49
 * A correct example is (from src/applications/model/radvd.cc):
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    50
 * \code
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    51
   if (!m_socket)
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    52
     {
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    53
       TypeId tid = TypeId::LookupByName ("ns3::Ipv6RawSocketFactory");
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    54
       m_socket = Socket::CreateSocket (GetNode (), tid);
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    55
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    56
       NS_ASSERT (m_socket);
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    57
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    58
       m_socket->SetAttribute ("Protocol", UintegerValue(Ipv6Header::IPV6_ICMPV6));
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    59
       m_socket->SetRecvCallback (MakeCallback (&Radvd::HandleRead, this));
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    60
     }
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    61
 * \endcode
46bfff3026b7 Bug 1318 - Clarify the Ipv6RawSocket documentation.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7385
diff changeset
    62
 *
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    63
 */
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    64
class Ipv6RawSocketImpl : public Socket
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    65
{
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    66
public:
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    67
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    68
   * \brief Get the type ID of this class.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    69
   * \return type ID
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    70
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    71
  static TypeId GetTypeId ();
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    72
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    73
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    74
   * \brief Constructor.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    75
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    76
  Ipv6RawSocketImpl ();
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    77
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    78
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    79
   * \brief Destructor.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    80
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    81
  virtual ~Ipv6RawSocketImpl ();
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    82
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    83
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    84
   * \brief Set the node.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    85
   * \param node node to set
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    86
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    87
  void SetNode (Ptr<Node> node);
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    88
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    89
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    90
   * \brief Get last error number.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    91
   * \return error number
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    92
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    93
  virtual enum Socket::SocketErrno GetErrno () const;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    94
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
    95
  /**
6692
591fb1aa0ca4 Avoid enum name collision in socket
Josh Pelkey <jpelkey@gatech.edu>
parents: 6689
diff changeset
    96
   * \brief Get socket type (NS3_SOCK_RAW)
6689
e2de571e920a Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents: 6448
diff changeset
    97
   * \return socket type
e2de571e920a Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents: 6448
diff changeset
    98
   */
e2de571e920a Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents: 6448
diff changeset
    99
  virtual enum Socket::SocketType GetSocketType () const;
e2de571e920a Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents: 6448
diff changeset
   100
e2de571e920a Implement Socket::GetSocketType
Josh Pelkey <jpelkey@gatech.edu>
parents: 6448
diff changeset
   101
  /**
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   102
   * \brief Get node.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   103
   * \return node associated with this raw socket.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   104
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   105
  virtual Ptr<Node> GetNode () const;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   106
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   107
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   108
   * \brief Bind the socket to address.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   109
   * \param address bind to this address
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   110
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   111
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   112
  virtual int Bind (const Address& address);
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   113
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   114
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   115
   * \brief Bind socket.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   116
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   117
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   118
  virtual int Bind ();
7717
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7696
diff changeset
   119
  virtual int Bind6 ();
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   120
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   121
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   122
   * \brief Get socket address.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   123
   * \param address socket address if method success
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   124
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   125
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   126
  virtual int GetSockName (Address& address) const;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   127
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   128
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   129
   * \brief Close the socket.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   130
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   131
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   132
  virtual int Close ();
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   133
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   134
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   135
   * \brief Shutdown send capability.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   136
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   137
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   138
  virtual int ShutdownSend ();
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   139
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   140
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   141
   * \brief Shutdown receive capability.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   142
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   143
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   144
  virtual int ShutdownRecv ();
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   145
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   146
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   147
   * \brief Connect to address.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   148
   * \param address address
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   149
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   150
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   151
  virtual int Connect (const Address& address);
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   152
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   153
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   154
   * \brief Listen.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   155
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   156
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   157
  virtual int Listen ();
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   158
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   159
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   160
   * \brief Get TX size available.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   161
   * \return TX size
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   162
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   163
  virtual uint32_t GetTxAvailable () const;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   164
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   165
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   166
   * \brief Get RX size available.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   167
   * \return RX size
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   168
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   169
  virtual uint32_t GetRxAvailable () const;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   170
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   171
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   172
   * \brief Send a packet.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   173
   * \param p packet to send
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   174
   * \param flags additionnal flags
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   175
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   176
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   177
  virtual int Send (Ptr<Packet> p, uint32_t flags);
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   178
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   179
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   180
   * \brief Send a packet.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   181
   * \param p packet to send
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   182
   * \param flags additionnal flags
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   183
   * \param toAddress destination address
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   184
   * \return 0 if success, -1 otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   185
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   186
  virtual int SendTo (Ptr<Packet> p, uint32_t flags, const Address& toAddress);
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   187
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   188
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   189
   * \brief Receive packet.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   190
   * \param maxSize maximum size
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   191
   * \param flags additionnal flags
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   192
   * \return packet received
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   193
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   194
  virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags);
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   195
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   196
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   197
   * \brief Receive packet.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   198
   * \param maxSize maximum size
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   199
   * \param flags additionnal flags
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   200
   * \param fromAddress source address
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   201
   * \return packet received
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   202
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   203
  virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags, Address& fromAddress);
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   204
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   205
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   206
   * \brief Set protocol field.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   207
   * \param protocol protocol to set
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   208
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   209
  void SetProtocol (uint16_t protocol);
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   210
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   211
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   212
   * \brief Forward up to receive method.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   213
   * \param p packet
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   214
   * \param hdr IPv6 header
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   215
   * \param device device
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   216
   * \return true if forwarded, false otherwise
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   217
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   218
  bool ForwardUp (Ptr<const Packet> p, Ipv6Header hdr, Ptr<NetDevice> device);
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   219
6448
184a509cc71d Still Bug 943: fix UdpSocketImpl::GetAllowBroadcast, let Socket::SetAllowBroadcast return a bool indicating success/failure, instead of a fatal error.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6437
diff changeset
   220
  virtual bool SetAllowBroadcast (bool allowBroadcast);
6437
c11291f51d57 Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5891
diff changeset
   221
  virtual bool GetAllowBroadcast () const;
c11291f51d57 Bug 943 - Add a SO_BROADCAST socket option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5891
diff changeset
   222
7696
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   223
  /**
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   224
   * \brief Clean the ICMPv6 filter structure
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   225
   */
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   226
  void Icmpv6FilterSetPassAll();
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   227
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   228
  /**
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   229
   * \brief Set the filter to block all the ICMPv6 types
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   230
   */
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   231
  void Icmpv6FilterSetBlockAll();
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   232
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   233
  /**
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   234
   * \brief Set the filter to pass one ICMPv6 type
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   235
   * \param the ICMPv6 type to pass
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   236
   */
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   237
  void Icmpv6FilterSetPass(uint8_t type);
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   238
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   239
  /**
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   240
   * \brief Set the filter to block one ICMPv6 type
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   241
   * \param the ICMPv6 type to block
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   242
   */
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   243
  void Icmpv6FilterSetBlock(uint8_t type);
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   244
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   245
  /**
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   246
   * \brief Ask the filter about the status of one ICMPv6 type
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   247
   * \param the ICMPv6 type
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   248
   * \return true if the ICMP type is passing through
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   249
   */
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   250
  bool Icmpv6FilterWillPass(uint8_t type);
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   251
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   252
  /**
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   253
   * \brief Ask the filter about the status of one ICMPv6 type
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   254
   * \param the ICMPv6 type
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   255
   * \return true if the ICMP type is being blocked
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   256
   */
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   257
  bool Icmpv6FilterWillBlock(uint8_t type);
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   258
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   259
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   260
private:
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   261
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   262
   * \struct Data
7696
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   263
   * \brief IPv6 raw data and additional information.
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   264
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   265
  struct Data
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   266
  {
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   267
    Ptr<Packet> packet;   /**< Packet data */
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   268
    Ipv6Address fromIp;   /**< Source address */
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   269
    uint16_t fromProtocol;   /**< Protocol used */
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   270
  };
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   271
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   272
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   273
   * \brief Dispose object.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   274
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   275
  virtual void DoDispose ();
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   276
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   277
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   278
   * \brief Last error number.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   279
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   280
  enum Socket::SocketErrno m_err;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   281
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   282
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   283
   * \brief Node.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   284
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   285
  Ptr<Node> m_node;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   286
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   287
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   288
   * \brief Source address.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   289
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   290
  Ipv6Address m_src;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   291
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   292
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   293
   * \brief Destination address.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   294
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   295
  Ipv6Address m_dst;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   296
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   297
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   298
   * \brief Protocol.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   299
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   300
  uint16_t m_protocol;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   301
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   302
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   303
   * \brief Packet waiting to be processed.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   304
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   305
  std::list<struct Data> m_data;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   306
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   307
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   308
   * \brief Flag to shutdown send capability.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   309
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   310
  bool m_shutdownSend;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   311
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   312
  /**
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   313
   * \brief Flag to shutdown receive capability.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   314
   */
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   315
  bool m_shutdownRecv;
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   316
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   317
  /**
7696
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   318
   * \brief Struct to hold the ICMPv6 filter
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   319
   */
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   320
  typedef struct
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   321
  {
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   322
    uint32_t icmpv6Filt[8];
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   323
  } icmpv6Filter;
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   324
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   325
  /**
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   326
   * \brief ICMPv6 filter.
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4731
diff changeset
   327
   */
7696
142e062124f4 Bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7650
diff changeset
   328
  icmpv6Filter m_icmpFilter;
4731
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   329
};
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   330
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   331
} /* namespace ns3 */
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   332
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   333
#endif /* IPV6_RAW_SOCKET_IMPL_H */
510db8599bfb second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   334