mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-27 20:47:11 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
69
vendor/POCO/Net/src/RawSocketImpl.cpp
vendored
Normal file
69
vendor/POCO/Net/src/RawSocketImpl.cpp
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
//
|
||||
// RawSocketImpl.cpp
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Sockets
|
||||
// Module: RawSocketImpl
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Net/RawSocketImpl.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
|
||||
|
||||
using Poco::InvalidArgumentException;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
RawSocketImpl::RawSocketImpl()
|
||||
{
|
||||
init(AF_INET);
|
||||
}
|
||||
|
||||
|
||||
RawSocketImpl::RawSocketImpl(SocketAddress::Family family, int proto)
|
||||
{
|
||||
if (family == SocketAddress::IPv4)
|
||||
init2(AF_INET, proto);
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else if (family == SocketAddress::IPv6)
|
||||
init2(AF_INET6, proto);
|
||||
#endif
|
||||
else throw InvalidArgumentException("Invalid or unsupported address family passed to RawSocketImpl");
|
||||
|
||||
}
|
||||
|
||||
|
||||
RawSocketImpl::RawSocketImpl(poco_socket_t sockfd):
|
||||
SocketImpl(sockfd)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
RawSocketImpl::~RawSocketImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void RawSocketImpl::init(int af)
|
||||
{
|
||||
init2(af, IPPROTO_RAW);
|
||||
}
|
||||
|
||||
|
||||
void RawSocketImpl::init2(int af, int proto)
|
||||
{
|
||||
initSocket(af, SOCK_RAW, proto);
|
||||
setOption(IPPROTO_IP, IP_HDRINCL, 0);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
Reference in New Issue
Block a user