Loading...
Searching...
No Matches
connection_driver.hpp
Go to the documentation of this file.
#ifndef PROTON_IO_CONNECTION_DRIVER_HPP
#define PROTON_IO_CONNECTION_DRIVER_HPP
/*
*
* 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 "../connection_options.hpp"
#include "../error_condition.hpp"
#include "../fwd.hpp"
#include "../types_fwd.hpp"
#include <proton/connection_driver.h>
#include <string>
namespace proton {
class work_queue;
class proton_handler;
namespace io {
struct mutable_buffer {
char* data;
size_t size;
mutable_buffer(char* data_=0, size_t size_=0) : data(data_), size(size_) {}
};
struct const_buffer {
const char* data;
size_t size;
const_buffer(const char* data_=0, size_t size_=0) : data(data_), size(size_) {}
};
class
PN_CPP_CLASS_EXTERN connection_driver {
public:
PN_CPP_EXTERN connection_driver();
PN_CPP_EXTERN connection_driver(const std::string&);
PN_CPP_EXTERN ~connection_driver();
void configure(const connection_options& opts=connection_options(), bool server=false);
PN_CPP_EXTERN void connect(const connection_options& opts);
PN_CPP_EXTERN void accept(const connection_options& opts);
PN_CPP_EXTERN mutable_buffer read_buffer();
PN_CPP_EXTERN void read_done(size_t n);
PN_CPP_EXTERN void read_close();
PN_CPP_EXTERN const_buffer write_buffer();
PN_CPP_EXTERN const_buffer write_done(size_t n);
PN_CPP_EXTERN void write_close();
PN_CPP_EXTERN timestamp tick(timestamp now);
PN_CPP_EXTERN void disconnected(const error_condition& = error_condition());
PN_CPP_EXTERN bool has_events() const;
PN_CPP_EXTERN bool dispatch();
PN_CPP_EXTERN proton::connection connection() const;
PN_CPP_EXTERN proton::transport transport() const;
PN_CPP_EXTERN proton::container* container() const;
private:
void init();
connection_driver(const connection_driver&);
connection_driver& operator=(const connection_driver&);
std::string container_id_;
messaging_handler* handler_;
pn_connection_driver_t driver_;
};
} // io
} // proton
#endif // PROTON_IO_CONNECTION_DRIVER_HPP
proton::connection_options
Options for creating a connection.
Definition connection_options.hpp:67
proton::connection
A connection to a remote AMQP peer.
Definition connection.hpp:47
proton::container
A top-level container of connections, sessions, and links.
Definition container.hpp:49
proton::error_condition
Describes an endpoint error state.
Definition error_condition.hpp:39
proton::io::connection_driver::write_done
const_buffer write_done(size_t n)
Indicate that the first n bytes of write_buffer() have been written successfully.
proton::io::connection_driver::disconnected
void disconnected(const error_condition &=error_condition())
Inform the engine that the transport been disconnected unexpectedly, without completing the AMQP conn...
proton::io::connection_driver::read_done
void read_done(size_t n)
Indicate that the first n bytes of read_buffer() have valid data.
proton::io::connection_driver::connect
void connect(const connection_options &opts)
Call configure() with client options and call connection::open() Options applied: container::id(),...
proton::io::connection_driver::dispatch
bool dispatch()
Dispatch all available events and call the corresponding messaging_handler methods.
proton::io::connection_driver::connection_driver
connection_driver()
An engine without a container id.
proton::io::connection_driver::container
proton::container * container() const
Get the container associated with this connection_driver, if there is one.
proton::io::connection_driver::connection_driver
connection_driver(const std::string &)
Create a connection driver associated with a container id.
proton::io::connection_driver::connection
proton::connection connection() const
Get the AMQP connection associated with this connection_driver.
proton::io::connection_driver::configure
void configure(const connection_options &opts=connection_options(), bool server=false)
Configure a connection by applying exactly the options in opts (including proton::messaging_handler) ...
proton::io::connection_driver::accept
void accept(const connection_options &opts)
Call configure() with server options.
proton::io::connection_driver::has_events
bool has_events() const
There are events to be dispatched by dispatch().
proton::io::connection_driver::read_close
void read_close()
Indicate that the read side of the transport is closed and no more data will be read.
proton::io::connection_driver::tick
timestamp tick(timestamp now)
Indicate that time has passed.
proton::io::connection_driver::write_buffer
const_buffer write_buffer()
The engine's write buffer.
proton::io::connection_driver::write_close
void write_close()
Indicate that the write side of the transport has closed and no more data can be written.
proton::io::connection_driver::transport
proton::transport transport() const
Get the transport associated with this connection_driver.
proton::io::connection_driver::read_buffer
mutable_buffer read_buffer()
The engine's read buffer.
proton::messaging_handler
Handler for Proton messaging events.
Definition messaging_handler.hpp:69
proton::timestamp
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition timestamp.hpp:35
proton::transport
A network channel supporting an AMQP connection.
Definition transport.hpp:37
proton::work_queue
Unsettled API - A context for thread-safe execution of work.
Definition work_queue.hpp:327
connection_options.hpp
Options for creating a connection.
error_condition.hpp
Describes an endpoint error state.
fwd.hpp
Forward declarations.
proton::io
Unsettled API - Interfaces for IO integration.
Definition fwd.hpp:67
proton
The main Proton namespace.
Definition annotation_key.hpp:33
proton::io::const_buffer
Unsettled API - A pointer to an immutable memory region with a size.
Definition connection_driver.hpp:56
proton::io::const_buffer::size
size_t size
Number of bytes in the buffer.
Definition connection_driver.hpp:58
proton::io::const_buffer::data
const char * data
Beginning of the buffered data.
Definition connection_driver.hpp:57
proton::io::const_buffer::const_buffer
const_buffer(const char *data_=0, size_t size_=0)
Construct a buffer starting at data_ with size_ bytes.
Definition connection_driver.hpp:61
proton::io::mutable_buffer
Unsettled API - A pointer to a mutable memory region with a size.
Definition connection_driver.hpp:46
proton::io::mutable_buffer::size
size_t size
Number of bytes in the buffer.
Definition connection_driver.hpp:48
proton::io::mutable_buffer::data
char * data
Beginning of the buffered data.
Definition connection_driver.hpp:47
proton::io::mutable_buffer::mutable_buffer
mutable_buffer(char *data_=0, size_t size_=0)
Construct a buffer starting at data_ with size_ bytes.
Definition connection_driver.hpp:51
types_fwd.hpp
Forward declarations for Proton types used to represent AMQP types.