Qpid Proton C API  0.18.1
message.h
Go to the documentation of this file.
1 #ifndef PROTON_MESSAGE_H
2 #define PROTON_MESSAGE_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/types.h>
27 #include <proton/codec.h>
28 #include <proton/error.h>
29 #include <proton/type_compat.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
51 typedef struct pn_message_t pn_message_t;
52 
56 #define PN_DEFAULT_PRIORITY (4)
57 
66 PN_EXTERN pn_message_t * pn_message(void);
67 
73 PN_EXTERN void pn_message_free(pn_message_t *msg);
74 
84 PN_EXTERN void pn_message_clear(pn_message_t *msg);
85 
97 PN_EXTERN int pn_message_errno(pn_message_t *msg);
98 
111 PN_EXTERN pn_error_t *pn_message_error(pn_message_t *msg);
112 
127 PN_EXTERN bool pn_message_is_inferred(pn_message_t *msg);
128 
139 PN_EXTERN int pn_message_set_inferred(pn_message_t *msg, bool inferred);
140 
150 PN_EXTERN bool pn_message_is_durable (pn_message_t *msg);
151 
162 PN_EXTERN int pn_message_set_durable (pn_message_t *msg, bool durable);
163 
174 PN_EXTERN uint8_t pn_message_get_priority (pn_message_t *msg);
175 
185 PN_EXTERN int pn_message_set_priority (pn_message_t *msg, uint8_t priority);
186 
200 
210 PN_EXTERN int pn_message_set_ttl (pn_message_t *msg, pn_millis_t ttl);
211 
224 PN_EXTERN bool pn_message_is_first_acquirer (pn_message_t *msg);
225 
236 PN_EXTERN int pn_message_set_first_acquirer (pn_message_t *msg, bool first);
237 
248 PN_EXTERN uint32_t pn_message_get_delivery_count (pn_message_t *msg);
249 
260 PN_EXTERN int pn_message_set_delivery_count (pn_message_t *msg, uint32_t count);
261 
275 PN_EXTERN pn_data_t * pn_message_id (pn_message_t *msg);
276 
289 PN_EXTERN pn_atom_t pn_message_get_id (pn_message_t *msg);
290 
302 PN_EXTERN int pn_message_set_id (pn_message_t *msg, pn_atom_t id);
303 
318 
329 PN_EXTERN int pn_message_set_user_id (pn_message_t *msg, pn_bytes_t user_id);
330 
345 PN_EXTERN const char * pn_message_get_address (pn_message_t *msg);
346 
359 PN_EXTERN int pn_message_set_address (pn_message_t *msg, const char *address);
360 
375 PN_EXTERN const char * pn_message_get_subject (pn_message_t *msg);
376 
389 PN_EXTERN int pn_message_set_subject (pn_message_t *msg, const char *subject);
390 
405 PN_EXTERN const char * pn_message_get_reply_to (pn_message_t *msg);
406 
419 PN_EXTERN int pn_message_set_reply_to (pn_message_t *msg, const char *reply_to);
420 
434 
447 
459 PN_EXTERN int pn_message_set_correlation_id (pn_message_t *msg, pn_atom_t id);
460 
475 PN_EXTERN const char * pn_message_get_content_type (pn_message_t *msg);
476 
489 PN_EXTERN int pn_message_set_content_type (pn_message_t *msg, const char *type);
490 
505 PN_EXTERN const char * pn_message_get_content_encoding (pn_message_t *msg);
506 
519 PN_EXTERN int pn_message_set_content_encoding (pn_message_t *msg, const char *encoding);
520 
531 
541 PN_EXTERN int pn_message_set_expiry_time (pn_message_t *msg, pn_timestamp_t time);
542 
553 
563 PN_EXTERN int pn_message_set_creation_time (pn_message_t *msg, pn_timestamp_t time);
564 
579 PN_EXTERN const char * pn_message_get_group_id (pn_message_t *msg);
580 
593 PN_EXTERN int pn_message_set_group_id (pn_message_t *msg, const char *group_id);
594 
606 
618 
633 PN_EXTERN const char * pn_message_get_reply_to_group_id (pn_message_t *msg);
634 
647 PN_EXTERN int pn_message_set_reply_to_group_id (pn_message_t *msg, const char *reply_to_group_id);
648 
665 
681 
697 
709 PN_EXTERN pn_data_t *pn_message_body(pn_message_t *msg);
710 
723 PN_EXTERN int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size);
724 
738 PN_EXTERN int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size);
739 
743 PN_EXTERN int pn_message_data(pn_message_t *msg, pn_data_t *data);
744 
748 #ifdef __cplusplus
749 }
750 #endif
751 
752 #endif /* message.h */
const char * pn_message_get_content_type(pn_message_t *msg)
Get the content_type for a message.
int pn_message_set_reply_to(pn_message_t *msg, const char *reply_to)
Set the reply_to for a message.
uint32_t pn_millis_t
A span of time in milliseconds.
Definition: types.h:145
int pn_message_set_priority(pn_message_t *msg, uint8_t priority)
Set the priority for a message.
pn_sequence_t pn_message_get_group_sequence(pn_message_t *msg)
Get the group sequence for a message.
AMQP and API data types.
int pn_message_set_ttl(pn_message_t *msg, pn_millis_t ttl)
Set the ttl for a message.
bool pn_message_is_durable(pn_message_t *msg)
Get the durable flag for a message.
int pn_message_set_durable(pn_message_t *msg, bool durable)
Set the durable flag for a message.
int pn_message_set_subject(pn_message_t *msg, const char *subject)
Set the subject for a message.
pn_data_t * pn_message_id(pn_message_t *msg)
Get/set the id for a message.
pn_data_t * pn_message_properties(pn_message_t *msg)
Get and set the properties for a message.
A descriminated union that holds any scalar AMQP value.
Definition: codec.h:200
bool pn_message_is_first_acquirer(pn_message_t *msg)
Get the first acquirer flag for a message.
bool pn_message_is_inferred(pn_message_t *msg)
Get the inferred flag for a message.
const char * pn_message_get_reply_to_group_id(pn_message_t *msg)
Get the reply_to_group_id for a message.
struct pn_message_t pn_message_t
An AMQP Message object.
Definition: message.h:51
pn_message_t * pn_message(void)
Construct a new pn_message_t.
int pn_message_set_content_type(pn_message_t *msg, const char *type)
Set the content_type for a message.
pn_timestamp_t pn_message_get_creation_time(pn_message_t *msg)
Get the creation time for a message.
AMQP data encoding and decoding.
const char * pn_message_get_subject(pn_message_t *msg)
Get the subject for a message.
const char * pn_message_get_content_encoding(pn_message_t *msg)
Get the content_encoding for a message.
pn_timestamp_t pn_message_get_expiry_time(pn_message_t *msg)
Get the expiry time for a message.
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_message_errno(pn_message_t *msg)
Access the error code of a message.
pn_data_t * pn_message_correlation_id(pn_message_t *msg)
Get/set the correlation id for a message.
int32_t pn_sequence_t
A sequence number.
Definition: types.h:138
void pn_message_free(pn_message_t *msg)
Free a previously constructed pn_message_t.
uint32_t pn_message_get_delivery_count(pn_message_t *msg)
Get the delivery count for a message.
int pn_message_set_first_acquirer(pn_message_t *msg, bool first)
Set the first acquirer flag for a message.
A Proton API error.
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.
void pn_message_clear(pn_message_t *msg)
Clears the content of a pn_message_t.
int pn_message_set_creation_time(pn_message_t *msg, pn_timestamp_t time)
Set the creation time for a message.
int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size)
Encode/save message content as AMQP formatted binary data.
const char * pn_message_get_group_id(pn_message_t *msg)
Get the group_id for a message.
pn_bytes_t pn_message_get_user_id(pn_message_t *msg)
Get the user id for a message.
pn_atom_t pn_message_get_id(pn_message_t *msg)
Get the id for a message.
int pn_message_set_group_sequence(pn_message_t *msg, pn_sequence_t n)
Set the group sequence for a message.
int pn_message_data(pn_message_t *msg, pn_data_t *data)
Save message content into a pn_data_t object data.
uint8_t pn_message_get_priority(pn_message_t *msg)
Get the priority for a message.
int pn_message_set_user_id(pn_message_t *msg, pn_bytes_t user_id)
Set the user id for a message.
pn_millis_t pn_message_get_ttl(pn_message_t *msg)
Get the ttl for a message.
int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size)
Decode/load message content from AMQP formatted binary data.
pn_data_t * pn_message_instructions(pn_message_t *msg)
Get/set the delivery instructions for a message.
int pn_message_set_content_encoding(pn_message_t *msg, const char *encoding)
Set the content_encoding for a message.
struct pn_data_t pn_data_t
An AMQP Data object.
Definition: codec.h:364
pn_atom_t pn_message_get_correlation_id(pn_message_t *msg)
Get the correlation id for a message.
int pn_message_set_correlation_id(pn_message_t *msg, pn_atom_t id)
Set the correlation id for a message.
int pn_message_set_delivery_count(pn_message_t *msg, uint32_t count)
Set the delivery count for a message.
pn_error_t * pn_message_error(pn_message_t *msg)
Access the error information for a message.
int pn_message_set_group_id(pn_message_t *msg, const char *group_id)
Set the group_id for a message.
const char * pn_message_get_address(pn_message_t *msg)
Get the address for a message.
int pn_message_set_inferred(pn_message_t *msg, bool inferred)
Set the inferred flag for a message.
int pn_message_set_expiry_time(pn_message_t *msg, pn_timestamp_t time)
Set the expiry time for a message.
pn_data_t * pn_message_annotations(pn_message_t *msg)
Get/set the annotations for a message.
int pn_message_set_address(pn_message_t *msg, const char *address)
Set the address for a message.
A const byte buffer.
Definition: types.h:212
pn_data_t * pn_message_body(pn_message_t *msg)
Get and set the body of a message.
int64_t pn_timestamp_t
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition: types.h:166
int pn_message_set_id(pn_message_t *msg, pn_atom_t id)
Set the id for a message.
const char * pn_message_get_reply_to(pn_message_t *msg)
Get the reply_to for a message.