move buf stuff into its own header, so we can use it in spdy.h

This commit is contained in:
Joris Vink 2013-05-02 14:55:57 +02:00
parent 60ed3e0fd2
commit 84428f7133
11 changed files with 44 additions and 13 deletions

33
includes/buf.h Normal file
View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2013 Joris Vink <joris@coders.se>
*
* 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 */

View File

@ -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 *,

View File

@ -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;
};

View File

@ -33,6 +33,7 @@
#include <string.h>
#include <zlib.h>
#include "buf.h"
#include "spdy.h"
#include "kore.h"

View File

@ -34,6 +34,7 @@
#include <string.h>
#include <zlib.h>
#include "buf.h"
#include "spdy.h"
#include "kore.h"

View File

@ -34,6 +34,7 @@
#include <time.h>
#include <zlib.h>
#include "buf.h"
#include "spdy.h"
#include "kore.h"
#include "http.h"

View File

@ -35,6 +35,7 @@
#include <time.h>
#include <zlib.h>
#include "buf.h"
#include "spdy.h"
#include "kore.h"
#include "http.h"

View File

@ -36,6 +36,7 @@
#include <string.h>
#include <zlib.h>
#include "buf.h"
#include "spdy.h"
#include "kore.h"

View File

@ -34,6 +34,7 @@
#include <string.h>
#include <zlib.h>
#include "buf.h"
#include "spdy.h"
#include "kore.h"

View File

@ -33,6 +33,7 @@
#include <string.h>
#include <zlib.h>
#include "buf.h"
#include "spdy.h"
#include "kore.h"
#include "http.h"

View File

@ -33,6 +33,7 @@
#include <string.h>
#include <zlib.h>
#include "buf.h"
#include "spdy.h"
#include "kore.h"