WPILibC++ 2024.1.1-beta-4
wpi::uv Namespace Reference

Classes

class  Async
 Async handle. More...
 
class  Async<>
 Async specialization for no data parameters. More...
 
class  AsyncFunction
 
class  AsyncFunction< R(T...)>
 Function async handle. More...
 
class  Buffer
 Data buffer. More...
 
class  Check
 Check handle. More...
 
class  ConnectReq
 Connection request. More...
 
class  Error
 Error code. More...
 
class  FsEvent
 Filesystem Event handle. More...
 
class  GetAddrInfoReq
 GetAddrInfo request. More...
 
class  GetNameInfoReq
 GetNameInfo request. More...
 
class  Handle
 Handle. More...
 
class  HandleImpl
 Handle. More...
 
class  Idle
 Idle handle. More...
 
class  Loop
 Event loop. More...
 
class  NetworkStream
 Network stream handle. More...
 
class  NetworkStreamImpl
 
class  Pipe
 Pipe handle. More...
 
class  PipeConnectReq
 Pipe connection request. More...
 
class  Poll
 Poll handle. More...
 
class  Prepare
 Prepare handle. More...
 
class  Process
 Process handle. More...
 
class  Request
 Request. More...
 
class  RequestImpl
 Request. More...
 
class  ShutdownReq
 Shutdown request. More...
 
class  Signal
 Signal handle. More...
 
class  SimpleBufferPool
 A simple pool allocator for Buffers. More...
 
class  Stream
 Stream handle. More...
 
class  StreamImpl
 
class  Tcp
 TCP handle. More...
 
class  TcpConnectReq
 TCP connection request. More...
 
class  Timer
 Timer handle. More...
 
class  Tty
 TTY handle. More...
 
class  Udp
 UDP handle. More...
 
class  UdpSendReq
 UDP send request. More...
 
class  WorkReq
 Work request. More...
 
class  WriteReq
 Write request. More...
 

Functions

void QueueWork (Loop &loop, const std::shared_ptr< WorkReq > &req)
 Initializes a work request which will run on the thread pool. More...
 
void QueueWork (const std::shared_ptr< Loop > &loop, const std::shared_ptr< WorkReq > &req)
 Initializes a work request which will run on the thread pool. More...
 
void QueueWork (Loop &loop, std::function< void()> work, std::function< void()> afterWork)
 Initializes a work request which will run on the thread pool. More...
 
void QueueWork (const std::shared_ptr< Loop > &loop, std::function< void()> work, std::function< void()> afterWork)
 Initializes a work request which will run on the thread pool. More...
 
void GetNameInfo (Loop &loop, const std::shared_ptr< GetNameInfoReq > &req, const sockaddr &addr, int flags=0)
 Asynchronous getnameinfo(3). More...
 
void GetNameInfo (const std::shared_ptr< Loop > &loop, const std::shared_ptr< GetNameInfoReq > &req, const sockaddr &addr, int flags=0)
 Asynchronous getnameinfo(3). More...
 
void GetNameInfo (Loop &loop, std::function< void(const char *, const char *)> callback, const sockaddr &addr, int flags=0)
 Asynchronous getnameinfo(3). More...
 
void GetNameInfo (const std::shared_ptr< Loop > &loop, std::function< void(const char *, const char *)> callback, const sockaddr &addr, int flags=0)
 Asynchronous getnameinfo(3). More...
 
void GetNameInfo4 (Loop &loop, const std::shared_ptr< GetNameInfoReq > &req, std::string_view ip, unsigned int port, int flags=0)
 Asynchronous IPv4 getnameinfo(3). More...
 
void GetNameInfo4 (const std::shared_ptr< Loop > &loop, const std::shared_ptr< GetNameInfoReq > &req, std::string_view ip, unsigned int port, int flags=0)
 Asynchronous IPv4 getnameinfo(3). More...
 
void GetNameInfo4 (Loop &loop, std::function< void(const char *, const char *)> callback, std::string_view ip, unsigned int port, int flags=0)
 Asynchronous IPv4 getnameinfo(3). More...
 
void GetNameInfo4 (const std::shared_ptr< Loop > &loop, std::function< void(const char *, const char *)> callback, std::string_view ip, unsigned int port, int flags=0)
 Asynchronous IPv4 getnameinfo(3). More...
 
