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

ss: add lws_ss_to_user_object

The ss handle is opaque, so if you need to get the user allocation from the handle
outside of a callback, a helper is needed.

ABI change.
This commit is contained in:
Andy Green 2020-03-15 04:40:30 +00:00
parent 2cd8f599eb
commit f843668db9
2 changed files with 18 additions and 0 deletions

View file

@ -420,6 +420,18 @@ lws_ss_state_name(int state);
LWS_VISIBLE LWS_EXTERN struct lws_context *
lws_ss_get_context(struct lws_ss_handle *h);
/**
* lws_ss_to_user_object() - convenience helper to get user object from handle
*
* \param h: secure streams handle
*
* Returns the user allocation related to the handle. Normally you won't need
* this since it's available in the rx, tx and state callbacks as "userdata"
* already.
*/
LWS_VISIBLE LWS_EXTERN void *
lws_ss_to_user_object(struct lws_ss_handle *h);
/**
* lws_ss_rideshare() - find the current streamtype when types rideshare
*

View file

@ -480,6 +480,12 @@ lws_ss_create(struct lws_context *context, int tsi, const lws_ss_info_t *ssi,
return 0;
}
void *
lws_ss_to_user_object(struct lws_ss_handle *h)
{
return (void *)&h[1];
}
void
lws_ss_destroy(lws_ss_handle_t **ppss)
{