Qpid Proton C API  0.29.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 <stddef.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
58 typedef int pn_trace_t;
59 
65 typedef void (*pn_tracer_t)(pn_transport_t *transport, const char *message);
66 
72 #define PN_TRACE_OFF (0)
73 
79 #define PN_TRACE_RAW (1)
80 
86 #define PN_TRACE_FRM (2)
87 
94 #define PN_TRACE_DRV (4)
95 
101 #define PN_TRACE_EVT (8)
102 
124 PN_EXTERN pn_transport_t *pn_transport(void);
125 
131 PN_EXTERN void pn_transport_set_server(pn_transport_t *transport);
132 
141 PN_EXTERN void pn_transport_free(pn_transport_t *transport);
142 
161 PN_EXTERN const char *pn_transport_get_user(pn_transport_t *transport);
162 
177 PN_EXTERN void pn_transport_require_auth(pn_transport_t *transport, bool required);
178 
188 PN_EXTERN bool pn_transport_is_authenticated(pn_transport_t *transport);
189 
202 PN_EXTERN void pn_transport_require_encryption(pn_transport_t *transport, bool required);
203 
213 PN_EXTERN bool pn_transport_is_encrypted(pn_transport_t *transport);
214 
228 
232 PN_EXTERN pn_error_t *pn_transport_error(pn_transport_t *transport);
233 
241 PN_EXTERN int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection);
242 
250 PN_EXTERN int pn_transport_unbind(pn_transport_t *transport);
251 
263 PN_EXTERN void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace);
264 
277 PN_EXTERN void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t tracer);
278 
288 
298 PN_EXTERN void *pn_transport_get_context(pn_transport_t *transport);
299 
309 PN_EXTERN void pn_transport_set_context(pn_transport_t *transport, void *context);
310 
317 PN_EXTERN pn_record_t *pn_transport_attachments(pn_transport_t *transport);
318 
330 PN_EXTERN void pn_transport_log(pn_transport_t *transport, const char *message);
331 
345 PN_EXTERN void pn_transport_vlogf(pn_transport_t *transport, const char *fmt, va_list ap);
346 
359 PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...);
360 
373 PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport);
374 
394 PN_EXTERN int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max);
395 
404 PN_EXTERN uint16_t pn_transport_remote_channel_max(pn_transport_t *transport);
405 
414 PN_EXTERN uint32_t pn_transport_get_max_frame(pn_transport_t *transport);
415 
424 PN_EXTERN void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size);
425 
434 PN_EXTERN uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport);
435 
447 
458 PN_EXTERN void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout);
459 
471 
475 PN_EXTERN ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available);
476 
480 PN_EXTERN ssize_t pn_transport_output(pn_transport_t *transport, char *bytes, size_t size);
481 
499 PN_EXTERN ssize_t pn_transport_capacity(pn_transport_t *transport);
500 
513 PN_EXTERN char *pn_transport_tail(pn_transport_t *transport);
514 
532 PN_EXTERN ssize_t pn_transport_push(pn_transport_t *transport, const char *src, size_t size);
533 
549 PN_EXTERN int pn_transport_process(pn_transport_t *transport, size_t size);
550 
561 PN_EXTERN int pn_transport_close_tail(pn_transport_t *transport);
562 
579 PN_EXTERN ssize_t pn_transport_pending(pn_transport_t *transport);
580 
595 PN_EXTERN const char *pn_transport_head(pn_transport_t *transport);
596 
611 PN_EXTERN ssize_t pn_transport_peek(pn_transport_t *transport, char *dst, size_t size);
612 
626 PN_EXTERN void pn_transport_pop(pn_transport_t *transport, size_t size);
627 
638 PN_EXTERN int pn_transport_close_head(pn_transport_t *transport);
639 
648 PN_EXTERN bool pn_transport_quiesced(pn_transport_t *transport);
649 
655 PN_EXTERN bool pn_transport_head_closed(pn_transport_t *transport);
656 
662 PN_EXTERN bool pn_transport_tail_closed(pn_transport_t *transport);
663 
669 PN_EXTERN bool pn_transport_closed(pn_transport_t *transport);
670 
693 PN_EXTERN int64_t pn_transport_tick(pn_transport_t *transport, int64_t now);
694 
703 PN_EXTERN uint64_t pn_transport_get_frames_output(const pn_transport_t *transport);
704 
713 PN_EXTERN uint64_t pn_transport_get_frames_input(const pn_transport_t *transport);
714 
723 
724 #ifdef __cplusplus
725 }
726 #endif
727 
732 #endif /* transport.h */
uint32_t pn_millis_t
A span of time in milliseconds.
Definition: types.h:145
pn_record_t * pn_transport_attachments(pn_transport_t *transport)
Get the attachments that are associated with a transport object.
void pn_transport_vlogf(pn_transport_t *transport, const char *fmt, va_list ap)
Log a printf formatted message using a transport&#39;s logging mechanism.
void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout)
Set the idle timeout for a transport.
bool pn_transport_tail_closed(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
void pn_transport_require_auth(pn_transport_t *transport, bool required)
Set whether a non-authenticated transport connection is allowed.
void pn_transport_logf(pn_transport_t *transport, const char *fmt,...)
Log a printf formatted message using a transport&#39;s logging mechanism.
char * pn_transport_tail(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
struct pn_transport_t pn_transport_t
A network channel supporting an AMQP connection.
Definition: types.h:431
ssize_t pn_transport_peek(pn_transport_t *transport, char *dst, size_t size)
Deprecated - Use the Connection driver API.
uint64_t pn_transport_get_frames_output(const pn_transport_t *transport)
Deprecated - No replacement.
void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace)
Update a transports trace flags.
struct pn_error_t pn_error_t
An int error code and some string text to describe the error.
Definition: error.h:44
int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection)
Deprecated - Use pn_connection_driver_init().
bool pn_transport_closed(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available)
Deprecated - Use the Connection driver API.
void pn_transport_pop(pn_transport_t *transport, size_t size)
Deprecated - Use the Connection driver API.
const char * pn_transport_get_user(pn_transport_t *transport)
Retrieve the authenticated user.
ssize_t pn_transport_capacity(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
void * pn_transport_get_context(pn_transport_t *transport)
Get the application context that is associated with a transport object.
void pn_transport_require_encryption(pn_transport_t *transport, bool required)
Set whether a non encrypted transport connection is allowed.
An endpoint error state.
pn_millis_t pn_transport_get_idle_timeout(pn_transport_t *transport)
Get the idle timeout for a transport.
pn_millis_t pn_transport_get_remote_idle_timeout(pn_transport_t *transport)
Get the idle timeout for a transport&#39;s remote peer.
uint16_t pn_transport_get_channel_max(pn_transport_t *transport)
Get the maximum allowed channel for a transport.
uint64_t pn_transport_get_frames_input(const pn_transport_t *transport)
Deprecated - No replacement.
void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size)
Set the maximum frame size of a transport.
int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max)
Set the maximum allowed channel number for a transport.
int pn_transport_close_head(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
int64_t pn_transport_tick(pn_transport_t *transport, int64_t now)
Process any pending transport timer events.
uint16_t pn_transport_remote_channel_max(pn_transport_t *transport)
Get the maximum allowed channel of a transport&#39;s remote peer.
void pn_transport_set_context(pn_transport_t *transport, void *context)
Set a new application context for a transport object.
void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t tracer)
Set the tracing function used by a transport.
pn_tracer_t pn_transport_get_tracer(pn_transport_t *transport)
Get the tracing function used by a transport.
pn_error_t * pn_transport_error(pn_transport_t *transport)
Deprecated - Use pn_transport_condition().
void pn_transport_log(pn_transport_t *transport, const char *message)
Log a message using a transport&#39;s logging mechanism.
int pn_trace_t
Holds the trace flags for an AMQP transport.
Definition: transport.h:58
int pn_transport_process(pn_transport_t *transport, size_t size)
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.
bool pn_transport_is_encrypted(pn_transport_t *transport)
Tell whether the transport connection is encrypted.
uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport)
Get the maximum frame size of a transport&#39;s remote peer.
const char * pn_transport_head(pn_transport_t *transport)
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:65
ssize_t pn_transport_pending(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
struct pn_connection_t pn_connection_t
An AMQP Connection object.
Definition: types.h:281
ssize_t pn_transport_output(pn_transport_t *transport, char *bytes, size_t size)
Deprecated - Use the Connection driver API.
pn_condition_t * pn_transport_condition(pn_transport_t *transport)
Get additional information about the condition of the transport.
struct pn_condition_t pn_condition_t
An AMQP Condition object.
Definition: condition.h:64
void pn_transport_free(pn_transport_t *transport)
Free a transport object.
int pn_transport_close_tail(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
bool pn_transport_quiesced(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.
bool pn_transport_head_closed(pn_transport_t *transport)
Deprecated - Use the Connection driver API.
pn_transport_t * pn_transport(void)
Factory for creating a transport.
void pn_transport_set_server(pn_transport_t *transport)
Configure a transport as a server.
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.
uint32_t pn_transport_get_max_frame(pn_transport_t *transport)
Get the maximum frame size of a transport.