mirror of https://github.com/aria2/aria2
Updated wslay
parent
4c4e1dcf9b
commit
16d67e9b32
|
@ -31,6 +31,10 @@ AC_SUBST(LT_CURRENT, 0)
|
|||
AC_SUBST(LT_REVISION, 0)
|
||||
AC_SUBST(LT_AGE, 0)
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AM_INIT_AUTOMAKE()
|
||||
|
@ -51,6 +55,13 @@ AC_CHECK_LIB([cunit], [CU_initialize_registry],
|
|||
[have_cunit=yes], [have_cunit=no])
|
||||
AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ])
|
||||
|
||||
case "$target" in
|
||||
*mingw*)
|
||||
# Required for ntoh*/hton* functions.
|
||||
LIBS="-lws2_32 $LIBS"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([ \
|
||||
arpa/inet.h \
|
||||
|
@ -62,6 +73,13 @@ AC_CHECK_HEADERS([ \
|
|||
unistd.h \
|
||||
])
|
||||
|
||||
# Need winsock2.h for ntoh*/hton* functions.
|
||||
case "$target" in
|
||||
*mingw*)
|
||||
AC_CHECK_HEADERS([winsock2.h])
|
||||
;;
|
||||
esac
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_SSIZE_T
|
||||
|
@ -73,7 +91,9 @@ AC_CHECK_TYPES([ptrdiff_t])
|
|||
AC_C_BIGENDIAN
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
if test "x$cross_compiling" != "xyes"; then
|
||||
AC_FUNC_MALLOC
|
||||
fi
|
||||
AC_CHECK_FUNCS([ \
|
||||
memmove \
|
||||
memset \
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
SUBDIRS = includes
|
||||
|
||||
AM_CFLAGS = -Wall
|
||||
AM_CPPFLAGS = -I$(srcdir)/includes -I$(builddir)/includes
|
||||
AM_CPPFLAGS = @DEFS@ -I$(srcdir)/includes -I$(builddir)/includes
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libwslay.pc
|
||||
|
|
|
@ -507,12 +507,12 @@ static void wslay_event_call_on_frame_recv_chunk_callback
|
|||
(wslay_event_context_ptr ctx, const struct wslay_frame_iocb *iocb)
|
||||
{
|
||||
if(ctx->callbacks.on_frame_recv_chunk_callback) {
|
||||
struct wslay_event_on_frame_recv_chunk_arg arg = {
|
||||
iocb->data, iocb->data_length
|
||||
};
|
||||
struct wslay_event_on_frame_recv_chunk_arg arg;
|
||||
arg.data = iocb->data;
|
||||
arg.data_length = iocb->data_length;
|
||||
ctx->callbacks.on_frame_recv_chunk_callback(ctx, &arg, ctx->user_data);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void wslay_event_call_on_frame_recv_end_callback
|
||||
(wslay_event_context_ptr ctx)
|
||||
|
@ -697,9 +697,10 @@ int wslay_event_recv(wslay_event_context_ptr ctx)
|
|||
return r;
|
||||
}
|
||||
} else if(ctx->imsg->opcode == WSLAY_PING) {
|
||||
struct wslay_event_msg arg = {
|
||||
WSLAY_PONG, msg, ctx->imsg->msg_length
|
||||
};
|
||||
struct wslay_event_msg arg;
|
||||
arg.opcode = WSLAY_PONG;
|
||||
arg.msg = msg;
|
||||
arg.msg_length = ctx->imsg->msg_length;
|
||||
if((r = wslay_event_queue_msg(ctx, &arg)) &&
|
||||
r != WSLAY_ERR_NO_MORE_MSG) {
|
||||
ctx->read_enabled = 0;
|
||||
|
|
|
@ -73,7 +73,7 @@ struct wslay_event_frame_user_data {
|
|||
enum wslay_event_close_status {
|
||||
WSLAY_CLOSE_RECEIVED = 1 << 0,
|
||||
WSLAY_CLOSE_QUEUED = 1 << 1,
|
||||
WSLAY_CLOSE_SENT = 1 << 2,
|
||||
WSLAY_CLOSE_SENT = 1 << 2
|
||||
};
|
||||
|
||||
enum wslay_event_config {
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif // HAVE_ARPA_INET_H
|
||||
#include <assert.h>
|
||||
|
||||
#include "wslay_net.h"
|
||||
|
@ -142,17 +139,18 @@ ssize_t wslay_frame_send(wslay_frame_context_ptr ctx,
|
|||
const uint8_t *datamark = iocb->data,
|
||||
*datalimit = iocb->data+iocb->data_length;
|
||||
while(datamark < datalimit) {
|
||||
size_t datalen = datalimit - datamark;
|
||||
const uint8_t *writelimit = datamark+
|
||||
wslay_min(sizeof(temp), datalimit-datamark);
|
||||
wslay_min(sizeof(temp), datalen);
|
||||
size_t writelen = writelimit-datamark;
|
||||
ssize_t r;
|
||||
int i;
|
||||
size_t i;
|
||||
for(i = 0; i < writelen; ++i) {
|
||||
temp[i] = datamark[i]^ctx->omaskkey[(ctx->opayloadoff+i)%4];
|
||||
}
|
||||
r = ctx->callbacks.send_callback(temp, writelen, 0, ctx->user_data);
|
||||
if(r > 0) {
|
||||
if(r > writelen) {
|
||||
if((size_t)r > writelen) {
|
||||
return WSLAY_ERR_INVALID_CALLBACK;
|
||||
} else {
|
||||
datamark += r;
|
||||
|
@ -172,7 +170,7 @@ ssize_t wslay_frame_send(wslay_frame_context_ptr ctx,
|
|||
r = ctx->callbacks.send_callback(iocb->data, iocb->data_length, 0,
|
||||
ctx->user_data);
|
||||
if(r > 0) {
|
||||
if(r > iocb->data_length) {
|
||||
if((size_t)r > iocb->data_length) {
|
||||
return WSLAY_ERR_INVALID_CALLBACK;
|
||||
} else {
|
||||
ctx->opayloadoff += r;
|
||||
|
@ -216,7 +214,7 @@ static ssize_t wslay_recv(wslay_frame_context_ptr ctx)
|
|||
return r;
|
||||
}
|
||||
|
||||
#define WSLAY_AVAIL_IBUF(ctx) (ctx->ibuflimit-ctx->ibufmark)
|
||||
#define WSLAY_AVAIL_IBUF(ctx) ((size_t)(ctx->ibuflimit - ctx->ibufmark))
|
||||
|
||||
ssize_t wslay_frame_recv(wslay_frame_context_ptr ctx,
|
||||
struct wslay_frame_iocb *iocb)
|
||||
|
|
|
@ -26,37 +26,11 @@
|
|||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
|
||||
static uint16_t byteswap16(uint16_t x)
|
||||
uint64_t wslay_byteswap64(uint64_t x)
|
||||
{
|
||||
return ((x & 0xffu) << 8) | (x >> 8);;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NTOHL
|
||||
# define byteswap32(x) ntohl(x)
|
||||
#else /* !HAVE_NTOHL */
|
||||
static uint32_t byteswap32(uint32_t x)
|
||||
{
|
||||
uint32_t u = byteswap16(x & 0xffffu);
|
||||
uint32_t l = byteswap16(x >> 16);
|
||||
return (u << 16) | l;
|
||||
}
|
||||
#endif /* !HAVE_NTOHL */
|
||||
|
||||
static uint64_t byteswap64(uint64_t x)
|
||||
{
|
||||
uint64_t u = byteswap32(x & 0xffffffffllu);
|
||||
uint64_t l = byteswap32(x >> 32);
|
||||
uint64_t u = ntohl(x & 0xffffffffllu);
|
||||
uint64_t l = ntohl(x >> 32);
|
||||
return (u << 32) | l;
|
||||
}
|
||||
|
||||
uint16_t wslay_byteswap16(uint16_t x)
|
||||
{
|
||||
return byteswap16(x);
|
||||
}
|
||||
|
||||
uint64_t wslay_byteswap64(uint64_t x)
|
||||
{
|
||||
return byteswap64(x);
|
||||
}
|
||||
|
||||
#endif /* !WORDS_BIGENDIAN */
|
||||
|
|
|
@ -37,25 +37,16 @@
|
|||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif /* HAVE_NETINET_IN_H */
|
||||
/* For Mingw build */
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
#endif /* HAVE_WINSOCK2_H */
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# ifndef HAVE_HTONS
|
||||
# define htons(x) (x)
|
||||
# endif /* !HAVE_HTONS */
|
||||
# ifndef HAVE_NTOHS
|
||||
# define ntohs(x) (x)
|
||||
# endif /* !HAVE_NTOHS */
|
||||
# define ntoh64(x) (x)
|
||||
# define hton64(x) (x)
|
||||
#else /* !WORDS_BIGENDIAN */
|
||||
uint16_t wslay_byteswap16(uint16_t x);
|
||||
uint64_t wslay_byteswap64(uint64_t x);
|
||||
# ifndef HAVE_HTONS
|
||||
# define htons(x) wslay_byteswap16(x)
|
||||
# endif /* !HAVE_HTONS */
|
||||
# ifndef HAVE_NTOHS
|
||||
# define ntohs(x) wslay_byteswap16(x)
|
||||
# endif /* !HAVE_NTOHS */
|
||||
# define ntoh64(x) wslay_byteswap64(x)
|
||||
# define hton64(x) wslay_byteswap64(x)
|
||||
#endif /* !WORDS_BIGENDIAN */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct wslay_queue* wslay_queue_new()
|
||||
struct wslay_queue* wslay_queue_new(void)
|
||||
{
|
||||
struct wslay_queue *queue = (struct wslay_queue*)malloc
|
||||
(sizeof(struct wslay_queue));
|
||||
|
@ -42,14 +42,15 @@ void wslay_queue_free(struct wslay_queue *queue)
|
|||
{
|
||||
if(!queue) {
|
||||
return;
|
||||
} else {
|
||||
struct wslay_queue_cell *p = queue->top;
|
||||
while(p) {
|
||||
struct wslay_queue_cell *next = p->next;
|
||||
free(p);
|
||||
p = next;
|
||||
}
|
||||
free(queue);
|
||||
}
|
||||
struct wslay_queue_cell *p = queue->top;
|
||||
while(p) {
|
||||
struct wslay_queue_cell *next = p->next;
|
||||
free(p);
|
||||
p = next;
|
||||
}
|
||||
free(queue);
|
||||
}
|
||||
|
||||
int wslay_queue_push(struct wslay_queue *queue, void *data)
|
||||
|
|
|
@ -41,7 +41,7 @@ struct wslay_queue {
|
|||
struct wslay_queue_cell *tail;
|
||||
};
|
||||
|
||||
struct wslay_queue* wslay_queue_new();
|
||||
struct wslay_queue* wslay_queue_new(void);
|
||||
void wslay_queue_free(struct wslay_queue *queue);
|
||||
int wslay_queue_push(struct wslay_queue *queue, void *data);
|
||||
int wslay_queue_push_front(struct wslay_queue *queue, void *data);
|
||||
|
|
|
@ -30,18 +30,18 @@
|
|||
#include "wslay_event_test.h"
|
||||
#include "wslay_queue_test.h"
|
||||
|
||||
int init_suite1(void)
|
||||
static int init_suite1(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int clean_suite1(void)
|
||||
static int clean_suite1(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
CU_pSuite pSuite = NULL;
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ static ssize_t fail_send_callback(wslay_event_context_ptr ctx,
|
|||
}
|
||||
|
||||
|
||||
void test_wslay_event_send_fragmented_msg()
|
||||
void test_wslay_event_send_fragmented_msg(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -166,7 +166,7 @@ void test_wslay_event_send_fragmented_msg()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_send_fragmented_msg_with_ctrl()
|
||||
void test_wslay_event_send_fragmented_msg_with_ctrl(void)
|
||||
{
|
||||
int i;
|
||||
wslay_event_context_ptr ctx;
|
||||
|
@ -214,7 +214,7 @@ void test_wslay_event_send_fragmented_msg_with_ctrl()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_send_ctrl_msg_first()
|
||||
void test_wslay_event_send_ctrl_msg_first(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -246,7 +246,7 @@ void test_wslay_event_send_ctrl_msg_first()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_queue_close()
|
||||
void test_wslay_event_queue_close(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -270,7 +270,7 @@ void test_wslay_event_queue_close()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_queue_close_without_code()
|
||||
void test_wslay_event_queue_close_without_code(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -284,7 +284,7 @@ void test_wslay_event_queue_close_without_code()
|
|||
ud.acc = &acc;
|
||||
wslay_event_context_server_init(&ctx, &callbacks, &ud);
|
||||
CU_ASSERT(0 == wslay_event_queue_msg(ctx, &ping));
|
||||
// See that ping is not sent because close frame is queued
|
||||
/* See that ping is not sent because close frame is queued */
|
||||
CU_ASSERT(0 == wslay_event_queue_close(ctx, 0, NULL, 0));
|
||||
CU_ASSERT(0 == wslay_event_send(ctx));
|
||||
CU_ASSERT(2 == acc.length);
|
||||
|
@ -295,7 +295,7 @@ void test_wslay_event_queue_close_without_code()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_recv_close_without_code()
|
||||
void test_wslay_event_recv_close_without_code(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -314,7 +314,7 @@ void test_wslay_event_recv_close_without_code()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_reply_close()
|
||||
void test_wslay_event_reply_close(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -360,7 +360,7 @@ void test_wslay_event_reply_close()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_no_more_msg()
|
||||
void test_wslay_event_no_more_msg(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -371,7 +371,7 @@ void test_wslay_event_no_more_msg()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_callback_failure()
|
||||
void test_wslay_event_callback_failure(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -398,7 +398,7 @@ static void no_buffering_callback(wslay_event_context_ptr ctx,
|
|||
}
|
||||
}
|
||||
|
||||
void test_wslay_event_no_buffering()
|
||||
void test_wslay_event_no_buffering(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -422,7 +422,7 @@ void test_wslay_event_no_buffering()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_frame_too_big()
|
||||
void test_wslay_event_frame_too_big(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
@ -455,7 +455,7 @@ void test_wslay_event_frame_too_big()
|
|||
wslay_event_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_event_message_too_big()
|
||||
void test_wslay_event_message_too_big(void)
|
||||
{
|
||||
wslay_event_context_ptr ctx;
|
||||
struct wslay_event_callbacks callbacks;
|
||||
|
|
|
@ -25,17 +25,17 @@
|
|||
#ifndef WSLAY_EVENT_TEST_H
|
||||
#define WSLAY_EVENT_TEST_H
|
||||
|
||||
void test_wslay_event_send_fragmented_msg();
|
||||
void test_wslay_event_send_fragmented_msg_with_ctrl();
|
||||
void test_wslay_event_send_ctrl_msg_first();
|
||||
void test_wslay_event_queue_close();
|
||||
void test_wslay_event_queue_close_without_code();
|
||||
void test_wslay_event_recv_close_without_code();
|
||||
void test_wslay_event_reply_close();
|
||||
void test_wslay_event_no_more_msg();
|
||||
void test_wslay_event_callback_failure();
|
||||
void test_wslay_event_no_buffering();
|
||||
void test_wslay_event_frame_too_big();
|
||||
void test_wslay_event_message_too_big();
|
||||
void test_wslay_event_send_fragmented_msg(void);
|
||||
void test_wslay_event_send_fragmented_msg_with_ctrl(void);
|
||||
void test_wslay_event_send_ctrl_msg_first(void);
|
||||
void test_wslay_event_queue_close(void);
|
||||
void test_wslay_event_queue_close_without_code(void);
|
||||
void test_wslay_event_recv_close_without_code(void);
|
||||
void test_wslay_event_reply_close(void);
|
||||
void test_wslay_event_no_more_msg(void);
|
||||
void test_wslay_event_callback_failure(void);
|
||||
void test_wslay_event_no_buffering(void);
|
||||
void test_wslay_event_frame_too_big(void);
|
||||
void test_wslay_event_message_too_big(void);
|
||||
|
||||
#endif // WSLAY_EVENT_TEST_H
|
||||
#endif /* WSLAY_EVENT_TEST_H */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "wslay_frame.h"
|
||||
|
||||
void test_wslay_frame_context_init()
|
||||
void test_wslay_frame_context_init(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks;
|
||||
|
@ -88,7 +88,7 @@ static ssize_t scripted_send_callback(const uint8_t* data, size_t len,
|
|||
return wlen;
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv()
|
||||
void test_wslay_frame_recv(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -114,7 +114,7 @@ void test_wslay_frame_recv()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv_1byte()
|
||||
void test_wslay_frame_recv_1byte(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -122,7 +122,7 @@ void test_wslay_frame_recv_1byte()
|
|||
NULL };
|
||||
struct scripted_data_feed df;
|
||||
struct wslay_frame_iocb iocb;
|
||||
int i;
|
||||
size_t i;
|
||||
/* Masked text frame containing "Hello" */
|
||||
uint8_t msg[] = { 0x81u, 0x85u, 0x37u, 0xfau, 0x21u, 0x3du, 0x7fu, 0x9fu,
|
||||
0x4du, 0x51u, 0x58u };
|
||||
|
@ -150,7 +150,7 @@ void test_wslay_frame_recv_1byte()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv_fragmented()
|
||||
void test_wslay_frame_recv_fragmented(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -187,7 +187,7 @@ void test_wslay_frame_recv_fragmented()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv_interleaved_ctrl_frame()
|
||||
void test_wslay_frame_recv_interleaved_ctrl_frame(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -236,7 +236,7 @@ void test_wslay_frame_recv_interleaved_ctrl_frame()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv_zero_payloadlen()
|
||||
void test_wslay_frame_recv_zero_payloadlen(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -261,7 +261,7 @@ void test_wslay_frame_recv_zero_payloadlen()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv_too_large_payload()
|
||||
void test_wslay_frame_recv_too_large_payload(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -278,7 +278,7 @@ void test_wslay_frame_recv_too_large_payload()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv_ctrl_frame_too_large_payload()
|
||||
void test_wslay_frame_recv_ctrl_frame_too_large_payload(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -295,7 +295,7 @@ void test_wslay_frame_recv_ctrl_frame_too_large_payload()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv_minimum_ext_payload16()
|
||||
void test_wslay_frame_recv_minimum_ext_payload16(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -312,7 +312,7 @@ void test_wslay_frame_recv_minimum_ext_payload16()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_recv_minimum_ext_payload64()
|
||||
void test_wslay_frame_recv_minimum_ext_payload64(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { NULL,
|
||||
|
@ -347,12 +347,12 @@ static ssize_t accumulator_send_callback(const uint8_t *buf, size_t len,
|
|||
static int static_genmask_callback(uint8_t *buf, size_t len,
|
||||
void* user_data)
|
||||
{
|
||||
const static uint8_t makskey[] = { 0x37u, 0xfau, 0x21u, 0x3du };
|
||||
static const uint8_t makskey[] = { 0x37u, 0xfau, 0x21u, 0x3du };
|
||||
memcpy(buf, makskey, 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void test_wslay_frame_send()
|
||||
void test_wslay_frame_send(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { accumulator_send_callback,
|
||||
|
@ -379,7 +379,7 @@ void test_wslay_frame_send()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_send_fragmented()
|
||||
void test_wslay_frame_send_fragmented(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { accumulator_send_callback,
|
||||
|
@ -416,7 +416,7 @@ void test_wslay_frame_send_fragmented()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_send_interleaved_ctrl_frame()
|
||||
void test_wslay_frame_send_interleaved_ctrl_frame(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { accumulator_send_callback,
|
||||
|
@ -467,7 +467,7 @@ void test_wslay_frame_send_interleaved_ctrl_frame()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_send_1byte_masked()
|
||||
void test_wslay_frame_send_1byte_masked(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { scripted_send_callback,
|
||||
|
@ -479,7 +479,7 @@ void test_wslay_frame_send_1byte_masked()
|
|||
0x4du, 0x51u, 0x58u };
|
||||
uint8_t hello[] = "Hello";
|
||||
struct scripted_data_feed df;
|
||||
int i;
|
||||
size_t i;
|
||||
scripted_data_feed_init(&df, NULL, 0);
|
||||
for(i = 0; i < sizeof(msg); ++i) {
|
||||
df.feedseq[i] = 1;
|
||||
|
@ -500,7 +500,7 @@ void test_wslay_frame_send_1byte_masked()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_send_zero_payloadlen()
|
||||
void test_wslay_frame_send_zero_payloadlen(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks = { accumulator_send_callback,
|
||||
|
@ -525,7 +525,7 @@ void test_wslay_frame_send_zero_payloadlen()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_send_too_large_payload()
|
||||
void test_wslay_frame_send_too_large_payload(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks;
|
||||
|
@ -542,7 +542,7 @@ void test_wslay_frame_send_too_large_payload()
|
|||
wslay_frame_context_free(ctx);
|
||||
}
|
||||
|
||||
void test_wslay_frame_send_ctrl_frame_too_large_payload()
|
||||
void test_wslay_frame_send_ctrl_frame_too_large_payload(void)
|
||||
{
|
||||
wslay_frame_context_ptr ctx;
|
||||
struct wslay_frame_callbacks callbacks;
|
||||
|
|
|
@ -25,22 +25,22 @@
|
|||
#ifndef WSLAY_FRAME_TEST_H
|
||||
#define WSLAY_FRAME_TEST_H
|
||||
|
||||
void test_wslay_frame_context_init();
|
||||
void test_wslay_frame_recv();
|
||||
void test_wslay_frame_recv_1byte();
|
||||
void test_wslay_frame_recv_fragmented();
|
||||
void test_wslay_frame_recv_interleaved_ctrl_frame();
|
||||
void test_wslay_frame_recv_zero_payloadlen();
|
||||
void test_wslay_frame_recv_too_large_payload();
|
||||
void test_wslay_frame_recv_ctrl_frame_too_large_payload();
|
||||
void test_wslay_frame_recv_minimum_ext_payload16();
|
||||
void test_wslay_frame_recv_minimum_ext_payload64();
|
||||
void test_wslay_frame_send();
|
||||
void test_wslay_frame_send_fragmented();
|
||||
void test_wslay_frame_send_interleaved_ctrl_frame();
|
||||
void test_wslay_frame_send_1byte_masked();
|
||||
void test_wslay_frame_send_zero_payloadlen();
|
||||
void test_wslay_frame_send_too_large_payload();
|
||||
void test_wslay_frame_send_ctrl_frame_too_large_payload();
|
||||
void test_wslay_frame_context_init(void);
|
||||
void test_wslay_frame_recv(void);
|
||||
void test_wslay_frame_recv_1byte(void);
|
||||
void test_wslay_frame_recv_fragmented(void);
|
||||
void test_wslay_frame_recv_interleaved_ctrl_frame(void);
|
||||
void test_wslay_frame_recv_zero_payloadlen(void);
|
||||
void test_wslay_frame_recv_too_large_payload(void);
|
||||
void test_wslay_frame_recv_ctrl_frame_too_large_payload(void);
|
||||
void test_wslay_frame_recv_minimum_ext_payload16(void);
|
||||
void test_wslay_frame_recv_minimum_ext_payload64(void);
|
||||
void test_wslay_frame_send(void);
|
||||
void test_wslay_frame_send_fragmented(void);
|
||||
void test_wslay_frame_send_interleaved_ctrl_frame(void);
|
||||
void test_wslay_frame_send_1byte_masked(void);
|
||||
void test_wslay_frame_send_zero_payloadlen(void);
|
||||
void test_wslay_frame_send_too_large_payload(void);
|
||||
void test_wslay_frame_send_ctrl_frame_too_large_payload(void);
|
||||
|
||||
#endif // WSLAY_FRAME_TEST_H
|
||||
#endif /* WSLAY_FRAME_TEST_H */
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "wslay_queue.h"
|
||||
|
||||
void test_wslay_queue()
|
||||
void test_wslay_queue(void)
|
||||
{
|
||||
int ints[] = { 1, 2, 3, 4, 5 };
|
||||
int i;
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
#ifndef WSLAY_QUEUE_TEST_H
|
||||
#define WSLAY_QUEUE_TEST_H
|
||||
|
||||
void test_wslay_queue();
|
||||
void test_wslay_queue(void);
|
||||
|
||||
#endif // WSLAY_QUEUE_TEST_H
|
||||
#endif /* WSLAY_QUEUE_TEST_H */
|
||||
|
|
Loading…
Reference in New Issue