Qpid Proton C API  0.32.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 
54 #if defined(_WIN32) && ! defined(__CYGWIN__)
55 #ifdef _WIN64
56 typedef unsigned __int64 pn_socket_t;
57 #else
58 typedef unsigned int pn_socket_t;
59 #endif
60 #define PN_INVALID_SOCKET (pn_socket_t)(~0)
61 #else
62 typedef int pn_socket_t;
63 #define PN_INVALID_SOCKET (-1)
64 #endif
65 
84 typedef struct pn_selectable_t pn_selectable_t;
85 
86 PNX_EXTERN pn_selectable_t *pn_selectable(void);
87 
88 PNX_EXTERN void pn_selectable_on_readable(pn_selectable_t *sel, void (*readable)(pn_selectable_t *));
89 PNX_EXTERN void pn_selectable_on_writable(pn_selectable_t *sel, void (*writable)(pn_selectable_t *));
90 PNX_EXTERN void pn_selectable_on_expired(pn_selectable_t *sel, void (*expired)(pn_selectable_t *));
91 PNX_EXTERN void pn_selectable_on_error(pn_selectable_t *sel, void (*error)(pn_selectable_t *));
92 PNX_EXTERN void pn_selectable_on_release(pn_selectable_t *sel, void (*release)(pn_selectable_t *));
93 PNX_EXTERN void pn_selectable_on_finalize(pn_selectable_t *sel, void (*finalize)(pn_selectable_t *));
94 
95 PNX_EXTERN pn_record_t *pn_selectable_attachments(pn_selectable_t *sel);
96 
103 PNX_EXTERN pn_socket_t pn_selectable_get_fd(pn_selectable_t *selectable);
104 
111 PNX_EXTERN void pn_selectable_set_fd(pn_selectable_t *selectable, pn_socket_t fd);
112 
119 PNX_EXTERN bool pn_selectable_is_reading(pn_selectable_t *selectable);
120 
121 PNX_EXTERN void pn_selectable_set_reading(pn_selectable_t *sel, bool reading);
122 
129 PNX_EXTERN bool pn_selectable_is_writing(pn_selectable_t *selectable);
130 
131  PNX_EXTERN void pn_selectable_set_writing(pn_selectable_t *sel, bool writing);
132 
143 PNX_EXTERN pn_timestamp_t pn_selectable_get_deadline(pn_selectable_t *selectable);
144 
145 PNX_EXTERN void pn_selectable_set_deadline(pn_selectable_t *sel, pn_timestamp_t deadline);
146 
152 PNX_EXTERN void pn_selectable_readable(pn_selectable_t *selectable);
153 
159 PNX_EXTERN void pn_selectable_writable(pn_selectable_t *selectable);
160 
166 PNX_EXTERN void pn_selectable_error(pn_selectable_t *selectable);
167 
173 PNX_EXTERN void pn_selectable_expired(pn_selectable_t *selectable);
174 
185 PNX_EXTERN bool pn_selectable_is_registered(pn_selectable_t *selectable);
186 
195 PNX_EXTERN void pn_selectable_set_registered(pn_selectable_t *selectable, bool registered);
196 
209 PNX_EXTERN bool pn_selectable_is_terminal(pn_selectable_t *selectable);
210 
216 PNX_EXTERN void pn_selectable_terminate(pn_selectable_t *selectable);
217 
218 PNX_EXTERN void pn_selectable_release(pn_selectable_t *selectable);
219 
225 PNX_EXTERN void pn_selectable_free(pn_selectable_t *selectable);
226 
234 PNX_EXTERN void pn_selectable_collect(pn_selectable_t *selectable, pn_collector_t *collector);
235 
240 #ifdef __cplusplus
241 }
242 #endif
243 
244 #endif /* selectable.h */
struct pn_collector_t pn_collector_t
An event collector.
Definition: types.h:417
Protocol and transport events.
int64_t pn_timestamp_t
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition: types.h:170