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

rx_chunk.c File Reference


Detailed Description

Network RX -- chunked-encoding.

Author:
Christian Biere
Date:
2005

#include "common.h"
#include "pmsg.h"
#include "hosts.h"
#include "rx.h"
#include "rx_chunk.h"
#include "rxbuf.h"
#include "if/gnet_property_priv.h"
#include "lib/misc.h"
#include "lib/walloc.h"
#include "lib/override.h"

Data Structures

struct  attr
 Private attributes for the decompressing layer. More...


Defines

#define IF_ENABLED   0x00000001 /**< Reception enabled */
 Reception enabled.

#define IF_NO_CRLF   0x00000002 /**< Set when missing CRLF after data */
 Set when missing CRLF after data.


Enumerations

enum  chunk_state {
  CHUNK_STATE_ERROR = 0, CHUNK_STATE_SIZE, CHUNK_STATE_EXT, CHUNK_STATE_DATA,
  CHUNK_STATE_DATA_CRLF, CHUNK_STATE_TRAILER_START, CHUNK_STATE_TRAILER, CHUNK_STATE_END,
  NUM_CHUNK_STATES
}

Functions

 RCSID ("$Id:rx_chunk.c, v 1.17 2005/12/17 09:25:44 daichik Exp $")
size_t parse_chunk (rxdrv_t *rx, const gchar *src, size_t size, const gchar **p_error_str)
 Decodes "chunked" data.

pmsg_tdechunk_data (rxdrv_t *rx, pmsg_t *mb)
 Dechunk more data from the input buffer `mb'.

gpointer rx_chunk_init (rxdrv_t *rx, gconstpointer args)
 Initialize the driver.

void rx_chunk_destroy (rxdrv_t *rx)
 Get rid of the driver's private data.

void rx_chunk_recv (rxdrv_t *rx, pmsg_t *mb)
 Got data from lower layer.

void rx_chunk_enable (rxdrv_t *rx)
 Enable reception of data.

void rx_chunk_disable (rxdrv_t *rx)
 Disable reception of data.

const struct rxdrv_opsrx_chunk_get_ops (void)

Variables

const struct rxdrv_ops rx_chunk_ops


Define Documentation

#define IF_ENABLED   0x00000001 /**< Reception enabled */
 

Reception enabled.

#define IF_NO_CRLF   0x00000002 /**< Set when missing CRLF after data */
 

Set when missing CRLF after data.


Enumeration Type Documentation

enum chunk_state
 

Enumeration values:
CHUNK_STATE_ERROR 
CHUNK_STATE_SIZE 
CHUNK_STATE_EXT 
CHUNK_STATE_DATA 
CHUNK_STATE_DATA_CRLF 
CHUNK_STATE_TRAILER_START 
CHUNK_STATE_TRAILER 
CHUNK_STATE_END 
NUM_CHUNK_STATES 


Function Documentation

pmsg_t* dechunk_data rxdrv_t rx,
pmsg_t mb
[static]
 

Dechunk more data from the input buffer `mb'.

Returns:
dechunked data in a new buffer, or NULL if no more data.

size_t parse_chunk rxdrv_t rx,
const gchar *  src,
size_t  size,
const gchar **  p_error_str
[static]
 

Decodes "chunked" data.

The function returns as soon as it needs more data to proceed, on error, if the state CHUNK_STATE_END was reached, or if the state CHUNK_STATE_DATA was reached. In the latter case the chunk payload itself must be consumed and this function must not be called again until the state CHUNK_STATE_DATA_CRLF is reached.

Parameters:
rx the current RX driver.
src the chunk data.
size no document.
p_error_str if not NULL and parse_chunk() fails, it will point to an informational error message.
Returns:
0 on failure; non-zero amount of consumed bytes on success.

RCSID "$Id:rx_chunk.  c,
v 1.17 2005/12/17 09:25:44 daichik Exp $" 
 

void rx_chunk_destroy rxdrv_t rx  )  [static]
 

Get rid of the driver's private data.

void rx_chunk_disable rxdrv_t rx  )  [static]
 

Disable reception of data.

void rx_chunk_enable rxdrv_t rx  )  [static]
 

Enable reception of data.

const struct rxdrv_ops* rx_chunk_get_ops void   ) 
 

gpointer rx_chunk_init rxdrv_t rx,
gconstpointer  args
[static]
 

Initialize the driver.

void rx_chunk_recv rxdrv_t rx,
pmsg_t mb
[static]
 

Got data from lower layer.


Variable Documentation

const struct rxdrv_ops rx_chunk_ops [static]
 

Initial value:

 {
    rx_chunk_init,      
    rx_chunk_destroy,   
    rx_chunk_recv,      
    rx_chunk_enable,    
    rx_chunk_disable,   
    rx_no_source,       
}


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