void GetNameInfo6 (Loop &loop, const std::shared_ptr< GetNameInfoReq > &req, std::string_view ip, unsigned int port, int flags=0)
 Asynchronous IPv6 getnameinfo(3). More...
 
void GetNameInfo6 (const std::shared_ptr< Loop > &loop, const std::shared_ptr< GetNameInfoReq > &req, std::string_view ip, unsigned int port, int flags=0)
 Asynchronous IPv6 getnameinfo(3). More...
 
void GetNameInfo6 (Loop &loop, std::function< void(const char *, const char *)> callback, std::string_view ip, unsigned int port, int flags=0)
 Asynchronous IPv6 getnameinfo(3). More...
 
void GetNameInfo6 (const std::shared_ptr< Loop > &loop, std::function< void(const char *, const char *)> callback, std::string_view ip, unsigned int port, int flags=0)
 Asynchronous IPv6 getnameinfo(3). More...
 
void GetAddrInfo (Loop &loop, const std::shared_ptr< GetAddrInfoReq > &req, std::string_view node, std::string_view service={}, const addrinfo *hints=nullptr)
 Asynchronous getaddrinfo(3). More...
 
void GetAddrInfo (const std::shared_ptr< Loop > &loop, const std::shared_ptr< GetAddrInfoReq > &req, std::string_view node, std::string_view service={}, const addrinfo *hints=nullptr)
 Asynchronous getaddrinfo(3). More...
 
void GetAddrInfo (Loop &loop, std::function< void(const addrinfo &)> callback, std::string_view node, std::string_view service={}, const addrinfo *hints=nullptr)
 Asynchronous getaddrinfo(3). More...
 
void GetAddrInfo (const std::shared_ptr< Loop > &loop, std::function< void(const addrinfo &)> callback, std::string_view node, std::string_view service={}, const addrinfo *hints=nullptr)
 Asynchronous getaddrinfo(3). More...
 
template<typename T >
int AddrToName (const sockaddr_in &addr, T *ip, unsigned int *port)
 Convert a binary structure containing an IPv4 address to a string. More...
 
template<typename T >
int AddrToName (const sockaddr_in6 &addr, T *ip, unsigned int *port)
 Convert a binary structure containing an IPv6 address to a string. More...
 
template<typename T >
int AddrToName (const sockaddr_storage &addr, T *ip, unsigned int *port)
 Convert a binary structure containing an IPv4 or IPv6 address to a string. More...
 
template<typename T >
int AddrToName (const in_addr &addr, T *ip)
 Convert a binary IPv4 address to a string. More...
 
template<typename T >
int AddrToName (const in6_addr &addr, T *ip)
 Convert a binary IPv6 address to a string. More...
 
int NameToAddr (std::string_view ip, unsigned int port, sockaddr_in *addr)
 Convert a string containing an IPv4 address to a binary structure. More...
 
int NameToAddr (std::string_view ip, unsigned int port, sockaddr_in6 *addr)
 Convert a string containing an IPv6 address to a binary structure. More...
 
int NameToAddr (std::string_view ip, in_addr *addr)
 Convert a string containing an IPv4 address to binary format. More...
 
int NameToAddr (std::string_view ip, in6_addr *addr)
 Convert a string containing an IPv6 address to binary format. More...
 

Function Documentation

◆ AddrToName() [1/5]

template<typename T >
int wpi::uv::AddrToName ( const in6_addr &  addr,
T *  ip 
)

Convert a binary IPv6 address to a string.

Parameters
addrBinary address
ipOutput string (any type that has assign(char*, char*))
Returns
Error (same as uv_inet_ntop()).

◆ AddrToName() [2/5]

template<typename T >
int wpi::uv::AddrToName ( const in_addr &  addr,
T *  ip 
)

Convert a binary IPv4 address to a string.

Parameters
addrBinary address
ipOutput string (any type that has assign(char*, char*))
Returns
Error (same as uv_inet_ntop()).

◆ AddrToName() [3/5]

template<typename T >
int wpi::uv::AddrToName ( const sockaddr_in &  addr,
T *  ip,
unsigned int *  port 
)

