Qpid Proton C API  0.37.0
transport.h
Go to the documentation of this file.
1 #ifndef PROTON_TRANSPORT_H
2 #define PROTON_TRANSPORT_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/import_export.h>
26 #include <proton/type_compat.h>
27 #include <proton/condition.h>
28 #include <proton/logger.h>
29 #include <stddef.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
59 typedef int pn_trace_t;
60 
66 typedef void (*pn_tracer_t)(pn_transport_t *transport, const char *message);
67 
73 #define PN_TRACE_OFF (0)
74 
80 #define PN_TRACE_RAW (1)
81 
87 #define PN_TRACE_FRM (2)
88 
95 #define PN_TRACE_DRV (4)
96 
102 #define PN_TRACE_EVT (8)
103 
125 PN_EXTERN pn_transport_t *pn_transport(void);
126 
132 PN_EXTERN void pn_transport_set_server(pn_transport_t *transport);
133 
142 PN_EXTERN void pn_transport_free(pn_transport_t *transport);
143 
162 PN_EXTERN const char *pn_transport_get_user(pn_transport_t *transport);
163 
178 PN_EXTERN void pn_transport_require_auth(pn_transport_t *transport, bool required);
179 
190 
203 PN_EXTERN void pn_transport_require_encryption(pn_transport_t *transport, bool required);
204 
214 PN_EXTERN bool pn_transport_is_encrypted(pn_transport_t *transport);
215 
229 
242 
247 
255 PN_EXTERN int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection);
256 
264 PN_EXTERN int pn_transport_unbind(pn_transport_t *transport);
265 
277 PN_EXTERN void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace);
278 
291 PN_EXTERN void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t tracer);
292 
302 
312 PN_EXTERN void *pn_transport_get_context(pn_transport_t *transport);
313 
323 PN_EXTERN void pn_transport_set_context(pn_transport_t *transport, void *context);
324 
331 PN_EXTERN pn_record_t *pn_transport_attachments(pn_transport_t *transport);
332 
344 PN_EXTERN void pn_transport_log(pn_transport_t *transport, const char *message);
345 
359 PN_EXTERN void pn_transport_vlogf(pn_transport_t *transport, const char *fmt, va_list ap);
360 
373 PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...);
374 
387 PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport);
388 
408 PN_EXTERN int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max);
409 
418 PN_EXTERN uint16_t pn_transport_remote_channel_max(pn_transport_t *transport);
419 
428 PN_EXTERN uint32_t pn_transport_get_max_frame(pn_transport_t *transport);
429 
438 PN_EXTERN void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size);
439 
448 PN_EXTERN uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport);
449 
461 
472 PN_EXTERN void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout);
473 
485 
489 PN_EXTERN ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available);
490 
494 PN_EXTERN ssize_t pn_transport_output(pn_transport_t *transport, char *bytes, size_t size);
495 
513 PN_EXTERN ssize_t pn_transport_capacity(pn_transport_t *transport);
514 
527 PN_EXTERN char *pn_transport_tail(pn_transport_t *transport);
528 
546 PN_EXTERN ssize_t pn_transport_push(pn_transport_t *transport, const char *src, size_t size);
547 
563 PN_EXTERN int pn_transport_process(pn_transport_t *transport, size_t size);
564 
575 PN_EXTERN int pn_transport_close_tail(pn_transport_t *transport);
576 
593 PN_EXTERN ssize_t pn_transport_pending(pn_transport_t *transport);
594 
609 PN_EXTERN const char *pn_transport_head(pn_transport_t *transport);
610 
625 PN_EXTERN ssize_t pn_transport_peek(pn_transport_t *transport, char *dst, size_t size);
626 
640 PN_EXTERN void pn_transport_pop(pn_transport_t *transport, size_t size);
641 
652 PN_EXTERN int pn_transport_close_head(pn_transport_t *transport);
653 
662 PN_EXTERN bool pn_transport_quiesced(pn_transport_t *transport);
663 
669 PN_EXTERN bool pn_transport_head_closed(pn_transport_t *transport);
670 
676 PN_EXTERN bool pn_transport_tail_closed(pn_transport_t *transport);
677 
683 PN_EXTERN bool pn_transport_closed(pn_transport_t *transport);
684 
707 PN_EXTERN int64_t pn_transport_tick(pn_transport_t *transport, int64_t now);
708 
717 PN_EXTERN uint64_t pn_transport_get_frames_output(const pn_transport_t *transport);
718 
727 PN_EXTERN uint64_t pn_transport_get_frames_input(const pn_transport_t *transport);
728 
737 
738 #ifdef __cplusplus
739 }
740 #endif
741 
746 #endif /* transport.h */
An endpoint error state.
uint32_t pn_millis_t
A span of time in milliseconds.
Definition: types.h:149
struct pn_condition_t pn_condition_t
An AMQP Condition object.
Definition: condition.h:64
struct pn_connection_t pn_connection_t
An AMQP Connection object.
Definition: types.h:285
struct pn_error_t pn_error_t
An int error code and some string text to describe the error.
Definition: error.h:44
struct pn_logger_t pn_logger_t
The logger object allows library logging to be controlled.
Definition: logger.h:86
void * pn_transport_get_context(pn_transport_t *transport)
Get the application context that is associated with a transport object.
ssize_t pn_transport_peek(pn_transport_t *transport, char *dst, size_t size)
Deprecated - Use the Connection driver API.
int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection)
Deprecated - Use pn_connection_driver_init().
int pn_transport_process(pn_transport_t *transport, size_t size)
Deprecated - Use the Connection driver API.
void pn_transport_logf(pn_transport_t *transport, const char *fmt,...)
Log a printf formatted message using a transport's logging mechanism.
void pn_transport_require_auth(pn_transport_t *transport, bool required)
Set whether a non-authenticated transport connection is allowed.
int pn_transport_unbind(pn_transport_t *transport)
Deprecated - Use pn_connection_driver_destroy().
pn_connection_t * pn_transport_connection(pn_transport_t *transport)
Access the AMQP Connection associated with the transport.
pn_tracer_t pn_transport_get_tracer(pn_transport_t *transport)
Get the tracing function used by a transport.
void pn_transport_pop(pn_transport_t *transport, size_t size)
Deprecated - Use the Connection driver API.
uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport)
Get the maximum frame size of a transport's remote peer.
uint64_t pn_transport_get_frames_output(const pn_transport_t *transport)
Deprecated - No replacement.
pn_logger_t * pn_transport_logger(pn_transport_t *transport)
Get the transport logger.
bool pn_transport_head_closed(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
const char * pn_transport_head(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
uint32_t pn_transport_get_max_frame(pn_transport_t *transport)
Get the maximum frame size of a transport.
int pn_trace_t
Holds the trace flags for an AMQP transport.
Definition: transport.h:59
char * pn_transport_tail(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
ssize_t pn_transport_push(pn_transport_t *transport, const char *src, size_t size)
Deprecated - Use the Connection driver API.
void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size)
Set the maximum frame size of a transport.
bool pn_transport_closed(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
bool pn_transport_tail_closed(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
pn_millis_t pn_transport_get_idle_timeout(pn_transport_t *transport)
Get the idle timeout for a transport.
void pn_transport_free(pn_transport_t *transport)
Free a transport object.
const char * pn_transport_get_user(pn_transport_t *transport)
Retrieve the authenticated user.
bool pn_transport_is_encrypted(pn_transport_t *transport)
Tell whether the transport connection is encrypted.
void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t tracer)
Set the tracing function used by a transport.
ssize_t pn_transport_pending(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
bool pn_transport_is_authenticated(pn_transport_t *transport)
Tell whether the transport connection is authenticated.
int64_t pn_transport_tick(pn_transport_t *transport, int64_t now)
Process any pending transport timer events.
int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max)
Set the maximum allowed channel number for a transport.
uint64_t pn_transport_get_frames_input(const pn_transport_t *transport)
Deprecated - No replacement.
ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available)
Deprecated - Use the Connection driver API.
ssize_t pn_transport_capacity(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
int pn_transport_close_tail(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace)
Update a transports trace flags.
int pn_transport_close_head(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
bool pn_transport_quiesced(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
pn_millis_t pn_transport_get_remote_idle_timeout(pn_transport_t *transport)
Get the idle timeout for a transport's remote peer.
pn_record_t * pn_transport_attachments(pn_transport_t *transport)
Get the attachments that are associated with a transport object.
uint16_t pn_transport_get_channel_max(pn_transport_t *transport)
Get the maximum allowed channel for a transport.
void pn_transport_set_context(pn_transport_t *transport, void *context)
Set a new application context for a transport object.
struct pn_transport_t pn_transport_t
A network channel supporting an AMQP connection.
Definition: types.h:435
pn_condition_t * pn_transport_condition(pn_transport_t *transport)
Get additional information about the condition of the transport.
void pn_transport_set_server(pn_transport_t *transport)
Configure a transport as a server.
void pn_transport_vlogf(pn_transport_t *transport, const char *fmt, va_list ap)
Log a printf formatted message using a transport's logging mechanism.
void pn_transport_log(pn_transport_t *transport, const char *message)
Log a message using a transport's logging mechanism.
ssize_t pn_transport_output(pn_transport_t *transport, char *bytes, size_t size)
Deprecated - Use the Connection driver API.
void(* pn_tracer_t)(pn_transport_t *transport, const char *message)
Callback for customizing logging behaviour.
Definition: transport.h:66
void pn_transport_require_encryption(pn_transport_t *transport, bool required)
Set whether a non encrypted transport connection is allowed.
pn_error_t * pn_transport_error(pn_transport_t *transport)
Deprecated - Use pn_transport_condition().
pn_transport_t * pn_transport(void)
Factory for creating a transport.
void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout)
Set the idle timeout for a transport.
uint16_t pn_transport_remote_channel_max(pn_transport_t *transport)
Get the maximum allowed channel of a transport's remote peer.
Facility for logging messages.