载入中...
搜索中...
未找到
eve::network::Network类 参考

Network module: TCP/UDP/HTTP factories, background worker, and completion event plumbing. Script: net <- eve.Network(); @thread Construct, configure, pump and destroy on the composition/owner thread. @reentrancy Callbacks may retire HTTP requests, but must not destroy this module or recursively call pump() before the outer pump returns. 更多...

#include <Network.h>

类 eve::network::Network 继承关系图:
eve::Module eve::service::INetwork

Public 成员函数

 Module_REG (Network)
 
 Network ()
 Network.
 
 ~Network () override
 Cancels HTTP completions and joins background I/O before destruction. @cost May wait for in-flight socket timeouts; OS DNS resolution can take longer. @thread Destroy on the module owner thread, without concurrent API calls.
 
std::unique_ptr< TcpSocket > makeTcp ()
 Creates an owning TCP socket handle for C++ callers.
 
std::unique_ptr< UdpSocket > makeUdp ()
 Creates an owning UDP socket handle for C++ callers.
 
std::unique_ptr< HttpRequest > makeHttp (std::string method, std::string url)
 Creates an owning HTTP request handle for C++ callers.
 
std::unique_ptr< Channel > makeChannel (TcpSocket *socket)
 Creates an owning channel handle, or null for a null socket.
 
std::unique_ptr< Session > makeSession ()
 Creates an owning session handle.
 
std::unique_ptr< NetWriter > makeWriter ()
 Creates an owning streaming writer handle.
 
std::unique_ptr< NetReader > makeReader (std::string bytes)
 Creates an owning streaming reader handle.
 
std::unique_ptr< UdpLink > makeUdpLink (UdpSocket *socket)
 Creates an owning UDP link handle, or null for a null socket.
 
std::unique_ptr< NetRpc > makeRpc (UdpLink *link)
 Creates an owning RPC handle, or null for a null link.
 
std::unique_ptr< NetHost > makeHost ()
 Creates an owning UDP host handle.
 
TcpSocket * newTcp ()
 Script adapter: creates a caller-owned TCP socket.
 
UdpSocket * newUdp ()
 Script adapter: creates a caller-owned UDP socket.
 
HttpRequest * newHttp (std::string method, std::string url)
 Script adapter: creates a caller-owned HTTP request.
 
Channel * newChannel (TcpSocket *socket)
 Script adapter: creates a caller-owned channel.
 
Session * newSession ()
 Script adapter: creates a caller-owned session.
 
NetWriter * newWriter ()
 Script adapter: creates a caller-owned writer.
 
NetReader * newReader (std::string bytes)
 Script adapter: creates a caller-owned reader.
 
UdpLink * newUdpLink (UdpSocket *socket)
 Script adapter: creates a caller-owned UDP link.
 
NetRpc * newRpc (UdpLink *link)
 Script adapter: creates a caller-owned RPC client.
 
NetHost * newHost ()
 Script adapter: creates a caller-owned UDP host.
 
void setTimeout (int ms)
 Default socket/HTTP timeout in milliseconds.
 
int getTimeout () const
 Returns the timeout.
 
void setVerifySsl (bool verify)
 Whether TLS peer certificates are verified (default true).
 
bool getVerifySsl () const
 Returns the verify ssl.
 
void setCaLocation (std::string location)
 Sets an owning UTF-8 CA file or hashed CA directory for future HTTPS requests. Empty selects system/default trust. A custom source exclusively replaces it. @thread Network owner thread; requests snapshot this policy on submission. @cost Copies the path per policy change; jobs load certificates per HTTPS request.
 
NetTelemetrySnapshot telemetrySnapshot () const
 Return a thread-safe copied telemetry snapshot for diagnostics tools.
 
void resetTelemetry ()
 Reset cumulative telemetry counters without affecting live sockets.
 
void pump ()
 Drains worker completions and emits them as events; call per frame.
 
bool httpRequest (const std::string &method, const std::string &url, const std::string &body, int timeoutMs, int &status, std::string &responseBody) override
 Synchronous HTTP(S) compatibility service; other completions remain queued. @cost Blocks the owner thread for network I/O until completion or the requested deadline.
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 
- Public 成员函数 继承自 eve::service::INetwork
virtual ~INetwork ()=default
 Releases INetwork resources.
 

友元

class Channel
 
class HttpRequest
 
class NetHost
 
class NetWorker
 
class TcpSocket
 
class UdpSocket
 

额外继承的成员函数

- 静态 Public 属性 继承自 eve::service::INetwork
static constexpr const char * capabilityName = "INetwork"
 

