A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ipv6-raw-socket-impl.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007-2009 Strasbourg University
4  *
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;
8  *
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.
13  *
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
17  *
18  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19  */
20 
21 #ifndef IPV6_RAW_SOCKET_IMPL_H
22 #define IPV6_RAW_SOCKET_IMPL_H
23 
24 #include <list>
25 
26 #include "ns3/socket.h"
27 #include "ns3/ipv6-address.h"
28 #include "ns3/ipv6-header.h"
29 
30 namespace ns3
31 {
32 
33 class NetDevice;
34 class Node;
35 
64 class Ipv6RawSocketImpl : public Socket
65 {
66 public:
71  static TypeId GetTypeId ();
72 
77 
81  virtual ~Ipv6RawSocketImpl ();
82 
87  void SetNode (Ptr<Node> node);
88 
93  virtual enum Socket::SocketErrno GetErrno () const;
94 
99  virtual enum Socket::SocketType GetSocketType () const;
100 
105  virtual Ptr<Node> GetNode () const;
106 
112  virtual int Bind (const Address& address);
113 
118  virtual int Bind ();
119  virtual int Bind6 ();
120 
126  virtual int GetSockName (Address& address) const;
127 
132  virtual int Close ();
133 
138  virtual int ShutdownSend ();
139 
144  virtual int ShutdownRecv ();
145 
151  virtual int Connect (const Address& address);
152 
157  virtual int Listen ();
158 
163  virtual uint32_t GetTxAvailable () const;
164 
169  virtual uint32_t GetRxAvailable () const;
170 
177  virtual int Send (Ptr<Packet> p, uint32_t flags);
178 
186  virtual int SendTo (Ptr<Packet> p, uint32_t flags, const Address& toAddress);
187 
194  virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags);
195 
203  virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags, Address& fromAddress);
204 
209  void SetProtocol (uint16_t protocol);
210 
219 
220  virtual bool SetAllowBroadcast (bool allowBroadcast);
221  virtual bool GetAllowBroadcast () const;
222 
226  void Icmpv6FilterSetPassAll();
227 
232 
237  void Icmpv6FilterSetPass(uint8_t type);
238 
243  void Icmpv6FilterSetBlock(uint8_t type);
244 
250  bool Icmpv6FilterWillPass(uint8_t type);
251 
257  bool Icmpv6FilterWillBlock(uint8_t type);
258 
259 
260 private:
265  struct Data
266  {
269  uint16_t fromProtocol;
270  };
271 
275  virtual void DoDispose ();
276 
281 
286 
291 
296 
300  uint16_t m_protocol;
301 
305  std::list<struct Data> m_data;
306 
311 
316 
320  typedef struct
321  {
322  uint32_t icmpv6Filt[8];
323  } icmpv6Filter;
324 
329 };
330 
331 } /* namespace ns3 */
332 
333 #endif /* IPV6_RAW_SOCKET_IMPL_H */
334