Convert a binary structure containing an IPv4 address to a string.

Parameters
addrBinary structure
ipOutput string (any type that has assign(char*, char*))
portOutput port number
Returns
Error (same as uv_ip4_name()).

◆ AddrToName() [4/5]

template<typename T >
int wpi::uv::AddrToName ( const sockaddr_in6 &  addr,
T *  ip,
unsigned int *  port 
)

Convert a binary structure containing an IPv6 address to a string.

Parameters
addrBinary structure
ipOutput string (any type that has assign(char*, char*))
portOutput port number
Returns
Error (same as uv_ip6_name()).

◆ AddrToName() [5/5]

template<typename T >
int wpi::uv::AddrToName ( const sockaddr_storage &  addr,
T *  ip,
unsigned int *  port 
)

Convert a binary structure containing an IPv4 or IPv6 address to a string.

Parameters
addrBinary structure
ipOutput string (any type that has assign(char*, char*))
portOutput port number
Returns
Error (same as uv_ip6_name()).

◆ GetAddrInfo() [1/4]

void wpi::uv::GetAddrInfo ( const std::shared_ptr< Loop > &  loop,
const std::shared_ptr< GetAddrInfoReq > &  req,
std::string_view  node,
std::string_view  service = {},
const addrinfo *  hints = nullptr 
)
inline

Asynchronous getaddrinfo(3).

HandleResolvedAddress() is called on the request when the resolution completes. HandleError() is called on the request if any errors occur.

Either node or service may be empty but not both.

Parameters
loopEvent loop
reqrequest
nodeEither a numerical network address or a network hostname.
serviceEither a service name or a port number as a string.
hintsOptional addrinfo data structure with additional address type constraints.

◆ GetAddrInfo() [2/4]

void wpi::uv::GetAddrInfo ( const std::shared_ptr< Loop > &  loop,
std::function< void(const addrinfo &)>  callback,
std::string_view  node,
std::string_view  service = {},
const addrinfo *  hints = nullptr 
)
inline

Asynchronous getaddrinfo(3).

The callback is called when the resolution completes, and errors are forwarded to the loop. This is a convenience wrapper.

Either node or service may be empty but not both.

Parameters
loopEvent loop
callbackCallback function to call when resolution completes
nodeEither a numerical network address or a network hostname.
serviceEither a service name or a port number as a string.
hintsOptional addrinfo data structure with additional address type constraints.

◆ GetAddrInfo() [3/4]

void wpi::uv::GetAddrInfo ( Loop loop,
const std::shared_ptr< GetAddrInfoReq > &  req,
std::string_view  node,
std::string_view  service = {},
const addrinfo *  hints = nullptr 
)

Asynchronous getaddrinfo(3).

HandleResolvedAddress() is called on the request when the resolution completes. HandleError() is called on the request if any errors occur.

Either node or service may be empty but not both.

Parameters
loopEvent loop
reqrequest
nodeEither a numerical network address or a network hostname.
serviceEither a service name or a port number as a string.
hintsOptional addrinfo data structure with additional address type constraints.

◆ GetAddrInfo() [4/4]

void wpi::uv::GetAddrInfo ( Loop loop,
std::function< void(const addrinfo &)>  callback,
std::string_view  node,
std::string_view  service = {},
const addrinfo *  hints = nullptr 
)

Asynchronous getaddrinfo(3).

The callback is called when the resolution completes, and errors are forwarded to the loop. This is a convenience wrapper.

Either node or service may be empty but not both.

Parameters
loopEvent loop
callbackCallback function to call when resolution completes
nodeEither a numerical network address or a network hostname.
serviceEither a service name or a port number as a string.
hintsOptional addrinfo data structure with additional address type constraints.

◆ GetNameInfo() [1/4]

void wpi::uv::GetNameInfo ( const std::shared_ptr< Loop > &  loop,
const std::shared_ptr< GetNameInfoReq > &  req,
const sockaddr &  addr,
int  flags = 0 
)
inline

Asynchronous getnameinfo(3).

HandleResolvedName() is called on the request when the resolution completes. HandleError() is called on the request if any errors occur.

Parameters
loopEvent loop
reqrequest
addrInitialized sockaddr_in or sockaddr_in6 data structure.
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo() [2/4]

