xref: /aosp_15_r20/external/openscreen/platform/impl/socket_handle_posix.cc (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "platform/impl/socket_handle_posix.h"
6 
7 #include <cstdlib>
8 #include <functional>
9 
10 namespace openscreen {
11 
SocketHandle(int descriptor)12 SocketHandle::SocketHandle(int descriptor) : fd(descriptor) {}
13 
operator ==(const SocketHandle & lhs,const SocketHandle & rhs)14 bool operator==(const SocketHandle& lhs, const SocketHandle& rhs) {
15   return lhs.fd == rhs.fd;
16 }
17 
operator ()(const SocketHandle & handle) const18 size_t SocketHandleHash::operator()(const SocketHandle& handle) const {
19   return std::hash<int>()(handle.fd);
20 }
21 
22 }  // namespace openscreen
23