xrtHttpServerMuxConfigInit

初始化最多 256 个 Host 和 64 KiB Host 文本的默认配置;存储可以未对齐。

void xrtHttpServerMuxConfigInit( xhttpservermuxconfig* pConfig );
参数说明
xhttpservermuxconfig* pConfig配置结构
返回:初始化最多 256 个 Host 和 64 KiB Host 文本的默认配置;存储可以未对齐。

示例已编译验证

httpservermuxconfiginit obj;
xrtHttpServerMuxConfigInit(&obj);

xrtHttpServerMuxCreate

创建可并发查询并允许运行时替换 Router 的空 Mux;配置被立即快照。

xhttpservermux* xrtHttpServerMuxCreate( const xhttpservermuxconfig* pConfig );
参数说明
const xhttpservermuxconfig* pConfig配置结构
返回:创建可并发查询并允许运行时替换 Router 的空 Mux;配置被立即快照。

示例已编译验证

/* 创建可并发查询并允许运行时替换 Router 的空 Mux;配置被立即快照。 */
xhandle* h = xrtHttpServerMuxCreate();

xrtHttpServerMuxRef

增加 Mux 引用;运行中的 Server 会独立持有一份引用。

xhttpservermux* xrtHttpServerMuxRef( xhttpservermux* pMux );
参数说明
xhttpservermux* pMuxMux 参数
返回:增加 Mux 引用;运行中的 Server 会独立持有一份引用。

示例已编译验证

/* 增加 Mux 引用;运行中的 Server 会独立持有一份引用。 */
result = xrtHttpServerMuxRef(pMux);

xrtHttpServerMuxDestroy

释放 Mux 引用;最后一个引用释放全部 Router 与 Host 副本。

void xrtHttpServerMuxDestroy( xhttpservermux* pMux );
参数说明
xhttpservermux* pMuxMux 参数
返回:释放 Mux 引用;最后一个引用释放全部 Router 与 Host 副本。

示例已编译验证

xrtHttpServerMuxDestroy(pMux);

xrtHttpServerMuxDefault

设置或热替换默认站点;Router 必须已经冻结。

bool xrtHttpServerMuxDefault( xhttpservermux* pMux, xhttpserverrouter* pRouter );
参数说明
xhttpservermux* pMuxMux 参数
xhttpserverrouter* pRouter路由器
返回:设置或热替换默认站点;Router 必须已经冻结。

示例已编译验证

/* 设置或热替换默认站点;Router 必须已经冻结。 */
result = xrtHttpServerMuxDefault(pMux, pRouter);

xrtHttpServerMuxHost

XRT_API bool xrtHttpServerMuxHost( xhttpservermux* pMux, xstrview Host, xhttpserverrouter* pRouter );

;
返回:XRT_API bool xrtHttpServerMuxHost( xhttpservermux* pMux, xstrview Host, xhttpserverrouter* pRouter );

示例已编译验证

/* XRT_API bool xrtHttpServerMuxHost( xhttpservermux* pMux, xstrview Host, xhttpserverrouter* pRouter ); */
result = xrtHttpServerMuxHost();

xrtHttpServerMuxRemove

移除精确 Host;不存在是正常 NOT_FOUND,不设置错误。

xhttpservermuxstatus xrtHttpServerMuxRemove( xhttpservermux* pMux, xstrview Host );
参数说明
xhttpservermux* pMuxMux 参数
xstrview Host主机名
返回:移除精确 Host;不存在是正常 NOT_FOUND,不设置错误。

示例已编译验证

/* 移除精确 Host;不存在是正常 NOT_FOUND,不设置错误。 */
result = xrtHttpServerMuxRemove(pMux, Host);

xrtHttpServerMuxMatch

XRT_API xhttpservermuxstatus xrtHttpServerMuxMatch( xhttpservermux* pMux, xstrview Host, xhttpserverrouter** ppRouter );

;
返回:XRT_API xhttpservermuxstatus xrtHttpServerMuxMatch( xhttpservermux* pMux, xstrview Host, xhttpserverrouter** ppRouter );

示例已编译验证

/* XRT_API xhttpservermuxstatus xrtHttpServerMuxMatch( xhttpservermux* pMux, xstrview Host, xhttpserverrouter** ppRouter ); */
result = xrtHttpServerMuxMatch();

xrtHttpServerMuxStats

XRT_API bool xrtHttpServerMuxStats( xhttpservermux* pMux, xhttpservermuxstats* pStats );

;
返回:XRT_API bool xrtHttpServerMuxStats( xhttpservermux* pMux, xhttpservermuxstats* pStats );

示例已编译验证

/* XRT_API bool xrtHttpServerMuxStats( xhttpservermux* pMux, xhttpservermuxstats* pStats ); */
result = xrtHttpServerMuxStats();

xrtHttpServerMuxStart

XRT_API xhttpserver* xrtHttpServerMuxStart( xnetengine* pEngine, const xhttpserverconfig* pConfig, xhttpservermux* pMux, const xhttpserverevents* pEvents );

;
返回:XRT_API xhttpserver* xrtHttpServerMuxStart( xnetengine* pEngine, const xhttpserverconfig* pConfig, xhttpservermux* pMux, const xhttpserverevents* pEvents );

示例已编译验证

/* XRT_API xhttpserver* xrtHttpServerMuxStart( xnetengine* pEngine, const xhttpserverconfig* pConfig, xhttpservermux* pMux, const xhttpserverevents* pEvents ); */
result = xrtHttpServerMuxStart();