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

tx.h File Reference


Detailed Description

Network driver.

Author:
Raphael Manfredi
Date:
2002-2003

#include <glib.h>
#include "if/core/hosts.h"

Go to the source code of this file.

Data Structures

struct  txdriver
 A network driver. More...

struct  txdrv_ops

Defines

#define TX_SERVICE   0x00000001 /**< Servicing of upper layer needed */
 Servicing of upper layer needed.

#define TX_ERROR   0x00000002 /**< Fatal error detected */
 Fatal error detected.

#define TX_DOWN   0x00000004 /**< No further writes allowed */
 No further writes allowed.

#define TX_CLOSING   0x00000008 /**< Closing, no further writes allowed */
 Closing, no further writes allowed.

#define TX_EAGER   0x00000010 /**< Always service the queue */
 Always service the queue.


Typedefs

typedef void(* tx_service_t )(gpointer obj)
typedef txdriver txdrv_t
 A network driver.

typedef void(* tx_closed_t )(txdrv_t *tx, gpointer arg)
 Operations defined on all drivers.


Functions

txdrv_ttx_make (gpointer owner, gnet_host_t *host, const struct txdrv_ops *ops, gpointer args)
 Create a new network driver, equipped with the `ops' operations and initialize its specific parameters by calling the init routine with `args'.

txdrv_ttx_make_above (txdrv_t *ltx, const struct txdrv_ops *ops, gpointer args)
 Createion routine for a driver to be stacked above specified lower `ltx'.

void tx_free (txdrv_t *tx)
 Dispose of the driver resources, asynchronously.

void tx_collect (void)
 Collect freed stacks.

ssize_t tx_write (txdrv_t *tx, gpointer data, size_t len)
 Write `len' bytes starting at `data'.

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

ssize_t tx_sendto (txdrv_t *tx, gnet_host_t *to, gpointer data, size_t len)
 Send buffer datagram to specified destination `to'.

void tx_srv_register (txdrv_t *d, tx_service_t srv_fn, gpointer srv_arg)
 Register service routine from upper TX layer.

void tx_srv_enable (txdrv_t *tx)
 Record that upper layer wants its service routine enabled.

void tx_srv_disable (txdrv_t *tx)
 Record that upper layer wants its service routine disabled.

size_t tx_pending (txdrv_t *tx)
bio_sourcetx_bio_source (txdrv_t *tx)
 The I/O source of the lowest layer (link) that physically sends the information.

ssize_t tx_no_write (txdrv_t *tx, gpointer data, size_t len)
 The write() operation is forbidden.

ssize_t tx_no_writev (txdrv_t *tx, struct iovec *iov, gint iovcnt)
 The writev() operation is forbidden.

ssize_t tx_no_sendto (txdrv_t *tx, gnet_host_t *to, gpointer data, size_t len)
 The sendto() operation is forbidden.

void tx_flush (txdrv_t *tx)
 Request that data be sent immediately.

void tx_shutdown (txdrv_t *tx)
 Shutdown stack, disallowing further writes.

void tx_close (txdrv_t *d, tx_closed_t cb, gpointer arg)
 Close the transmission by ensuring each layer properly finishes sending its data.

void tx_close_noop (txdrv_t *tx, tx_closed_t cb, gpointer arg)
 No-operation closing routine for layers that don't need anything special.

gboolean tx_has_error (txdrv_t *tx)
void tx_eager_mode (txdrv_t *tx, gboolean on)
 Set stack in "eager" mode: in that mode, servicing is always enabled in the whole stack, meaning the bottom layer always invokes the queue service routines whenever it can accept more data.

bio_sourcetx_no_source (txdrv_t *tx)
 No I/O source can be fetched from this layer.


Define Documentation

#define TX_CLOSING   0x00000008 /**< Closing, no further writes allowed */
 

Closing, no further writes allowed.

#define TX_DOWN   0x00000004 /**< No further writes allowed */
 

No further writes allowed.

#define TX_EAGER   0x00000010 /**< Always service the queue */
 

Always service the queue.

#define TX_ERROR   0x00000002 /**< Fatal error detected */
 

Fatal error detected.

#define TX_SERVICE   0x00000001 /**< Servicing of upper layer needed */
 

Servicing of upper layer needed.


Typedef Documentation

typedef void(* tx_closed_t)(txdrv_t *tx, gpointer arg)
 

Operations defined on all drivers.

typedef void(* tx_service_t)(gpointer obj)
 

typedef struct txdriver txdrv_t
 

A network driver.


Function Documentation

struct bio_source* tx_bio_source txdrv_t tx  ) 
 

The I/O source of the lowest layer (link) that physically sends the information.

void tx_close txdrv_t tx,
tx_closed_t  cb,
gpointer  arg
 

Close the transmission by ensuring each layer properly finishes sending its data.

When the whole stack is done, invoke the specified callback.

void tx_close_noop txdrv_t tx,
tx_closed_t  cb,
gpointer  arg
 

No-operation closing routine for layers that don't need anything special.

void tx_collect void   ) 
 

Collect freed stacks.

void tx_eager_mode txdrv_t tx,
gboolean  on
 

Set stack in "eager" mode: in that mode, servicing is always enabled in the whole stack, meaning the bottom layer always invokes the queue service routines whenever it can accept more data.

This mode is appropriate when the data to send is already generated or easily computed on demand and the limiting factor is the output bandwidth.

void tx_flush txdrv_t tx  ) 
 

Request that data be sent immediately.

void tx_free txdrv_t tx  ) 
 

Dispose of the driver resources, asynchronously.

It must be called on the top layer only.

gboolean tx_has_error txdrv_t tx  ) 
 

Returns:
TRUE if there is an error reported by any layer underneath.

txdrv_t* tx_make gpointer  owner,
gnet_host_t host,
const struct txdrv_ops ops,
gpointer  args
 

Create a new network driver, equipped with the `ops' operations and initialize its specific parameters by calling the init routine with `args'.

