![]() |
RMVL
2.3.0
Robotic Manipulation and Vision Library
|
提供跨平台的同步异步 Socket 通信、HTTP 请求、HTTP Web 后端框架功能 更多...
概念 | |
| concept | rm::IpProtocol |
| IP 协议 | |
| concept | rm::LocalProtocol |
| 本地协议 | |
类 | |
| struct | rm::URLParseInfo |
| URL 解析结果 更多... | |
| struct | rm::Request |
| HTTP 请求 更多... | |
| struct | rm::Response |
| HTTP 响应 更多... | |
| class | rm::async::Webapp |
| Web 应用程序框架 更多... | |
| struct | rm::ipc |
| 进程间通信协议族 更多... | |
| struct | rm::ip |
| IP 协议族 更多... | |
| class | rm::Endpoint |
| 端点 更多... | |
| class | rm::Socket |
| Socket 会话层 更多... | |
| class | rm::Acceptor |
| Socket 接受器 更多... | |
| class | rm::Connector |
| Socket 连接器 更多... | |
| class | rm::async::Socket |
| Socket 异步会话层 更多... | |
| class | rm::async::Acceptor |
| 异步 Socket 接受器 更多... | |
| class | rm::async::Connector |
| 异步 Socket 连接器 更多... | |
类型定义 | |
| using | rm::ResponseMiddleware = std::function<void(Response &)> |
| 响应中间件类型 | |
| using | rm::SocketFd = int |
枚举 | |
| enum class | rm::HTTPMethod : uint8_t { rm::HTTPMethod::Get , rm::HTTPMethod::Post , rm::HTTPMethod::Put , rm::HTTPMethod::Delete , rm::HTTPMethod::Patch , rm::HTTPMethod::Head , rm::HTTPMethod::Options , rm::HTTPMethod::Trace , rm::HTTPMethod::Connect , rm::HTTPMethod::Unknown } |
| HTTP 请求方法 更多... | |
函数 | |
| URLParseInfo | rm::parseURL (std::string_view url) |
| 解析 URL | |
| std::tuple< std::string, bool > | rm::parseDNS (std::string_view hostname) |
| 域名解析 | |
| void | rm::cors (Response &res) |
| 跨域资源共享 CORS 中间件,为响应添加 CORS 头部信息 | |
| Response | rm::requests::request (HTTPMethod method, std::string_view url, const std::vector< std::string > &querys={}, const std::unordered_map< std::string, std::string > &heads={}, std::string_view body="") |
| 发出同步 HTTP 请求 | |
| Response | rm::requests::get (std::string_view url, const std::vector< std::string > &querys={}, const std::unordered_map< std::string, std::string > &heads={}) |
| 发出同步 GET 请求 | |
| Response | rm::requests::post (std::string_view url, std::string_view body, const std::vector< std::string > &querys={}, const std::unordered_map< std::string, std::string > &heads={}) |
| 发出同步 POST 请求 | |
| Response | rm::requests::del (std::string_view url, const std::vector< std::string > &querys={}, const std::unordered_map< std::string, std::string > &heads={}) |
| 发出同步 DELETE 请求 | |
| Task< Response > | rm::async::requests::request (IOContext &io_context, HTTPMethod method, std::string_view url, const std::vector< std::string > &querys={}, const std::unordered_map< std::string, std::string > &heads={}, std::string_view body="") |
| 发出异步 HTTP 请求 | |
| Task< Response > | rm::async::requests::get (IOContext &io_context, std::string_view url, const std::vector< std::string > &querys={}, const std::unordered_map< std::string, std::string > &heads={}) |
| 发出异步 GET 请求 | |
| Task< Response > | rm::async::requests::post (IOContext &io_context, std::string_view url, std::string_view body, const std::vector< std::string > &querys={}, const std::unordered_map< std::string, std::string > &heads={}) |
| 发出异步 POST 请求 | |
| Task< Response > | rm::async::requests::del (IOContext &io_context, std::string_view url, const std::vector< std::string > &querys={}, const std::unordered_map< std::string, std::string > &heads={}) |
| 发出异步 DELETE 请求 | |
变量 | |
| constexpr SocketFd | rm::INVALID_SOCKET_FD = -1 |
提供跨平台的同步异步 Socket 通信、HTTP 请求、HTTP Web 后端框架功能
| using rm::ResponseMiddleware = std::function<void(Response &)> |
#include <rmvl/io/netapp.hpp>
响应中间件类型
| using rm::SocketFd = int |
#include <rmvl/io/socket.hpp>
|
strong |
#include <rmvl/io/netapp.hpp>
HTTP 请求方法
| void rm::cors | ( | Response & | res | ) |
#include <rmvl/io/netapp.hpp>
跨域资源共享 CORS 中间件,为响应添加 CORS 头部信息
|
inline |
#include <rmvl/io/netapp.hpp>
发出异步 DELETE 请求
| [in] | io_context | 异步 I/O 执行上下文 |
| [in] | url | 请求的 URL |
| [in] | querys | 可选的 URL 参数列表 |
| [in] | heads | 可选的请求头列表 |
|
inline |
#include <rmvl/io/netapp.hpp>
发出同步 DELETE 请求
| [in] | url | 请求的 URL |
| [in] | querys | 可选的 URL 参数列表 |
| [in] | heads | 可选的请求头列表 |
|
inline |
#include <rmvl/io/netapp.hpp>
发出异步 GET 请求
| [in] | io_context | 异步 I/O 执行上下文 |
| [in] | url | 请求的 URL |
| [in] | querys | 可选的 URL 参数列表 |
| [in] | heads | 可选的请求头列表 |
|
inline |
#include <rmvl/io/netapp.hpp>
发出同步 GET 请求
| [in] | url | 请求的 URL |
| [in] | querys | 可选的 URL 参数列表 |
| [in] | heads | 可选的请求头列表 |
| std::tuple< std::string, bool > rm::parseDNS | ( | std::string_view | hostname | ) |
| URLParseInfo rm::parseURL | ( | std::string_view | url | ) |
#include <rmvl/io/netapp.hpp>
解析 URL
| [in] | url | 统一资源定位符,例如 http://example.com:8080/path |
| scheme | 协议部分,例如 http 或 https |
| hostname | 域名部分,例如 example.com |
| port | 端口号,默认为 80 (HTTP) 或 443 (HTTPS) |
| path | 路径部分,例如 /path/to/resource |
| querys | 以 std::vector 存储的查询参数部分,例如 [key=value, key2=value2] |
|
inline |
#include <rmvl/io/netapp.hpp>
发出异步 POST 请求
| [in] | io_context | 异步 I/O 执行上下文 |
| [in] | url | 请求的 URL |
| [in] | body | 请求体 |
| [in] | querys | 可选的 URL 参数列表 |
| [in] | heads | 可选的请求头列表 |
|
inline |
#include <rmvl/io/netapp.hpp>
发出同步 POST 请求
| [in] | url | 请求的 URL |
| [in] | body | 请求体 |
| [in] | querys | 可选的 URL 参数列表 |
| [in] | heads | 可选的请求头列表 |
| Task< Response > rm::async::requests::request | ( | IOContext & | io_context, |
| HTTPMethod | method, | ||
| std::string_view | url, | ||
| const std::vector< std::string > & | querys = {}, | ||
| const std::unordered_map< std::string, std::string > & | heads = {}, | ||
| std::string_view | body = "" ) |
#include <rmvl/io/netapp.hpp>
发出异步 HTTP 请求
| [in] | io_context | 异步 I/O 执行上下文 |
| [in] | method | 请求方法 |
| [in] | url | 请求的 URL |
| [in] | querys | 可选的 URL 参数列表 |
| [in] | heads | 可选的请求头列表 |
| [in] | body | 可选的请求体 |
| Response rm::requests::request | ( | HTTPMethod | method, |
| std::string_view | url, | ||
| const std::vector< std::string > & | querys = {}, | ||
| const std::unordered_map< std::string, std::string > & | heads = {}, | ||
| std::string_view | body = "" ) |
#include <rmvl/io/netapp.hpp>
发出同步 HTTP 请求
| [in] | method | 请求方法 |
| [in] | url | 请求的 URL |
| [in] | querys | 可选的 URL 查询参数列表 |
| [in] | heads | 可选的请求头列表 |
| [in] | body | 可选的请求体 |
|
constexpr |
#include <rmvl/io/socket.hpp>