Qpid Proton C API  0.18.0
proactor.h
Go to the documentation of this file.
1 #ifndef PROTON_PROACTOR_H
2 #define PROTON_PROACTOR_H 1
3 
4 /*
5  * Licensed to the Apache Software Foundation (ASF) under one
6  * or more contributor license agreements. See the NOTICE file
7  * distributed with this work for additional information
8  * regarding copyright ownership. The ASF licenses this file
9  * to you under the Apache License, Version 2.0 (the
10  * "License"); you may not use this file except in compliance
11  * with the License. You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing,
16  * software distributed under the License is distributed on an
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  * KIND, either express or implied. See the License for the
19  * specific language governing permissions and limitations
20  * under the License.
21  */
22 
23 #include <proton/condition.h>
24 #include <proton/event.h>
25 #include <proton/import_export.h>
26 #include <proton/types.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
74 #define PN_MAX_ADDR 1060
75 
86 PNP_EXTERN int pn_proactor_addr(char *addr, size_t size, const char *host, const char *port);
87 
91 PNP_EXTERN pn_proactor_t *pn_proactor(void);
92 
96 PNP_EXTERN void pn_proactor_free(pn_proactor_t *proactor);
97 
119 PNP_EXTERN void pn_proactor_connect(pn_proactor_t *proactor, pn_connection_t *connection, const char *addr);
120 
148 PNP_EXTERN void pn_proactor_listen(pn_proactor_t *proactor, pn_listener_t *listener, const char *addr, int backlog);
149 
171 PNP_EXTERN void pn_proactor_disconnect(pn_proactor_t *proactor, pn_condition_t *condition);
172 
189 PNP_EXTERN pn_event_batch_t *pn_proactor_wait(pn_proactor_t *proactor);
190 
197 PNP_EXTERN pn_event_batch_t *pn_proactor_get(pn_proactor_t *proactor);
198 
207 PNP_EXTERN void pn_proactor_done(pn_proactor_t *proactor, pn_event_batch_t *events);
208 
220 PNP_EXTERN void pn_proactor_interrupt(pn_proactor_t *proactor);
221 
233 PNP_EXTERN void pn_proactor_set_timeout(pn_proactor_t *proactor, pn_millis_t timeout);
234 
241 PNP_EXTERN void pn_proactor_cancel_timeout(pn_proactor_t *proactor);
242 
259 PNP_EXTERN void pn_proactor_release_connection(pn_connection_t *connection);
260 
273 PNP_EXTERN void pn_connection_wake(pn_connection_t *connection);
274 
282 PNP_EXTERN pn_proactor_t *pn_connection_proactor(pn_connection_t *connection);
283 
291 PNP_EXTERN pn_proactor_t *pn_event_proactor(pn_event_t *event);
292 
305 PNP_EXTERN pn_millis_t pn_proactor_now(void);
306 
362 #ifdef __cplusplus
363 }
364 #endif
365 
366 #endif /* proactor.h */
struct pn_listener_t pn_listener_t
A listener for incoming connections.
Definition: types.h:420
PNP_EXTERN int pn_proactor_addr(char *addr, size_t size, const char *host, const char *port)
Format a host:port address string for pn_proactor_connect() or pn_proactor_listen() ...
uint32_t pn_millis_t
A span of time in milliseconds.
Definition: types.h:145
PNP_EXTERN pn_event_batch_t * pn_proactor_wait(pn_proactor_t *proactor)
Wait until there are Proactor events to handle.
AMQP and API data types.
struct pn_event_batch_t pn_event_batch_t
Unsettled API - A batch of events that must be handled in sequence.
Definition: event.h:547
PNP_EXTERN void pn_proactor_interrupt(pn_proactor_t *proactor)
Return a PN_PROACTOR_INTERRUPT event as soon as possible.
PNP_EXTERN void pn_proactor_disconnect(pn_proactor_t *proactor, pn_condition_t *condition)
Disconnect all connections and listeners belonging to the proactor.
PNP_EXTERN void pn_proactor_set_timeout(pn_proactor_t *proactor, pn_millis_t timeout)
Return a PN_PROACTOR_TIMEOUT after timeout milliseconds elapse.
struct pn_proactor_t pn_proactor_t
A harness for multithreaded IO.
Definition: types.h:438
An endpoint error state.
PNP_EXTERN pn_proactor_t * pn_event_proactor(pn_event_t *event)
Return the proactor associated with an event.
PNP_EXTERN void pn_connection_wake(pn_connection_t *connection)
Return a PN_CONNECTION_WAKE event for connection as soon as possible.
PNP_EXTERN void pn_proactor_connect(pn_proactor_t *proactor, pn_connection_t *connection, const char *addr)
Bind connection to a new Transport connected to addr.
PNP_EXTERN void pn_proactor_listen(pn_proactor_t *proactor, pn_listener_t *listener, const char *addr, int backlog)
Start listening for incoming connections.
PNP_EXTERN pn_proactor_t * pn_proactor(void)
Create a proactor.
PNP_EXTERN pn_millis_t pn_proactor_now(void)
Get the real elapsed time since an arbitrary point in the past in milliseconds.
PNP_EXTERN void pn_proactor_cancel_timeout(pn_proactor_t *proactor)
Cancel the pending timeout set by pn_proactor_set_timeout().
PNP_EXTERN pn_proactor_t * pn_connection_proactor(pn_connection_t *connection)
Return the proactor associated with a connection.
PNP_EXTERN void pn_proactor_free(pn_proactor_t *proactor)
Free the proactor.
PNP_EXTERN void pn_proactor_done(pn_proactor_t *proactor, pn_event_batch_t *events)
Call when finished handling a batch of events.
PNP_EXTERN pn_event_batch_t * pn_proactor_get(pn_proactor_t *proactor)
Return Proactor events if any are available immediately.
Protocol and transport events.
struct pn_connection_t pn_connection_t
An AMQP Connection object.
Definition: types.h:281
struct pn_condition_t pn_condition_t
An AMQP Condition object.
Definition: condition.h:64
PNP_EXTERN void pn_proactor_release_connection(pn_connection_t *connection)
Release ownership of connection, disassociate it from its proactor.
struct pn_event_t pn_event_t
Notification of a state change in the protocol engine.
Definition: event.h:75