LWS_CALLBACK_USER = 1000, /* user code can use any including / above */
};
-// argument structure for all external poll related calls
-// passed in via 'in'
-struct libwebsocket_pollargs {
- int fd; // applicable file descriptor
- int events; // the new event mask
- int prev_events; // the previous event mask
-};
-
-#if defined(_WIN32) && (_WIN32_WINNT < 0x0600)
+#if defined(_WIN32) && (_WIN32_WINNT < 0x0600)
+typedef SOCKET lws_sockfd_type;
struct libwebsocket_pollfd {
- SOCKET fd;
+ lws_sockfd_type fd;
SHORT events;
SHORT revents;
};
WINSOCK_API_LINKAGE int WSAAPI WSAPoll(struct libwebsocket_pollfd fdArray[], ULONG fds, INT timeout);
#else
+
+#if defined(MBED_OPERATORS)
+typedef int lws_sockfd_type;
+struct pollfd {
+ lws_sockfd_type *fd;
+ short events;
+ short revents;
+};
+#define POLLIN 0x0001
+#define POLLPRI 0x0002
+#define POLLOUT 0x0004
+#define POLLERR 0x0008
+#define POLLHUP 0x0010
+#define POLLNVAL 0x0020
+#else
+typedef int lws_fd_type;
+#endif
+
#define libwebsocket_pollfd pollfd
#endif
+// argument structure for all external poll related calls
+// passed in via 'in'
+struct libwebsocket_pollargs {
+ lws_sockfd_type fd; // applicable file descriptor
+ int events; // the new event mask
+ int prev_events; // the previous event mask
+};
+
enum libwebsocket_extension_callback_reasons {
LWS_EXT_CALLBACK_SERVER_CONTEXT_CONSTRUCT,
LWS_EXT_CALLBACK_CLIENT_CONTEXT_CONSTRUCT,
LWS_VISIBLE LWS_EXTERN void
libwebsockets_get_peer_addresses(struct libwebsocket_context *context,
- struct libwebsocket *wsi, int fd, char *name, int name_len,
+ struct libwebsocket *wsi, lws_sockfd_type fd, char *name, int name_len,
char *rip, int rip_len);
LWS_VISIBLE LWS_EXTERN int
int fd_random;
int listen_service_modulo;
int listen_service_count;
- int listen_service_fd;
+ lws_sockfd_type listen_service_fd;
int listen_service_extraseen;
/*
LWS_EXTERN void lws_feature_status_libev(struct lws_context_creation_info *info);
LWS_EXTERN void
lws_libev_accept(struct libwebsocket_context *context,
- struct libwebsocket *new_wsi, int accept_fd);
+ struct libwebsocket *new_wsi, lws_sockfd_type accept_fd);
LWS_EXTERN void
lws_libev_io(struct libwebsocket_context *context,
struct libwebsocket *wsi, int flags);
#if defined(WIN32) || defined(_WIN32)
HANDLE fd;
#else
- int fd;
+ lws_sockfd_type fd;
#endif
unsigned long filepos;
unsigned long filelen;
char pending_timeout; /* enum pending_timeout */
time_t pending_timeout_limit;
- int sock;
+ lws_sockfd_type sock;
int position_in_fds_table;
#ifdef LWS_LATENCY
unsigned long action_start;
#ifdef _WIN32
LWS_EXTERN struct libwebsocket *
-wsi_from_fd(struct libwebsocket_context *context, int fd);
+wsi_from_fd(struct libwebsocket_context *context, lws_sockfd_type fd);
LWS_EXTERN int
insert_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi);
LWS_EXTERN int
-delete_from_fd(struct libwebsocket_context *context, int fd);
+delete_from_fd(struct libwebsocket_context *context, lws_sockfd_type fd);
#else
#define wsi_from_fd(A,B) A->lws_lookup[B]
#define insert_wsi(A,B) A->lws_lookup[B->sock]=B
#endif
LWS_EXTERN int
-lws_plat_set_socket_options(struct libwebsocket_context *context, int fd);
+lws_plat_set_socket_options(struct libwebsocket_context *context, lws_sockfd_type fd);
LWS_EXTERN int
lws_allocate_header_table(struct libwebsocket *wsi);
LWS_EXTERN int
lws_server_socket_service_ssl(struct libwebsocket_context *context,
struct libwebsocket **wsi, struct libwebsocket *new_wsi,
- int accept_fd, struct libwebsocket_pollfd *pollfd);
+ lws_sockfd_type accept_fd, struct libwebsocket_pollfd *pollfd);
LWS_EXTERN int
lws_ssl_close(struct libwebsocket *wsi);
LWS_EXTERN void