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

tx_deflate.c File Reference


Detailed Description

Network driver -- compressing level.

This driver compresses its data stream before sending it to the link layer.

Author:
Raphael Manfredi
Date:
2002-2003

#include "common.h"
#include "sockets.h"
#include "hosts.h"
#include "tx.h"
#include "tx_deflate.h"
#include "if/gnet_property_priv.h"
#include "lib/endian.h"
#include "lib/walloc.h"
#include "lib/zlib_util.h"
#include "lib/override.h"

Data Structures

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


Defines

#define BUFFER_COUNT   2
#define BUFFER_NAGLE   200 /**< 200 ms */
 200 ms

#define DF_FLOWC   0x00000001 /**< We flow-controlled the upper layer */
 We flow-controlled the upper layer.

#define DF_NAGLE   0x00000002 /**< Nagle timer started */
 Nagle timer started.

#define DF_FLUSH   0x00000004 /**< Flushing started */
 Flushing started.

#define DF_SHUTDOWN   0x00000008 /**< Stack has shut down */
 Stack has shut down.


Functions

 RCSID ("$Id:tx_deflate.c, v 1.31 2005/11/15 21:30:07 rmanfredi Exp $")
void deflate_nagle_timeout (cqueue_t *cq, gpointer arg)
 Called from the callout queue when the Nagle timer expires.

size_t tx_deflate_pending (txdrv_t *tx)
void deflate_send (txdrv_t *tx)
 Write ready-to-be-sent buffer to the lower layer.

void deflate_nagle_start (txdrv_t *tx)
 Start the nagle timer.

void deflate_nagle_stop (txdrv_t *tx)
 Stop the nagle timer.

void deflate_rotate_and_send (txdrv_t *tx)
 Make the "filling buffer" the buffer to send, and rotate filling buffers.

gboolean deflate_flush (txdrv_t *tx)
 Flush compression within filling buffer.

void deflate_flush_send (txdrv_t *tx)
 Flush compression and send whatever we got so far.

gint deflate_add (txdrv_t *tx, gconstpointer data, gint len)
 Compress as much data as possible to the output buffer, sending data as we go along.

void deflate_service (gpointer data)
 Service routine for the compressing stage.

gpointer tx_deflate_init (txdrv_t *tx, gpointer args)
 Initialize the driver.

void tx_deflate_destroy (txdrv_t *tx)
 Get rid of the driver's private data.

ssize_t tx_deflate_write (txdrv_t *tx, gpointer data, size_t len)
 Write data buffer.

ssize_t tx_deflate_writev (txdrv_t *tx, struct iovec *iov, gint iovcnt)
 Write I/O vector.

void tx_deflate_enable (txdrv_t *unused_tx)
 Allow servicing of upper TX queue.

void tx_deflate_disable (txdrv_t *unused_tx)
 Disable servicing of upper TX queue.

void tx_deflate_flush (txdrv_t *tx)
 Trigger the Nagle timeout immediately, if registered.

void tx_deflate_shutdown (txdrv_t *tx)
 Disable all transmission.

void tx_deflate_close (txdrv_t *tx, tx_closed_t cb, gpointer arg)
 Close the layer, flushing all the data there is.

const struct txdrv_opstx_deflate_get_ops (void)

Variables

const struct txdrv_ops tx_deflate_ops


Define Documentation

#define BUFFER_COUNT   2
 

#define BUFFER_NAGLE   200 /**< 200 ms */
 

200 ms

#define DF_FLOWC   0x00000001 /**< We flow-controlled the upper layer */
 

We flow-controlled the upper layer.

#define DF_FLUSH   0x00000004 /**< Flushing started */
 

Flushing started.

#define DF_NAGLE   0x00000002 /**< Nagle timer started */
 

Nagle timer started.

#define DF_SHUTDOWN   0x00000008 /**< Stack has shut down */
 

Stack has shut down.


Function Documentation

gint deflate_add txdrv_t tx,
gconstpointer  data,
gint  len
[static]
 

Compress as much data as possible to the output buffer, sending data as we go along.

Returns:
the amount of input bytes that were consumed ("added"), -1 on error.

gboolean deflate_flush txdrv_t tx  )  [static]
 

Flush compression within filling buffer.

Returns:
success status, failure meaning we shutdown.

void deflate_flush_send txdrv_t tx  )  [static]
 

Flush compression and send whatever we got so far.

void deflate_nagle_start txdrv_t tx  )  [static]
 

Start the nagle timer.

void deflate_nagle_stop txdrv_t tx  )  [static]
 

Stop the nagle timer.

void deflate_nagle_timeout cqueue_t unused_cq,
gpointer  arg
[static]
 

Called from the callout queue when the Nagle timer expires.

If we can send the buffer, flush it and send it. Otherwise, reschedule.

void deflate_rotate_and_send txdrv_t tx  )  [static]
 

Make the "filling buffer" the buffer to send, and rotate filling buffers.

Attempt to write the new send buffer immediately.

void deflate_send txdrv_t tx  )  [static]
 

Write ready-to-be-sent buffer to the lower layer.

< Amount of bytes to send

void deflate_service gpointer  data  )  [static]
 

Service routine for the compressing stage.

Called by lower layer when it is ready to process more data.

RCSID "$Id:tx_deflate.  c,
v 1.31 2005/11/15 21:30:07 rmanfredi Exp $" 
 

void tx_deflate_close txdrv_t tx,
tx_closed_t  cb,
gpointer  arg
[static]
 

Close the layer, flushing all the data there is.

Once this is done, invoke the supplied callback.

void tx_deflate_destroy txdrv_t tx  )  [static]
 

Get rid of the driver's private data.

void tx_deflate_disable txdrv_t unused_tx  )  [static]
 

Disable servicing of upper TX queue.

void tx_deflate_enable txdrv_t unused_tx  )  [static]
 

Allow servicing of upper TX queue.

void tx_deflate_flush txdrv_t tx  )  [static]
 

Trigger the Nagle timeout immediately, if registered.

const struct txdrv_ops* tx_deflate_get_ops void   ) 
 

gpointer tx_deflate_init txdrv_t tx,
gpointer  args
[static]
 

Initialize the driver.

Returns:
NULL if there is an initialization problem.

size_t tx_deflate_pending txdrv_t tx  )  [static]
 

Returns:
the amount of data buffered locally.

void tx_deflate_shutdown txdrv_t tx  )  [static]
 

Disable all transmission.

ssize_t tx_deflate_write txdrv_t tx,
gpointer  data,
size_t  len
[static]
 

Write data buffer.

Returns:
amount of bytes written, or -1 on error.

ssize_t tx_deflate_writev txdrv_t tx,
struct iovec *  iov,
gint  iovcnt
[static]
 

Write I/O vector.

Returns:
amount of bytes written, or -1 on error.


Variable Documentation

const struct txdrv_ops tx_deflate_ops [static]
 

Initial value:

 {
    tx_deflate_init,        
    tx_deflate_destroy,     
    tx_deflate_write,       
    tx_deflate_writev,      
    tx_no_sendto,           
    tx_deflate_enable,      
    tx_deflate_disable,     
    tx_deflate_pending,     
    tx_deflate_flush,       
    tx_deflate_shutdown,    
    tx_deflate_close,       
    tx_no_source,           
}


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