Qpid Proton C API 0.40.0
 
Loading...
Searching...
No Matches
reactor.h
1#ifndef PROTON_REACTOR_H
2#define PROTON_REACTOR_H 1
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
25#include <proton/import_export.h>
26#include <proton/type_compat.h>
27#include <proton/error.h>
28#include <proton/event.h>
29#include <proton/object.h>
30#include <proton/selectable.h>
31#include <proton/ssl.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
41typedef struct pn_reactor_t pn_reactor_t;
42typedef struct pn_acceptor_t pn_acceptor_t;
43typedef struct pn_timer_t pn_timer_t;
44typedef struct pn_task_t pn_task_t;
45struct pn_list_t;
46
47PNX_EXTERN pn_handler_t *pn_handler(void (*dispatch)(pn_handler_t *, pn_event_t *, pn_event_type_t));
48PNX_EXTERN pn_handler_t *pn_handler_new(void (*dispatch)(pn_handler_t *, pn_event_t *, pn_event_type_t), size_t size,
49 void (*finalize)(pn_handler_t *));
50PNX_EXTERN void pn_handler_free(pn_handler_t *handler);
51PNX_EXTERN void *pn_handler_mem(pn_handler_t *handler);
52PNX_EXTERN void pn_handler_add(pn_handler_t *handler, pn_handler_t *child);
53PNX_EXTERN void pn_handler_clear(pn_handler_t *handler);
54PNX_EXTERN void pn_handler_dispatch(pn_handler_t *handler, pn_event_t *event, pn_event_type_t type);
55
56PNX_EXTERN pn_reactor_t *pn_reactor(void);
57PNX_EXTERN pn_record_t *pn_reactor_attachments(pn_reactor_t *reactor);
58PNX_EXTERN pn_millis_t pn_reactor_get_timeout(pn_reactor_t *reactor);
59PNX_EXTERN void pn_reactor_set_timeout(pn_reactor_t *reactor, pn_millis_t timeout);
60PNX_EXTERN pn_timestamp_t pn_reactor_mark(pn_reactor_t *reactor);
61PNX_EXTERN pn_timestamp_t pn_reactor_now(pn_reactor_t *reactor);
62PNX_EXTERN void pn_reactor_yield(pn_reactor_t *reactor);
63PNX_EXTERN void pn_reactor_free(pn_reactor_t *reactor);
64PNX_EXTERN pn_collector_t *pn_reactor_collector(pn_reactor_t *reactor);
65PNX_EXTERN pn_handler_t *pn_reactor_get_global_handler(pn_reactor_t *reactor);
66PNX_EXTERN void pn_reactor_set_global_handler(pn_reactor_t *reactor, pn_handler_t *handler);
67PNX_EXTERN pn_handler_t *pn_reactor_get_handler(pn_reactor_t *reactor);
68PNX_EXTERN void pn_reactor_set_handler(pn_reactor_t *reactor, pn_handler_t *handler);
69PNX_EXTERN struct pn_list_t *pn_reactor_children(pn_reactor_t *reactor);
70PNX_EXTERN pn_selectable_t *pn_reactor_selectable(pn_reactor_t *reactor);
71PNX_EXTERN void pn_reactor_update(pn_reactor_t *reactor, pn_selectable_t *selectable);
72PNX_EXTERN pn_acceptor_t *pn_reactor_acceptor(pn_reactor_t *reactor, const char *host, const char *port,
73 pn_handler_t *handler);
74PNX_EXTERN pn_error_t *pn_reactor_error(pn_reactor_t *reactor);
75
89PNX_EXTERN pn_connection_t *pn_reactor_connection_to_host(pn_reactor_t *reactor,
90 const char *host,
91 const char *port,
92 pn_handler_t *handler);
93
109PNX_EXTERN pn_connection_t *pn_reactor_connection(pn_reactor_t *reactor,
110 pn_handler_t *handler);
111
123PNX_EXTERN void pn_reactor_set_connection_host(pn_reactor_t *reactor,
124 pn_connection_t *connection,
125 const char *host,
126 const char *port);
146PNX_EXTERN const char *pn_reactor_get_connection_address(pn_reactor_t *reactor,
147 pn_connection_t *connection);
148
149PNX_EXTERN int pn_reactor_wakeup(pn_reactor_t *reactor);
150PNX_EXTERN void pn_reactor_start(pn_reactor_t *reactor);
151PNX_EXTERN bool pn_reactor_quiesced(pn_reactor_t *reactor);
152PNX_EXTERN bool pn_reactor_process(pn_reactor_t *reactor);
153PNX_EXTERN void pn_reactor_stop(pn_reactor_t *reactor);
154PNX_EXTERN void pn_reactor_run(pn_reactor_t *reactor);
155PNX_EXTERN pn_task_t *pn_reactor_schedule(pn_reactor_t *reactor, int delay, pn_handler_t *handler);
156
157
158PNX_EXTERN void pn_acceptor_set_ssl_domain(pn_acceptor_t *acceptor, pn_ssl_domain_t *domain);
159PNX_EXTERN void pn_acceptor_close(pn_acceptor_t *acceptor);
160PNX_EXTERN pn_acceptor_t *pn_connection_acceptor(pn_connection_t *connection);
161
162PNX_EXTERN pn_timer_t *pn_timer(pn_collector_t *collector);
163PNX_EXTERN pn_timestamp_t pn_timer_deadline(pn_timer_t *timer);
164PNX_EXTERN void pn_timer_tick(pn_timer_t *timer, pn_timestamp_t now);
165PNX_EXTERN pn_task_t *pn_timer_schedule(pn_timer_t *timer, pn_timestamp_t deadline);
166PNX_EXTERN int pn_timer_tasks(pn_timer_t *timer);
167
168PNX_EXTERN pn_record_t *pn_task_attachments(pn_task_t *task);
169PNX_EXTERN void pn_task_cancel(pn_task_t *task);
170
171PNX_EXTERN pn_reactor_t *pn_class_reactor(const pn_class_t *clazz, void *object);
172PNX_EXTERN pn_reactor_t *pn_object_reactor(void *object);
173PNX_EXTERN pn_reactor_t *pn_event_reactor(pn_event_t *event);
174
175PNX_EXTERN pn_handler_t *pn_record_get_handler(pn_record_t *record);
176PNX_EXTERN void pn_record_set_handler(pn_record_t *record, pn_handler_t *handler);
177
181PNX_EXTERN pn_handler_t *pn_event_root(pn_event_t *event);
182
187#ifdef __cplusplus
188}
189#endif
190
191#endif /* reactor.h */
A Proton API error.
Protocol and transport events.
int64_t pn_timestamp_t
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition types.h:177
uint32_t pn_millis_t
A span of time in milliseconds.
Definition types.h:156
struct pn_connection_t pn_connection_t
An AMQP Connection object.
Definition types.h:300
struct pn_error_t pn_error_t
An int error code and some string text to describe the error.
Definition error.h:45
pn_event_type_t
An event type.
Definition event.h:80
struct pn_event_t pn_event_t
Notification of a state change in the protocol engine.
Definition event.h:75
struct pn_collector_t pn_collector_t
An event collector.
Definition types.h:432
struct pn_ssl_domain_t pn_ssl_domain_t
API for using SSL with the Transport Layer.
Definition ssl.h:80
SSL secure transport layer.
struct pn_record_t pn_record_t
A type representing attached context information.
Definition types.h:492
struct pn_class_t pn_class_t
A type representing the type of a proton internal object.
Definition types.h:487