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 00031 /** @file 00032 * Additional API for the Driver Layer. 00033 * 00034 * These additional driver functions allow the application to supply 00035 * a separately created socket to the driver library. 00036 * 00037 */ 00038 00039 #if defined(_WIN32) && ! defined(__CYGWIN__) 00040 typedef SOCKET pn_socket_t; 00041 #else 00042 typedef int pn_socket_t; 00043 #endif 00044 00045 /** Create a listener using the existing file descriptor. 00046 * 00047 * @param[in] driver driver that will 'own' this listener 00048 * @param[in] fd existing socket for listener to listen on 00049 * @param[in] context application-supplied, can be accessed via 00050 * pn_listener_context() 00051 * @return a new listener on the given host:port, NULL if error 00052 */ 00053 PN_EXTERN pn_listener_t *pn_listener_fd(pn_driver_t *driver, pn_socket_t fd, void *context); 00054 00055 /** Create a connector using the existing file descriptor. 00056 * 00057 * @param[in] driver driver that will 'own' this connector. 00058 * @param[in] fd existing socket to use for this connector. 00059 * @param[in] context application-supplied, can be accessed via 00060 * pn_connector_context() 00061 * @return a new connector to the given host:port, NULL if error. 00062 */ 00063 PN_EXTERN pn_connector_t *pn_connector_fd(pn_driver_t *driver, pn_socket_t fd, void *context); 00064 00065 00066 #ifdef __cplusplus 00067 } 00068 #endif 00069 00070 #endif /* driver_extras.h */