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

mq.h File Reference


Detailed Description

Message queues.

Author:
Raphael Manfredi
Date:
2002-2003

#include <glib.h>
#include "gnutella.h"
#include "pmsg.h"
#include "tx.h"

Go to the source code of this file.

Data Structures

struct  mq_ops
 Operations defined on all mq types. More...

struct  mq_cops
struct  mqueue
 A message queue. More...


Defines

#define MQ_FLOWC   0x00000001 /**< In flow control */
 In flow control.

#define MQ_DISCARD   0x00000002 /**< No writing, discard message */
 No writing, discard message.

#define MQ_SWIFT   0x00000004 /**< Swift mode, dropping more traffic */
 Swift mode, dropping more traffic.

#define MQ_WARNZONE   0x00000008 /**< Between hiwat and lowat */
 Between hiwat and lowat.

#define mq_is_flow_controlled(q)   ((q)->flags & MQ_FLOWC)
#define mq_is_swift_controlled(q)   ((q)->flags & MQ_SWIFT)
#define mq_maxsize(q)   ((q)->maxsize)
#define mq_size(q)   ((q)->size)
#define mq_lowat(q)   ((q)->lowat)
#define mq_hiwat(q)   ((q)->hiwat)
#define mq_count(q)   ((q)->count)
#define mq_pending(q)   ((q)->size + tx_pending((q)->tx_drv))
#define mq_bio(q)   (tx_bio_source((q)->tx_drv))
#define mq_node(q)   ((q)->node)

Typedefs

typedef mqueue mqueue_t

Functions

void mq_putq (mqueue_t *q, pmsg_t *mb)
 Enqueue message, which becomes owned by the queue.

void mq_free (mqueue_t *q)
 Free queue and all enqueued messages.

void mq_clear (mqueue_t *q)
 Remove all unsent messages from the queue.

void mq_discard (mqueue_t *q)
 Forbid further writes to the queue.

void mq_shutdown (mqueue_t *q)
 Disable all further writes from the queue.

void mq_fill_ops (struct mq_ops *ops)
const struct mq_copsmq_get_cops (void)
 Get common operations.


Define Documentation

#define mq_bio  )     (tx_bio_source((q)->tx_drv))
 

#define mq_count  )     ((q)->count)
 

#define MQ_DISCARD   0x00000002 /**< No writing, discard message */
 

No writing, discard message.

#define MQ_FLOWC   0x00000001 /**< In flow control */
 

In flow control.

#define mq_hiwat  )     ((q)->hiwat)
 

#define mq_is_flow_controlled  )     ((q)->flags & MQ_FLOWC)
 

#define mq_is_swift_controlled  )     ((q)->flags & MQ_SWIFT)
 

#define mq_lowat  )     ((q)->lowat)
 

#define mq_maxsize  )     ((q)->maxsize)
 

#define mq_node  )     ((q)->node)
 

#define mq_pending  )     ((q)->size + tx_pending((q)->tx_drv))
 

#define mq_size  )     ((q)->size)
 

#define MQ_SWIFT   0x00000004 /**< Swift mode, dropping more traffic */
 

Swift mode, dropping more traffic.

#define MQ_WARNZONE   0x00000008 /**< Between hiwat and lowat */
 

Between hiwat and lowat.


Typedef Documentation

typedef struct mqueue mqueue_t
 


Function Documentation

void mq_clear mqueue_t q  ) 
 

Remove all unsent messages from the queue.

void mq_discard mqueue_t q  ) 
 

Forbid further writes to the queue.

void mq_fill_ops struct mq_ops ops  ) 
 

void mq_free mqueue_t q  ) 
 

Free queue and all enqueued messages.

Since the message queue is the top of the network TX stack, calling mq_free() recursively requests freeing to lower layers.

const struct mq_cops* mq_get_cops void   ) 
 

Get common operations.

void mq_putq mqueue_t q,
pmsg_t mb
 

Enqueue message, which becomes owned by the queue.

void mq_shutdown mqueue_t q  ) 
 

Disable all further writes from the queue.


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