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" / >
2016-11-14 18:12:31 +08:00
< meta name = "generator" content = "Doxygen 1.8.12" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
2016-06-20 17:05:31 +08:00
< title > libwebsockets: Protocols and Plugins< / 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 -->
2016-11-14 18:12:31 +08:00
<!-- Generated by Doxygen 1.8.12 -->
< 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__Protocols-and-Plugins.html','');});
< / script >
< div id = "doc-content" >
< div class = "header" >
< div class = "summary" >
< a href = "#groups" > Modules< / a > |
< a href = "#nested-classes" > Data Structures< / a > |
< a href = "#typedef-members" > Typedefs< / a > |
< a href = "#func-members" > Functions< / a > < / div >
< div class = "headertitle" >
< div class = "title" > Protocols and Plugins< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "groups" > < / a >
Modules< / h2 > < / td > < / tr >
< tr class = "memitem:group__generic-sessions" > < td class = "memItemLeft" align = "right" valign = "top" >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__generic-sessions.html" > plugin: generic-sessions< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "nested-classes" > < / a >
Data Structures< / h2 > < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > struct   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > struct   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "structlws__plugin__capability.html" > lws_plugin_capability< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > struct   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "structlws__plugin.html" > lws_plugin< / a > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "typedef-members" > < / a >
Typedefs< / h2 > < / td > < / tr >
2016-11-14 18:12:31 +08:00
< tr class = "memitem:ga40994491e1567f91f579d2b444775266" > < td class = "memItemLeft" align = "right" valign = "top" > < a id = "ga40994491e1567f91f579d2b444775266" > < / a >
2016-06-20 17:05:31 +08:00
typedef int(*  < / td > < td class = "memItemRight" valign = "bottom" > < b > lws_plugin_init_func< / b > ) (struct lws_context *, struct < a class = "el" href = "structlws__plugin__capability.html" > lws_plugin_capability< / a > *)< / td > < / tr >
< tr class = "separator:ga40994491e1567f91f579d2b444775266" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2016-11-14 18:12:31 +08:00
< tr class = "memitem:ga83f7a924ba790fa273476075a59f08b0" > < td class = "memItemLeft" align = "right" valign = "top" > < a id = "ga83f7a924ba790fa273476075a59f08b0" > < / a >
2016-06-20 17:05:31 +08:00
typedef int(*  < / td > < td class = "memItemRight" valign = "bottom" > < b > lws_plugin_destroy_func< / b > ) (struct lws_context *)< / td > < / tr >
< tr class = "separator:ga83f7a924ba790fa273476075a59f08b0" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:ga25754726d97c5f519d313e691a9fe29d" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN const struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__Protocols-and-Plugins.html#ga25754726d97c5f519d313e691a9fe29d" > lws_vhost_name_to_protocol< / a > (struct lws_vhost *vh, const char *name)< / td > < / tr >
< tr class = "separator:ga25754726d97c5f519d313e691a9fe29d" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga72ad550786ca7976463589d347e62112" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN const struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__Protocols-and-Plugins.html#ga72ad550786ca7976463589d347e62112" > lws_get_protocol< / a > (struct lws *wsi)< / td > < / tr >
< tr class = "separator:ga72ad550786ca7976463589d347e62112" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga8bbe5e65faca068845704bab911a5030" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN const struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__Protocols-and-Plugins.html#ga8bbe5e65faca068845704bab911a5030" > lws_protocol_get< / a > (struct lws *wsi) LWS_WARN_DEPRECATED< / td > < / tr >
< tr class = "separator:ga8bbe5e65faca068845704bab911a5030" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gaec0c0477288ff3f83aff38d357b883d1" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN void *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__Protocols-and-Plugins.html#gaec0c0477288ff3f83aff38d357b883d1" > lws_protocol_vh_priv_zalloc< / a > (struct lws_vhost *vhost, const struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > *prot, int size)< / td > < / tr >
< tr class = "separator:gaec0c0477288ff3f83aff38d357b883d1" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gaf3be4243443baac0f8be1fcfb4d25129" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN void *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__Protocols-and-Plugins.html#gaf3be4243443baac0f8be1fcfb4d25129" > lws_protocol_vh_priv_get< / a > (struct lws_vhost *vhost, const struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > *prot)< / td > < / tr >
< tr class = "separator:gaf3be4243443baac0f8be1fcfb4d25129" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga106b37ae9c247e84d191ab09441adc43" > < td class = "memItemLeft" align = "right" valign = "top" > LWS_VISIBLE LWS_EXTERN int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "group__Protocols-and-Plugins.html#ga106b37ae9c247e84d191ab09441adc43" > lws_finalize_startup< / a > (struct lws_context *context)< / td > < / tr >
< tr class = "separator:ga106b37ae9c247e84d191ab09441adc43" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
< h2 > Protocol and protocol plugin -related apis< / h2 >
< p > Protocols bind ws protocol names to a custom callback specific to that protocol implementaion.< / p >
< p > A list of protocols can be passed in at context creation time, but it is also legal to leave that NULL and add the protocols and their callback code using plugins.< / p >
< p > Plugins are much preferable compared to cut and pasting code into an application each time, since they can be used standalone. < / p >
< h2 class = "groupheader" > Function Documentation< / h2 >
2016-11-14 18:12:31 +08:00
< a id = "ga106b37ae9c247e84d191ab09441adc43" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga106b37ae9c247e84d191ab09441adc43" > § < / a > < / span > lws_finalize_startup()< / h2 >
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_finalize_startup < / 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__Protocols-and-Plugins.html#ga106b37ae9c247e84d191ab09441adc43" > lws_finalize_startup()< / a > - drop initial process privileges< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > context< / td > < td > lws context< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > This is called after the end of the vhost protocol initializations, but you may choose to call it earlier < / p >
< / div >
< / div >
2016-11-14 18:12:31 +08:00
< a id = "ga72ad550786ca7976463589d347e62112" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga72ad550786ca7976463589d347e62112" > § < / a > < / span > lws_get_protocol()< / h2 >
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 struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > * lws_get_protocol < / 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__Protocols-and-Plugins.html#ga72ad550786ca7976463589d347e62112" > lws_get_protocol()< / a > - Returns a protocol pointer from a websocket connection. < / p > < dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > wsi< / td > < td > pointer to struct websocket you want to know the protocol of< / td > < / tr >
< / table >
< / dd >
< / dl >
< pre class = "fragment" > Some apis can act on all live connections of a given protocol,
this is how you can get a pointer to the active protocol if needed.< / pre >
< / div >
< / div >
2016-11-14 18:12:31 +08:00
< a id = "ga8bbe5e65faca068845704bab911a5030" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga8bbe5e65faca068845704bab911a5030" > § < / a > < / span > lws_protocol_get()< / h2 >
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 struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > * lws_protocol_get < / 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__Protocols-and-Plugins.html#ga8bbe5e65faca068845704bab911a5030" > lws_protocol_get()< / a > - deprecated: use lws_get_protocol < / p >
< / div >
< / div >
2016-11-14 18:12:31 +08:00
< a id = "gaf3be4243443baac0f8be1fcfb4d25129" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gaf3be4243443baac0f8be1fcfb4d25129" > § < / a > < / span > lws_protocol_vh_priv_get()< / h2 >
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_protocol_vh_priv_get < / td >
< td > (< / td >
< td class = "paramtype" > struct lws_vhost *  < / td >
< td class = "paramname" > < em > vhost< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > *  < / td >
< td class = "paramname" > < em > prot< / 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__Protocols-and-Plugins.html#gaf3be4243443baac0f8be1fcfb4d25129" > lws_protocol_vh_priv_get()< / a > - retreive a protocol's per-vhost storage< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > vhost< / td > < td > vhost the instance is related to < / td > < / tr >
< tr > < td class = "paramname" > prot< / td > < td > protocol the instance is related to< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > Recover a pointer to the allocated per-vhost storage for the protocol created by < a class = "el" href = "group__Protocols-and-Plugins.html#gaec0c0477288ff3f83aff38d357b883d1" > lws_protocol_vh_priv_zalloc()< / a > earlier < / p >
< / div >
< / div >
2016-11-14 18:12:31 +08:00
< a id = "gaec0c0477288ff3f83aff38d357b883d1" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gaec0c0477288ff3f83aff38d357b883d1" > § < / a > < / span > lws_protocol_vh_priv_zalloc()< / h2 >
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_protocol_vh_priv_zalloc < / td >
< td > (< / td >
< td class = "paramtype" > struct lws_vhost *  < / td >
< td class = "paramname" > < em > vhost< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > *  < / td >
< td class = "paramname" > < em > prot< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > size< / 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__Protocols-and-Plugins.html#gaec0c0477288ff3f83aff38d357b883d1" > lws_protocol_vh_priv_zalloc()< / a > - Allocate and zero down a protocol's per-vhost storage < / p > < dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > vhost< / td > < td > vhost the instance is related to < / td > < / tr >
< tr > < td class = "paramname" > prot< / td > < td > protocol the instance is related to < / td > < / tr >
< tr > < td class = "paramname" > size< / td > < td > bytes to allocate< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > Protocols often find it useful to allocate a per-vhost struct, this is a helper to be called in the per-vhost init LWS_CALLBACK_PROTOCOL_INIT < / p >
< / div >
< / div >
2016-11-14 18:12:31 +08:00
< a id = "ga25754726d97c5f519d313e691a9fe29d" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga25754726d97c5f519d313e691a9fe29d" > § < / a > < / span > lws_vhost_name_to_protocol()< / h2 >
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 struct < a class = "el" href = "structlws__protocols.html" > lws_protocols< / a > * lws_vhost_name_to_protocol < / td >
< td > (< / td >
< td class = "paramtype" > struct lws_vhost *  < / td >
< td class = "paramname" > < em > vh< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > name< / 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__Protocols-and-Plugins.html#ga25754726d97c5f519d313e691a9fe29d" > lws_vhost_name_to_protocol()< / a > - get vhost's protocol object from its name< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > vh< / td > < td > vhost to search < / td > < / tr >
< tr > < td class = "paramname" > name< / td > < td > protocol name< / td > < / tr >
< / table >
< / dd >
< / dl >
< p > Returns NULL or a pointer to the vhost's protocol of the requested name < / 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" >
2016-11-14 18:12:31 +08:00
< img class = "footer" src = "doxygen.png" alt = "doxygen" / > < / a > 1.8.12 < / li >
2016-06-20 17:05:31 +08:00
< / ul >
< / div >
< / body >
< / html >