#include "common.h"
#include "bsched.h"
Go to the source code of this file.
Data Structures | |
| struct | io_error |
| This structure holds all the per-resource callbacks that can be used during header processing in case something goes wrong. More... | |
Defines | |
| #define | IO_HEAD_ONLY 0x00000001 |
| No data expected after EOH. | |
| #define | IO_SAVE_FIRST 0x00000002 |
| Save 1st line in socket's getline. | |
| #define | IO_SINGLE_LINE 0x00000004 |
| Get one line only, then process. | |
| #define | IO_3_WAY 0x00000008 |
| In 3-way handshaking. | |
| #define | IO_SAVE_HEADER 0x00000010 |
| Save header text for later perusal. | |
Typedefs | |
| typedef void(* | io_done_cb_t )(gpointer resource, struct header *header) |
| typedef void(* | io_start_cb_t )(gpointer resource) |
Functions | |
| 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_get_header (gpointer resource, gpointer *io_opaque, bsched_bws_t bws, struct gnutella_socket *s, gint flags, io_done_cb_t done, io_start_cb_t start, const struct io_error *error) |
| Mandatory: error callbacks for resource. | |
| void | io_continue_header (gpointer opaque, gint flags, io_done_cb_t done, io_start_cb_t start) |
| Optional: called when reading 1st byte. | |
|
|
In 3-way handshaking.
|
|
|
No data expected after EOH.
|
|
|
Save 1st line in socket's getline.
|
|
|
Save header text for later perusal.
|
|
|
Get one line only, then process.
|
|
|
|
|
|
|
|
||||||||||||||||||||
|
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.
|
|
||||||||||||||||||||||||||||||||||||
|
Mandatory: error callbacks for resource. 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.
|
1.3.9.1