00001 #ifndef PROTON_DRIVER_H_EXTRAS 00002 #define PROTON_DRIVER_H_EXTRAS 1 00003 00004 /* 00005 * 00006 * Licensed to the Apache Software Foundation (ASF) under one 00007 * or more contributor license agreements. See the NOTICE file 00008 * distributed with this work for additional information 00009 * regarding copyright ownership. The ASF licenses this file 00010 * to you under the Apache License, Version 2.0 (the 00011 * "License"); you may not use this file except in compliance 00012 * with the License. You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, 00017 * software distributed under the License is distributed on an 00018 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00019 * KIND, either express or implied. See the License for the 00020 * specific language governing permissions and limitations 00021 * under the License. 00022 * 00023 */ 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 #include <proton/import_export.h> 00030 #include <proton/io.h> 00031 00032 /** @file 00033 * Additional API for the Driver Layer. 00034 * 00035 * These additional driver functions allow the application to supply 00036 * a separately created socket to the driver library. 00037 * 00038 */ 00039 00040 /** Create a listener using the existing file descriptor. 00041 * 00042 * @param[in] driver driver that will 'own' this listener 00043 * @param[in] fd existing socket for listener to listen on 00044 * @param[in] context application-supplied, can be accessed via 00045 * pn_listener_context() 00046 * @return a new listener on the given host:port, NULL if error 00047 */ 00048 PN_EXTERN pn_listener_t *pn_listener_fd(pn_driver_t *driver, pn_socket_t fd, void *context); 00049 00050 PN_EXTERN pn_socket_t pn_listener_get_fd(pn_listener_t *listener); 00051 00052 /** Create a connector using the existing file descriptor. 00053 * 00054 * @param[in] driver driver that will 'own' this connector. 00055 * @param[in] fd existing socket to use for this connector. 00056 * @param[in] context application-supplied, can be accessed via 00057 * pn_connector_context() 00058 * @return a new connector to the given host:port, NULL if error. 00059 */ 00060 PN_EXTERN pn_connector_t *pn_connector_fd(pn_driver_t *driver, pn_socket_t fd, void *context); 00061 00062 PN_EXTERN pn_socket_t pn_connector_get_fd(pn_connector_t *connector); 00063 00064 #ifdef __cplusplus 00065 } 00066 #endif 00067 00068 #endif /* driver_extras.h */