[Libwebsockets] LibWebSockets Error when compiling for VS 2008

FNA aqiruse at gmail.com
Sat Jan 19 07:25:01 CET 2013


I forget now the exact origins. I believe it came from the
support-chrome-20-firefox-12.tar.gz<http://git.warmcat.com/cgi-bin/cgit/libwebsockets/snapshot/support-chrome-20-firefox-12.tar.gz>
file. If not, then I must
have downloaded the zlib for windows and used its sources. But I believe I
used the one from Chrome 20 as that is
the last version I was working with.


On Sat, Jan 19, 2013 at 1:01 AM, "Andy Green (林安廸)" <andy at warmcat.com>wrote:

> On 19/01/13 13:53, the mail apparently from FNA included:
>
>  The original version was from the download file
>> of libwebsockets-1.0-chrome25-**firefox17 on your site. Attached is the
>> original version.
>>
>
> Thanks I pushed it here
>
> http://git.libwebsockets.org/**cgi-bin/cgit/libwebsockets/**commit/?id=**
> 0bf3ef605d4deb4622d7387caffd28**a4a471e40f<http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/commit/?id=0bf3ef605d4deb4622d7387caffd28a4a471e40f>
>
> Can you also let me know what the working win32 zlib came from?
>
> Thanks,
>
> -Andy
>
>  On Sat, Jan 19, 2013 at 12:40 AM, "Andy Green (林安廸)"
>> <andy at warmcat.com <mailto:andy at warmcat.com>> wrote:
>>
>>     On 19/01/13 13:20, the mail apparently from FNA included:
>>
>>     (Can I ask you to sign up to this mailing list
>>
>>     http://ml.libwebsockets.org/__**mailman/listinfo/libwebsockets<http://ml.libwebsockets.org/__mailman/listinfo/libwebsockets>
>>
>>     <http://ml.libwebsockets.org/**mailman/listinfo/libwebsockets<http://ml.libwebsockets.org/mailman/listinfo/libwebsockets>
>> **>
>>
>>     and we can continue there where other interested parties might chip
>>     in...)
>>
>>
>>         Dear Andy Green,
>>
>>         I just downloaded the updated version of LibWebSockets for
>>         Chrome 25.
>>         When I try to compile it wil VS 2008 as a library I have a few
>>         errors. I
>>         was not able to get the included version of zlib to compile at
>>         all in VS
>>         2008, so i decided to use the version from a previous install of
>>         libwebsockets that i had. Anyways, I am attaching the changes I
>>         made to
>>         private-libwebockets.h file. There were not many changes that
>>         needed to
>>         occur, but a few and then it compiles fine with the previous
>>         version of
>>         zlib.
>>
>>
>>     OK.  I'm very glad you sent me your changes, because I am not
>>     testing at all on Windows.  I expected it's not far off correct
>>     since it has been correct in the last weeks.
>>
>>
>>         Here is the file as I have it. You will notice that i added some
>> #if
>>         #else #endif to the file for just a few headers. I Am also
>>         attaching the
>>         file in source code format to make it easier.
>>
>>
>>     I'm grateful for the file however it's coming, but can you let me
>>     know what the original version was?  Either a copy of the original
>>     file itself or your git HEAD that you cloned before your changes,
>>     the output of
>>
>>     git log --oneline -n 1
>>
>>     will be fine
>>
>>     Thanks
>>
>>     -Andy
>>
>>         Sincerely,
>>
>>         Fred Ackers
>>
>>         /*
>>            * libwebsockets - small server side websockets and web server
>>         implementation
>>            *
>>            * Copyright (C) 2010 Andy Green <andy at warmcat.com
>>         <mailto:andy at warmcat.com>
>>         <mailto:andy at warmcat.com <mailto:andy at warmcat.com>>>
>>
>>
>>            *
>>            *  This library is free software; you can redistribute it
>> and/or
>>            *  modify it under the terms of the GNU Lesser General Public
>>            *  License as published by the Free Software Foundation:
>>            *  version 2.1 of the License.
>>            *
>>            *  This library is distributed in the hope that it will be
>>         useful,
>>            *  but WITHOUT ANY WARRANTY; without even the implied warranty
>> of
>>            *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
>>         the GNU
>>            *  Lesser General Public License for more details.
>>            *
>>            *  You should have received a copy of the GNU Lesser General
>>         Public
>>            *  License along with this library; if not, write to the Free
>>         Software
>>            *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
>>            *  MA  02110-1301  USA
>>            */
>>         #if _MSC_VER > 1000 || defined(_WIN32)
>>         #else
>>         #include <unistd.h>
>>         #include <strings.h>
>>         #endif
>>         #include <stdio.h>
>>         #include <stdlib.h>
>>         #include <string.h>
>>         #include <ctype.h>
>>         #include <errno.h>
>>         #include <fcntl.h>
>>         #include <signal.h>
>>         #ifdef  __MINGW64__
>>         #else
>>         #ifdef  __MINGW32__
>>         #elif _MSC_VER > 1000 || defined(_WIN32)
>>         #else
>>         #include <netdb.h>
>>         #endif
>>         #endif
>>         #include <stdarg.h>
>>
>>         #include <sys/stat.h>
>>
>>         #ifdef WIN32
>>         #ifdef  __MINGW64__
>>         #else
>>         #ifdef  __MINGW32__
>>         #else
>>         #include <time.h >
>>         #endif
>>         #endif
>>         #include <winsock2.h>
>>         #include <ws2ipdef.h>
>>         #include <windows.h>
>>
>>         #else
>>
>>         #include <sys/types.h>
>>         #include <sys/socket.h>
>>         #ifndef LWS_NO_FORK
>>         #ifdef HAVE_SYS_PRCTL_H
>>         #include <sys/prctl.h>
>>         #endif
>>         #endif
>>         #include <netinet/in.h>
>>         #include <netinet/tcp.h>
>>         #include <arpa/inet.h>
>>
>>         #include <poll.h>
>>         #include <sys/mman.h>
>>         #include <sys/time.h>
>>
>>         #endif
>>
>>         #ifdef LWS_OPENSSL_SUPPORT
>>         #include <openssl/ssl.h>
>>         #include <openssl/evp.h>
>>         #include <openssl/err.h>
>>         #include <openssl/md5.h>
>>         #include <openssl/sha.h>
>>         #endif
>>
>>
>>         #include "libwebsockets.h"
>>
>>         #if 0
>>         #define DEBUG
>>         #endif
>>
>>         #ifdef DEBUG
>>         #ifdef WIN32
>>         static
>>         #else
>>         static inline
>>         #endif
>>         void debug(const char *format, ...)
>>         {
>>         va_list ap;
>>         va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap);
>>         }
>>         #else
>>         #ifdef WIN32
>>         #define debug(...)
>>         #else
>>         static inline
>>         void debug(const char *format, ...)
>>         {
>>         }
>>         #endif
>>         #endif
>>
>>
>>         /*
>>            * Mac OSX as well as iOS do not define the MSG_NOSIGNAL flag,
>>            * but happily have something equivalent in the SO_NOSIGPIPE
>> flag.
>>            */
>>         #ifdef __APPLE__
>>         #define MSG_NOSIGNAL SO_NOSIGPIPE
>>         #endif
>>
>>
>>         #define FD_HASHTABLE_MODULUS 32
>>         #define MAX_CLIENTS 100
>>         #define LWS_MAX_HEADER_NAME_LENGTH 64
>>         #define LWS_MAX_HEADER_LEN 4096
>>         #define LWS_INITIAL_HDR_ALLOC 256
>>         #define LWS_ADDITIONAL_HDR_ALLOC 64
>>         #define MAX_USER_RX_BUFFER 4096
>>         #define MAX_BROADCAST_PAYLOAD 4096
>>         #define LWS_MAX_PROTOCOLS 10
>>         #define LWS_MAX_EXTENSIONS_ACTIVE 10
>>         #define SPEC_LATEST_SUPPORTED 13
>>         #define AWAITING_TIMEOUT 5
>>         #define CIPHERS_LIST_STRING "DEFAULT"
>>
>>         #define MAX_WEBSOCKET_04_KEY_LEN 128
>>         #define SYSTEM_RANDOM_FILEPATH "/dev/urandom"
>>
>>         enum lws_websocket_opcodes_04 {
>>         LWS_WS_OPCODE_04__CONTINUATION = 0,
>>         LWS_WS_OPCODE_04__CLOSE = 1,
>>         LWS_WS_OPCODE_04__PING = 2,
>>         LWS_WS_OPCODE_04__PONG = 3,
>>         LWS_WS_OPCODE_04__TEXT_FRAME = 4,
>>         LWS_WS_OPCODE_04__BINARY_FRAME = 5,
>>
>>         LWS_WS_OPCODE_04__RESERVED_6 = 6,
>>         LWS_WS_OPCODE_04__RESERVED_7 = 7,
>>         LWS_WS_OPCODE_04__RESERVED_8 = 8,
>>         LWS_WS_OPCODE_04__RESERVED_9 = 9,
>>         LWS_WS_OPCODE_04__RESERVED_A = 0xa,
>>         LWS_WS_OPCODE_04__RESERVED_B = 0xb,
>>         LWS_WS_OPCODE_04__RESERVED_C = 0xc,
>>         LWS_WS_OPCODE_04__RESERVED_D = 0xd,
>>         LWS_WS_OPCODE_04__RESERVED_E = 0xe,
>>         LWS_WS_OPCODE_04__RESERVED_F = 0xf,
>>         };
>>
>>         enum lws_websocket_opcodes_07 {
>>         LWS_WS_OPCODE_07__CONTINUATION = 0,
>>         LWS_WS_OPCODE_07__TEXT_FRAME = 1,
>>         LWS_WS_OPCODE_07__BINARY_FRAME = 2,
>>
>>         LWS_WS_OPCODE_07__NOSPEC__MUX = 7,
>>
>>         /* control extensions 8+ */
>>
>>         LWS_WS_OPCODE_07__CLOSE = 8,
>>         LWS_WS_OPCODE_07__PING = 9,
>>         LWS_WS_OPCODE_07__PONG = 0xa,
>>         };
>>
>>
>>         enum lws_connection_states {
>>         WSI_STATE_HTTP,
>>         WSI_STATE_HTTP_HEADERS,
>>         WSI_STATE_DEAD_SOCKET,
>>         WSI_STATE_ESTABLISHED,
>>         WSI_STATE_CLIENT_UNCONNECTED,
>>         WSI_STATE_RETURNED_CLOSE___**ALREADY,
>>
>>         WSI_STATE_AWAITING_CLOSE_ACK,
>>         };
>>
>>         enum lws_rx_parse_state {
>>         LWS_RXPS_NEW,
>>
>>         LWS_RXPS_SEEN_76_FF,
>>         LWS_RXPS_PULLING_76_LENGTH,
>>         LWS_RXPS_EAT_UNTIL_76_FF,
>>
>>         LWS_RXPS_04_MASK_NONCE_1,
>>         LWS_RXPS_04_MASK_NONCE_2,
>>         LWS_RXPS_04_MASK_NONCE_3,
>>
>>         LWS_RXPS_04_FRAME_HDR_1,
>>         LWS_RXPS_04_FRAME_HDR_LEN,
>>         LWS_RXPS_04_FRAME_HDR_LEN16_2,
>>         LWS_RXPS_04_FRAME_HDR_LEN16_1,
>>         LWS_RXPS_04_FRAME_HDR_LEN64_8,
>>         LWS_RXPS_04_FRAME_HDR_LEN64_7,
>>         LWS_RXPS_04_FRAME_HDR_LEN64_6,
>>         LWS_RXPS_04_FRAME_HDR_LEN64_5,
>>         LWS_RXPS_04_FRAME_HDR_LEN64_4,
>>         LWS_RXPS_04_FRAME_HDR_LEN64_3,
>>         LWS_RXPS_04_FRAME_HDR_LEN64_2,
>>         LWS_RXPS_04_FRAME_HDR_LEN64_1,
>>
>>         LWS_RXPS_07_COLLECT_FRAME_KEY_**__1,
>>         LWS_RXPS_07_COLLECT_FRAME_KEY_**__2,
>>         LWS_RXPS_07_COLLECT_FRAME_KEY_**__3,
>>         LWS_RXPS_07_COLLECT_FRAME_KEY_**__4,
>>
>>         LWS_RXPS_PAYLOAD_UNTIL_LENGTH_**__EXHAUSTED
>>
>>         };
>>
>>
>>         enum connection_mode {
>>         LWS_CONNMODE_WS_SERVING,
>>         LWS_CONNMODE_WS_CLIENT,
>>
>>         /* transient modes */
>>         LWS_CONNMODE_WS_CLIENT___**WAITING_PROXY_REPLY,
>>         LWS_CONNMODE_WS_CLIENT_ISSUE__**_HANDSHAKE,
>>         LWS_CONNMODE_WS_CLIENT___**WAITING_SERVER_REPLY,
>>         LWS_CONNMODE_WS_CLIENT___**WAITING_EXTENSION_CONNECT,
>>         LWS_CONNMODE_WS_CLIENT___**PENDING_CANDIDATE_CHILD,
>>
>>
>>         /* special internal types */
>>         LWS_CONNMODE_SERVER_LISTENER,
>>         LWS_CONNMODE_BROADCAST_PROXY__**_LISTENER,
>>
>>         LWS_CONNMODE_BROADCAST_PROXY
>>         };
>>
>>
>>         #define LWS_FD_HASH(fd) ((fd ^ (fd >> 8) ^ (fd >> 16)) %
>>         FD_HASHTABLE_MODULUS)
>>
>>         struct libwebsocket_fd_hashtable {
>>         struct libwebsocket *wsi[MAX_CLIENTS + 1];
>>         int length;
>>         };
>>
>>         struct libwebsocket_protocols;
>>
>>         struct libwebsocket_context {
>>         struct libwebsocket_fd_hashtable
>>         fd_hashtable[FD_HASHTABLE___**MODULUS];
>>
>>         struct pollfd fds[MAX_CLIENTS * FD_HASHTABLE_MODULUS + 1];
>>         int fds_count;
>>         int listen_port;
>>         char http_proxy_address[256];
>>         char canonical_hostname[1024];
>>         unsigned int http_proxy_port;
>>         unsigned int options;
>>         unsigned long last_timeout_check_s;
>>
>>         int fd_random;
>>
>>         #ifdef LWS_OPENSSL_SUPPORT
>>         int use_ssl;
>>         SSL_CTX *ssl_ctx;
>>         SSL_CTX *ssl_client_ctx;
>>         #endif
>>         struct libwebsocket_protocols *protocols;
>>         int count_protocols;
>>         struct libwebsocket_extension *extensions;
>>
>>               void *user_space;
>>         };
>>
>>
>>         enum pending_timeout {
>>         NO_PENDING_TIMEOUT = 0,
>>         PENDING_TIMEOUT_AWAITING___**PROXY_RESPONSE,
>>         PENDING_TIMEOUT_ESTABLISH___**WITH_SERVER,
>>         PENDING_TIMEOUT_AWAITING___**SERVER_RESPONSE,
>>         PENDING_TIMEOUT_AWAITING_PING,
>>         PENDING_TIMEOUT_CLOSE_ACK,
>>         PENDING_TIMEOUT_AWAITING___**EXTENSION_CONNECT_RESPONSE,
>>
>>         };
>>
>>
>>         /*
>>            * This is totally opaque to code using the library.  It's
>>         exported as a
>>            * forward-reference pointer-only declaration; the user can
>>         use the
>>         pointer with
>>            * other APIs to get information out of it.
>>            */
>>
>>         struct libwebsocket {
>>         const struct libwebsocket_protocols *protocol;
>>         struct libwebsocket_extension *
>>             active_extensions[LWS_MAX___**EXTENSIONS_ACTIVE];
>>         void *active_extensions_user[LWS___**MAX_EXTENSIONS_ACTIVE];
>>
>>         int count_active_extensions;
>>
>>         enum lws_connection_states state;
>>
>>         char name_buffer[LWS_MAX_HEADER___**NAME_LENGTH];
>>
>>         int name_buffer_pos;
>>         int current_alloc_len;
>>         enum lws_token_indexes parser_state;
>>         struct lws_tokens utf8_token[WSI_TOKEN_COUNT];
>>         int ietf_spec_revision;
>>         char rx_user_buffer[LWS_SEND___**BUFFER_PRE_PADDING +
>>
>>         MAX_USER_RX_BUFFER +
>>            LWS_SEND_BUFFER_POST_PADDING];
>>         int rx_user_buffer_head;
>>         enum libwebsocket_write_protocol rx_frame_type;
>>         int protocol_index_for_broadcast__**_proxy;
>>
>>         enum pending_timeout pending_timeout;
>>         unsigned long pending_timeout_limit;
>>
>>         int sock;
>>
>>         enum lws_rx_parse_state lws_rx_parse_state;
>>         char extension_data_pending;
>>         struct libwebsocket *candidate_children_list;
>>         struct libwebsocket *extension_handles;
>>
>>         /* 04 protocol specific */
>>
>>         char key_b64[150];
>>         unsigned char masking_key_04[20];
>>         unsigned char frame_masking_nonce_04[4];
>>         unsigned char frame_mask_04[20];
>>         unsigned char frame_mask_index;
>>         size_t rx_packet_length;
>>         unsigned char opcode;
>>         unsigned char final;
>>         unsigned char rsv;
>>
>>         int pings_vs_pongs;
>>         unsigned char (*xor_mask)(struct libwebsocket *, unsigned char);
>>         char all_zero_nonce;
>>
>>         enum lws_close_status close_reason;
>>
>>         /* 07 specific */
>>         char this_frame_masked;
>>
>>         /* client support */
>>         char initial_handshake_hash_base64[**__30];
>>
>>         enum connection_mode mode;
>>         char *c_path;
>>         char *c_host;
>>         char *c_origin;
>>         char *c_protocol;
>>         callback_function *c_callback;
>>
>>         char *c_address;
>>         int c_port;
>>
>>
>>         #ifdef LWS_OPENSSL_SUPPORT
>>         SSL *ssl;
>>         BIO *client_bio;
>>         int use_ssl;
>>         #endif
>>
>>         void *user_space;
>>         };
>>
>>         extern int
>>         libwebsocket_client_rx_sm(__**struct libwebsocket *wsi, unsigned
>>
>>         char c);
>>
>>         extern int
>>         libwebsocket_parse(struct libwebsocket *wsi, unsigned char c);
>>
>>         extern int
>>         libwebsocket_interpret___**incoming_packet(struct libwebsocket
>> *wsi,
>>
>>         unsigned char *buf, size_t len);
>>
>>         extern int
>>         libwebsocket_read(struct libwebsocket_context *context,
>>         struct libwebsocket *wsi,
>>                 unsigned char *buf, size_t len);
>>
>>         extern int
>>         lws_b64_selftest(void);
>>
>>         extern unsigned char
>>         xor_no_mask(struct libwebsocket *wsi, unsigned char c);
>>
>>         extern unsigned char
>>         xor_mask_04(struct libwebsocket *wsi, unsigned char c);
>>
>>         extern unsigned char
>>         xor_mask_05(struct libwebsocket *wsi, unsigned char c);
>>
>>         extern struct libwebsocket *
>>         wsi_from_fd(struct libwebsocket_context *context, int fd);
>>
>>         extern int
>>         insert_wsi(struct libwebsocket_context *context, struct
>>         libwebsocket *wsi);
>>
>>         extern int
>>         delete_from_fd(struct libwebsocket_context *context, int fd);
>>
>>         extern void
>>         libwebsocket_set_timeout(__**struct libwebsocket *wsi,
>>
>>         enum pending_timeout reason, int secs);
>>
>>         extern int
>>         lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf,
>>         size_t len);
>>
>>
>>         extern void
>>         libwebsocket_service_timeout__**_check(struct
>> libwebsocket_context
>>
>>         *context,
>>              struct libwebsocket *wsi, unsigned int sec);
>>
>>         extern struct libwebsocket *
>>         __libwebsocket_client_connect_**__2(struct libwebsocket_context
>>
>>         *context,
>>         struct libwebsocket *wsi);
>>
>>         extern struct libwebsocket *
>>         libwebsocket_create_new___**server_wsi(struct
>> libwebsocket_context
>>         *context);
>>
>>         extern char *
>>         libwebsockets_generate_client_**__handshake(struct
>>
>>         libwebsocket_context
>>         *context,
>>         struct libwebsocket *wsi, char *pkt);
>>
>>         extern int
>>         lws_handle_POLLOUT_event(__**struct libwebsocket_context
>> *context,
>>
>>                struct libwebsocket *wsi, struct pollfd *pollfd);
>>
>>         extern int
>>         lws_any_extension_handled(__**struct libwebsocket_context
>> *context,
>>            struct libwebsocket *wsi,
>>            enum libwebsocket_extension___**callback_reasons r,
>>
>>            void *v, size_t len);
>>
>>         extern void *
>>         lws_get_extension_user___**matching_ext(struct libwebsocket *wsi,
>>
>>            struct libwebsocket_extension *ext);
>>
>>         extern int
>>         lws_client_interpret_server___**handshake(struct
>>
>>         libwebsocket_context *context,
>>         struct libwebsocket *wsi);
>>
>>         extern int
>>         libwebsocket_rx_sm(struct libwebsocket *wsi, unsigned char c);
>>
>>         extern int
>>         lws_issue_raw_ext_access(__**struct libwebsocket *wsi,
>>
>>         unsigned char *buf, size_t len);
>>
>>         #ifndef LWS_OPENSSL_SUPPORT
>>
>>         unsigned char *
>>         SHA1(const unsigned char *d, size_t n, unsigned char *md);
>>
>>         void
>>         MD5(const unsigned char *input, int ilen, unsigned char *output);
>>
>>         #endif
>>
>>
>>         --
>>         --A programmer started to cuss
>>         --Because getting to sleep was a fuss
>>         --As he lay there in bed
>>         --Looping 'round in his head
>>         --was: while( !asleep() ) sheep++;
>>         --Nothing is impossible! It is merely a matter of figuring out
>> How?
>>
>>
>>
>>
>>
>> --
>> --A programmer started to cuss
>> --Because getting to sleep was a fuss
>> --As he lay there in bed
>> --Looping 'round in his head
>> --was: while( !asleep() ) sheep++;
>> --Nothing is impossible! It is merely a matter of figuring out How?
>>
>
>


-- 
--A programmer started to cuss
--Because getting to sleep was a fuss
--As he lay there in bed
--Looping 'round in his head
--was: while( !asleep() ) sheep++;
--Nothing is impossible! It is merely a matter of figuring out How?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20130119/f9c70136/attachment-0001.html>


More information about the Libwebsockets mailing list