diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/libs/poco/Net/src/RawSocketImpl.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/libs/poco/Net/src/RawSocketImpl.cpp')
-rw-r--r-- | contrib/libs/poco/Net/src/RawSocketImpl.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/contrib/libs/poco/Net/src/RawSocketImpl.cpp b/contrib/libs/poco/Net/src/RawSocketImpl.cpp new file mode 100644 index 0000000000..c7fb248ef7 --- /dev/null +++ b/contrib/libs/poco/Net/src/RawSocketImpl.cpp @@ -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 |