connection_engine.hpp
#ifndef PROTON_IO_CONNECTION_ENGINE_HPP
#define PROTON_IO_CONNECTION_ENGINE_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 "../internal/config.hpp"
#include "../connection.hpp"
#include "../connection_options.hpp"
#include "../error.hpp"
#include "../error_condition.hpp"
#include "../internal/export.hpp"
#include "../internal/pn_unique_ptr.hpp"
#include "../transport.hpp"
#include "../types.hpp"
#include <proton/connection_engine.h>
#include <cstddef>
#include <utility>
#include <string>
namespace proton {
class event_loop;
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_engine {
public:
PN_CPP_EXTERN connection_engine();
PN_CPP_EXTERN connection_engine(proton::container&, event_loop* loop = 0);
PN_CPP_EXTERN ~connection_engine();
void configure(const connection_options& opts=connection_options());
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 void write_done(size_t n);
PN_CPP_EXTERN void write_close();
PN_CPP_EXTERN void disconnected(const error_condition& = error_condition());
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:
connection_engine(const connection_engine&);
connection_engine& operator=(const connection_engine&);
internal::pn_unique_ptr<proton_handler> handler_;
proton::container* container_;
pn_connection_engine_t c_engine_;
};
} // io
} // proton
#endif // PROTON_IO_CONNECTION_ENGINE_HPP
proton::io::const_buffer::size
size_t size
Number of bytes in the buffer.
Definition: connection_engine.hpp:60
proton::container
A top-level container of connections, sessions, senders, and receivers.
Definition: container.hpp:62
proton::io::const_buffer
Experimental - Pointer to a const memory region with a size.
Definition: connection_engine.hpp:58
proton::connection
A connection to a remote AMQP peer.
Definition: connection.hpp:48
proton::connection_options
Options for creating a connection.
Definition: connection_options.hpp:67
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_engine.hpp:54
proton::event_loop
Experimental - A serial execution context.
Definition: event_loop.hpp:57
proton::io::const_buffer::data
const char * data
Beginning of the buffered data.
Definition: connection_engine.hpp:59
proton::io::mutable_buffer::data
char * data
Beginning of the buffered data.
Definition: connection_engine.hpp:50
proton::io::connection_engine
Experimental - An AMQP protocol engine for a single connection.
Definition: connection_engine.hpp:98
proton::io::mutable_buffer::size
size_t size
Number of bytes in the buffer.
Definition: connection_engine.hpp:51
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_engine.hpp:63
proton::transport
A network channel supporting an AMQP connection.
Definition: transport.hpp:42
proton::io::mutable_buffer
Experimental - Pointer to a mutable memory region with a size.
Definition: connection_engine.hpp:49
proton
Type traits for mapping between AMQP and C++ types.
Definition: annotation_key.hpp:28
proton::error_condition
Describes an endpoint error state.
Definition: error_condition.hpp:37