详细描述

Network module: TCP/UDP/HTTP factories, background worker, and completion event plumbing. Script: net <- eve.Network(); @thread Construct, configure, pump and destroy on the composition/owner thread. @reentrancy Callbacks may retire HTTP requests, but must not destroy this module or recursively call pump() before the outer pump returns.

在文件 Network.h 第 39 行定义.

构造及析构函数说明

◆ Network()

eve::network::Network::Network ( )

Network.

在文件 Network.cpp 第 57 行定义.

◆ ~Network()

eve::network::Network::~Network ( )
override

Cancels HTTP completions and joins background I/O before destruction. @cost May wait for in-flight socket timeouts; OS DNS resolution can take longer. @thread Destroy on the module owner thread, without concurrent API calls.

在文件 Network.cpp 第 64 行定义.

成员函数说明

◆ getTimeout()

int eve::network::Network::getTimeout ( ) const

Returns the timeout.

在文件 Network.cpp 第 170 行定义.

◆ getVerifySsl()

bool eve::network::Network::getVerifySsl ( ) const

Returns the verify ssl.

在文件 Network.cpp 第 174 行定义.

◆ httpRequest()

bool eve::network::Network::httpRequest ( const std::string &  method,
const std::string &  url,
const std::string &  body,
int  timeoutMs,
int &  status,
std::string &  responseBody 
)
overridevirtual

Synchronous HTTP(S) compatibility service; other completions remain queued. @cost Blocks the owner thread for network I/O until completion or the requested deadline.

注解
Does not dispatch events or invoke callbacks. Certificate verification defaults to true.

实现了 eve::service::INetwork.

在文件 Network.cpp 第 84 行定义.

引用了 body, c, eve::network::HttpResult::completion, deadline, eve::network::Err, eve::network::HttpResp, makeHttp(), method, eve::network::HttpRuntime::Ready, result, eve::network::HttpRequest::setBodyString(), eve::network::HttpRequest::setTimeout(), status , 以及 eve::network::HttpRequest::submit().

◆ makeChannel()

std::unique_ptr< Channel > eve::network::Network::makeChannel ( TcpSocket *  socket)

Creates an owning channel handle, or null for a null socket.

在文件 Network.cpp 第 115 行定义.

被这些函数引用 newChannel().

◆ makeHost()

std::unique_ptr< NetHost > eve::network::Network::makeHost ( )

Creates an owning UDP host handle.

在文件 Network.cpp 第 149 行定义.

被这些函数引用 newHost().

◆ makeHttp()

std::unique_ptr< HttpRequest > eve::network::Network::makeHttp ( std::string  method,
std::string  url 
)

Creates an owning HTTP request handle for C++ callers.

在文件 Network.cpp 第 77 行定义.

引用了 method.

被这些函数引用 httpRequest() , 以及 newHttp().

◆ makeReader()

std::unique_ptr< NetReader > eve::network::Network::makeReader ( std::string  bytes)

Creates an owning streaming reader handle.

在文件 Network.cpp 第 129 行定义.

引用了 bytes , 以及 r.

被这些函数引用 newReader().

◆ makeRpc()

std::unique_ptr< NetRpc > eve::network::Network::makeRpc ( UdpLink *  link)

Creates an owning RPC handle, or null for a null link.

在文件 Network.cpp 第 144 行定义.

引用了 link.

被这些函数引用 newRpc().

◆ makeSession()

std::unique_ptr< Session > eve::network::Network::makeSession ( )

Creates an owning session handle.

在文件 Network.cpp 第 123 行定义.

被这些函数引用 newSession().

◆ makeTcp()

std::unique_ptr< TcpSocket > eve::network::Network::makeTcp ( )

Creates an owning TCP socket handle for C++ callers.

在文件 Network.cpp 第 71 行定义.

被这些函数引用 newTcp().

◆ makeUdp()

std::unique_ptr< UdpSocket > eve::network::Network::makeUdp ( )

Creates an owning UDP socket handle for C++ callers.

在文件 Network.cpp 第 74 行定义.

被这些函数引用 newUdp().

◆ makeUdpLink()

std::unique_ptr< UdpLink > eve::network::Network::makeUdpLink ( UdpSocket *  socket)

Creates an owning UDP link handle, or null for a null socket.

在文件 Network.cpp 第 136 行定义.

引用了 link.

被这些函数引用 newUdpLink().

◆ makeWriter()

std::unique_ptr< NetWriter > eve::network::Network::makeWriter ( )

Creates an owning streaming writer handle.

在文件 Network.cpp 第 126 行定义.

