proton/io/connection_driver.hpp

Go to the documentation of this file.
00001 #ifndef PROTON_IO_CONNECTION_DRIVER_HPP
00002 #define PROTON_IO_CONNECTION_DRIVER_HPP
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include "../connection_options.hpp"
00026 #include "../error_condition.hpp"
00027 #include "../fwd.hpp"
00028 #include "../internal/config.hpp"
00029 #include "../types_fwd.hpp"
00030 
00031 #include <proton/connection_driver.h>
00032 
00033 #include <string>
00034 
00037 
00038 namespace proton {
00039 
00040 class work_queue;
00041 class proton_handler;
00042 
00043 namespace io {
00044 
00047 struct mutable_buffer {
00048     char* data;                 
00049     size_t size;                
00050 
00052     mutable_buffer(char* data_=0, size_t size_=0) : data(data_), size(size_) {}
00053 };
00054 
00057 struct const_buffer {
00058     const char* data;           
00059     size_t size;                
00060 
00062     const_buffer(const char* data_=0, size_t size_=0) : data(data_), size(size_) {}
00063 };
00064 
00093 class
00094 PN_CPP_CLASS_EXTERN connection_driver {
00095   public:
00097     PN_CPP_EXTERN connection_driver();
00098 
00100     PN_CPP_EXTERN connection_driver(const std::string&);
00101 
00102     PN_CPP_EXTERN ~connection_driver();
00103 
00107     void configure(const connection_options& opts=connection_options(), bool server=false);
00108 
00111     PN_CPP_EXTERN void connect(const connection_options& opts);
00112 
00119     PN_CPP_EXTERN void accept(const connection_options& opts);
00120 
00124     PN_CPP_EXTERN mutable_buffer read_buffer();
00125 
00128     PN_CPP_EXTERN void read_done(size_t n);
00129 
00132     PN_CPP_EXTERN void read_close();
00133 
00137     PN_CPP_EXTERN const_buffer write_buffer();
00138 
00141     PN_CPP_EXTERN void write_done(size_t n);
00142 
00145     PN_CPP_EXTERN void write_close();
00146 
00154     PN_CPP_EXTERN timestamp tick(timestamp now);
00155 
00168     PN_CPP_EXTERN void disconnected(const error_condition& = error_condition());
00169 
00171     PN_CPP_EXTERN bool has_events() const;
00172 
00184     PN_CPP_EXTERN bool dispatch();
00185 
00187     PN_CPP_EXTERN proton::connection connection() const;
00188 
00190     PN_CPP_EXTERN proton::transport transport() const;
00191 
00193     PN_CPP_EXTERN proton::container* container() const;
00194 
00195  private:
00196     void init();
00197     connection_driver(const connection_driver&);
00198     connection_driver& operator=(const connection_driver&);
00199 
00200     std::string container_id_;
00201     messaging_handler* handler_;
00202     pn_connection_driver_t driver_;
00203 };
00204 
00205 } // io
00206 } // proton
00207 
00208 #endif // PROTON_IO_CONNECTION_DRIVER_HPP

Generated on 14 May 2019 for Qpid Proton C++ by  doxygen 1.6.1