Raw socket nearly work
This commit is contained in:
35
src/node/raw-socket-factory.cc
Normal file
35
src/node/raw-socket-factory.cc
Normal file
@@ -0,0 +1,35 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2007 INRIA
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#include "raw-socket-factory.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (RawSocketFactory);
|
||||
|
||||
TypeId RawSocketFactory::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::RawSocketFactory")
|
||||
.SetParent<SocketFactory> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
46
src/node/raw-socket-factory.h
Normal file
46
src/node/raw-socket-factory.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2007 INRIA
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#ifndef RAW_SOCKET_FACTORY_H
|
||||
#define RAW_SOCKET_FACTORY_H
|
||||
|
||||
#include "socket-factory.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Socket;
|
||||
|
||||
/**
|
||||
* \ingroup socket
|
||||
*
|
||||
* \brief API to create RAW socket instances
|
||||
*
|
||||
* This abstract class defines the API for RAW socket factory.
|
||||
*
|
||||
*/
|
||||
class RawSocketFactory : public SocketFactory
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* RAW_SOCKET_FACTORY_H */
|
||||
@@ -45,7 +45,10 @@ Ptr<Socket>
|
||||
Socket::CreateSocket (Ptr<Node> node, TypeId tid)
|
||||
{
|
||||
Ptr<Socket> s;
|
||||
NS_LOG_UNCOND(tid);
|
||||
NS_ASSERT(node != 0);
|
||||
Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (tid);
|
||||
NS_ASSERT(socketFactory != 0);
|
||||
s = socketFactory->CreateSocket ();
|
||||
NS_ASSERT (s != 0);
|
||||
return s;
|
||||
|
||||
@@ -30,6 +30,7 @@ def build(bld):
|
||||
'packet-socket.cc',
|
||||
'udp-socket.cc',
|
||||
'udp-socket-factory.cc',
|
||||
'raw-socket-factory.cc',
|
||||
'tcp-socket.cc',
|
||||
'tcp-socket-factory.cc',
|
||||
'ipv4.cc',
|
||||
@@ -71,6 +72,7 @@ def build(bld):
|
||||
'packet-socket-factory.h',
|
||||
'udp-socket.h',
|
||||
'udp-socket-factory.h',
|
||||
'raw-socket-factory.h',
|
||||
'tcp-socket.h',
|
||||
'tcp-socket-factory.h',
|
||||
'ipv4.h',
|
||||
|
||||
Reference in New Issue
Block a user