message.h
Go to the documentation of this file.
#ifndef PROTON_MESSAGE_H
#define PROTON_MESSAGE_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/types.h>
#include <proton/codec.h>
#include <proton/error.h>
#include <proton/type_compat.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct pn_message_t pn_message_t;
#define PN_DEFAULT_PRIORITY (4)
PN_EXTERN pn_message_t * pn_message(void);
PN_EXTERN void pn_message_free(pn_message_t *msg);
PN_EXTERN void pn_message_clear(pn_message_t *msg);
PN_EXTERN int pn_message_errno(pn_message_t *msg);
PN_EXTERN pn_error_t *pn_message_error(pn_message_t *msg);
PN_EXTERN bool pn_message_is_inferred(pn_message_t *msg);
PN_EXTERN int pn_message_set_inferred(pn_message_t *msg, bool inferred);
PN_EXTERN bool pn_message_is_durable (pn_message_t *msg);
PN_EXTERN int pn_message_set_durable (pn_message_t *msg, bool durable);
PN_EXTERN uint8_t pn_message_get_priority (pn_message_t *msg);
PN_EXTERN int pn_message_set_priority (pn_message_t *msg, uint8_t priority);
PN_EXTERN pn_millis_t pn_message_get_ttl (pn_message_t *msg);
PN_EXTERN int pn_message_set_ttl (pn_message_t *msg, pn_millis_t ttl);
PN_EXTERN bool pn_message_is_first_acquirer (pn_message_t *msg);
PN_EXTERN int pn_message_set_first_acquirer (pn_message_t *msg, bool first);
PN_EXTERN uint32_t pn_message_get_delivery_count (pn_message_t *msg);
PN_EXTERN int pn_message_set_delivery_count (pn_message_t *msg, uint32_t count);
PN_EXTERN pn_data_t * pn_message_id (pn_message_t *msg);
PN_EXTERN pn_atom_t pn_message_get_id (pn_message_t *msg);
PN_EXTERN int pn_message_set_id (pn_message_t *msg, pn_atom_t id);
PN_EXTERN pn_bytes_t pn_message_get_user_id (pn_message_t *msg);
PN_EXTERN int pn_message_set_user_id (pn_message_t *msg, pn_bytes_t user_id);
PN_EXTERN const char * pn_message_get_address (pn_message_t *msg);
PN_EXTERN int pn_message_set_address (pn_message_t *msg, const char *address);
PN_EXTERN const char * pn_message_get_subject (pn_message_t *msg);
PN_EXTERN int pn_message_set_subject (pn_message_t *msg, const char *subject);
PN_EXTERN const char * pn_message_get_reply_to (pn_message_t *msg);
PN_EXTERN int pn_message_set_reply_to (pn_message_t *msg, const char *reply_to);
PN_EXTERN pn_data_t * pn_message_correlation_id (pn_message_t *msg);
PN_EXTERN pn_atom_t pn_message_get_correlation_id (pn_message_t *msg);
PN_EXTERN int pn_message_set_correlation_id (pn_message_t *msg, pn_atom_t id);
PN_EXTERN const char * pn_message_get_content_type (pn_message_t *msg);
PN_EXTERN int pn_message_set_content_type (pn_message_t *msg, const char *type);
PN_EXTERN const char * pn_message_get_content_encoding (pn_message_t *msg);
PN_EXTERN int pn_message_set_content_encoding (pn_message_t *msg, const char *encoding);
PN_EXTERN pn_timestamp_t pn_message_get_expiry_time (pn_message_t *msg);
PN_EXTERN int pn_message_set_expiry_time (pn_message_t *msg, pn_timestamp_t time);
PN_EXTERN pn_timestamp_t pn_message_get_creation_time (pn_message_t *msg);
PN_EXTERN int pn_message_set_creation_time (pn_message_t *msg, pn_timestamp_t time);
PN_EXTERN const char * pn_message_get_group_id (pn_message_t *msg);
PN_EXTERN int pn_message_set_group_id (pn_message_t *msg, const char *group_id);
PN_EXTERN pn_sequence_t pn_message_get_group_sequence (pn_message_t *msg);
PN_EXTERN int pn_message_set_group_sequence (pn_message_t *msg, pn_sequence_t n);
PN_EXTERN const char * pn_message_get_reply_to_group_id (pn_message_t *msg);
PN_EXTERN int pn_message_set_reply_to_group_id (pn_message_t *msg, const char *reply_to_group_id);
PN_EXTERN pn_data_t *pn_message_instructions(pn_message_t *msg);
PN_EXTERN pn_data_t *pn_message_annotations(pn_message_t *msg);
PN_EXTERN pn_data_t *pn_message_properties(pn_message_t *msg);
PN_EXTERN pn_data_t *pn_message_body(pn_message_t *msg);
PN_EXTERN int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size);
PN_EXTERN int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size);
PN_EXTERN int pn_message_data(pn_message_t *msg, pn_data_t *data);
#ifdef __cplusplus
}
#endif
#endif /* message.h */
pn_message_set_content_type
int pn_message_set_content_type(pn_message_t *msg, const char *type)
Set the content_type for a message.
pn_message_get_reply_to
const char * pn_message_get_reply_to(pn_message_t *msg)
Get the reply_to for a message.
pn_message_properties
pn_data_t * pn_message_properties(pn_message_t *msg)
Get and set the properties for a message.
pn_message_set_reply_to
int pn_message_set_reply_to(pn_message_t *msg, const char *reply_to)
Set the reply_to for a message.
pn_message_get_subject
const char * pn_message_get_subject(pn_message_t *msg)
Get the subject for a message.
types.h
pn_message_set_ttl
int pn_message_set_ttl(pn_message_t *msg, pn_millis_t ttl)
Set the ttl for a message.
pn_message_correlation_id
pn_data_t * pn_message_correlation_id(pn_message_t *msg)
Get/set the correlation id for a message.
pn_message_set_durable
int pn_message_set_durable(pn_message_t *msg, bool durable)
Set the durable flag for a message.
pn_message_errno
int pn_message_errno(pn_message_t *msg)
Access the error code of a message.
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_message_free
void pn_message_free(pn_message_t *msg)
Free a previously constructed pn_message_t.
pn_message_get_content_type
const char * pn_message_get_content_type(pn_message_t *msg)
Get the content_type for a message.
pn_message_get_expiry_time
pn_timestamp_t pn_message_get_expiry_time(pn_message_t *msg)
Get the expiry time for a message.
pn_message_set_reply_to_group_id
int pn_message_set_reply_to_group_id(pn_message_t *msg, const char *reply_to_group_id)
Set the reply_to_group_id for a message.
pn_message_set_priority
int pn_message_set_priority(pn_message_t *msg, uint8_t priority)
Set the priority for a message.
pn_message_set_subject
int pn_message_set_subject(pn_message_t *msg, const char *subject)
Set the subject for a message.
pn_atom_t
A discriminated union that holds any scalar AMQP value.
Definition: codec.h:200
pn_message_encode
int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size)
Encode/save message content as AMQP formatted binary data.
pn_message_get_creation_time
pn_timestamp_t pn_message_get_creation_time(pn_message_t *msg)
Get the creation time for a message.
pn_message_id
pn_data_t * pn_message_id(pn_message_t *msg)
Get/set the id for a message.
codec.h
pn_message_get_delivery_count
uint32_t pn_message_get_delivery_count(pn_message_t *msg)
Get the delivery count for a message.
pn_message_t
struct pn_message_t pn_message_t
An AMQP Message object.
Definition: message.h:51
pn_sequence_t
int32_t pn_sequence_t
A sequence number.
Definition: types.h:138
pn_message_clear
void pn_message_clear(pn_message_t *msg)
Clears the content of a pn_message_t.
pn_message
pn_message_t * pn_message(void)
Construct a new pn_message_t.
pn_bytes_t
A const byte buffer.
Definition: types.h:212
pn_message_get_content_encoding
const char * pn_message_get_content_encoding(pn_message_t *msg)
Get the content_encoding for a message.
pn_message_data
int pn_message_data(pn_message_t *msg, pn_data_t *data)
Save message content into a pn_data_t object data.
pn_message_set_correlation_id
int pn_message_set_correlation_id(pn_message_t *msg, pn_atom_t id)
Set the correlation id for a message.
pn_message_get_ttl
pn_millis_t pn_message_get_ttl(pn_message_t *msg)
Get the ttl for a message.
pn_data_t
struct pn_data_t pn_data_t
An AMQP Data object.
Definition: codec.h:364
pn_message_set_user_id
int pn_message_set_user_id(pn_message_t *msg, pn_bytes_t user_id)
Set the user id for a message.
pn_message_set_creation_time
int pn_message_set_creation_time(pn_message_t *msg, pn_timestamp_t time)
Set the creation time for a message.
pn_millis_t
uint32_t pn_millis_t
A span of time in milliseconds.
Definition: types.h:145
pn_message_set_first_acquirer
int pn_message_set_first_acquirer(pn_message_t *msg, bool first)
Set the first acquirer flag for a message.
pn_message_get_id
pn_atom_t pn_message_get_id(pn_message_t *msg)
Get the id for a message.
error.h
pn_message_set_group_sequence
int pn_message_set_group_sequence(pn_message_t *msg, pn_sequence_t n)
Set the group sequence for a message.
pn_message_instructions
pn_data_t * pn_message_instructions(pn_message_t *msg)
Get/set the delivery instructions for a message.
pn_message_set_inferred
int pn_message_set_inferred(pn_message_t *msg, bool inferred)
Set the inferred flag for a message.
pn_message_get_user_id
pn_bytes_t pn_message_get_user_id(pn_message_t *msg)
Get the user id for a message.
pn_message_error
pn_error_t * pn_message_error(pn_message_t *msg)
Access the error information for a message.
pn_message_get_priority
uint8_t pn_message_get_priority(pn_message_t *msg)
Get the priority for a message.
pn_timestamp_t
int64_t pn_timestamp_t
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition: types.h:166
pn_message_get_group_id
const char * pn_message_get_group_id(pn_message_t *msg)
Get the group_id for a message.
pn_message_decode
int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size)
Decode/load message content from AMQP formatted binary data.
pn_message_set_content_encoding
int pn_message_set_content_encoding(pn_message_t *msg, const char *encoding)
Set the content_encoding for a message.
pn_message_get_address
const char * pn_message_get_address(pn_message_t *msg)
Get the address for a message.
pn_message_get_correlation_id
pn_atom_t pn_message_get_correlation_id(pn_message_t *msg)
Get the correlation id for a message.
pn_message_set_id
int pn_message_set_id(pn_message_t *msg, pn_atom_t id)
Set the id for a message.
pn_message_set_delivery_count
int pn_message_set_delivery_count(pn_message_t *msg, uint32_t count)
Set the delivery count for a message.
pn_message_set_group_id
int pn_message_set_group_id(pn_message_t *msg, const char *group_id)
Set the group_id for a message.
pn_message_body
pn_data_t * pn_message_body(pn_message_t *msg)
Get and set the body of a message.
pn_message_get_group_sequence
pn_sequence_t pn_message_get_group_sequence(pn_message_t *msg)
Get the group sequence for a message.
pn_message_set_address
int pn_message_set_address(pn_message_t *msg, const char *address)
Set the address for a message.
pn_message_annotations
pn_data_t * pn_message_annotations(pn_message_t *msg)
Get/set the annotations for a message.
pn_message_is_first_acquirer
bool pn_message_is_first_acquirer(pn_message_t *msg)
Get the first acquirer flag for a message.
pn_message_set_expiry_time
int pn_message_set_expiry_time(pn_message_t *msg, pn_timestamp_t time)
Set the expiry time for a message.
pn_message_is_inferred
bool pn_message_is_inferred(pn_message_t *msg)
Get the inferred flag for a message.
pn_message_get_reply_to_group_id
const char * pn_message_get_reply_to_group_id(pn_message_t *msg)
Get the reply_to_group_id for a message.
pn_message_is_durable
bool pn_message_is_durable(pn_message_t *msg)
Get the durable flag for a message.