From: Andy Green Date: Thu, 9 Feb 2017 01:10:57 +0000 (+0800) Subject: chunked http client: support in test-client and document X-Git-Tag: accepted/tizen/4.0/unified/20171012.191640~242 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e25dc07c81d86acfad1815e44612dfbf7199e00;p=platform%2Fupstream%2Flibwebsockets.git chunked http client: support in test-client and document This improves the test client to - dump http content if INFO log level enabled - handle chunked content correctly - document lws_http_client_read() --- diff --git a/doc/html/globals_func.html b/doc/html/globals_func.html index a8d2219..0e5d009 100644 --- a/doc/html/globals_func.html +++ b/doc/html/globals_func.html @@ -252,6 +252,9 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
  • lws_http_client_http_response() : libwebsockets.h
  • +
  • lws_http_client_read() +: libwebsockets.h +
  • lws_http_redirect() : libwebsockets.h
  • @@ -405,6 +408,9 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
  • lwsl_timestamp() : libwebsockets.h
  • +
  • lwsl_visible() +: libwebsockets.h +
  • lwsws_get_config_globals() : libwebsockets.h
  • diff --git a/doc/html/globals_l.html b/doc/html/globals_l.html index 828aa51..4cc0003 100644 --- a/doc/html/globals_l.html +++ b/doc/html/globals_l.html @@ -471,6 +471,9 @@ $(document).ready(function(){initNavTree('globals_l.html','');});
  • lws_http_client_http_response() : libwebsockets.h
  • +
  • lws_http_client_read() +: libwebsockets.h +
  • lws_http_redirect() : libwebsockets.h
  • @@ -747,6 +750,9 @@ $(document).ready(function(){initNavTree('globals_l.html','');});
  • lwsl_timestamp() : libwebsockets.h
  • +
  • lwsl_visible() +: libwebsockets.h +
  • LWSMPRO_CALLBACK : libwebsockets.h
  • diff --git a/doc/html/group__client.html b/doc/html/group__client.html index 5a3313f..bb02632 100644 --- a/doc/html/group__client.html +++ b/doc/html/group__client.html @@ -93,8 +93,7 @@ Functions   LWS_VISIBLE LWS_EXTERN int lws_init_vhost_client_ssl (const struct lws_context_creation_info *info, struct lws_vhost *vhost)   - -LWS_VISIBLE LWS_EXTERN int lws_http_client_read (struct lws *wsi, char **buf, int *len) +LWS_VISIBLE LWS_EXTERN int lws_http_client_read (struct lws *wsi, char **buf, int *len)   LWS_VISIBLE LWS_EXTERN unsigned int lws_http_client_http_response (struct lws *wsi)   @@ -119,7 +118,7 @@ LWS_VISIBLE LWS_EXTERN void <

    #include <lib/libwebsockets.h>

    enum lws_client_connect_ssl_connection_flags - flags that may be used with struct lws_client_connect_info ssl_connection member to control if and how SSL checks apply to the client connection being created

    -
    2084  {
    2085  LCCSCF_USE_SSL = (1 << 0),
    2086  LCCSCF_ALLOW_SELFSIGNED = (1 << 1),
    2087  LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK = (1 << 2),
    2088  LCCSCF_ALLOW_EXPIRED = (1 << 3)
    2089 };
    +
    2096  {
    2097  LCCSCF_USE_SSL = (1 << 0),
    2098  LCCSCF_ALLOW_SELFSIGNED = (1 << 1),
    2099  LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK = (1 << 2),
    2100  LCCSCF_ALLOW_EXPIRED = (1 << 3)
    2101 };

    Function Documentation

    @@ -360,6 +359,54 @@ LWS_VISIBLE LWS_EXTERN void < + +

    § lws_http_client_read()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    LWS_VISIBLE LWS_EXTERN int lws_http_client_read (struct lws * wsi,
    char ** buf,
    int * len 
    )
    +
    + +

    #include <lib/libwebsockets.h>

    +

    lws_http_client_read() - consume waiting received http client data

    +
    Parameters
    + + + + +
    wsiclient connection
    bufpointer to buffer pointer - fill with pointer to your buffer
    lenpointer to chunk length - fill with max length of buffer
    +
    +
    +

    This is called when the user code is notified client http data has arrived. The user code may choose to delay calling it to consume the data, for example waiting until an onward connection is writeable.

    +

    For non-chunked connections, up to len bytes of buf are filled with the received content. len is set to the actual amount filled before return.

    +

    For chunked connections, the linear buffer content contains the chunking headers and it cannot be passed in one lump. Instead, this function will call back LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ with in pointing to the chunk start and len set to the chunk length. There will be as many calls as there are chunks or partial chunks in the buffer.

    + +
    +

    § lws_init_vhost_client_ssl()

    diff --git a/doc/html/group__client.js b/doc/html/group__client.js index 38bf4b5..65c323c 100644 --- a/doc/html/group__client.js +++ b/doc/html/group__client.js @@ -25,5 +25,6 @@ var group__client = [ "lws_client_connect_extended", "group__client.html#gac6a8558b4410961a880241c2ac1271e2", null ], [ "lws_client_connect_via_info", "group__client.html#ga0c966136905f467816307cfba6deb5fd", null ], [ "lws_http_client_http_response", "group__client.html#ga715efffc0c4e8fbf72a4293008eb2187", null ], + [ "lws_http_client_read", "group__client.html#ga4450c34200bf9dab3beb90ef23221870", null ], [ "lws_init_vhost_client_ssl", "group__client.html#ga4f44b8230e6732816ca5cd8d1aaaf340", null ] ]; \ No newline at end of file diff --git a/doc/html/group__context-and-vhost.html b/doc/html/group__context-and-vhost.html index 0a1aa6b..b9dca59 100644 --- a/doc/html/group__context-and-vhost.html +++ b/doc/html/group__context-and-vhost.html @@ -211,25 +211,25 @@ LWS_VISIBLE LWS_EXTERN int LWS_SERVER_OPTION_JUST_USE_RAW_ORIGIN 

    For backwards-compatibility reasons, by default lws prepends "http://" to the origin you give in the client connection info struct. If you give this flag when you create the context, only the string you give in the client connect info for .origin (if any) will be used directly.

    -
    1531  {
    1533  (1 << 12),
    1540  (1 << 12),
    1544  LWS_SERVER_OPTION_LIBEV = (1 << 4),
    1546  LWS_SERVER_OPTION_DISABLE_IPV6 = (1 << 5),
    1555  LWS_SERVER_OPTION_SSL_ECDH = (1 << 9) |
    1556  (1 << 12),
    1558  LWS_SERVER_OPTION_LIBUV = (1 << 10),
    1561  (1 << 12),
    1569  LWS_SERVER_OPTION_UNIX_SOCK = (1 << 14),
    1571  LWS_SERVER_OPTION_STS = (1 << 15),
    1592  /****** add new things just above ---^ ******/
    1593 };
    -
    Definition: libwebsockets.h:1548
    -
    Definition: libwebsockets.h:1578
    -
    Definition: libwebsockets.h:1560
    -
    Definition: libwebsockets.h:1566
    -
    Definition: libwebsockets.h:1537
    -
    Definition: libwebsockets.h:1555
    -
    Definition: libwebsockets.h:1539
    -
    Definition: libwebsockets.h:1544
    -
    Definition: libwebsockets.h:1564
    -
    Definition: libwebsockets.h:1576
    -
    Definition: libwebsockets.h:1546
    -
    Definition: libwebsockets.h:1558
    -
    Definition: libwebsockets.h:1569
    -
    Definition: libwebsockets.h:1553
    -
    Definition: libwebsockets.h:1551
    -
    Definition: libwebsockets.h:1584
    -
    Definition: libwebsockets.h:1571
    -
    Definition: libwebsockets.h:1574
    +
    1543  {
    1545  (1 << 12),
    1552  (1 << 12),
    1556  LWS_SERVER_OPTION_LIBEV = (1 << 4),
    1558  LWS_SERVER_OPTION_DISABLE_IPV6 = (1 << 5),
    1567  LWS_SERVER_OPTION_SSL_ECDH = (1 << 9) |
    1568  (1 << 12),
    1570  LWS_SERVER_OPTION_LIBUV = (1 << 10),
    1573  (1 << 12),
    1581  LWS_SERVER_OPTION_UNIX_SOCK = (1 << 14),
    1583  LWS_SERVER_OPTION_STS = (1 << 15),
    1604  /****** add new things just above ---^ ******/
    1605 };
    +
    Definition: libwebsockets.h:1560
    +
    Definition: libwebsockets.h:1590
    +
    Definition: libwebsockets.h:1572
    +
    Definition: libwebsockets.h:1578
    +
    Definition: libwebsockets.h:1549
    +
    Definition: libwebsockets.h:1567
    +
    Definition: libwebsockets.h:1551
    +
    Definition: libwebsockets.h:1556
    +
    Definition: libwebsockets.h:1576
    +
    Definition: libwebsockets.h:1588
    +
    Definition: libwebsockets.h:1558
    +
    Definition: libwebsockets.h:1570
    +
    Definition: libwebsockets.h:1581
    +
    Definition: libwebsockets.h:1565
    +
    Definition: libwebsockets.h:1563
    +
    Definition: libwebsockets.h:1596
    +
    Definition: libwebsockets.h:1583
    +
    Definition: libwebsockets.h:1586
    diff --git a/doc/html/group__extensions.html b/doc/html/group__extensions.html index d343609..445881d 100644 --- a/doc/html/group__extensions.html +++ b/doc/html/group__extensions.html @@ -242,9 +242,9 @@ Functions EXTARG_OPT_DEC 

    may have an optional decimal argument

    -
    1133  {
    1134  EXTARG_NONE,
    1135  EXTARG_DEC,
    1138  /* Add new things just above here ---^
    1139  * This is part of the ABI, don't needlessly break compatibility */
    1140 };
    Definition: libwebsockets.h:1136
    -
    Definition: libwebsockets.h:1134
    -
    Definition: libwebsockets.h:1135
    +
    1145  {
    1146  EXTARG_NONE,
    1147  EXTARG_DEC,
    1150  /* Add new things just above here ---^
    1151  * This is part of the ABI, don't needlessly break compatibility */
    1152 };
    Definition: libwebsockets.h:1148
    +
    Definition: libwebsockets.h:1146
    +
    Definition: libwebsockets.h:1147
    diff --git a/doc/html/group__form-parsing.html b/doc/html/group__form-parsing.html index cdf8cd4..72876c5 100644 --- a/doc/html/group__form-parsing.html +++ b/doc/html/group__form-parsing.html @@ -156,9 +156,9 @@ Functions LWS_UFS_OPEN 

    a new file is starting to arrive

    -
    2928  {
    2933  LWS_UFS_OPEN
    2935 };
    Definition: libwebsockets.h:2931
    -
    Definition: libwebsockets.h:2933
    -
    Definition: libwebsockets.h:2929
    +
    2960  {
    2965  LWS_UFS_OPEN
    2967 };
    Definition: libwebsockets.h:2963
    +
    Definition: libwebsockets.h:2965
    +
    Definition: libwebsockets.h:2961
    diff --git a/doc/html/group__generic-sessions.html b/doc/html/group__generic-sessions.html index 0c47071..028557f 100644 --- a/doc/html/group__generic-sessions.html +++ b/doc/html/group__generic-sessions.html @@ -116,8 +116,8 @@ Enumerations LWSGSE_DELETED 

    an existing user was deleted

    -
    1495  {
    1496  LWSGSE_CREATED,
    1498 };
    Definition: libwebsockets.h:1497
    -
    Definition: libwebsockets.h:1496
    +
    1507  {
    1508  LWSGSE_CREATED,
    1510 };
    Definition: libwebsockets.h:1509
    +
    Definition: libwebsockets.h:1508
    @@ -145,10 +145,10 @@ Enumerations LWSGS_AUTH_FORGOT_FLOW 

    he just completed "forgot password" flow

    -
    1477  {
    1478  LWSGS_AUTH_LOGGED_IN = 1,
    1479  LWSGS_AUTH_ADMIN = 2,
    1480  LWSGS_AUTH_VERIFIED = 4,
    1482 };
    Definition: libwebsockets.h:1480
    -
    Definition: libwebsockets.h:1481
    -
    Definition: libwebsockets.h:1479
    -
    Definition: libwebsockets.h:1478
    +
    1489  {
    1490  LWSGS_AUTH_LOGGED_IN = 1,
    1491  LWSGS_AUTH_ADMIN = 2,
    1492  LWSGS_AUTH_VERIFIED = 4,
    1494 };
    Definition: libwebsockets.h:1492
    +
    Definition: libwebsockets.h:1493
    +
    Definition: libwebsockets.h:1491
    +
    Definition: libwebsockets.h:1490
    diff --git a/doc/html/group__log.html b/doc/html/group__log.html index 695c2a6..7d3905a 100644 --- a/doc/html/group__log.html +++ b/doc/html/group__log.html @@ -105,6 +105,8 @@ LWS_VISIBLE LWS_EXTERN void <   LWS_VISIBLE LWS_EXTERN void lwsl_emit_syslog (int level, const char *line)   +LWS_VISIBLE LWS_EXTERN int lwsl_visible (int level) + 

    Detailed Description

    Logging

    @@ -272,6 +274,34 @@ LWS_VISIBLE LWS_EXTERN void < + +

    § lwsl_visible()

    + +
    +
    + + + + + + + + +
    LWS_VISIBLE LWS_EXTERN int lwsl_visible (int level)
    +
    + +

    #include <lib/libwebsockets.h>

    +

    lwsl_visible() - returns true if the log level should be printed

    +
    Parameters
    + + +
    levelone of LLL_ log level indexes
    +
    +
    +

    This is useful if you have to do work to generate the log content, you can skip the work if the log level used to print it is not actually enabled at runtime.

    + +
    +
    diff --git a/doc/html/group__log.js b/doc/html/group__log.js index e220377..5739b29 100644 --- a/doc/html/group__log.js +++ b/doc/html/group__log.js @@ -3,5 +3,6 @@ var group__log = [ "lws_set_log_level", "group__log.html#ga244647f9e1bf0097ccdde66d74f41e26", null ], [ "lwsl_emit_syslog", "group__log.html#gab7c0fc936cc9f1eb58e2bb234c15147c", null ], [ "lwsl_hexdump", "group__log.html#ga898b1f03872ad019f507d4e35bbefa90", null ], - [ "lwsl_timestamp", "group__log.html#ga42e39775c6b69b7251bdbf5a2cdd5dcd", null ] + [ "lwsl_timestamp", "group__log.html#ga42e39775c6b69b7251bdbf5a2cdd5dcd", null ], + [ "lwsl_visible", "group__log.html#ga2d1819ad1645062fd83817e6f20e03b4", null ] ]; \ No newline at end of file diff --git a/doc/html/group__sending-data.html b/doc/html/group__sending-data.html index b58ba8d..1089e25 100644 --- a/doc/html/group__sending-data.html +++ b/doc/html/group__sending-data.html @@ -124,13 +124,13 @@ Functions LWS_WRITE_CLIENT_IGNORE_XOR_MASK 

    client packet payload goes out on wire unmunged only useful for security tests since normal servers cannot decode the content if used

    -
    3275  {
    3276  LWS_WRITE_TEXT = 0,
    3280  LWS_WRITE_BINARY = 1,
    3286  LWS_WRITE_HTTP = 3,
    3289  /* LWS_WRITE_CLOSE is handled by lws_close_reason() */
    3290  LWS_WRITE_PING = 5,
    3291  LWS_WRITE_PONG = 6,
    3292 
    3293  /* Same as write_http but we know this write ends the transaction */
    3294  LWS_WRITE_HTTP_FINAL = 7,
    3295 
    3296  /* HTTP2 */
    3297 
    3305  /****** add new things just above ---^ ******/
    3306 
    3307  /* flags */
    3308 
    3309  LWS_WRITE_NO_FIN = 0x40,
    3316 };
    Definition: libwebsockets.h:3286
    -
    Definition: libwebsockets.h:3309
    -
    Definition: libwebsockets.h:3276
    -
    Definition: libwebsockets.h:3280
    -
    Definition: libwebsockets.h:3312
    -
    Definition: libwebsockets.h:3283
    -
    Definition: libwebsockets.h:3298
    +
    3307  {
    3308  LWS_WRITE_TEXT = 0,
    3312  LWS_WRITE_BINARY = 1,
    3318  LWS_WRITE_HTTP = 3,
    3321  /* LWS_WRITE_CLOSE is handled by lws_close_reason() */
    3322  LWS_WRITE_PING = 5,
    3323  LWS_WRITE_PONG = 6,
    3324 
    3325  /* Same as write_http but we know this write ends the transaction */
    3326  LWS_WRITE_HTTP_FINAL = 7,
    3327 
    3328  /* HTTP2 */
    3329 
    3337  /****** add new things just above ---^ ******/
    3338 
    3339  /* flags */
    3340 
    3341  LWS_WRITE_NO_FIN = 0x40,
    3348 };
    Definition: libwebsockets.h:3318
    +
    Definition: libwebsockets.h:3341
    +
    Definition: libwebsockets.h:3308
    +
    Definition: libwebsockets.h:3312
    +
    Definition: libwebsockets.h:3344
    +
    Definition: libwebsockets.h:3315
    +
    Definition: libwebsockets.h:3330
    diff --git a/doc/html/group__smtp.html b/doc/html/group__smtp.html index 7e2f9ac..672b636 100644 --- a/doc/html/group__smtp.html +++ b/doc/html/group__smtp.html @@ -149,15 +149,15 @@ Functions LGSSMTP_SENT_QUIT 

    sent the session quit

    -
    4283  {
    4284  LGSSMTP_IDLE,
    4289  LGSSMTP_SENT_TO,
    4293 };
    Definition: libwebsockets.h:4286
    -
    Definition: libwebsockets.h:4291
    -
    Definition: libwebsockets.h:4284
    -
    Definition: libwebsockets.h:4285
    -
    Definition: libwebsockets.h:4289
    -
    Definition: libwebsockets.h:4288
    -
    Definition: libwebsockets.h:4292
    -
    Definition: libwebsockets.h:4287
    -
    Definition: libwebsockets.h:4290
    +
    4315  {
    4316  LGSSMTP_IDLE,
    4321  LGSSMTP_SENT_TO,
    4325 };
    Definition: libwebsockets.h:4318
    +
    Definition: libwebsockets.h:4323
    +
    Definition: libwebsockets.h:4316
    +
    Definition: libwebsockets.h:4317
    +
    Definition: libwebsockets.h:4321
    +
    Definition: libwebsockets.h:4320
    +
    Definition: libwebsockets.h:4324
    +
    Definition: libwebsockets.h:4319
    +
    Definition: libwebsockets.h:4322
    diff --git a/doc/html/group__usercb.html b/doc/html/group__usercb.html index 9b1d4b5..6f98311 100644 --- a/doc/html/group__usercb.html +++ b/doc/html/group__usercb.html @@ -348,49 +348,49 @@ Enumerations LWS_CALLBACK_USER 

    user code can use any including / above without fear of clashes

    -
    671  {
    755  LWS_CALLBACK_HTTP = 12,
    913  /* external poll() management support */
    976  LWS_CALLBACK_WS_EXT_DEFAULTS = 39,
    979  LWS_CALLBACK_CGI = 40,
    981  LWS_CALLBACK_CGI_TERMINATED = 41,
    983  LWS_CALLBACK_CGI_STDIN_DATA = 42,
    985  LWS_CALLBACK_CGI_STDIN_COMPLETED = 43,
    987  LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44,
    989  LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45,
    991  LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46,
    993  LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47,
    995  LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ = 48,
    997  LWS_CALLBACK_HTTP_BIND_PROTOCOL = 49,
    999  LWS_CALLBACK_HTTP_DROP_PROTOCOL = 50,
    1001  LWS_CALLBACK_CHECK_ACCESS_RIGHTS = 51,
    1003  LWS_CALLBACK_PROCESS_HTML = 52,
    1005  LWS_CALLBACK_ADD_HEADERS = 53,
    1007  LWS_CALLBACK_SESSION_INFO = 54,
    1010  LWS_CALLBACK_GS_EVENT = 55,
    1012  LWS_CALLBACK_HTTP_PMO = 56,
    1057  /****** add new things just above ---^ ******/
    1058 
    1059  LWS_CALLBACK_USER = 1000,
    1061 };
    Definition: libwebsockets.h:778
    -
    Definition: libwebsockets.h:906
    - -
    Definition: libwebsockets.h:904
    -
    Definition: libwebsockets.h:809
    -
    Definition: libwebsockets.h:755
    -
    Definition: libwebsockets.h:789
    -
    Definition: libwebsockets.h:930
    -
    Definition: libwebsockets.h:876
    -
    Definition: libwebsockets.h:769
    -
    Definition: libwebsockets.h:967
    - -
    Definition: libwebsockets.h:956
    - -
    Definition: libwebsockets.h:730
    -
    Definition: libwebsockets.h:908
    -
    Definition: libwebsockets.h:896
    -
    Definition: libwebsockets.h:727
    -
    Definition: libwebsockets.h:914
    -
    Definition: libwebsockets.h:720
    -
    Definition: libwebsockets.h:801
    -
    Definition: libwebsockets.h:899
    -
    Definition: libwebsockets.h:936
    -
    Definition: libwebsockets.h:776
    -
    Definition: libwebsockets.h:772
    -
    Definition: libwebsockets.h:672
    - -
    Definition: libwebsockets.h:740
    -
    Definition: libwebsockets.h:774
    -
    Definition: libwebsockets.h:1012
    -
    Definition: libwebsockets.h:852
    -
    Definition: libwebsockets.h:738
    -
    Definition: libwebsockets.h:743
    -
    Definition: libwebsockets.h:1017
    - -
    Definition: libwebsockets.h:676
    -
    Definition: libwebsockets.h:753
    -
    Definition: libwebsockets.h:1059
    - -
    Definition: libwebsockets.h:732
    -
    Definition: libwebsockets.h:734
    -
    Definition: libwebsockets.h:745
    -
    Definition: libwebsockets.h:944
    +
    683  {
    767  LWS_CALLBACK_HTTP = 12,
    925  /* external poll() management support */
    988  LWS_CALLBACK_WS_EXT_DEFAULTS = 39,
    991  LWS_CALLBACK_CGI = 40,
    993  LWS_CALLBACK_CGI_TERMINATED = 41,
    995  LWS_CALLBACK_CGI_STDIN_DATA = 42,
    997  LWS_CALLBACK_CGI_STDIN_COMPLETED = 43,
    999  LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44,
    1001  LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45,
    1003  LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46,
    1005  LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47,
    1007  LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ = 48,
    1009  LWS_CALLBACK_HTTP_BIND_PROTOCOL = 49,
    1011  LWS_CALLBACK_HTTP_DROP_PROTOCOL = 50,
    1013  LWS_CALLBACK_CHECK_ACCESS_RIGHTS = 51,
    1015  LWS_CALLBACK_PROCESS_HTML = 52,
    1017  LWS_CALLBACK_ADD_HEADERS = 53,
    1019  LWS_CALLBACK_SESSION_INFO = 54,
    1022  LWS_CALLBACK_GS_EVENT = 55,
    1024  LWS_CALLBACK_HTTP_PMO = 56,
    1069  /****** add new things just above ---^ ******/
    1070 
    1071  LWS_CALLBACK_USER = 1000,
    1073 };
    Definition: libwebsockets.h:790
    +
    Definition: libwebsockets.h:918
    + +
    Definition: libwebsockets.h:916
    +
    Definition: libwebsockets.h:821
    +
    Definition: libwebsockets.h:767
    +
    Definition: libwebsockets.h:801
    +
    Definition: libwebsockets.h:942
    +
    Definition: libwebsockets.h:888
    +
    Definition: libwebsockets.h:781
    +
    Definition: libwebsockets.h:979
    + +
    Definition: libwebsockets.h:968
    + +
    Definition: libwebsockets.h:742
    +
    Definition: libwebsockets.h:920
    +
    Definition: libwebsockets.h:908
    +
    Definition: libwebsockets.h:739
    +
    Definition: libwebsockets.h:926
    +
    Definition: libwebsockets.h:732
    +
    Definition: libwebsockets.h:813
    +
    Definition: libwebsockets.h:911
    +
    Definition: libwebsockets.h:948
    +
    Definition: libwebsockets.h:788
    +
    Definition: libwebsockets.h:784
    +
    Definition: libwebsockets.h:684
    + +
    Definition: libwebsockets.h:752
    +
    Definition: libwebsockets.h:786
    +
    Definition: libwebsockets.h:1024
    +
    Definition: libwebsockets.h:864
    +
    Definition: libwebsockets.h:750
    +
    Definition: libwebsockets.h:755
    +
    Definition: libwebsockets.h:1029
    + +
    Definition: libwebsockets.h:688
    +
    Definition: libwebsockets.h:765
    +
    Definition: libwebsockets.h:1071
    + +
    Definition: libwebsockets.h:744
    +
    Definition: libwebsockets.h:746
    +
    Definition: libwebsockets.h:757
    +
    Definition: libwebsockets.h:956
    diff --git a/doc/html/group__vhost-mounts.html b/doc/html/group__vhost-mounts.html index e499fe7..dc19ed0 100644 --- a/doc/html/group__vhost-mounts.html +++ b/doc/html/group__vhost-mounts.html @@ -123,13 +123,13 @@ Enumerations LWSMPRO_CALLBACK 

    hand by named protocol's callback

    -
    2007  {
    2008  LWSMPRO_HTTP = 0,
    2009  LWSMPRO_HTTPS = 1,
    2010  LWSMPRO_FILE = 2,
    2011  LWSMPRO_CGI = 3,
    2012  LWSMPRO_REDIR_HTTP = 4,
    2013  LWSMPRO_REDIR_HTTPS = 5,
    2014  LWSMPRO_CALLBACK = 6,
    2015 };
    Definition: libwebsockets.h:2011
    -
    Definition: libwebsockets.h:2009
    -
    Definition: libwebsockets.h:2010
    -
    Definition: libwebsockets.h:2012
    -
    Definition: libwebsockets.h:2013
    -
    Definition: libwebsockets.h:2008
    -
    Definition: libwebsockets.h:2014
    +
    2019  {
    2020  LWSMPRO_HTTP = 0,
    2021  LWSMPRO_HTTPS = 1,
    2022  LWSMPRO_FILE = 2,
    2023  LWSMPRO_CGI = 3,
    2024  LWSMPRO_REDIR_HTTP = 4,
    2025  LWSMPRO_REDIR_HTTPS = 5,
    2026  LWSMPRO_CALLBACK = 6,
    2027 };
    Definition: libwebsockets.h:2023
    +
    Definition: libwebsockets.h:2021
    +
    Definition: libwebsockets.h:2022
    +
    Definition: libwebsockets.h:2024
    +
    Definition: libwebsockets.h:2025
    +
    Definition: libwebsockets.h:2020
    +
    Definition: libwebsockets.h:2026
    diff --git a/doc/html/group__wsclose.html b/doc/html/group__wsclose.html index 6b2f04c..931caf4 100644 --- a/doc/html/group__wsclose.html +++ b/doc/html/group__wsclose.html @@ -144,19 +144,19 @@ Functions LWS_CLOSE_STATUS_TLS_FAILURE 

    1015 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).

    -
    561  {
    562  LWS_CLOSE_STATUS_NOSTATUS = 0,
    624  /****** add new things just above ---^ ******/
    625 
    626  LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY = 9999,
    627 };
    Definition: libwebsockets.h:590
    -
    Definition: libwebsockets.h:601
    -
    Definition: libwebsockets.h:617
    -
    Definition: libwebsockets.h:569
    -
    Definition: libwebsockets.h:595
    -
    Definition: libwebsockets.h:579
    -
    Definition: libwebsockets.h:584
    -
    Definition: libwebsockets.h:566
    -
    Definition: libwebsockets.h:605
    -
    Definition: libwebsockets.h:563
    -
    Definition: libwebsockets.h:572
    -
    Definition: libwebsockets.h:577
    -
    Definition: libwebsockets.h:613
    +
    573  {
    574  LWS_CLOSE_STATUS_NOSTATUS = 0,
    636  /****** add new things just above ---^ ******/
    637 
    638  LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY = 9999,
    639 };
    Definition: libwebsockets.h:602
    +
    Definition: libwebsockets.h:613
    +
    Definition: libwebsockets.h:629
    +
    Definition: libwebsockets.h:581
    +
    Definition: libwebsockets.h:607
    +
    Definition: libwebsockets.h:591
    +
    Definition: libwebsockets.h:596
    +
    Definition: libwebsockets.h:578
    +
    Definition: libwebsockets.h:617
    +
    Definition: libwebsockets.h:575
    +
    Definition: libwebsockets.h:584
    +
    Definition: libwebsockets.h:589
    +
    Definition: libwebsockets.h:625
    diff --git a/doc/html/libwebsockets_8h.html b/doc/html/libwebsockets_8h.html index b519f34..16ea85b 100644 --- a/doc/html/libwebsockets_8h.html +++ b/doc/html/libwebsockets_8h.html @@ -648,6 +648,8 @@ LWS_VISIBLE LWS_EXTERN void <   LWS_VISIBLE LWS_EXTERN void lwsl_emit_syslog (int level, const char *line)   +LWS_VISIBLE LWS_EXTERN int lwsl_visible (int level) +  void * mbed3_create_tcp_stream_socket (void)   @@ -736,8 +738,7 @@ LWS_VISIBLE LWS_EXTERN int   LWS_VISIBLE LWS_EXTERN int lws_init_vhost_client_ssl (const struct lws_context_creation_info *info, struct lws_vhost *vhost)   - -LWS_VISIBLE LWS_EXTERN int lws_http_client_read (struct lws *wsi, char **buf, int *len) +LWS_VISIBLE LWS_EXTERN int lws_http_client_read (struct lws *wsi, char **buf, int *len)   LWS_VISIBLE LWS_EXTERN unsigned int lws_http_client_http_response (struct lws *wsi)   diff --git a/doc/html/libwebsockets_8h.js b/doc/html/libwebsockets_8h.js index 40e2577..211d300 100644 --- a/doc/html/libwebsockets_8h.js +++ b/doc/html/libwebsockets_8h.js @@ -522,6 +522,7 @@ var libwebsockets_8h = [ "lwsl_emit_syslog", "group__log.html#gab7c0fc936cc9f1eb58e2bb234c15147c", null ], [ "lwsl_hexdump", "group__log.html#ga898b1f03872ad019f507d4e35bbefa90", null ], [ "lwsl_timestamp", "group__log.html#ga42e39775c6b69b7251bdbf5a2cdd5dcd", null ], + [ "lwsl_visible", "group__log.html#ga2d1819ad1645062fd83817e6f20e03b4", null ], [ "lwsws_get_config_globals", "group__context-and-vhost.html#ga98d88c9080fd89c37114363a6474ea73", null ], [ "lwsws_get_config_vhosts", "group__context-and-vhost.html#ga341064721add2618ae1b29717493a212", null ], [ "mbed3_create_tcp_stream_socket", "libwebsockets_8h.html#a0b056fdcf949a838ff82209b4a627dd9", null ], diff --git a/doc/html/libwebsockets_8h_source.html b/doc/html/libwebsockets_8h_source.html index 674a71b..0c4f1ff 100644 --- a/doc/html/libwebsockets_8h_source.html +++ b/doc/html/libwebsockets_8h_source.html @@ -64,420 +64,422 @@ $(document).ready(function(){initNavTree('libwebsockets_8h_source.html','');});
    libwebsockets.h
    -Go to the documentation of this file.
    1 /*
    2  * libwebsockets - small server side websockets and web server implementation
    3  *
    4  * Copyright (C) 2010-2016 Andy Green <andy@warmcat.com>
    5  *
    6  * This library is free software; you can redistribute it and/or
    7  * modify it under the terms of the GNU Lesser General Public
    8  * License as published by the Free Software Foundation:
    9  * version 2.1 of the License.
    10  *
    11  * This library is distributed in the hope that it will be useful,
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    14  * Lesser General Public License for more details.
    15  *
    16  * You should have received a copy of the GNU Lesser General Public
    17  * License along with this library; if not, write to the Free Software
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    19  * MA 02110-1301 USA
    20  */
    21 
    24 #ifndef LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
    25 #define LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
    26 
    27 #ifdef __cplusplus
    28 #include <cstddef>
    29 #include <cstdarg>
    30 #ifdef MBED_OPERATORS
    31 #include "mbed-drivers/mbed.h"
    32 #include "sal-iface-eth/EthernetInterface.h"
    33 #include "sockets/TCPListener.h"
    34 #include "sal-stack-lwip/lwipv4_init.h"
    35 
    36 namespace {
    37 }
    38 using namespace mbed::Sockets::v0;
    39 
    40 
    41 struct sockaddr_in;
    42 struct lws;
    43 
    44 class lws_conn {
    45  public:
    46  lws_conn():
    47  ts(NULL),
    48  wsi(NULL),
    49  writeable(1),
    50  awaiting_on_writeable(0)
    51  {
    52  }
    53 
    54 public:
    55  void set_wsi(struct lws *_wsi) { wsi = _wsi; }
    56  int actual_onRX(Socket *s);
    57  void onRX(Socket *s);
    58  void onError(Socket *s, socket_error_t err);
    59  void onDisconnect(TCPStream *s);
    60  void onSent(Socket *s, uint16_t len);
    61  void serialized_writeable(struct lws *wsi);
    62 
    63 public:
    64  TCPStream *ts;
    65 
    66 public:
    67  struct lws *wsi;
    68  char writeable;
    69  char awaiting_on_writeable;
    70 };
    71 
    73 public:
    75  srv(SOCKET_STACK_LWIP_IPV4)
    76  {
    77  srv.setOnError(TCPStream::ErrorHandler_t(this,
    79  }
    80 
    81  void start(const uint16_t port);
    83 protected:
    84  void onRX(Socket *s);
    85  void onError(Socket *s, socket_error_t err);
    86  void onIncoming(TCPListener *s, void *impl);
    87  void onDisconnect(TCPStream *s);
    89 public:
    90  TCPListener srv;
    91 };
    92 
    93 #endif
    94 
    95 extern "C" {
    96 #else
    97 #include <stdarg.h>
    98 #endif
    99 
    100 #if defined(MBED_OPERATORS) || defined(LWS_WITH_ESP8266)
    101 struct sockaddr_in;
    102 #define LWS_POSIX 0
    103 #else
    104 #define LWS_POSIX 1
    105 #endif
    106 
    107 #include "lws_config.h"
    108 
    109 #if defined(WIN32) || defined(_WIN32)
    110 #ifndef WIN32_LEAN_AND_MEAN
    111 #define WIN32_LEAN_AND_MEAN
    112 #endif
    113 
    114 #include <winsock2.h>
    115 #include <ws2tcpip.h>
    116 #include <stddef.h>
    117 #include <basetsd.h>
    118 #ifndef _WIN32_WCE
    119 #include <fcntl.h>
    120 #else
    121 #define _O_RDONLY 0x0000
    122 #define O_RDONLY _O_RDONLY
    123 #endif
    124 
    125 // Visual studio older than 2015 and WIN_CE has only _stricmp
    126 #if (defined(_MSC_VER) && _MSC_VER < 1900) || defined(_WIN32_WCE)
    127 #define strcasecmp _stricmp
    128 #elif !defined(__MINGW32__)
    129 #define strcasecmp stricmp
    130 #endif
    131 #define getdtablesize() 30000
    132 
    133 #define LWS_INLINE __inline
    134 #define LWS_VISIBLE
    135 #define LWS_WARN_UNUSED_RESULT
    136 #define LWS_WARN_DEPRECATED
    137 #define LWS_FORMAT(string_index)
    138 
    139 #ifdef LWS_DLL
    140 #ifdef LWS_INTERNAL
    141 #define LWS_EXTERN extern __declspec(dllexport)
    142 #else
    143 #define LWS_EXTERN extern __declspec(dllimport)
    144 #endif
    145 #else
    146 #define LWS_EXTERN
    147 #endif
    148 
    149 #define LWS_INVALID_FILE INVALID_HANDLE_VALUE
    150 #define LWS_O_RDONLY _O_RDONLY
    151 
    152 #if !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER < 1900) /* Visual Studio 2015 already defines this in <stdio.h> */
    153 #define lws_snprintf _snprintf
    154 #endif
    155 
    156 #ifndef __func__
    157 #define __func__ __FUNCTION__
    158 #endif
    159 
    160 #else /* NOT WIN32 */
    161 #include <unistd.h>
    162 
    163 #if defined(__NetBSD__) || defined(__FreeBSD__)
    164 #include <netinet/in.h>
    165 #endif
    166 
    167 #define LWS_INLINE inline
    168 #define LWS_O_RDONLY O_RDONLY
    169 
    170 #if !defined(MBED_OPERATORS) && !defined(LWS_WITH_ESP8266) && !defined(OPTEE_TA)
    171 #include <poll.h>
    172 #include <netdb.h>
    173 #define LWS_INVALID_FILE -1
    174 #else
    175 #define getdtablesize() (20)
    176 #define LWS_INVALID_FILE NULL
    177 #endif
    178 
    179 #if defined(__GNUC__)
    180 
    181 /* warn_unused_result attribute only supported by GCC 3.4 or later */
    182 #if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
    183 #define LWS_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
    184 #else
    185 #define LWS_WARN_UNUSED_RESULT
    186 #endif
    187 
    188 #define LWS_VISIBLE __attribute__((visibility("default")))
    189 #define LWS_WARN_DEPRECATED __attribute__ ((deprecated))
    190 #define LWS_FORMAT(string_index) __attribute__ ((format(printf, string_index, string_index+1)))
    191 #else
    192 #define LWS_VISIBLE
    193 #define LWS_WARN_UNUSED_RESULT
    194 #define LWS_WARN_DEPRECATED
    195 #define LWS_FORMAT(string_index)
    196 #endif
    197 
    198 #if defined(__ANDROID__)
    199 #include <unistd.h>
    200 #define getdtablesize() sysconf(_SC_OPEN_MAX)
    201 #endif
    202 
    203 #endif
    204 
    205 #ifdef LWS_USE_LIBEV
    206 #include <ev.h>
    207 #endif /* LWS_USE_LIBEV */
    208 #ifdef LWS_USE_LIBUV
    209 #include <uv.h>
    210 #ifdef LWS_HAVE_UV_VERSION_H
    211 #include <uv-version.h>
    212 #endif
    213 #endif /* LWS_USE_LIBUV */
    214 
    215 #ifndef LWS_EXTERN
    216 #define LWS_EXTERN extern
    217 #endif
    218 
    219 #ifdef _WIN32
    220 #define random rand
    221 #else
    222 #if !defined(OPTEE_TA)
    223 #include <sys/time.h>
    224 #include <unistd.h>
    225 #endif
    226 #endif
    227 
    228 #ifdef LWS_OPENSSL_SUPPORT
    229 
    230 #ifdef USE_WOLFSSL
    231 #ifdef USE_OLD_CYASSL
    232 #include <cyassl/openssl/ssl.h>
    233 #include <cyassl/error-ssl.h>
    234 #else
    235 #include <wolfssl/openssl/ssl.h>
    236 #include <wolfssl/error-ssl.h>
    237 #endif /* not USE_OLD_CYASSL */
    238 #else
    239 #if defined(LWS_USE_POLARSSL)
    240 #include <polarssl/ssl.h>
    242  x509_crt ca;
    243  x509_crt certificate;
    244  rsa_context key;
    245 };
    246 typedef struct lws_polarssl_context SSL_CTX;
    247 typedef ssl_context SSL;
    248 #else
    249 #if defined(LWS_USE_MBEDTLS)
    250 #include <mbedtls/ssl.h>
    251 #else
    252 #include <openssl/ssl.h>
    253 #include <openssl/err.h>
    254 #endif /* not USE_MBEDTLS */
    255 #endif /* not USE_POLARSSL */
    256 #endif /* not USE_WOLFSSL */
    257 #endif
    258 
    259 
    260 #define CONTEXT_PORT_NO_LISTEN -1
    261 #define CONTEXT_PORT_NO_LISTEN_SERVER -2
    262 
    273 
    275 enum lws_log_levels {
    276  LLL_ERR = 1 << 0,
    277  LLL_WARN = 1 << 1,
    278  LLL_NOTICE = 1 << 2,
    279  LLL_INFO = 1 << 3,
    280  LLL_DEBUG = 1 << 4,
    281  LLL_PARSER = 1 << 5,
    282  LLL_HEADER = 1 << 6,
    283  LLL_EXT = 1 << 7,
    284  LLL_CLIENT = 1 << 8,
    285  LLL_LATENCY = 1 << 9,
    286  LLL_USER = 1 << 10,
    287 
    288  LLL_COUNT = 11 /* set to count of valid flags */
    289 };
    290 
    291 LWS_VISIBLE LWS_EXTERN void _lws_log(int filter, const char *format, ...) LWS_FORMAT(2);
    292 LWS_VISIBLE LWS_EXTERN void _lws_logv(int filter, const char *format, va_list vl);
    302 LWS_VISIBLE LWS_EXTERN int
    303 lwsl_timestamp(int level, char *p, int len);
    304 
    305 /* these guys are unconditionally included */
    306 
    307 #define lwsl_err(...) _lws_log(LLL_ERR, __VA_ARGS__)
    308 #define lwsl_user(...) _lws_log(LLL_USER, __VA_ARGS__)
    309 
    310 #if !defined(LWS_WITH_NO_LOGS)
    311 /* notice and warn are usually included by being compiled in */
    312 #define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__)
    313 #define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__)
    314 #endif
    315 /*
    316  * weaker logging can be deselected by telling CMake to build in RELEASE mode
    317  * that gets rid of the overhead of checking while keeping _warn and _err
    318  * active
    319  */
    320 
    321 #if defined(LWS_WITH_ESP8266)
    322 #undef _DEBUG
    323 #endif
    324 
    325 #ifdef _DEBUG
    326 #if defined(LWS_WITH_NO_LOGS)
    327 /* notice, warn and log are always compiled in */
    328 #define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__)
    329 #define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__)
    330 #endif
    331 #define lwsl_info(...) _lws_log(LLL_INFO, __VA_ARGS__)
    332 #define lwsl_debug(...) _lws_log(LLL_DEBUG, __VA_ARGS__)
    333 #define lwsl_parser(...) _lws_log(LLL_PARSER, __VA_ARGS__)
    334 #define lwsl_header(...) _lws_log(LLL_HEADER, __VA_ARGS__)
    335 #define lwsl_ext(...) _lws_log(LLL_EXT, __VA_ARGS__)
    336 #define lwsl_client(...) _lws_log(LLL_CLIENT, __VA_ARGS__)
    337 #define lwsl_latency(...) _lws_log(LLL_LATENCY, __VA_ARGS__)
    338 
    344 LWS_VISIBLE LWS_EXTERN void lwsl_hexdump(void *buf, size_t len);
    345 
    346 #else /* no debug */
    347 #if defined(LWS_WITH_NO_LOGS)
    348 #define lwsl_warn(...) do {} while(0)
    349 #define lwsl_notice(...) do {} while(0)
    350 #endif
    351 #define lwsl_info(...) do {} while(0)
    352 #define lwsl_debug(...) do {} while(0)
    353 #define lwsl_parser(...) do {} while(0)
    354 #define lwsl_header(...) do {} while(0)
    355 #define lwsl_ext(...) do {} while(0)
    356 #define lwsl_client(...) do {} while(0)
    357 #define lwsl_latency(...) do {} while(0)
    358 #define lwsl_hexdump(a, b)
    359 
    360 #endif
    361 
    372 LWS_VISIBLE LWS_EXTERN void
    373 lws_set_log_level(int level,
    374  void (*log_emit_function)(int level, const char *line));
    375 
    385 LWS_VISIBLE LWS_EXTERN void
    386 lwsl_emit_syslog(int level, const char *line);
    387 
    389 
    390 
    391 #include <stddef.h>
    392 
    393 #ifndef lws_container_of
    394 #define lws_container_of(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
    395 #endif
    396 
    397 
    398 struct lws;
    399 #ifndef ARRAY_SIZE
    400 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
    401 #endif
    402 
    403 /* api change list for user code to test against */
    404 
    405 #define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_ARG
    406 
    407 /* the struct lws_protocols has the id field present */
    408 #define LWS_FEATURE_PROTOCOLS_HAS_ID_FIELD
    409 
    410 /* you can call lws_get_peer_write_allowance */
    411 #define LWS_FEATURE_PROTOCOLS_HAS_PEER_WRITE_ALLOWANCE
    412 
    413 /* extra parameter introduced in 917f43ab821 */
    414 #define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_LEN
    415 
    416 /* File operations stuff exists */
    417 #define LWS_FEATURE_FOPS
    418 
    419 
    420 #if defined(_WIN32)
    421 typedef SOCKET lws_sockfd_type;
    422 typedef HANDLE lws_filefd_type;
    423 #define lws_sockfd_valid(sfd) (!!sfd)
    424 struct lws_pollfd {
    425  lws_sockfd_type fd;
    426  SHORT events;
    427  SHORT revents;
    428 };
    429 #define LWS_POLLHUP (FD_CLOSE)
    430 #define LWS_POLLIN (FD_READ | FD_ACCEPT)
    431 #define LWS_POLLOUT (FD_WRITE)
    432 #else
    433 
    434 #if defined(MBED_OPERATORS)
    435 /* it's a class lws_conn * */
    436 typedef void * lws_sockfd_type;
    437 typedef void * lws_filefd_type;
    438 #define lws_sockfd_valid(sfd) (!!sfd)
    439 struct pollfd {
    440  lws_sockfd_type fd;
    441  short events;
    442  short revents;
    443 };
    444 #define POLLIN 0x0001
    445 #define POLLPRI 0x0002
    446 #define POLLOUT 0x0004
    447 #define POLLERR 0x0008
    448 #define POLLHUP 0x0010
    449 #define POLLNVAL 0x0020
    450 
    451 struct lws;
    452 
    453 void * mbed3_create_tcp_stream_socket(void);
    454 void mbed3_delete_tcp_stream_socket(void *sockfd);
    455 void mbed3_tcp_stream_bind(void *sock, int port, struct lws *);
    456 void mbed3_tcp_stream_accept(void *sock, struct lws *);
    457 #else
    458 #if defined(LWS_WITH_ESP8266)
    459 
    460 #include <user_interface.h>
    461 #include <espconn.h>
    462 
    463 typedef struct espconn * lws_sockfd_type;
    464 typedef void * lws_filefd_type;
    465 #define lws_sockfd_valid(sfd) (!!sfd)
    466 struct pollfd {
    467  lws_sockfd_type fd;
    468  short events;
    469  short revents;
    470 };
    471 #define POLLIN 0x0001
    472 #define POLLPRI 0x0002
    473 #define POLLOUT 0x0004
    474 #define POLLERR 0x0008
    475 #define POLLHUP 0x0010
    476 #define POLLNVAL 0x0020
    477 
    478 struct lws_vhost;
    479 
    480 lws_sockfd_type esp8266_create_tcp_listen_socket(struct lws_vhost *vh);
    481 void esp8266_tcp_stream_accept(lws_sockfd_type fd, struct lws *wsi);
    482 
    483 #include <os_type.h>
    484 #include <osapi.h>
    485 #include "ets_sys.h"
    486 
    487 int ets_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
    488 #define snprintf ets_snprintf
    489 
    490 typedef os_timer_t uv_timer_t;
    491 typedef void uv_cb_t(uv_timer_t *);
    492 
    493 void os_timer_disarm(void *);
    494 void os_timer_setfn(os_timer_t *, os_timer_func_t *, void *);
    495 
    496 void ets_timer_arm_new(os_timer_t *, int, int, int);
    497 
    498 //void os_timer_arm(os_timer_t *, int, int);
    499 
    500 #define UV_VERSION_MAJOR 1
    501 
    502 #define lws_uv_getloop(a, b) (NULL)
    503 
    504 static inline void uv_timer_init(void *l, uv_timer_t *t)
    505 {
    506  (void)l;
    507  memset(t, 0, sizeof(*t));
    508  os_timer_disarm(t);
    509 }
    510 
    511 static inline void uv_timer_start(uv_timer_t *t, uv_cb_t *cb, int first, int rep)
    512 {
    513  os_timer_setfn(t, (os_timer_func_t *)cb, t);
    514  /* ms, repeat */
    515  os_timer_arm(t, first, !!rep);
    516 }
    517 
    518 static inline void uv_timer_stop(uv_timer_t *t)
    519 {
    520  os_timer_disarm(t);
    521 }
    522 
    523 #else
    524 typedef int lws_sockfd_type;
    525 typedef int lws_filefd_type;
    526 #define lws_sockfd_valid(sfd) (sfd >= 0)
    527 #endif
    528 #endif
    529 
    530 #define lws_pollfd pollfd
    531 #define LWS_POLLHUP (POLLHUP|POLLERR)
    532 #define LWS_POLLIN (POLLIN)
    533 #define LWS_POLLOUT (POLLOUT)
    534 #endif
    535 
    538 struct lws_pollargs {
    539  lws_sockfd_type fd;
    540  int events;
    542 };
    543 
    544 struct lws_tokens;
    545 struct lws_token_limits;
    546 
    554 
    556 /*
    557  * NOTE: These public enums are part of the abi. If you want to add one,
    558  * add it at where specified so existing users are unaffected.
    559  */
    562  LWS_CLOSE_STATUS_NOSTATUS = 0,
    624  /****** add new things just above ---^ ******/
    625 
    626  LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY = 9999,
    627 };
    628 
    641 LWS_VISIBLE LWS_EXTERN void
    642 lws_close_reason(struct lws *wsi, enum lws_close_status status,
    643  unsigned char *buf, size_t len);
    644 
    646 
    647 struct lws;
    648 struct lws_context;
    649 /* needed even with extensions disabled for create context */
    650 struct lws_extension;
    651 
    663 
    665 
    666 /*
    667  * NOTE: These public enums are part of the abi. If you want to add one,
    668  * add it at where specified so existing users are unaffected.
    669  */
    913  /* external poll() management support */
    976  LWS_CALLBACK_WS_EXT_DEFAULTS = 39,
    979  LWS_CALLBACK_CGI = 40,
    981  LWS_CALLBACK_CGI_TERMINATED = 41,
    983  LWS_CALLBACK_CGI_STDIN_DATA = 42,
    985  LWS_CALLBACK_CGI_STDIN_COMPLETED = 43,
    987  LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44,
    989  LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45,
    991  LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46,
    993  LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47,
    995  LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ = 48,
    997  LWS_CALLBACK_HTTP_BIND_PROTOCOL = 49,
    999  LWS_CALLBACK_HTTP_DROP_PROTOCOL = 50,
    1001  LWS_CALLBACK_CHECK_ACCESS_RIGHTS = 51,
    1003  LWS_CALLBACK_PROCESS_HTML = 52,
    1005  LWS_CALLBACK_ADD_HEADERS = 53,
    1007  LWS_CALLBACK_SESSION_INFO = 54,
    1010  LWS_CALLBACK_GS_EVENT = 55,
    1057  /****** add new things just above ---^ ******/
    1058 
    1061 };
    1062 
    1063 
    1064 
    1080 typedef int
    1081 lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
    1082  void *user, void *in, size_t len);
    1084 
    1094 
    1096 /*
    1097  * NOTE: These public enums are part of the abi. If you want to add one,
    1098  * add it at where specified so existing users are unaffected.
    1099  */
    1100 enum lws_extension_callback_reasons {
    1101  LWS_EXT_CB_SERVER_CONTEXT_CONSTRUCT = 0,
    1102  LWS_EXT_CB_CLIENT_CONTEXT_CONSTRUCT = 1,
    1103  LWS_EXT_CB_SERVER_CONTEXT_DESTRUCT = 2,
    1104  LWS_EXT_CB_CLIENT_CONTEXT_DESTRUCT = 3,
    1105  LWS_EXT_CB_CONSTRUCT = 4,
    1106  LWS_EXT_CB_CLIENT_CONSTRUCT = 5,
    1107  LWS_EXT_CB_CHECK_OK_TO_REALLY_CLOSE = 6,
    1108  LWS_EXT_CB_CHECK_OK_TO_PROPOSE_EXTENSION = 7,
    1109  LWS_EXT_CB_DESTROY = 8,
    1110  LWS_EXT_CB_DESTROY_ANY_WSI_CLOSING = 9,
    1111  LWS_EXT_CB_ANY_WSI_ESTABLISHED = 10,
    1112  LWS_EXT_CB_PACKET_RX_PREPARSE = 11,
    1113  LWS_EXT_CB_PACKET_TX_PRESEND = 12,
    1114  LWS_EXT_CB_PACKET_TX_DO_SEND = 13,
    1115  LWS_EXT_CB_HANDSHAKE_REPLY_TX = 14,
    1116  LWS_EXT_CB_FLUSH_PENDING_TX = 15,
    1117  LWS_EXT_CB_EXTENDED_PAYLOAD_RX = 16,
    1118  LWS_EXT_CB_CAN_PROXY_CLIENT_CONNECTION = 17,
    1119  LWS_EXT_CB_1HZ = 18,
    1120  LWS_EXT_CB_REQUEST_ON_WRITEABLE = 19,
    1121  LWS_EXT_CB_IS_WRITEABLE = 20,
    1122  LWS_EXT_CB_PAYLOAD_TX = 21,
    1123  LWS_EXT_CB_PAYLOAD_RX = 22,
    1124  LWS_EXT_CB_OPTION_DEFAULT = 23,
    1125  LWS_EXT_CB_OPTION_SET = 24,
    1126  LWS_EXT_CB_OPTION_CONFIRM = 25,
    1127  LWS_EXT_CB_NAMED_OPTION_SET = 26,
    1128 
    1129  /****** add new things just above ---^ ******/
    1130 };
    1131 
    1138  /* Add new things just above here ---^
    1139  * This is part of the ABI, don't needlessly break compatibility */
    1140 };
    1141 
    1147  const char *name;
    1150  /* Add new things just above here ---^
    1151  * This is part of the ABI, don't needlessly break compatibility */
    1152 };
    1153 
    1156  const char *option_name;
    1158  const char *start;
    1159  int len;
    1160 };
    1161 
    1222 typedef int
    1223 lws_extension_callback_function(struct lws_context *context,
    1224  const struct lws_extension *ext, struct lws *wsi,
    1225  enum lws_extension_callback_reasons reason,
    1226  void *user, void *in, size_t len);
    1227 
    1230  const char *name;
    1232  const char *client_offer;
    1234  /* Add new things just above here ---^
    1235  * This is part of the ABI, don't needlessly break compatibility */
    1236 };
    1237 
    1246 LWS_VISIBLE LWS_EXTERN int
    1247 lws_set_extension_option(struct lws *wsi, const char *ext_name,
    1248  const char *opt_name, const char *opt_val);
    1249 
    1250 #ifndef LWS_NO_EXTENSIONS
    1251 /* lws_get_internal_extensions() - DEPRECATED
    1252  *
    1253  * \Deprecated There is no longer a set internal extensions table. The table is provided
    1254  * by user code along with application-specific settings. See the test
    1255  * client and server for how to do.
    1256  */
    1257 static LWS_INLINE LWS_WARN_DEPRECATED const struct lws_extension *
    1258 lws_get_internal_extensions(void) { return NULL; }
    1259 
    1270 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    1271 lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,
    1272  void *ext_user, const struct lws_ext_options *opts,
    1273  const char *o, int len);
    1274 #endif
    1275 
    1288 LWS_EXTERN
    1290  struct lws_context *context, const struct lws_extension *ext,
    1291  struct lws *wsi, enum lws_extension_callback_reasons reason,
    1292  void *user, void *in, size_t len);
    1293 
    1294 /*
    1295  * The internal exts are part of the public abi
    1296  * If we add more extensions, publish the callback here ------v
    1297  */
    1299 
    1315 
    1320  const char *name;
    1341  unsigned int id;
    1348  void *user;
    1351  /* Add new things just above here ---^
    1352  * This is part of the ABI, don't needlessly break compatibility */
    1353 };
    1354 
    1355 struct lws_vhost;
    1356 
    1365 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
    1366 lws_vhost_name_to_protocol(struct lws_vhost *vh, const char *name);
    1367 
    1377 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
    1378 lws_get_protocol(struct lws *wsi);
    1379 
    1381 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
    1382 lws_protocol_get(struct lws *wsi) LWS_WARN_DEPRECATED;
    1383 
    1394 LWS_VISIBLE LWS_EXTERN void *
    1395 lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost, const struct lws_protocols *prot,
    1396  int size);
    1397 
    1407 LWS_VISIBLE LWS_EXTERN void *
    1408 lws_protocol_vh_priv_get(struct lws_vhost *vhost, const struct lws_protocols *prot);
    1409 
    1418 LWS_VISIBLE LWS_EXTERN int
    1419 lws_finalize_startup(struct lws_context *context);
    1420 
    1421 #ifdef LWS_WITH_PLUGINS
    1422 
    1423 /* PLUGINS implies LIBUV */
    1424 
    1425 #define LWS_PLUGIN_API_MAGIC 180
    1426 
    1429  unsigned int api_magic;
    1430  const struct lws_protocols *protocols;
    1432  const struct lws_extension *extensions;
    1434 };
    1435 
    1436 typedef int (*lws_plugin_init_func)(struct lws_context *,
    1437  struct lws_plugin_capability *);
    1438 typedef int (*lws_plugin_destroy_func)(struct lws_context *);
    1439 
    1441 struct lws_plugin {
    1442  struct lws_plugin *list;
    1443 #if (UV_VERSION_MAJOR > 0)
    1444  uv_lib_t lib;
    1445 #else
    1446  void *l;
    1447 #endif
    1448  char name[64];
    1450 };
    1451 
    1452 #endif
    1453 
    1455 
    1456 
    1465 
    1467 #define LWSGS_EMAIL_CONTENT_SIZE 16384
    1468 
    1470 /* SHA-1 binary and hexified versions */
    1472 typedef struct { unsigned char bin[20]; } lwsgw_hash_bin;
    1474 typedef struct { char id[41]; } lwsgw_hash;
    1475 
    1482 };
    1483 
    1486  char username[32];
    1487  char email[100];
    1488  char ip[72];
    1489  unsigned int mask;
    1491  char session[42];
    1492 };
    1493 
    1498 };
    1499 
    1502  enum lws_gs_event event;
    1503  const char *username;
    1504  const char *email;
    1505 };
    1506 
    1508 
    1509 
    1523 
    1525 /*
    1526  * NOTE: These public enums are part of the abi. If you want to add one,
    1527  * add it at where specified so existing users are unaffected.
    1528  */
    1529 
    1533  (1 << 12),
    1540  (1 << 12),
    1556  (1 << 12),
    1561  (1 << 12),
    1592  /****** add new things just above ---^ ******/
    1593 };
    1594 
    1595 #define lws_check_opt(c, f) (((c) & (f)) == (f))
    1596 
    1607  int port;
    1612  const char *iface;
    1619  const struct lws_protocols *protocols;
    1623  const struct lws_extension *extensions;
    1631  const char *ssl_cert_filepath;
    1641  const char *ssl_ca_filepath;
    1643  const char *ssl_cipher_list;
    1647  const char *http_proxy_address;
    1650  unsigned int http_proxy_port;
    1652  int gid;
    1654  int uid;
    1656  unsigned int options;
    1658  void *user;
    1661  int ka_time;
    1671 #ifdef LWS_OPENSSL_SUPPORT
    1677 #else /* maintain structure layout either way */
    1679 #endif
    1680 
    1691  unsigned int count_threads;
    1693  unsigned int fd_limit_per_thread;
    1697  unsigned int timeout_secs;
    1702  const char *ecdh_curve;
    1704  const char *vhost_name;
    1708  const char * const *plugin_dirs;
    1717  const char *log_filepath;
    1720  const struct lws_http_mount *mounts;
    1722  const char *server_string;
    1725  unsigned int pt_serv_buf_size;
    1740  unsigned short ws_ping_pong_interval;
    1771  /* Add new things just above here ---^
    1772  * This is part of the ABI, don't needlessly break compatibility
    1773  *
    1774  * The below is to ensure later library versions with new
    1775  * members added above will see 0 (default) even if the app
    1776  * was not built against the newer headers.
    1777  */
    1778 
    1779  void *_unused[8];
    1780 };
    1781 
    1816 LWS_VISIBLE LWS_EXTERN struct lws_context *
    1818 
    1827 LWS_VISIBLE LWS_EXTERN void
    1828 lws_context_destroy(struct lws_context *context);
    1829 
    1830 LWS_VISIBLE LWS_EXTERN void
    1831 lws_context_destroy2(struct lws_context *context);
    1832 
    1833 typedef int (*lws_reload_func)(void);
    1834 
    1859 LWS_VISIBLE LWS_EXTERN void
    1860 lws_context_deprecate(struct lws_context *context, lws_reload_func cb);
    1861 
    1862 LWS_VISIBLE LWS_EXTERN int
    1863 lws_context_is_deprecated(struct lws_context *context);
    1864 
    1882 LWS_VISIBLE LWS_EXTERN int
    1883 lws_set_proxy(struct lws_vhost *vhost, const char *proxy);
    1884 
    1885 
    1886 struct lws_vhost;
    1887 
    1897 LWS_EXTERN LWS_VISIBLE struct lws_vhost *
    1898 lws_create_vhost(struct lws_context *context,
    1899  struct lws_context_creation_info *info);
    1900 
    1915 LWS_VISIBLE LWS_EXTERN int
    1916 lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d,
    1917  char **config_strings, int *len);
    1918 
    1934 LWS_VISIBLE LWS_EXTERN int
    1935 lwsws_get_config_vhosts(struct lws_context *context,
    1936  struct lws_context_creation_info *info, const char *d,
    1937  char **config_strings, int *len);
    1938 
    1940 LWS_VISIBLE LWS_EXTERN struct lws_vhost *
    1941 lws_vhost_get(struct lws *wsi) LWS_WARN_DEPRECATED;
    1942 
    1948 LWS_VISIBLE LWS_EXTERN struct lws_vhost *
    1949 lws_get_vhost(struct lws *wsi);
    1950 
    1958 LWS_VISIBLE LWS_EXTERN int
    1959 lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len);
    1960 
    1968 LWS_VISIBLE LWS_EXTERN int
    1969 lws_json_dump_context(const struct lws_context *context, char *buf, int len,
    1970  int hide_vhosts);
    1971 
    1981 LWS_VISIBLE LWS_EXTERN void *
    1982 lws_context_user(struct lws_context *context);
    1983 
    1989 
    1999  const char *name;
    2000  const char *value;
    2001 };
    2002 
    2015 };
    2016 
    2024  const char *mountpoint;
    2026  const char *origin;
    2028  const char *def;
    2030  const char *protocol;
    2046  unsigned int auth_mask;
    2049  unsigned int cache_reusable:1;
    2050  unsigned int cache_revalidate:1;
    2051  unsigned int cache_intermediaries:1;
    2053  unsigned char origin_protocol;
    2054  unsigned char mountpoint_len;
    2059  /* Add new things just above here ---^
    2060  * This is part of the ABI, don't needlessly break compatibility
    2061  *
    2062  * The below is to ensure later library versions with new
    2063  * members added above will see 0 (default) even if the app
    2064  * was not built against the newer headers.
    2065  */
    2066 
    2067  void *_unused[2];
    2068 };
    2071 
    2077 
    2085  LCCSCF_USE_SSL = (1 << 0),
    2086  LCCSCF_ALLOW_SELFSIGNED = (1 << 1),
    2087  LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK = (1 << 2),
    2088  LCCSCF_ALLOW_EXPIRED = (1 << 3)
    2089 };
    2090 
    2095  struct lws_context *context;
    2097  const char *address;
    2099  int port;
    2103  const char *path;
    2105  const char *host;
    2107  const char *origin;
    2109  const char *protocol;
    2113  void *userdata;
    2115  const void *client_exts;
    2117  const char *method;
    2120  struct lws *parent_wsi;
    2124  const char *uri_replace_from;
    2127  const char *uri_replace_to;
    2129  struct lws_vhost *vhost;
    2131  struct lws **pwsi;
    2143  /* Add new things just above here ---^
    2144  * This is part of the ABI, don't needlessly break compatibility
    2145  *
    2146  * The below is to ensure later library versions with new
    2147  * members added above will see 0 (default) even if the app
    2148  * was not built against the newer headers.
    2149  */
    2150 
    2151  void *_unused[4];
    2152 };
    2153 
    2161 LWS_VISIBLE LWS_EXTERN struct lws *
    2163 
    2184 /* deprecated, use lws_client_connect_via_info() */
    2185 LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
    2186 lws_client_connect(struct lws_context *clients, const char *address,
    2187  int port, int ssl_connection, const char *path,
    2188  const char *host, const char *origin, const char *protocol,
    2189  int ietf_version_or_minus_one) LWS_WARN_DEPRECATED;
    2190 /* deprecated, use lws_client_connect_via_info() */
    2211 LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
    2212 lws_client_connect_extended(struct lws_context *clients, const char *address,
    2213  int port, int ssl_connection, const char *path,
    2214  const char *host, const char *origin,
    2215  const char *protocol, int ietf_version_or_minus_one,
    2216  void *userdata) LWS_WARN_DEPRECATED;
    2217 
    2243 LWS_VISIBLE LWS_EXTERN int
    2245  struct lws_vhost *vhost);
    2246 
    2247 LWS_VISIBLE LWS_EXTERN int
    2248 lws_http_client_read(struct lws *wsi, char **buf, int *len);
    2249 
    2257 LWS_VISIBLE LWS_EXTERN unsigned int
    2258 lws_http_client_http_response(struct lws *wsi);
    2259 
    2260 LWS_VISIBLE LWS_EXTERN void
    2261 lws_client_http_body_pending(struct lws *wsi, int something_left_to_send);
    2262 
    2283 
    2292 
    2325 LWS_VISIBLE LWS_EXTERN int
    2326 lws_service(struct lws_context *context, int timeout_ms);
    2327 
    2339 LWS_VISIBLE LWS_EXTERN int
    2340 lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
    2341 
    2357 LWS_VISIBLE LWS_EXTERN void
    2358 lws_cancel_service_pt(struct lws *wsi);
    2359 
    2371 LWS_VISIBLE LWS_EXTERN void
    2372 lws_cancel_service(struct lws_context *context);
    2373 
    2400 LWS_VISIBLE LWS_EXTERN int
    2401 lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd);
    2402 
    2412 LWS_VISIBLE LWS_EXTERN int
    2413 lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
    2414  int tsi);
    2415 
    2433 LWS_VISIBLE LWS_EXTERN int
    2434 lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi);
    2435 
    2436 /* Backwards compatibility */
    2437 #define lws_plat_service_tsi lws_service_tsi
    2438 
    2440 
    2446 
    2453 
    2465 LWS_VISIBLE LWS_EXTERN const char *
    2466 lws_get_mimetype(const char *file, const struct lws_http_mount *m);
    2467 
    2486 LWS_VISIBLE LWS_EXTERN int
    2487 lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
    2488  const char *other_headers, int other_headers_len);
    2489 LWS_VISIBLE LWS_EXTERN int
    2490 lws_serve_http_file_fragment(struct lws *wsi);
    2492 
    2503 
    2504 enum http_status {
    2505  HTTP_STATUS_OK = 200,
    2506  HTTP_STATUS_NO_CONTENT = 204,
    2507  HTTP_STATUS_PARTIAL_CONTENT = 206,
    2508 
    2509  HTTP_STATUS_MOVED_PERMANENTLY = 301,
    2510  HTTP_STATUS_FOUND = 302,
    2511  HTTP_STATUS_SEE_OTHER = 303,
    2512 
    2513  HTTP_STATUS_BAD_REQUEST = 400,
    2514  HTTP_STATUS_UNAUTHORIZED,
    2515  HTTP_STATUS_PAYMENT_REQUIRED,
    2516  HTTP_STATUS_FORBIDDEN,
    2517  HTTP_STATUS_NOT_FOUND,
    2518  HTTP_STATUS_METHOD_NOT_ALLOWED,
    2519  HTTP_STATUS_NOT_ACCEPTABLE,
    2520  HTTP_STATUS_PROXY_AUTH_REQUIRED,
    2521  HTTP_STATUS_REQUEST_TIMEOUT,
    2522  HTTP_STATUS_CONFLICT,
    2523  HTTP_STATUS_GONE,
    2524  HTTP_STATUS_LENGTH_REQUIRED,
    2525  HTTP_STATUS_PRECONDITION_FAILED,
    2526  HTTP_STATUS_REQ_ENTITY_TOO_LARGE,
    2527  HTTP_STATUS_REQ_URI_TOO_LONG,
    2528  HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE,
    2529  HTTP_STATUS_REQ_RANGE_NOT_SATISFIABLE,
    2530  HTTP_STATUS_EXPECTATION_FAILED,
    2531 
    2532  HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
    2533  HTTP_STATUS_NOT_IMPLEMENTED,
    2534  HTTP_STATUS_BAD_GATEWAY,
    2535  HTTP_STATUS_SERVICE_UNAVAILABLE,
    2536  HTTP_STATUS_GATEWAY_TIMEOUT,
    2537  HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED,
    2538 };
    2539 
    2541  char *p;
    2542  int len;
    2543  int max_len;
    2544  int final;
    2545 };
    2546 
    2547 typedef const char *(*lws_process_html_state_cb)(void *data, int index);
    2548 
    2550  char *start;
    2551  char swallow[16];
    2552  int pos;
    2553  void *data;
    2554  const char * const *vars;
    2557  lws_process_html_state_cb replace;
    2558 };
    2559 
    2564 LWS_VISIBLE LWS_EXTERN int
    2566  struct lws_process_html_state *s);
    2568 
    2601 
    2609 struct lws_tokens {
    2610  char *token;
    2612 };
    2613 
    2614 /* enum lws_token_indexes
    2615  * these have to be kept in sync with lextable.h / minilex.c
    2616  *
    2617  * NOTE: These public enums are part of the abi. If you want to add one,
    2618  * add it at where specified so existing users are unaffected.
    2619  */
    2620 enum lws_token_indexes {
    2621  WSI_TOKEN_GET_URI = 0,
    2622  WSI_TOKEN_POST_URI = 1,
    2623  WSI_TOKEN_OPTIONS_URI = 2,
    2624  WSI_TOKEN_HOST = 3,
    2625  WSI_TOKEN_CONNECTION = 4,
    2626  WSI_TOKEN_UPGRADE = 5,
    2627  WSI_TOKEN_ORIGIN = 6,
    2628  WSI_TOKEN_DRAFT = 7,
    2629  WSI_TOKEN_CHALLENGE = 8,
    2630  WSI_TOKEN_EXTENSIONS = 9,
    2631  WSI_TOKEN_KEY1 = 10,
    2632  WSI_TOKEN_KEY2 = 11,
    2633  WSI_TOKEN_PROTOCOL = 12,
    2634  WSI_TOKEN_ACCEPT = 13,
    2635  WSI_TOKEN_NONCE = 14,
    2636  WSI_TOKEN_HTTP = 15,
    2637  WSI_TOKEN_HTTP2_SETTINGS = 16,
    2638  WSI_TOKEN_HTTP_ACCEPT = 17,
    2639  WSI_TOKEN_HTTP_AC_REQUEST_HEADERS = 18,
    2640  WSI_TOKEN_HTTP_IF_MODIFIED_SINCE = 19,
    2641  WSI_TOKEN_HTTP_IF_NONE_MATCH = 20,
    2642  WSI_TOKEN_HTTP_ACCEPT_ENCODING = 21,
    2643  WSI_TOKEN_HTTP_ACCEPT_LANGUAGE = 22,
    2644  WSI_TOKEN_HTTP_PRAGMA = 23,
    2645  WSI_TOKEN_HTTP_CACHE_CONTROL = 24,
    2646  WSI_TOKEN_HTTP_AUTHORIZATION = 25,
    2647  WSI_TOKEN_HTTP_COOKIE = 26,
    2648  WSI_TOKEN_HTTP_CONTENT_LENGTH = 27,
    2649  WSI_TOKEN_HTTP_CONTENT_TYPE = 28,
    2650  WSI_TOKEN_HTTP_DATE = 29,
    2651  WSI_TOKEN_HTTP_RANGE = 30,
    2652  WSI_TOKEN_HTTP_REFERER = 31,
    2653  WSI_TOKEN_KEY = 32,
    2654  WSI_TOKEN_VERSION = 33,
    2655  WSI_TOKEN_SWORIGIN = 34,
    2656 
    2657  WSI_TOKEN_HTTP_COLON_AUTHORITY = 35,
    2658  WSI_TOKEN_HTTP_COLON_METHOD = 36,
    2659  WSI_TOKEN_HTTP_COLON_PATH = 37,
    2660  WSI_TOKEN_HTTP_COLON_SCHEME = 38,
    2661  WSI_TOKEN_HTTP_COLON_STATUS = 39,
    2662 
    2663  WSI_TOKEN_HTTP_ACCEPT_CHARSET = 40,
    2664  WSI_TOKEN_HTTP_ACCEPT_RANGES = 41,
    2665  WSI_TOKEN_HTTP_ACCESS_CONTROL_ALLOW_ORIGIN = 42,
    2666  WSI_TOKEN_HTTP_AGE = 43,
    2667  WSI_TOKEN_HTTP_ALLOW = 44,
    2668  WSI_TOKEN_HTTP_CONTENT_DISPOSITION = 45,
    2669  WSI_TOKEN_HTTP_CONTENT_ENCODING = 46,
    2670  WSI_TOKEN_HTTP_CONTENT_LANGUAGE = 47,
    2671  WSI_TOKEN_HTTP_CONTENT_LOCATION = 48,
    2672  WSI_TOKEN_HTTP_CONTENT_RANGE = 49,
    2673  WSI_TOKEN_HTTP_ETAG = 50,
    2674  WSI_TOKEN_HTTP_EXPECT = 51,
    2675  WSI_TOKEN_HTTP_EXPIRES = 52,
    2676  WSI_TOKEN_HTTP_FROM = 53,
    2677  WSI_TOKEN_HTTP_IF_MATCH = 54,
    2678  WSI_TOKEN_HTTP_IF_RANGE = 55,
    2679  WSI_TOKEN_HTTP_IF_UNMODIFIED_SINCE = 56,
    2680  WSI_TOKEN_HTTP_LAST_MODIFIED = 57,
    2681  WSI_TOKEN_HTTP_LINK = 58,
    2682  WSI_TOKEN_HTTP_LOCATION = 59,
    2683  WSI_TOKEN_HTTP_MAX_FORWARDS = 60,
    2684  WSI_TOKEN_HTTP_PROXY_AUTHENTICATE = 61,
    2685  WSI_TOKEN_HTTP_PROXY_AUTHORIZATION = 62,
    2686  WSI_TOKEN_HTTP_REFRESH = 63,
    2687  WSI_TOKEN_HTTP_RETRY_AFTER = 64,
    2688  WSI_TOKEN_HTTP_SERVER = 65,
    2689  WSI_TOKEN_HTTP_SET_COOKIE = 66,
    2690  WSI_TOKEN_HTTP_STRICT_TRANSPORT_SECURITY = 67,
    2691  WSI_TOKEN_HTTP_TRANSFER_ENCODING = 68,
    2692  WSI_TOKEN_HTTP_USER_AGENT = 69,
    2693  WSI_TOKEN_HTTP_VARY = 70,
    2694  WSI_TOKEN_HTTP_VIA = 71,
    2695  WSI_TOKEN_HTTP_WWW_AUTHENTICATE = 72,
    2696 
    2697  WSI_TOKEN_PATCH_URI = 73,
    2698  WSI_TOKEN_PUT_URI = 74,
    2699  WSI_TOKEN_DELETE_URI = 75,
    2700 
    2701  WSI_TOKEN_HTTP_URI_ARGS = 76,
    2702  WSI_TOKEN_PROXY = 77,
    2703  WSI_TOKEN_HTTP_X_REAL_IP = 78,
    2704  WSI_TOKEN_HTTP1_0 = 79,
    2705  WSI_TOKEN_X_FORWARDED_FOR = 80,
    2706 
    2707  /****** add new things just above ---^ ******/
    2708 
    2709  /* use token storage to stash these internally, not for
    2710  * user use */
    2711 
    2712  _WSI_TOKEN_CLIENT_SENT_PROTOCOLS,
    2713  _WSI_TOKEN_CLIENT_PEER_ADDRESS,
    2714  _WSI_TOKEN_CLIENT_URI,
    2715  _WSI_TOKEN_CLIENT_HOST,
    2716  _WSI_TOKEN_CLIENT_ORIGIN,
    2717  _WSI_TOKEN_CLIENT_METHOD,
    2718 
    2719  /* always last real token index*/
    2720  WSI_TOKEN_COUNT,
    2721 
    2722  /* parser state additions, no storage associated */
    2723  WSI_TOKEN_NAME_PART,
    2724  WSI_TOKEN_SKIPPING,
    2725  WSI_TOKEN_SKIPPING_SAW_CR,
    2726  WSI_PARSING_COMPLETE,
    2727  WSI_INIT_TOKEN_MUXURL,
    2728 };
    2729 
    2731  unsigned short token_limit[WSI_TOKEN_COUNT];
    2732 };
    2733 
    2739 LWS_VISIBLE LWS_EXTERN const unsigned char *
    2740 lws_token_to_string(enum lws_token_indexes token);
    2741 
    2742 
    2751 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2752 lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h);
    2753 
    2763 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2764 lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h, int frag_idx);
    2765 
    2779 LWS_VISIBLE LWS_EXTERN int
    2780 lws_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h);
    2781 
    2799 LWS_VISIBLE LWS_EXTERN int
    2800 lws_hdr_copy_fragment(struct lws *wsi, char *dest, int len,
    2801  enum lws_token_indexes h, int frag_idx);
    2802 
    2813 LWS_VISIBLE LWS_EXTERN const char *
    2814 lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len);
    2816 
    2831 
    2842 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2843 lws_add_http_header_status(struct lws *wsi,
    2844  unsigned int code, unsigned char **p,
    2845  unsigned char *end);
    2858 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2859 lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
    2860  const unsigned char *value, int length,
    2861  unsigned char **p, unsigned char *end);
    2875 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2876 lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
    2877  const unsigned char *value, int length,
    2878  unsigned char **p, unsigned char *end);
    2889 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2890 lws_add_http_header_content_length(struct lws *wsi,
    2891  unsigned long content_length,
    2892  unsigned char **p, unsigned char *end);
    2902 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2903 lws_finalize_http_header(struct lws *wsi, unsigned char **p,
    2904  unsigned char *end);
    2906 
    2925 
    2935 };
    2936 
    2950 typedef int (*lws_spa_fileupload_cb)(void *data, const char *name,
    2951  const char *filename, char *buf, int len,
    2952  enum lws_spa_fileupload_states state);
    2953 
    2956 struct lws_spa;
    2957 
    2976 LWS_VISIBLE LWS_EXTERN struct lws_spa *
    2977 lws_spa_create(struct lws *wsi, const char * const *param_names,
    2978  int count_params, int max_storage, lws_spa_fileupload_cb opt_cb,
    2979  void *opt_data);
    2980 
    2988 LWS_VISIBLE LWS_EXTERN int
    2989 lws_spa_process(struct lws_spa *spa, const char *in, int len);
    2990 
    2996 LWS_VISIBLE LWS_EXTERN int
    2997 lws_spa_finalize(struct lws_spa *spa);
    2998 
    3005 LWS_VISIBLE LWS_EXTERN int
    3006 lws_spa_get_length(struct lws_spa *spa, int n);
    3007 
    3013 LWS_VISIBLE LWS_EXTERN const char *
    3014 lws_spa_get_string(struct lws_spa *spa, int n);
    3015 
    3021 LWS_VISIBLE LWS_EXTERN int
    3022 lws_spa_destroy(struct lws_spa *spa);
    3024 
    3035 
    3046 LWS_VISIBLE LWS_EXTERN const char *
    3047 lws_urlencode(char *escaped, const char *string, int len);
    3048 
    3049 /*
    3050  * URLDECODE 1 / 2
    3051  *
    3052  * This simple urldecode only operates until the first '\0' and requires the
    3053  * data to exist all at once
    3054  */
    3067 LWS_VISIBLE LWS_EXTERN int
    3068 lws_urldecode(char *string, const char *escaped, int len);
    3070 
    3079 LWS_VISIBLE LWS_EXTERN int
    3080 lws_return_http_status(struct lws *wsi, unsigned int code,
    3081  const char *html_body);
    3082 
    3093 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3094 lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
    3095  unsigned char **p, unsigned char *end);
    3096 
    3105 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3106 lws_http_transaction_completed(struct lws *wsi);
    3108 
    3116 
    3127 LWS_VISIBLE LWS_EXTERN const char *
    3128 lws_sql_purify(char *escaped, const char *string, int len);
    3129 
    3140 LWS_VISIBLE LWS_EXTERN const char *
    3141 lws_json_purify(char *escaped, const char *string, int len);
    3143 
    3150 
    3152 #ifdef LWS_USE_LIBEV
    3153 typedef void (lws_ev_signal_cb_t)(EV_P_ struct ev_signal *w, int revents);
    3154 
    3155 LWS_VISIBLE LWS_EXTERN int
    3156 lws_ev_sigint_cfg(struct lws_context *context, int use_ev_sigint,
    3157  lws_ev_signal_cb_t *cb);
    3158 
    3159 LWS_VISIBLE LWS_EXTERN int
    3160 lws_ev_initloop(struct lws_context *context, struct ev_loop *loop, int tsi);
    3161 
    3162 LWS_VISIBLE LWS_EXTERN void
    3163 lws_ev_sigint_cb(struct ev_loop *loop, struct ev_signal *watcher, int revents);
    3164 #endif /* LWS_USE_LIBEV */
    3165 
    3167 
    3174 #ifdef LWS_USE_LIBUV
    3176 LWS_VISIBLE LWS_EXTERN int
    3177 lws_uv_sigint_cfg(struct lws_context *context, int use_uv_sigint,
    3178  uv_signal_cb cb);
    3179 
    3180 LWS_VISIBLE LWS_EXTERN void
    3181 lws_libuv_run(const struct lws_context *context, int tsi);
    3182 
    3183 LWS_VISIBLE LWS_EXTERN void
    3184 lws_libuv_stop(struct lws_context *context);
    3185 
    3186 LWS_VISIBLE LWS_EXTERN void
    3187 lws_libuv_stop_without_kill(const struct lws_context *context, int tsi);
    3188 
    3189 LWS_VISIBLE LWS_EXTERN int
    3190 lws_uv_initloop(struct lws_context *context, uv_loop_t *loop, int tsi);
    3191 
    3192 LWS_VISIBLE LWS_EXTERN uv_loop_t *
    3193 lws_uv_getloop(struct lws_context *context, int tsi);
    3194 
    3195 LWS_VISIBLE LWS_EXTERN void
    3196 lws_uv_sigint_cb(uv_signal_t *watcher, int signum);
    3197 #endif /* LWS_USE_LIBUV */
    3198 
    3205 
    3206 /*
    3207  * NOTE: These public enums are part of the abi. If you want to add one,
    3208  * add it at where specified so existing users are unaffected.
    3209  */
    3210 enum pending_timeout {
    3211  NO_PENDING_TIMEOUT = 0,
    3212  PENDING_TIMEOUT_AWAITING_PROXY_RESPONSE = 1,
    3213  PENDING_TIMEOUT_AWAITING_CONNECT_RESPONSE = 2,
    3214  PENDING_TIMEOUT_ESTABLISH_WITH_SERVER = 3,
    3215  PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE = 4,
    3216  PENDING_TIMEOUT_AWAITING_PING = 5,
    3217  PENDING_TIMEOUT_CLOSE_ACK = 6,
    3218  PENDING_TIMEOUT_AWAITING_EXTENSION_CONNECT_RESPONSE = 7,
    3219  PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE = 8,
    3220  PENDING_TIMEOUT_SSL_ACCEPT = 9,
    3221  PENDING_TIMEOUT_HTTP_CONTENT = 10,
    3222  PENDING_TIMEOUT_AWAITING_CLIENT_HS_SEND = 11,
    3223  PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE = 12,
    3224  PENDING_TIMEOUT_SHUTDOWN_FLUSH = 13,
    3225  PENDING_TIMEOUT_CGI = 14,
    3226  PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE = 15,
    3227  PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING = 16,
    3228  PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG = 17,
    3229  PENDING_TIMEOUT_CLIENT_ISSUE_PAYLOAD = 18,
    3230 
    3231  /****** add new things just above ---^ ******/
    3232 };
    3233 
    3243 LWS_VISIBLE LWS_EXTERN void
    3244 lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs);
    3246 
    3252 #if !defined(LWS_SIZEOFPTR)
    3253 #define LWS_SIZEOFPTR (sizeof (void *))
    3254 #endif
    3255 #if !defined(u_int64_t)
    3256 #define u_int64_t unsigned long long
    3257 #endif
    3258 
    3259 #if defined(__x86_64__)
    3260 #define _LWS_PAD_SIZE 16 /* Intel recommended for best performance */
    3261 #else
    3262 #define _LWS_PAD_SIZE LWS_SIZEOFPTR /* Size of a pointer on the target arch */
    3263 #endif
    3264 #define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ? \
    3265  ((n) + (_LWS_PAD_SIZE - ((n) % _LWS_PAD_SIZE))) : (n))
    3266 #define LWS_PRE _LWS_PAD(4 + 10)
    3267 /* used prior to 1.7 and retained for backward compatibility */
    3268 #define LWS_SEND_BUFFER_PRE_PADDING LWS_PRE
    3269 #define LWS_SEND_BUFFER_POST_PADDING 0
    3270 
    3271 /*
    3272  * NOTE: These public enums are part of the abi. If you want to add one,
    3273  * add it at where specified so existing users are unaffected.
    3274  */
    3289  /* LWS_WRITE_CLOSE is handled by lws_close_reason() */
    3290  LWS_WRITE_PING = 5,
    3291  LWS_WRITE_PONG = 6,
    3292 
    3293  /* Same as write_http but we know this write ends the transaction */
    3294  LWS_WRITE_HTTP_FINAL = 7,
    3295 
    3296  /* HTTP2 */
    3297 
    3305  /****** add new things just above ---^ ******/
    3306 
    3307  /* flags */
    3308 
    3316 };
    3317 
    3318 
    3405 LWS_VISIBLE LWS_EXTERN int
    3406 lws_write(struct lws *wsi, unsigned char *buf, size_t len,
    3407  enum lws_write_protocol protocol);
    3408 
    3409 /* helper for case where buffer may be const */
    3410 #define lws_write_http(wsi, buf, len) \
    3411  lws_write(wsi, (unsigned char *)(buf), len, LWS_WRITE_HTTP)
    3412 
    3432 
    3445 LWS_VISIBLE LWS_EXTERN int
    3446 lws_callback_on_writable(struct lws *wsi);
    3447 
    3461 LWS_VISIBLE LWS_EXTERN int
    3462 lws_callback_on_writable_all_protocol(const struct lws_context *context,
    3463  const struct lws_protocols *protocol);
    3464 
    3478 LWS_VISIBLE LWS_EXTERN int
    3479 lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,
    3480  const struct lws_protocols *protocol);
    3481 
    3494 LWS_VISIBLE LWS_EXTERN int
    3495 lws_callback_all_protocol(struct lws_context *context,
    3496  const struct lws_protocols *protocol, int reason);
    3497 
    3510 LWS_VISIBLE LWS_EXTERN int
    3511 lws_callback_all_protocol_vhost(struct lws_vhost *vh,
    3512  const struct lws_protocols *protocol, int reason);
    3513 
    3527 LWS_VISIBLE LWS_EXTERN int
    3528 lws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len);
    3529 
    3530 LWS_VISIBLE LWS_EXTERN int
    3531 lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
    3532  void *user, void *in, size_t len);
    3533 
    3541 LWS_VISIBLE LWS_EXTERN int
    3542 lws_get_socket_fd(struct lws *wsi);
    3543 
    3565 LWS_VISIBLE LWS_EXTERN size_t
    3566 lws_get_peer_write_allowance(struct lws *wsi);
    3568 
    3579 LWS_VISIBLE LWS_EXTERN int
    3580 lws_rx_flow_control(struct lws *wsi, int enable);
    3581 
    3591 LWS_VISIBLE LWS_EXTERN void
    3592 lws_rx_flow_allow_all_protocol(const struct lws_context *context,
    3593  const struct lws_protocols *protocol);
    3594 
    3611 LWS_VISIBLE LWS_EXTERN size_t
    3612 lws_remaining_packet_payload(struct lws *wsi);
    3613 
    3614 
    3623 
    3637 LWS_VISIBLE LWS_EXTERN struct lws *
    3638 lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd);
    3651 LWS_VISIBLE LWS_EXTERN struct lws *
    3652 lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd);
    3676 LWS_VISIBLE LWS_EXTERN struct lws *
    3677 lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
    3678  const char *readbuf, size_t len);
    3702 LWS_VISIBLE LWS_EXTERN struct lws *
    3703 lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost, lws_sockfd_type accept_fd,
    3704  const char *readbuf, size_t len);
    3706 
    3712 
    3723 LWS_VISIBLE LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
    3724 lws_canonical_hostname(struct lws_context *context);
    3725 
    3740 LWS_VISIBLE LWS_EXTERN void
    3741 lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
    3742  int name_len, char *rip, int rip_len);
    3743 
    3754 LWS_VISIBLE LWS_EXTERN const char *
    3755 lws_get_peer_simple(struct lws *wsi, char *name, int namelen);
    3756 #ifndef LWS_WITH_ESP8266
    3757 
    3768 LWS_VISIBLE LWS_EXTERN int
    3769 lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
    3770  size_t addrlen);
    3772 #endif
    3773 
    3779 
    3792 LWS_VISIBLE LWS_EXTERN int
    3793 lws_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
    3794 
    3806 LWS_VISIBLE LWS_EXTERN int
    3807 lws_get_random(struct lws_context *context, void *buf, int len);
    3815 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3816 lws_daemonize(const char *_lock_path);
    3822 LWS_VISIBLE LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
    3824 
    3831 LWS_VISIBLE LWS_EXTERN void *
    3832 lws_wsi_user(struct lws *wsi);
    3833 
    3845 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3846 lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
    3847  const char **path);
    3848 
    3852 LWS_VISIBLE LWS_EXTERN unsigned long
    3853 lws_now_secs(void);
    3854 
    3864 LWS_VISIBLE LWS_EXTERN struct lws_context * LWS_WARN_UNUSED_RESULT
    3865 lws_get_context(const struct lws *wsi);
    3866 
    3876 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3877 lws_get_count_threads(struct lws_context *context);
    3878 
    3886 LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
    3887 lws_get_parent(const struct lws *wsi);
    3888 
    3895 LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
    3896 lws_get_child(const struct lws *wsi);
    3897 
    3898 
    3899 /*
    3900  * \deprecated DEPRECATED Note: this is not normally needed as a user api.
    3901  * It's provided in case it is
    3902  * useful when integrating with other app poll loop service code.
    3903  */
    3904 LWS_VISIBLE LWS_EXTERN int
    3905 lws_read(struct lws *wsi, unsigned char *buf, size_t len);
    3906 
    3914 LWS_VISIBLE LWS_EXTERN void
    3915 lws_set_allocator(void *(*realloc)(void *ptr, size_t size));
    3917 
    3923 
    3930 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3931 lws_send_pipe_choked(struct lws *wsi);
    3932 
    3937 LWS_VISIBLE LWS_EXTERN int
    3938 lws_is_final_fragment(struct lws *wsi);
    3939 
    3944 LWS_VISIBLE LWS_EXTERN unsigned char
    3945 lws_get_reserved_bits(struct lws *wsi);
    3946 
    3963 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3964 lws_partial_buffered(struct lws *wsi);
    3965 
    3975 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3976 lws_frame_is_binary(struct lws *wsi);
    3977 
    3986 LWS_VISIBLE LWS_EXTERN int
    3987 lws_is_ssl(struct lws *wsi);
    3992 LWS_VISIBLE LWS_EXTERN int
    3993 lws_is_cgi(struct lws *wsi);
    3994 
    3995 #ifdef LWS_OPENSSL_SUPPORT
    3996 
    4002 LWS_VISIBLE LWS_EXTERN SSL*
    4003 lws_get_ssl(struct lws *wsi);
    4004 #endif
    4005 
    4007 
    4013 #ifdef LWS_SHA1_USE_OPENSSL_NAME
    4015 #define lws_SHA1 SHA1
    4016 #else
    4017 
    4026 LWS_VISIBLE LWS_EXTERN unsigned char *
    4027 lws_SHA1(const unsigned char *d, size_t n, unsigned char *md);
    4028 #endif
    4029 
    4039 LWS_VISIBLE LWS_EXTERN int
    4040 lws_b64_encode_string(const char *in, int in_len, char *out, int out_size);
    4050 LWS_VISIBLE LWS_EXTERN int
    4051 lws_b64_decode_string(const char *in, char *out, int out_size);
    4053 
    4054 
    4064 #ifdef LWS_WITH_CGI
    4065 enum lws_enum_stdinouterr {
    4066  LWS_STDIN = 0,
    4067  LWS_STDOUT = 1,
    4068  LWS_STDERR = 2,
    4069 };
    4070 
    4071 enum lws_cgi_hdr_state {
    4072  LCHS_HEADER,
    4073  LCHS_CR1,
    4074  LCHS_LF1,
    4075  LCHS_CR2,
    4076  LCHS_LF2,
    4077  LHCS_PAYLOAD,
    4078  LCHS_SINGLE_0A,
    4079 };
    4080 
    4082  struct lws **stdwsi;
    4083  enum lws_enum_stdinouterr ch;
    4084  unsigned char *data;
    4085  enum lws_cgi_hdr_state hdr_state;
    4086  int len;
    4087 };
    4088 
    4089 
    4099 LWS_VISIBLE LWS_EXTERN int
    4100 lws_cgi(struct lws *wsi, const char * const *exec_array,
    4101  int script_uri_path_len, int timeout_secs,
    4102  const struct lws_protocol_vhost_options *mp_cgienv);
    4103 
    4109 LWS_VISIBLE LWS_EXTERN int
    4110 lws_cgi_write_split_stdout_headers(struct lws *wsi);
    4111 
    4117 LWS_VISIBLE LWS_EXTERN int
    4118 lws_cgi_kill(struct lws *wsi);
    4119 #endif
    4120 
    4122 
    4139 
    4146  lws_filefd_type (*open)(struct lws *wsi, const char *filename,
    4147  unsigned long *filelen, int flags);
    4151  int (*close)(struct lws *wsi, lws_filefd_type fd);
    4153  unsigned long (*seek_cur)(struct lws *wsi, lws_filefd_type fd,
    4154  long offset_from_cur_pos);
    4156  int (*read)(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
    4157  unsigned char *buf, unsigned long len);
    4159  int (*write)(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
    4160  unsigned char *buf, unsigned long len);
    4163  /* Add new things just above here ---^
    4164  * This is part of the ABI, don't needlessly break compatibility */
    4165 };
    4166 
    4172 LWS_VISIBLE LWS_EXTERN struct lws_plat_file_ops * LWS_WARN_UNUSED_RESULT
    4173 lws_get_fops(struct lws_context *context);
    4174 
    4183 static LWS_INLINE lws_filefd_type LWS_WARN_UNUSED_RESULT
    4184 lws_plat_file_open(struct lws *wsi, const char *filename,
    4185  unsigned long *filelen, int flags)
    4186 {
    4187  return lws_get_fops(lws_get_context(wsi))->open(wsi, filename,
    4188  filelen, flags);
    4189 }
    4190 
    4197 static LWS_INLINE int
    4198 lws_plat_file_close(struct lws *wsi, lws_filefd_type fd)
    4199 {
    4200  return lws_get_fops(lws_get_context(wsi))->close(wsi, fd);
    4201 }
    4202 
    4210 static LWS_INLINE unsigned long
    4211 lws_plat_file_seek_cur(struct lws *wsi, lws_filefd_type fd, long offset)
    4212 {
    4213  return lws_get_fops(lws_get_context(wsi))->seek_cur(wsi, fd, offset);
    4214 }
    4224 static LWS_INLINE int LWS_WARN_UNUSED_RESULT
    4225 lws_plat_file_read(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
    4226  unsigned char *buf, unsigned long len)
    4227 {
    4228  return lws_get_fops(lws_get_context(wsi))->read(wsi, fd, amount, buf,
    4229  len);
    4230 }
    4240 static LWS_INLINE int LWS_WARN_UNUSED_RESULT
    4241 lws_plat_file_write(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
    4242  unsigned char *buf, unsigned long len)
    4243 {
    4244  return lws_get_fops(lws_get_context(wsi))->write(wsi, fd, amount, buf,
    4245  len);
    4246 }
    4248 
    4280 #ifdef LWS_WITH_SMTP
    4281 
    4293 };
    4294 
    4296 struct lws_email {
    4297  void *data;
    4299  uv_loop_t *loop;
    4302  char email_smtp_ip[32];
    4303  char email_helo[32];
    4304  char email_from[100];
    4305  char email_to[100];
    4307  unsigned int max_content_size;
    4310  /* Fill all the callbacks before init */
    4311 
    4312  int (*on_next)(struct lws_email *email);
    4317  int (*on_sent)(struct lws_email *email);
    4322  int (*on_get_body)(struct lws_email *email, char *buf, int len);
    4328  /* private things */
    4329  uv_timer_t timeout_email;
    4331  uv_connect_t email_connect_req;
    4332  uv_tcp_t email_client;
    4334  char email_buf[256];
    4335  char *content;
    4336 };
    4337 
    4347 LWS_VISIBLE LWS_EXTERN int
    4348 lws_email_init(struct lws_email *email, uv_loop_t *loop, int max_content);
    4349 
    4358 LWS_VISIBLE LWS_EXTERN void
    4359 lws_email_check(struct lws_email *email);
    4367 LWS_VISIBLE LWS_EXTERN void
    4368 lws_email_destroy(struct lws_email *email);
    4369 
    4370 #endif
    4371 
    4372 
    4373 #ifdef __cplusplus
    4374 }
    4375 #endif
    4376 
    4377 #endif
    LWS_VISIBLE LWS_EXTERN int lws_spa_destroy(struct lws_spa *spa)
    +Go to the documentation of this file.
    1 /*
    2  * libwebsockets - small server side websockets and web server implementation
    3  *
    4  * Copyright (C) 2010-2016 Andy Green <andy@warmcat.com>
    5  *
    6  * This library is free software; you can redistribute it and/or
    7  * modify it under the terms of the GNU Lesser General Public
    8  * License as published by the Free Software Foundation:
    9  * version 2.1 of the License.
    10  *
    11  * This library is distributed in the hope that it will be useful,
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    14  * Lesser General Public License for more details.
    15  *
    16  * You should have received a copy of the GNU Lesser General Public
    17  * License along with this library; if not, write to the Free Software
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    19  * MA 02110-1301 USA
    20  */
    21 
    24 #ifndef LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
    25 #define LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
    26 
    27 #ifdef __cplusplus
    28 #include <cstddef>
    29 #include <cstdarg>
    30 #ifdef MBED_OPERATORS
    31 #include "mbed-drivers/mbed.h"
    32 #include "sal-iface-eth/EthernetInterface.h"
    33 #include "sockets/TCPListener.h"
    34 #include "sal-stack-lwip/lwipv4_init.h"
    35 
    36 namespace {
    37 }
    38 using namespace mbed::Sockets::v0;
    39 
    40 
    41 struct sockaddr_in;
    42 struct lws;
    43 
    44 class lws_conn {
    45  public:
    46  lws_conn():
    47  ts(NULL),
    48  wsi(NULL),
    49  writeable(1),
    50  awaiting_on_writeable(0)
    51  {
    52  }
    53 
    54 public:
    55  void set_wsi(struct lws *_wsi) { wsi = _wsi; }
    56  int actual_onRX(Socket *s);
    57  void onRX(Socket *s);
    58  void onError(Socket *s, socket_error_t err);
    59  void onDisconnect(TCPStream *s);
    60  void onSent(Socket *s, uint16_t len);
    61  void serialized_writeable(struct lws *wsi);
    62 
    63 public:
    64  TCPStream *ts;
    65 
    66 public:
    67  struct lws *wsi;
    68  char writeable;
    69  char awaiting_on_writeable;
    70 };
    71 
    73 public:
    75  srv(SOCKET_STACK_LWIP_IPV4)
    76  {
    77  srv.setOnError(TCPStream::ErrorHandler_t(this,
    79  }
    80 
    81  void start(const uint16_t port);
    83 protected:
    84  void onRX(Socket *s);
    85  void onError(Socket *s, socket_error_t err);
    86  void onIncoming(TCPListener *s, void *impl);
    87  void onDisconnect(TCPStream *s);
    89 public:
    90  TCPListener srv;
    91 };
    92 
    93 #endif
    94 
    95 extern "C" {
    96 #else
    97 #include <stdarg.h>
    98 #endif
    99 
    100 #if defined(MBED_OPERATORS) || defined(LWS_WITH_ESP8266)
    101 struct sockaddr_in;
    102 #define LWS_POSIX 0
    103 #else
    104 #define LWS_POSIX 1
    105 #endif
    106 
    107 #include "lws_config.h"
    108 
    109 #if defined(WIN32) || defined(_WIN32)
    110 #ifndef WIN32_LEAN_AND_MEAN
    111 #define WIN32_LEAN_AND_MEAN
    112 #endif
    113 
    114 #include <winsock2.h>
    115 #include <ws2tcpip.h>
    116 #include <stddef.h>
    117 #include <basetsd.h>
    118 #ifndef _WIN32_WCE
    119 #include <fcntl.h>
    120 #else
    121 #define _O_RDONLY 0x0000
    122 #define O_RDONLY _O_RDONLY
    123 #endif
    124 
    125 // Visual studio older than 2015 and WIN_CE has only _stricmp
    126 #if (defined(_MSC_VER) && _MSC_VER < 1900) || defined(_WIN32_WCE)
    127 #define strcasecmp _stricmp
    128 #elif !defined(__MINGW32__)
    129 #define strcasecmp stricmp
    130 #endif
    131 #define getdtablesize() 30000
    132 
    133 #define LWS_INLINE __inline
    134 #define LWS_VISIBLE
    135 #define LWS_WARN_UNUSED_RESULT
    136 #define LWS_WARN_DEPRECATED
    137 #define LWS_FORMAT(string_index)
    138 
    139 #ifdef LWS_DLL
    140 #ifdef LWS_INTERNAL
    141 #define LWS_EXTERN extern __declspec(dllexport)
    142 #else
    143 #define LWS_EXTERN extern __declspec(dllimport)
    144 #endif
    145 #else
    146 #define LWS_EXTERN
    147 #endif
    148 
    149 #define LWS_INVALID_FILE INVALID_HANDLE_VALUE
    150 #define LWS_O_RDONLY _O_RDONLY
    151 
    152 #if !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER < 1900) /* Visual Studio 2015 already defines this in <stdio.h> */
    153 #define lws_snprintf _snprintf
    154 #endif
    155 
    156 #ifndef __func__
    157 #define __func__ __FUNCTION__
    158 #endif
    159 
    160 #else /* NOT WIN32 */
    161 #include <unistd.h>
    162 
    163 #if defined(__NetBSD__) || defined(__FreeBSD__)
    164 #include <netinet/in.h>
    165 #endif
    166 
    167 #define LWS_INLINE inline
    168 #define LWS_O_RDONLY O_RDONLY
    169 
    170 #if !defined(MBED_OPERATORS) && !defined(LWS_WITH_ESP8266) && !defined(OPTEE_TA)
    171 #include <poll.h>
    172 #include <netdb.h>
    173 #define LWS_INVALID_FILE -1
    174 #else
    175 #define getdtablesize() (20)
    176 #define LWS_INVALID_FILE NULL
    177 #endif
    178 
    179 #if defined(__GNUC__)
    180 
    181 /* warn_unused_result attribute only supported by GCC 3.4 or later */
    182 #if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
    183 #define LWS_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
    184 #else
    185 #define LWS_WARN_UNUSED_RESULT
    186 #endif
    187 
    188 #define LWS_VISIBLE __attribute__((visibility("default")))
    189 #define LWS_WARN_DEPRECATED __attribute__ ((deprecated))
    190 #define LWS_FORMAT(string_index) __attribute__ ((format(printf, string_index, string_index+1)))
    191 #else
    192 #define LWS_VISIBLE
    193 #define LWS_WARN_UNUSED_RESULT
    194 #define LWS_WARN_DEPRECATED
    195 #define LWS_FORMAT(string_index)
    196 #endif
    197 
    198 #if defined(__ANDROID__)
    199 #include <unistd.h>
    200 #define getdtablesize() sysconf(_SC_OPEN_MAX)
    201 #endif
    202 
    203 #endif
    204 
    205 #ifdef LWS_USE_LIBEV
    206 #include <ev.h>
    207 #endif /* LWS_USE_LIBEV */
    208 #ifdef LWS_USE_LIBUV
    209 #include <uv.h>
    210 #ifdef LWS_HAVE_UV_VERSION_H
    211 #include <uv-version.h>
    212 #endif
    213 #endif /* LWS_USE_LIBUV */
    214 
    215 #ifndef LWS_EXTERN
    216 #define LWS_EXTERN extern
    217 #endif
    218 
    219 #ifdef _WIN32
    220 #define random rand
    221 #else
    222 #if !defined(OPTEE_TA)
    223 #include <sys/time.h>
    224 #include <unistd.h>
    225 #endif
    226 #endif
    227 
    228 #ifdef LWS_OPENSSL_SUPPORT
    229 
    230 #ifdef USE_WOLFSSL
    231 #ifdef USE_OLD_CYASSL
    232 #include <cyassl/openssl/ssl.h>
    233 #include <cyassl/error-ssl.h>
    234 #else
    235 #include <wolfssl/openssl/ssl.h>
    236 #include <wolfssl/error-ssl.h>
    237 #endif /* not USE_OLD_CYASSL */
    238 #else
    239 #if defined(LWS_USE_POLARSSL)
    240 #include <polarssl/ssl.h>
    242  x509_crt ca;
    243  x509_crt certificate;
    244  rsa_context key;
    245 };
    246 typedef struct lws_polarssl_context SSL_CTX;
    247 typedef ssl_context SSL;
    248 #else
    249 #if defined(LWS_USE_MBEDTLS)
    250 #include <mbedtls/ssl.h>
    251 #else
    252 #include <openssl/ssl.h>
    253 #include <openssl/err.h>
    254 #endif /* not USE_MBEDTLS */
    255 #endif /* not USE_POLARSSL */
    256 #endif /* not USE_WOLFSSL */
    257 #endif
    258 
    259 
    260 #define CONTEXT_PORT_NO_LISTEN -1
    261 #define CONTEXT_PORT_NO_LISTEN_SERVER -2
    262 
    273 
    275 enum lws_log_levels {
    276  LLL_ERR = 1 << 0,
    277  LLL_WARN = 1 << 1,
    278  LLL_NOTICE = 1 << 2,
    279  LLL_INFO = 1 << 3,
    280  LLL_DEBUG = 1 << 4,
    281  LLL_PARSER = 1 << 5,
    282  LLL_HEADER = 1 << 6,
    283  LLL_EXT = 1 << 7,
    284  LLL_CLIENT = 1 << 8,
    285  LLL_LATENCY = 1 << 9,
    286  LLL_USER = 1 << 10,
    287 
    288  LLL_COUNT = 11 /* set to count of valid flags */
    289 };
    290 
    291 LWS_VISIBLE LWS_EXTERN void _lws_log(int filter, const char *format, ...) LWS_FORMAT(2);
    292 LWS_VISIBLE LWS_EXTERN void _lws_logv(int filter, const char *format, va_list vl);
    302 LWS_VISIBLE LWS_EXTERN int
    303 lwsl_timestamp(int level, char *p, int len);
    304 
    305 /* these guys are unconditionally included */
    306 
    307 #define lwsl_err(...) _lws_log(LLL_ERR, __VA_ARGS__)
    308 #define lwsl_user(...) _lws_log(LLL_USER, __VA_ARGS__)
    309 
    310 #if !defined(LWS_WITH_NO_LOGS)
    311 /* notice and warn are usually included by being compiled in */
    312 #define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__)
    313 #define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__)
    314 #endif
    315 /*
    316  * weaker logging can be deselected by telling CMake to build in RELEASE mode
    317  * that gets rid of the overhead of checking while keeping _warn and _err
    318  * active
    319  */
    320 
    321 #if defined(LWS_WITH_ESP8266)
    322 #undef _DEBUG
    323 #endif
    324 
    325 #ifdef _DEBUG
    326 #if defined(LWS_WITH_NO_LOGS)
    327 /* notice, warn and log are always compiled in */
    328 #define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__)
    329 #define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__)
    330 #endif
    331 #define lwsl_info(...) _lws_log(LLL_INFO, __VA_ARGS__)
    332 #define lwsl_debug(...) _lws_log(LLL_DEBUG, __VA_ARGS__)
    333 #define lwsl_parser(...) _lws_log(LLL_PARSER, __VA_ARGS__)
    334 #define lwsl_header(...) _lws_log(LLL_HEADER, __VA_ARGS__)
    335 #define lwsl_ext(...) _lws_log(LLL_EXT, __VA_ARGS__)
    336 #define lwsl_client(...) _lws_log(LLL_CLIENT, __VA_ARGS__)
    337 #define lwsl_latency(...) _lws_log(LLL_LATENCY, __VA_ARGS__)
    338 
    344 LWS_VISIBLE LWS_EXTERN void lwsl_hexdump(void *buf, size_t len);
    345 
    346 #else /* no debug */
    347 #if defined(LWS_WITH_NO_LOGS)
    348 #define lwsl_warn(...) do {} while(0)
    349 #define lwsl_notice(...) do {} while(0)
    350 #endif
    351 #define lwsl_info(...) do {} while(0)
    352 #define lwsl_debug(...) do {} while(0)
    353 #define lwsl_parser(...) do {} while(0)
    354 #define lwsl_header(...) do {} while(0)
    355 #define lwsl_ext(...) do {} while(0)
    356 #define lwsl_client(...) do {} while(0)
    357 #define lwsl_latency(...) do {} while(0)
    358 #define lwsl_hexdump(a, b)
    359 
    360 #endif
    361 
    372 LWS_VISIBLE LWS_EXTERN void
    373 lws_set_log_level(int level,
    374  void (*log_emit_function)(int level, const char *line));
    375 
    385 LWS_VISIBLE LWS_EXTERN void
    386 lwsl_emit_syslog(int level, const char *line);
    387 
    397 LWS_VISIBLE LWS_EXTERN int
    398 lwsl_visible(int level);
    399 
    401 
    402 
    403 #include <stddef.h>
    404 
    405 #ifndef lws_container_of
    406 #define lws_container_of(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
    407 #endif
    408 
    409 
    410 struct lws;
    411 #ifndef ARRAY_SIZE
    412 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
    413 #endif
    414 
    415 /* api change list for user code to test against */
    416 
    417 #define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_ARG
    418 
    419 /* the struct lws_protocols has the id field present */
    420 #define LWS_FEATURE_PROTOCOLS_HAS_ID_FIELD
    421 
    422 /* you can call lws_get_peer_write_allowance */
    423 #define LWS_FEATURE_PROTOCOLS_HAS_PEER_WRITE_ALLOWANCE
    424 
    425 /* extra parameter introduced in 917f43ab821 */
    426 #define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_LEN
    427 
    428 /* File operations stuff exists */
    429 #define LWS_FEATURE_FOPS
    430 
    431 
    432 #if defined(_WIN32)
    433 typedef SOCKET lws_sockfd_type;
    434 typedef HANDLE lws_filefd_type;
    435 #define lws_sockfd_valid(sfd) (!!sfd)
    436 struct lws_pollfd {
    437  lws_sockfd_type fd;
    438  SHORT events;
    439  SHORT revents;
    440 };
    441 #define LWS_POLLHUP (FD_CLOSE)
    442 #define LWS_POLLIN (FD_READ | FD_ACCEPT)
    443 #define LWS_POLLOUT (FD_WRITE)
    444 #else
    445 
    446 #if defined(MBED_OPERATORS)
    447 /* it's a class lws_conn * */
    448 typedef void * lws_sockfd_type;
    449 typedef void * lws_filefd_type;
    450 #define lws_sockfd_valid(sfd) (!!sfd)
    451 struct pollfd {
    452  lws_sockfd_type fd;
    453  short events;
    454  short revents;
    455 };
    456 #define POLLIN 0x0001
    457 #define POLLPRI 0x0002
    458 #define POLLOUT 0x0004
    459 #define POLLERR 0x0008
    460 #define POLLHUP 0x0010
    461 #define POLLNVAL 0x0020
    462 
    463 struct lws;
    464 
    465 void * mbed3_create_tcp_stream_socket(void);
    466 void mbed3_delete_tcp_stream_socket(void *sockfd);
    467 void mbed3_tcp_stream_bind(void *sock, int port, struct lws *);
    468 void mbed3_tcp_stream_accept(void *sock, struct lws *);
    469 #else
    470 #if defined(LWS_WITH_ESP8266)
    471 
    472 #include <user_interface.h>
    473 #include <espconn.h>
    474 
    475 typedef struct espconn * lws_sockfd_type;
    476 typedef void * lws_filefd_type;
    477 #define lws_sockfd_valid(sfd) (!!sfd)
    478 struct pollfd {
    479  lws_sockfd_type fd;
    480  short events;
    481  short revents;
    482 };
    483 #define POLLIN 0x0001
    484 #define POLLPRI 0x0002
    485 #define POLLOUT 0x0004
    486 #define POLLERR 0x0008
    487 #define POLLHUP 0x0010
    488 #define POLLNVAL 0x0020
    489 
    490 struct lws_vhost;
    491 
    492 lws_sockfd_type esp8266_create_tcp_listen_socket(struct lws_vhost *vh);
    493 void esp8266_tcp_stream_accept(lws_sockfd_type fd, struct lws *wsi);
    494 
    495 #include <os_type.h>
    496 #include <osapi.h>
    497 #include "ets_sys.h"
    498 
    499 int ets_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
    500 #define snprintf ets_snprintf
    501 
    502 typedef os_timer_t uv_timer_t;
    503 typedef void uv_cb_t(uv_timer_t *);
    504 
    505 void os_timer_disarm(void *);
    506 void os_timer_setfn(os_timer_t *, os_timer_func_t *, void *);
    507 
    508 void ets_timer_arm_new(os_timer_t *, int, int, int);
    509 
    510 //void os_timer_arm(os_timer_t *, int, int);
    511 
    512 #define UV_VERSION_MAJOR 1
    513 
    514 #define lws_uv_getloop(a, b) (NULL)
    515 
    516 static inline void uv_timer_init(void *l, uv_timer_t *t)
    517 {
    518  (void)l;
    519  memset(t, 0, sizeof(*t));
    520  os_timer_disarm(t);
    521 }
    522 
    523 static inline void uv_timer_start(uv_timer_t *t, uv_cb_t *cb, int first, int rep)
    524 {
    525  os_timer_setfn(t, (os_timer_func_t *)cb, t);
    526  /* ms, repeat */
    527  os_timer_arm(t, first, !!rep);
    528 }
    529 
    530 static inline void uv_timer_stop(uv_timer_t *t)
    531 {
    532  os_timer_disarm(t);
    533 }
    534 
    535 #else
    536 typedef int lws_sockfd_type;
    537 typedef int lws_filefd_type;
    538 #define lws_sockfd_valid(sfd) (sfd >= 0)
    539 #endif
    540 #endif
    541 
    542 #define lws_pollfd pollfd
    543 #define LWS_POLLHUP (POLLHUP|POLLERR)
    544 #define LWS_POLLIN (POLLIN)
    545 #define LWS_POLLOUT (POLLOUT)
    546 #endif
    547 
    550 struct lws_pollargs {
    551  lws_sockfd_type fd;
    552  int events;
    554 };
    555 
    556 struct lws_tokens;
    557 struct lws_token_limits;
    558 
    566 
    568 /*
    569  * NOTE: These public enums are part of the abi. If you want to add one,
    570  * add it at where specified so existing users are unaffected.
    571  */
    574  LWS_CLOSE_STATUS_NOSTATUS = 0,
    636  /****** add new things just above ---^ ******/
    637 
    638  LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY = 9999,
    639 };
    640 
    653 LWS_VISIBLE LWS_EXTERN void
    654 lws_close_reason(struct lws *wsi, enum lws_close_status status,
    655  unsigned char *buf, size_t len);
    656 
    658 
    659 struct lws;
    660 struct lws_context;
    661 /* needed even with extensions disabled for create context */
    662 struct lws_extension;
    663 
    675 
    677 
    678 /*
    679  * NOTE: These public enums are part of the abi. If you want to add one,
    680  * add it at where specified so existing users are unaffected.
    681  */
    925  /* external poll() management support */
    988  LWS_CALLBACK_WS_EXT_DEFAULTS = 39,
    991  LWS_CALLBACK_CGI = 40,
    993  LWS_CALLBACK_CGI_TERMINATED = 41,
    995  LWS_CALLBACK_CGI_STDIN_DATA = 42,
    997  LWS_CALLBACK_CGI_STDIN_COMPLETED = 43,
    999  LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44,
    1001  LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45,
    1003  LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46,
    1005  LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47,
    1007  LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ = 48,
    1009  LWS_CALLBACK_HTTP_BIND_PROTOCOL = 49,
    1011  LWS_CALLBACK_HTTP_DROP_PROTOCOL = 50,
    1013  LWS_CALLBACK_CHECK_ACCESS_RIGHTS = 51,
    1015  LWS_CALLBACK_PROCESS_HTML = 52,
    1017  LWS_CALLBACK_ADD_HEADERS = 53,
    1019  LWS_CALLBACK_SESSION_INFO = 54,
    1022  LWS_CALLBACK_GS_EVENT = 55,
    1069  /****** add new things just above ---^ ******/
    1070 
    1073 };
    1074 
    1075 
    1076 
    1092 typedef int
    1093 lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
    1094  void *user, void *in, size_t len);
    1096 
    1106 
    1108 /*
    1109  * NOTE: These public enums are part of the abi. If you want to add one,
    1110  * add it at where specified so existing users are unaffected.
    1111  */
    1112 enum lws_extension_callback_reasons {
    1113  LWS_EXT_CB_SERVER_CONTEXT_CONSTRUCT = 0,
    1114  LWS_EXT_CB_CLIENT_CONTEXT_CONSTRUCT = 1,
    1115  LWS_EXT_CB_SERVER_CONTEXT_DESTRUCT = 2,
    1116  LWS_EXT_CB_CLIENT_CONTEXT_DESTRUCT = 3,
    1117  LWS_EXT_CB_CONSTRUCT = 4,
    1118  LWS_EXT_CB_CLIENT_CONSTRUCT = 5,
    1119  LWS_EXT_CB_CHECK_OK_TO_REALLY_CLOSE = 6,
    1120  LWS_EXT_CB_CHECK_OK_TO_PROPOSE_EXTENSION = 7,
    1121  LWS_EXT_CB_DESTROY = 8,
    1122  LWS_EXT_CB_DESTROY_ANY_WSI_CLOSING = 9,
    1123  LWS_EXT_CB_ANY_WSI_ESTABLISHED = 10,
    1124  LWS_EXT_CB_PACKET_RX_PREPARSE = 11,
    1125  LWS_EXT_CB_PACKET_TX_PRESEND = 12,
    1126  LWS_EXT_CB_PACKET_TX_DO_SEND = 13,
    1127  LWS_EXT_CB_HANDSHAKE_REPLY_TX = 14,
    1128  LWS_EXT_CB_FLUSH_PENDING_TX = 15,
    1129  LWS_EXT_CB_EXTENDED_PAYLOAD_RX = 16,
    1130  LWS_EXT_CB_CAN_PROXY_CLIENT_CONNECTION = 17,
    1131  LWS_EXT_CB_1HZ = 18,
    1132  LWS_EXT_CB_REQUEST_ON_WRITEABLE = 19,
    1133  LWS_EXT_CB_IS_WRITEABLE = 20,
    1134  LWS_EXT_CB_PAYLOAD_TX = 21,
    1135  LWS_EXT_CB_PAYLOAD_RX = 22,
    1136  LWS_EXT_CB_OPTION_DEFAULT = 23,
    1137  LWS_EXT_CB_OPTION_SET = 24,
    1138  LWS_EXT_CB_OPTION_CONFIRM = 25,
    1139  LWS_EXT_CB_NAMED_OPTION_SET = 26,
    1140 
    1141  /****** add new things just above ---^ ******/
    1142 };
    1143 
    1150  /* Add new things just above here ---^
    1151  * This is part of the ABI, don't needlessly break compatibility */
    1152 };
    1153 
    1159  const char *name;
    1162  /* Add new things just above here ---^
    1163  * This is part of the ABI, don't needlessly break compatibility */
    1164 };
    1165 
    1168  const char *option_name;
    1170  const char *start;
    1171  int len;
    1172 };
    1173 
    1234 typedef int
    1235 lws_extension_callback_function(struct lws_context *context,
    1236  const struct lws_extension *ext, struct lws *wsi,
    1237  enum lws_extension_callback_reasons reason,
    1238  void *user, void *in, size_t len);
    1239 
    1242  const char *name;
    1244  const char *client_offer;
    1246  /* Add new things just above here ---^
    1247  * This is part of the ABI, don't needlessly break compatibility */
    1248 };
    1249 
    1258 LWS_VISIBLE LWS_EXTERN int
    1259 lws_set_extension_option(struct lws *wsi, const char *ext_name,
    1260  const char *opt_name, const char *opt_val);
    1261 
    1262 #ifndef LWS_NO_EXTENSIONS
    1263 /* lws_get_internal_extensions() - DEPRECATED
    1264  *
    1265  * \Deprecated There is no longer a set internal extensions table. The table is provided
    1266  * by user code along with application-specific settings. See the test
    1267  * client and server for how to do.
    1268  */
    1269 static LWS_INLINE LWS_WARN_DEPRECATED const struct lws_extension *
    1270 lws_get_internal_extensions(void) { return NULL; }
    1271 
    1282 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    1283 lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,
    1284  void *ext_user, const struct lws_ext_options *opts,
    1285  const char *o, int len);
    1286 #endif
    1287 
    1300 LWS_EXTERN
    1302  struct lws_context *context, const struct lws_extension *ext,
    1303  struct lws *wsi, enum lws_extension_callback_reasons reason,
    1304  void *user, void *in, size_t len);
    1305 
    1306 /*
    1307  * The internal exts are part of the public abi
    1308  * If we add more extensions, publish the callback here ------v
    1309  */
    1311 
    1327 
    1332  const char *name;
    1353  unsigned int id;
    1360  void *user;
    1363  /* Add new things just above here ---^
    1364  * This is part of the ABI, don't needlessly break compatibility */
    1365 };
    1366 
    1367 struct lws_vhost;
    1368 
    1377 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
    1378 lws_vhost_name_to_protocol(struct lws_vhost *vh, const char *name);
    1379 
    1389 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
    1390 lws_get_protocol(struct lws *wsi);
    1391 
    1393 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
    1394 lws_protocol_get(struct lws *wsi) LWS_WARN_DEPRECATED;
    1395 
    1406 LWS_VISIBLE LWS_EXTERN void *
    1407 lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost, const struct lws_protocols *prot,
    1408  int size);
    1409 
    1419 LWS_VISIBLE LWS_EXTERN void *
    1420 lws_protocol_vh_priv_get(struct lws_vhost *vhost, const struct lws_protocols *prot);
    1421 
    1430 LWS_VISIBLE LWS_EXTERN int
    1431 lws_finalize_startup(struct lws_context *context);
    1432 
    1433 #ifdef LWS_WITH_PLUGINS
    1434 
    1435 /* PLUGINS implies LIBUV */
    1436 
    1437 #define LWS_PLUGIN_API_MAGIC 180
    1438 
    1441  unsigned int api_magic;
    1442  const struct lws_protocols *protocols;
    1444  const struct lws_extension *extensions;
    1446 };
    1447 
    1448 typedef int (*lws_plugin_init_func)(struct lws_context *,
    1449  struct lws_plugin_capability *);
    1450 typedef int (*lws_plugin_destroy_func)(struct lws_context *);
    1451 
    1453 struct lws_plugin {
    1454  struct lws_plugin *list;
    1455 #if (UV_VERSION_MAJOR > 0)
    1456  uv_lib_t lib;
    1457 #else
    1458  void *l;
    1459 #endif
    1460  char name[64];
    1462 };
    1463 
    1464 #endif
    1465 
    1467 
    1468 
    1477 
    1479 #define LWSGS_EMAIL_CONTENT_SIZE 16384
    1480 
    1482 /* SHA-1 binary and hexified versions */
    1484 typedef struct { unsigned char bin[20]; } lwsgw_hash_bin;
    1486 typedef struct { char id[41]; } lwsgw_hash;
    1487 
    1494 };
    1495 
    1498  char username[32];
    1499  char email[100];
    1500  char ip[72];
    1501  unsigned int mask;
    1503  char session[42];
    1504 };
    1505 
    1510 };
    1511 
    1514  enum lws_gs_event event;
    1515  const char *username;
    1516  const char *email;
    1517 };
    1518 
    1520 
    1521 
    1535 
    1537 /*
    1538  * NOTE: These public enums are part of the abi. If you want to add one,
    1539  * add it at where specified so existing users are unaffected.
    1540  */
    1541 
    1545  (1 << 12),
    1552  (1 << 12),
    1568  (1 << 12),
    1573  (1 << 12),
    1604  /****** add new things just above ---^ ******/
    1605 };
    1606 
    1607 #define lws_check_opt(c, f) (((c) & (f)) == (f))
    1608 
    1619  int port;
    1624  const char *iface;
    1631  const struct lws_protocols *protocols;
    1635  const struct lws_extension *extensions;
    1643  const char *ssl_cert_filepath;
    1653  const char *ssl_ca_filepath;
    1655  const char *ssl_cipher_list;
    1659  const char *http_proxy_address;
    1662  unsigned int http_proxy_port;
    1664  int gid;
    1666  int uid;
    1668  unsigned int options;
    1670  void *user;
    1673  int ka_time;
    1683 #ifdef LWS_OPENSSL_SUPPORT
    1689 #else /* maintain structure layout either way */
    1691 #endif
    1692 
    1703  unsigned int count_threads;
    1705  unsigned int fd_limit_per_thread;
    1709  unsigned int timeout_secs;
    1714  const char *ecdh_curve;
    1716  const char *vhost_name;
    1720  const char * const *plugin_dirs;
    1729  const char *log_filepath;
    1732  const struct lws_http_mount *mounts;
    1734  const char *server_string;
    1737  unsigned int pt_serv_buf_size;
    1752  unsigned short ws_ping_pong_interval;
    1783  /* Add new things just above here ---^
    1784  * This is part of the ABI, don't needlessly break compatibility
    1785  *
    1786  * The below is to ensure later library versions with new
    1787  * members added above will see 0 (default) even if the app
    1788  * was not built against the newer headers.
    1789  */
    1790 
    1791  void *_unused[8];
    1792 };
    1793 
    1828 LWS_VISIBLE LWS_EXTERN struct lws_context *
    1830 
    1839 LWS_VISIBLE LWS_EXTERN void
    1840 lws_context_destroy(struct lws_context *context);
    1841 
    1842 LWS_VISIBLE LWS_EXTERN void
    1843 lws_context_destroy2(struct lws_context *context);
    1844 
    1845 typedef int (*lws_reload_func)(void);
    1846 
    1871 LWS_VISIBLE LWS_EXTERN void
    1872 lws_context_deprecate(struct lws_context *context, lws_reload_func cb);
    1873 
    1874 LWS_VISIBLE LWS_EXTERN int
    1875 lws_context_is_deprecated(struct lws_context *context);
    1876 
    1894 LWS_VISIBLE LWS_EXTERN int
    1895 lws_set_proxy(struct lws_vhost *vhost, const char *proxy);
    1896 
    1897 
    1898 struct lws_vhost;
    1899 
    1909 LWS_EXTERN LWS_VISIBLE struct lws_vhost *
    1910 lws_create_vhost(struct lws_context *context,
    1911  struct lws_context_creation_info *info);
    1912 
    1927 LWS_VISIBLE LWS_EXTERN int
    1928 lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d,
    1929  char **config_strings, int *len);
    1930 
    1946 LWS_VISIBLE LWS_EXTERN int
    1947 lwsws_get_config_vhosts(struct lws_context *context,
    1948  struct lws_context_creation_info *info, const char *d,
    1949  char **config_strings, int *len);
    1950 
    1952 LWS_VISIBLE LWS_EXTERN struct lws_vhost *
    1953 lws_vhost_get(struct lws *wsi) LWS_WARN_DEPRECATED;
    1954 
    1960 LWS_VISIBLE LWS_EXTERN struct lws_vhost *
    1961 lws_get_vhost(struct lws *wsi);
    1962 
    1970 LWS_VISIBLE LWS_EXTERN int
    1971 lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len);
    1972 
    1980 LWS_VISIBLE LWS_EXTERN int
    1981 lws_json_dump_context(const struct lws_context *context, char *buf, int len,
    1982  int hide_vhosts);
    1983 
    1993 LWS_VISIBLE LWS_EXTERN void *
    1994 lws_context_user(struct lws_context *context);
    1995 
    2001 
    2011  const char *name;
    2012  const char *value;
    2013 };
    2014 
    2027 };
    2028 
    2036  const char *mountpoint;
    2038  const char *origin;
    2040  const char *def;
    2042  const char *protocol;
    2058  unsigned int auth_mask;
    2061  unsigned int cache_reusable:1;
    2062  unsigned int cache_revalidate:1;
    2063  unsigned int cache_intermediaries:1;
    2065  unsigned char origin_protocol;
    2066  unsigned char mountpoint_len;
    2071  /* Add new things just above here ---^
    2072  * This is part of the ABI, don't needlessly break compatibility
    2073  *
    2074  * The below is to ensure later library versions with new
    2075  * members added above will see 0 (default) even if the app
    2076  * was not built against the newer headers.
    2077  */
    2078 
    2079  void *_unused[2];
    2080 };
    2083 
    2089 
    2097  LCCSCF_USE_SSL = (1 << 0),
    2098  LCCSCF_ALLOW_SELFSIGNED = (1 << 1),
    2099  LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK = (1 << 2),
    2100  LCCSCF_ALLOW_EXPIRED = (1 << 3)
    2101 };
    2102 
    2107  struct lws_context *context;
    2109  const char *address;
    2111  int port;
    2115  const char *path;
    2117  const char *host;
    2119  const char *origin;
    2121  const char *protocol;
    2125  void *userdata;
    2127  const void *client_exts;
    2129  const char *method;
    2132  struct lws *parent_wsi;
    2136  const char *uri_replace_from;
    2139  const char *uri_replace_to;
    2141  struct lws_vhost *vhost;
    2143  struct lws **pwsi;
    2155  /* Add new things just above here ---^
    2156  * This is part of the ABI, don't needlessly break compatibility
    2157  *
    2158  * The below is to ensure later library versions with new
    2159  * members added above will see 0 (default) even if the app
    2160  * was not built against the newer headers.
    2161  */
    2162 
    2163  void *_unused[4];
    2164 };
    2165 
    2173 LWS_VISIBLE LWS_EXTERN struct lws *
    2175 
    2196 /* deprecated, use lws_client_connect_via_info() */
    2197 LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
    2198 lws_client_connect(struct lws_context *clients, const char *address,
    2199  int port, int ssl_connection, const char *path,
    2200  const char *host, const char *origin, const char *protocol,
    2201  int ietf_version_or_minus_one) LWS_WARN_DEPRECATED;
    2202 /* deprecated, use lws_client_connect_via_info() */
    2223 LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
    2224 lws_client_connect_extended(struct lws_context *clients, const char *address,
    2225  int port, int ssl_connection, const char *path,
    2226  const char *host, const char *origin,
    2227  const char *protocol, int ietf_version_or_minus_one,
    2228  void *userdata) LWS_WARN_DEPRECATED;
    2229 
    2255 LWS_VISIBLE LWS_EXTERN int
    2257  struct lws_vhost *vhost);
    2258 
    2279 LWS_VISIBLE LWS_EXTERN int
    2280 lws_http_client_read(struct lws *wsi, char **buf, int *len);
    2281 
    2289 LWS_VISIBLE LWS_EXTERN unsigned int
    2290 lws_http_client_http_response(struct lws *wsi);
    2291 
    2292 LWS_VISIBLE LWS_EXTERN void
    2293 lws_client_http_body_pending(struct lws *wsi, int something_left_to_send);
    2294 
    2315 
    2324 
    2357 LWS_VISIBLE LWS_EXTERN int
    2358 lws_service(struct lws_context *context, int timeout_ms);
    2359 
    2371 LWS_VISIBLE LWS_EXTERN int
    2372 lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
    2373 
    2389 LWS_VISIBLE LWS_EXTERN void
    2390 lws_cancel_service_pt(struct lws *wsi);
    2391 
    2403 LWS_VISIBLE LWS_EXTERN void
    2404 lws_cancel_service(struct lws_context *context);
    2405 
    2432 LWS_VISIBLE LWS_EXTERN int
    2433 lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd);
    2434 
    2444 LWS_VISIBLE LWS_EXTERN int
    2445 lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
    2446  int tsi);
    2447 
    2465 LWS_VISIBLE LWS_EXTERN int
    2466 lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi);
    2467 
    2468 /* Backwards compatibility */
    2469 #define lws_plat_service_tsi lws_service_tsi
    2470 
    2472 
    2478 
    2485 
    2497 LWS_VISIBLE LWS_EXTERN const char *
    2498 lws_get_mimetype(const char *file, const struct lws_http_mount *m);
    2499 
    2518 LWS_VISIBLE LWS_EXTERN int
    2519 lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
    2520  const char *other_headers, int other_headers_len);
    2521 LWS_VISIBLE LWS_EXTERN int
    2522 lws_serve_http_file_fragment(struct lws *wsi);
    2524 
    2535 
    2536 enum http_status {
    2537  HTTP_STATUS_OK = 200,
    2538  HTTP_STATUS_NO_CONTENT = 204,
    2539  HTTP_STATUS_PARTIAL_CONTENT = 206,
    2540 
    2541  HTTP_STATUS_MOVED_PERMANENTLY = 301,
    2542  HTTP_STATUS_FOUND = 302,
    2543  HTTP_STATUS_SEE_OTHER = 303,
    2544 
    2545  HTTP_STATUS_BAD_REQUEST = 400,
    2546  HTTP_STATUS_UNAUTHORIZED,
    2547  HTTP_STATUS_PAYMENT_REQUIRED,
    2548  HTTP_STATUS_FORBIDDEN,
    2549  HTTP_STATUS_NOT_FOUND,
    2550  HTTP_STATUS_METHOD_NOT_ALLOWED,
    2551  HTTP_STATUS_NOT_ACCEPTABLE,
    2552  HTTP_STATUS_PROXY_AUTH_REQUIRED,
    2553  HTTP_STATUS_REQUEST_TIMEOUT,
    2554  HTTP_STATUS_CONFLICT,
    2555  HTTP_STATUS_GONE,
    2556  HTTP_STATUS_LENGTH_REQUIRED,
    2557  HTTP_STATUS_PRECONDITION_FAILED,
    2558  HTTP_STATUS_REQ_ENTITY_TOO_LARGE,
    2559  HTTP_STATUS_REQ_URI_TOO_LONG,
    2560  HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE,
    2561  HTTP_STATUS_REQ_RANGE_NOT_SATISFIABLE,
    2562  HTTP_STATUS_EXPECTATION_FAILED,
    2563 
    2564  HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
    2565  HTTP_STATUS_NOT_IMPLEMENTED,
    2566  HTTP_STATUS_BAD_GATEWAY,
    2567  HTTP_STATUS_SERVICE_UNAVAILABLE,
    2568  HTTP_STATUS_GATEWAY_TIMEOUT,
    2569  HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED,
    2570 };
    2571 
    2573  char *p;
    2574  int len;
    2575  int max_len;
    2576  int final;
    2577 };
    2578 
    2579 typedef const char *(*lws_process_html_state_cb)(void *data, int index);
    2580 
    2582  char *start;
    2583  char swallow[16];
    2584  int pos;
    2585  void *data;
    2586  const char * const *vars;
    2589  lws_process_html_state_cb replace;
    2590 };
    2591 
    2596 LWS_VISIBLE LWS_EXTERN int
    2598  struct lws_process_html_state *s);
    2600 
    2633 
    2641 struct lws_tokens {
    2642  char *token;
    2644 };
    2645 
    2646 /* enum lws_token_indexes
    2647  * these have to be kept in sync with lextable.h / minilex.c
    2648  *
    2649  * NOTE: These public enums are part of the abi. If you want to add one,
    2650  * add it at where specified so existing users are unaffected.
    2651  */
    2652 enum lws_token_indexes {
    2653  WSI_TOKEN_GET_URI = 0,
    2654  WSI_TOKEN_POST_URI = 1,
    2655  WSI_TOKEN_OPTIONS_URI = 2,
    2656  WSI_TOKEN_HOST = 3,
    2657  WSI_TOKEN_CONNECTION = 4,
    2658  WSI_TOKEN_UPGRADE = 5,
    2659  WSI_TOKEN_ORIGIN = 6,
    2660  WSI_TOKEN_DRAFT = 7,
    2661  WSI_TOKEN_CHALLENGE = 8,
    2662  WSI_TOKEN_EXTENSIONS = 9,
    2663  WSI_TOKEN_KEY1 = 10,
    2664  WSI_TOKEN_KEY2 = 11,
    2665  WSI_TOKEN_PROTOCOL = 12,
    2666  WSI_TOKEN_ACCEPT = 13,
    2667  WSI_TOKEN_NONCE = 14,
    2668  WSI_TOKEN_HTTP = 15,
    2669  WSI_TOKEN_HTTP2_SETTINGS = 16,
    2670  WSI_TOKEN_HTTP_ACCEPT = 17,
    2671  WSI_TOKEN_HTTP_AC_REQUEST_HEADERS = 18,
    2672  WSI_TOKEN_HTTP_IF_MODIFIED_SINCE = 19,
    2673  WSI_TOKEN_HTTP_IF_NONE_MATCH = 20,
    2674  WSI_TOKEN_HTTP_ACCEPT_ENCODING = 21,
    2675  WSI_TOKEN_HTTP_ACCEPT_LANGUAGE = 22,
    2676  WSI_TOKEN_HTTP_PRAGMA = 23,
    2677  WSI_TOKEN_HTTP_CACHE_CONTROL = 24,
    2678  WSI_TOKEN_HTTP_AUTHORIZATION = 25,
    2679  WSI_TOKEN_HTTP_COOKIE = 26,
    2680  WSI_TOKEN_HTTP_CONTENT_LENGTH = 27,
    2681  WSI_TOKEN_HTTP_CONTENT_TYPE = 28,
    2682  WSI_TOKEN_HTTP_DATE = 29,
    2683  WSI_TOKEN_HTTP_RANGE = 30,
    2684  WSI_TOKEN_HTTP_REFERER = 31,
    2685  WSI_TOKEN_KEY = 32,
    2686  WSI_TOKEN_VERSION = 33,
    2687  WSI_TOKEN_SWORIGIN = 34,
    2688 
    2689  WSI_TOKEN_HTTP_COLON_AUTHORITY = 35,
    2690  WSI_TOKEN_HTTP_COLON_METHOD = 36,
    2691  WSI_TOKEN_HTTP_COLON_PATH = 37,
    2692  WSI_TOKEN_HTTP_COLON_SCHEME = 38,
    2693  WSI_TOKEN_HTTP_COLON_STATUS = 39,
    2694 
    2695  WSI_TOKEN_HTTP_ACCEPT_CHARSET = 40,
    2696  WSI_TOKEN_HTTP_ACCEPT_RANGES = 41,
    2697  WSI_TOKEN_HTTP_ACCESS_CONTROL_ALLOW_ORIGIN = 42,
    2698  WSI_TOKEN_HTTP_AGE = 43,
    2699  WSI_TOKEN_HTTP_ALLOW = 44,
    2700  WSI_TOKEN_HTTP_CONTENT_DISPOSITION = 45,
    2701  WSI_TOKEN_HTTP_CONTENT_ENCODING = 46,
    2702  WSI_TOKEN_HTTP_CONTENT_LANGUAGE = 47,
    2703  WSI_TOKEN_HTTP_CONTENT_LOCATION = 48,
    2704  WSI_TOKEN_HTTP_CONTENT_RANGE = 49,
    2705  WSI_TOKEN_HTTP_ETAG = 50,
    2706  WSI_TOKEN_HTTP_EXPECT = 51,
    2707  WSI_TOKEN_HTTP_EXPIRES = 52,
    2708  WSI_TOKEN_HTTP_FROM = 53,
    2709  WSI_TOKEN_HTTP_IF_MATCH = 54,
    2710  WSI_TOKEN_HTTP_IF_RANGE = 55,
    2711  WSI_TOKEN_HTTP_IF_UNMODIFIED_SINCE = 56,
    2712  WSI_TOKEN_HTTP_LAST_MODIFIED = 57,
    2713  WSI_TOKEN_HTTP_LINK = 58,
    2714  WSI_TOKEN_HTTP_LOCATION = 59,
    2715  WSI_TOKEN_HTTP_MAX_FORWARDS = 60,
    2716  WSI_TOKEN_HTTP_PROXY_AUTHENTICATE = 61,
    2717  WSI_TOKEN_HTTP_PROXY_AUTHORIZATION = 62,
    2718  WSI_TOKEN_HTTP_REFRESH = 63,
    2719  WSI_TOKEN_HTTP_RETRY_AFTER = 64,
    2720  WSI_TOKEN_HTTP_SERVER = 65,
    2721  WSI_TOKEN_HTTP_SET_COOKIE = 66,
    2722  WSI_TOKEN_HTTP_STRICT_TRANSPORT_SECURITY = 67,
    2723  WSI_TOKEN_HTTP_TRANSFER_ENCODING = 68,
    2724  WSI_TOKEN_HTTP_USER_AGENT = 69,
    2725  WSI_TOKEN_HTTP_VARY = 70,
    2726  WSI_TOKEN_HTTP_VIA = 71,
    2727  WSI_TOKEN_HTTP_WWW_AUTHENTICATE = 72,
    2728 
    2729  WSI_TOKEN_PATCH_URI = 73,
    2730  WSI_TOKEN_PUT_URI = 74,
    2731  WSI_TOKEN_DELETE_URI = 75,
    2732 
    2733  WSI_TOKEN_HTTP_URI_ARGS = 76,
    2734  WSI_TOKEN_PROXY = 77,
    2735  WSI_TOKEN_HTTP_X_REAL_IP = 78,
    2736  WSI_TOKEN_HTTP1_0 = 79,
    2737  WSI_TOKEN_X_FORWARDED_FOR = 80,
    2738 
    2739  /****** add new things just above ---^ ******/
    2740 
    2741  /* use token storage to stash these internally, not for
    2742  * user use */
    2743 
    2744  _WSI_TOKEN_CLIENT_SENT_PROTOCOLS,
    2745  _WSI_TOKEN_CLIENT_PEER_ADDRESS,
    2746  _WSI_TOKEN_CLIENT_URI,
    2747  _WSI_TOKEN_CLIENT_HOST,
    2748  _WSI_TOKEN_CLIENT_ORIGIN,
    2749  _WSI_TOKEN_CLIENT_METHOD,
    2750 
    2751  /* always last real token index*/
    2752  WSI_TOKEN_COUNT,
    2753 
    2754  /* parser state additions, no storage associated */
    2755  WSI_TOKEN_NAME_PART,
    2756  WSI_TOKEN_SKIPPING,
    2757  WSI_TOKEN_SKIPPING_SAW_CR,
    2758  WSI_PARSING_COMPLETE,
    2759  WSI_INIT_TOKEN_MUXURL,
    2760 };
    2761 
    2763  unsigned short token_limit[WSI_TOKEN_COUNT];
    2764 };
    2765 
    2771 LWS_VISIBLE LWS_EXTERN const unsigned char *
    2772 lws_token_to_string(enum lws_token_indexes token);
    2773 
    2774 
    2783 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2784 lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h);
    2785 
    2795 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2796 lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h, int frag_idx);
    2797 
    2811 LWS_VISIBLE LWS_EXTERN int
    2812 lws_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h);
    2813 
    2831 LWS_VISIBLE LWS_EXTERN int
    2832 lws_hdr_copy_fragment(struct lws *wsi, char *dest, int len,
    2833  enum lws_token_indexes h, int frag_idx);
    2834 
    2845 LWS_VISIBLE LWS_EXTERN const char *
    2846 lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len);
    2848 
    2863 
    2874 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2875 lws_add_http_header_status(struct lws *wsi,
    2876  unsigned int code, unsigned char **p,
    2877  unsigned char *end);
    2890 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2891 lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
    2892  const unsigned char *value, int length,
    2893  unsigned char **p, unsigned char *end);
    2907 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2908 lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
    2909  const unsigned char *value, int length,
    2910  unsigned char **p, unsigned char *end);
    2921 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2922 lws_add_http_header_content_length(struct lws *wsi,
    2923  unsigned long content_length,
    2924  unsigned char **p, unsigned char *end);
    2934 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    2935 lws_finalize_http_header(struct lws *wsi, unsigned char **p,
    2936  unsigned char *end);
    2938 
    2957 
    2967 };
    2968 
    2982 typedef int (*lws_spa_fileupload_cb)(void *data, const char *name,
    2983  const char *filename, char *buf, int len,
    2984  enum lws_spa_fileupload_states state);
    2985 
    2988 struct lws_spa;
    2989 
    3008 LWS_VISIBLE LWS_EXTERN struct lws_spa *
    3009 lws_spa_create(struct lws *wsi, const char * const *param_names,
    3010  int count_params, int max_storage, lws_spa_fileupload_cb opt_cb,
    3011  void *opt_data);
    3012 
    3020 LWS_VISIBLE LWS_EXTERN int
    3021 lws_spa_process(struct lws_spa *spa, const char *in, int len);
    3022 
    3028 LWS_VISIBLE LWS_EXTERN int
    3029 lws_spa_finalize(struct lws_spa *spa);
    3030 
    3037 LWS_VISIBLE LWS_EXTERN int
    3038 lws_spa_get_length(struct lws_spa *spa, int n);
    3039 
    3045 LWS_VISIBLE LWS_EXTERN const char *
    3046 lws_spa_get_string(struct lws_spa *spa, int n);
    3047 
    3053 LWS_VISIBLE LWS_EXTERN int
    3054 lws_spa_destroy(struct lws_spa *spa);
    3056 
    3067 
    3078 LWS_VISIBLE LWS_EXTERN const char *
    3079 lws_urlencode(char *escaped, const char *string, int len);
    3080 
    3081 /*
    3082  * URLDECODE 1 / 2
    3083  *
    3084  * This simple urldecode only operates until the first '\0' and requires the
    3085  * data to exist all at once
    3086  */
    3099 LWS_VISIBLE LWS_EXTERN int
    3100 lws_urldecode(char *string, const char *escaped, int len);
    3102 
    3111 LWS_VISIBLE LWS_EXTERN int
    3112 lws_return_http_status(struct lws *wsi, unsigned int code,
    3113  const char *html_body);
    3114 
    3125 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3126 lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
    3127  unsigned char **p, unsigned char *end);
    3128 
    3137 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3138 lws_http_transaction_completed(struct lws *wsi);
    3140 
    3148 
    3159 LWS_VISIBLE LWS_EXTERN const char *
    3160 lws_sql_purify(char *escaped, const char *string, int len);
    3161 
    3172 LWS_VISIBLE LWS_EXTERN const char *
    3173 lws_json_purify(char *escaped, const char *string, int len);
    3175 
    3182 
    3184 #ifdef LWS_USE_LIBEV
    3185 typedef void (lws_ev_signal_cb_t)(EV_P_ struct ev_signal *w, int revents);
    3186 
    3187 LWS_VISIBLE LWS_EXTERN int
    3188 lws_ev_sigint_cfg(struct lws_context *context, int use_ev_sigint,
    3189  lws_ev_signal_cb_t *cb);
    3190 
    3191 LWS_VISIBLE LWS_EXTERN int
    3192 lws_ev_initloop(struct lws_context *context, struct ev_loop *loop, int tsi);
    3193 
    3194 LWS_VISIBLE LWS_EXTERN void
    3195 lws_ev_sigint_cb(struct ev_loop *loop, struct ev_signal *watcher, int revents);
    3196 #endif /* LWS_USE_LIBEV */
    3197 
    3199 
    3206 #ifdef LWS_USE_LIBUV
    3208 LWS_VISIBLE LWS_EXTERN int
    3209 lws_uv_sigint_cfg(struct lws_context *context, int use_uv_sigint,
    3210  uv_signal_cb cb);
    3211 
    3212 LWS_VISIBLE LWS_EXTERN void
    3213 lws_libuv_run(const struct lws_context *context, int tsi);
    3214 
    3215 LWS_VISIBLE LWS_EXTERN void
    3216 lws_libuv_stop(struct lws_context *context);
    3217 
    3218 LWS_VISIBLE LWS_EXTERN void
    3219 lws_libuv_stop_without_kill(const struct lws_context *context, int tsi);
    3220 
    3221 LWS_VISIBLE LWS_EXTERN int
    3222 lws_uv_initloop(struct lws_context *context, uv_loop_t *loop, int tsi);
    3223 
    3224 LWS_VISIBLE LWS_EXTERN uv_loop_t *
    3225 lws_uv_getloop(struct lws_context *context, int tsi);
    3226 
    3227 LWS_VISIBLE LWS_EXTERN void
    3228 lws_uv_sigint_cb(uv_signal_t *watcher, int signum);
    3229 #endif /* LWS_USE_LIBUV */
    3230 
    3237 
    3238 /*
    3239  * NOTE: These public enums are part of the abi. If you want to add one,
    3240  * add it at where specified so existing users are unaffected.
    3241  */
    3242 enum pending_timeout {
    3243  NO_PENDING_TIMEOUT = 0,
    3244  PENDING_TIMEOUT_AWAITING_PROXY_RESPONSE = 1,
    3245  PENDING_TIMEOUT_AWAITING_CONNECT_RESPONSE = 2,
    3246  PENDING_TIMEOUT_ESTABLISH_WITH_SERVER = 3,
    3247  PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE = 4,
    3248  PENDING_TIMEOUT_AWAITING_PING = 5,
    3249  PENDING_TIMEOUT_CLOSE_ACK = 6,
    3250  PENDING_TIMEOUT_AWAITING_EXTENSION_CONNECT_RESPONSE = 7,
    3251  PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE = 8,
    3252  PENDING_TIMEOUT_SSL_ACCEPT = 9,
    3253  PENDING_TIMEOUT_HTTP_CONTENT = 10,
    3254  PENDING_TIMEOUT_AWAITING_CLIENT_HS_SEND = 11,
    3255  PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE = 12,
    3256  PENDING_TIMEOUT_SHUTDOWN_FLUSH = 13,
    3257  PENDING_TIMEOUT_CGI = 14,
    3258  PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE = 15,
    3259  PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING = 16,
    3260  PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG = 17,
    3261  PENDING_TIMEOUT_CLIENT_ISSUE_PAYLOAD = 18,
    3262 
    3263  /****** add new things just above ---^ ******/
    3264 };
    3265 
    3275 LWS_VISIBLE LWS_EXTERN void
    3276 lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs);
    3278 
    3284 #if !defined(LWS_SIZEOFPTR)
    3285 #define LWS_SIZEOFPTR (sizeof (void *))
    3286 #endif
    3287 #if !defined(u_int64_t)
    3288 #define u_int64_t unsigned long long
    3289 #endif
    3290 
    3291 #if defined(__x86_64__)
    3292 #define _LWS_PAD_SIZE 16 /* Intel recommended for best performance */
    3293 #else
    3294 #define _LWS_PAD_SIZE LWS_SIZEOFPTR /* Size of a pointer on the target arch */
    3295 #endif
    3296 #define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ? \
    3297  ((n) + (_LWS_PAD_SIZE - ((n) % _LWS_PAD_SIZE))) : (n))
    3298 #define LWS_PRE _LWS_PAD(4 + 10)
    3299 /* used prior to 1.7 and retained for backward compatibility */
    3300 #define LWS_SEND_BUFFER_PRE_PADDING LWS_PRE
    3301 #define LWS_SEND_BUFFER_POST_PADDING 0
    3302 
    3303 /*
    3304  * NOTE: These public enums are part of the abi. If you want to add one,
    3305  * add it at where specified so existing users are unaffected.
    3306  */
    3321  /* LWS_WRITE_CLOSE is handled by lws_close_reason() */
    3322  LWS_WRITE_PING = 5,
    3323  LWS_WRITE_PONG = 6,
    3324 
    3325  /* Same as write_http but we know this write ends the transaction */
    3326  LWS_WRITE_HTTP_FINAL = 7,
    3327 
    3328  /* HTTP2 */
    3329 
    3337  /****** add new things just above ---^ ******/
    3338 
    3339  /* flags */
    3340 
    3348 };
    3349 
    3350 
    3437 LWS_VISIBLE LWS_EXTERN int
    3438 lws_write(struct lws *wsi, unsigned char *buf, size_t len,
    3439  enum lws_write_protocol protocol);
    3440 
    3441 /* helper for case where buffer may be const */
    3442 #define lws_write_http(wsi, buf, len) \
    3443  lws_write(wsi, (unsigned char *)(buf), len, LWS_WRITE_HTTP)
    3444 
    3464 
    3477 LWS_VISIBLE LWS_EXTERN int
    3478 lws_callback_on_writable(struct lws *wsi);
    3479 
    3493 LWS_VISIBLE LWS_EXTERN int
    3494 lws_callback_on_writable_all_protocol(const struct lws_context *context,
    3495  const struct lws_protocols *protocol);
    3496 
    3510 LWS_VISIBLE LWS_EXTERN int
    3511 lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,
    3512  const struct lws_protocols *protocol);
    3513 
    3526 LWS_VISIBLE LWS_EXTERN int
    3527 lws_callback_all_protocol(struct lws_context *context,
    3528  const struct lws_protocols *protocol, int reason);
    3529 
    3542 LWS_VISIBLE LWS_EXTERN int
    3543 lws_callback_all_protocol_vhost(struct lws_vhost *vh,
    3544  const struct lws_protocols *protocol, int reason);
    3545 
    3559 LWS_VISIBLE LWS_EXTERN int
    3560 lws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len);
    3561 
    3562 LWS_VISIBLE LWS_EXTERN int
    3563 lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
    3564  void *user, void *in, size_t len);
    3565 
    3573 LWS_VISIBLE LWS_EXTERN int
    3574 lws_get_socket_fd(struct lws *wsi);
    3575 
    3597 LWS_VISIBLE LWS_EXTERN size_t
    3598 lws_get_peer_write_allowance(struct lws *wsi);
    3600 
    3611 LWS_VISIBLE LWS_EXTERN int
    3612 lws_rx_flow_control(struct lws *wsi, int enable);
    3613 
    3623 LWS_VISIBLE LWS_EXTERN void
    3624 lws_rx_flow_allow_all_protocol(const struct lws_context *context,
    3625  const struct lws_protocols *protocol);
    3626 
    3643 LWS_VISIBLE LWS_EXTERN size_t
    3644 lws_remaining_packet_payload(struct lws *wsi);
    3645 
    3646 
    3655 
    3669 LWS_VISIBLE LWS_EXTERN struct lws *
    3670 lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd);
    3683 LWS_VISIBLE LWS_EXTERN struct lws *
    3684 lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd);
    3708 LWS_VISIBLE LWS_EXTERN struct lws *
    3709 lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
    3710  const char *readbuf, size_t len);
    3734 LWS_VISIBLE LWS_EXTERN struct lws *
    3735 lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost, lws_sockfd_type accept_fd,
    3736  const char *readbuf, size_t len);
    3738 
    3744 
    3755 LWS_VISIBLE LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
    3756 lws_canonical_hostname(struct lws_context *context);
    3757 
    3772 LWS_VISIBLE LWS_EXTERN void
    3773 lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
    3774  int name_len, char *rip, int rip_len);
    3775 
    3786 LWS_VISIBLE LWS_EXTERN const char *
    3787 lws_get_peer_simple(struct lws *wsi, char *name, int namelen);
    3788 #ifndef LWS_WITH_ESP8266
    3789 
    3800 LWS_VISIBLE LWS_EXTERN int
    3801 lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
    3802  size_t addrlen);
    3804 #endif
    3805 
    3811 
    3824 LWS_VISIBLE LWS_EXTERN int
    3825 lws_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
    3826 
    3838 LWS_VISIBLE LWS_EXTERN int
    3839 lws_get_random(struct lws_context *context, void *buf, int len);
    3847 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3848 lws_daemonize(const char *_lock_path);
    3854 LWS_VISIBLE LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
    3856 
    3863 LWS_VISIBLE LWS_EXTERN void *
    3864 lws_wsi_user(struct lws *wsi);
    3865 
    3877 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3878 lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
    3879  const char **path);
    3880 
    3884 LWS_VISIBLE LWS_EXTERN unsigned long
    3885 lws_now_secs(void);
    3886 
    3896 LWS_VISIBLE LWS_EXTERN struct lws_context * LWS_WARN_UNUSED_RESULT
    3897 lws_get_context(const struct lws *wsi);
    3898 
    3908 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3909 lws_get_count_threads(struct lws_context *context);
    3910 
    3918 LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
    3919 lws_get_parent(const struct lws *wsi);
    3920 
    3927 LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
    3928 lws_get_child(const struct lws *wsi);
    3929 
    3930 
    3931 /*
    3932  * \deprecated DEPRECATED Note: this is not normally needed as a user api.
    3933  * It's provided in case it is
    3934  * useful when integrating with other app poll loop service code.
    3935  */
    3936 LWS_VISIBLE LWS_EXTERN int
    3937 lws_read(struct lws *wsi, unsigned char *buf, size_t len);
    3938 
    3946 LWS_VISIBLE LWS_EXTERN void
    3947 lws_set_allocator(void *(*realloc)(void *ptr, size_t size));
    3949 
    3955 
    3962 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3963 lws_send_pipe_choked(struct lws *wsi);
    3964 
    3969 LWS_VISIBLE LWS_EXTERN int
    3970 lws_is_final_fragment(struct lws *wsi);
    3971 
    3976 LWS_VISIBLE LWS_EXTERN unsigned char
    3977 lws_get_reserved_bits(struct lws *wsi);
    3978 
    3995 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    3996 lws_partial_buffered(struct lws *wsi);
    3997 
    4007 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
    4008 lws_frame_is_binary(struct lws *wsi);
    4009 
    4018 LWS_VISIBLE LWS_EXTERN int
    4019 lws_is_ssl(struct lws *wsi);
    4024 LWS_VISIBLE LWS_EXTERN int
    4025 lws_is_cgi(struct lws *wsi);
    4026 
    4027 #ifdef LWS_OPENSSL_SUPPORT
    4028 
    4034 LWS_VISIBLE LWS_EXTERN SSL*
    4035 lws_get_ssl(struct lws *wsi);
    4036 #endif
    4037 
    4039 
    4045 #ifdef LWS_SHA1_USE_OPENSSL_NAME
    4047 #define lws_SHA1 SHA1
    4048 #else
    4049 
    4058 LWS_VISIBLE LWS_EXTERN unsigned char *
    4059 lws_SHA1(const unsigned char *d, size_t n, unsigned char *md);
    4060 #endif
    4061 
    4071 LWS_VISIBLE LWS_EXTERN int
    4072 lws_b64_encode_string(const char *in, int in_len, char *out, int out_size);
    4082 LWS_VISIBLE LWS_EXTERN int
    4083 lws_b64_decode_string(const char *in, char *out, int out_size);
    4085 
    4086 
    4096 #ifdef LWS_WITH_CGI
    4097 enum lws_enum_stdinouterr {
    4098  LWS_STDIN = 0,
    4099  LWS_STDOUT = 1,
    4100  LWS_STDERR = 2,
    4101 };
    4102 
    4103 enum lws_cgi_hdr_state {
    4104  LCHS_HEADER,
    4105  LCHS_CR1,
    4106  LCHS_LF1,
    4107  LCHS_CR2,
    4108  LCHS_LF2,
    4109  LHCS_PAYLOAD,
    4110  LCHS_SINGLE_0A,
    4111 };
    4112 
    4114  struct lws **stdwsi;
    4115  enum lws_enum_stdinouterr ch;
    4116  unsigned char *data;
    4117  enum lws_cgi_hdr_state hdr_state;
    4118  int len;
    4119 };
    4120 
    4121 
    4131 LWS_VISIBLE LWS_EXTERN int
    4132 lws_cgi(struct lws *wsi, const char * const *exec_array,
    4133  int script_uri_path_len, int timeout_secs,
    4134  const struct lws_protocol_vhost_options *mp_cgienv);
    4135 
    4141 LWS_VISIBLE LWS_EXTERN int
    4142 lws_cgi_write_split_stdout_headers(struct lws *wsi);
    4143 
    4149 LWS_VISIBLE LWS_EXTERN int
    4150 lws_cgi_kill(struct lws *wsi);
    4151 #endif
    4152 
    4154 
    4171 
    4178  lws_filefd_type (*open)(struct lws *wsi, const char *filename,
    4179  unsigned long *filelen, int flags);
    4183  int (*close)(struct lws *wsi, lws_filefd_type fd);
    4185  unsigned long (*seek_cur)(struct lws *wsi, lws_filefd_type fd,
    4186  long offset_from_cur_pos);
    4188  int (*read)(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
    4189  unsigned char *buf, unsigned long len);
    4191  int (*write)(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
    4192  unsigned char *buf, unsigned long len);
    4195  /* Add new things just above here ---^
    4196  * This is part of the ABI, don't needlessly break compatibility */
    4197 };
    4198 
    4204 LWS_VISIBLE LWS_EXTERN struct lws_plat_file_ops * LWS_WARN_UNUSED_RESULT
    4205 lws_get_fops(struct lws_context *context);
    4206 
    4215 static LWS_INLINE lws_filefd_type LWS_WARN_UNUSED_RESULT
    4216 lws_plat_file_open(struct lws *wsi, const char *filename,
    4217  unsigned long *filelen, int flags)
    4218 {
    4219  return lws_get_fops(lws_get_context(wsi))->open(wsi, filename,
    4220  filelen, flags);
    4221 }
    4222 
    4229 static LWS_INLINE int
    4230 lws_plat_file_close(struct lws *wsi, lws_filefd_type fd)
    4231 {
    4232  return lws_get_fops(lws_get_context(wsi))->close(wsi, fd);
    4233 }
    4234 
    4242 static LWS_INLINE unsigned long
    4243 lws_plat_file_seek_cur(struct lws *wsi, lws_filefd_type fd, long offset)
    4244 {
    4245  return lws_get_fops(lws_get_context(wsi))->seek_cur(wsi, fd, offset);
    4246 }
    4256 static LWS_INLINE int LWS_WARN_UNUSED_RESULT
    4257 lws_plat_file_read(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
    4258  unsigned char *buf, unsigned long len)
    4259 {
    4260  return lws_get_fops(lws_get_context(wsi))->read(wsi, fd, amount, buf,
    4261  len);
    4262 }
    4272 static LWS_INLINE int LWS_WARN_UNUSED_RESULT
    4273 lws_plat_file_write(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
    4274  unsigned char *buf, unsigned long len)
    4275 {
    4276  return lws_get_fops(lws_get_context(wsi))->write(wsi, fd, amount, buf,
    4277  len);
    4278 }
    4280 
    4312 #ifdef LWS_WITH_SMTP
    4313 
    4325 };
    4326 
    4328 struct lws_email {
    4329  void *data;
    4331  uv_loop_t *loop;
    4334  char email_smtp_ip[32];
    4335  char email_helo[32];
    4336  char email_from[100];
    4337  char email_to[100];
    4339  unsigned int max_content_size;
    4342  /* Fill all the callbacks before init */
    4343 
    4344  int (*on_next)(struct lws_email *email);
    4349  int (*on_sent)(struct lws_email *email);
    4354  int (*on_get_body)(struct lws_email *email, char *buf, int len);
    4360  /* private things */
    4361  uv_timer_t timeout_email;
    4363  uv_connect_t email_connect_req;
    4364  uv_tcp_t email_client;
    4366  char email_buf[256];
    4367  char *content;
    4368 };
    4369 
    4379 LWS_VISIBLE LWS_EXTERN int
    4380 lws_email_init(struct lws_email *email, uv_loop_t *loop, int max_content);
    4381 
    4390 LWS_VISIBLE LWS_EXTERN void
    4391 lws_email_check(struct lws_email *email);
    4399 LWS_VISIBLE LWS_EXTERN void
    4400 lws_email_destroy(struct lws_email *email);
    4401 
    4402 #endif
    4403 
    4404 
    4405 #ifdef __cplusplus
    4406 }
    4407 #endif
    4408 
    4409 #endif
    LWS_VISIBLE LWS_EXTERN int lws_spa_destroy(struct lws_spa *spa)
    LWS_VISIBLE LWS_EXTERN const char * lws_json_purify(char *escaped, const char *string, int len)
    -
    Definition: libwebsockets.h:4081
    -
    size_t rx_buffer_size
    Definition: libwebsockets.h:1332
    +
    Definition: libwebsockets.h:4113
    +
    size_t rx_buffer_size
    Definition: libwebsockets.h:1344
    LWS_VISIBLE LWS_EXTERN struct lws_spa * lws_spa_create(struct lws *wsi, const char *const *param_names, int count_params, int max_storage, lws_spa_fileupload_cb opt_cb, void *opt_data)
    LWS_VISIBLE LWS_EXTERN struct lws_vhost * lws_vhost_get(struct lws *wsi) LWS_WARN_DEPRECATED
    -
    Definition: libwebsockets.h:778
    -
    Definition: libwebsockets.h:906
    +
    Definition: libwebsockets.h:790
    +
    Definition: libwebsockets.h:918
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_daemonize(const char *_lock_path)
    -
    Definition: libwebsockets.h:2011
    -
    Definition: libwebsockets.h:3286
    -
    Definition: libwebsockets.h:4286
    +
    Definition: libwebsockets.h:2023
    +
    Definition: libwebsockets.h:3318
    +
    Definition: libwebsockets.h:4318
    LWS_VISIBLE LWS_EXTERN struct lws * lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd, const char *readbuf, size_t len)
    Definition: libwebsockets.h:241
    -
    unsigned int auth_mask
    Definition: libwebsockets.h:2046
    -
    Definition: libwebsockets.h:3309
    -
    void * data
    Definition: libwebsockets.h:4297
    -
    const char * uri_replace_from
    Definition: libwebsockets.h:2124
    -
    int(* write)(struct lws *wsi, lws_filefd_type fd, unsigned long *amount, unsigned char *buf, unsigned long len)
    Definition: libwebsockets.h:4159
    -
    lws_callback_reasons
    Definition: libwebsockets.h:671
    +
    unsigned int auth_mask
    Definition: libwebsockets.h:2058
    +
    Definition: libwebsockets.h:3341
    +
    void * data
    Definition: libwebsockets.h:4329
    +
    const char * uri_replace_from
    Definition: libwebsockets.h:2136
    +
    int(* write)(struct lws *wsi, lws_filefd_type fd, unsigned long *amount, unsigned char *buf, unsigned long len)
    Definition: libwebsockets.h:4191
    +
    lws_callback_reasons
    Definition: libwebsockets.h:683
    LWS_VISIBLE LWS_EXTERN int lws_hdr_copy_fragment(struct lws *wsi, char *dest, int len, enum lws_token_indexes h, int frag_idx)
    - -
    lwsgs_auth_bits
    Definition: libwebsockets.h:1477
    + +
    lwsgs_auth_bits
    Definition: libwebsockets.h:1489
    LWS_VISIBLE LWS_EXTERN void lws_close_reason(struct lws *wsi, enum lws_close_status status, unsigned char *buf, size_t len)
    LWS_VISIBLE LWS_EXTERN void lws_email_destroy(struct lws_email *email)
    LWS_VISIBLE LWS_EXTERN int lws_urldecode(char *string, const char *escaped, int len)
    -
    Definition: libwebsockets.h:904
    -
    Definition: libwebsockets.h:1136
    -
    unsigned int id
    Definition: libwebsockets.h:1341
    +
    Definition: libwebsockets.h:916
    +
    Definition: libwebsockets.h:1148
    +
    unsigned int id
    Definition: libwebsockets.h:1353
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h)
    -
    Definition: libwebsockets.h:1134
    -
    Definition: libwebsockets.h:809
    +
    Definition: libwebsockets.h:1146
    +
    Definition: libwebsockets.h:821
    LWS_VISIBLE LWS_EXTERN int lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int tsi)
    LWS_VISIBLE LWS_EXTERN int lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi)
    LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT lws_get_parent(const struct lws *wsi)
    LWS_VISIBLE LWS_EXTERN size_t lws_get_peer_write_allowance(struct lws *wsi)
    LWS_VISIBLE LWS_EXTERN struct lws * lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd)
    -
    Definition: libwebsockets.h:755
    +
    Definition: libwebsockets.h:767
    LWS_VISIBLE LWS_EXTERN const char *LWS_WARN_UNUSED_RESULT lws_get_library_version(void)
    -
    int(* on_sent)(struct lws_email *email)
    Definition: libwebsockets.h:4317
    -
    Definition: libwebsockets.h:1472
    -
    struct lws ** pwsi
    Definition: libwebsockets.h:2131
    -
    Definition: libwebsockets.h:789
    -
    const char * path
    Definition: libwebsockets.h:2103
    +
    int(* on_sent)(struct lws_email *email)
    Definition: libwebsockets.h:4349
    +
    Definition: libwebsockets.h:1484
    +
    struct lws ** pwsi
    Definition: libwebsockets.h:2143
    +
    Definition: libwebsockets.h:801
    +
    const char * path
    Definition: libwebsockets.h:2115
    LWS_VISIBLE LWS_EXTERN size_t lws_remaining_packet_payload(struct lws *wsi)
    -
    Definition: libwebsockets.h:590
    -
    Definition: libwebsockets.h:1428
    +
    Definition: libwebsockets.h:602
    +
    Definition: libwebsockets.h:1440
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi, void *ext_user, const struct lws_ext_options *opts, const char *o, int len)
    -
    time_t email_connect_started
    Definition: libwebsockets.h:4333
    -
    lws_close_status
    Definition: libwebsockets.h:561
    +
    time_t email_connect_started
    Definition: libwebsockets.h:4365
    +
    lws_close_status
    Definition: libwebsockets.h:573
    LWS_VISIBLE LWS_EXTERN int lws_callback_all_protocol(struct lws_context *context, const struct lws_protocols *protocol, int reason)
    -
    Definition: libwebsockets.h:601
    - -
    int token_len
    Definition: libwebsockets.h:2611
    -
    const struct lws_http_mount * mounts
    Definition: libwebsockets.h:1720
    -
    Definition: libwebsockets.h:930
    +
    Definition: libwebsockets.h:613
    + +
    int token_len
    Definition: libwebsockets.h:2643
    +
    const struct lws_http_mount * mounts
    Definition: libwebsockets.h:1732
    +
    Definition: libwebsockets.h:942
    LWS_VISIBLE LWS_EXTERN struct lws_context *LWS_WARN_UNUSED_RESULT lws_get_context(const struct lws *wsi)
    -
    const char * value
    Definition: libwebsockets.h:2000
    -
    Definition: libwebsockets.h:2931
    -
    Definition: libwebsockets.h:4291
    -
    const char * username
    Definition: libwebsockets.h:1503
    +
    const char * value
    Definition: libwebsockets.h:2012
    +
    Definition: libwebsockets.h:2963
    +
    Definition: libwebsockets.h:4323
    +
    const char * username
    Definition: libwebsockets.h:1515
    LWS_VISIBLE LWS_EXTERN struct lws * lws_client_connect_via_info(struct lws_client_connect_info *ccinfo)
    -
    const char * protocol
    Definition: libwebsockets.h:2030
    -
    struct lws ** stdwsi
    Definition: libwebsockets.h:4082
    +
    const char * protocol
    Definition: libwebsockets.h:2042
    +
    struct lws ** stdwsi
    Definition: libwebsockets.h:4114
    LWS_VISIBLE LWS_EXTERN int lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)
    -
    Definition: libwebsockets.h:876
    +
    Definition: libwebsockets.h:888
    LWS_VISIBLE LWS_EXTERN const char * lws_get_mimetype(const char *file, const struct lws_http_mount *m)
    -
    Definition: libwebsockets.h:1474
    -
    int cache_max_age
    Definition: libwebsockets.h:2044
    -
    long ssl_options_clear
    Definition: libwebsockets.h:1738
    -
    Definition: libwebsockets.h:769
    -
    Definition: libwebsockets.h:1606
    +
    Definition: libwebsockets.h:1486
    +
    int cache_max_age
    Definition: libwebsockets.h:2056
    +
    long ssl_options_clear
    Definition: libwebsockets.h:1750
    +
    Definition: libwebsockets.h:781
    +
    Definition: libwebsockets.h:1618
    LWS_VISIBLE LWS_EXTERN void lws_context_destroy(struct lws_context *context)
    -
    Definition: libwebsockets.h:617
    -
    char * start
    Definition: libwebsockets.h:2550
    +
    Definition: libwebsockets.h:629
    +
    char * start
    Definition: libwebsockets.h:2582
    LWS_VISIBLE LWS_EXTERN int lws_snprintf(char *str, size_t size, const char *format,...) LWS_FORMAT(3)
    LWS_VISIBLE LWS_EXTERN void lws_set_allocator(void *(*realloc)(void *ptr, size_t size))
    -
    lws_callback_function * callback
    Definition: libwebsockets.h:1323
    -
    Definition: libwebsockets.h:3276
    +
    lws_callback_function * callback
    Definition: libwebsockets.h:1335
    +
    Definition: libwebsockets.h:3308
    LWS_VISIBLE LWS_EXTERN void lws_context_deprecate(struct lws_context *context, lws_reload_func cb)
    LWS_VISIBLE LWS_EXTERN int lws_get_socket_fd(struct lws *wsi)
    -
    Definition: libwebsockets.h:967
    - -
    const char * protocol
    Definition: libwebsockets.h:2109
    -
    Definition: libwebsockets.h:956
    -
    unsigned int pt_serv_buf_size
    Definition: libwebsockets.h:1725
    +
    Definition: libwebsockets.h:979
    + +
    const char * protocol
    Definition: libwebsockets.h:2121
    +
    Definition: libwebsockets.h:968
    +
    unsigned int pt_serv_buf_size
    Definition: libwebsockets.h:1737
    LWS_VISIBLE LWS_EXTERN struct lws * lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd)
    -
    int len
    Definition: libwebsockets.h:2542
    -
    int ka_time
    Definition: libwebsockets.h:1661
    -
    Definition: libwebsockets.h:1548
    +
    int len
    Definition: libwebsockets.h:2574
    +
    int ka_time
    Definition: libwebsockets.h:1673
    +
    Definition: libwebsockets.h:1560
    LWS_VISIBLE LWS_EXTERN int lws_callback_on_writable_all_protocol(const struct lws_context *context, const struct lws_protocols *protocol)
    LWS_VISIBLE LWS_EXTERN void lws_set_log_level(int level, void(*log_emit_function)(int level, const char *line))
    -
    unsigned short ws_ping_pong_interval
    Definition: libwebsockets.h:1740
    -
    int count_extensions
    Definition: libwebsockets.h:1433
    -
    Definition: libwebsockets.h:3280
    -
    int port
    Definition: libwebsockets.h:2099
    -
    struct lws_context * context
    Definition: libwebsockets.h:2095
    -
    Definition: libwebsockets.h:1480
    -
    int ietf_version_or_minus_one
    Definition: libwebsockets.h:2111
    +
    unsigned short ws_ping_pong_interval
    Definition: libwebsockets.h:1752
    +
    int count_extensions
    Definition: libwebsockets.h:1445
    +
    Definition: libwebsockets.h:3312
    +
    int port
    Definition: libwebsockets.h:2111
    +
    struct lws_context * context
    Definition: libwebsockets.h:2107
    +
    Definition: libwebsockets.h:1492
    +
    int ietf_version_or_minus_one
    Definition: libwebsockets.h:2123
    LWS_VISIBLE LWS_EXTERN int lws_callback_all_protocol_vhost(struct lws_vhost *vh, const struct lws_protocols *protocol, int reason)
    -
    Definition: libwebsockets.h:4284
    -
    Definition: libwebsockets.h:1996
    +
    Definition: libwebsockets.h:4316
    +
    Definition: libwebsockets.h:2008
    LWS_VISIBLE LWS_EXTERN int lws_callback_on_writable(struct lws *wsi)
    -
    const char *const * vars
    Definition: libwebsockets.h:2554
    +
    const char *const * vars
    Definition: libwebsockets.h:2586
    LWS_VISIBLE LWS_EXTERN SSL * lws_get_ssl(struct lws *wsi)
    -
    Definition: libwebsockets.h:569
    -
    Definition: libwebsockets.h:2094
    -
    Definition: libwebsockets.h:1578
    -
    int lws_extension_callback_function(struct lws_context *context, const struct lws_extension *ext, struct lws *wsi, enum lws_extension_callback_reasons reason, void *user, void *in, size_t len)
    Definition: libwebsockets.h:1223
    - -
    int len
    Definition: libwebsockets.h:1159
    -
    Definition: libwebsockets.h:2021
    -
    const char * def
    Definition: libwebsockets.h:2028
    -
    Definition: libwebsockets.h:730
    -
    Definition: libwebsockets.h:1560
    -
    lws_context_options
    Definition: libwebsockets.h:1531
    -
    Definition: libwebsockets.h:908
    -
    Definition: libwebsockets.h:1497
    -
    Definition: libwebsockets.h:1566
    -
    Definition: libwebsockets.h:896
    -
    const char * option_name
    Definition: libwebsockets.h:1156
    -
    Definition: libwebsockets.h:2009
    -
    lws_sockfd_type fd
    Definition: libwebsockets.h:539
    +
    Definition: libwebsockets.h:581
    +
    Definition: libwebsockets.h:2106
    +
    Definition: libwebsockets.h:1590
    +
    int lws_extension_callback_function(struct lws_context *context, const struct lws_extension *ext, struct lws *wsi, enum lws_extension_callback_reasons reason, void *user, void *in, size_t len)
    Definition: libwebsockets.h:1235
    + +
    int len
    Definition: libwebsockets.h:1171
    +
    Definition: libwebsockets.h:2033
    +
    const char * def
    Definition: libwebsockets.h:2040
    +
    Definition: libwebsockets.h:742
    +
    Definition: libwebsockets.h:1572
    +
    lws_context_options
    Definition: libwebsockets.h:1543
    +
    Definition: libwebsockets.h:920
    +
    Definition: libwebsockets.h:1509
    +
    Definition: libwebsockets.h:1578
    +
    Definition: libwebsockets.h:908
    +
    const char * option_name
    Definition: libwebsockets.h:1168
    +
    Definition: libwebsockets.h:2021
    +
    lws_sockfd_type fd
    Definition: libwebsockets.h:551
    LWS_VISIBLE LWS_EXTERN int lws_json_dump_context(const struct lws_context *context, char *buf, int len, int hide_vhosts)
    -
    const char * ssl_private_key_password
    Definition: libwebsockets.h:1629
    -
    short events
    Definition: libwebsockets.h:441
    -
    Definition: libwebsockets.h:1441
    -
    const struct lws_extension * extensions
    Definition: libwebsockets.h:1432
    -
    const struct lws_http_mount * mount_next
    Definition: libwebsockets.h:2022
    +
    const char * ssl_private_key_password
    Definition: libwebsockets.h:1641
    +
    short events
    Definition: libwebsockets.h:453
    +
    Definition: libwebsockets.h:1453
    +
    const struct lws_extension * extensions
    Definition: libwebsockets.h:1444
    +
    const struct lws_http_mount * mount_next
    Definition: libwebsockets.h:2034
    LWS_VISIBLE LWS_EXTERN void lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs)
    -
    void * userdata
    Definition: libwebsockets.h:2113
    -
    Definition: libwebsockets.h:727
    -
    Definition: libwebsockets.h:914
    +
    void * userdata
    Definition: libwebsockets.h:2125
    +
    Definition: libwebsockets.h:739
    +
    Definition: libwebsockets.h:926
    LWS_VISIBLE LWS_EXTERN int lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
    -
    unsigned char * data
    Definition: libwebsockets.h:4084
    -
    const struct lws_protocol_vhost_options * extra_mimetypes
    Definition: libwebsockets.h:2037
    +
    unsigned char * data
    Definition: libwebsockets.h:4116
    +
    const struct lws_protocol_vhost_options * extra_mimetypes
    Definition: libwebsockets.h:2049
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_finalize_http_header(struct lws *wsi, unsigned char **p, unsigned char *end)
    -
    Definition: libwebsockets.h:720
    +
    Definition: libwebsockets.h:732
    LWS_VISIBLE LWS_EXTERN const char * lws_urlencode(char *escaped, const char *string, int len)
    -
    Definition: libwebsockets.h:801
    -
    uv_loop_t * loop
    Definition: libwebsockets.h:4299
    -
    Definition: libwebsockets.h:899
    +
    Definition: libwebsockets.h:813
    +
    uv_loop_t * loop
    Definition: libwebsockets.h:4331
    +
    Definition: libwebsockets.h:911
    Definition: libwebsockets.h:72
    -
    Definition: libwebsockets.h:3312
    -
    int pos
    Definition: libwebsockets.h:2552
    -
    struct lws_plugin * list
    Definition: libwebsockets.h:1442
    +
    Definition: libwebsockets.h:3344
    +
    int pos
    Definition: libwebsockets.h:2584
    +
    struct lws_plugin * list
    Definition: libwebsockets.h:1454
    LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT lws_client_connect_extended(struct lws_context *clients, const char *address, int port, int ssl_connection, const char *path, const char *host, const char *origin, const char *protocol, int ietf_version_or_minus_one, void *userdata) LWS_WARN_DEPRECATED
    -
    short max_http_header_data
    Definition: libwebsockets.h:1681
    +
    short max_http_header_data
    Definition: libwebsockets.h:1693
    LWS_VISIBLE LWS_EXTERN int lws_spa_process(struct lws_spa *spa, const char *in, int len)
    -
    void * provided_client_ssl_ctx
    Definition: libwebsockets.h:1678
    +
    void * provided_client_ssl_ctx
    Definition: libwebsockets.h:1690
    LWS_VISIBLE LWS_EXTERN struct lws_vhost * lws_get_vhost(struct lws *wsi)
    Definition: libwebsockets.h:44
    LWS_VISIBLE LWS_EXTERN void lwsl_emit_syslog(int level, const char *line)
    -
    const struct lws_protocols * protocols
    Definition: libwebsockets.h:1430
    -
    Definition: libwebsockets.h:1135
    -
    int ka_probes
    Definition: libwebsockets.h:1664
    +
    const struct lws_protocols * protocols
    Definition: libwebsockets.h:1442
    +
    Definition: libwebsockets.h:1147
    +
    int ka_probes
    Definition: libwebsockets.h:1676
    void onError(Socket *s, socket_error_t err)
    -
    const char * origin
    Definition: libwebsockets.h:2107
    -
    SHORT revents
    Definition: libwebsockets.h:427
    -
    const char * method
    Definition: libwebsockets.h:2117
    +
    const char * origin
    Definition: libwebsockets.h:2119
    +
    SHORT revents
    Definition: libwebsockets.h:439
    +
    const char * method
    Definition: libwebsockets.h:2129
    LWS_VISIBLE LWS_EXTERN const char * lws_spa_get_string(struct lws_spa *spa, int n)
    -
    Definition: libwebsockets.h:1229
    +
    Definition: libwebsockets.h:1241
    LWS_VISIBLE LWS_EXTERN int lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost, const struct lws_protocols *protocol)
    -
    Definition: libwebsockets.h:936
    -
    unsigned char origin_protocol
    Definition: libwebsockets.h:2053
    -
    const char * log_filepath
    Definition: libwebsockets.h:1717
    -
    Definition: libwebsockets.h:776
    -
    unsigned int max_content_size
    Definition: libwebsockets.h:4307
    -
    int option_index
    Definition: libwebsockets.h:1157
    +
    Definition: libwebsockets.h:948
    +
    unsigned char origin_protocol
    Definition: libwebsockets.h:2065
    +
    const char * log_filepath
    Definition: libwebsockets.h:1729
    +
    Definition: libwebsockets.h:788
    +
    unsigned int max_content_size
    Definition: libwebsockets.h:4339
    +
    int option_index
    Definition: libwebsockets.h:1169
    LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT lws_get_child(const struct lws *wsi)
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token, const unsigned char *value, int length, unsigned char **p, unsigned char *end)
    -
    Definition: libwebsockets.h:772
    -
    const char * uri_replace_to
    Definition: libwebsockets.h:2127
    -
    struct lws * parent_wsi
    Definition: libwebsockets.h:2120
    +
    Definition: libwebsockets.h:784
    +
    const char * uri_replace_to
    Definition: libwebsockets.h:2139
    +
    struct lws * parent_wsi
    Definition: libwebsockets.h:2132
    LWS_VISIBLE LWS_EXTERN int lws_b64_decode_string(const char *in, char *out, int out_size)
    -
    enum lwsgs_smtp_states estate
    Definition: libwebsockets.h:4330
    +
    enum lwsgs_smtp_states estate
    Definition: libwebsockets.h:4362
    LWS_VISIBLE LWS_EXTERN int lws_spa_finalize(struct lws_spa *spa)
    -
    Definition: libwebsockets.h:672
    +
    Definition: libwebsockets.h:684
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_get_count_threads(struct lws_context *context)
    -
    const char *const * plugin_dirs
    Definition: libwebsockets.h:1708
    -
    char name[64]
    Definition: libwebsockets.h:1448
    +
    const char *const * plugin_dirs
    Definition: libwebsockets.h:1720
    +
    char name[64]
    Definition: libwebsockets.h:1460
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h, int frag_idx)
    LWS_VISIBLE LWS_EXTERN int lws_cgi_kill(struct lws *wsi)
    -
    char email_buf[256]
    Definition: libwebsockets.h:4334
    +
    char email_buf[256]
    Definition: libwebsockets.h:4366
    LWS_VISIBLE LWS_EXTERN int lws_is_ssl(struct lws *wsi)
    -
    Definition: libwebsockets.h:1537
    -
    int(* close)(struct lws *wsi, lws_filefd_type fd)
    Definition: libwebsockets.h:4151
    -
    uv_lib_t lib
    Definition: libwebsockets.h:1444
    +
    Definition: libwebsockets.h:1549
    +
    int(* close)(struct lws *wsi, lws_filefd_type fd)
    Definition: libwebsockets.h:4183
    +
    uv_lib_t lib
    Definition: libwebsockets.h:1456
    x509_crt certificate
    Definition: libwebsockets.h:243
    LWS_VISIBLE LWS_EXTERN void lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name, int name_len, char *rip, int rip_len)
    -
    Definition: libwebsockets.h:4285
    +
    Definition: libwebsockets.h:4317
    LWS_VISIBLE LWS_EXTERN int lws_is_cgi(struct lws *wsi)
    -
    int ssl_connection
    Definition: libwebsockets.h:2101
    -
    Definition: libwebsockets.h:1496
    -
    SSL_CTX * provided_client_ssl_ctx
    Definition: libwebsockets.h:1672
    +
    int ssl_connection
    Definition: libwebsockets.h:2113
    +
    Definition: libwebsockets.h:1508
    +
    SSL_CTX * provided_client_ssl_ctx
    Definition: libwebsockets.h:1684
    LWS_VISIBLE LWS_EXTERN int lws_rx_flow_control(struct lws *wsi, int enable)
    -
    Definition: libwebsockets.h:2540
    +
    Definition: libwebsockets.h:2572
    LWS_VISIBLE LWS_EXTERN struct lws_plat_file_ops *LWS_WARN_UNUSED_RESULT lws_get_fops(struct lws_context *context)
    -
    Definition: libwebsockets.h:538
    -
    const struct lws_protocol_vhost_options * cgienv
    Definition: libwebsockets.h:2033
    -
    const char * name
    Definition: libwebsockets.h:1999
    -
    unsigned char mountpoint_len
    Definition: libwebsockets.h:2054
    -
    Definition: libwebsockets.h:3283
    -
    Definition: libwebsockets.h:1555
    -
    lws_sockfd_type fd
    Definition: libwebsockets.h:425
    -
    Definition: libwebsockets.h:2010
    +
    Definition: libwebsockets.h:550
    +
    const struct lws_protocol_vhost_options * cgienv
    Definition: libwebsockets.h:2045
    +
    const char * name
    Definition: libwebsockets.h:2011
    +
    unsigned char mountpoint_len
    Definition: libwebsockets.h:2066
    +
    Definition: libwebsockets.h:3315
    +
    Definition: libwebsockets.h:1567
    +
    lws_sockfd_type fd
    Definition: libwebsockets.h:437
    +
    Definition: libwebsockets.h:2022
    LWS_VISIBLE LWS_EXTERN int lws_is_final_fragment(struct lws *wsi)
    -
    const struct lws_extension * extensions
    Definition: libwebsockets.h:1623
    -
    Definition: libwebsockets.h:1539
    +
    const struct lws_extension * extensions
    Definition: libwebsockets.h:1635
    +
    Definition: libwebsockets.h:1551
    LWS_VISIBLE LWS_EXTERN void * lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost, const struct lws_protocols *prot, int size)
    -
    Definition: libwebsockets.h:1544
    -
    lws_ext_options_types
    Definition: libwebsockets.h:1133
    -
    const struct lws_protocols * protocols
    Definition: libwebsockets.h:1619
    +
    Definition: libwebsockets.h:1556
    +
    lws_ext_options_types
    Definition: libwebsockets.h:1145
    +
    const struct lws_protocols * protocols
    Definition: libwebsockets.h:1631
    LWS_VISIBLE LWS_EXTERN int lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d, char **config_strings, int *len)
    LWS_VISIBLE LWS_EXTERN void * lws_wsi_user(struct lws *wsi)
    LWS_VISIBLE LWS_EXTERN unsigned long lws_now_secs(void)
    LWS_VISIBLE LWS_EXTERN const char * lws_get_peer_simple(struct lws *wsi, char *name, int namelen)
    -
    const char * start
    Definition: libwebsockets.h:1158
    -
    const char * ssl_cipher_list
    Definition: libwebsockets.h:1643
    +
    const char * start
    Definition: libwebsockets.h:1170
    +
    const char * ssl_cipher_list
    Definition: libwebsockets.h:1655
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name, const unsigned char *value, int length, unsigned char **p, unsigned char *end)
    -
    const char * mountpoint
    Definition: libwebsockets.h:2024
    -
    const char * http_proxy_address
    Definition: libwebsockets.h:1647
    - +
    const char * mountpoint
    Definition: libwebsockets.h:2036
    +
    const char * http_proxy_address
    Definition: libwebsockets.h:1659
    +
    rsa_context key
    Definition: libwebsockets.h:244
    -
    const char * ssl_cert_filepath
    Definition: libwebsockets.h:1631
    -
    const char * ecdh_curve
    Definition: libwebsockets.h:1702
    -
    int cgi_timeout
    Definition: libwebsockets.h:2042
    -
    Definition: libwebsockets.h:2012
    -
    Definition: libwebsockets.h:1481
    -
    Definition: libwebsockets.h:439
    -
    Definition: libwebsockets.h:595
    +
    const char * ssl_cert_filepath
    Definition: libwebsockets.h:1643
    +
    const char * ecdh_curve
    Definition: libwebsockets.h:1714
    +
    int cgi_timeout
    Definition: libwebsockets.h:2054
    +
    Definition: libwebsockets.h:2024
    +
    Definition: libwebsockets.h:1493
    +
    Definition: libwebsockets.h:451
    +
    Definition: libwebsockets.h:607
    LWS_VISIBLE LWS_EXTERN unsigned char lws_get_reserved_bits(struct lws *wsi)
    LWS_VISIBLE LWS_EXTERN unsigned char * lws_SHA1(const unsigned char *d, size_t n, unsigned char *md)
    +
    LWS_VISIBLE LWS_EXTERN int lwsl_visible(int level)
    LWS_VISIBLE LWS_EXTERN const unsigned char * lws_token_to_string(enum lws_token_indexes token)
    LWS_VISIBLE LWS_EXTERN int lws_set_extension_option(struct lws *wsi, const char *ext_name, const char *opt_name, const char *opt_val)
    -
    Definition: libwebsockets.h:740
    +
    Definition: libwebsockets.h:752
    LWS_VISIBLE LWS_EXTERN int lws_cgi(struct lws *wsi, const char *const *exec_array, int script_uri_path_len, int timeout_secs, const struct lws_protocol_vhost_options *mp_cgienv)
    LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT lws_client_connect(struct lws_context *clients, const char *address, int port, int ssl_connection, const char *path, const char *host, const char *origin, const char *protocol, int ietf_version_or_minus_one) LWS_WARN_DEPRECATED
    -
    Definition: libwebsockets.h:774
    +
    Definition: libwebsockets.h:786
    LWS_VISIBLE LWS_EXTERN int lwsws_get_config_vhosts(struct lws_context *context, struct lws_context_creation_info *info, const char *d, char **config_strings, int *len)
    -
    Definition: libwebsockets.h:1564
    +
    Definition: libwebsockets.h:1576
    +
    LWS_VISIBLE LWS_EXTERN int lws_http_client_read(struct lws *wsi, char **buf, int *len)
    LWS_VISIBLE LWS_EXTERN int lwsl_timestamp(int level, char *p, int len)
    -
    Definition: libwebsockets.h:1012
    -
    Definition: libwebsockets.h:1576
    -
    uv_timer_t timeout_email
    Definition: libwebsockets.h:4329
    -
    Definition: libwebsockets.h:1546
    -
    short max_http_header_pool
    Definition: libwebsockets.h:1684
    +
    Definition: libwebsockets.h:1024
    +
    Definition: libwebsockets.h:1588
    +
    uv_timer_t timeout_email
    Definition: libwebsockets.h:4361
    +
    Definition: libwebsockets.h:1558
    +
    short max_http_header_pool
    Definition: libwebsockets.h:1696
    LWS_VISIBLE LWS_EXTERN int lws_chunked_html_process(struct lws_process_html_args *args, struct lws_process_html_state *s)
    -
    char * p
    Definition: libwebsockets.h:2541
    +
    char * p
    Definition: libwebsockets.h:2573
    x509_crt ca
    Definition: libwebsockets.h:242
    -
    size_t per_session_data_size
    Definition: libwebsockets.h:1327
    -
    Definition: libwebsockets.h:579
    -
    const struct lws_protocol_vhost_options * reject_service_keywords
    Definition: libwebsockets.h:1756
    -
    lwsgs_smtp_states
    Definition: libwebsockets.h:4283
    -
    Definition: libwebsockets.h:1558
    -
    Definition: libwebsockets.h:852
    +
    size_t per_session_data_size
    Definition: libwebsockets.h:1339
    +
    Definition: libwebsockets.h:591
    +
    const struct lws_protocol_vhost_options * reject_service_keywords
    Definition: libwebsockets.h:1768
    +
    lwsgs_smtp_states
    Definition: libwebsockets.h:4315
    +
    Definition: libwebsockets.h:1570
    +
    Definition: libwebsockets.h:864
    LWS_VISIBLE LWS_EXTERN struct lws * lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost, lws_sockfd_type accept_fd, const char *readbuf, size_t len)
    -
    Definition: libwebsockets.h:738
    -
    Definition: libwebsockets.h:1319
    -
    Definition: libwebsockets.h:584
    +
    Definition: libwebsockets.h:750
    +
    Definition: libwebsockets.h:1331
    +
    Definition: libwebsockets.h:596
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len, unsigned char **p, unsigned char *end)
    -
    unsigned int count_threads
    Definition: libwebsockets.h:1691
    -
    const char * email
    Definition: libwebsockets.h:1504
    +
    unsigned int count_threads
    Definition: libwebsockets.h:1703
    +
    const char * email
    Definition: libwebsockets.h:1516
    LWS_VISIBLE LWS_EXTERN int lws_get_random(struct lws_context *context, void *buf, int len)
    -
    Definition: libwebsockets.h:566
    -
    uv_connect_t email_connect_req
    Definition: libwebsockets.h:4331
    -
    const char * server_string
    Definition: libwebsockets.h:1722
    -
    Definition: libwebsockets.h:1569
    -
    SHORT events
    Definition: libwebsockets.h:426
    -
    Definition: libwebsockets.h:743
    -
    Definition: libwebsockets.h:1553
    -
    const char * vhost_name
    Definition: libwebsockets.h:1704
    -
    Definition: libwebsockets.h:2013
    +
    Definition: libwebsockets.h:578
    +
    uv_connect_t email_connect_req
    Definition: libwebsockets.h:4363
    +
    const char * server_string
    Definition: libwebsockets.h:1734
    +
    Definition: libwebsockets.h:1581
    +
    SHORT events
    Definition: libwebsockets.h:438
    +
    Definition: libwebsockets.h:755
    +
    Definition: libwebsockets.h:1565
    +
    const char * vhost_name
    Definition: libwebsockets.h:1716
    +
    Definition: libwebsockets.h:2025
    LWS_VISIBLE LWS_EXTERN const struct lws_protocols * lws_get_protocol(struct lws *wsi)
    -
    Definition: libwebsockets.h:1479
    -
    Definition: libwebsockets.h:1501
    -
    unsigned int fd_limit_per_thread
    Definition: libwebsockets.h:1693
    +
    Definition: libwebsockets.h:1491
    +
    Definition: libwebsockets.h:1513
    +
    unsigned int fd_limit_per_thread
    Definition: libwebsockets.h:1705
    LWS_VISIBLE LWS_EXTERN int lws_cgi_write_split_stdout_headers(struct lws *wsi)
    -
    lws_gs_event
    Definition: libwebsockets.h:1495
    +
    lws_gs_event
    Definition: libwebsockets.h:1507
    LWS_VISIBLE LWS_EXTERN int lws_finalize_startup(struct lws_context *context)
    -
    int ka_interval
    Definition: libwebsockets.h:1668
    -
    Definition: libwebsockets.h:1478
    -
    int uid
    Definition: libwebsockets.h:1654
    -
    Definition: libwebsockets.h:2933
    +
    int ka_interval
    Definition: libwebsockets.h:1680
    +
    Definition: libwebsockets.h:1490
    +
    int uid
    Definition: libwebsockets.h:1666
    +
    Definition: libwebsockets.h:2965
    LWS_VISIBLE LWS_EXTERN int lws_b64_encode_string(const char *in, int in_len, char *out, int out_size)
    LWS_VISIBLE LWS_EXTERN void * lws_context_user(struct lws_context *context)
    -
    const char * name
    Definition: libwebsockets.h:1320
    +
    const char * name
    Definition: libwebsockets.h:1332
    LWS_VISIBLE LWS_EXTERN int lws_init_vhost_client_ssl(const struct lws_context_creation_info *info, struct lws_vhost *vhost)
    -
    Definition: libwebsockets.h:4289
    -
    unsigned int http_proxy_port
    Definition: libwebsockets.h:1650
    +
    Definition: libwebsockets.h:4321
    +
    unsigned int http_proxy_port
    Definition: libwebsockets.h:1662
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_partial_buffered(struct lws *wsi)
    -
    unsigned int timeout_secs
    Definition: libwebsockets.h:1697
    -
    int port
    Definition: libwebsockets.h:1607
    +
    unsigned int timeout_secs
    Definition: libwebsockets.h:1709
    +
    int port
    Definition: libwebsockets.h:1619
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_parse_uri(char *p, const char **prot, const char **ads, int *port, const char **path)
    -
    unsigned int options
    Definition: libwebsockets.h:1656
    +
    unsigned int options
    Definition: libwebsockets.h:1668
    LWS_VISIBLE LWS_EXTERN int lws_spa_get_length(struct lws_spa *spa, int n)
    -
    const struct lws_protocol_vhost_options * options
    Definition: libwebsockets.h:1998
    -
    int prev_events
    Definition: libwebsockets.h:541
    -
    int keepalive_timeout
    Definition: libwebsockets.h:1714
    -
    Definition: libwebsockets.h:1485
    -
    Definition: libwebsockets.h:1146
    -
    const struct lws_protocol_vhost_options * headers
    Definition: libwebsockets.h:1752
    -
    Definition: libwebsockets.h:2730
    +
    const struct lws_protocol_vhost_options * options
    Definition: libwebsockets.h:2010
    +
    int prev_events
    Definition: libwebsockets.h:553
    +
    int keepalive_timeout
    Definition: libwebsockets.h:1726
    +
    Definition: libwebsockets.h:1497
    +
    Definition: libwebsockets.h:1158
    +
    const struct lws_protocol_vhost_options * headers
    Definition: libwebsockets.h:1764
    +
    Definition: libwebsockets.h:2762
    LWS_VISIBLE LWS_EXTERN int lws_write(struct lws *wsi, unsigned char *buf, size_t len, enum lws_write_protocol protocol)
    -
    const struct lws_protocol_vhost_options * pvo
    Definition: libwebsockets.h:1711
    -
    const char * basic_auth_login_file
    Definition: libwebsockets.h:2056
    -
    const char * host
    Definition: libwebsockets.h:2105
    -
    Definition: libwebsockets.h:1155
    -
    Definition: libwebsockets.h:605
    +
    const struct lws_protocol_vhost_options * pvo
    Definition: libwebsockets.h:1723
    +
    const char * basic_auth_login_file
    Definition: libwebsockets.h:2068
    +
    const char * host
    Definition: libwebsockets.h:2117
    +
    Definition: libwebsockets.h:1167
    +
    Definition: libwebsockets.h:617
    LWS_VISIBLE LWS_EXTERN const struct lws_protocols * lws_vhost_name_to_protocol(struct lws_vhost *vh, const char *name)
    -
    int len
    Definition: libwebsockets.h:4086
    +
    int len
    Definition: libwebsockets.h:4118
    LWS_VISIBLE LWS_EXTERN const char * lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len)
    -
    const char * iface
    Definition: libwebsockets.h:1612
    -
    Definition: libwebsockets.h:4145
    +
    const char * iface
    Definition: libwebsockets.h:1624
    +
    Definition: libwebsockets.h:4177
    LWS_VISIBLE LWS_EXTERN void lwsl_hexdump(void *buf, size_t len)
    -
    Definition: libwebsockets.h:1017
    -
    lws_spa_fileupload_states
    Definition: libwebsockets.h:2928
    +
    Definition: libwebsockets.h:1029
    +
    lws_spa_fileupload_states
    Definition: libwebsockets.h:2960
    LWS_VISIBLE LWS_EXTERN int lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd)
    LWS_VISIBLE LWS_EXTERN int lws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len)
    - -
    Definition: libwebsockets.h:563
    -
    Definition: libwebsockets.h:572
    + +
    Definition: libwebsockets.h:575
    +
    Definition: libwebsockets.h:584
    LWS_VISIBLE LWS_EXTERN const char * lws_sql_purify(char *escaped, const char *string, int len)
    -
    uv_tcp_t email_client
    Definition: libwebsockets.h:4332
    -
    Definition: libwebsockets.h:424
    -
    Definition: libwebsockets.h:676
    -
    lws_filefd_type(* open)(struct lws *wsi, const char *filename, unsigned long *filelen, int flags)
    Definition: libwebsockets.h:4146
    -
    lws_write_protocol
    Definition: libwebsockets.h:3275
    -
    const char * client_offer
    Definition: libwebsockets.h:1232
    -
    int(* read)(struct lws *wsi, lws_filefd_type fd, unsigned long *amount, unsigned char *buf, unsigned long len)
    Definition: libwebsockets.h:4156
    +
    uv_tcp_t email_client
    Definition: libwebsockets.h:4364
    +
    Definition: libwebsockets.h:436
    +
    Definition: libwebsockets.h:688
    +
    lws_filefd_type(* open)(struct lws *wsi, const char *filename, unsigned long *filelen, int flags)
    Definition: libwebsockets.h:4178
    +
    lws_write_protocol
    Definition: libwebsockets.h:3307
    +
    const char * client_offer
    Definition: libwebsockets.h:1244
    +
    int(* read)(struct lws *wsi, lws_filefd_type fd, unsigned long *amount, unsigned char *buf, unsigned long len)
    Definition: libwebsockets.h:4188
    LWS_VISIBLE LWS_EXTERN void lws_cancel_service(struct lws_context *context)
    -
    Definition: libwebsockets.h:2929
    -
    Definition: libwebsockets.h:577
    -
    const char * origin
    Definition: libwebsockets.h:2026
    -
    const char * name
    Definition: libwebsockets.h:1147
    +
    Definition: libwebsockets.h:2961
    +
    Definition: libwebsockets.h:589
    +
    const char * origin
    Definition: libwebsockets.h:2038
    +
    const char * name
    Definition: libwebsockets.h:1159
    LWS_VISIBLE LWS_EXTERN int lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type, const char *other_headers, int other_headers_len)
    LWS_VISIBLE LWS_EXTERN void lws_email_check(struct lws_email *email)
    LWS_VISIBLE LWS_EXTERN int lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_frame_is_binary(struct lws *wsi)
    LWS_VISIBLE LWS_EXTERN int lws_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h)
    -
    Definition: libwebsockets.h:753
    -
    const char * name
    Definition: libwebsockets.h:1230
    -
    Definition: libwebsockets.h:4288
    -
    short revents
    Definition: libwebsockets.h:442
    -
    lws_extension_callback_function * callback
    Definition: libwebsockets.h:1231
    -
    long ssl_options_set
    Definition: libwebsockets.h:1736
    -
    Definition: libwebsockets.h:1059
    +
    Definition: libwebsockets.h:765
    +
    const char * name
    Definition: libwebsockets.h:1242
    +
    Definition: libwebsockets.h:4320
    +
    short revents
    Definition: libwebsockets.h:454
    +
    lws_extension_callback_function * callback
    Definition: libwebsockets.h:1243
    +
    long ssl_options_set
    Definition: libwebsockets.h:1748
    +
    Definition: libwebsockets.h:1071
    LWS_VISIBLE LWS_EXTERN const struct lws_protocols * lws_protocol_get(struct lws *wsi) LWS_WARN_DEPRECATED
    -
    unsigned int mask
    Definition: libwebsockets.h:1489
    +
    unsigned int mask
    Definition: libwebsockets.h:1501
    LWS_VISIBLE LWS_EXTERN int lws_email_init(struct lws_email *email, uv_loop_t *loop, int max_content)
    -
    const void * client_exts
    Definition: libwebsockets.h:2115
    -
    lws_mount_protocols
    Definition: libwebsockets.h:2007
    +
    const void * client_exts
    Definition: libwebsockets.h:2127
    +
    lws_mount_protocols
    Definition: libwebsockets.h:2019
    LWS_EXTERN int lws_extension_callback_pm_deflate(struct lws_context *context, const struct lws_extension *ext, struct lws *wsi, enum lws_extension_callback_reasons reason, void *user, void *in, size_t len)
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_header_content_length(struct lws *wsi, unsigned long content_length, unsigned char **p, unsigned char *end)
    -
    lws_sockfd_type fd
    Definition: libwebsockets.h:440
    -
    unsigned int max_http_header_data2
    Definition: libwebsockets.h:1731
    -
    Definition: libwebsockets.h:2008
    +
    lws_sockfd_type fd
    Definition: libwebsockets.h:452
    +
    unsigned int max_http_header_data2
    Definition: libwebsockets.h:1743
    +
    Definition: libwebsockets.h:2020
    LWS_VISIBLE LWS_EXTERN int lws_return_http_status(struct lws *wsi, unsigned int code, const char *html_body)
    LWS_EXTERN LWS_VISIBLE struct lws_vhost * lws_create_vhost(struct lws_context *context, struct lws_context_creation_info *info)
    -
    const struct lws_protocol_vhost_options * interpret
    Definition: libwebsockets.h:2039
    -
    void * external_baggage_free_on_destroy
    Definition: libwebsockets.h:1763
    +
    const struct lws_protocol_vhost_options * interpret
    Definition: libwebsockets.h:2051
    +
    void * external_baggage_free_on_destroy
    Definition: libwebsockets.h:1775
    LWS_VISIBLE LWS_EXTERN int lws_service(struct lws_context *context, int timeout_ms)
    - -
    Definition: libwebsockets.h:1551
    + +
    Definition: libwebsockets.h:1563
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_transaction_completed(struct lws *wsi)
    -
    int count_vars
    Definition: libwebsockets.h:2555
    +
    int count_vars
    Definition: libwebsockets.h:2587
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_header_status(struct lws *wsi, unsigned int code, unsigned char **p, unsigned char *end)
    -
    Definition: libwebsockets.h:2609
    +
    Definition: libwebsockets.h:2641
    LWS_VISIBLE LWS_EXTERN struct lws_context * lws_create_context(struct lws_context_creation_info *info)
    -
    Definition: libwebsockets.h:732
    -
    void * data
    Definition: libwebsockets.h:2553
    -
    char * content
    Definition: libwebsockets.h:4335
    +
    Definition: libwebsockets.h:744
    +
    void * data
    Definition: libwebsockets.h:2585
    +
    char * content
    Definition: libwebsockets.h:4367
    LWS_VISIBLE LWS_EXTERN int lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr, size_t addrlen)
    -
    const struct lws_token_limits * token_limits
    Definition: libwebsockets.h:1626
    -
    Definition: libwebsockets.h:4296
    -
    const char * address
    Definition: libwebsockets.h:2097
    -
    unsigned long(* seek_cur)(struct lws *wsi, lws_filefd_type fd, long offset_from_cur_pos)
    Definition: libwebsockets.h:4153
    -
    void * user
    Definition: libwebsockets.h:1348
    -
    int events
    Definition: libwebsockets.h:540
    +
    const struct lws_token_limits * token_limits
    Definition: libwebsockets.h:1638
    +
    Definition: libwebsockets.h:4328
    +
    const char * address
    Definition: libwebsockets.h:2109
    +
    unsigned long(* seek_cur)(struct lws *wsi, lws_filefd_type fd, long offset_from_cur_pos)
    Definition: libwebsockets.h:4185
    +
    void * user
    Definition: libwebsockets.h:1360
    +
    int events
    Definition: libwebsockets.h:552
    LWS_VISIBLE LWS_EXTERN unsigned int lws_http_client_http_response(struct lws *wsi)
    -
    int(* on_get_body)(struct lws_email *email, char *buf, int len)
    Definition: libwebsockets.h:4322
    -
    Definition: libwebsockets.h:2014
    -
    void * user
    Definition: libwebsockets.h:1658
    -
    Definition: libwebsockets.h:4292
    -
    Definition: libwebsockets.h:3298
    -
    char * token
    Definition: libwebsockets.h:2610
    +
    int(* on_get_body)(struct lws_email *email, char *buf, int len)
    Definition: libwebsockets.h:4354
    +
    Definition: libwebsockets.h:2026
    +
    void * user
    Definition: libwebsockets.h:1670
    +
    Definition: libwebsockets.h:4324
    +
    Definition: libwebsockets.h:3330
    +
    char * token
    Definition: libwebsockets.h:2642
    LWS_VISIBLE LWS_EXTERN void * lws_protocol_vh_priv_get(struct lws_vhost *vhost, const struct lws_protocols *prot)
    -
    int count_protocols
    Definition: libwebsockets.h:1431
    -
    void * l
    Definition: libwebsockets.h:1446
    -
    const char * ssl_private_key_filepath
    Definition: libwebsockets.h:1635
    -
    Definition: libwebsockets.h:1584
    -
    int max_len
    Definition: libwebsockets.h:2543
    -
    Definition: libwebsockets.h:734
    -
    const struct lws_protocol_vhost_options * next
    Definition: libwebsockets.h:1997
    -
    Definition: libwebsockets.h:745
    +
    int count_protocols
    Definition: libwebsockets.h:1443
    +
    void * l
    Definition: libwebsockets.h:1458
    +
    const char * ssl_private_key_filepath
    Definition: libwebsockets.h:1647
    +
    Definition: libwebsockets.h:1596
    +
    int max_len
    Definition: libwebsockets.h:2575
    +
    Definition: libwebsockets.h:746
    +
    const struct lws_protocol_vhost_options * next
    Definition: libwebsockets.h:2009
    +
    Definition: libwebsockets.h:757
    LWS_VISIBLE LWS_EXTERN void lws_rx_flow_allow_all_protocol(const struct lws_context *context, const struct lws_protocols *protocol)
    -
    Definition: libwebsockets.h:2549
    +
    Definition: libwebsockets.h:2581
    LWS_VISIBLE LWS_EXTERN const char *LWS_WARN_UNUSED_RESULT lws_canonical_hostname(struct lws_context *context)
    -
    Definition: libwebsockets.h:944
    -
    const char * ssl_ca_filepath
    Definition: libwebsockets.h:1641
    -
    lws_client_connect_ssl_connection_flags
    Definition: libwebsockets.h:2084
    -
    int gid
    Definition: libwebsockets.h:1652
    -
    struct lws_vhost * vhost
    Definition: libwebsockets.h:2129
    -
    int lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len)
    Definition: libwebsockets.h:1081
    +
    Definition: libwebsockets.h:956
    +
    const char * ssl_ca_filepath
    Definition: libwebsockets.h:1653
    +
    lws_client_connect_ssl_connection_flags
    Definition: libwebsockets.h:2096
    +
    int gid
    Definition: libwebsockets.h:1664
    +
    struct lws_vhost * vhost
    Definition: libwebsockets.h:2141
    +
    int lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len)
    Definition: libwebsockets.h:1093
    LWS_VISIBLE LWS_EXTERN void lws_cancel_service_pt(struct lws *wsi)
    -
    Definition: libwebsockets.h:1571
    -
    Definition: libwebsockets.h:613
    -
    Definition: libwebsockets.h:4287
    -
    unsigned int api_magic
    Definition: libwebsockets.h:1429
    -
    Definition: libwebsockets.h:1574
    +
    Definition: libwebsockets.h:1583
    +
    Definition: libwebsockets.h:625
    +
    Definition: libwebsockets.h:4319
    +
    unsigned int api_magic
    Definition: libwebsockets.h:1441
    +
    Definition: libwebsockets.h:1586
    LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_send_pipe_choked(struct lws *wsi)
    -
    Definition: libwebsockets.h:4290
    -
    int(* lws_spa_fileupload_cb)(void *data, const char *name, const char *filename, char *buf, int len, enum lws_spa_fileupload_states state)
    Definition: libwebsockets.h:2950
    +
    Definition: libwebsockets.h:4322
    +
    int(* lws_spa_fileupload_cb)(void *data, const char *name, const char *filename, char *buf, int len, enum lws_spa_fileupload_states state)
    Definition: libwebsockets.h:2982
    diff --git a/doc/html/md_README_8coding.html b/doc/html/md_README_8coding.html index ed51c3e..a45296e 100644 --- a/doc/html/md_README_8coding.html +++ b/doc/html/md_README_8coding.html @@ -217,7 +217,7 @@ Client connections as HTTP[S] rather than WS[S]

    To stay in http[s], set the optional info member "method" to point to the string "GET" instead of the default NULL.

    After the server headers are processed, when payload from the server is available the callback LWS_CALLBACK_RECEIVE_CLIENT_HTTP will be made.

    You can choose whether to process the data immediately, or queue a callback when an outgoing socket is writeable to provide flow control, and process the data in the writable callback.

    -

    Either way you use the api lws_http_client_read() to access the data, eg

    +

    Either way you use the api lws_http_client_read() to access the data, eg

    case LWS_CALLBACK_RECEIVE_CLIENT_HTTP:
    {
    char buffer[1024 + LWS_PRE];
    char *px = buffer + LWS_PRE;
    int lenx = sizeof(buffer) - LWS_PRE;
    lwsl_notice("LWS_CALLBACK_RECEIVE_CLIENT_HTTP\n");
    /*
    * Often you need to flow control this by something
    * else being writable. In that case call the api
    * to get a callback when writable here, and do the
    * pending client read in the writeable callback of
    * the output.
    */
    if (lws_http_client_read(wsi, &px, &lenx) < 0)
    return -1;
    while (lenx--)
    putchar(*px++);
    }
    break;

    Notice that if you will use SSL client connections on a vhost, you must prepare the client SSL context for the vhost after creating the vhost, since this is not normally done if the vhost was set up to listen / serve. Call the api lws_init_vhost_client_ssl() to also allow client SSL on the vhost.

    Using lws vhosts

    diff --git a/doc/html/navtreedata.js b/doc/html/navtreedata.js index 8b70256..6157e6c 100644 --- a/doc/html/navtreedata.js +++ b/doc/html/navtreedata.js @@ -136,9 +136,9 @@ var NAVTREEINDEX = [ "annotated.html", "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a4933347a821e73c3f1e13fb6bfc7ad93", -"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dafe5a38e940ce56708ac814627e9c0917", -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390", -"structlws__ext__option__arg.html#af37f0b6caa7735af51a1ac12b68d5bc5" +"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dae7d8a025a65524652fe9e24c2654c935", +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350", +"structlws__ext__option__arg.html" ]; var SYNCONMSG = 'click to disable panel synchronisation'; diff --git a/doc/html/navtreeindex0.js b/doc/html/navtreeindex0.js index 8709d3d..a33282c 100644 --- a/doc/html/navtreeindex0.js +++ b/doc/html/navtreeindex0.js @@ -185,18 +185,19 @@ var NAVTREEINDEX0 = "group__callback-when-writeable.html#gabbe4655c7eeb3eb1671b2323ec6b3107":[11,0,0,0,60], "group__callback-when-writeable.html#gac4643fe16b0940ae5b68b4ee6195cbde":[11,0,0,0,103], "group__callback-when-writeable.html#gac4643fe16b0940ae5b68b4ee6195cbde":[9,1,6], -"group__callback-when-writeable.html#gacf04bbe089f47c971c6408c5efe2ac70":[11,0,0,0,56], "group__callback-when-writeable.html#gacf04bbe089f47c971c6408c5efe2ac70":[9,1,0], +"group__callback-when-writeable.html#gacf04bbe089f47c971c6408c5efe2ac70":[11,0,0,0,56], "group__cgi.html":[9,19], "group__client.html":[9,2], "group__client.html#ga0c966136905f467816307cfba6deb5fd":[9,2,4], "group__client.html#ga0c966136905f467816307cfba6deb5fd":[11,0,0,0,72], "group__client.html#ga26588fb345083076c14169dd5859f57a":[11,0,0,0,73], "group__client.html#ga4450c34200bf9dab3beb90ef23221870":[11,0,0,0,116], +"group__client.html#ga4450c34200bf9dab3beb90ef23221870":[9,2,6], "group__client.html#ga4af0a20108a95e8b6d94dd4d80055ff3":[9,2,2], "group__client.html#ga4af0a20108a95e8b6d94dd4d80055ff3":[11,0,0,0,70], "group__client.html#ga4f44b8230e6732816ca5cd8d1aaaf340":[11,0,0,0,119], -"group__client.html#ga4f44b8230e6732816ca5cd8d1aaaf340":[9,2,6], +"group__client.html#ga4f44b8230e6732816ca5cd8d1aaaf340":[9,2,7], "group__client.html#ga715efffc0c4e8fbf72a4293008eb2187":[11,0,0,0,115], "group__client.html#ga715efffc0c4e8fbf72a4293008eb2187":[9,2,5], "group__client.html#ga96f3dbad54b2853969cfa933d66871ce":[9,2,1], @@ -218,7 +219,7 @@ var NAVTREEINDEX0 = "group__context-and-vhost.html#ga1dce5453d72a2037051aba5410e18135":[11,0,0,0,124], "group__context-and-vhost.html#ga256a49a07d2dd5062d6cf7bdc3668096":[11,0,0,0,15], "group__context-and-vhost.html#ga341064721add2618ae1b29717493a212":[9,4,15], -"group__context-and-vhost.html#ga341064721add2618ae1b29717493a212":[11,0,0,0,178], +"group__context-and-vhost.html#ga341064721add2618ae1b29717493a212":[11,0,0,0,179], "group__context-and-vhost.html#ga41c2d763f78cc248df3b9f8645dbd2a5":[11,0,0,0,27], "group__context-and-vhost.html#ga41c2d763f78cc248df3b9f8645dbd2a5":[9,4,3], "group__context-and-vhost.html#ga7e9d5405547a457d86e0b4f0ae2bb1c4":[9,4,12], @@ -230,13 +231,13 @@ var NAVTREEINDEX0 = "group__context-and-vhost.html#ga94e6cc2223c4eec316b13bcebc3628b6":[9,4,11], "group__context-and-vhost.html#ga94e6cc2223c4eec316b13bcebc3628b6":[11,0,0,0,125], "group__context-and-vhost.html#ga98d88c9080fd89c37114363a6474ea73":[9,4,14], -"group__context-and-vhost.html#ga98d88c9080fd89c37114363a6474ea73":[11,0,0,0,177], +"group__context-and-vhost.html#ga98d88c9080fd89c37114363a6474ea73":[11,0,0,0,178], "group__context-and-vhost.html#gaa327c9d543edaddf06765d2c6131065c":[11,0,0,0,77], "group__context-and-vhost.html#gaeb12f934bfd178bd2132a9e73fc641da":[11,0,0,0,79], "group__context-and-vhost.html#gaeb12f934bfd178bd2132a9e73fc641da":[9,4,6], "group__context-and-vhost.html#gaf023d1898a5f773288568f55b82d19e8":[11,0,0,0,78], -"group__context-and-vhost.html#gaf2fff58562caab7510c41eeac85a8648":[11,0,0,0,80], "group__context-and-vhost.html#gaf2fff58562caab7510c41eeac85a8648":[9,4,7], +"group__context-and-vhost.html#gaf2fff58562caab7510c41eeac85a8648":[11,0,0,0,80], "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a1b2f8bde0f62adc7ebe81b2043f34c0c":[11,0,0,0,27,8], "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a1b2f8bde0f62adc7ebe81b2043f34c0c":[9,4,3,8], "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a1cc4562d05cba52a6dfa0697a65ade0d":[11,0,0,0,27,2], @@ -248,6 +249,5 @@ var NAVTREEINDEX0 = "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a34ab36e68c0d593b6f19b8d5ef1240a9":[11,0,0,0,27,4], "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a34ab36e68c0d593b6f19b8d5ef1240a9":[9,4,3,4], "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a4832187186c4d130c68051214cd42ada":[11,0,0,0,27,10], -"group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a4832187186c4d130c68051214cd42ada":[9,4,3,10], -"group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a4933347a821e73c3f1e13fb6bfc7ad93":[11,0,0,0,27,5] +"group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a4832187186c4d130c68051214cd42ada":[9,4,3,10] }; diff --git a/doc/html/navtreeindex1.js b/doc/html/navtreeindex1.js index df39795..6c81944 100644 --- a/doc/html/navtreeindex1.js +++ b/doc/html/navtreeindex1.js @@ -1,5 +1,6 @@ var NAVTREEINDEX1 = { +"group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a4933347a821e73c3f1e13fb6bfc7ad93":[11,0,0,0,27,5], "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a4933347a821e73c3f1e13fb6bfc7ad93":[9,4,3,5], "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a6582c985ee0ceaadc1d277030eae2d7c":[11,0,0,0,27,1], "group__context-and-vhost.html#gga41c2d763f78cc248df3b9f8645dbd2a5a6582c985ee0ceaadc1d277030eae2d7c":[9,4,3,1], @@ -104,8 +105,8 @@ var NAVTREEINDEX1 = "group__generic-sessions.html":[9,10,0], "group__generic-sessions.html#ga7c2dc7bfb4ccb91c5d771f9e9ea237e1":[9,10,0,5], "group__generic-sessions.html#ga7c2dc7bfb4ccb91c5d771f9e9ea237e1":[11,0,0,0,37], -"group__generic-sessions.html#gaa93946b3d921072209d5cd8cdfa5332e":[9,10,0,4], "group__generic-sessions.html#gaa93946b3d921072209d5cd8cdfa5332e":[11,0,0,0,31], +"group__generic-sessions.html#gaa93946b3d921072209d5cd8cdfa5332e":[9,10,0,4], "group__generic-sessions.html#gga7c2dc7bfb4ccb91c5d771f9e9ea237e1a0657a9e846814781b128c397fe4b10bf":[9,10,0,5,1], "group__generic-sessions.html#gga7c2dc7bfb4ccb91c5d771f9e9ea237e1a0657a9e846814781b128c397fe4b10bf":[11,0,0,0,37,1], "group__generic-sessions.html#gga7c2dc7bfb4ccb91c5d771f9e9ea237e1a2cd8fb86e3b85c106e7711c03f0ddd0a":[9,10,0,5,3], @@ -158,19 +159,21 @@ var NAVTREEINDEX1 = "group__http.html#ga8fbf01e473ac421fc33ad9f8da8b8a25":[9,6,7], "group__http.html#gac8a4a71240857dc6b2ed70456b6923f4":[11,0,0,0,138], "group__http.html#gac8a4a71240857dc6b2ed70456b6923f4":[9,6,9], -"group__http.html#gad27aed6c66a41b2b89ffe4da2a309e8a":[11,0,0,0,118], "group__http.html#gad27aed6c66a41b2b89ffe4da2a309e8a":[9,6,8], +"group__http.html#gad27aed6c66a41b2b89ffe4da2a309e8a":[11,0,0,0,118], "group__httpft.html":[9,6,2], "group__httpft.html#ga29e1123f6d56cd777b3e5bf9ca40f9e5":[11,0,0,0,143], "group__httpft.html#gab393a06d3d2722af4c3f8b06842c80d7":[11,0,0,0,142], "group__httpft.html#gab393a06d3d2722af4c3f8b06842c80d7":[9,6,2,1], -"group__httpft.html#gab4da87a4800413f15e7aba649fb1d77c":[9,6,2,0], "group__httpft.html#gab4da87a4800413f15e7aba649fb1d77c":[11,0,0,0,99], +"group__httpft.html#gab4da87a4800413f15e7aba649fb1d77c":[9,6,2,0], "group__log.html":[9,7], "group__log.html#ga0cdc1065ae7f003d59a3c8525acf545e":[11,0,0,0,40], "group__log.html#ga14542b84d2c76efa7814124bb10f9c5f":[11,0,0,0,32], "group__log.html#ga244647f9e1bf0097ccdde66d74f41e26":[11,0,0,0,151], "group__log.html#ga244647f9e1bf0097ccdde66d74f41e26":[9,7,0], +"group__log.html#ga2d1819ad1645062fd83817e6f20e03b4":[11,0,0,0,177], +"group__log.html#ga2d1819ad1645062fd83817e6f20e03b4":[9,7,4], "group__log.html#ga42e39775c6b69b7251bdbf5a2cdd5dcd":[11,0,0,0,176], "group__log.html#ga42e39775c6b69b7251bdbf5a2cdd5dcd":[9,7,3], "group__log.html#ga74eb146969f0595e12ea835851b4588e":[11,0,0,0,41], @@ -204,12 +207,12 @@ var NAVTREEINDEX1 = "group__misc.html#ga58f906c6be0ca80efd813f694569dd4a":[9,8,6], "group__misc.html#ga629f48268fd1856b54b11172991b97d9":[9,8,3], "group__misc.html#ga629f48268fd1856b54b11172991b97d9":[11,0,0,0,96], -"group__misc.html#ga8930fe36a3f3eefe4a6a4fd499d8e899":[9,8,5], "group__misc.html#ga8930fe36a3f3eefe4a6a4fd499d8e899":[11,0,0,0,100], +"group__misc.html#ga8930fe36a3f3eefe4a6a4fd499d8e899":[9,8,5], "group__misc.html#gaa194584fff9698f3b280658f770ccd0f":[11,0,0,0,173], "group__misc.html#gaa194584fff9698f3b280658f770ccd0f":[9,8,11], -"group__misc.html#gab321ed812f46f6dc7ef9e3ca6f00cf1b":[9,8,9], "group__misc.html#gab321ed812f46f6dc7ef9e3ca6f00cf1b":[11,0,0,0,149], +"group__misc.html#gab321ed812f46f6dc7ef9e3ca6f00cf1b":[9,8,9], "group__misc.html#gac6abfc0b2bd5b2f09281a4432bb2f5f0":[9,8,4], "group__misc.html#gac6abfc0b2bd5b2f09281a4432bb2f5f0":[11,0,0,0,98], "group__misc.html#gacae4d7b6a8d22e4c2d82ff8b12c1e234":[9,8,1], @@ -219,8 +222,8 @@ var NAVTREEINDEX1 = "group__net.html":[9,9], "group__net.html#ga092e5f473b3347f03ffeef8a950080f3":[11,0,0,0,101], "group__net.html#ga092e5f473b3347f03ffeef8a950080f3":[9,9,1], -"group__net.html#ga869d8bdffb0f2a7ce08e3ce10d6be3d8":[9,9,3], "group__net.html#ga869d8bdffb0f2a7ce08e3ce10d6be3d8":[11,0,0,0,120], +"group__net.html#ga869d8bdffb0f2a7ce08e3ce10d6be3d8":[9,9,3], "group__net.html#gad01014fed09759741b6d23afccfdaacc":[9,9,2], "group__net.html#gad01014fed09759741b6d23afccfdaacc":[11,0,0,0,102], "group__net.html#gad0df22db2be9fc65a667a1e83f9a92a4":[9,9,0], @@ -228,8 +231,8 @@ var NAVTREEINDEX1 = "group__pur.html":[9,12], "group__pur.html#ga9cc82f06e5ae7e71458626d7a39a5865":[11,0,0,0,162], "group__pur.html#ga9cc82f06e5ae7e71458626d7a39a5865":[9,12,1], -"group__pur.html#gab15187efcfa256b7c928562c182b92a3":[11,0,0,0,126], "group__pur.html#gab15187efcfa256b7c928562c182b92a3":[9,12,0], +"group__pur.html#gab15187efcfa256b7c928562c182b92a3":[11,0,0,0,126], "group__sending-data.html":[9,13], "group__sending-data.html#ga98b099cf8c1c7e38ad78501f270e193d":[9,13,0], "group__sending-data.html#ga98b099cf8c1c7e38ad78501f270e193d":[11,0,0,0,36], @@ -245,9 +248,6 @@ var NAVTREEINDEX1 = "group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193da80e8f169fda236c56bfb795ed62903db":[9,13,0,0], "group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193da80e8f169fda236c56bfb795ed62903db":[11,0,0,0,36,0], "group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dab7e7a62cf6f456c09c21dff24dad9039":[11,0,0,0,36,5], -"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dabb6705e1d1327cdda5025be28f07712e":[11,0,0,0,36,3], "group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dabb6705e1d1327cdda5025be28f07712e":[9,13,0,3], -"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dae7d8a025a65524652fe9e24c2654c935":[11,0,0,0,36,6], -"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193daf6486c0dba50c44198100717721d9ab2":[9,13,0,1], -"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193daf6486c0dba50c44198100717721d9ab2":[11,0,0,0,36,1] +"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dabb6705e1d1327cdda5025be28f07712e":[11,0,0,0,36,3] }; diff --git a/doc/html/navtreeindex2.js b/doc/html/navtreeindex2.js index ff0e3fe..e4c19d8 100644 --- a/doc/html/navtreeindex2.js +++ b/doc/html/navtreeindex2.js @@ -1,5 +1,8 @@ var NAVTREEINDEX2 = { +"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dae7d8a025a65524652fe9e24c2654c935":[11,0,0,0,36,6], +"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193daf6486c0dba50c44198100717721d9ab2":[9,13,0,1], +"group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193daf6486c0dba50c44198100717721d9ab2":[11,0,0,0,36,1], "group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dafe5a38e940ce56708ac814627e9c0917":[9,13,0,4], "group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193dafe5a38e940ce56708ac814627e9c0917":[11,0,0,0,36,7], "group__service.html":[9,0], @@ -7,14 +10,14 @@ var NAVTREEINDEX2 = "group__service.html#ga29c246707997ab7a466aa709aecd2d7b":[11,0,0,0,64], "group__service.html#ga4fd9d714434ca499e2b3f7dbba86f241":[11,0,0,0,145], "group__service.html#ga4fd9d714434ca499e2b3f7dbba86f241":[9,0,3], -"group__service.html#ga53e3d0801dfda7960a7249dd559e68a2":[9,0,0], "group__service.html#ga53e3d0801dfda7960a7249dd559e68a2":[11,0,0,0,63], +"group__service.html#ga53e3d0801dfda7960a7249dd559e68a2":[9,0,0], "group__service.html#ga9b3cc4473fd8848e5bbee7f310712939":[11,0,0,0,148], "group__service.html#ga9b3cc4473fd8848e5bbee7f310712939":[9,0,6], "group__service.html#gad82efa5466d14a9f05aa06416375b28d":[11,0,0,0,146], "group__service.html#gad82efa5466d14a9f05aa06416375b28d":[9,0,4], -"group__service.html#gaebf426eda371ba23642fc11d8e0ace6b":[9,0,5], "group__service.html#gaebf426eda371ba23642fc11d8e0ace6b":[11,0,0,0,147], +"group__service.html#gaebf426eda371ba23642fc11d8e0ace6b":[9,0,5], "group__service.html#gaf95bd0c663d6516a0c80047d9b1167a8":[11,0,0,0,144], "group__service.html#gaf95bd0c663d6516a0c80047d9b1167a8":[9,0,2], "group__sha.html":[9,11], @@ -25,28 +28,28 @@ var NAVTREEINDEX2 = "group__sha.html#gaf39765e4a3b413efb65e4698b2ec3575":[9,11,1], "group__sha.html#gaf39765e4a3b413efb65e4698b2ec3575":[11,0,0,0,55], "group__smtp.html":[9,14], -"group__smtp.html#ga116be79bf44f9dc2a97f46e051fe4dc0":[9,14,1], "group__smtp.html#ga116be79bf44f9dc2a97f46e051fe4dc0":[11,0,0,0,38], +"group__smtp.html#ga116be79bf44f9dc2a97f46e051fe4dc0":[9,14,1], "group__smtp.html#ga25298a5afc1074e13b2d5711a86432b2":[9,14,3], "group__smtp.html#ga25298a5afc1074e13b2d5711a86432b2":[11,0,0,0,84], -"group__smtp.html#ga5e535e346d92a9daf00be33abf79d4eb":[11,0,0,0,83], "group__smtp.html#ga5e535e346d92a9daf00be33abf79d4eb":[9,14,2], -"group__smtp.html#ga77fc9b56a1bb39484844981ec375fc29":[9,14,4], +"group__smtp.html#ga5e535e346d92a9daf00be33abf79d4eb":[11,0,0,0,83], "group__smtp.html#ga77fc9b56a1bb39484844981ec375fc29":[11,0,0,0,85], +"group__smtp.html#ga77fc9b56a1bb39484844981ec375fc29":[9,14,4], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a1dfec948a864205cec875f63cbe0d4ad":[9,14,1,3], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a1dfec948a864205cec875f63cbe0d4ad":[11,0,0,0,38,3], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a29e5b0ecf75375b5a643faa3d6222b7c":[9,14,1,0], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a29e5b0ecf75375b5a643faa3d6222b7c":[11,0,0,0,38,0], -"group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a2c2ed16ffc572326e3040684084b21d5":[11,0,0,0,38,8], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a2c2ed16ffc572326e3040684084b21d5":[9,14,1,8], +"group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a2c2ed16ffc572326e3040684084b21d5":[11,0,0,0,38,8], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a38fba41f28d754e38079b31418a86a69":[9,14,1,7], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a38fba41f28d754e38079b31418a86a69":[11,0,0,0,38,7], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a85e3c452950c09a79086bff4b9be5c14":[9,14,1,6], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a85e3c452950c09a79086bff4b9be5c14":[11,0,0,0,38,6], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a929bb4623ff3f585108aba2a1b047fab":[9,14,1,4], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0a929bb4623ff3f585108aba2a1b047fab":[11,0,0,0,38,4], -"group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0aae20a0cb95b97a70f6b45d0ed2d5be83":[11,0,0,0,38,5], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0aae20a0cb95b97a70f6b45d0ed2d5be83":[9,14,1,5], +"group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0aae20a0cb95b97a70f6b45d0ed2d5be83":[11,0,0,0,38,5], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0ab61778f70ecac007b334bb14942eb41d":[9,14,1,2], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0ab61778f70ecac007b334bb14942eb41d":[11,0,0,0,38,2], "group__smtp.html#gga116be79bf44f9dc2a97f46e051fe4dc0ab89442b7a3ca2b94c3cdcf33756eb933":[9,14,1,1], @@ -58,12 +61,12 @@ var NAVTREEINDEX2 = "group__sock-adopt.html#ga5ed5fd251ac0ed46798af341c33bf067":[11,0,0,0,53], "group__sock-adopt.html#gab2d045df0f81afe00891aaed312d552b":[9,15,1], "group__sock-adopt.html#gab2d045df0f81afe00891aaed312d552b":[11,0,0,0,51], -"group__sock-adopt.html#gabe71b7462afb21c767bdc67334f305af":[11,0,0,0,50], "group__sock-adopt.html#gabe71b7462afb21c767bdc67334f305af":[9,15,0], +"group__sock-adopt.html#gabe71b7462afb21c767bdc67334f305af":[11,0,0,0,50], "group__timeout.html":[9,3], "group__timeout.html#ga2c0aa4b9c3c55bae7b35cbfac3246c87":[11,0,0,0,39], -"group__timeout.html#gaced9f9237f6172fed9f730a2af51345a":[11,0,0,0,153], "group__timeout.html#gaced9f9237f6172fed9f730a2af51345a":[9,3,0], +"group__timeout.html#gaced9f9237f6172fed9f730a2af51345a":[11,0,0,0,153], "group__timeout.html#gga2c0aa4b9c3c55bae7b35cbfac3246c87a0d6b956db11acb6d263af3ea054a914e":[11,0,0,0,39,12], "group__timeout.html#gga2c0aa4b9c3c55bae7b35cbfac3246c87a0eef059426f37d00b75142d4dc3e25e3":[11,0,0,0,39,3], "group__timeout.html#gga2c0aa4b9c3c55bae7b35cbfac3246c87a1104c39d0177378713a9332ab7a9d7fe":[11,0,0,0,39,4], @@ -91,8 +94,8 @@ var NAVTREEINDEX2 = "group__usercb.html":[9,16], "group__usercb.html#gad4fcb82e68d60ffacca61a3f783a0a2f":[11,0,0,0,8], "group__usercb.html#gad4fcb82e68d60ffacca61a3f783a0a2f":[9,16,0], -"group__usercb.html#gad62860e19975ba4c4af401c3cdb6abf7":[11,0,0,0,23], "group__usercb.html#gad62860e19975ba4c4af401c3cdb6abf7":[9,16,1], +"group__usercb.html#gad62860e19975ba4c4af401c3cdb6abf7":[11,0,0,0,23], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a026502768778b8d79d62dd0fe4375fc6":[11,0,0,0,23,17], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a026502768778b8d79d62dd0fe4375fc6":[9,16,1,17], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a0418587d5083bb4850faa438648496ba":[11,0,0,0,23,49], @@ -100,8 +103,8 @@ var NAVTREEINDEX2 = "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a06006e98d27e1e884364d88317f83493":[9,16,1,22], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a0e9e3dd667c0c42cdbe1a3d921f4fd79":[11,0,0,0,23,36], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a0e9e3dd667c0c42cdbe1a3d921f4fd79":[9,16,1,36], -"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a136a7cec11c3afd13245623bd84e76c9":[9,16,1,9], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a136a7cec11c3afd13245623bd84e76c9":[11,0,0,0,23,9], +"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a136a7cec11c3afd13245623bd84e76c9":[9,16,1,9], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a17620dd6cb920b9b6daeae63575be08b":[9,16,1,41], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a17620dd6cb920b9b6daeae63575be08b":[11,0,0,0,23,58], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a182a4a14c3278784505cea6d516a8308":[11,0,0,0,23,47], @@ -121,20 +124,20 @@ var NAVTREEINDEX2 = "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a45d538082dec32dbecfe9d9a05ddfecd":[11,0,0,0,23,50], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a48a9590e5e18c7920282e094a0bfd9d8":[9,16,1,4], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a48a9590e5e18c7920282e094a0bfd9d8":[11,0,0,0,23,4], -"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a492c1b1c0ac0ed980042ee732fe2990c":[9,16,1,6], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a492c1b1c0ac0ed980042ee732fe2990c":[11,0,0,0,23,6], +"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a492c1b1c0ac0ed980042ee732fe2990c":[9,16,1,6], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a54269ca88508e6efd3afdb9d360a9caa":[11,0,0,0,23,28], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a54269ca88508e6efd3afdb9d360a9caa":[9,16,1,28], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a659539cfa65c66e0d813113b09900d31":[11,0,0,0,23,42], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a6a09ee9c01c4a233aedbe6697e29cc01":[11,0,0,0,23,44], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a75199176c82c1a56e4a6bbf1cc30c12c":[11,0,0,0,23,18], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a75199176c82c1a56e4a6bbf1cc30c12c":[9,16,1,18], -"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a7e12418eec9bce85735e6460176ab604":[9,16,1,3], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a7e12418eec9bce85735e6460176ab604":[11,0,0,0,23,3], +"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a7e12418eec9bce85735e6460176ab604":[9,16,1,3], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a7ec8e2e9557ee02a4fc9f7dec7e2babc":[11,0,0,0,23,11], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a7ec8e2e9557ee02a4fc9f7dec7e2babc":[9,16,1,11], -"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a838b18d255c1b94a533287ba302a2eba":[11,0,0,0,23,5], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a838b18d255c1b94a533287ba302a2eba":[9,16,1,5], +"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a838b18d255c1b94a533287ba302a2eba":[11,0,0,0,23,5], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a8909732521d379179003d97ab7a05428":[11,0,0,0,23,35], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a8909732521d379179003d97ab7a05428":[9,16,1,35], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7a89862929a72bff65257ca1d51a0fce4d":[11,0,0,0,23,52], @@ -184,8 +187,8 @@ var NAVTREEINDEX2 = "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7ae4986291b7a810fe290851d73bebeb1c":[9,16,1,21], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7ae5ad65d779b7eab32ab67ceff91a3bac":[11,0,0,0,23,23], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7ae5ad65d779b7eab32ab67ceff91a3bac":[9,16,1,23], -"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7ae8d1de0bb56e03aa58cb4d44b18edd2e":[9,16,1,12], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7ae8d1de0bb56e03aa58cb4d44b18edd2e":[11,0,0,0,23,12], +"group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7ae8d1de0bb56e03aa58cb4d44b18edd2e":[9,16,1,12], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7ae9734e1d7af2abf291665ce9e4a728d3":[11,0,0,0,23,19], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7ae9734e1d7af2abf291665ce9e4a728d3":[9,16,1,19], "group__usercb.html#ggad62860e19975ba4c4af401c3cdb6abf7aeb0cec65ec82a713cd01e9ca9aeeb5e6":[11,0,0,0,23,57], @@ -224,17 +227,17 @@ var NAVTREEINDEX2 = "group__wsclose.html":[9,17], "group__wsclose.html#gaa1c863415d1783cd8de7938aa6efa262":[9,17,1], "group__wsclose.html#gaa1c863415d1783cd8de7938aa6efa262":[11,0,0,0,74], -"group__wsclose.html#gae399c571df32ba532c0ca67da9284985":[11,0,0,0,26], "group__wsclose.html#gae399c571df32ba532c0ca67da9284985":[9,17,0], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a1bb501d212fa4d57053db681b1dfab98":[9,17,0,2], +"group__wsclose.html#gae399c571df32ba532c0ca67da9284985":[11,0,0,0,26], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a1bb501d212fa4d57053db681b1dfab98":[11,0,0,0,26,3], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a2e1f0113494a58e762eed3d22e7080d8":[11,0,0,0,26,10], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a1bb501d212fa4d57053db681b1dfab98":[9,17,0,2], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a2e1f0113494a58e762eed3d22e7080d8":[9,17,0,9], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a2e1f0113494a58e762eed3d22e7080d8":[11,0,0,0,26,10], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a32c38edab10d1379febac0c479ab2e9c":[11,0,0,0,26,14], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a3ffa38d5081b85fb739e02a747ccf2c4":[9,17,0,0], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a3ffa38d5081b85fb739e02a747ccf2c4":[11,0,0,0,26,1], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a462c99b05459df700919cfd3f53c8276":[11,0,0,0,26,4], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a3ffa38d5081b85fb739e02a747ccf2c4":[9,17,0,0], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a462c99b05459df700919cfd3f53c8276":[9,17,0,3], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a462c99b05459df700919cfd3f53c8276":[11,0,0,0,26,4], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a4b8a3b7ce6f731e5248e4b0fb64a5044":[9,17,0,5], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a4b8a3b7ce6f731e5248e4b0fb64a5044":[11,0,0,0,26,6], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a68b3d34bebd88547dcfa5cadba0acd6c":[11,0,0,0,26,7], @@ -243,11 +246,8 @@ var NAVTREEINDEX2 = "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a7aef2da0062da606eeb35aaca5cf9050":[9,17,0,7], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a9737a68759e739856b150ff9dfa30218":[11,0,0,0,26,2], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a9737a68759e739856b150ff9dfa30218":[9,17,0,1], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ac6a161822783ee873be1c66f48d14e0e":[11,0,0,0,26,11], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ac6a161822783ee873be1c66f48d14e0e":[9,17,0,10], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ac6a161822783ee873be1c66f48d14e0e":[11,0,0,0,26,11], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985acc9a317c70363dd88e823e066b2c73b7":[11,0,0,0,26,0], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350":[9,17,0,11], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350":[11,0,0,0,26,12], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5":[11,0,0,0,26,9], -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5":[9,17,0,8] +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350":[9,17,0,11] }; diff --git a/doc/html/navtreeindex3.js b/doc/html/navtreeindex3.js index 6103626..27b3cb7 100644 --- a/doc/html/navtreeindex3.js +++ b/doc/html/navtreeindex3.js @@ -1,20 +1,23 @@ var NAVTREEINDEX3 = { -"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390":[9,17,0,12], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350":[11,0,0,0,26,12], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5":[11,0,0,0,26,9], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5":[9,17,0,8], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390":[11,0,0,0,26,13], +"group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390":[9,17,0,12], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985af90cb98d983ad3d4c79df9b6f3d4a4d2":[9,17,0,4], "group__wsclose.html#ggae399c571df32ba532c0ca67da9284985af90cb98d983ad3d4c79df9b6f3d4a4d2":[11,0,0,0,26,5], "group__wsstatus.html":[9,18], -"group__wsstatus.html#ga08e9ee165fca503fd9427d55cfecac37":[11,0,0,0,122], "group__wsstatus.html#ga08e9ee165fca503fd9427d55cfecac37":[9,18,4], +"group__wsstatus.html#ga08e9ee165fca503fd9427d55cfecac37":[11,0,0,0,122], "group__wsstatus.html#ga26a140623d202dd2bf2004deb6994baa":[9,18,5], "group__wsstatus.html#ga26a140623d202dd2bf2004deb6994baa":[11,0,0,0,123], -"group__wsstatus.html#ga2bb3655329b4651cd06f79ee3a764421":[11,0,0,0,141], "group__wsstatus.html#ga2bb3655329b4651cd06f79ee3a764421":[9,18,7], -"group__wsstatus.html#ga3df5045656dfb6b0e63a38de2dca79d2":[9,18,1], +"group__wsstatus.html#ga2bb3655329b4651cd06f79ee3a764421":[11,0,0,0,141], "group__wsstatus.html#ga3df5045656dfb6b0e63a38de2dca79d2":[11,0,0,0,106], -"group__wsstatus.html#ga42152ffb385f9b19f4e7b04f998425de":[9,18,2], +"group__wsstatus.html#ga3df5045656dfb6b0e63a38de2dca79d2":[9,18,1], "group__wsstatus.html#ga42152ffb385f9b19f4e7b04f998425de":[11,0,0,0,108], +"group__wsstatus.html#ga42152ffb385f9b19f4e7b04f998425de":[9,18,2], "group__wsstatus.html#ga4ad226d5e01024b4046f4a5a37199aa1":[9,18,3], "group__wsstatus.html#ga4ad226d5e01024b4046f4a5a37199aa1":[11,0,0,0,121], "group__wsstatus.html#gaccd9c59336efad8af0554f79cc5966fd":[9,18,0], @@ -25,8 +28,8 @@ var NAVTREEINDEX3 = "index.html":[0], "index.html":[], "libwebsockets_8h.html":[11,0,0,0], -"libwebsockets_8h.html#a0b056fdcf949a838ff82209b4a627dd9":[11,0,0,0,179], -"libwebsockets_8h.html#a17f5fc891b31d2920bd18b0d66d6cb25":[11,0,0,0,184], +"libwebsockets_8h.html#a0b056fdcf949a838ff82209b4a627dd9":[11,0,0,0,180], +"libwebsockets_8h.html#a17f5fc891b31d2920bd18b0d66d6cb25":[11,0,0,0,185], "libwebsockets_8h.html#a1b12016562c728eb306c7f954c804bef":[11,0,0,0,21], "libwebsockets_8h.html#a2271141d8be8d72b47ba327130b4905f":[11,0,0,0,28], "libwebsockets_8h.html#a2271141d8be8d72b47ba327130b4905fa7741c12fc97574fa73a810fedae2be76":[11,0,0,0,28,1], @@ -47,16 +50,16 @@ var NAVTREEINDEX3 = "libwebsockets_8h.html#a5e627dbf1db48170ef486edbaf268672":[11,0,0,0,139], "libwebsockets_8h.html#a71451ba21aadc2fa3e25674d04c31ab7":[11,0,0,0,44], "libwebsockets_8h.html#a72fe65e83b8bb03f904a1a256c673536":[11,0,0,0,137], -"libwebsockets_8h.html#a863bdd5bca33bcbaa424c42fb7b2fc96":[11,0,0,0,183], -"libwebsockets_8h.html#a9032a3062641d334161c29adcc4fa15d":[11,0,0,0,181], +"libwebsockets_8h.html#a863bdd5bca33bcbaa424c42fb7b2fc96":[11,0,0,0,184], +"libwebsockets_8h.html#a9032a3062641d334161c29adcc4fa15d":[11,0,0,0,182], "libwebsockets_8h.html#a9b1bfc6f34319188d2aa40500d825bab":[11,0,0,0,43], "libwebsockets_8h.html#a9b878fb94f4596226c982eef4f42a607":[11,0,0,0,45], -"libwebsockets_8h.html#a9f2a8506fd963db95a5103823c60fb0a":[11,0,0,0,182], +"libwebsockets_8h.html#a9f2a8506fd963db95a5103823c60fb0a":[11,0,0,0,183], "libwebsockets_8h.html#abddb8d337fb2692586d892b494739003":[11,0,0,0,19], "libwebsockets_8h.html#ac3abb8b7e6d29a0292797230e4031681":[11,0,0,0,18], "libwebsockets_8h.html#adedbc79528b71a5c7f27cde87100c9aa":[11,0,0,0,16], "libwebsockets_8h.html#adf4abd01e8c43f07c6e498ce13590c3e":[11,0,0,0,140], -"libwebsockets_8h.html#aefb2f20fe5bb29d79701a399838ef4ce":[11,0,0,0,180], +"libwebsockets_8h.html#aefb2f20fe5bb29d79701a399838ef4ce":[11,0,0,0,181], "libwebsockets_8h.html#af52923473c59e643a974d65e12290831":[11,0,0,0,66], "libwebsockets_8h.html#aff42d53861afdc1a6edfb999ba688ecb":[11,0,0,0,11], "libwebsockets_8h_source.html":[11,0,0,0], @@ -246,8 +249,5 @@ var NAVTREEINDEX3 = "structlws__email.html#ac6115d3cbef2e8bac62cc00895bf5fd3":[9,14,0,10], "structlws__email.html#ad8dc60353ee246d84dd59ec0591e9719":[9,14,0,14], "structlws__email.html#add1341456045382c183f4c763bdea6bc":[9,14,0,1], -"structlws__email.html#af7f0ae934347d81071f63a963301f9e2":[9,14,0,6], -"structlws__ext__option__arg.html":[9,5,1], -"structlws__ext__option__arg.html#a0a320c56b79271b8f059eeaad9423ac9":[9,5,1,2], -"structlws__ext__option__arg.html#a0b1f7b30c3ceaf5f1bf9d105c24568d1":[9,5,1,3] +"structlws__email.html#af7f0ae934347d81071f63a963301f9e2":[9,14,0,6] }; diff --git a/doc/html/navtreeindex4.js b/doc/html/navtreeindex4.js index 4e8a961..dd014bc 100644 --- a/doc/html/navtreeindex4.js +++ b/doc/html/navtreeindex4.js @@ -1,5 +1,8 @@ var NAVTREEINDEX4 = { +"structlws__ext__option__arg.html":[9,5,1], +"structlws__ext__option__arg.html#a0a320c56b79271b8f059eeaad9423ac9":[9,5,1,2], +"structlws__ext__option__arg.html#a0b1f7b30c3ceaf5f1bf9d105c24568d1":[9,5,1,3], "structlws__ext__option__arg.html#af37f0b6caa7735af51a1ac12b68d5bc5":[9,5,1,0], "structlws__ext__option__arg.html#af57fffcfa253dfa8d98681ac1fb1785f":[9,5,1,1], "structlws__ext__options.html":[9,5,0], @@ -77,12 +80,12 @@ var NAVTREEINDEX4 = "structlws__process__html__state.html#af21119890fdfebe28fb5c4dabfc1bdf5":[9,6,1,1,1], "structlws__protocol__vhost__options.html":[9,4,0,0], "structlws__protocol__vhost__options.html":[9,4,2], -"structlws__protocol__vhost__options.html#a0640a92513c70ee6b9b295a9ad1658e7":[9,4,0,0,3], "structlws__protocol__vhost__options.html#a0640a92513c70ee6b9b295a9ad1658e7":[9,4,2,3], -"structlws__protocol__vhost__options.html#abc714ddb4171756fc8196e9823a1e21c":[9,4,2,1], +"structlws__protocol__vhost__options.html#a0640a92513c70ee6b9b295a9ad1658e7":[9,4,0,0,3], "structlws__protocol__vhost__options.html#abc714ddb4171756fc8196e9823a1e21c":[9,4,0,0,1], -"structlws__protocol__vhost__options.html#acf9db77f8eb64cd4e314be9b43d8a8b9":[9,4,0,0,0], +"structlws__protocol__vhost__options.html#abc714ddb4171756fc8196e9823a1e21c":[9,4,2,1], "structlws__protocol__vhost__options.html#acf9db77f8eb64cd4e314be9b43d8a8b9":[9,4,2,0], +"structlws__protocol__vhost__options.html#acf9db77f8eb64cd4e314be9b43d8a8b9":[9,4,0,0,0], "structlws__protocol__vhost__options.html#afd99fbc90be51ea2465b550c2ec47822":[9,4,2,2], "structlws__protocol__vhost__options.html#afd99fbc90be51ea2465b550c2ec47822":[9,4,0,0,2], "structlws__protocols.html":[9,10,1], @@ -104,8 +107,8 @@ var NAVTREEINDEX4 = "structlws__tokens.html":[9,6,4,0], "structlws__tokens.html#a855b7375d1d58516c0ecd4b60e9a7766":[9,6,4,0,1], "structlws__tokens.html#a855b7375d1d58516c0ecd4b60e9a7766":[9,6,6,1], -"structlws__tokens.html#a9f3635412bc71a5cb78e9862b55f10cd":[9,6,4,0,0], "structlws__tokens.html#a9f3635412bc71a5cb78e9862b55f10cd":[9,6,6,0], +"structlws__tokens.html#a9f3635412bc71a5cb78e9862b55f10cd":[9,6,4,0,0], "structlwsgw__hash.html":[9,10,0,1], "structlwsgw__hash.html#a29435f5cf78747d4257695b0f141d164":[9,10,0,1,0], "structlwsgw__hash__bin.html":[9,10,0,0], diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index 8af784c..2a3c793 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -2256,6 +2256,26 @@ LWS_VISIBLE LWS_EXTERN int lws_init_vhost_client_ssl(const struct lws_context_creation_info *info, struct lws_vhost *vhost); +/** + * lws_http_client_read() - consume waiting received http client data + * + * \param wsi: client connection + * \param buf: pointer to buffer pointer - fill with pointer to your buffer + * \param len: pointer to chunk length - fill with max length of buffer + * + * This is called when the user code is notified client http data has arrived. + * The user code may choose to delay calling it to consume the data, for example + * waiting until an onward connection is writeable. + * + * For non-chunked connections, up to len bytes of buf are filled with the + * received content. len is set to the actual amount filled before return. + * + * For chunked connections, the linear buffer content contains the chunking + * headers and it cannot be passed in one lump. Instead, this function will + * call back LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ with in pointing to the + * chunk start and len set to the chunk length. There will be as many calls + * as there are chunks or partial chunks in the buffer. + */ LWS_VISIBLE LWS_EXTERN int lws_http_client_read(struct lws *wsi, char **buf, int *len); diff --git a/test-server/test-client.c b/test-server/test-client.c index 01dd64c..cfea0f8 100644 --- a/test-server/test-client.c +++ b/test-server/test-client.c @@ -75,6 +75,17 @@ enum demo_protocols { DEMO_PROTOCOL_COUNT }; +static void show_http_content(const char *p, size_t l) +{ + if (lwsl_visible(LLL_INFO)) { + while (l--) + if (*p < 0x7f) + putchar(*p++); + else + putchar('.'); + } +} + /* * dumb_increment protocol @@ -146,25 +157,41 @@ callback_dumb_increment(struct lws *wsi, enum lws_callback_reasons reason, lws_http_client_http_response(wsi)); break; + /* chunked content */ + case LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ: + lwsl_notice("LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ: %ld\n", + (long)len); + show_http_content(in, len); + break; + + /* unchunked content */ case LWS_CALLBACK_RECEIVE_CLIENT_HTTP: { char buffer[1024 + LWS_PRE]; char *px = buffer + LWS_PRE; int lenx = sizeof(buffer) - LWS_PRE; - lwsl_notice("LWS_CALLBACK_RECEIVE_CLIENT_HTTP\n"); - /* * Often you need to flow control this by something * else being writable. In that case call the api * to get a callback when writable here, and do the * pending client read in the writeable callback of * the output. + * + * In the case of chunked content, this will call back + * LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ once per + * chunk or partial chunk in the buffer, and report + * zero length back here. */ if (lws_http_client_read(wsi, &px, &lenx) < 0) return -1; - while (lenx--) - putchar(*px++); + + if (lenx) { + lwsl_info("LWS_CALLBACK_RECEIVE_CLIENT_HTTP %ld\n", + (long)lenx); + + show_http_content(px, lenx); + } } break;