1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

lws_pvo_get_str

This commit is contained in:
Andy Green 2018-08-15 09:23:35 +08:00
parent 79397b21a3
commit 956bb4e255
2 changed files with 27 additions and 0 deletions

View file

@ -3019,6 +3019,21 @@ lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name)
return pvo;
}
int
lws_pvo_get_str(void *in, const char *name, const char **result)
{
const struct lws_protocol_vhost_options *pv =
lws_pvo_search((const struct lws_protocol_vhost_options *)in,
name);
if (!pv)
return 1;
*result = (const char *)pv->value;
return 0;
}
void
lws_sum_stats(const struct lws_context *ctx, struct lws_conn_stats *cs)
{

View file

@ -2456,6 +2456,18 @@ lws_finalize_startup(struct lws_context *context);
LWS_VISIBLE LWS_EXTERN const struct lws_protocol_vhost_options *
lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name);
/**
* lws_pvo_get_str() - retreive a string pvo value
*
* \param pvo: the first pvo in the linked-list
* \param name: the name of the pvo to return if found
* \param result: pointer to a const char * to get the result if any
*
* Returns 0 if found and *result set, or nonzero if not found
*/
LWS_VISIBLE LWS_EXTERN int
lws_pvo_get_str(void *in, const char *name, const char **result);
LWS_VISIBLE LWS_EXTERN int
lws_protocol_init(struct lws_context *context);