Debian Codegraph @

cpp/src/handler.cpp

raw
1 /*
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 */
21 #include "proton/messaging_handler.hpp"
22
23 #include "proton/connection.hpp"
24 #include "proton/container.hpp"
25 #include "proton/error_condition.hpp"
26 #include "proton/receiver.hpp"
27 #include "proton/receiver_options.hpp"
28 #include "proton/sender.hpp"
29 #include "proton/sender_options.hpp"
30 #include "proton/session.hpp"
31 #include "proton/transport.hpp"
32
33 #include "proton_bits.hpp"
34
35 #include "proton/connection.h"
36 #include "proton/session.h"
37
38 namespace proton {
39
40 messaging_handler::messaging_handler() = default;
41
42 messaging_handler::~messaging_handler() = default;
43
44 void messaging_handler::on_container_start(container &) {}
45 void messaging_handler::on_container_stop(container &) {}
46 void messaging_handler::on_message(delivery &, message &) {}
47 void messaging_handler::on_sendable(sender &) {}
48 void messaging_handler::on_transport_close(transport &) {}
49 void messaging_handler::on_transport_error(transport &t) { on_error(t.error()); }
50 void messaging_handler::on_transport_open(transport &) {}
51
52 void messaging_handler::on_connection_close(connection &) {}
53 void messaging_handler::on_connection_error(connection &c) { on_error(c.error()); }
54 void messaging_handler::on_connection_open(connection &c) {
55 if (c.uninitialized()) {
56 pn_connection_open(unwrap(c));
57 }
58 }
59 void messaging_handler::on_connection_wake(connection&) {}
60
61 void messaging_handler::on_session_close(session &) {}
62 void messaging_handler::on_session_error(session &s) { on_error(s.error()); }
63 void messaging_handler::on_session_open(session &s) {
64 if (s.uninitialized()) {
65 pn_session_open(unwrap(s));
66 }
67 }
68 void messaging_handler::on_receiver_close(receiver &) {}
69 void messaging_handler::on_receiver_error(receiver &l) { on_error(l.error()); }
70 void messaging_handler::on_receiver_open(receiver &l) {
71 if (l.uninitialized()) {
72 l.open(l.connection().receiver_options());
73 }
74 }
75 void messaging_handler::on_receiver_detach(receiver &) {}
76 void messaging_handler::on_sender_close(sender &) {}
77 void messaging_handler::on_sender_error(sender &l) { on_error(l.error()); }
78 void messaging_handler::on_sender_open(sender &l) {
79 if (l.uninitialized()) {
80 l.open(l.connection().sender_options());
81 }
82 }
83 void messaging_handler::on_sender_detach(sender &) {}
84 void messaging_handler::on_tracker_accept(tracker &) {}
85 void messaging_handler::on_tracker_reject(tracker &) {}
86 void messaging_handler::on_tracker_release(tracker &) {}
87 void messaging_handler::on_tracker_settle(tracker &) {}
88 void messaging_handler::on_delivery_settle(delivery &) {}
89 void messaging_handler::on_sender_drain_start(sender &) {}
90 void messaging_handler::on_receiver_drain_finish(receiver &) {}
91
92 void messaging_handler::on_error(const error_condition& c) { throw proton::error(c.what()); }
93
94 }