link.h
Go to the documentation of this file.
#ifndef PROTON_LINK_H
#define PROTON_LINK_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 <proton/terminus.h>
#include <proton/types.h>
#include <proton/object.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
PN_EXTERN pn_link_t *pn_sender(pn_session_t *session, const char *name);
PN_EXTERN pn_link_t *pn_receiver(pn_session_t *session, const char *name);
PN_EXTERN void pn_link_free(pn_link_t *link);
PN_EXTERN void *pn_link_get_context(pn_link_t *link);
PN_EXTERN void pn_link_set_context(pn_link_t *link, void *context);
PN_EXTERN pn_record_t *pn_link_attachments(pn_link_t *link);
PN_EXTERN const char *pn_link_name(pn_link_t *link);
PN_EXTERN bool pn_link_is_sender(pn_link_t *link);
PN_EXTERN bool pn_link_is_receiver(pn_link_t *link);
PN_EXTERN pn_state_t pn_link_state(pn_link_t *link);
PN_EXTERN pn_error_t *pn_link_error(pn_link_t *link);
PN_EXTERN pn_condition_t *pn_link_condition(pn_link_t *link);
PN_EXTERN pn_condition_t *pn_link_remote_condition(pn_link_t *link);
PN_EXTERN pn_session_t *pn_link_session(pn_link_t *link);
PN_EXTERN pn_link_t *pn_link_head(pn_connection_t *connection, pn_state_t state);
PN_EXTERN pn_link_t *pn_link_next(pn_link_t *link, pn_state_t state);
PN_EXTERN void pn_link_open(pn_link_t *link);
PN_EXTERN void pn_link_close(pn_link_t *link);
PN_EXTERN void pn_link_detach(pn_link_t *link);
PN_EXTERN pn_terminus_t *pn_link_source(pn_link_t *link);
PN_EXTERN pn_terminus_t *pn_link_target(pn_link_t *link);
PN_EXTERN pn_terminus_t *pn_link_remote_source(pn_link_t *link);
PN_EXTERN pn_terminus_t *pn_link_remote_target(pn_link_t *link);
PN_EXTERN pn_delivery_t *pn_link_current(pn_link_t *link);
PN_EXTERN bool pn_link_advance(pn_link_t *link);
PN_EXTERN int pn_link_credit(pn_link_t *link);
PN_EXTERN int pn_link_queued(pn_link_t *link);
PN_EXTERN int pn_link_remote_credit(pn_link_t *link);
PN_EXTERN bool pn_link_get_drain(pn_link_t *link);
PN_EXTERN int pn_link_drained(pn_link_t *link);
PN_EXTERN int pn_link_available(pn_link_t *link);
typedef enum {
PN_SND_UNSETTLED = 0,
PN_SND_SETTLED = 1,
PN_SND_MIXED = 2
} pn_snd_settle_mode_t;
typedef enum {
PN_RCV_FIRST = 0,
PN_RCV_SECOND = 1
} pn_rcv_settle_mode_t;
PN_EXTERN pn_snd_settle_mode_t pn_link_snd_settle_mode(pn_link_t *link);
PN_EXTERN pn_rcv_settle_mode_t pn_link_rcv_settle_mode(pn_link_t *link);
PN_EXTERN void pn_link_set_snd_settle_mode(pn_link_t *link, pn_snd_settle_mode_t mode);
PN_EXTERN void pn_link_set_rcv_settle_mode(pn_link_t *link, pn_rcv_settle_mode_t mode);
PN_EXTERN pn_snd_settle_mode_t pn_link_remote_snd_settle_mode(pn_link_t *link);
PN_EXTERN pn_rcv_settle_mode_t pn_link_remote_rcv_settle_mode(pn_link_t *link);
PN_EXTERN int pn_link_unsettled(pn_link_t *link);
PN_EXTERN pn_delivery_t *pn_unsettled_head(pn_link_t *link);
PN_EXTERN pn_delivery_t *pn_unsettled_next(pn_delivery_t *delivery);
PN_EXTERN void pn_link_offered(pn_link_t *sender, int credit);
PN_EXTERN ssize_t pn_link_send(pn_link_t *sender, const char *bytes, size_t n);
PN_EXTERN void pn_link_flow(pn_link_t *receiver, int credit);
PN_EXTERN void pn_link_drain(pn_link_t *receiver, int credit);
PN_EXTERN void pn_link_set_drain(pn_link_t *receiver, bool drain);
PN_EXTERN ssize_t pn_link_recv(pn_link_t *receiver, char *bytes, size_t n);
PN_EXTERN bool pn_link_draining(pn_link_t *receiver);
PN_EXTERN uint64_t pn_link_max_message_size(pn_link_t *link);
PN_EXTERN void pn_link_set_max_message_size(pn_link_t *link, uint64_t size);
PN_EXTERN uint64_t pn_link_remote_max_message_size(pn_link_t *link);
#ifdef __cplusplus
}
#endif
#endif /* link.h */
pn_link_state
pn_state_t pn_link_state(pn_link_t *link)
Get the endpoint state flags for a link.
pn_rcv_settle_mode_t
pn_rcv_settle_mode_t
Describes the permitted/expected settlement behaviours of a receiving link.
Definition: link.h:491
pn_link_open
void pn_link_open(pn_link_t *link)
Open a link.
pn_link_set_rcv_settle_mode
void pn_link_set_rcv_settle_mode(pn_link_t *link, pn_rcv_settle_mode_t mode)
Set the local receiver settle mode for a link.
pn_receiver
pn_link_t * pn_receiver(pn_session_t *session, const char *name)
Construct a new receiver on a session.
pn_link_get_drain
bool pn_link_get_drain(pn_link_t *link)
Get the drain flag for a link.
types.h
pn_link_condition
pn_condition_t * pn_link_condition(pn_link_t *link)
Get the local condition associated with a link endpoint.
pn_link_current
pn_delivery_t * pn_link_current(pn_link_t *link)
Get the current delivery for a link.
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_link_available
int pn_link_available(pn_link_t *link)
Get the available deliveries hint for a link.
pn_link_draining
bool pn_link_draining(pn_link_t *receiver)
Check if a link is currently draining.
pn_state_t
int pn_state_t
Holds the state flags for an AMQP endpoint.
Definition: types.h:267
pn_link_name
const char * pn_link_name(pn_link_t *link)
Get the name of a link.
pn_link_session
pn_session_t * pn_link_session(pn_link_t *link)
Get the parent session for a link object.
PN_SND_UNSETTLED
The sender will send all deliveries initially unsettled.
Definition: link.h:475
pn_link_snd_settle_mode
pn_snd_settle_mode_t pn_link_snd_settle_mode(pn_link_t *link)
Get the local sender settle mode for a link.
pn_link_set_max_message_size
void pn_link_set_max_message_size(pn_link_t *link, uint64_t size)
Unsettled API - Set the maximum message size for a link.
pn_link_attachments
pn_record_t * pn_link_attachments(pn_link_t *link)
Get the attachments that are associated with a link object.
pn_terminus_t
struct pn_terminus_t pn_terminus_t
Encapsulates the endpoint state associated with an AMQP Terminus.
Definition: terminus.h:53
pn_link_error
pn_error_t * pn_link_error(pn_link_t *link)
Deprecated
pn_snd_settle_mode_t
pn_snd_settle_mode_t
Describes the permitted/expected settlement behaviours of a sending link.
Definition: link.h:474
pn_link_remote_condition
pn_condition_t * pn_link_remote_condition(pn_link_t *link)
Get the remote condition associated with a link endpoint.
pn_link_rcv_settle_mode
pn_rcv_settle_mode_t pn_link_rcv_settle_mode(pn_link_t *link)
Get the local receiver settle mode for a link.
pn_link_target
pn_terminus_t * pn_link_target(pn_link_t *link)
Access the locally defined target definition for a link.
pn_link_drain
void pn_link_drain(pn_link_t *receiver, int credit)
Grant credit for incoming deliveries on a receiver, and set drain mode to true.
pn_link_offered
void pn_link_offered(pn_link_t *sender, int credit)
Signal the availability of deliveries for a link.
pn_link_set_drain
void pn_link_set_drain(pn_link_t *receiver, bool drain)
Set the drain mode on a link.
pn_link_free
void pn_link_free(pn_link_t *link)
Free a link object.
pn_link_is_receiver
bool pn_link_is_receiver(pn_link_t *link)
Test if a link is a receiver.
pn_link_is_sender
bool pn_link_is_sender(pn_link_t *link)
Test if a link is a sender.
pn_link_queued
int pn_link_queued(pn_link_t *link)
Get the number of queued deliveries for a link.
condition.h
pn_link_get_context
void * pn_link_get_context(pn_link_t *link)
Deprecated - Use pn_link_attachments().
pn_link_drained
int pn_link_drained(pn_link_t *link)
Drain excess credit for a link.
pn_link_remote_max_message_size
uint64_t pn_link_remote_max_message_size(pn_link_t *link)
Unsettled API - Get the remote view of the maximum message size for a link.
pn_link_remote_snd_settle_mode
pn_snd_settle_mode_t pn_link_remote_snd_settle_mode(pn_link_t *link)
Get the remote sender settle mode for a link.
pn_delivery_t
struct pn_delivery_t pn_delivery_t
An AMQP Delivery object.
Definition: types.h:401
pn_unsettled_head
pn_delivery_t * pn_unsettled_head(pn_link_t *link)
Get the first unsettled delivery for a link.
pn_link_max_message_size
uint64_t pn_link_max_message_size(pn_link_t *link)
Unsettled API - Get the maximum message size for a link.
pn_link_flow
void pn_link_flow(pn_link_t *receiver, int credit)
Grant credit for incoming deliveries on a receiver.
PN_SND_SETTLED
The sender will send all deliveries settled to the receiver.
Definition: link.h:477
pn_condition_t
struct pn_condition_t pn_condition_t
An AMQP Condition object.
Definition: condition.h:64
pn_link_send
ssize_t pn_link_send(pn_link_t *sender, const char *bytes, size_t n)
Send message data for the current delivery on a link.
pn_unsettled_next
pn_delivery_t * pn_unsettled_next(pn_delivery_t *delivery)
Get the next unsettled delivery on a link.
pn_link_remote_source
pn_terminus_t * pn_link_remote_source(pn_link_t *link)
Access the remotely defined source definition for a link.
pn_connection_t
struct pn_connection_t pn_connection_t
An AMQP Connection object.
Definition: types.h:281
pn_sender
pn_link_t * pn_sender(pn_session_t *session, const char *name)
Construct a new sender on a session.
pn_link_recv
ssize_t pn_link_recv(pn_link_t *receiver, char *bytes, size_t n)
Receive message data for the current delivery on a link.
pn_link_set_snd_settle_mode
void pn_link_set_snd_settle_mode(pn_link_t *link, pn_snd_settle_mode_t mode)
Set the local sender settle mode for a link.
pn_link_t
struct pn_link_t pn_link_t
An AMQP Link object.
Definition: types.h:311
pn_link_unsettled
int pn_link_unsettled(pn_link_t *link)
Get the number of unsettled deliveries for a link.
pn_link_detach
void pn_link_detach(pn_link_t *link)
Detach a link.
PN_SND_MIXED
The sender may send a mixture of settled and unsettled deliveries.
Definition: link.h:479
pn_link_next
pn_link_t * pn_link_next(pn_link_t *link, pn_state_t state)
Retrieve the next link that matches the given state mask.
pn_session_t
struct pn_session_t pn_session_t
An AMQP Session object.
Definition: types.h:292
pn_link_remote_target
pn_terminus_t * pn_link_remote_target(pn_link_t *link)
Access the remotely defined target definition for a link.
PN_RCV_FIRST
The receiver will settle deliveries regardless of what the sender does.
Definition: link.h:492
terminus.h
pn_link_remote_rcv_settle_mode
pn_rcv_settle_mode_t pn_link_remote_rcv_settle_mode(pn_link_t *link)
Get the remote receiver settle mode for a link.
pn_link_credit
int pn_link_credit(pn_link_t *link)
Get the credit balance for a link.
pn_link_close
void pn_link_close(pn_link_t *link)
Close a link.
pn_link_remote_credit
int pn_link_remote_credit(pn_link_t *link)
Get the remote view of the credit for a link.
PN_RCV_SECOND
The receiver will only settle deliveries after the sender settles.
Definition: link.h:494
pn_link_head
pn_link_t * pn_link_head(pn_connection_t *connection, pn_state_t state)
Retrieve the first link that matches the given state mask.
pn_link_source
pn_terminus_t * pn_link_source(pn_link_t *link)
Access the locally defined source definition for a link.
pn_link_advance
bool pn_link_advance(pn_link_t *link)
Advance the current delivery of a link to the next delivery on the link.
pn_link_set_context
void pn_link_set_context(pn_link_t *link, void *context)
Deprecated - Use pn_link_attachments().