Qpid Proton C++  0.13.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
reconnect_timer.hpp
1 #ifndef PROTON_RECONNECT_TIMER_HPP
2 #define PROTON_RECONNECT_TIMER_HPP
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
27 
28 #include "./internal/export.hpp"
29 #include "./duration.hpp"
30 #include "./timestamp.hpp"
31 #include "./types.hpp"
32 
33 #include <string>
34 
35 namespace proton {
36 
41 class reconnect_timer {
42  public:
43  PN_CPP_EXTERN reconnect_timer(uint32_t first = 0, int32_t max = -1, uint32_t increment = 100,
44  bool doubling = true, int32_t max_retries = -1, int32_t timeout = -1);
45 
48  PN_CPP_EXTERN void reset();
49 
54  PN_CPP_EXTERN int next_delay(timestamp now);
55 
56  private:
57  duration first_delay_;
58  duration max_delay_;
59  duration increment_;
60  bool doubling_;
61  int32_t max_retries_;
62  duration timeout_;
63  int32_t retries_;
64  duration next_delay_;
65  timestamp timeout_deadline_;
66 };
67 
68 } // proton
69 
71 
72 #endif // PROTON_RECONNECT_TIMER_HPP
Include the definitions of all proton types used to represent AMQP types.