This driver performed a "chunked" encoding of the data it receives before transmitting them. The specification of that encoding are those of HTTP/1.1, namely:
Chunked-Body = *chunk last-chunk trailer CRLF
chunk = chunk-size [ chunk-extension ] CRLF chunk-data CRLF chunk-size = 1*HEX last-chunk = 1*("0") [ chunk-extension ] CRLF
chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) chunk-ext-name = token chunk-ext-val = token | quoted-string chunk-data = chunk-size(OCTET) trailer = *(entity-header CRLF)
#include "common.h"
#include "tx.h"
#include "tx_chunk.h"
#include "if/gnet_property_priv.h"
#include "lib/cq.h"
#include "lib/glib-missing.h"
#include "lib/walloc.h"
#include "lib/override.h"
Data Structures | |
| struct | attr | 
| Private attributes for the decompressing layer.  More... | |
Defines | |
| #define | CHUNK_DIGITS 4 /* At most that many digits in hexa */ | 
Functions | |
| RCSID ("$Id:tx_chunk.c, v 1.12 2005/10/31 06:31:48 cbiere Exp $") | |
| ssize_t | chunk_flush_header (txdrv_t *tx) | 
| Flush the chunk header by sending it to the wire.   | |
| ssize_t | chunk_begin (txdrv_t *tx, size_t len, gboolean final) | 
| Begin new chunk of said length, committing to write that much at least until the new chunk header.   | |
| ssize_t | chunk_acceptable (txdrv_t *tx, size_t len) | 
| Compute how much data we can still send within the current chunk, knowing that we're offered `len' bytes from the upper layer.   | |
| void | chunk_service (gpointer data) | 
| Service routine for the chunking stage.   | |
| gpointer | tx_chunk_init (txdrv_t *tx, gpointer unused_args) | 
| Initialize the driver.   | |
| void | tx_chunk_destroy (txdrv_t *tx) | 
| Get rid of the driver's private data.   | |
| ssize_t | tx_chunk_write (txdrv_t *tx, gpointer data, size_t len) | 
| Write data buffer.   | |
| ssize_t | tx_chunk_writev (txdrv_t *tx, struct iovec *iov, gint iovcnt) | 
| Write I/O vector.   | |
| void | tx_chunk_enable (txdrv_t *unused_tx) | 
| Allow servicing of upper TX queue.   | |
| void | tx_chunk_disable (txdrv_t *unused_tx) | 
| Disable servicing of upper TX queue.   | |
| size_t | tx_chunk_pending (txdrv_t *tx) | 
| void | tx_chunk_flush (txdrv_t *tx) | 
| Send buffered data, if any.   | |
| void | tx_chunk_shutdown (txdrv_t *tx) | 
| Disable all further transmission.   | |
| void | tx_chunk_close (txdrv_t *tx, tx_closed_t cb, gpointer arg) | 
| Close the layer, flushing all the data there is.   | |
| const struct txdrv_ops * | tx_chunk_get_ops (void) | 
Variables | |
| const struct txdrv_ops | tx_chunk_ops | 
      
  | 
  
| 
 
  | 
  
      
  | 
  ||||||||||||
| 
 Compute how much data we can still send within the current chunk, knowing that we're offered `len' bytes from the upper layer. 
  | 
  
      
  | 
  ||||||||||||||||
| 
 Begin new chunk of said length, committing to write that much at least until the new chunk header. 
 
  | 
  
      
  | 
  
| 
 Flush the chunk header by sending it to the wire. 
 
  | 
  
      
  | 
  
| 
 Service routine for the chunking 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. 
  | 
  
      
  | 
  
| 
 Send buffered data, if any. 
  | 
  
      
  | 
  
| 
 
  | 
  
      
  | 
  ||||||||||||
| 
 Initialize the driver. Always succeeds, so never returns NULL.  | 
  
      
  | 
  
| 
 
 
  | 
  
      
  | 
  
| 
 Disable all further transmission. 
  | 
  
      
  | 
  ||||||||||||||||
| 
 Write data buffer. 
 
  | 
  
      
  | 
  ||||||||||||||||
| 
 Write I/O vector. 
 
  | 
  
      
  | 
  
| 
 Initial value:  {
    tx_chunk_init,      
    tx_chunk_destroy,   
    tx_chunk_write,     
    tx_chunk_writev,    
    tx_no_sendto,       
    tx_chunk_enable,    
    tx_chunk_disable,   
    tx_chunk_pending,   
    tx_chunk_flush,     
    tx_chunk_shutdown,  
    tx_chunk_close,     
    tx_no_source,       
}
 | 
  
 
1.3.6