Returns:
NULL if there is an initialization problem.

txdrv_t* tx_make_above txdrv_t ltx,
const struct txdrv_ops ops,
gpointer  args
 

Createion routine for a driver to be stacked above specified lower `ltx'.

Returns:
NULL if there is an initialization problem.

ssize_t tx_no_sendto txdrv_t tx,
gnet_host_t to,
gpointer  data,
size_t  len
 

The sendto() operation is forbidden.

struct bio_source* tx_no_source txdrv_t tx  ) 
 

No I/O source can be fetched from this layer.

ssize_t tx_no_write txdrv_t tx,
gpointer  data,
size_t  len
 

The write() operation is forbidden.

ssize_t tx_no_writev txdrv_t tx,
struct iovec *  iov,
gint  iovcnt
 

The writev() operation is forbidden.

size_t tx_pending txdrv_t tx  ) 
 

Returns:
amount of data pending in the whole stack.

ssize_t tx_sendto txdrv_t tx,
gnet_host_t to,
gpointer  data,
size_t  len
 

Send buffer datagram to specified destination `to'.

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

void tx_shutdown txdrv_t tx  ) 
 

Shutdown stack, disallowing further writes.

void tx_srv_disable txdrv_t tx  ) 
 

Record that upper layer wants its service routine disabled.

void tx_srv_enable txdrv_t tx  ) 
 

Record that upper layer wants its service routine enabled.

void tx_srv_register txdrv_t d,
tx_service_t  srv_fn,
gpointer  srv_arg
 

Register service routine from upper TX layer.

ssize_t tx_write txdrv_t tx,
gpointer  data,
size_t  len
 

Write `len' bytes starting at `data'.

Returns:
the amount of bytes written, or -1 with errno set on error.

ssize_t tx_writev txdrv_t tx,
struct iovec *  iov,
gint  iovcnt
 

Write I/O vector.

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


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