Subject: Support to bind accepted socket to device on Linux
[platform/upstream/libwebsockets.git] / lib / private-libwebsockets.h
index ad61015..993f6e1 100644 (file)
@@ -854,6 +854,9 @@ struct lws_vhost {
        struct lws *lserv_wsi;
        const char *name;
        const char *iface;
+#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32) && !defined(OPTEE_TA) && !defined(WIN32)
+       int bind_iface;
+#endif
        const struct lws_protocols *protocols;
        void **protocol_vh_privs;
        const struct lws_protocol_vhost_options *pvo;
@@ -935,6 +938,11 @@ struct lws_context {
        const struct lws_protocol_vhost_options *reject_service_keywords;
        lws_reload_func deprecation_cb;
 
+#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
+       cap_value_t caps[4];
+       char count_caps;
+#endif
+
 #if defined(LWS_USE_LIBEV)
        lws_ev_signal_cb_t * lws_ev_sigint_cb;
 #endif
@@ -1442,18 +1450,36 @@ struct _lws_websocket_related {
 
 #ifdef LWS_WITH_CGI
 
+enum {
+       SIGNIFICANT_HDR_CONTENT_LENGTH,
+       SIGNIFICANT_HDR_LOCATION,
+       SIGNIFICANT_HDR_STATUS,
+       SIGNIFICANT_HDR_TRANSFER_ENCODING,
+
+       SIGNIFICANT_HDR_COUNT
+};
+
 /* wsi who is master of the cgi points to an lws_cgi */
 
 struct lws_cgi {
        struct lws_cgi *cgi_list;
        struct lws *stdwsi[3]; /* points to the associated stdin/out/err wsis */
        struct lws *wsi; /* owner */
+       unsigned char *headers_buf;
+       unsigned char *headers_pos;
+       unsigned char *headers_dumped;
+       unsigned char *headers_end;
        unsigned long content_length;
        unsigned long content_length_seen;
        int pipe_fds[3][2];
+       int match[SIGNIFICANT_HDR_COUNT];
        int pid;
+       int response_code;
+       int lp;
+       char l[12];
 
        unsigned int being_closed:1;
+       unsigned int explicitly_chunked:1;
 
        unsigned char chunked_grace;
 };
@@ -1656,6 +1682,11 @@ LWS_EXTERN int
 lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
                const char *iface);
 
+#if defined(LWS_USE_IPV6)
+LWS_EXTERN unsigned long
+lws_get_addr_scope(const char *ipaddr);
+#endif
+
 LWS_EXTERN void
 lws_close_free_wsi(struct lws *wsi, enum lws_close_status);
 
@@ -2145,6 +2176,8 @@ LWS_EXTERN unsigned long long
 time_in_microseconds(void);
 LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
 lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt);
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_plat_inet_pton(int af, const char *src, void *dst);
 
 LWS_EXTERN int LWS_WARN_UNUSED_RESULT
 lws_check_utf8(unsigned char *state, unsigned char *buf, size_t len);