#include "common.h"
#include "ioheader.h"
#include "sockets.h"
#include "bsched.h"
#include "lib/getline.h"
#include "lib/header.h"
#include "lib/inputevt.h"
#include "lib/misc.h"
#include "lib/walloc.h"
#include "if/gnet_property_priv.h"
#include "lib/override.h"
Data Structures | |
struct | io_header |
This structure is used to encapsulate the various arguments required by the header parsing I/O callbacks. More... | |
Defines | |
#define | DFLT_SIZE 2048 /**< Expected headers should not be larger */ |
Expected headers should not be larger. | |
Functions | |
RCSID ("$Id:ioheader.c, v 1.12 2005/09/17 22:30:28 rmanfredi Exp $") | |
void | io_free (gpointer opaque) |
Free the opaque I/O data. | |
header * | io_header (gpointer opaque) |
Fetch header structure from opaque I/O data. | |
getline * | io_getline (gpointer opaque) |
Fetch getline structure from opaque I/O data. | |
gchar * | io_gettext (gpointer opaque) |
Fetch header text as C string from opaque I/O data. | |
void | io_header_parse (struct io_header *ih) |
This routine is called to parse the input buffer (the socket's buffer), a line at a time, until EOH is reached. | |
void | io_read_data (gpointer data, gint unused_source, inputevt_cond_t cond) |
This routine is installed as an input callback to read the headers into the socket's buffer. | |
void | io_get_header (gpointer resource, gpointer *io_opaque, bsched_t *bs, struct gnutella_socket *s, gint flags, io_done_cb_t done, io_start_cb_t start, const struct io_error *error) |
Setup input callback and context for reading/parsing the header. | |
void | io_continue_header (gpointer opaque, gint flags, io_done_cb_t done, io_start_cb_t start) |
Optional: called when reading 1st byte. |
|
Expected headers should not be larger.
|
|
Optional: called when reading 1st byte. This is used when we're receiving an incoming connection. Once we have parsed the initial handshaking headers, we're replying and then we have to parse the final handshaking headers from our peer. That's when this routine is called.
|
|
Free the opaque I/O data.
|
|
Setup input callback and context for reading/parsing the header. The I/O parsing context is directly written into the structure. Data is read into the supplied socket's buffer, and then stuffed into the headers, unless the IO_SAVE_FIRST flag is set, in which case the very first line will be copied into the (dynamically allocated) socket's getline buffer.
|
|
Fetch getline structure from opaque I/O data.
|
|
Fetch header text as C string from opaque I/O data. It is up to the caller to strdup the data if needed. The returned data will be freed when io_free() is called. |
|
Fetch header structure from opaque I/O data.
|
|
This routine is called to parse the input buffer (the socket's buffer), a line at a time, until EOH is reached.
|
|
This routine is installed as an input callback to read the headers into the socket's buffer. Read data is then handed out to io_header_parse() for analysis. |
|
|