Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"en-US,en;q\u003d0.5", "gen_ut":1571121020, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"406daea174702abb1deb9013cbad8bb3", "oid":{ "oid": "6d8039c13b80f530edecd833eda608175ce15387", "alias": [ "refs/heads/master"]},"blobname": "include/libwebsockets/lws-writeable.h", "blob": "/*\n * libwebsockets - small server side websockets and web server implementation\n *\n * Copyright (C) 2010 - 2019 Andy Green \u003candy@warmcat.com\u003e\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \u0022Software\u0022), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \u0022AS IS\u0022, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/** \u005cdefgroup callback-when-writeable Callback when writeable\n *\n * ##Callback When Writeable\n *\n * lws can only write data on a connection when it is able to accept more\n * data without blocking.\n *\n * So a basic requirement is we should only use the lws_write() apis when the\n * connection we want to write on says that he can accept more data.\n *\n * When lws cannot complete your send at the time, it will buffer the data\n * and send it in the background, suppressing any further WRITEABLE callbacks\n * on that connection until it completes. So it is important to write new\n * things in a new writeable callback.\n *\n * These apis reflect the various ways we can indicate we would like to be\n * called back when one or more connections is writeable.\n */\n///@{\n\n/**\n * lws_callback_on_writable() - Request a callback when this socket\n *\t\t\t\t\t becomes able to be written to without\n *\t\t\t\t\t blocking\n *\n * \u005cparam wsi:\tWebsocket connection instance to get callback for\n *\n * - Which: only this wsi\n * - When: when the individual connection becomes writeable\n * - What: LWS_CALLBACK_*_WRITEABLE\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_callback_on_writable(struct lws *wsi);\n\n/**\n * lws_callback_on_writable_all_protocol() - Request a callback for all\n *\t\t\tconnections using the given protocol when it\n *\t\t\tbecomes possible to write to each socket without\n *\t\t\tblocking in turn.\n *\n * \u005cparam context:\tlws_context\n * \u005cparam protocol:\tProtocol whose connections will get callbacks\n *\n * - Which: connections using this protocol on ANY VHOST\n * - When: when the individual connection becomes writeable\n * - What: LWS_CALLBACK_*_WRITEABLE\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_callback_on_writable_all_protocol(const struct lws_context *context,\n\t\t\t\t const struct lws_protocols *protocol);\n\n/**\n * lws_callback_on_writable_all_protocol_vhost() - Request a callback for\n *\t\t\tall connections on same vhost using the given protocol\n *\t\t\twhen it becomes possible to write to each socket without\n *\t\t\tblocking in turn.\n *\n * \u005cparam vhost:\tOnly consider connections on this lws_vhost\n * \u005cparam protocol:\tProtocol whose connections will get callbacks\n *\n * - Which: connections using this protocol on GIVEN VHOST ONLY\n * - When: when the individual connection becomes writeable\n * - What: LWS_CALLBACK_*_WRITEABLE\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,\n\t\t\t\t const struct lws_protocols *protocol);\n\n/**\n * lws_callback_all_protocol() - Callback all connections using\n *\t\t\t\tthe given protocol with the given reason\n *\n * \u005cparam context:\tlws_context\n * \u005cparam protocol:\tProtocol whose connections will get callbacks\n * \u005cparam reason:\tCallback reason index\n *\n * - Which: connections using this protocol on ALL VHOSTS\n * - When: before returning\n * - What: reason\n *\n * This isn't normally what you want... normally any update of connection-\n * specific information can wait until a network-related callback like rx,\n * writable, or close.\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_callback_all_protocol(struct lws_context *context,\n\t\t\t const struct lws_protocols *protocol, int reason);\n\n/**\n * lws_callback_all_protocol_vhost() - Callback all connections using\n *\t\t\tthe given protocol with the given reason. This is\n *\t\t\tdeprecated since v2.4: use lws_callback_all_protocol_vhost_args\n *\n * \u005cparam vh:\t\tVhost whose connections will get callbacks\n * \u005cparam protocol:\tWhich protocol to match. NULL means all.\n * \u005cparam reason:\tCallback reason index\n *\n * - Which: connections using this protocol on GIVEN VHOST ONLY\n * - When: now\n * - What: reason\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_callback_all_protocol_vhost(struct lws_vhost *vh,\n\t\t\t\tconst struct lws_protocols *protocol,\n\t\t\t\tint reason)\nLWS_WARN_DEPRECATED;\n\n/**\n * lws_callback_all_protocol_vhost_args() - Callback all connections using\n *\t\t\tthe given protocol with the given reason and args\n *\n * \u005cparam vh:\t\tVhost whose connections will get callbacks\n * \u005cparam protocol:\tWhich protocol to match. NULL means all.\n * \u005cparam reason:\tCallback reason index\n * \u005cparam argp:\t\tCallback \u0022in\u0022 parameter\n * \u005cparam len:\t\tCallback \u0022len\u0022 parameter\n *\n * - Which: connections using this protocol on GIVEN VHOST ONLY\n * - When: now\n * - What: reason\n */\nLWS_VISIBLE int\nlws_callback_all_protocol_vhost_args(struct lws_vhost *vh,\n\t\t\t\t const struct lws_protocols *protocol,\n\t\t\t\t int reason, void *argp, size_t len);\n\n/**\n * lws_callback_vhost_protocols() - Callback all protocols enabled on a vhost\n *\t\t\t\t\twith the given reason\n *\n * \u005cparam wsi:\twsi whose vhost will get callbacks\n * \u005cparam reason:\tCallback reason index\n * \u005cparam in:\t\tin argument to callback\n * \u005cparam len:\tlen argument to callback\n *\n * - Which: connections using this protocol on same VHOST as wsi ONLY\n * - When: now\n * - What: reason\n *\n * This is deprecated since v2.5, use lws_callback_vhost_protocols_vhost()\n * which takes the pointer to the vhost directly without using or needing the\n * wsi.\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len)\nLWS_WARN_DEPRECATED;\n\n/**\n * lws_callback_vhost_protocols_vhost() - Callback all protocols enabled on a vhost\n *\t\t\t\t\twith the given reason\n *\n * \u005cparam vh:\t\tvhost that will get callbacks\n * \u005cparam reason:\tCallback reason index\n * \u005cparam in:\t\tin argument to callback\n * \u005cparam len:\t\tlen argument to callback\n *\n * - Which: connections using this protocol on same VHOST as wsi ONLY\n * - When: now\n * - What: reason\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_callback_vhost_protocols_vhost(struct lws_vhost *vh, int reason, void *in,\n\t\t\t\t size_t len);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,\n\t\t\tvoid *user, void *in, size_t len);\n\n/**\n * lws_get_socket_fd() - returns the socket file descriptor\n *\n * This is needed to use sendto() on UDP raw sockets\n *\n * \u005cparam wsi:\tWebsocket connection instance\n */\nLWS_VISIBLE LWS_EXTERN lws_sockfd_type\nlws_get_socket_fd(struct lws *wsi);\n\n/**\n * lws_get_peer_write_allowance() - get the amount of data writeable to peer\n * \t\t\t\t\tif known\n *\n * \u005cparam wsi:\tWebsocket connection instance\n *\n * if the protocol does not have any guidance, returns -1. Currently only\n * http2 connections get send window information from this API. But your code\n * should use it so it can work properly with any protocol.\n *\n * If nonzero return is the amount of payload data the peer or intermediary has\n * reported it has buffer space for. That has NO relationship with the amount\n * of buffer space your OS can accept on this connection for a write action.\n *\n * This number represents the maximum you could send to the peer or intermediary\n * on this connection right now without the protocol complaining.\n *\n * lws manages accounting for send window updates and payload writes\n * automatically, so this number reflects the situation at the peer or\n * intermediary dynamically.\n */\nLWS_VISIBLE LWS_EXTERN lws_fileofs_t\nlws_get_peer_write_allowance(struct lws *wsi);\n///@}\n","s":{"c":1571121020,"u": 441}} ],"g": 2802,"chitpc": 0,"ehitpc": 0, "indexed":0 }