diff --git a/includes/buf.h b/includes/buf.h new file mode 100644 index 0000000..cd52f6e --- /dev/null +++ b/includes/buf.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2013 Joris Vink + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef __H_BUF_H +#define __H_BUF_H + +#define KORE_BUF_INITIAL 128 +#define KORE_BUF_INCREMENT KORE_BUF_INITIAL + +struct kore_buf { + u_int8_t *data; + u_int32_t length; + u_int32_t offset; +}; + +struct kore_buf *kore_buf_create(u_int32_t); +void kore_buf_append(struct kore_buf *, u_int8_t *, u_int32_t); +u_int8_t *kore_buf_release(struct kore_buf *, u_int32_t *); + +#endif /* !__H_BUF_H */ diff --git a/includes/kore.h b/includes/kore.h index b35ad7c..8bb2e83 100644 --- a/includes/kore.h +++ b/includes/kore.h @@ -97,15 +97,6 @@ struct kore_module_handle { TAILQ_ENTRY(kore_module_handle) list; }; -#define KORE_BUF_INITIAL 128 -#define KORE_BUF_INCREMENT KORE_BUF_INITIAL - -struct kore_buf { - u_int8_t *data; - u_int32_t length; - u_int32_t offset; -}; - extern int server_port; extern char *server_ip; @@ -144,10 +135,6 @@ int net_recv_expand(struct connection *c, struct netbuf *, size_t, void net_send_queue(struct connection *, u_int8_t *, size_t, int, struct netbuf **, int (*cb)(struct netbuf *)); -struct kore_buf *kore_buf_create(u_int32_t); -void kore_buf_append(struct kore_buf *, u_int8_t *, u_int32_t); -u_int8_t *kore_buf_release(struct kore_buf *, u_int32_t *); - struct spdy_header_block *spdy_header_block_create(int); struct spdy_stream *spdy_stream_lookup(struct connection *, u_int32_t); int spdy_stream_get_header(struct spdy_header_block *, diff --git a/includes/spdy.h b/includes/spdy.h index 2b9d075..1fe1d8a 100644 --- a/includes/spdy.h +++ b/includes/spdy.h @@ -50,6 +50,9 @@ struct spdy_stream { u_int8_t flags; u_int8_t prio; + u_int32_t bytes_expected; + u_int32_t bytes_received; + struct spdy_header_block *hblock; TAILQ_ENTRY(spdy_stream) list; }; diff --git a/src/buf.c b/src/buf.c index fe1d3e9..b2c3010 100644 --- a/src/buf.c +++ b/src/buf.c @@ -33,6 +33,7 @@ #include #include +#include "buf.h" #include "spdy.h" #include "kore.h" diff --git a/src/config.c b/src/config.c index ae20602..2428686 100644 --- a/src/config.c +++ b/src/config.c @@ -34,6 +34,7 @@ #include #include +#include "buf.h" #include "spdy.h" #include "kore.h" diff --git a/src/http.c b/src/http.c index 70deb66..13d7dfd 100644 --- a/src/http.c +++ b/src/http.c @@ -34,6 +34,7 @@ #include #include +#include "buf.h" #include "spdy.h" #include "kore.h" #include "http.h" diff --git a/src/kore.c b/src/kore.c index 02ee5d7..c5c2c9c 100644 --- a/src/kore.c +++ b/src/kore.c @@ -35,6 +35,7 @@ #include #include +#include "buf.h" #include "spdy.h" #include "kore.h" #include "http.h" diff --git a/src/module.c b/src/module.c index 7eaf3a4..2e832ef 100644 --- a/src/module.c +++ b/src/module.c @@ -36,6 +36,7 @@ #include #include +#include "buf.h" #include "spdy.h" #include "kore.h" diff --git a/src/net.c b/src/net.c index 17a8a1d..e3fed51 100644 --- a/src/net.c +++ b/src/net.c @@ -34,6 +34,7 @@ #include #include +#include "buf.h" #include "spdy.h" #include "kore.h" diff --git a/src/spdy.c b/src/spdy.c index ee8c23c..9d91974 100644 --- a/src/spdy.c +++ b/src/spdy.c @@ -33,6 +33,7 @@ #include #include +#include "buf.h" #include "spdy.h" #include "kore.h" #include "http.h" diff --git a/src/utils.c b/src/utils.c index 8d552a9..9d6cfd2 100644 --- a/src/utils.c +++ b/src/utils.c @@ -33,6 +33,7 @@ #include #include +#include "buf.h" #include "spdy.h" #include "kore.h"