void wpi::uv::GetNameInfo ( const std::shared_ptr< Loop > &  loop,
std::function< void(const char *, const char *)>  callback,
const sockaddr &  addr,
int  flags = 0 
)
inline

Asynchronous getnameinfo(3).

The callback is called when the resolution completes, and errors are forwarded to the loop.

Parameters
loopEvent loop
callbackCallback function to call when resolution completes
addrInitialized sockaddr_in or sockaddr_in6 data structure.
flagsOptional flags to modify the behavior of getnameinfo.
Returns
Connection object for the callback

◆ GetNameInfo() [3/4]

void wpi::uv::GetNameInfo ( Loop loop,
const std::shared_ptr< GetNameInfoReq > &  req,
const sockaddr &  addr,
int  flags = 0 
)

Asynchronous getnameinfo(3).

HandleResolvedName() is called on the request when the resolution completes. HandleError() is called on the request if any errors occur.

Parameters
loopEvent loop
reqrequest
addrInitialized sockaddr_in or sockaddr_in6 data structure.
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo() [4/4]

void wpi::uv::GetNameInfo ( Loop loop,
std::function< void(const char *, const char *)>  callback,
const sockaddr &  addr,
int  flags = 0 
)

Asynchronous getnameinfo(3).

The callback is called when the resolution completes, and errors are forwarded to the loop.

Parameters
loopEvent loop
callbackCallback function to call when resolution completes
addrInitialized sockaddr_in or sockaddr_in6 data structure.
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo4() [1/4]

void wpi::uv::GetNameInfo4 ( const std::shared_ptr< Loop > &  loop,
const std::shared_ptr< GetNameInfoReq > &  req,
std::string_view  ip,
unsigned int  port,
int  flags = 0 
)
inline

Asynchronous IPv4 getnameinfo(3).

HandleResolvedName() is called on the request when the resolution completes. HandleError() is called on the request if any errors occur.

Parameters
loopEvent loop
reqrequest
ipA valid IPv4 address
portA valid port number
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo4() [2/4]

void wpi::uv::GetNameInfo4 ( const std::shared_ptr< Loop > &  loop,
std::function< void(const char *, const char *)>  callback,
std::string_view  ip,
unsigned int  port,
int  flags = 0 
)
inline

Asynchronous IPv4 getnameinfo(3).

The callback is called when the resolution completes, and errors are forwarded to the loop. This is a convenience wrapper.

Parameters
loopEvent loop
ipA valid IPv4 address
portA valid port number
callbackCallback function to call when resolution completes
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo4() [3/4]

void wpi::uv::GetNameInfo4 ( Loop loop,
const std::shared_ptr< GetNameInfoReq > &  req,
std::string_view  ip,
unsigned int  port,
int  flags = 0 
)

Asynchronous IPv4 getnameinfo(3).

HandleResolvedName() is called on the request when the resolution completes. HandleError() is called on the request if any errors occur.

Parameters
loopEvent loop
reqrequest
ipA valid IPv4 address
portA valid port number
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo4() [4/4]

void wpi::uv::GetNameInfo4 ( Loop loop,
std::function< void(const char *, const char *)>  callback,
std::string_view  ip,
unsigned int  port,
int  flags = 0 
)

Asynchronous IPv4 getnameinfo(3).

The callback is called when the resolution completes, and errors are forwarded to the loop.

Parameters
loopEvent loop
callbackCallback function to call when resolution completes
ipA valid IPv4 address
portA valid port number
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo6() [1/4]

void wpi::uv::GetNameInfo6 ( const std::shared_ptr< Loop > &  loop,
const std::shared_ptr< GetNameInfoReq > &  req,
std::string_view  ip,
unsigned int  port,
int  flags = 0 
)
inline

Asynchronous IPv6 getnameinfo(3).

HandleResolvedName() is called on the request when the resolution completes. HandleError() is called on the request if any errors occur.

Parameters
loopEvent loop
reqrequest
ipA valid IPv6 address
portA valid port number
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo6() [2/4]

void wpi::uv::GetNameInfo6 ( const std::shared_ptr< Loop > &  loop,
std::function< void(const char *, const char *)>  callback,
std::string_view  ip,
unsigned int  port,
int  flags = 0 
)
inline