被这些函数引用 newWriter().

◆ Module_REG()

eve::network::Network::Module_REG ( Network  )

◆ newChannel()

Channel * eve::network::Network::newChannel ( TcpSocket *  socket)

Script adapter: creates a caller-owned channel.

在文件 Network.cpp 第 121 行定义.

引用了 makeChannel().

◆ newHost()

NetHost * eve::network::Network::newHost ( )

Script adapter: creates a caller-owned UDP host.

在文件 Network.cpp 第 150 行定义.

引用了 makeHost().

◆ newHttp()

HttpRequest * eve::network::Network::newHttp ( std::string  method,
std::string  url 
)

Script adapter: creates a caller-owned HTTP request.

在文件 Network.cpp 第 80 行定义.

引用了 makeHttp() , 以及 method.

◆ newReader()

NetReader * eve::network::Network::newReader ( std::string  bytes)

Script adapter: creates a caller-owned reader.

在文件 Network.cpp 第 134 行定义.

引用了 bytes , 以及 makeReader().

◆ newRpc()

NetRpc * eve::network::Network::newRpc ( UdpLink *  link)

Script adapter: creates a caller-owned RPC client.

在文件 Network.cpp 第 147 行定义.

引用了 link , 以及 makeRpc().

◆ newSession()

Session * eve::network::Network::newSession ( )

Script adapter: creates a caller-owned session.

在文件 Network.cpp 第 124 行定义.

引用了 makeSession().

◆ newTcp()

TcpSocket * eve::network::Network::newTcp ( )

Script adapter: creates a caller-owned TCP socket.

在文件 Network.cpp 第 72 行定义.

引用了 makeTcp().

◆ newUdp()

UdpSocket * eve::network::Network::newUdp ( )

Script adapter: creates a caller-owned UDP socket.

在文件 Network.cpp 第 75 行定义.

引用了 makeUdp().

被这些函数引用 eve::network::NetHost::start().

◆ newUdpLink()

UdpLink * eve::network::Network::newUdpLink ( UdpSocket *  socket)

Script adapter: creates a caller-owned UDP link.

在文件 Network.cpp 第 142 行定义.

引用了 makeUdpLink().

◆ newWriter()

NetWriter * eve::network::Network::newWriter ( )

Script adapter: creates a caller-owned writer.

在文件 Network.cpp 第 127 行定义.

引用了 makeWriter().

◆ pump()

void eve::network::Network::pump ( )

Drains worker completions and emits them as events; call per frame.

在文件 Network.cpp 第 425 行定义.

引用了 c, eve::network::Data, hit, eve::network::HttpRuntime::Ready, result , 以及 eve::network::Udp.

◆ resetTelemetry()

void eve::network::Network::resetTelemetry ( )

Reset cumulative telemetry counters without affecting live sockets.

在文件 Network.cpp 第 218 行定义.

◆ setCaLocation()

void eve::network::Network::setCaLocation ( std::string  location)

Sets an owning UTF-8 CA file or hashed CA directory for future HTTPS requests. Empty selects system/default trust. A custom source exclusively replaces it. @thread Network owner thread; requests snapshot this policy on submission. @cost Copies the path per policy change; jobs load certificates per HTTPS request.

在文件 Network.cpp 第 176 行定义.

◆ setTimeout()

void eve::network::Network::setTimeout ( int  ms)

Default socket/HTTP timeout in milliseconds.

在文件 Network.cpp 第 168 行定义.

◆ setVerifySsl()

void eve::network::Network::setVerifySsl ( bool  verify)

Whether TLS peer certificates are verified (default true).

在文件 Network.cpp 第 172 行定义.

◆ telemetrySnapshot()

NetTelemetrySnapshot eve::network::Network::telemetrySnapshot ( ) const

Return a thread-safe copied telemetry snapshot for diagnostics tools.

在文件 Network.cpp 第 197 行定义.

引用了 result , 以及 eve::network::NetTelemetrySnapshot::revision.

友元及相关函数文档

◆ Channel

friend class Channel
friend

在文件 Network.h 第 124 行定义.

◆ HttpRequest

friend class HttpRequest
friend

在文件 Network.h 第 125 行定义.

◆ NetHost

friend class NetHost
friend

在文件 Network.h 第 126 行定义.

◆ NetWorker

friend class NetWorker
friend

在文件 Network.h 第 127 行定义.

◆ TcpSocket

friend class TcpSocket
friend

在文件 Network.h 第 128 行定义.

◆ UdpSocket

friend class UdpSocket
friend

在文件 Network.h 第 129 行定义.


该类的文档由以下文件生成: