Qpid Proton C API  0.24.0
selectable.h
1 #ifndef PROTON_SELECTABLE_H
2 #define PROTON_SELECTABLE_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/object.h>
27 #include <proton/event.h>
28 #include <proton/type_compat.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
41 typedef pn_iterator_t pn_selectables_t;
42 
59 #if defined(_WIN32) && ! defined(__CYGWIN__)
60 #ifdef _WIN64
61 typedef unsigned __int64 pn_socket_t;
62 #else
63 typedef unsigned int pn_socket_t;
64 #endif
65 #define PN_INVALID_SOCKET (pn_socket_t)(~0)
66 #else
67 typedef int pn_socket_t;
68 #define PN_INVALID_SOCKET (-1)
69 #endif
70 
89 typedef struct pn_selectable_t pn_selectable_t;
90 
96 PNX_EXTERN pn_selectables_t *pn_selectables(void);
97 
104 PNX_EXTERN pn_selectable_t *pn_selectables_next(pn_selectables_t *selectables);
105 
111 PNX_EXTERN void pn_selectables_free(pn_selectables_t *selectables);
112 
113 PNX_EXTERN pn_selectable_t *pn_selectable(void);
114 
115 PNX_EXTERN void pn_selectable_on_readable(pn_selectable_t *sel, void (*readable)(pn_selectable_t *));
116 PNX_EXTERN void pn_selectable_on_writable(pn_selectable_t *sel, void (*writable)(pn_selectable_t *));
117 PNX_EXTERN void pn_selectable_on_expired(pn_selectable_t *sel, void (*expired)(pn_selectable_t *));
118 PNX_EXTERN void pn_selectable_on_error(pn_selectable_t *sel, void (*error)(pn_selectable_t *));
119 PNX_EXTERN void pn_selectable_on_release(pn_selectable_t *sel, void (*release)(pn_selectable_t *));
120 PNX_EXTERN void pn_selectable_on_finalize(pn_selectable_t *sel, void (*finalize)(pn_selectable_t *));
121 
122 PNX_EXTERN pn_record_t *pn_selectable_attachments(pn_selectable_t *sel);
123 
130 PNX_EXTERN pn_socket_t pn_selectable_get_fd(pn_selectable_t *selectable);
131 
138 PNX_EXTERN void pn_selectable_set_fd(pn_selectable_t *selectable, pn_socket_t fd);
139 
146 PNX_EXTERN bool pn_selectable_is_reading(pn_selectable_t *selectable);
147 
148 PNX_EXTERN void pn_selectable_set_reading(pn_selectable_t *sel, bool reading);
149 
156 PNX_EXTERN bool pn_selectable_is_writing(pn_selectable_t *selectable);
157 
158  PNX_EXTERN void pn_selectable_set_writing(pn_selectable_t *sel, bool writing);
159 
170 PNX_EXTERN pn_timestamp_t pn_selectable_get_deadline(pn_selectable_t *selectable);
171 
172 PNX_EXTERN void pn_selectable_set_deadline(pn_selectable_t *sel, pn_timestamp_t deadline);
173 
179 PNX_EXTERN void pn_selectable_readable(pn_selectable_t *selectable);
180 
186 PNX_EXTERN void pn_selectable_writable(pn_selectable_t *selectable);
187 
193 PNX_EXTERN void pn_selectable_error(pn_selectable_t *selectable);
194 
200 PNX_EXTERN void pn_selectable_expired(pn_selectable_t *selectable);
201 
212 PNX_EXTERN bool pn_selectable_is_registered(pn_selectable_t *selectable);
213 
222 PNX_EXTERN void pn_selectable_set_registered(pn_selectable_t *selectable, bool registered);
223 
236 PNX_EXTERN bool pn_selectable_is_terminal(pn_selectable_t *selectable);
237 
243 PNX_EXTERN void pn_selectable_terminate(pn_selectable_t *selectable);
244 
245 PNX_EXTERN void pn_selectable_release(pn_selectable_t *selectable);
246 
252 PNX_EXTERN void pn_selectable_free(pn_selectable_t *selectable);
253 
261 PNX_EXTERN void pn_selectable_collect(pn_selectable_t *selectable, pn_collector_t *collector);
262 
267 #ifdef __cplusplus
268 }
269 #endif
270 
271 #endif /* selectable.h */
struct pn_collector_t pn_collector_t
An event collector.
Definition: types.h:413
Protocol and transport events.
int64_t pn_timestamp_t
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition: types.h:166