A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-raw-socket-factory.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19
20#ifndef IPV6_RAW_SOCKET_FACTORY_H
21#define IPV6_RAW_SOCKET_FACTORY_H
22
23#include "ns3/socket-factory.h"
24
25namespace ns3
26{
27
28class Socket;
29
30/**
31 * \ingroup ipv6
32 * \ingroup socket
33 *
34 * \brief API to create IPv6 RAW socket instances
35 *
36 * This abstract class defines the API for IPv6 RAW socket factory.
37 *
38 * A RAW Socket typically is used to access specific IP layers not usually
39 * available through L4 sockets, e.g., ICMP. The implementer should take
40 * particular care to define the Ipv6RawSocketImpl Attributes, and in
41 * particular the Protocol attribute.
42 * Not setting it will result in a zero protocol at IP level (corresponding
43 * to the HopByHop IPv6 Extension header, i.e., Ipv6ExtensionHopByHopHeader)
44 * when sending data through the socket, which is probably not the intended
45 * behavior.
46 *
47 * A correct example is (from src/applications/model/radvd.cc):
48 * \code
49 if (!m_socket)
50 {
51 TypeId tid = TypeId::LookupByName ("ns3::Ipv6RawSocketFactory");
52 m_socket = Socket::CreateSocket (GetNode (), tid);
53
54 NS_ASSERT (m_socket);
55
56 m_socket->SetAttribute ("Protocol", UintegerValue(Ipv6Header::IPV6_ICMPV6));
57 m_socket->SetRecvCallback (MakeCallback (&Radvd::HandleRead, this));
58 }
59 * \endcode
60 *
61 */
63{
64 public:
65 /**
66 * \brief Get the type ID of this class.
67 * \return type ID
68 */
69 static TypeId GetTypeId();
70};
71
72} // namespace ns3
73
74#endif /* IPV6_RAW_SOCKET_FACTORY_H */
API to create IPv6 RAW socket instances.
static TypeId GetTypeId()
Get the type ID of this class.
Object to create transport layer instances that provide a socket API to applications.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.