![]() |
RMVL
2.4.0-dev
Robotic Manipulation and Vision Library
|
提供跨平台的同步异步 Socket 通信、HTTP 请求、HTTP Web 后端框架功能 更多...
命名空间 | |
| namespace | rm::ip |
| IP 协议族,包含 IPv4 和 IPv6 以及多播选项的相关定义 | |
类 | |
| struct | rm::URLParseInfo |
| URL 解析结果 更多... | |
| struct | rm::Request |
| HTTP 请求结构 更多... | |
| struct | rm::Response |
| HTTP 响应结构 更多... | |
| class | rm::async::Webapp |
| Web 应用程序框架 更多... | |
| struct | rm::NetworkInterfaceFlag |
| 接口功能与状态标志 更多... | |
| class | rm::NetworkInterface |
| 网络接口 更多... | |
| class | rm::Endpoint |
| 端点 更多... | |
| class | rm::DgramSocket |
| 由 rm::Listener 或 rm::Sender 建立的数据报式 Socket 会话 更多... | |
| class | rm::Sender |
| 同步数据报式 Socket 发送器 更多... | |
| class | rm::Listener |
| 同步数据报式 Socket 监听器 更多... | |
| class | rm::StreamSocket |
| 由 rm::Acceptor 或 rm::Connector 建立的流式 Socket 会话 更多... | |
| class | rm::Acceptor |
| Socket 接受器 更多... | |
| class | rm::Connector |
| Socket 连接器 更多... | |
| class | rm::async::DgramSocket |
| 由 rm::async::Listener 建立的数据报式 Socket 异步会话 更多... | |
| class | rm::async::Sender |
| 异步数据报式 Socket 发送器 更多... | |
| class | rm::async::Listener |
| 异步数据报式 Socket 监听器 更多... | |
| class | rm::async::StreamSocket |
| 由 rm::async::Acceptor 建立的流式 Socket 异步会话 更多... | |
| class | rm::async::Acceptor |
| 异步流式 Socket 接受器 更多... | |
| class | rm::async::Connector |
| 异步流式 Socket 连接器 更多... | |
类型定义 | |
| using | rm::ResponseMiddleware = std::function<void(const Request &, Response &)> |
| 响应中间件类型 | |
| using | rm::SocketFd = int |
函数 | |
| URLParseInfo | rm::parseURL (std::string_view url) |
| 解析 URL | |
| std::tuple< std::string, bool > | rm::parseDNS (std::string_view hostname) |
| 域名解析 | |
| ResponseMiddleware | rm::statics (std::string_view url, std::string_view root) |
| 静态路由中间件,处理对指定 URL 路径的静态文件请求 | |
| ResponseMiddleware | rm::cors () |
| 跨域资源共享 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(const Request &, Response &)> |
#include <rmvl/io/netapp.hpp>
响应中间件类型
| using rm::SocketFd = int |
#include <rmvl/io/socket.hpp>
|
strong |
#include <rmvl/io/netapp.hpp>
HTTP 请求方法
|
strong |
#include <rmvl/io/socket.hpp>
接口驱动类型
| 枚举值 | |
|---|---|
| Ethernet | 以太网 |
| Wireless | 无线接口 |
| PPP | 点对点协议 |
| Tunnel | 隧道接口 |
| Loopback | lo 回环设备 |
| Other | 其他 |
| Unknown | 未知类型 |
| ResponseMiddleware rm::cors | ( | ) |
#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 | 可选的请求体 |
| ResponseMiddleware rm::statics | ( | std::string_view | url, |
| std::string_view | root ) |
#include <rmvl/io/netapp.hpp>
静态路由中间件,处理对指定 URL 路径的静态文件请求
| [in] | url | URL 路径前缀,例如 /static |
| [in] | root | 静态文件根目录,例如 ./public |
|
constexpr |
#include <rmvl/io/socket.hpp>