| 1 |
#ifndef PROTON_SELECTOR_H |
| 2 |
#define PROTON_SELECTOR_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/selectable.h> |
| 26 |
#include <proton/type_compat.h> |
| 27 |
|
| 28 |
#define PN_READABLE (1) |
| 29 |
#define PN_WRITABLE (2) |
| 30 |
#define PN_EXPIRED (4) |
| 31 |
#define PN_ERROR (8) |
| 32 |
|
| 33 |
/** |
| 34 |
* A ::pn_selector_t provides a selection mechanism that allows |
| 35 |
* efficient monitoring of a large number of Proton connections and |
| 36 |
* listeners. |
| 37 |
* |
| 38 |
* External (non-Proton) sockets may also be monitored, either solely |
| 39 |
* for event notification (read, write, and timer) or event |
| 40 |
* notification and use with pn_io_t interfaces. |
| 41 |
*/ |
| 42 |
typedef struct pn_selector_t pn_selector_t; |
| 43 |
|
| 44 |
pn_selector_t *pni_selector(void); |
| 45 |
void pn_selector_free(pn_selector_t *selector); |
| 46 |
void pn_selector_add(pn_selector_t *selector, pn_selectable_t *selectable); |
| 47 |
void pn_selector_update(pn_selector_t *selector, pn_selectable_t *selectable); |
| 48 |
void pn_selector_remove(pn_selector_t *selector, pn_selectable_t *selectable); |
| 49 |
size_t pn_selector_size(pn_selector_t *selector); |
| 50 |
int pn_selector_select(pn_selector_t *select, int timeout); |
| 51 |
pn_selectable_t *pn_selector_next(pn_selector_t *select, int *events); |
| 52 |
|
| 53 |
#endif /* selector.h */ |