transport.h
Go to the documentation of this file.
#ifndef PROTON_TRANSPORT_H
#define PROTON_TRANSPORT_H 1
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#include <proton/import_export.h>
#include <proton/type_compat.h>
#include <proton/condition.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int pn_trace_t;
typedef void (*pn_tracer_t)(pn_transport_t *transport, const char *message);
#define PN_TRACE_OFF (0)
#define PN_TRACE_RAW (1)
#define PN_TRACE_FRM (2)
#define PN_TRACE_DRV (4)
#define PN_TRACE_EVT (8)
PN_EXTERN pn_transport_t *pn_transport(void);
PN_EXTERN void pn_transport_set_server(pn_transport_t *transport);
PN_EXTERN void pn_transport_free(pn_transport_t *transport);
PN_EXTERN const char *pn_transport_get_user(pn_transport_t *transport);
PN_EXTERN void pn_transport_require_auth(pn_transport_t *transport, bool required);
PN_EXTERN bool pn_transport_is_authenticated(pn_transport_t *transport);
PN_EXTERN void pn_transport_require_encryption(pn_transport_t *transport, bool required);
PN_EXTERN bool pn_transport_is_encrypted(pn_transport_t *transport);
PN_EXTERN pn_condition_t *pn_transport_condition(pn_transport_t *transport);
PN_EXTERN pn_error_t *pn_transport_error(pn_transport_t *transport);
PN_EXTERN int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection);
PN_EXTERN int pn_transport_unbind(pn_transport_t *transport);
PN_EXTERN void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace);
PN_EXTERN void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t tracer);
PN_EXTERN pn_tracer_t pn_transport_get_tracer(pn_transport_t *transport);
PN_EXTERN void *pn_transport_get_context(pn_transport_t *transport);
PN_EXTERN void pn_transport_set_context(pn_transport_t *transport, void *context);
PN_EXTERN pn_record_t *pn_transport_attachments(pn_transport_t *transport);
PN_EXTERN void pn_transport_log(pn_transport_t *transport, const char *message);
PN_EXTERN void pn_transport_vlogf(pn_transport_t *transport, const char *fmt, va_list ap);
PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...);
PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport);
PN_EXTERN int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max);
PN_EXTERN uint16_t pn_transport_remote_channel_max(pn_transport_t *transport);
PN_EXTERN uint32_t pn_transport_get_max_frame(pn_transport_t *transport);
PN_EXTERN void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size);
PN_EXTERN uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport);
PN_EXTERN pn_millis_t pn_transport_get_idle_timeout(pn_transport_t *transport);
PN_EXTERN void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout);
PN_EXTERN pn_millis_t pn_transport_get_remote_idle_timeout(pn_transport_t *transport);
PN_EXTERN ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available);
PN_EXTERN ssize_t pn_transport_output(pn_transport_t *transport, char *bytes, size_t size);
PN_EXTERN ssize_t pn_transport_capacity(pn_transport_t *transport);
PN_EXTERN char *pn_transport_tail(pn_transport_t *transport);
PN_EXTERN ssize_t pn_transport_push(pn_transport_t *transport, const char *src, size_t size);
PN_EXTERN int pn_transport_process(pn_transport_t *transport, size_t size);
PN_EXTERN int pn_transport_close_tail(pn_transport_t *transport);
PN_EXTERN ssize_t pn_transport_pending(pn_transport_t *transport);
PN_EXTERN const char *pn_transport_head(pn_transport_t *transport);
PN_EXTERN ssize_t pn_transport_peek(pn_transport_t *transport, char *dst, size_t size);
PN_EXTERN void pn_transport_pop(pn_transport_t *transport, size_t size);
PN_EXTERN int pn_transport_close_head(pn_transport_t *transport);
PN_EXTERN bool pn_transport_quiesced(pn_transport_t *transport);
PN_EXTERN bool pn_transport_head_closed(pn_transport_t *transport);
PN_EXTERN bool pn_transport_tail_closed(pn_transport_t *transport);
PN_EXTERN bool pn_transport_closed(pn_transport_t *transport);
PN_EXTERN pn_timestamp_t pn_transport_tick(pn_transport_t *transport, pn_timestamp_t now);
PN_EXTERN uint64_t pn_transport_get_frames_output(const pn_transport_t *transport);
PN_EXTERN uint64_t pn_transport_get_frames_input(const pn_transport_t *transport);
PN_EXTERN pn_connection_t *pn_transport_connection(pn_transport_t *transport);
#ifdef __cplusplus
}
#endif
#endif /* transport.h */
pn_transport_is_encrypted
bool pn_transport_is_encrypted(pn_transport_t *transport)
Tell whether the transport connection is encrypted.
pn_transport_get_context
void * pn_transport_get_context(pn_transport_t *transport)
Deprecated - Use pn_transport_attachments().
pn_transport_unbind
int pn_transport_unbind(pn_transport_t *transport)
Unbinds a transport from its AMQP connection.
pn_transport_tail
char * pn_transport_tail(pn_transport_t *transport)
Get the transport's tail pointer.
pn_transport_pending
ssize_t pn_transport_pending(pn_transport_t *transport)
Get the number of pending output bytes following the transport's head pointer.
pn_transport_input
ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available)
Deprecated
pn_transport_get_remote_max_frame
uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport)
Get the maximum frame size of a transport's remote peer.
pn_transport_logf
void pn_transport_logf(pn_transport_t *transport, const char *fmt,...)
Log a printf formatted message using a transport's logging mechanism.
pn_transport
pn_transport_t * pn_transport(void)
Factory for creating a transport.
pn_transport_set_idle_timeout
void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout)
Set the idle timeout for a transport.
pn_error_t
struct pn_error_t pn_error_t
An int error code and some string text to describe the error.
Definition: error.h:44
pn_transport_attachments
pn_record_t * pn_transport_attachments(pn_transport_t *transport)
Get the attachments that are associated with a transport object.
pn_transport_set_max_frame
void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size)
Set the maximum frame size of a transport.
pn_transport_remote_channel_max
uint16_t pn_transport_remote_channel_max(pn_transport_t *transport)
Get the maximum allowed channel of a transport's remote peer.
pn_transport_connection
pn_connection_t * pn_transport_connection(pn_transport_t *transport)
Access the AMQP Connection associated with the transport.
pn_transport_t
struct pn_transport_t pn_transport_t
A network channel supporting an AMQP connection.
Definition: types.h:431
pn_transport_capacity
ssize_t pn_transport_capacity(pn_transport_t *transport)
Get the amount of free space for input following the transport's tail pointer.
pn_transport_get_user
const char * pn_transport_get_user(pn_transport_t *transport)
Retrieve the authenticated user.
pn_transport_closed
bool pn_transport_closed(pn_transport_t *transport)
Equivalent to pn_transport_head_closed(transport) && pn_transport_tail_closed(transport)
pn_trace_t
int pn_trace_t
Holds the trace flags for an AMQP transport.
Definition: transport.h:57
pn_transport_bind
int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection)
Binds the transport to an AMQP connection.
pn_transport_head
const char * pn_transport_head(pn_transport_t *transport)
Get the transport's head pointer.
pn_tracer_t
void(* pn_tracer_t)(pn_transport_t *transport, const char *message)
Callback for customizing logging behaviour.
Definition: transport.h:62
condition.h
pn_transport_get_frames_output
uint64_t pn_transport_get_frames_output(const pn_transport_t *transport)
Get the number of frames output by a transport.
pn_transport_set_context
void pn_transport_set_context(pn_transport_t *transport, void *context)
Deprecated - Use pn_transport_attachments().
pn_transport_tick
pn_timestamp_t pn_transport_tick(pn_transport_t *transport, pn_timestamp_t now)
Process any pending transport timer events.
pn_transport_peek
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.
pn_millis_t
uint32_t pn_millis_t
A span of time in milliseconds.
Definition: types.h:145
pn_condition_t
struct pn_condition_t pn_condition_t
An AMQP Condition object.
Definition: condition.h:64
pn_transport_require_encryption
void pn_transport_require_encryption(pn_transport_t *transport, bool required)
Set whether a non encrypted transport connection is allowed.
pn_transport_free
void pn_transport_free(pn_transport_t *transport)
Free a transport object.
pn_transport_pop
void pn_transport_pop(pn_transport_t *transport, size_t size)
Removes size bytes of output from the pending output queue following the transport's head pointer.
pn_transport_set_channel_max
int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max)
Set the maximum allowed channel number for a transport.
pn_transport_close_tail
int pn_transport_close_tail(pn_transport_t *transport)
Indicate that the input has reached End Of Stream (EOS).
pn_transport_set_tracer
void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t tracer)
Set the tracing function used by a transport.
pn_transport_get_channel_max
uint16_t pn_transport_get_channel_max(pn_transport_t *transport)
Get the maximum allowed channel for a transport.
pn_transport_get_frames_input
uint64_t pn_transport_get_frames_input(const pn_transport_t *transport)
Get the number of frames input by a transport.
pn_timestamp_t
int64_t pn_timestamp_t
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition: types.h:166
pn_transport_is_authenticated
bool pn_transport_is_authenticated(pn_transport_t *transport)
Tell whether the transport connection is authenticated.
pn_connection_t
struct pn_connection_t pn_connection_t
An AMQP Connection object.
Definition: types.h:281
pn_transport_output
ssize_t pn_transport_output(pn_transport_t *transport, char *bytes, size_t size)
Deprecated
pn_transport_process
int pn_transport_process(pn_transport_t *transport, size_t size)
Process input data following the tail pointer.
pn_transport_push
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.
pn_transport_get_tracer
pn_tracer_t pn_transport_get_tracer(pn_transport_t *transport)
Get the tracing function used by a transport.
pn_transport_vlogf
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.
pn_transport_tail_closed
bool pn_transport_tail_closed(pn_transport_t *transport)
True if pn_transport_close_tail() has been called.
pn_transport_error
pn_error_t * pn_transport_error(pn_transport_t *transport)
Deprecated
pn_transport_close_head
int pn_transport_close_head(pn_transport_t *transport)
Indicate that the output has closed.
pn_transport_get_max_frame
uint32_t pn_transport_get_max_frame(pn_transport_t *transport)
Get the maximum frame size of a transport.
pn_transport_get_idle_timeout
pn_millis_t pn_transport_get_idle_timeout(pn_transport_t *transport)
Get the idle timeout for a transport.
pn_transport_get_remote_idle_timeout
pn_millis_t pn_transport_get_remote_idle_timeout(pn_transport_t *transport)
Get the idle timeout for a transport's remote peer.
pn_transport_condition
pn_condition_t * pn_transport_condition(pn_transport_t *transport)
Get additional information about the condition of the transport.
pn_transport_set_server
void pn_transport_set_server(pn_transport_t *transport)
Configure a transport as a server.
pn_transport_head_closed
bool pn_transport_head_closed(pn_transport_t *transport)
True if pn_transport_close_head() has been called.
pn_transport_require_auth
void pn_transport_require_auth(pn_transport_t *transport, bool required)
Set whether a non-authenticated transport connection is allowed.
pn_transport_trace
void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace)
Update a transports trace flags.
pn_transport_quiesced
bool pn_transport_quiesced(pn_transport_t *transport)
Check if a transport has buffered data.
pn_transport_log
void pn_transport_log(pn_transport_t *transport, const char *message)
Log a message using a transport's logging mechanism.