Qpid Proton C API  0.18.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 
57 typedef int pn_trace_t;
58 
62 typedef void (*pn_tracer_t)(pn_transport_t *transport, const char *message);
63 
67 #define PN_TRACE_OFF (0)
68 
72 #define PN_TRACE_RAW (1)
73 
77 #define PN_TRACE_FRM (2)
78 
83 #define PN_TRACE_DRV (4)
84 
88 #define PN_TRACE_EVT (8)
89 
112 PN_EXTERN pn_transport_t *pn_transport(void);
113 
119 PN_EXTERN void pn_transport_set_server(pn_transport_t *transport);
120 
129 PN_EXTERN void pn_transport_free(pn_transport_t *transport);
130 
149 PN_EXTERN const char *pn_transport_get_user(pn_transport_t *transport);
150 
165 PN_EXTERN void pn_transport_require_auth(pn_transport_t *transport, bool required);
166 
176 PN_EXTERN bool pn_transport_is_authenticated(pn_transport_t *transport);
177 
190 PN_EXTERN void pn_transport_require_encryption(pn_transport_t *transport, bool required);
191 
201 PN_EXTERN bool pn_transport_is_encrypted(pn_transport_t *transport);
202 
216 
220 PN_EXTERN pn_error_t *pn_transport_error(pn_transport_t *transport);
221 
227 PN_EXTERN int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection);
228 
234 PN_EXTERN int pn_transport_unbind(pn_transport_t *transport);
235 
247 PN_EXTERN void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace);
248 
261 PN_EXTERN void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t tracer);
262 
272 
284 PN_EXTERN void *pn_transport_get_context(pn_transport_t *transport);
285 
297 PN_EXTERN void pn_transport_set_context(pn_transport_t *transport, void *context);
298 
305 PN_EXTERN pn_record_t *pn_transport_attachments(pn_transport_t *transport);
306 
318 PN_EXTERN void pn_transport_log(pn_transport_t *transport, const char *message);
319 
333 PN_EXTERN void pn_transport_vlogf(pn_transport_t *transport, const char *fmt, va_list ap);
334 
347 PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...);
348 
361 PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport);
362 
382 PN_EXTERN int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max);
383 
392 PN_EXTERN uint16_t pn_transport_remote_channel_max(pn_transport_t *transport);
393 
402 PN_EXTERN uint32_t pn_transport_get_max_frame(pn_transport_t *transport);
403 
412 PN_EXTERN void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size);
413 
422 PN_EXTERN uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport);
423 
435 
446 PN_EXTERN void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout);
447 
459 
463 PN_EXTERN ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available);
464 
468 PN_EXTERN ssize_t pn_transport_output(pn_transport_t *transport, char *bytes, size_t size);
469 
484 PN_EXTERN ssize_t pn_transport_capacity(pn_transport_t *transport);
485 
496 PN_EXTERN char *pn_transport_tail(pn_transport_t *transport);
497 
513 PN_EXTERN ssize_t pn_transport_push(pn_transport_t *transport, const char *src, size_t size);
514 
528 PN_EXTERN int pn_transport_process(pn_transport_t *transport, size_t size);
529 
538 PN_EXTERN int pn_transport_close_tail(pn_transport_t *transport);
539 
554 PN_EXTERN ssize_t pn_transport_pending(pn_transport_t *transport);
555 
568 PN_EXTERN const char *pn_transport_head(pn_transport_t *transport);
569 
582 PN_EXTERN ssize_t pn_transport_peek(pn_transport_t *transport, char *dst, size_t size);
583 
595 PN_EXTERN void pn_transport_pop(pn_transport_t *transport, size_t size);
596 
605 PN_EXTERN int pn_transport_close_head(pn_transport_t *transport);
606 
613 PN_EXTERN bool pn_transport_quiesced(pn_transport_t *transport);
614 
618 PN_EXTERN bool pn_transport_head_closed(pn_transport_t *transport);
619 
623 PN_EXTERN bool pn_transport_tail_closed(pn_transport_t *transport);
624 
628 PN_EXTERN bool pn_transport_closed(pn_transport_t *transport);
629 
646 
653 PN_EXTERN uint64_t pn_transport_get_frames_output(const pn_transport_t *transport);
654 
661 PN_EXTERN uint64_t pn_transport_get_frames_input(const pn_transport_t *transport);
662 
671 
672 #ifdef __cplusplus
673 }
674 #endif
675 
680 #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)
True if pn_transport_close_tail() has been called.
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)
Get the transport&#39;s tail pointer.
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)
Copies size bytes from the head of the transport to the dst pointer.
uint64_t pn_transport_get_frames_output(const pn_transport_t *transport)
Get the number of frames output by a transport.
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)
Binds the transport to an AMQP connection.
bool pn_transport_closed(pn_transport_t *transport)
Equivalent to pn_transport_head_closed(transport) && pn_transport_tail_closed(transport) ...
ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available)
Deprecated
void pn_transport_pop(pn_transport_t *transport, size_t size)
Removes size bytes of output from the pending output queue following the transport&#39;s head pointer...
const char * pn_transport_get_user(pn_transport_t *transport)
Retrieve the authenticated user.
ssize_t pn_transport_capacity(pn_transport_t *transport)
Get the amount of free space for input following the transport&#39;s tail pointer.
void * pn_transport_get_context(pn_transport_t *transport)
Deprecated - Use pn_transport_attachments().
pn_timestamp_t pn_transport_tick(pn_transport_t *transport, pn_timestamp_t now)
Process any pending transport timer events.
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)
Get the number of frames input by a transport.
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)
Indicate that the output has closed.
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)
Deprecated - Use pn_transport_attachments().
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
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:57
int pn_transport_process(pn_transport_t *transport, size_t size)
Process input data following the tail pointer.
ssize_t pn_transport_push(pn_transport_t *transport, const char *src, size_t size)
Pushes the supplied bytes into the tail of the transport.
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)
Get the transport&#39;s head pointer.
void(* pn_tracer_t)(pn_transport_t *transport, const char *message)
Callback for customizing logging behaviour.
Definition: transport.h:62
ssize_t pn_transport_pending(pn_transport_t *transport)
Get the number of pending output bytes following the transport&#39;s head pointer.
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
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)
Indicate that the input has reached End Of Stream (EOS).
bool pn_transport_quiesced(pn_transport_t *transport)
Check if a transport has buffered data.
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)
True if pn_transport_close_head() has been called.
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.
int64_t pn_timestamp_t
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition: types.h:166
int pn_transport_unbind(pn_transport_t *transport)
Unbinds a transport from its AMQP connection.
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.