mirror of
https://github.com/moparisthebest/spdylay
synced 2024-12-22 07:38:52 -05:00
Code cleanup: C89 and old-style-prototypes and definition.
This commit is contained in:
parent
72b6c7a1db
commit
9e716eb635
@ -156,7 +156,7 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
* The user callback function failed. This is a fatal error.
|
* The user callback function failed. This is a fatal error.
|
||||||
*/
|
*/
|
||||||
SPDYLAY_ERR_CALLBACK_FAILURE = -902,
|
SPDYLAY_ERR_CALLBACK_FAILURE = -902
|
||||||
} spdylay_error;
|
} spdylay_error;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -207,7 +207,7 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
* The DATA frame.
|
* The DATA frame.
|
||||||
*/
|
*/
|
||||||
SPDYLAY_DATA = 100,
|
SPDYLAY_DATA = 100
|
||||||
} spdylay_frame_type;
|
} spdylay_frame_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,7 +127,7 @@ int spdylay_frame_count_unpack_nv_space
|
|||||||
size_t buflen = 0;
|
size_t buflen = 0;
|
||||||
size_t nvlen = 0;
|
size_t nvlen = 0;
|
||||||
size_t off = 0;
|
size_t off = 0;
|
||||||
int i;
|
size_t i;
|
||||||
if(inlen < len_size) {
|
if(inlen < len_size) {
|
||||||
return SPDYLAY_ERR_INVALID_FRAME;
|
return SPDYLAY_ERR_INVALID_FRAME;
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ int spdylay_frame_count_unpack_nv_space
|
|||||||
off += len_size;
|
off += len_size;
|
||||||
for(i = 0; i < n; ++i) {
|
for(i = 0; i < n; ++i) {
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
int j;
|
size_t j;
|
||||||
for(j = 0; j < 2; ++j) {
|
for(j = 0; j < 2; ++j) {
|
||||||
if(inlen-off < len_size) {
|
if(inlen-off < len_size) {
|
||||||
return SPDYLAY_ERR_INVALID_FRAME;
|
return SPDYLAY_ERR_INVALID_FRAME;
|
||||||
@ -169,7 +169,8 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen,
|
|||||||
size_t len_size)
|
size_t len_size)
|
||||||
{
|
{
|
||||||
size_t nvlen, buflen;
|
size_t nvlen, buflen;
|
||||||
int r, i;
|
int r;
|
||||||
|
size_t i;
|
||||||
char *buf, **index, *data;
|
char *buf, **index, *data;
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
r = spdylay_frame_count_unpack_nv_space(&nvlen, &buflen, in, inlen, len_size);
|
r = spdylay_frame_count_unpack_nv_space(&nvlen, &buflen, in, inlen, len_size);
|
||||||
@ -217,7 +218,7 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen,
|
|||||||
*index++ = val;
|
*index++ = val;
|
||||||
}
|
}
|
||||||
*index = NULL;
|
*index = NULL;
|
||||||
assert((char*)index-buf == (nvlen*2)*sizeof(char*));
|
assert((size_t)((char*)index - buf) == (nvlen*2)*sizeof(char*));
|
||||||
*nv_ptr = (char**)buf;
|
*nv_ptr = (char**)buf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -900,7 +901,8 @@ ssize_t spdylay_frame_pack_settings(uint8_t **buf_ptr, size_t *buflen_ptr,
|
|||||||
spdylay_settings *frame)
|
spdylay_settings *frame)
|
||||||
{
|
{
|
||||||
ssize_t framelen = SPDYLAY_FRAME_HEAD_LENGTH+frame->hd.length;
|
ssize_t framelen = SPDYLAY_FRAME_HEAD_LENGTH+frame->hd.length;
|
||||||
int i, r;
|
size_t i;
|
||||||
|
int r;
|
||||||
if(frame->hd.version != SPDYLAY_PROTO_SPDY2 &&
|
if(frame->hd.version != SPDYLAY_PROTO_SPDY2 &&
|
||||||
frame->hd.version != SPDYLAY_PROTO_SPDY3) {
|
frame->hd.version != SPDYLAY_PROTO_SPDY3) {
|
||||||
return SPDYLAY_ERR_UNSUPPORTED_VERSION;
|
return SPDYLAY_ERR_UNSUPPORTED_VERSION;
|
||||||
@ -943,7 +945,7 @@ int spdylay_frame_unpack_settings(spdylay_settings *frame,
|
|||||||
const uint8_t *head, size_t headlen,
|
const uint8_t *head, size_t headlen,
|
||||||
const uint8_t *payload, size_t payloadlen)
|
const uint8_t *payload, size_t payloadlen)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
if(payloadlen < 4) {
|
if(payloadlen < 4) {
|
||||||
return SPDYLAY_ERR_INVALID_FRAME;
|
return SPDYLAY_ERR_INVALID_FRAME;
|
||||||
}
|
}
|
||||||
@ -962,7 +964,7 @@ int spdylay_frame_unpack_settings(spdylay_settings *frame,
|
|||||||
}
|
}
|
||||||
if(frame->hd.version == SPDYLAY_PROTO_SPDY2) {
|
if(frame->hd.version == SPDYLAY_PROTO_SPDY2) {
|
||||||
for(i = 0; i < frame->niv; ++i) {
|
for(i = 0; i < frame->niv; ++i) {
|
||||||
int off = i*8;
|
size_t off = i*8;
|
||||||
/* ID is little endian. See comments in
|
/* ID is little endian. See comments in
|
||||||
spdylay_frame_pack_settings(). */
|
spdylay_frame_pack_settings(). */
|
||||||
frame->iv[i].settings_id = 0;
|
frame->iv[i].settings_id = 0;
|
||||||
@ -978,7 +980,7 @@ int spdylay_frame_unpack_settings(spdylay_settings *frame,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(i = 0; i < frame->niv; ++i) {
|
for(i = 0; i < frame->niv; ++i) {
|
||||||
int off = i*8;
|
size_t off = i*8;
|
||||||
frame->iv[i].settings_id = spdylay_get_uint32(&payload[4+off]) &
|
frame->iv[i].settings_id = spdylay_get_uint32(&payload[4+off]) &
|
||||||
SPDYLAY_SETTINGS_ID_MASK;
|
SPDYLAY_SETTINGS_ID_MASK;
|
||||||
frame->iv[i].flags = payload[4+off];
|
frame->iv[i].flags = payload[4+off];
|
||||||
|
@ -57,8 +57,9 @@ int spdylay_reserve_buffer(uint8_t **buf_ptr, size_t *buflen_ptr,
|
|||||||
size_t min_length)
|
size_t min_length)
|
||||||
{
|
{
|
||||||
if(min_length > *buflen_ptr) {
|
if(min_length > *buflen_ptr) {
|
||||||
|
uint8_t *temp;
|
||||||
min_length = (min_length+4095)/4096*4096;
|
min_length = (min_length+4095)/4096*4096;
|
||||||
uint8_t *temp = malloc(min_length);
|
temp = malloc(min_length);
|
||||||
if(temp == NULL) {
|
if(temp == NULL) {
|
||||||
return SPDYLAY_ERR_NOMEM;
|
return SPDYLAY_ERR_NOMEM;
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,7 +42,7 @@ int spdylay_select_next_protocol(unsigned char **out, unsigned char *outlen,
|
|||||||
{ (const unsigned char*)"spdy/3", 6, SPDYLAY_PROTO_SPDY3 }
|
{ (const unsigned char*)"spdy/3", 6, SPDYLAY_PROTO_SPDY3 }
|
||||||
};
|
};
|
||||||
for(; i < inlen; i += in[i]+1) {
|
for(; i < inlen; i += in[i]+1) {
|
||||||
int j;
|
unsigned int j;
|
||||||
for(j = 0; j < sizeof(proto_list)/sizeof(spdylay_npn_proto); ++j) {
|
for(j = 0; j < sizeof(proto_list)/sizeof(spdylay_npn_proto); ++j) {
|
||||||
if(in[i] == proto_list[j].len &&
|
if(in[i] == proto_list[j].len &&
|
||||||
memcmp(&in[i+1], proto_list[j].proto, in[i]) == 0) {
|
memcmp(&in[i+1], proto_list[j].proto, in[i]) == 0) {
|
||||||
|
@ -91,7 +91,7 @@ static void bubble_down(spdylay_pq *pq, size_t index)
|
|||||||
{
|
{
|
||||||
size_t lchild = index*2+1;
|
size_t lchild = index*2+1;
|
||||||
size_t minindex = index;
|
size_t minindex = index;
|
||||||
int i, j;
|
size_t i, j;
|
||||||
for(i = 0; i < 2; ++i) {
|
for(i = 0; i < 2; ++i) {
|
||||||
j = lchild+i;
|
j = lchild+i;
|
||||||
if(j >= pq->length) {
|
if(j >= pq->length) {
|
||||||
|
@ -36,12 +36,13 @@ void spdylay_queue_free(spdylay_queue *queue)
|
|||||||
{
|
{
|
||||||
if(!queue) {
|
if(!queue) {
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
spdylay_queue_cell *p = queue->front;
|
spdylay_queue_cell *p = queue->front;
|
||||||
while(p) {
|
while(p) {
|
||||||
spdylay_queue_cell *next = p->next;
|
spdylay_queue_cell *next = p->next;
|
||||||
free(p);
|
free(p);
|
||||||
p = next;
|
p = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ void spdylay_session_close_pushed_streams(spdylay_session *session,
|
|||||||
spdylay_stream *stream;
|
spdylay_stream *stream;
|
||||||
stream = spdylay_session_get_stream(session, stream_id);
|
stream = spdylay_session_get_stream(session, stream_id);
|
||||||
if(stream) {
|
if(stream) {
|
||||||
int i;
|
size_t i;
|
||||||
for(i = 0; i < stream->pushed_streams_length; ++i) {
|
for(i = 0; i < stream->pushed_streams_length; ++i) {
|
||||||
spdylay_session_close_stream(session, stream->pushed_streams[i],
|
spdylay_session_close_stream(session, stream->pushed_streams[i],
|
||||||
status_code);
|
status_code);
|
||||||
@ -1290,7 +1290,7 @@ static ssize_t spdylay_recv(spdylay_session *session, uint8_t *buf, size_t len)
|
|||||||
r = session->callbacks.recv_callback
|
r = session->callbacks.recv_callback
|
||||||
(session, buf, len, 0, session->user_data);
|
(session, buf, len, 0, session->user_data);
|
||||||
if(r > 0) {
|
if(r > 0) {
|
||||||
if(r > len) {
|
if((size_t)r > len) {
|
||||||
return SPDYLAY_ERR_CALLBACK_FAILURE;
|
return SPDYLAY_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
} else if(r < 0) {
|
} else if(r < 0) {
|
||||||
@ -1602,7 +1602,7 @@ void spdylay_session_update_local_settings(spdylay_session *session,
|
|||||||
spdylay_settings_entry *iv,
|
spdylay_settings_entry *iv,
|
||||||
size_t niv)
|
size_t niv)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
for(i = 0; i < niv; ++i) {
|
for(i = 0; i < niv; ++i) {
|
||||||
assert(iv[i].settings_id > 0 && iv[i].settings_id <= SPDYLAY_SETTINGS_MAX);
|
assert(iv[i].settings_id > 0 && iv[i].settings_id <= SPDYLAY_SETTINGS_MAX);
|
||||||
session->local_settings[iv[i].settings_id] = iv[i].value;
|
session->local_settings[iv[i].settings_id] = iv[i].value;
|
||||||
@ -1612,7 +1612,8 @@ void spdylay_session_update_local_settings(spdylay_session *session,
|
|||||||
int spdylay_session_on_settings_received(spdylay_session *session,
|
int spdylay_session_on_settings_received(spdylay_session *session,
|
||||||
spdylay_frame *frame)
|
spdylay_frame *frame)
|
||||||
{
|
{
|
||||||
int i, check[SPDYLAY_SETTINGS_MAX+1];
|
size_t i;
|
||||||
|
int check[SPDYLAY_SETTINGS_MAX+1];
|
||||||
if(!spdylay_session_check_version(session, frame->settings.hd.version)) {
|
if(!spdylay_session_check_version(session, frame->settings.hd.version)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2011,7 +2012,7 @@ static int spdylay_session_update_recv_window_size(spdylay_session *session,
|
|||||||
if(stream) {
|
if(stream) {
|
||||||
stream->recv_window_size += delta_size;
|
stream->recv_window_size += delta_size;
|
||||||
/* This is just a heuristics. */
|
/* This is just a heuristics. */
|
||||||
if(stream->recv_window_size*2 >=
|
if((size_t)stream->recv_window_size*2 >=
|
||||||
session->remote_settings[SPDYLAY_SETTINGS_INITIAL_WINDOW_SIZE]) {
|
session->remote_settings[SPDYLAY_SETTINGS_INITIAL_WINDOW_SIZE]) {
|
||||||
int r;
|
int r;
|
||||||
r = spdylay_session_add_window_update(session, stream_id,
|
r = spdylay_session_add_window_update(session, stream_id,
|
||||||
@ -2267,7 +2268,7 @@ ssize_t spdylay_session_pack_data(spdylay_session *session,
|
|||||||
&eof, &frame->data_prd.source, session->user_data);
|
&eof, &frame->data_prd.source, session->user_data);
|
||||||
if(r < 0) {
|
if(r < 0) {
|
||||||
return r;
|
return r;
|
||||||
} else if(datamax < r) {
|
} else if(datamax < (size_t)r) {
|
||||||
return SPDYLAY_ERR_CALLBACK_FAILURE;
|
return SPDYLAY_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
memset(*buf_ptr, 0, SPDYLAY_HEAD_LEN);
|
memset(*buf_ptr, 0, SPDYLAY_HEAD_LEN);
|
||||||
|
@ -195,7 +195,8 @@ int spdylay_submit_settings(spdylay_session *session, uint8_t flags,
|
|||||||
spdylay_frame *frame;
|
spdylay_frame *frame;
|
||||||
spdylay_settings_entry *iv_copy;
|
spdylay_settings_entry *iv_copy;
|
||||||
int check[SPDYLAY_SETTINGS_MAX+1];
|
int check[SPDYLAY_SETTINGS_MAX+1];
|
||||||
int i, r;
|
size_t i;
|
||||||
|
int r;
|
||||||
memset(check, 0, sizeof(check));
|
memset(check, 0, sizeof(check));
|
||||||
for(i = 0; i < niv; ++i) {
|
for(i = 0; i < niv; ++i) {
|
||||||
if(iv[i].settings_id > SPDYLAY_SETTINGS_MAX || iv[i].settings_id == 0 ||
|
if(iv[i].settings_id > SPDYLAY_SETTINGS_MAX || iv[i].settings_id == 0 ||
|
||||||
|
@ -36,12 +36,12 @@
|
|||||||
#include "spdylay_stream_test.h"
|
#include "spdylay_stream_test.h"
|
||||||
#include "spdylay_npn_test.h"
|
#include "spdylay_npn_test.h"
|
||||||
|
|
||||||
int init_suite1(void)
|
static int init_suite1(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clean_suite1(void)
|
static int clean_suite1(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "spdylay_buffer.h"
|
#include "spdylay_buffer.h"
|
||||||
|
|
||||||
void test_spdylay_buffer()
|
void test_spdylay_buffer(void)
|
||||||
{
|
{
|
||||||
spdylay_buffer buffer;
|
spdylay_buffer buffer;
|
||||||
uint8_t out[1024];
|
uint8_t out[1024];
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
#ifndef SPDYLAY_BUFFER_TEST_H
|
#ifndef SPDYLAY_BUFFER_TEST_H
|
||||||
#define SPDYLAY_BUFFER_TEST_H
|
#define SPDYLAY_BUFFER_TEST_H
|
||||||
|
|
||||||
void test_spdylay_buffer();
|
void test_spdylay_buffer(void);
|
||||||
|
|
||||||
#endif // SPDYLAY_BUFFER_TEST_H
|
#endif /* SPDYLAY_BUFFER_TEST_H */
|
||||||
|
@ -39,7 +39,7 @@ static const char *headers[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
void test_spdylay_frame_unpack_nv_with(size_t len_size)
|
static void test_spdylay_frame_unpack_nv_with(size_t len_size)
|
||||||
{
|
{
|
||||||
uint8_t out[1024];
|
uint8_t out[1024];
|
||||||
char **nv;
|
char **nv;
|
||||||
@ -60,17 +60,17 @@ void test_spdylay_frame_unpack_nv_with(size_t len_size)
|
|||||||
spdylay_frame_nv_del(nv);
|
spdylay_frame_nv_del(nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_unpack_nv_spdy2()
|
void test_spdylay_frame_unpack_nv_spdy2(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_unpack_nv_with(2);
|
test_spdylay_frame_unpack_nv_with(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_unpack_nv_spdy3()
|
void test_spdylay_frame_unpack_nv_spdy3(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_unpack_nv_with(4);
|
test_spdylay_frame_unpack_nv_with(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_nv_duplicate_keys()
|
void test_spdylay_frame_pack_nv_duplicate_keys(void)
|
||||||
{
|
{
|
||||||
uint8_t out[1024];
|
uint8_t out[1024];
|
||||||
size_t len_size = 2;
|
size_t len_size = 2;
|
||||||
@ -84,13 +84,16 @@ void test_spdylay_frame_pack_nv_duplicate_keys()
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
char **nv = spdylay_frame_nv_norm_copy(nv_src);
|
char **nv = spdylay_frame_nv_norm_copy(nv_src);
|
||||||
|
const uint8_t *outptr;
|
||||||
|
int pairs, len;
|
||||||
/* size_t inlen = */ spdylay_frame_pack_nv(out, nv, len_size);
|
/* size_t inlen = */ spdylay_frame_pack_nv(out, nv, len_size);
|
||||||
const uint8_t *outptr = out;
|
outptr = out;
|
||||||
int pairs = spdylay_get_uint16(outptr);
|
|
||||||
|
pairs = spdylay_get_uint16(outptr);
|
||||||
CU_ASSERT(pairs == 5);
|
CU_ASSERT(pairs == 5);
|
||||||
outptr += 2;
|
outptr += 2;
|
||||||
|
|
||||||
int len = spdylay_get_uint16(outptr);
|
len = spdylay_get_uint16(outptr);
|
||||||
outptr += 2;
|
outptr += 2;
|
||||||
CU_ASSERT(len == 6);
|
CU_ASSERT(len == 6);
|
||||||
CU_ASSERT(memcmp(outptr, "method", len) == 0);
|
CU_ASSERT(memcmp(outptr, "method", len) == 0);
|
||||||
@ -154,7 +157,7 @@ void test_spdylay_frame_pack_nv_duplicate_keys()
|
|||||||
spdylay_frame_nv_del(nv);
|
spdylay_frame_nv_del(nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_count_nv_space()
|
void test_spdylay_frame_count_nv_space(void)
|
||||||
{
|
{
|
||||||
size_t len_size = 2;
|
size_t len_size = 2;
|
||||||
CU_ASSERT(74 == spdylay_frame_count_nv_space((char**)headers, len_size));
|
CU_ASSERT(74 == spdylay_frame_count_nv_space((char**)headers, len_size));
|
||||||
@ -162,7 +165,7 @@ void test_spdylay_frame_count_nv_space()
|
|||||||
CU_ASSERT(96 == spdylay_frame_count_nv_space((char**)headers, len_size));
|
CU_ASSERT(96 == spdylay_frame_count_nv_space((char**)headers, len_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_count_unpack_nv_space()
|
void test_spdylay_frame_count_unpack_nv_space(void)
|
||||||
{
|
{
|
||||||
size_t nvlen, buflen;
|
size_t nvlen, buflen;
|
||||||
uint8_t out[1024];
|
uint8_t out[1024];
|
||||||
@ -199,7 +202,7 @@ void test_spdylay_frame_count_unpack_nv_space()
|
|||||||
len_size));
|
len_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_ping()
|
void test_spdylay_frame_pack_ping(void)
|
||||||
{
|
{
|
||||||
spdylay_frame frame, oframe;
|
spdylay_frame frame, oframe;
|
||||||
uint8_t *buf = NULL;
|
uint8_t *buf = NULL;
|
||||||
@ -218,7 +221,7 @@ void test_spdylay_frame_pack_ping()
|
|||||||
spdylay_frame_ping_free(&frame.ping);
|
spdylay_frame_ping_free(&frame.ping);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_goaway_version(uint16_t version)
|
static void test_spdylay_frame_pack_goaway_version(uint16_t version)
|
||||||
{
|
{
|
||||||
spdylay_frame frame, oframe;
|
spdylay_frame frame, oframe;
|
||||||
uint8_t *buf = NULL;
|
uint8_t *buf = NULL;
|
||||||
@ -248,17 +251,17 @@ void test_spdylay_frame_pack_goaway_version(uint16_t version)
|
|||||||
spdylay_frame_goaway_free(&frame.goaway);
|
spdylay_frame_goaway_free(&frame.goaway);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_goaway_spdy2()
|
void test_spdylay_frame_pack_goaway_spdy2(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_goaway_version(SPDYLAY_PROTO_SPDY2);
|
test_spdylay_frame_pack_goaway_version(SPDYLAY_PROTO_SPDY2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_goaway_spdy3()
|
void test_spdylay_frame_pack_goaway_spdy3(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_goaway_version(SPDYLAY_PROTO_SPDY3);
|
test_spdylay_frame_pack_goaway_version(SPDYLAY_PROTO_SPDY3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_syn_stream_version(uint16_t version)
|
static void test_spdylay_frame_pack_syn_stream_version(uint16_t version)
|
||||||
{
|
{
|
||||||
spdylay_zlib deflater, inflater;
|
spdylay_zlib deflater, inflater;
|
||||||
spdylay_frame frame, oframe;
|
spdylay_frame frame, oframe;
|
||||||
@ -301,17 +304,17 @@ void test_spdylay_frame_pack_syn_stream_version(uint16_t version)
|
|||||||
spdylay_buffer_free(&inflatebuf);
|
spdylay_buffer_free(&inflatebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_syn_stream_spdy2()
|
void test_spdylay_frame_pack_syn_stream_spdy2(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_syn_stream_version(SPDYLAY_PROTO_SPDY2);
|
test_spdylay_frame_pack_syn_stream_version(SPDYLAY_PROTO_SPDY2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_syn_stream_spdy3()
|
void test_spdylay_frame_pack_syn_stream_spdy3(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_syn_stream_version(SPDYLAY_PROTO_SPDY3);
|
test_spdylay_frame_pack_syn_stream_version(SPDYLAY_PROTO_SPDY3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_syn_reply_version(uint16_t version)
|
static void test_spdylay_frame_pack_syn_reply_version(uint16_t version)
|
||||||
{
|
{
|
||||||
spdylay_zlib deflater, inflater;
|
spdylay_zlib deflater, inflater;
|
||||||
spdylay_frame frame, oframe;
|
spdylay_frame frame, oframe;
|
||||||
@ -353,17 +356,17 @@ void test_spdylay_frame_pack_syn_reply_version(uint16_t version)
|
|||||||
spdylay_buffer_free(&inflatebuf);
|
spdylay_buffer_free(&inflatebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_syn_reply_spdy2()
|
void test_spdylay_frame_pack_syn_reply_spdy2(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_syn_reply_version(SPDYLAY_PROTO_SPDY2);
|
test_spdylay_frame_pack_syn_reply_version(SPDYLAY_PROTO_SPDY2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_syn_reply_spdy3()
|
void test_spdylay_frame_pack_syn_reply_spdy3(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_syn_reply_version(SPDYLAY_PROTO_SPDY3);
|
test_spdylay_frame_pack_syn_reply_version(SPDYLAY_PROTO_SPDY3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_headers_version(uint16_t version)
|
static void test_spdylay_frame_pack_headers_version(uint16_t version)
|
||||||
{
|
{
|
||||||
spdylay_zlib deflater, inflater;
|
spdylay_zlib deflater, inflater;
|
||||||
spdylay_frame frame, oframe;
|
spdylay_frame frame, oframe;
|
||||||
@ -405,17 +408,17 @@ void test_spdylay_frame_pack_headers_version(uint16_t version)
|
|||||||
spdylay_buffer_free(&inflatebuf);
|
spdylay_buffer_free(&inflatebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_headers_spdy2()
|
void test_spdylay_frame_pack_headers_spdy2(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_headers_version(SPDYLAY_PROTO_SPDY2);
|
test_spdylay_frame_pack_headers_version(SPDYLAY_PROTO_SPDY2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_headers_spdy3()
|
void test_spdylay_frame_pack_headers_spdy3(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_headers_version(SPDYLAY_PROTO_SPDY3);
|
test_spdylay_frame_pack_headers_version(SPDYLAY_PROTO_SPDY3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_window_update()
|
void test_spdylay_frame_pack_window_update(void)
|
||||||
{
|
{
|
||||||
spdylay_frame frame, oframe;
|
spdylay_frame frame, oframe;
|
||||||
uint8_t *buf = NULL;
|
uint8_t *buf = NULL;
|
||||||
@ -442,7 +445,7 @@ void test_spdylay_frame_pack_window_update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void test_spdylay_frame_pack_settings_version(uint16_t version)
|
static void test_spdylay_frame_pack_settings_version(uint16_t version)
|
||||||
{
|
{
|
||||||
spdylay_frame frame, oframe;
|
spdylay_frame frame, oframe;
|
||||||
uint8_t *buf = NULL;
|
uint8_t *buf = NULL;
|
||||||
@ -489,17 +492,17 @@ void test_spdylay_frame_pack_settings_version(uint16_t version)
|
|||||||
spdylay_frame_settings_free(&oframe.settings);
|
spdylay_frame_settings_free(&oframe.settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_settings_spdy2()
|
void test_spdylay_frame_pack_settings_spdy2(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_settings_version(SPDYLAY_PROTO_SPDY2);
|
test_spdylay_frame_pack_settings_version(SPDYLAY_PROTO_SPDY2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_pack_settings_spdy3()
|
void test_spdylay_frame_pack_settings_spdy3(void)
|
||||||
{
|
{
|
||||||
test_spdylay_frame_pack_settings_version(SPDYLAY_PROTO_SPDY3);
|
test_spdylay_frame_pack_settings_version(SPDYLAY_PROTO_SPDY3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_nv_sort()
|
void test_spdylay_frame_nv_sort(void)
|
||||||
{
|
{
|
||||||
char *nv[7];
|
char *nv[7];
|
||||||
nv[0] = (char*)"version";
|
nv[0] = (char*)"version";
|
||||||
@ -518,7 +521,7 @@ void test_spdylay_frame_nv_sort()
|
|||||||
CU_ASSERT(strcmp("HTTP/1.1", nv[5]) == 0);
|
CU_ASSERT(strcmp("HTTP/1.1", nv[5]) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_nv_downcase()
|
void test_spdylay_frame_nv_downcase(void)
|
||||||
{
|
{
|
||||||
const char *nv_src[] = {
|
const char *nv_src[] = {
|
||||||
"VERSION", "HTTP/1.1",
|
"VERSION", "HTTP/1.1",
|
||||||
@ -535,7 +538,7 @@ void test_spdylay_frame_nv_downcase()
|
|||||||
spdylay_frame_nv_del(nv);
|
spdylay_frame_nv_del(nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_nv_2to3()
|
void test_spdylay_frame_nv_2to3(void)
|
||||||
{
|
{
|
||||||
const char *nv_src[] = {
|
const char *nv_src[] = {
|
||||||
"host", "localhost",
|
"host", "localhost",
|
||||||
@ -560,7 +563,7 @@ void test_spdylay_frame_nv_2to3()
|
|||||||
spdylay_frame_nv_del(nv);
|
spdylay_frame_nv_del(nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_frame_nv_3to2()
|
void test_spdylay_frame_nv_3to2(void)
|
||||||
{
|
{
|
||||||
const char *nv_src[] = {
|
const char *nv_src[] = {
|
||||||
":host", "localhost",
|
":host", "localhost",
|
||||||
|
@ -25,26 +25,26 @@
|
|||||||
#ifndef SPDYLAY_FRAME_TEST_H
|
#ifndef SPDYLAY_FRAME_TEST_H
|
||||||
#define SPDYLAY_FRAME_TEST_H
|
#define SPDYLAY_FRAME_TEST_H
|
||||||
|
|
||||||
void test_spdylay_frame_unpack_nv_spdy2();
|
void test_spdylay_frame_unpack_nv_spdy2(void);
|
||||||
void test_spdylay_frame_unpack_nv_spdy3();
|
void test_spdylay_frame_unpack_nv_spdy3(void);
|
||||||
void test_spdylay_frame_pack_nv_duplicate_keys();
|
void test_spdylay_frame_pack_nv_duplicate_keys(void);
|
||||||
void test_spdylay_frame_count_nv_space();
|
void test_spdylay_frame_count_nv_space(void);
|
||||||
void test_spdylay_frame_count_unpack_nv_space();
|
void test_spdylay_frame_count_unpack_nv_space(void);
|
||||||
void test_spdylay_frame_pack_ping();
|
void test_spdylay_frame_pack_ping(void);
|
||||||
void test_spdylay_frame_pack_goaway_spdy2();
|
void test_spdylay_frame_pack_goaway_spdy2(void);
|
||||||
void test_spdylay_frame_pack_goaway_spdy3();
|
void test_spdylay_frame_pack_goaway_spdy3(void);
|
||||||
void test_spdylay_frame_pack_syn_stream_spdy2();
|
void test_spdylay_frame_pack_syn_stream_spdy2(void);
|
||||||
void test_spdylay_frame_pack_syn_stream_spdy3();
|
void test_spdylay_frame_pack_syn_stream_spdy3(void);
|
||||||
void test_spdylay_frame_pack_syn_reply_spdy2();
|
void test_spdylay_frame_pack_syn_reply_spdy2(void);
|
||||||
void test_spdylay_frame_pack_syn_reply_spdy3();
|
void test_spdylay_frame_pack_syn_reply_spdy3(void);
|
||||||
void test_spdylay_frame_pack_headers_spdy2();
|
void test_spdylay_frame_pack_headers_spdy2(void);
|
||||||
void test_spdylay_frame_pack_headers_spdy3();
|
void test_spdylay_frame_pack_headers_spdy3(void);
|
||||||
void test_spdylay_frame_pack_window_update();
|
void test_spdylay_frame_pack_window_update(void);
|
||||||
void test_spdylay_frame_pack_settings_spdy2();
|
void test_spdylay_frame_pack_settings_spdy2(void);
|
||||||
void test_spdylay_frame_pack_settings_spdy3();
|
void test_spdylay_frame_pack_settings_spdy3(void);
|
||||||
void test_spdylay_frame_nv_sort();
|
void test_spdylay_frame_nv_sort(void);
|
||||||
void test_spdylay_frame_nv_downcase();
|
void test_spdylay_frame_nv_downcase(void);
|
||||||
void test_spdylay_frame_nv_2to3();
|
void test_spdylay_frame_nv_2to3(void);
|
||||||
void test_spdylay_frame_nv_3to2();
|
void test_spdylay_frame_nv_3to2(void);
|
||||||
|
|
||||||
#endif /* SPDYLAY_FRAME_TEST_H */
|
#endif /* SPDYLAY_FRAME_TEST_H */
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "spdylay_map.h"
|
#include "spdylay_map.h"
|
||||||
|
|
||||||
void test_spdylay_map()
|
void test_spdylay_map(void)
|
||||||
{
|
{
|
||||||
spdylay_map map;
|
spdylay_map map;
|
||||||
spdylay_map_init(&map);
|
spdylay_map_init(&map);
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
#ifndef SPDYLAY_MAP_TEST_H
|
#ifndef SPDYLAY_MAP_TEST_H
|
||||||
#define SPDYLAY_MAP_TEST_H
|
#define SPDYLAY_MAP_TEST_H
|
||||||
|
|
||||||
void test_spdylay_map();
|
void test_spdylay_map(void);
|
||||||
|
|
||||||
#endif /* SPDYLAY_MAP_TEST_H */
|
#endif /* SPDYLAY_MAP_TEST_H */
|
||||||
|
@ -22,12 +22,13 @@
|
|||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "spdylay_npn_test.h"
|
||||||
|
|
||||||
#include <CUnit/CUnit.h>
|
#include <CUnit/CUnit.h>
|
||||||
#include <spdylay/spdylay.h>
|
#include <spdylay/spdylay.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static void spdy2()
|
static void spdy2(void)
|
||||||
{
|
{
|
||||||
const unsigned char spdy[] = {
|
const unsigned char spdy[] = {
|
||||||
8, 'h', 't', 't', 'p', '/', '1', '.', '1',
|
8, 'h', 't', 't', 'p', '/', '1', '.', '1',
|
||||||
@ -42,7 +43,7 @@ static void spdy2()
|
|||||||
CU_ASSERT(memcmp("spdy/2", out, outlen) == 0);
|
CU_ASSERT(memcmp("spdy/2", out, outlen) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void http11()
|
static void http11(void)
|
||||||
{
|
{
|
||||||
const unsigned char spdy[] = {
|
const unsigned char spdy[] = {
|
||||||
6, 's', 'p', 'd', 'y', '/', '4',
|
6, 's', 'p', 'd', 'y', '/', '4',
|
||||||
@ -57,7 +58,7 @@ static void http11()
|
|||||||
CU_ASSERT(memcmp("http/1.1", out, outlen) == 0);
|
CU_ASSERT(memcmp("http/1.1", out, outlen) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void no_overlap()
|
static void no_overlap(void)
|
||||||
{
|
{
|
||||||
const unsigned char spdy[] = {
|
const unsigned char spdy[] = {
|
||||||
6, 's', 'p', 'd', 'y', '/', '4',
|
6, 's', 'p', 'd', 'y', '/', '4',
|
||||||
@ -72,7 +73,7 @@ static void no_overlap()
|
|||||||
CU_ASSERT(NULL == out);
|
CU_ASSERT(NULL == out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_npn()
|
void test_spdylay_npn(void)
|
||||||
{
|
{
|
||||||
spdy2();
|
spdy2();
|
||||||
http11();
|
http11();
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
#ifndef SPDYLAY_NPN_TEST_H
|
#ifndef SPDYLAY_NPN_TEST_H
|
||||||
#define SPDYLAY_NPN_TEST_H
|
#define SPDYLAY_NPN_TEST_H
|
||||||
|
|
||||||
void test_spdylay_npn();
|
void test_spdylay_npn(void);
|
||||||
|
|
||||||
#endif // SPDYLAY_NPN_TEST_H
|
#endif /* SPDYLAY_NPN_TEST_H */
|
||||||
|
@ -33,7 +33,7 @@ static int pq_compar(const void *lhs, const void *rhs)
|
|||||||
return strcmp(lhs, rhs);
|
return strcmp(lhs, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_pq()
|
void test_spdylay_pq(void)
|
||||||
{
|
{
|
||||||
spdylay_pq pq;
|
spdylay_pq pq;
|
||||||
spdylay_pq_init(&pq, pq_compar);
|
spdylay_pq_init(&pq, pq_compar);
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
#ifndef SPDYLAY_PQ_TEST_H
|
#ifndef SPDYLAY_PQ_TEST_H
|
||||||
#define SPDYLAY_PQ_TEST_H
|
#define SPDYLAY_PQ_TEST_H
|
||||||
|
|
||||||
void test_spdylay_pq();
|
void test_spdylay_pq(void);
|
||||||
|
|
||||||
#endif /* SPDYLAY_PQ_TEST_H */
|
#endif /* SPDYLAY_PQ_TEST_H */
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "spdylay_queue.h"
|
#include "spdylay_queue.h"
|
||||||
|
|
||||||
void test_spdylay_queue()
|
void test_spdylay_queue(void)
|
||||||
{
|
{
|
||||||
int ints[] = { 1, 2, 3, 4, 5 };
|
int ints[] = { 1, 2, 3, 4, 5 };
|
||||||
int i;
|
int i;
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
#ifndef SPDYLAY_QUEUE_TEST_H
|
#ifndef SPDYLAY_QUEUE_TEST_H
|
||||||
#define SPDYLAY_QUEUE_TEST_H
|
#define SPDYLAY_QUEUE_TEST_H
|
||||||
|
|
||||||
void test_spdylay_queue();
|
void test_spdylay_queue(void);
|
||||||
|
|
||||||
#endif // SPDYLAY_QUEUE_TEST_H
|
#endif /* SPDYLAY_QUEUE_TEST_H */
|
||||||
|
@ -200,7 +200,7 @@ static spdylay_settings_entry* dup_iv(const spdylay_settings_entry *iv,
|
|||||||
return spdylay_frame_iv_copy(iv, niv);
|
return spdylay_frame_iv_copy(iv, niv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_recv()
|
void test_spdylay_session_recv(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -238,20 +238,17 @@ void test_spdylay_session_recv()
|
|||||||
spdylay_frame_syn_stream_free(&frame.syn_stream);
|
spdylay_frame_syn_stream_free(&frame.syn_stream);
|
||||||
|
|
||||||
user_data.ctrl_recv_cb_called = 0;
|
user_data.ctrl_recv_cb_called = 0;
|
||||||
while(df.seqidx < framelen) {
|
while((ssize_t)df.seqidx < framelen) {
|
||||||
CU_ASSERT(0 == spdylay_session_recv(session));
|
CU_ASSERT(0 == spdylay_session_recv(session));
|
||||||
}
|
}
|
||||||
CU_ASSERT(1 == user_data.ctrl_recv_cb_called);
|
CU_ASSERT(1 == user_data.ctrl_recv_cb_called);
|
||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_add_frame()
|
void test_spdylay_session_add_frame(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
accumulator_send_callback,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
accumulator acc;
|
accumulator acc;
|
||||||
my_user_data user_data;
|
my_user_data user_data;
|
||||||
const char *nv[] = {
|
const char *nv[] = {
|
||||||
@ -268,6 +265,8 @@ void test_spdylay_session_add_frame()
|
|||||||
0x80, 0x02, 0x00, 0x01
|
0x80, 0x02, 0x00, 0x01
|
||||||
};
|
};
|
||||||
uint32_t temp32;
|
uint32_t temp32;
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.send_callback = accumulator_send_callback;
|
||||||
memset(aux_data, 0, sizeof(spdylay_syn_stream_aux_data));
|
memset(aux_data, 0, sizeof(spdylay_syn_stream_aux_data));
|
||||||
acc.length = 0;
|
acc.length = 0;
|
||||||
user_data.acc = &acc;
|
user_data.acc = &acc;
|
||||||
@ -298,15 +297,10 @@ void test_spdylay_session_add_frame()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_recv_invalid_stream_id()
|
void test_spdylay_session_recv_invalid_stream_id(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
NULL,
|
|
||||||
scripted_recv_callback,
|
|
||||||
NULL,
|
|
||||||
on_invalid_ctrl_recv_callback
|
|
||||||
};
|
|
||||||
scripted_data_feed df;
|
scripted_data_feed df;
|
||||||
my_user_data user_data;
|
my_user_data user_data;
|
||||||
const char *nv[] = { NULL };
|
const char *nv[] = { NULL };
|
||||||
@ -314,6 +308,9 @@ void test_spdylay_session_recv_invalid_stream_id()
|
|||||||
size_t framedatalen = 0, nvbuflen = 0;
|
size_t framedatalen = 0, nvbuflen = 0;
|
||||||
ssize_t framelen;
|
ssize_t framelen;
|
||||||
spdylay_frame frame;
|
spdylay_frame frame;
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.recv_callback = scripted_recv_callback;
|
||||||
|
callbacks.on_invalid_ctrl_recv_callback = on_invalid_ctrl_recv_callback;
|
||||||
|
|
||||||
user_data.df = &df;
|
user_data.df = &df;
|
||||||
user_data.invalid_ctrl_recv_cb_called = 0;
|
user_data.invalid_ctrl_recv_cb_called = 0;
|
||||||
@ -348,7 +345,7 @@ void test_spdylay_session_recv_invalid_stream_id()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_syn_stream_received()
|
void test_spdylay_session_on_syn_stream_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -416,7 +413,7 @@ void test_spdylay_session_on_syn_stream_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_syn_stream_received_with_push()
|
void test_spdylay_session_on_syn_stream_received_with_push(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -470,7 +467,7 @@ void test_spdylay_session_on_syn_stream_received_with_push()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_syn_reply_received()
|
void test_spdylay_session_on_syn_reply_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -547,21 +544,18 @@ void test_spdylay_session_on_syn_reply_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_send_syn_stream()
|
void test_spdylay_session_send_syn_stream(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
null_send_callback,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
const char *nv[] = { NULL };
|
const char *nv[] = { NULL };
|
||||||
spdylay_frame *frame = malloc(sizeof(spdylay_frame));
|
spdylay_frame *frame = malloc(sizeof(spdylay_frame));
|
||||||
spdylay_stream *stream;
|
spdylay_stream *stream;
|
||||||
spdylay_syn_stream_aux_data *aux_data =
|
spdylay_syn_stream_aux_data *aux_data =
|
||||||
malloc(sizeof(spdylay_syn_stream_aux_data));
|
malloc(sizeof(spdylay_syn_stream_aux_data));
|
||||||
memset(aux_data, 0, sizeof(spdylay_syn_stream_aux_data));
|
memset(aux_data, 0, sizeof(spdylay_syn_stream_aux_data));
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.send_callback = null_send_callback;
|
||||||
|
|
||||||
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks, NULL);
|
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks, NULL);
|
||||||
spdylay_frame_syn_stream_init(&frame->syn_stream, SPDYLAY_PROTO_SPDY2,
|
spdylay_frame_syn_stream_init(&frame->syn_stream, SPDYLAY_PROTO_SPDY2,
|
||||||
@ -574,19 +568,17 @@ void test_spdylay_session_send_syn_stream()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_send_syn_reply()
|
void test_spdylay_session_send_syn_reply(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
null_send_callback,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
const char *nv[] = { NULL };
|
const char *nv[] = { NULL };
|
||||||
spdylay_frame *frame = malloc(sizeof(spdylay_frame));
|
spdylay_frame *frame = malloc(sizeof(spdylay_frame));
|
||||||
spdylay_stream *stream;
|
spdylay_stream *stream;
|
||||||
|
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.send_callback = null_send_callback;
|
||||||
|
|
||||||
CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2,
|
CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2,
|
||||||
&callbacks, NULL));
|
&callbacks, NULL));
|
||||||
spdylay_session_open_stream(session, 2, SPDYLAY_CTRL_FLAG_NONE, 3,
|
spdylay_session_open_stream(session, 2, SPDYLAY_CTRL_FLAG_NONE, 3,
|
||||||
@ -601,21 +593,19 @@ void test_spdylay_session_send_syn_reply()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_submit_response()
|
void test_spdylay_submit_response(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
null_send_callback,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
const char *nv[] = { "Content-Length", "1024", NULL };
|
const char *nv[] = { "Content-Length", "1024", NULL };
|
||||||
int32_t stream_id = 2;
|
int32_t stream_id = 2;
|
||||||
spdylay_data_provider data_prd;
|
spdylay_data_provider data_prd;
|
||||||
my_user_data ud;
|
my_user_data ud;
|
||||||
spdylay_outbound_item *item;
|
spdylay_outbound_item *item;
|
||||||
|
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.send_callback = null_send_callback;
|
||||||
|
|
||||||
data_prd.read_callback = fixed_length_data_source_read_callback;
|
data_prd.read_callback = fixed_length_data_source_read_callback;
|
||||||
ud.data_source_length = 64*1024;
|
ud.data_source_length = 64*1024;
|
||||||
CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2,
|
CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2,
|
||||||
@ -629,7 +619,7 @@ void test_spdylay_submit_response()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_submit_response_with_null_data_read_callback()
|
void test_spdylay_submit_response_with_null_data_read_callback(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -668,20 +658,18 @@ void test_spdylay_submit_response_with_null_data_read_callback()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_submit_request_with_data()
|
void test_spdylay_submit_request_with_data(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
null_send_callback,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
const char *nv[] = { "Version", "HTTP/1.1", NULL };
|
const char *nv[] = { "Version", "HTTP/1.1", NULL };
|
||||||
spdylay_data_provider data_prd;
|
spdylay_data_provider data_prd;
|
||||||
my_user_data ud;
|
my_user_data ud;
|
||||||
spdylay_outbound_item *item;
|
spdylay_outbound_item *item;
|
||||||
|
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.send_callback = null_send_callback;
|
||||||
|
|
||||||
data_prd.read_callback = fixed_length_data_source_read_callback;
|
data_prd.read_callback = fixed_length_data_source_read_callback;
|
||||||
ud.data_source_length = 64*1024;
|
ud.data_source_length = 64*1024;
|
||||||
CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2,
|
CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2,
|
||||||
@ -695,7 +683,7 @@ void test_spdylay_submit_request_with_data()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_submit_request_with_null_data_read_callback()
|
void test_spdylay_submit_request_with_null_data_read_callback(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -732,7 +720,7 @@ void test_spdylay_submit_request_with_null_data_read_callback()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_submit_syn_stream()
|
void test_spdylay_submit_syn_stream(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -771,7 +759,7 @@ void test_spdylay_submit_syn_stream()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_submit_syn_reply()
|
void test_spdylay_submit_syn_reply(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -810,7 +798,7 @@ void test_spdylay_submit_syn_reply()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_submit_headers()
|
void test_spdylay_submit_headers(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -862,20 +850,18 @@ void test_spdylay_submit_headers()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_reply_fail()
|
void test_spdylay_session_reply_fail(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
fail_send_callback,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
const char *nv[] = { NULL };
|
const char *nv[] = { NULL };
|
||||||
int32_t stream_id = 2;
|
int32_t stream_id = 2;
|
||||||
spdylay_data_provider data_prd;
|
spdylay_data_provider data_prd;
|
||||||
my_user_data ud;
|
my_user_data ud;
|
||||||
|
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.send_callback = fail_send_callback;
|
||||||
|
|
||||||
data_prd.read_callback = fixed_length_data_source_read_callback;
|
data_prd.read_callback = fixed_length_data_source_read_callback;
|
||||||
ud.data_source_length = 4*1024;
|
ud.data_source_length = 4*1024;
|
||||||
CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2,
|
CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2,
|
||||||
@ -885,7 +871,7 @@ void test_spdylay_session_reply_fail()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_headers_received()
|
void test_spdylay_session_on_headers_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -965,7 +951,7 @@ void test_spdylay_session_on_headers_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_window_update_received()
|
void test_spdylay_session_on_window_update_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1003,15 +989,10 @@ void test_spdylay_session_on_window_update_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_ping_received()
|
void test_spdylay_session_on_ping_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
on_ctrl_recv_callback,
|
|
||||||
on_invalid_ctrl_recv_callback
|
|
||||||
};
|
|
||||||
my_user_data user_data;
|
my_user_data user_data;
|
||||||
spdylay_frame frame;
|
spdylay_frame frame;
|
||||||
spdylay_outbound_item *top;
|
spdylay_outbound_item *top;
|
||||||
@ -1019,6 +1000,10 @@ void test_spdylay_session_on_ping_received()
|
|||||||
user_data.ctrl_recv_cb_called = 0;
|
user_data.ctrl_recv_cb_called = 0;
|
||||||
user_data.invalid_ctrl_recv_cb_called = 0;
|
user_data.invalid_ctrl_recv_cb_called = 0;
|
||||||
|
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.on_ctrl_recv_callback = on_ctrl_recv_callback;
|
||||||
|
callbacks.on_invalid_ctrl_recv_callback = on_invalid_ctrl_recv_callback;
|
||||||
|
|
||||||
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks,
|
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks,
|
||||||
&user_data);
|
&user_data);
|
||||||
unique_id = 2;
|
unique_id = 2;
|
||||||
@ -1040,21 +1025,20 @@ void test_spdylay_session_on_ping_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_goaway_received()
|
void test_spdylay_session_on_goaway_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks = {
|
spdylay_session_callbacks callbacks;
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
on_ctrl_recv_callback,
|
|
||||||
on_invalid_ctrl_recv_callback,
|
|
||||||
};
|
|
||||||
my_user_data user_data;
|
my_user_data user_data;
|
||||||
spdylay_frame frame;
|
spdylay_frame frame;
|
||||||
int32_t stream_id = 1000000007;
|
int32_t stream_id = 1000000007;
|
||||||
user_data.ctrl_recv_cb_called = 0;
|
user_data.ctrl_recv_cb_called = 0;
|
||||||
user_data.invalid_ctrl_recv_cb_called = 0;
|
user_data.invalid_ctrl_recv_cb_called = 0;
|
||||||
|
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
callbacks.on_ctrl_recv_callback = on_ctrl_recv_callback;
|
||||||
|
callbacks.on_invalid_ctrl_recv_callback = on_invalid_ctrl_recv_callback;
|
||||||
|
|
||||||
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks,
|
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks,
|
||||||
&user_data);
|
&user_data);
|
||||||
spdylay_frame_goaway_init(&frame.goaway, SPDYLAY_PROTO_SPDY2, stream_id,
|
spdylay_frame_goaway_init(&frame.goaway, SPDYLAY_PROTO_SPDY2, stream_id,
|
||||||
@ -1068,16 +1052,17 @@ void test_spdylay_session_on_goaway_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_data_received()
|
void test_spdylay_session_on_data_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
|
||||||
my_user_data user_data;
|
my_user_data user_data;
|
||||||
spdylay_outbound_item *top;
|
spdylay_outbound_item *top;
|
||||||
int32_t stream_id = 2;
|
int32_t stream_id = 2;
|
||||||
spdylay_stream *stream;
|
spdylay_stream *stream;
|
||||||
|
|
||||||
|
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||||
|
|
||||||
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks,
|
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks,
|
||||||
&user_data);
|
&user_data);
|
||||||
stream = spdylay_session_open_stream(session, stream_id,
|
stream = spdylay_session_open_stream(session, stream_id,
|
||||||
@ -1117,7 +1102,7 @@ void test_spdylay_session_on_data_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_is_my_stream_id()
|
void test_spdylay_session_is_my_stream_id(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1139,7 +1124,7 @@ void test_spdylay_session_is_my_stream_id()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_rst_received()
|
void test_spdylay_session_on_rst_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1172,7 +1157,7 @@ void test_spdylay_session_on_rst_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_send_rst_stream()
|
void test_spdylay_session_send_rst_stream(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1206,7 +1191,7 @@ void test_spdylay_session_send_rst_stream()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_get_next_ob_item()
|
void test_spdylay_session_get_next_ob_item(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1247,7 +1232,7 @@ void test_spdylay_session_get_next_ob_item()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_pop_next_ob_item()
|
void test_spdylay_session_pop_next_ob_item(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1299,7 +1284,7 @@ void test_spdylay_session_pop_next_ob_item()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_request_recv_callback()
|
void test_spdylay_session_on_request_recv_callback(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1366,7 +1351,7 @@ static void stream_close_callback(spdylay_session *session, int32_t stream_id,
|
|||||||
CU_ASSERT(stream_data != NULL);
|
CU_ASSERT(stream_data != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_stream_close()
|
void test_spdylay_session_on_stream_close(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1390,7 +1375,7 @@ void test_spdylay_session_on_stream_close()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_max_concurrent_streams()
|
void test_spdylay_session_max_concurrent_streams(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1433,7 +1418,7 @@ static ssize_t block_count_send_callback(spdylay_session* session,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_data_backoff_by_high_pri_frame()
|
void test_spdylay_session_data_backoff_by_high_pri_frame(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1478,7 +1463,7 @@ void test_spdylay_session_data_backoff_by_high_pri_frame()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_stop_data_with_rst_stream()
|
void test_spdylay_session_stop_data_with_rst_stream(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1529,7 +1514,7 @@ void test_spdylay_session_stop_data_with_rst_stream()
|
|||||||
* Check that on_stream_close_callback is called when server pushed
|
* Check that on_stream_close_callback is called when server pushed
|
||||||
* SYN_STREAM have SPDYLAY_CTRL_FLAG_FIN.
|
* SYN_STREAM have SPDYLAY_CTRL_FLAG_FIN.
|
||||||
*/
|
*/
|
||||||
void test_spdylay_session_stream_close_on_syn_stream()
|
void test_spdylay_session_stream_close_on_syn_stream(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1556,7 +1541,7 @@ void test_spdylay_session_stream_close_on_syn_stream()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_recv_invalid_frame()
|
void test_spdylay_session_recv_invalid_frame(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1614,7 +1599,7 @@ static ssize_t defer_data_source_read_callback
|
|||||||
return SPDYLAY_ERR_DEFERRED;
|
return SPDYLAY_ERR_DEFERRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_defer_data()
|
void test_spdylay_session_defer_data(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1681,7 +1666,7 @@ void test_spdylay_session_defer_data()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_flow_control()
|
void test_spdylay_session_flow_control(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1756,7 +1741,7 @@ void test_spdylay_session_flow_control()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_ctrl_not_send()
|
void test_spdylay_session_on_ctrl_not_send(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1881,7 +1866,7 @@ void test_spdylay_session_on_ctrl_not_send()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_on_settings_received()
|
void test_spdylay_session_on_settings_received(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -1889,7 +1874,7 @@ void test_spdylay_session_on_settings_received()
|
|||||||
spdylay_stream *stream1, *stream2;
|
spdylay_stream *stream1, *stream2;
|
||||||
spdylay_frame frame;
|
spdylay_frame frame;
|
||||||
const size_t niv = 5;
|
const size_t niv = 5;
|
||||||
spdylay_settings_entry iv[niv];
|
spdylay_settings_entry iv[255];
|
||||||
|
|
||||||
iv[0].settings_id = SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS;
|
iv[0].settings_id = SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS;
|
||||||
iv[0].value = 1000000009;
|
iv[0].value = 1000000009;
|
||||||
@ -1949,7 +1934,7 @@ void test_spdylay_session_on_settings_received()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_submit_settings()
|
void test_spdylay_submit_settings(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
@ -2023,7 +2008,7 @@ void test_spdylay_submit_settings()
|
|||||||
spdylay_session_del(session);
|
spdylay_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_session_get_outbound_queue_size()
|
void test_spdylay_session_get_outbound_queue_size(void)
|
||||||
{
|
{
|
||||||
spdylay_session *session;
|
spdylay_session *session;
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
|
@ -25,44 +25,44 @@
|
|||||||
#ifndef SPDYLAY_SESSION_TEST_H
|
#ifndef SPDYLAY_SESSION_TEST_H
|
||||||
#define SPDYLAY_SESSION_TEST_H
|
#define SPDYLAY_SESSION_TEST_H
|
||||||
|
|
||||||
void test_spdylay_session_recv();
|
void test_spdylay_session_recv(void);
|
||||||
void test_spdylay_session_recv_invalid_stream_id();
|
void test_spdylay_session_recv_invalid_stream_id(void);
|
||||||
void test_spdylay_session_add_frame();
|
void test_spdylay_session_add_frame(void);
|
||||||
void test_spdylay_session_on_syn_stream_received();
|
void test_spdylay_session_on_syn_stream_received(void);
|
||||||
void test_spdylay_session_on_syn_stream_received_with_push();
|
void test_spdylay_session_on_syn_stream_received_with_push(void);
|
||||||
void test_spdylay_session_on_syn_reply_received();
|
void test_spdylay_session_on_syn_reply_received(void);
|
||||||
void test_spdylay_session_on_window_update_received();
|
void test_spdylay_session_on_window_update_received(void);
|
||||||
void test_spdylay_session_send_syn_stream();
|
void test_spdylay_session_send_syn_stream(void);
|
||||||
void test_spdylay_session_send_syn_reply();
|
void test_spdylay_session_send_syn_reply(void);
|
||||||
void test_spdylay_submit_response();
|
void test_spdylay_submit_response(void);
|
||||||
void test_spdylay_submit_response_with_null_data_read_callback();
|
void test_spdylay_submit_response_with_null_data_read_callback(void);
|
||||||
void test_spdylay_submit_request_with_data();
|
void test_spdylay_submit_request_with_data(void);
|
||||||
void test_spdylay_submit_request_with_null_data_read_callback();
|
void test_spdylay_submit_request_with_null_data_read_callback(void);
|
||||||
void test_spdylay_submit_syn_stream();
|
void test_spdylay_submit_syn_stream(void);
|
||||||
void test_spdylay_submit_syn_reply();
|
void test_spdylay_submit_syn_reply(void);
|
||||||
void test_spdylay_submit_headers();
|
void test_spdylay_submit_headers(void);
|
||||||
void test_spdylay_session_reply_fail();
|
void test_spdylay_session_reply_fail(void);
|
||||||
void test_spdylay_session_on_headers_received();
|
void test_spdylay_session_on_headers_received(void);
|
||||||
void test_spdylay_session_on_ping_received();
|
void test_spdylay_session_on_ping_received(void);
|
||||||
void test_spdylay_session_on_goaway_received();
|
void test_spdylay_session_on_goaway_received(void);
|
||||||
void test_spdylay_session_on_data_received();
|
void test_spdylay_session_on_data_received(void);
|
||||||
void test_spdylay_session_on_rst_received();
|
void test_spdylay_session_on_rst_received(void);
|
||||||
void test_spdylay_session_is_my_stream_id();
|
void test_spdylay_session_is_my_stream_id(void);
|
||||||
void test_spdylay_session_send_rst_stream();
|
void test_spdylay_session_send_rst_stream(void);
|
||||||
void test_spdylay_session_get_next_ob_item();
|
void test_spdylay_session_get_next_ob_item(void);
|
||||||
void test_spdylay_session_pop_next_ob_item();
|
void test_spdylay_session_pop_next_ob_item(void);
|
||||||
void test_spdylay_session_on_request_recv_callback();
|
void test_spdylay_session_on_request_recv_callback(void);
|
||||||
void test_spdylay_session_on_stream_close();
|
void test_spdylay_session_on_stream_close(void);
|
||||||
void test_spdylay_session_max_concurrent_streams();
|
void test_spdylay_session_max_concurrent_streams(void);
|
||||||
void test_spdylay_session_data_backoff_by_high_pri_frame();
|
void test_spdylay_session_data_backoff_by_high_pri_frame(void);
|
||||||
void test_spdylay_session_stop_data_with_rst_stream();
|
void test_spdylay_session_stop_data_with_rst_stream(void);
|
||||||
void test_spdylay_session_stream_close_on_syn_stream();
|
void test_spdylay_session_stream_close_on_syn_stream(void);
|
||||||
void test_spdylay_session_recv_invalid_frame();
|
void test_spdylay_session_recv_invalid_frame(void);
|
||||||
void test_spdylay_session_defer_data();
|
void test_spdylay_session_defer_data(void);
|
||||||
void test_spdylay_session_flow_control();
|
void test_spdylay_session_flow_control(void);
|
||||||
void test_spdylay_session_on_ctrl_not_send();
|
void test_spdylay_session_on_ctrl_not_send(void);
|
||||||
void test_spdylay_session_on_settings_received();
|
void test_spdylay_session_on_settings_received(void);
|
||||||
void test_spdylay_submit_settings();
|
void test_spdylay_submit_settings(void);
|
||||||
void test_spdylay_session_get_outbound_queue_size();
|
void test_spdylay_session_get_outbound_queue_size(void);
|
||||||
|
|
||||||
#endif // SPDYLAY_SESSION_TEST_H
|
#endif /* SPDYLAY_SESSION_TEST_H */
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "spdylay_stream.h"
|
#include "spdylay_stream.h"
|
||||||
|
|
||||||
void test_spdylay_stream_add_pushed_stream()
|
void test_spdylay_stream_add_pushed_stream(void)
|
||||||
{
|
{
|
||||||
spdylay_stream stream;
|
spdylay_stream stream;
|
||||||
int i, n;
|
int i, n;
|
||||||
@ -37,7 +37,7 @@ void test_spdylay_stream_add_pushed_stream()
|
|||||||
n = 26;
|
n = 26;
|
||||||
for(i = 2; i < n; i += 2) {
|
for(i = 2; i < n; i += 2) {
|
||||||
CU_ASSERT(0 == spdylay_stream_add_pushed_stream(&stream, i));
|
CU_ASSERT(0 == spdylay_stream_add_pushed_stream(&stream, i));
|
||||||
CU_ASSERT(i/2 == stream.pushed_streams_length);
|
CU_ASSERT((size_t)i/2 == stream.pushed_streams_length);
|
||||||
}
|
}
|
||||||
for(i = 2; i < n; i += 2) {
|
for(i = 2; i < n; i += 2) {
|
||||||
CU_ASSERT(i == stream.pushed_streams[i/2-1]);
|
CU_ASSERT(i == stream.pushed_streams[i/2-1]);
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
#ifndef SPDYLAY_STREAM_TEST_H
|
#ifndef SPDYLAY_STREAM_TEST_H
|
||||||
#define SPDYLAY_STREAM_TEST_H
|
#define SPDYLAY_STREAM_TEST_H
|
||||||
|
|
||||||
void test_spdylay_stream_add_pushed_stream();
|
void test_spdylay_stream_add_pushed_stream(void);
|
||||||
|
|
||||||
#endif /* SPDYLAY_STREAM_TEST_H */
|
#endif /* SPDYLAY_STREAM_TEST_H */
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "spdylay_zlib.h"
|
#include "spdylay_zlib.h"
|
||||||
|
|
||||||
void test_spdylay_zlib_with(uint16_t version)
|
static void test_spdylay_zlib_with(uint16_t version)
|
||||||
{
|
{
|
||||||
spdylay_zlib deflater, inflater;
|
spdylay_zlib deflater, inflater;
|
||||||
const char msg[] =
|
const char msg[] =
|
||||||
@ -70,12 +70,12 @@ void test_spdylay_zlib_with(uint16_t version)
|
|||||||
spdylay_buffer_free(&buf);
|
spdylay_buffer_free(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_zlib_spdy2()
|
void test_spdylay_zlib_spdy2(void)
|
||||||
{
|
{
|
||||||
test_spdylay_zlib_with(SPDYLAY_PROTO_SPDY2);
|
test_spdylay_zlib_with(SPDYLAY_PROTO_SPDY2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_spdylay_zlib_spdy3()
|
void test_spdylay_zlib_spdy3(void)
|
||||||
{
|
{
|
||||||
test_spdylay_zlib_with(SPDYLAY_PROTO_SPDY3);
|
test_spdylay_zlib_with(SPDYLAY_PROTO_SPDY3);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#ifndef SPDYLAY_ZLIB_TEST_H
|
#ifndef SPDYLAY_ZLIB_TEST_H
|
||||||
#define SPDYLAY_ZLIB_TEST_H
|
#define SPDYLAY_ZLIB_TEST_H
|
||||||
|
|
||||||
void test_spdylay_zlib_spdy2();
|
void test_spdylay_zlib_spdy2(void);
|
||||||
void test_spdylay_zlib_spdy3();
|
void test_spdylay_zlib_spdy3(void);
|
||||||
|
|
||||||
#endif // SPDYLAY_ZLIB_TEST_H
|
#endif /* SPDYLAY_ZLIB_TEST_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user