Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

ioheader.h File Reference


Detailed Description

Asynchronous I/O header parsing routines.

Author:
Raphael Manfredi
Date:
2002-2003

#include <glib.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 */
 No data expected after EOH.

#define IO_SAVE_FIRST   0x00000002 /**< Save 1st line in socket's getline */
 Save 1st line in socket's getline.

#define IO_SINGLE_LINE   0x00000004 /**< Get one line only, then process */
 Get one line only, then process.

#define IO_3_WAY   0x00000008 /**< In 3-way handshaking */
 In 3-way handshaking.

#define IO_SAVE_HEADER   0x00000010 /**< Save header text for later perusal */
 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.

headerio_header (gpointer opaque)
 Fetch header structure from opaque I/O data.

getlineio_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, struct bsched *bs, 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.


Define Documentation

#define IO_3_WAY   0x00000008 /**< In 3-way handshaking */
 

In 3-way handshaking.

#define IO_HEAD_ONLY   0x00000001 /**< No data expected after EOH */
 

No data expected after EOH.

#define IO_SAVE_FIRST   0x00000002 /**< Save 1st line in socket's getline */
 

Save 1st line in socket's getline.

#define IO_SAVE_HEADER   0x00000010 /**< Save header text for later perusal */
 

Save header text for later perusal.

#define IO_SINGLE_LINE   0x00000004 /**< Get one line only, then process */
 

Get one line only, then process.


Typedef Documentation

typedef void(* io_done_cb_t)(gpointer resource, struct header *header)
 

typedef void(* io_start_cb_t)(gpointer resource)
 


Function Documentation

void io_continue_header gpointer  opaque,
gint  flags,
io_done_cb_t  done,
io_start_cb_t  start
 

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.

Parameters:
opaque  Existing header parsing context
flags  New I/O parsing flags
done  Mandatory: final callback when all done
start  Optional: called when reading 1st byte

void io_free gpointer  opaque  ) 
 

Free the opaque I/O data.

void io_get_header gpointer  resource,
gpointer *  io_opaque,
struct bsched bs,
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.

Parameters:
resource  Resource for which we're reading headers
io_opaque  Field address in resource's structure
bs  B/w scheduler from which we read
s  Socket from which we're reading
flags  I/O parsing flags
done  Mandatory: final callback when all done
start  Optional: called when reading 1st byte

struct 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.

It is up to the caller to strdup the data if needed. The returned data will be freed when io_free() is called.

struct header* io_header gpointer  opaque  ) 
 

Fetch header structure from opaque I/O data.


Generated on Sun Feb 12 10:50:03 2006 for Gtk-Gnutella by doxygen 1.3.6