xgboost
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
socket.h File Reference
#include <cerrno>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
#include <string>
#include <system_error>
#include <utility>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <unistd.h>
#include "xgboost/base.h"
#include "xgboost/collective/result.h"
#include "xgboost/logging.h"
#include "xgboost/string_view.h"
Include dependency graph for socket.h:

Go to the source code of this file.

Classes

class  xgboost::collective::SockAddrV6
 
class  xgboost::collective::SockAddrV4
 
class  xgboost::collective::SockAddress
 Address for TCP socket, can be either IPv4 or IPv6. More...
 
class  xgboost::collective::TCPSocket
 TCP socket for simple communication. More...
 

Namespaces

 xgboost
 Core data structure for multi-target trees.
 
 xgboost::system
 
 xgboost::collective
 

Macros

#define HOST_NAME_MAX   256
 
#define xgboost_CHECK_SYS_CALL(exp, expected)
 

Typedefs

using xgboost::system::SocketT = int
 

Enumerations

enum class  xgboost::collective::SockDomain : std::int32_t { xgboost::collective::kV4 = AF_INET , xgboost::collective::kV6 = AF_INET6 }
 

Functions

std::int32_t xgboost::system::LastError ()
 
collective::Result xgboost::system::FailWithCode (std::string msg)
 
auto xgboost::system::ThrowAtError (StringView fn_name, std::int32_t errsv=LastError())
 
std::int32_t xgboost::system::CloseSocket (SocketT fd)
 
bool xgboost::system::ErrorWouldBlock (std::int32_t errsv) noexcept(true)
 
bool xgboost::system::LastErrorWouldBlock ()
 
void xgboost::system::SocketStartup ()
 
void xgboost::system::SocketFinalize ()
 
SockAddress xgboost::collective::MakeSockAddress (StringView host, in_port_t port)
 Parse host address and return a SockAddress instance. Supports IPv4 and IPv6 host. More...
 
Result xgboost::collective::Connect (xgboost::StringView host, std::int32_t port, std::int32_t retry, std::chrono::seconds timeout, xgboost::collective::TCPSocket *out_conn)
 Connect to remote address, returns the error code if failed. More...
 
Result xgboost::collective::GetHostName (std::string *p_out)
 Get the local host name. More...
 
template<typename H >
Result xgboost::collective::INetNToP (H const &host, std::string *p_out)
 inet_ntop More...
 

Macro Definition Documentation

◆ HOST_NAME_MAX

#define HOST_NAME_MAX   256

Copyright (c) 2022-2023, XGBoost Contributors

◆ xgboost_CHECK_SYS_CALL

#define xgboost_CHECK_SYS_CALL (   exp,
  expected 
)
Value:
do { \
if (XGBOOST_EXPECT((exp) != (expected), false)) { \
} \
} while (false)
#define XGBOOST_EXPECT(cond, ret)
Definition: base.h:53
auto ThrowAtError(StringView fn_name, std::int32_t errsv=LastError())
Definition: socket.h:99