Qpid Proton C API  0.17.0
event.h
Go to the documentation of this file.
1 #ifndef PROTON_EVENT_H
2 #define PROTON_EVENT_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/object.h>
28 #include <stddef.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
75 typedef struct pn_event_t pn_event_t;
76 
80 typedef enum {
86 
91 
97 
102 
107 
114 
120 
126 
132 
138 
144 
150 
157 
163 
169 
175 
181 
187 
194 
200 
206 
212 
218 
224 
230 
236 
242 
249 
255 
261 
269 
276 
283 
289 
296 
302 
308 
309  PN_SELECTABLE_INIT,
310  PN_SELECTABLE_UPDATED,
311  PN_SELECTABLE_READABLE,
312  PN_SELECTABLE_WRITABLE,
313  PN_SELECTABLE_ERROR,
314  PN_SELECTABLE_EXPIRED,
315  PN_SELECTABLE_FINAL,
316 
322 
328 
334 
340 
346 
354 
356 
363 PN_EXTERN const char *pn_event_type_name(pn_event_type_t type);
364 
373 PN_EXTERN pn_collector_t *pn_collector(void);
374 
380 PN_EXTERN void pn_collector_free(pn_collector_t *collector);
381 
390 PN_EXTERN void pn_collector_release(pn_collector_t *collector);
391 
409 PN_EXTERN pn_event_t *pn_collector_put(pn_collector_t *collector,
410  const pn_class_t *clazz, void *context,
411  pn_event_type_t type);
412 
424 PN_EXTERN pn_event_t *pn_collector_peek(pn_collector_t *collector);
425 
432 PN_EXTERN bool pn_collector_pop(pn_collector_t *collector);
433 
447 PN_EXTERN pn_event_t *pn_collector_next(pn_collector_t *collector);
448 
458 PN_EXTERN pn_event_t *pn_collector_prev(pn_collector_t *collector);
459 
468 PN_EXTERN bool pn_collector_more(pn_collector_t *collector);
469 
476 PN_EXTERN pn_event_type_t pn_event_type(pn_event_t *event);
477 
484 PN_EXTERN const pn_class_t *pn_event_class(pn_event_t *event);
485 
489 PN_EXTERN void *pn_event_context(pn_event_t *event);
490 
498 
505 PN_EXTERN pn_session_t *pn_event_session(pn_event_t *event);
506 
513 PN_EXTERN pn_link_t *pn_event_link(pn_event_t *event);
514 
521 PN_EXTERN pn_delivery_t *pn_event_delivery(pn_event_t *event);
522 
529 PN_EXTERN pn_transport_t *pn_event_transport(pn_event_t *event);
530 
537 PN_EXTERN pn_record_t *pn_event_attachments(pn_event_t *event);
538 
545 
546 /* NOTE: there is deliberately no peek(), more() or other look-ahead on an event
547  * batch. We want to know exactly which events have been handled, next() only
548  * allows the user to get each event exactly once, in order.
549  */
550 
558 
564 struct pn_event_batch_t {
565  pn_event_t *(*next_event)(pn_event_batch_t *batch);
566 };
571 #ifdef __cplusplus
572 }
573 #endif
574 
579 #endif /* event.h */
PN_TRANSPORT_AUTHENTICATED
The transport has authenticated, if this is received by a server the associated transport has authent...
Definition: event.h:268
pn_collector_peek
pn_event_t * pn_collector_peek(pn_collector_t *collector)
Access the head event contained by a collector.
PN_CONNECTION_UNBOUND
The connection has been unbound from its transport.
Definition: event.h:125
pn_collector_put
pn_event_t * pn_collector_put(pn_collector_t *collector, const pn_class_t *clazz, void *context, pn_event_type_t type)
Place a new event on a collector.
PN_LINK_INIT
The link has been created.
Definition: event.h:199
pn_event_t
struct pn_event_t pn_event_t
Notification of a state change in the protocol engine.
Definition: event.h:75
pn_collector_t
struct pn_collector_t pn_collector_t
An event collector.
Definition: types.h:407
pn_collector_prev
pn_event_t * pn_collector_prev(pn_collector_t *collector)
Return the same event as the previous call to pn_collector_next()
PN_DELIVERY
A delivery has been created or updated.
Definition: event.h:254
pn_collector
pn_collector_t * pn_collector(void)
Construct a collector.
PN_LINK_REMOTE_CLOSE
The remote endpoint has closed the link.
Definition: event.h:223
pn_collector_pop
bool pn_collector_pop(pn_collector_t *collector)
Clear the head event on a collector.
PN_LINK_LOCAL_DETACH
The local link endpoint has been detached.
Definition: event.h:229
PN_CONNECTION_BOUND
The connection has been bound to a transport.
Definition: event.h:119
PN_TRANSPORT_CLOSED
Indicates that the both the head and tail of the transport are closed.
Definition: event.h:307
PN_TRANSPORT_TAIL_CLOSED
Indicates that the tail of the transport has been closed.
Definition: event.h:295
PN_PROACTOR_INACTIVE
The proactor becaome inactive: all listeners and connections are closed and their events processed,...
Definition: event.h:353
PN_TRANSPORT_WRITE_CLOSED
The write side of the transport is closed, it will no longer produce bytes to write to external IO.
Definition: event.h:288
pn_transport_t
struct pn_transport_t pn_transport_t
An AMQP Transport object.
Definition: types.h:419
pn_event_context
void * pn_event_context(pn_event_t *event)
Get the context associated with an event.
pn_event_class
const pn_class_t * pn_event_class(pn_event_t *event)
Get the class associated with the event context.
pn_event_attachments
pn_record_t * pn_event_attachments(pn_event_t *event)
Get any attachments associated with an event.
PN_SESSION_LOCAL_OPEN
The local session endpoint has been opened.
Definition: event.h:168
PN_EVENT_NONE
Defined as a programming convenience.
Definition: event.h:85
pn_event_type_t
pn_event_type_t
An event type.
Definition: event.h:80
PN_LINK_FINAL
The link has been freed and any outstanding processing has been completed.
Definition: event.h:248
pn_event_delivery
pn_delivery_t * pn_event_delivery(pn_event_t *event)
Get the delivery associated with an event.
PN_CONNECTION_INIT
The connection has been created.
Definition: event.h:113
PN_LISTENER_ACCEPT
Indicates the listener is ready to call pn_listener_accept() Events of this type point to the pn_list...
Definition: event.h:327
pn_delivery_t
struct pn_delivery_t pn_delivery_t
An AMQP Delivery object.
Definition: types.h:395
pn_event_batch_next
pn_event_t * pn_event_batch_next(pn_event_batch_t *batch)
Experimental - Remove the next event from the batch and return it.
PN_REACTOR_INIT
A reactor has been started.
Definition: event.h:90
pn_collector_free
void pn_collector_free(pn_collector_t *collector)
Free a collector.
PN_PROACTOR_INTERRUPT
Indicates pn_proactor_interrupt() was called to interrupt a proactor thread Events of this type point...
Definition: event.h:339
PN_PROACTOR_TIMEOUT
Timeout set by pn_proactor_set_timeout() time limit expired.
Definition: event.h:345
PN_SESSION_INIT
The session has been created.
Definition: event.h:162
pn_event_batch_t
struct pn_event_batch_t pn_event_batch_t
Experimental - A batch of events to handle.
Definition: event.h:544
PN_LINK_REMOTE_DETACH
The remote endpoint has detached the link.
Definition: event.h:235
pn_event_connection
pn_connection_t * pn_event_connection(pn_event_t *event)
Get the connection associated with an event.
PN_TRANSPORT_HEAD_CLOSED
Indicates that the "head" or writing end of the transport has been closed.
Definition: event.h:282
PN_CONNECTION_REMOTE_CLOSE
The remote endpoint has closed the connection.
Definition: event.h:149
PN_TRANSPORT
The transport has new data to read and/or write.
Definition: event.h:260
pn_connection_t
struct pn_connection_t pn_connection_t
An AMQP Connection object.
Definition: types.h:275
PN_SESSION_FINAL
The session has been freed and any outstanding processing has been completed.
Definition: event.h:193
PN_SESSION_REMOTE_OPEN
The remote endpoint has opened the session.
Definition: event.h:174
PN_LINK_LOCAL_CLOSE
The local link endpoint has been closed.
Definition: event.h:217
PN_SESSION_REMOTE_CLOSE
The remote endpoint has closed the session.
Definition: event.h:186
PN_CONNECTION_WAKE
pn_connection_wake() was called.
Definition: event.h:321
pn_event_session
pn_session_t * pn_event_session(pn_event_t *event)
Get the session associated with an event.
PN_SESSION_LOCAL_CLOSE
The local session endpoint has been closed.
Definition: event.h:180
PN_CONNECTION_LOCAL_OPEN
The local connection endpoint has been closed.
Definition: event.h:131
PN_REACTOR_QUIESCED
A reactor has no more events to process.
Definition: event.h:96
PN_CONNECTION_REMOTE_OPEN
The remote endpoint has opened the connection.
Definition: event.h:137
PN_LINK_LOCAL_OPEN
The local link endpoint has been opened.
Definition: event.h:205
pn_collector_release
void pn_collector_release(pn_collector_t *collector)
Release a collector.
PN_TIMER_TASK
A timer event has occurred.
Definition: event.h:106
PN_REACTOR_FINAL
A reactor has been stopped.
Definition: event.h:101
PN_LINK_FLOW
The flow control state for a link has changed.
Definition: event.h:241
pn_session_t
struct pn_session_t pn_session_t
An AMQP Session object.
Definition: types.h:286
pn_collector_next
pn_event_t * pn_collector_next(pn_collector_t *collector)
Return the next event to be handled.
PN_TRANSPORT_ERROR
Indicates that a transport error has occurred.
Definition: event.h:275
PN_LINK_REMOTE_OPEN
The remote endpoint has opened the link.
Definition: event.h:211
PN_CONNECTION_FINAL
The connection has been freed and any outstanding processing has been completed.
Definition: event.h:156
pn_event_type
pn_event_type_t pn_event_type(pn_event_t *event)
Get the type of an event.
pn_event_type_name
const char * pn_event_type_name(pn_event_type_t type)
Get a human readable name for an event type.
pn_collector_more
bool pn_collector_more(pn_collector_t *collector)
Check if there are more events after the current event.
pn_event_transport
pn_transport_t * pn_event_transport(pn_event_t *event)
Get the transport associated with an event.
PN_TRANSPORT_READ_CLOSED
The read side of the transport is closed, it will no longer read bytes from external IO.
Definition: event.h:301
pn_event_link
pn_link_t * pn_event_link(pn_event_t *event)
Get the link associated with an event.
PN_CONNECTION_LOCAL_CLOSE
The local connection endpoint has been closed.
Definition: event.h:143
PN_LISTENER_CLOSE
Indicates the listener has closed.
Definition: event.h:333