00001 #ifndef PROTON_RAW_CONNECTION_H 00002 #define PROTON_RAW_CONNECTION_H 1 00003 00004 /* 00005 * Licensed to the Apache Software Foundation (ASF) under one 00006 * or more contributor license agreements. See the NOTICE file 00007 * distributed with this work for additional information 00008 * regarding copyright ownership. The ASF licenses this file 00009 * to you under the Apache License, Version 2.0 (the 00010 * "License"); you may not use this file except in compliance 00011 * with the License. You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, 00016 * software distributed under the License is distributed on an 00017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00018 * KIND, either express or implied. See the License for the 00019 * specific language governing permissions and limitations 00020 * under the License. 00021 */ 00022 00023 #include <proton/condition.h> 00024 #include <proton/event.h> 00025 #include <proton/import_export.h> 00026 #include <proton/types.h> 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00054 typedef struct pn_raw_buffer_t { 00055 uintptr_t context; 00056 char *bytes; 00057 uint32_t capacity; 00058 uint32_t size; 00059 uint32_t offset; 00060 } pn_raw_buffer_t; 00061 00077 PNP_EXTERN pn_raw_connection_t *pn_raw_connection(void); 00078 00083 PNP_EXTERN const struct pn_netaddr_t *pn_raw_connection_local_addr(pn_raw_connection_t *connection); 00084 00089 PNP_EXTERN const struct pn_netaddr_t *pn_raw_connection_remote_addr(pn_raw_connection_t *connection); 00090 00100 PNP_EXTERN void pn_raw_connection_close(pn_raw_connection_t *connection); 00101 00105 PNP_EXTERN size_t pn_raw_connection_read_buffers_capacity(pn_raw_connection_t *connection); 00106 00110 PNP_EXTERN size_t pn_raw_connection_write_buffers_capacity(pn_raw_connection_t *connection); 00111 00135 PNP_EXTERN size_t pn_raw_connection_give_read_buffers(pn_raw_connection_t *connection, pn_raw_buffer_t const *buffers, size_t num); 00136 00150 PNP_EXTERN size_t pn_raw_connection_take_read_buffers(pn_raw_connection_t *connection, pn_raw_buffer_t *buffers, size_t num); 00151 00169 PNP_EXTERN size_t pn_raw_connection_write_buffers(pn_raw_connection_t *connection, pn_raw_buffer_t const *buffers, size_t num); 00170 00184 PNP_EXTERN size_t pn_raw_connection_take_written_buffers(pn_raw_connection_t *connection, pn_raw_buffer_t *buffers, size_t num); 00185 00191 PNP_EXTERN bool pn_raw_connection_is_read_closed(pn_raw_connection_t *connection); 00192 00198 PNP_EXTERN bool pn_raw_connection_is_write_closed(pn_raw_connection_t *connection); 00199 00210 PNP_EXTERN void pn_raw_connection_wake(pn_raw_connection_t *connection); 00211 00220 PNP_EXTERN pn_condition_t *pn_raw_connection_condition(pn_raw_connection_t *connection); 00221 00231 PNP_EXTERN void *pn_raw_connection_get_context(pn_raw_connection_t *connection); 00232 00242 PNP_EXTERN void pn_raw_connection_set_context(pn_raw_connection_t *connection, void *context); 00243 00247 PNP_EXTERN pn_record_t *pn_raw_connection_attachments(pn_raw_connection_t *connection); 00248 00254 PNP_EXTERN pn_raw_connection_t *pn_event_raw_connection(pn_event_t *event); 00255 00256 00261 #ifdef __cplusplus 00262 } 00263 #endif 00264 00265 #endif /* raw_connection.h */