1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2008 Louis Pasteur University
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Authors: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
25 #include "ns3/traced-callback.h"
26 #include "ns3/callback.h"
28 #include "ns3/object.h"
36 * \brief (abstract) base class of all IcmpSockets (for IPv4 or IPv6).
38 * This class exists solely for hosting IcmpSocket attributes that can
39 * be reused across different implementations.
41 class IcmpSocket : public Socket
45 * \brief Get the UID of this class.
48 static TypeId GetTypeId (void);
58 virtual ~IcmpSocket (void);
61 * \brief Get the error.
64 virtual enum Socket::SocketErrno GetErrno (void) const = 0;
67 * \brief Get the node.
70 virtual Ptr<Node> GetNode (void) const = 0;
73 * \brief Bind the socket.
74 * \return 0 if OK, -1 otherwise
76 virtual int Bind (void) = 0;
79 * \brief Bind the socket on "addr".
81 * \return 0 if OK, -1 otherwise
83 virtual int Bind (const Address &addr) = 0;
86 * \brief Close the socket.
87 * \return 0 if OK, -1 otherwise
89 virtual int Close (void) = 0;
92 * \brief Shutdown the socket on send.
93 * \return 0 if OK, -1 otherwise
95 virtual int ShutdownSend (void) = 0;
98 * \brief Shutdown the socket on receive.
99 * \return 0 if OK, -1 otherwise
101 virtual int ShutdownRecv (void) = 0;
104 * \brief Connect to another node.
105 * \param addr address
106 * \return 0 if OK, -1 otherwise
108 virtual int Connect (const Address &addr) = 0;
111 * \brief Send a packet.
112 * \param p the packet to send
114 * \return 0 if OK, -1 otherwise
116 virtual int Send (Ptr<Packet> p, uint32_t flags) = 0;
119 * \brief Get the maximum message size available.
120 * \return maximum message size
121 * \warning size of a message that could be sent is limited by the link MTU.
123 virtual uint32_t GetTxAvailable (void) const = 0;
126 * \brief Send a packet to a node.
127 * \param addr the address of the node
129 * \param p the packet to send
130 * \return 0 if OK, -1 otherwise
132 virtual int SendTo (Ptr<Packet> p, uint32_t flags, const Address &addr) = 0;
135 * \brief Receive method.
136 * \param maxSize maximum size we want to return
138 * \return a packet with at maximum maxSize size
140 virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags) = 0;
143 * \brief Receive method.
144 * \param maxSize maximum size we want to return
146 * \param fromAddress sender address
147 * \return a packet with at maximum maxSize size
149 virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress) = 0;
152 * \brief Get the size we could receive.
153 * \return size we could receive at one moment
155 virtual uint32_t GetRxAvailable (void) const = 0;
159 * \brief Get the receive buffer size.
160 * \return receive buffer size
162 virtual uint32_t GetRcvBufSize (void) const = 0;
165 * \brief Set the receive buffer size.
166 * \param rcvBufSize size to set
168 virtual void SetRcvBufSize (uint32_t rcvBufSize) = 0;
170 /* FIXME : add ICMP basic attribute for socket */
171 /* Indirect the attribute setting and getting through private virtual methods */
174 } /* namespace ns3 */
176 #endif /* ICMP_SOCKET_H */