Loading...
Searching...
No Matches
connection_driver.h
Go to the documentation of this file.
#ifndef PROTON_CONNECTION_DRIVER_H
#define PROTON_CONNECTION_DRIVER_H 1
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include <proton/import_export.h>
#include <proton/event.h>
#include <proton/types.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct pn_connection_driver_t {
pn_connection_t *connection;
pn_transport_t *transport;
pn_collector_t *collector;
} pn_connection_driver_t;
PN_EXTERN int pn_connection_driver_init(pn_connection_driver_t*, pn_connection_t*, pn_transport_t*);
PN_EXTERN int pn_connection_driver_bind(pn_connection_driver_t *d);
PN_EXTERN void pn_connection_driver_destroy(pn_connection_driver_t *);
PN_EXTERN pn_connection_t *pn_connection_driver_release_connection(pn_connection_driver_t *d);
PN_EXTERN pn_rwbytes_t pn_connection_driver_read_buffer_sized(pn_connection_driver_t *, size_t n);
PN_EXTERN pn_rwbytes_t pn_connection_driver_read_buffer(pn_connection_driver_t *);
PN_EXTERN void pn_connection_driver_read_done(pn_connection_driver_t *, size_t n);
PN_EXTERN void pn_connection_driver_read_close(pn_connection_driver_t *);
PN_EXTERN bool pn_connection_driver_read_closed(pn_connection_driver_t *);
PN_EXTERN pn_bytes_t pn_connection_driver_write_buffer(pn_connection_driver_t *);
PN_EXTERN pn_bytes_t pn_connection_driver_write_done(pn_connection_driver_t *, size_t n);
PN_EXTERN void pn_connection_driver_write_close(pn_connection_driver_t *);
PN_EXTERN bool pn_connection_driver_write_closed(pn_connection_driver_t *);
PN_EXTERN void pn_connection_driver_close(pn_connection_driver_t * c);
PN_EXTERN pn_event_t* pn_connection_driver_next_event(pn_connection_driver_t *);
PN_EXTERN bool pn_connection_driver_has_event(pn_connection_driver_t *);
PN_EXTERN bool pn_connection_driver_finished(pn_connection_driver_t *);
PN_EXTERN void pn_connection_driver_errorf(pn_connection_driver_t *d, const char *name, const char *fmt, ...);
PN_EXTERN void pn_connection_driver_verrorf(pn_connection_driver_t *d, const char *name, const char *fmt, va_list);
#define PN_TRANSPORT_WRITE_CLOSED PN_TRANSPORT_HEAD_CLOSED
#define PN_TRANSPORT_READ_CLOSED PN_TRANSPORT_TAIL_CLOSED
PN_EXTERN void pn_connection_driver_log(pn_connection_driver_t *d, const char *msg);
PN_EXTERN void pn_connection_driver_logf(pn_connection_driver_t *d, const char *fmt, ...);
PN_EXTERN void pn_connection_driver_vlogf(pn_connection_driver_t *d, const char *fmt, va_list ap);
PN_EXTERN pn_connection_driver_t **pn_connection_driver_ptr(pn_connection_t *connection);
#ifdef __cplusplus
}
#endif
#endif /* connection_driver.h */
event.h
Protocol and transport events.
pn_bytes_t
A const byte buffer.
Definition types.h:216
pn_rwbytes_t
A non-const byte buffer.
Definition types.h:235
pn_connection_driver_write_closed
bool pn_connection_driver_write_closed(pn_connection_driver_t *)
True if write side is closed.
pn_connection_driver_read_buffer
pn_rwbytes_t pn_connection_driver_read_buffer(pn_connection_driver_t *)
Get the read buffer.
pn_connection_driver_read_close
void pn_connection_driver_read_close(pn_connection_driver_t *)
Close the read side.
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_...
pn_connection_driver_next_event
pn_event_t * pn_connection_driver_next_event(pn_connection_driver_t *)
Get the next event to handle.
pn_connection_driver_release_connection
pn_connection_t * pn_connection_driver_release_connection(pn_connection_driver_t *d)
Disassociate the driver's connection from its transport and collector and sets d->connection = NULL.
pn_connection_driver_errorf
void pn_connection_driver_errorf(pn_connection_driver_t *d, const char *name, const char *fmt,...)
Set transport error.
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.
pn_connection_driver_write_buffer
pn_bytes_t pn_connection_driver_write_buffer(pn_connection_driver_t *)
Get the write buffer.
pn_connection_driver_destroy
void pn_connection_driver_destroy(pn_connection_driver_t *)
Unbind, release and free the connection and transport.
pn_connection_driver_read_buffer_sized
pn_rwbytes_t pn_connection_driver_read_buffer_sized(pn_connection_driver_t *, size_t n)
Try to get a read buffer with the specified size.
pn_connection_driver_read_closed
bool pn_connection_driver_read_closed(pn_connection_driver_t *)
True if read side is closed.
pn_connection_driver_logf
void pn_connection_driver_logf(pn_connection_driver_t *d, const char *fmt,...)
Deprecated - Use pn_transport_logf().
pn_connection_driver_ptr
pn_connection_driver_t ** pn_connection_driver_ptr(pn_connection_t *connection)
Associate a pn_connection_t with its pn_connection_driver_t.
pn_connection_driver_write_done
pn_bytes_t 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.
pn_connection_driver_read_done
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.
pn_connection_driver_vlogf
void pn_connection_driver_vlogf(pn_connection_driver_t *d, const char *fmt, va_list ap)
Deprecated - Use pn_transport_vlogf().
pn_connection_driver_close
void pn_connection_driver_close(pn_connection_driver_t *c)
Close both sides.
pn_connection_driver_bind
int pn_connection_driver_bind(pn_connection_driver_t *d)
Force binding of the transport.
pn_connection_driver_verrorf
void pn_connection_driver_verrorf(pn_connection_driver_t *d, const char *name, const char *fmt, va_list)
Set transport error via a va_list, see pn_connection_driver_errorf()
pn_connection_driver_log
void pn_connection_driver_log(pn_connection_driver_t *d, const char *msg)
Deprecated - Use pn_transport_log().
pn_connection_driver_has_event
bool pn_connection_driver_has_event(pn_connection_driver_t *)
True if pn_connection_driver_next_event() will return a non-NULL event.
pn_connection_driver_write_close
void pn_connection_driver_write_close(pn_connection_driver_t *)
Close the write side.
pn_connection_driver_t
The elements needed to drive AMQP IO and events.
Definition connection_driver.h:90
pn_connection_t
struct pn_connection_t pn_connection_t
An AMQP Connection object.
Definition types.h:285
pn_event_t
struct pn_event_t pn_event_t
Notification of a state change in the protocol engine.
Definition event.h:75
pn_collector_t
struct pn_collector_t pn_collector_t
An event collector.
Definition types.h:417
pn_transport_t
struct pn_transport_t pn_transport_t
A network channel supporting an AMQP connection.
Definition types.h:435
types.h
AMQP and API data types.