Asynchronous IPv6 getnameinfo(3).

The callback is called when the resolution completes, and errors are forwarded to the loop. This is a convenience wrapper.

Parameters
loopEvent loop
callbackCallback function to call when resolution completes
ipA valid IPv6 address
portA valid port number
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo6() [3/4]

void wpi::uv::GetNameInfo6 ( Loop loop,
const std::shared_ptr< GetNameInfoReq > &  req,
std::string_view  ip,
unsigned int  port,
int  flags = 0 
)

Asynchronous IPv6 getnameinfo(3).

HandleResolvedName() is called on the request when the resolution completes. HandleError() is called on the request if any errors occur.

Parameters
loopEvent loop
reqrequest
ipA valid IPv6 address
portA valid port number
flagsOptional flags to modify the behavior of getnameinfo.

◆ GetNameInfo6() [4/4]

void wpi::uv::GetNameInfo6 ( Loop loop,
std::function< void(const char *, const char *)>  callback,
std::string_view  ip,
unsigned int  port,
int  flags = 0 
)

Asynchronous IPv6 getnameinfo(3).

The callback is called when the resolution completes, and errors are forwarded to the loop. This is a convenience wrapper.

Parameters
loopEvent loop
callbackCallback function to call when resolution completes
ipA valid IPv6 address
portA valid port number
flagsOptional flags to modify the behavior of getnameinfo.

◆ NameToAddr() [1/4]

int wpi::uv::NameToAddr ( std::string_view  ip,
in6_addr *  addr 
)

Convert a string containing an IPv6 address to binary format.

Parameters
ipIPv6 address string
addrOutput binary
Returns
Error (same as uv_inet_pton()).

◆ NameToAddr() [2/4]

int wpi::uv::NameToAddr ( std::string_view  ip,
in_addr *  addr 
)

Convert a string containing an IPv4 address to binary format.

Parameters
ipIPv4 address string
addrOutput binary
Returns
Error (same as uv_inet_pton()).

◆ NameToAddr() [3/4]

int wpi::uv::NameToAddr ( std::string_view  ip,
unsigned int  port,
sockaddr_in *  addr 
)

Convert a string containing an IPv4 address to a binary structure.

Parameters
ipIPv4 address string
portPort number
addrOutput binary structure
Returns
Error (same as uv_ip4_addr()).

◆ NameToAddr() [4/4]

int wpi::uv::NameToAddr ( std::string_view  ip,
unsigned int  port,
sockaddr_in6 *  addr 
)

Convert a string containing an IPv6 address to a binary structure.

Parameters
ipIPv6 address string
portPort number
addrOutput binary structure
Returns
Error (same as uv_ip6_addr()).

◆ QueueWork() [1/4]

void wpi::uv::QueueWork ( const std::shared_ptr< Loop > &  loop,
const std::shared_ptr< WorkReq > &  req 
)
inline

Initializes a work request which will run on the thread pool.

Parameters
loopEvent loop
reqrequest

◆ QueueWork() [2/4]

void wpi::uv::QueueWork ( const std::shared_ptr< Loop > &  loop,
std::function< void()>  work,
std::function< void()>  afterWork 
)
inline

Initializes a work request which will run on the thread pool.

The work callback will be run on a thread from the thread pool, and the afterWork callback will be called on the loop thread after the work completes. Any errors are forwarded to the loop.

Parameters
loopEvent loop
workWork callback (called from separate thread)
afterWorkAfter work callback (called on loop thread)

◆ QueueWork() [3/4]

void wpi::uv::QueueWork ( Loop loop,
const std::shared_ptr< WorkReq > &  req 
)

Initializes a work request which will run on the thread pool.

Parameters
loopEvent loop
reqrequest

◆ QueueWork() [4/4]

void wpi::uv::QueueWork ( Loop loop,
std::function< void()>  work,
std::function< void()>  afterWork 
)

Initializes a work request which will run on the thread pool.

The work callback will be run on a thread from the thread pool, and the afterWork callback will be called on the loop thread after the work completes. Any errors are forwarded to the loop.

Parameters
loopEvent loop
workWork callback (called from separate thread)
afterWorkAfter work callback (called on loop thread)