// $Id$
//
// Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief PacketProtocol and PacketSocketHandle non-inline non-template implementation
+ \brief PacketSocketProtocol and PacketSocketHandle non-inline non-template implementation
*/
#include "PacketSocketHandle.hh"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ void senf::PacketProtocol::init_client(SocketType type, int protocol)
+prefix_ void senf::PacketSocketProtocol::init_client(SocketType type, int protocol)
const
{
int socktype = SOCK_RAW;
protocol = ETH_P_ALL;
int sock = ::socket(PF_PACKET, socktype, htons(protocol));
if (sock < 0)
- throwErrno();
+ throw SystemException();
fd(sock);
}
-prefix_ std::auto_ptr<senf::SocketProtocol> senf::PacketProtocol::clone()
- const
-{
- return std::auto_ptr<SocketProtocol>(new PacketProtocol());
-}
-
-prefix_ unsigned senf::PacketProtocol::available()
+prefix_ unsigned senf::PacketSocketProtocol::available()
const
{
if (! fh().readable())
return 0;
ssize_t l = ::recv(fd(),0,0,MSG_PEEK | MSG_TRUNC);
if (l < 0)
- throwErrno();
+ throw SystemException();
return l;
}
-prefix_ bool senf::PacketProtocol::eof()
+prefix_ bool senf::PacketSocketProtocol::eof()
const
{
return false;
struct packet_mreq mreq;
mreq.mr_ifindex = ::if_nametoindex(interface.c_str());
if (mreq.mr_ifindex == 0)
- senf::throwErrno(EINVAL);
+ throw senf::SystemException(EINVAL);
mreq.mr_type = PACKET_MR_MULTICAST;
mreq.mr_alen = 6;
std::copy(address.begin(), address.end(), &mreq.mr_address[0]);
if (::setsockopt(fd, SOL_PACKET,
add ? PACKET_ADD_MEMBERSHIP : PACKET_DROP_MEMBERSHIP,
&mreq, sizeof(mreq)) < 0)
- senf::throwErrno();
+ throw senf::SystemException();
}
}
-prefix_ void senf::PacketProtocol::mcAdd(std::string const & interface,
+prefix_ void senf::PacketSocketProtocol::mcAdd(std::string const & interface,
MACAddress const & address)
const
{
do_mc(fd(),interface,address,true);
}
-prefix_ void senf::PacketProtocol::mcDrop(std::string const & interface,
+prefix_ void senf::PacketSocketProtocol::mcDrop(std::string const & interface,
MACAddress const & address)
const
{