2016-06-20 17:05:31 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=9" / >
2017-03-20 19:37:47 +08:00
< meta name = "generator" content = "Doxygen 1.8.13" / >
2017-02-05 22:46:39 +08:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
2016-06-20 17:05:31 +08:00
< title > libwebsockets: Miscellaneous APIs< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "jquery.js" > < / script >
< script type = "text/javascript" src = "dynsections.js" > < / script >
< link href = "navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "resize.js" > < / script >
< script type = "text/javascript" src = "navtreedata.js" > < / script >
< script type = "text/javascript" src = "navtree.js" > < / script >
< script type = "text/javascript" >
$(document).ready(initResizable);
< / script >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr style = "height: 56px;" >
< td id = "projectlogo" > < img alt = "Logo" src = "libwebsockets.org-logo.png" / > < / td >
< td id = "projectalign" style = "padding-left: 0.5em;" >
< div id = "projectname" > libwebsockets
< / div >
< div id = "projectbrief" > Lightweight C library for HTML5 websockets< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2017-03-20 19:37:47 +08:00
<!-- Generated by Doxygen 1.8.13 -->
2017-02-05 22:46:39 +08:00
< script type = "text/javascript" src = "menudata.js" > < / script >
< script type = "text/javascript" src = "menu.js" > < / script >
< script type = "text/javascript" >
$(function() {
initMenu('',false,false,'search.php','Search');
});
< / script >
< div id = "main-nav" > < / div >
2016-06-20 17:05:31 +08:00
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
< script type = "text/javascript" >
$(document).ready(function(){initNavTree('group__misc.html','');});
< / script >
< div id = "doc-content" >
< div class = "header" >
< div class = "summary" >
< a href = "#func-members" > Functions< / a > < / div >
< div class = "headertitle" >
< div class = "title" > Miscellaneous APIs< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
2017-02-05 22:46:39 +08:00
< tr class = "memitem:ga2163492f17db959a36967adb73d823b4" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#ga2163492f17db959a36967adb73d823b4" > lws_snprintf< / a > (char *str, size_t size, const char *format,...) LWS_FORMAT(3)< / td > < / tr >
< tr class = "separator:ga2163492f17db959a36967adb73d823b4" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2016-06-20 17:05:31 +08:00
< tr class = "memitem:ga58f906c6be0ca80efd813f694569dd4a" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#ga58f906c6be0ca80efd813f694569dd4a" > lws_get_random< / a > (struct lws_context *context, void *buf, int len)< / td > < / tr >
< tr class = "separator:ga58f906c6be0ca80efd813f694569dd4a" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gace5171b1dbbc03ec89a98f8afdb5c9af" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#gace5171b1dbbc03ec89a98f8afdb5c9af" > lws_daemonize< / a > (const char *_lock_path)< / td > < / tr >
< tr class = "separator:gace5171b1dbbc03ec89a98f8afdb5c9af" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gac6abfc0b2bd5b2f09281a4432bb2f5f0" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN const char *LWS_WARN_UNUSED_RESULT  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#gac6abfc0b2bd5b2f09281a4432bb2f5f0" > lws_get_library_version< / a > (void)< / td > < / tr >
< tr class = "separator:gac6abfc0b2bd5b2f09281a4432bb2f5f0" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gaa194584fff9698f3b280658f770ccd0f" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN void *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#gaa194584fff9698f3b280658f770ccd0f" > lws_wsi_user< / a > (struct lws *wsi)< / td > < / tr >
< tr class = "separator:gaa194584fff9698f3b280658f770ccd0f" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga1ec0d9faac5d3a5824d765c287c043aa" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#ga1ec0d9faac5d3a5824d765c287c043aa" > lws_parse_uri< / a > (char *p, const char **prot, const char **ads, int *port, const char **path)< / td > < / tr >
< tr class = "separator:ga1ec0d9faac5d3a5824d765c287c043aa" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga33bf2635033710b25f931b57ed663e1e" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN unsigned long  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#ga33bf2635033710b25f931b57ed663e1e" > lws_now_secs< / a > (void)< / td > < / tr >
< tr class = "separator:ga33bf2635033710b25f931b57ed663e1e" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga0af4f7d2dd375aeedcfa7eb0e1101c4b" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN struct lws_context *LWS_WARN_UNUSED_RESULT  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#ga0af4f7d2dd375aeedcfa7eb0e1101c4b" > lws_get_context< / a > (const struct lws *wsi)< / td > < / tr >
< tr class = "separator:ga0af4f7d2dd375aeedcfa7eb0e1101c4b" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga629f48268fd1856b54b11172991b97d9" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#ga629f48268fd1856b54b11172991b97d9" > lws_get_count_threads< / a > (struct lws_context *context)< / td > < / tr >
< tr class = "separator:ga629f48268fd1856b54b11172991b97d9" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga8930fe36a3f3eefe4a6a4fd499d8e899" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#ga8930fe36a3f3eefe4a6a4fd499d8e899" > lws_get_parent< / a > (const struct lws *wsi)< / td > < / tr >
< tr class = "separator:ga8930fe36a3f3eefe4a6a4fd499d8e899" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gacae4d7b6a8d22e4c2d82ff8b12c1e234" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#gacae4d7b6a8d22e4c2d82ff8b12c1e234" > lws_get_child< / a > (const struct lws *wsi)< / td > < / tr >
< tr class = "separator:gacae4d7b6a8d22e4c2d82ff8b12c1e234" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2017-02-05 22:46:39 +08:00
< tr class = "memitem:ga0e705d498e8c8500649a26ba30a1e106" > < td class = "memItemLeft" align = "right" valign = "top" > < a id = "ga0e705d498e8c8500649a26ba30a1e106" > < / a >
2016-06-20 17:05:31 +08:00
LWS_VISIBLE LWS_EXTERN int  < / td > < td class = "memItemRight" valign = "bottom" > < b > lws_read< / b > (struct lws *wsi, unsigned char *buf, size_t len)< / td > < / tr >
< tr class = "separator:ga0e705d498e8c8500649a26ba30a1e106" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gab321ed812f46f6dc7ef9e3ca6f00cf1b" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__misc.html#gab321ed812f46f6dc7ef9e3ca6f00cf1b" > lws_set_allocator< / a > (void *(*realloc)(void *ptr, size_t size))< / td > < / tr >
< tr class = "separator:gab321ed812f46f6dc7ef9e3ca6f00cf1b" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
< h2 > Miscellaneous APIs< / h2 >
< p > Various APIs outside of other categories < / p >
< h2 class = "groupheader" > Function Documentation< / h2 >
2017-02-05 22:46:39 +08:00
< a id = "gace5171b1dbbc03ec89a98f8afdb5c9af" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gace5171b1dbbc03ec89a98f8afdb5c9af" > ◆ < / a > < / span > lws_daemonize()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_daemonize < / td >
< td > (< / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > _lock_path< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#gace5171b1dbbc03ec89a98f8afdb5c9af" > lws_daemonize()< / a > : fill a buffer with platform random data< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > _lock_path< / td > < td > the filepath to write the lock file< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > Spawn lws as a background process, taking care of various things < / p >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "gacae4d7b6a8d22e4c2d82ff8b12c1e234" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gacae4d7b6a8d22e4c2d82ff8b12c1e234" > ◆ < / a > < / span > lws_get_child()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN struct lws* LWS_WARN_UNUSED_RESULT lws_get_child < / td >
< td > (< / td >
< td class = "paramtype" > const struct lws *  < / td >
< td class = "paramname" > < em > wsi< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#gacae4d7b6a8d22e4c2d82ff8b12c1e234" > lws_get_child()< / a > - get child wsi or NULL < / p > < dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > wsi< / td > < td > lws connection< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > Allows you to find a related wsi from the parent wsi. < / p >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "ga0af4f7d2dd375aeedcfa7eb0e1101c4b" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga0af4f7d2dd375aeedcfa7eb0e1101c4b" > ◆ < / a > < / span > lws_get_context()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN struct lws_context* LWS_WARN_UNUSED_RESULT lws_get_context < / td >
< td > (< / td >
< td class = "paramtype" > const struct lws *  < / td >
< td class = "paramname" > < em > wsi< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > lws_get_context - Allow geting lws_context from a Websocket connection instance< / p >
< p > With this function, users can access context in the callback function. Otherwise users may have to declare context as a global variable.< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > wsi< / td > < td > Websocket connection instance < / td > < / tr >
< / table >
< / dd >
< / dl >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "ga629f48268fd1856b54b11172991b97d9" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga629f48268fd1856b54b11172991b97d9" > ◆ < / a > < / span > lws_get_count_threads()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_get_count_threads < / td >
< td > (< / td >
< td class = "paramtype" > struct lws_context *  < / td >
< td class = "paramname" > < em > context< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#ga629f48268fd1856b54b11172991b97d9" > lws_get_count_threads()< / a > : how many service threads the context uses< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > context< / td > < td > the lws context< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > By default this is always 1, if you asked for more than lws can handle it will clip the number of threads. So you can use this to find out how many threads are actually in use. < / p >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "gac6abfc0b2bd5b2f09281a4432bb2f5f0" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gac6abfc0b2bd5b2f09281a4432bb2f5f0" > ◆ < / a > < / span > lws_get_library_version()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN const char* LWS_WARN_UNUSED_RESULT lws_get_library_version < / td >
< td > (< / td >
< td class = "paramtype" > void  < / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#gac6abfc0b2bd5b2f09281a4432bb2f5f0" > lws_get_library_version()< / a > : return string describing the version of lws< / p >
< p > On unix, also includes the git describe < / p >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "ga8930fe36a3f3eefe4a6a4fd499d8e899" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga8930fe36a3f3eefe4a6a4fd499d8e899" > ◆ < / a > < / span > lws_get_parent()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN struct lws* LWS_WARN_UNUSED_RESULT lws_get_parent < / td >
< td > (< / td >
< td class = "paramtype" > const struct lws *  < / td >
< td class = "paramname" > < em > wsi< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#ga8930fe36a3f3eefe4a6a4fd499d8e899" > lws_get_parent()< / a > - get parent wsi or NULL < / p > < dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > wsi< / td > < td > lws connection< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > Specialized wsi like cgi stdin/out/err are associated to a parent wsi, this allows you to get their parent. < / p >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "ga58f906c6be0ca80efd813f694569dd4a" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga58f906c6be0ca80efd813f694569dd4a" > ◆ < / a > < / span > lws_get_random()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN int lws_get_random < / td >
< td > (< / td >
< td class = "paramtype" > struct lws_context *  < / td >
< td class = "paramname" > < em > context< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > void *  < / td >
< td class = "paramname" > < em > buf< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > len< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#ga58f906c6be0ca80efd813f694569dd4a" > lws_get_random()< / a > : fill a buffer with platform random data< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > context< / td > < td > the lws context < / td > < / tr >
< tr > < td class = "paramname" > buf< / td > < td > buffer to fill < / td > < / tr >
< tr > < td class = "paramname" > len< / td > < td > how much to fill< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > This is intended to be called from the LWS_CALLBACK_RECEIVE callback if it's interested to see if the frame it's dealing with was sent in binary mode. < / p >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "ga33bf2635033710b25f931b57ed663e1e" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga33bf2635033710b25f931b57ed663e1e" > ◆ < / a > < / span > lws_now_secs()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN unsigned long lws_now_secs < / td >
< td > (< / td >
< td class = "paramtype" > void  < / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#ga33bf2635033710b25f931b57ed663e1e" > lws_now_secs()< / a > : return seconds since 1970-1-1 < / p >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "ga1ec0d9faac5d3a5824d765c287c043aa" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga1ec0d9faac5d3a5824d765c287c043aa" > ◆ < / a > < / span > lws_parse_uri()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_parse_uri < / td >
< td > (< / td >
< td class = "paramtype" > char *  < / td >
< td class = "paramname" > < em > p< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const char **  < / td >
< td class = "paramname" > < em > prot< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const char **  < / td >
< td class = "paramname" > < em > ads< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int *  < / td >
< td class = "paramname" > < em > port< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const char **  < / td >
< td class = "paramname" > < em > path< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > lws_parse_uri: cut up prot:/ads:port/path into pieces Notice it does so by dropping '\0' into input string and the leading / on the path is consequently lost< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > p< / td > < td > incoming uri string.. will get written to < / td > < / tr >
< tr > < td class = "paramname" > prot< / td > < td > result pointer for protocol part (< a href = "https://" > https://< / a > ) < / td > < / tr >
< tr > < td class = "paramname" > ads< / td > < td > result pointer for address part < / td > < / tr >
< tr > < td class = "paramname" > port< / td > < td > result pointer for port part < / td > < / tr >
< tr > < td class = "paramname" > path< / td > < td > result pointer for path part < / td > < / tr >
< / table >
< / dd >
< / dl >
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "gab321ed812f46f6dc7ef9e3ca6f00cf1b" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gab321ed812f46f6dc7ef9e3ca6f00cf1b" > ◆ < / a > < / span > lws_set_allocator()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN void lws_set_allocator < / td >
< td > (< / td >
< td class = "paramtype" > void *(*)(void *ptr, size_t size)  < / td >
< td class = "paramname" > < em > realloc< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#gab321ed812f46f6dc7ef9e3ca6f00cf1b" > lws_set_allocator()< / a > - custom allocator support< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > realloc< / td > < td > Allows you to replace the allocator (and deallocator) used by lws < / td > < / tr >
< / table >
< / dd >
< / dl >
2016-09-15 02:22:57 +08:00
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "ga2163492f17db959a36967adb73d823b4" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga2163492f17db959a36967adb73d823b4" > ◆ < / a > < / span > lws_snprintf()< / h2 >
2017-02-05 22:46:39 +08:00
2016-09-15 02:22:57 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN int lws_snprintf < / td >
< td > (< / td >
< td class = "paramtype" > char *  < / td >
< td class = "paramname" > < em > str< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > size_t  < / td >
< td class = "paramname" > < em > size< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > format< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" >   < / td >
< td class = "paramname" > < em > ...< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
2017-02-05 22:46:39 +08:00
< p > < a class = "el" href = "group__misc.html#ga2163492f17db959a36967adb73d823b4" > lws_snprintf()< / a > : snprintf that truncates the returned length too< / p >
2016-09-15 02:22:57 +08:00
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > str< / td > < td > destination buffer < / td > < / tr >
< tr > < td class = "paramname" > size< / td > < td > bytes left in destination buffer < / td > < / tr >
< tr > < td class = "paramname" > format< / td > < td > format string < / td > < / tr >
< tr > < td class = "paramname" > ...< / td > < td > args for format< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > This lets you correctly truncate buffers by concatenating lengths, if you reach the limit the reported length doesn't exceed the limit. < / p >
2016-06-20 17:05:31 +08:00
< / div >
< / div >
2017-02-05 22:46:39 +08:00
< a id = "gaa194584fff9698f3b280658f770ccd0f" > < / a >
2017-03-20 19:37:47 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gaa194584fff9698f3b280658f770ccd0f" > ◆ < / a > < / span > lws_wsi_user()< / h2 >
2017-02-05 22:46:39 +08:00
2016-06-20 17:05:31 +08:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > LWS_VISIBLE LWS_EXTERN void* lws_wsi_user < / td >
< td > (< / td >
< td class = "paramtype" > struct lws *  < / td >
< td class = "paramname" > < em > wsi< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > < code > #include < < a class = "el" href = "libwebsockets_8h.html" > lib/libwebsockets.h< / a > > < / code > < / p >
< p > < a class = "el" href = "group__misc.html#gaa194584fff9698f3b280658f770ccd0f" > lws_wsi_user()< / a > - get the user data associated with the connection < / p > < dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > wsi< / td > < td > lws connection< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > Not normally needed since it's passed into the callback < / p >
< / div >
< / div >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "footer" > Generated by
< a href = "http://www.doxygen.org/index.html" >
2017-03-20 19:37:47 +08:00
< img class = "footer" src = "doxygen.png" alt = "doxygen" / > < / a > 1.8.13 < / li >
2016-06-20 17:05:31 +08:00
< / ul >
< / div >
< / body >
< / html >