proton  0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
driver_extras.h
Go to the documentation of this file.
1 #ifndef PROTON_DRIVER_H_EXTRAS
2 #define PROTON_DRIVER_H_EXTRAS 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 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include <proton/import_export.h>
30 
31 /** @file
32  * Additional API for the Driver Layer.
33  *
34  * These additional driver functions allow the application to supply
35  * a separately created socket to the driver library.
36  *
37  */
38 
39 #if defined(_WIN32) && ! defined(__CYGWIN__)
40 typedef SOCKET pn_socket_t;
41 #else
42 typedef int pn_socket_t;
43 #endif
44 
45 /** Create a listener using the existing file descriptor.
46  *
47  * @param[in] driver driver that will 'own' this listener
48  * @param[in] fd existing socket for listener to listen on
49  * @param[in] context application-supplied, can be accessed via
50  * pn_listener_context()
51  * @return a new listener on the given host:port, NULL if error
52  */
53 PN_EXTERN pn_listener_t *pn_listener_fd(pn_driver_t *driver, pn_socket_t fd, void *context);
54 
55 /** Create a connector using the existing file descriptor.
56  *
57  * @param[in] driver driver that will 'own' this connector.
58  * @param[in] fd existing socket to use for this connector.
59  * @param[in] context application-supplied, can be accessed via
60  * pn_connector_context()
61  * @return a new connector to the given host:port, NULL if error.
62  */
63 PN_EXTERN pn_connector_t *pn_connector_fd(pn_driver_t *driver, pn_socket_t fd, void *context);
64 
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif /* driver_extras.h */