This driver compresses its data stream before sending it to the link layer.
#include "common.h"
#include <zlib.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 | |
| #define | DF_FLOWC 0x00000001 |
| We flow-controlled the upper layer. | |
| #define | DF_NAGLE 0x00000002 |
| Nagle timer started. | |
| #define | DF_FLUSH 0x00000004 |
| Flushing started. | |
| #define | DF_SHUTDOWN 0x00000008 |
| Stack has shut down. | |
Functions | |
| 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, gconstpointer 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_ops * | tx_deflate_get_ops (void) |
Variables | |
| const struct txdrv_ops | tx_deflate_ops |
|
|
|
|
|
200 ms
|
|
|
We flow-controlled the upper layer.
|
|
|
Flushing started.
|
|
|
Nagle timer started.
|
|
|
Stack has shut down.
|
|
||||||||||||||||
|
Compress as much data as possible to the output buffer, sending data as we go along.
|
|
|
Flush compression within filling buffer.
|
|
|
Flush compression and send whatever we got so far.
|
|
|
Start the nagle timer.
|
|
|
Stop the nagle timer.
|
|
||||||||||||
|
Called from the callout queue when the Nagle timer expires. If we can send the buffer, flush it and send it. Otherwise, reschedule. |
|
|
Make the "filling buffer" the buffer to send, and rotate filling buffers. Attempt to write the new send buffer immediately. |
|
|
Write ready-to-be-sent buffer to the lower layer. < Amount of bytes to send |
|
|
Service routine for the compressing stage. Called by lower layer when it is ready to process more data. |
|
||||||||||||||||
|
Close the layer, flushing all the data there is. Once this is done, invoke the supplied callback. |
|
|
Get rid of the driver's private data.
|
|
|
Disable servicing of upper TX queue.
|
|
|
Allow servicing of upper TX queue.
|
|
|
Trigger the Nagle timeout immediately, if registered.
|
|
|
|
|
||||||||||||
|
Initialize the driver.
|
|
|
|
|
|
Disable all transmission.
|
|
||||||||||||||||
|
Write data buffer.
|
|
||||||||||||||||
|
Write I/O vector.
|
|
|
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,
}
|
1.3.9.1