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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef IPV6_RAW_SOCKET_FACTORY_H
10#define IPV6_RAW_SOCKET_FACTORY_H
11
12#include "ns3/socket-factory.h"
13
14namespace ns3
15{
16
17class Socket;
18
19/**
20 * \ingroup ipv6
21 * \ingroup socket
22 *
23 * \brief API to create IPv6 RAW socket instances
24 *
25 * This abstract class defines the API for IPv6 RAW socket factory.
26 *
27 * A RAW Socket typically is used to access specific IP layers not usually
28 * available through L4 sockets, e.g., ICMP. The implementer should take
29 * particular care to define the Ipv6RawSocketImpl Attributes, and in
30 * particular the Protocol attribute.
31 * Not setting it will result in a zero protocol at IP level (corresponding
32 * to the HopByHop IPv6 Extension header, i.e., Ipv6ExtensionHopByHopHeader)
33 * when sending data through the socket, which is probably not the intended
34 * behavior.
35 *
36 * A correct example is (from src/applications/model/radvd.cc):
37 * \code
38 if (!m_socket)
39 {
40 TypeId tid = TypeId::LookupByName ("ns3::Ipv6RawSocketFactory");
41 m_socket = Socket::CreateSocket (GetNode (), tid);
42
43 NS_ASSERT (m_socket);
44
45 m_socket->SetAttribute ("Protocol", UintegerValue(Ipv6Header::IPV6_ICMPV6));
46 m_socket->SetRecvCallback (MakeCallback (&Radvd::HandleRead, this));
47 }
48 * \endcode
49 *
50 */
52{
53 public:
54 /**
55 * \brief Get the type ID of this class.
56 * \return type ID
57 */
58 static TypeId GetTypeId();
59};
60
61} // namespace ns3
62
63#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:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.