Qpid Proton C API  0.17.0
Connection driver

Experimental - Low-level IO integration More...

Classes

struct  pn_connection_driver_t
 The elements needed to drive AMQP IO and events. More...
 

Typedefs

typedef struct pn_connection_driver_t pn_connection_driver_t
 The elements needed to drive AMQP IO and events.
 

Functions

int pn_connection_driver_init (pn_connection_driver_t *, pn_connection_t *, pn_transport_t *)
 Set connection and transport to the provided values, or create a new pn_connection_t or pn_transport_t if either is NULL. More...
 
int pn_connection_driver_bind (pn_connection_driver_t *d)
 Force binding of the transport. More...
 
void pn_connection_driver_destroy (pn_connection_driver_t *)
 Unbind, release and free the connection and transport. More...
 
pn_rwbytes_t pn_connection_driver_read_buffer (pn_connection_driver_t *)
 Get the read buffer. More...
 
void pn_connection_driver_read_done (pn_connection_driver_t *, size_t n)
 Process the first n bytes of data in pn_connection_driver_read_buffer() and reclaim the buffer space.
 
void pn_connection_driver_read_close (pn_connection_driver_t *)
 Close the read side. More...
 
bool pn_connection_driver_read_closed (pn_connection_driver_t *)
 True if read side is closed.
 
pn_bytes_t pn_connection_driver_write_buffer (pn_connection_driver_t *)
 Get the write buffer. More...
 
void pn_connection_driver_write_done (pn_connection_driver_t *, size_t n)
 Call when the first n bytes of pn_connection_driver_write_buffer() have been written to IO. More...
 
void pn_connection_driver_write_close (pn_connection_driver_t *)
 Close the write side. More...
 
bool pn_connection_driver_write_closed (pn_connection_driver_t *)
 True if write side is closed.
 
void pn_connection_driver_close (pn_connection_driver_t *c)
 Close both sides side.
 
pn_event_tpn_connection_driver_next_event (pn_connection_driver_t *)
 Get the next event to handle. More...
 
bool pn_connection_driver_has_event (pn_connection_driver_t *)
 True if pn_connection_driver_next_event() will return a non-NULL event.
 
bool pn_connection_driver_finished (pn_connection_driver_t *)
 Return true if the the driver is closed for reading and writing and there are no more events. More...
 
void pn_connection_driver_errorf (pn_connection_driver_t *d, const char *name, const char *fmt,...)
 Set IO error information. More...
 
void pn_connection_driver_verrorf (pn_connection_driver_t *d, const char *name, const char *fmt, va_list)
 Set IO error information via a va_list, see pn_connection_driver_errorf()
 
void pn_connection_driver_log (pn_connection_driver_t *d, const char *msg)
 Log a string message using the connection's transport log.
 
void pn_connection_driver_logf (pn_connection_driver_t *d, char *fmt,...)
 Log a printf formatted message using the connection's transport log.
 
void pn_connection_driver_vlogf (pn_connection_driver_t *d, const char *fmt, va_list ap)
 Log a printf formatted message using the connection's transport log.
 
pn_connection_driver_tpn_event_batch_connection_driver (pn_event_batch_t *batch)
 If batch is part of a connection_driver, return the connection_driver address, else return NULL.
 

Detailed Description

Experimental - Low-level IO integration


Class Documentation

◆ pn_connection_driver_t

struct pn_connection_driver_t

The elements needed to drive AMQP IO and events.

Class Members
pn_event_batch_t batch
pn_connection_t * connection
pn_transport_t * transport

Function Documentation

◆ pn_connection_driver_bind()

int pn_connection_driver_bind ( pn_connection_driver_t d)

Force binding of the transport.

This happens automatically after the PN_CONNECTION_INIT is processed.

Returns
PN_STATE_ERR if the transport is already bound.

◆ pn_connection_driver_destroy()

void pn_connection_driver_destroy ( pn_connection_driver_t )

Unbind, release and free the connection and transport.

Set all pointers to NULL. Does not free the pn_connection_driver_t struct itself.

◆ pn_connection_driver_errorf()

void pn_connection_driver_errorf ( pn_connection_driver_t d,
const char *  name,
const char *  fmt,
  ... 
)

Set IO error information.

The name and formatted description are set on the transport condition, and returned as a PN_TRANSPORT_ERROR event from pn_connection_driver_next_event().

You must call this before pn_connection_driver_read_close() or pn_connection_driver_write_close() to ensure the error is processed.

◆ pn_connection_driver_finished()

bool pn_connection_driver_finished ( pn_connection_driver_t )

Return true if the the driver is closed for reading and writing and there are no more events.

Call pn_connection_driver_free() to free all related memory.

◆ pn_connection_driver_init()

int pn_connection_driver_init ( pn_connection_driver_t ,
pn_connection_t ,
pn_transport_t  
)

Set connection and transport to the provided values, or create a new pn_connection_t or pn_transport_t if either is NULL.

The provided values belong to the connection driver and will be freed by pn_connection_driver_destroy()

The transport is bound automatically after the PN_CONNECTION_INIT has been is handled by the application. It can be bound earlier with pn_connection_driver_bind().

The following functions must be called before the transport is bound to have effect: pn_connection_set_username(), pn_connection_set_password(), pn_transport_set_server()

Returns
PN_OUT_OF_MEMORY if any allocation fails.

◆ pn_connection_driver_next_event()

pn_event_t* pn_connection_driver_next_event ( pn_connection_driver_t )

Get the next event to handle.

Returns
pointer is valid till the next call of pn_connection_driver_next(). NULL if there are no more events available now, reading/writing may produce more.

◆ pn_connection_driver_read_buffer()

pn_rwbytes_t pn_connection_driver_read_buffer ( pn_connection_driver_t )

Get the read buffer.

Copy data from your input byte source to buf.start, up to buf.size. Call pn_connection_driver_read_done() when reading is complete.

buf.size==0 means reading is not possible: no buffer space or the read side is closed.

◆ pn_connection_driver_read_close()

void pn_connection_driver_read_close ( pn_connection_driver_t )

Close the read side.

Call when the IO can no longer be read.

◆ pn_connection_driver_write_buffer()

pn_bytes_t pn_connection_driver_write_buffer ( pn_connection_driver_t )

Get the write buffer.

Write data from buf.start to your IO destination, up to a max of buf.size. Call pn_connection_driver_write_done() when writing is complete.

buf.size==0 means there is nothing to write.

◆ pn_connection_driver_write_close()

void pn_connection_driver_write_close ( pn_connection_driver_t )

Close the write side.

Call when IO can no longer be written to.

◆ pn_connection_driver_write_done()

void pn_connection_driver_write_done ( pn_connection_driver_t ,
size_t  n 
)

Call when the first n bytes of pn_connection_driver_write_buffer() have been written to IO.

Reclaims the buffer space and reset the write buffer.