proton  0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
35 /** @file
36  * Message API for encoding/decoding AMQP Messages.
37  *
38  * @defgroup message Message
39  * @{
40  */
41 
42 /**
43  * An AMQP Message object.
44  *
45  * An AMQP Message object is a mutable holder of message content that
46  * may be used to generate and encode or decode and access AMQP
47  * formatted message data.
48  */
49 typedef struct pn_message_t pn_message_t;
50 
51 /**
52  * Default priority for messages.
53  */
54 #define PN_DEFAULT_PRIORITY (4)
55 
56 /**
57  * Construct a new ::pn_message_t.
58  *
59  * Every message that is constructed must be freed using
60  * ::pn_message_free().
61  *
62  * @return pointer to a new ::pn_message_t
63  */
65 
66 /**
67  * Free a previously constructed ::pn_message_t.
68  *
69  * @param[in] msg pointer to a ::pn_message_t or NULL
70  */
72 
73 /**
74  * Clears the content of a ::pn_message_t.
75  *
76  * When pn_message_clear returns, the supplied ::pn_message_t will be
77  * emptied of all content and effectively returned to the same state
78  * as if it was just created.
79  *
80  * @param[in] msg pointer to the ::pn_message_t to be cleared
81  */
83 
84 /**
85  * Access the error code of a message.
86  *
87  * Every operation on a message that can result in an error will set
88  * the message's error code in case of error. The pn_message_errno()
89  * call will access the error code of the most recent failed
90  * operation.
91  *
92  * @param[in] msg a message
93  * @return the message's error code
94  */
96 
97 /**
98  * Access the error information for a message.
99  *
100  * Every operation on a message that can result in an error will
101  * update the error information held by its error descriptor should
102  * that operation fail. The pn_message_error() call will access the
103  * error information of the most recent failed operation. The pointer
104  * returned by this call is valid until the message is freed.
105  *
106  * @param[in] msg a message
107  * @return the message's error descriptor
108  */
110 
111 /**
112  * Get the inferred flag for a message.
113  *
114  * The inferred flag for a message indicates how the message content
115  * is encoded into AMQP sections. If inferred is true then binary and
116  * list values in the body of the message will be encoded as AMQP DATA
117  * and AMQP SEQUENCE sections, respectively. If inferred is false,
118  * then all values in the body of the message will be encoded as AMQP
119  * VALUE sections regardless of their type. Use
120  * ::pn_message_set_inferred to set the value.
121  *
122  * @param[in] msg a message object
123  * @return the value of the inferred flag for the message
124  */
126 
127 /**
128  * Set the inferred flag for a message.
129  *
130  * See ::pn_message_is_inferred() for a description of what the
131  * inferred flag is.
132  *
133  * @param[in] msg a message object
134  * @param[in] inferred the new value of the inferred flag
135  * @return zero on success or an error code on failure
136  */
137 PN_EXTERN int pn_message_set_inferred(pn_message_t *msg, bool inferred);
138 
139 // standard message headers and properties
140 
141 /**
142  * Get the durable flag for a message.
143  *
144  * The durable flag indicates that any parties taking responsibility
145  * for the message must durably store the content.
146  *
147  * @param[in] msg a message object
148  * @return the value of the durable flag
149  */
151 
152 /**
153  * Set the durable flag for a message.
154  *
155  * See ::pn_message_is_durable() for a description of the durable
156  * flag.
157  *
158  * @param[in] msg a message object
159  * @param[in] durable the new value of the durable flag
160  * @return zero on success or an error code on failure
161  */
162 PN_EXTERN int pn_message_set_durable (pn_message_t *msg, bool durable);
163 
164 /**
165  * Get the priority for a message.
166  *
167  * The priority of a message impacts ordering guarantees. Within a
168  * given ordered context, higher priority messages may jump ahead of
169  * lower priority messages.
170  *
171  * @param[in] msg a message object
172  * @return the message priority
173  */
175 
176 /**
177  * Set the priority for a message.
178  *
179  * See ::pn_message_get_priority() for details on message priority.
180  *
181  * @param[in] msg a message object
182  * @param[in] priority the new priority for the message
183  * @return zero on success or an error code on failure
184  */
185 PN_EXTERN int pn_message_set_priority (pn_message_t *msg, uint8_t priority);
186 
187 /**
188  * Get the ttl for a message.
189  *
190  * The ttl for a message determines how long a message is considered
191  * live. When a message is held for retransmit, the ttl is
192  * decremented. Once the ttl reaches zero, the message is considered
193  * dead. Once a message is considered dead it may be dropped. Use
194  * ::pn_message_set_ttl() to set the ttl for a message.
195  *
196  * @param[in] msg a message object
197  * @return the ttl in milliseconds
198  */
200 
201 /**
202  * Set the ttl for a message.
203  *
204  * See ::pn_message_get_ttl() for a detailed description of message ttl.
205  *
206  * @param[in] msg a message object
207  * @param[in] ttl the new value for the message ttl
208  * @return zero on success or an error code on failure
209  */
211 
212 /**
213  * Get the first acquirer flag for a message.
214  *
215  * When set to true, the first acquirer flag for a message indicates
216  * that the recipient of the message is the first recipient to acquire
217  * the message, i.e. there have been no failed delivery attempts to
218  * other acquirers. Note that this does not mean the message has not
219  * been delivered to, but not acquired, by other recipients.
220  *
221  * @param[in] msg a message object
222  * @return the first acquirer flag for the message
223  */
225 
226 /**
227  * Set the first acquirer flag for a message.
228  *
229  * See ::pn_message_is_first_acquirer() for details on the first
230  * acquirer flag.
231  *
232  * @param[in] msg a message object
233  * @param[in] first the new value for the first acquirer flag
234  * @return zero on success or an error code on failure
235  */
237 
238 /**
239  * Get the delivery count for a message.
240  *
241  * The delivery count field tracks how many attempts have been made to
242  * delivery a message. Use ::pn_message_set_delivery_count() to set
243  * the delivery count for a message.
244  *
245  * @param[in] msg a message object
246  * @return the delivery count for the message
247  */
249 
250 /**
251  * Set the delivery count for a message.
252  *
253  * See ::pn_message_get_delivery_count() for details on what the
254  * delivery count means.
255  *
256  * @param[in] msg a message object
257  * @param[in] count the new delivery count
258  * @return zero on success or an error code on failure
259  */
260 PN_EXTERN int pn_message_set_delivery_count (pn_message_t *msg, uint32_t count);
261 
262 /**
263  * Get/set the id for a message.
264  *
265  * The message id provides a globally unique identifier for a message.
266  * A message id can be an a string, an unsigned long, a uuid or a
267  * binary value. This operation returns a pointer to a ::pn_data_t
268  * that can be used to access and/or modify the value of the message
269  * id. The pointer is valid until the message is freed. See
270  * ::pn_data_t for details on how to get/set the value.
271  *
272  * @param[in] msg a message object
273  * @return pointer to a ::pn_data_t holding the id
274  */
276 
277 /**
278  * Get the id for a message.
279  *
280  * The message id provides a globally unique identifier for a message.
281  * A message id can be an a string, an unsigned long, a uuid or a
282  * binary value. This operation returns the value of the id using the
283  * ::pn_atom_t descriminated union. See ::pn_atom_t for details on how
284  * to access the value.
285  *
286  * @param[in] msg a message object
287  * @return the message id
288  */
290 
291 /**
292  * Set the id for a message.
293  *
294  * See ::pn_message_get_id() for more details on the meaning of the
295  * message id. Note that only string, unsigned long, uuid, or binary
296  * values are permitted.
297  *
298  * @param[in] msg a message object
299  * @param[in] id the new value of the message id
300  * @return zero on success or an error code on failure
301  */
303 
304 /**
305  * Get the user id for a message.
306  *
307  * The pointer referenced by the ::pn_bytes_t struct will be valid
308  * until any one of the following operations occur:
309  *
310  * - ::pn_message_free()
311  * - ::pn_message_clear()
312  * - ::pn_message_set_user_id()
313  *
314  * @param[in] msg a message object
315  * @return a pn_bytes_t referencing the message's user_id
316  */
318 
319 /**
320  * Set the user id for a message.
321  *
322  * This operation copies the bytes referenced by the provided
323  * ::pn_bytes_t struct.
324  *
325  * @param[in] msg a message object
326  * @param[in] user_id the new user_id for the message
327  * @return zero on success or an error code on failure
328  */
330 
331 /**
332  * Get the address for a message.
333  *
334  * This operation will return NULL if no address has been set or if
335  * the address has been set to NULL. The pointer returned by this
336  * operation is valid until any one of the following operations occur:
337  *
338  * - ::pn_message_free()
339  * - ::pn_message_clear()
340  * - ::pn_message_set_address()
341  *
342  * @param[in] msg a message object
343  * @return a pointer to the address of the message (or NULL)
344  */
345 PN_EXTERN const char * pn_message_get_address (pn_message_t *msg);
346 
347 /**
348  * Set the address for a message.
349  *
350  * The supplied address pointer must either be NULL or reference a NUL
351  * terminated string. When the pointer is NULL, the address of the
352  * message is set to NULL. When the pointer is non NULL, the contents
353  * are copied into the message.
354  *
355  * @param[in] msg a message object
356  * @param[in] address a pointer to the new address (or NULL)
357  * @return zero on success or an error code on failure
358  */
359 PN_EXTERN int pn_message_set_address (pn_message_t *msg, const char *address);
360 
361 /**
362  * Get the subject for a message.
363  *
364  * This operation will return NULL if no subject has been set or if
365  * the subject has been set to NULL. The pointer returned by this
366  * operation is valid until any one of the following operations occur:
367  *
368  * - ::pn_message_free()
369  * - ::pn_message_clear()
370  * - ::pn_message_set_subject()
371  *
372  * @param[in] msg a message object
373  * @return a pointer to the subject of the message (or NULL)
374  */
375 PN_EXTERN const char * pn_message_get_subject (pn_message_t *msg);
376 
377 /**
378  * Set the subject for a message.
379  *
380  * The supplied subject pointer must either be NULL or reference a NUL
381  * terminated string. When the pointer is NULL, the subject is set to
382  * NULL. When the pointer is non NULL, the contents are copied into
383  * the message.
384  *
385  * @param[in] msg a message object
386  * @param[in] subject a pointer to the new subject (or NULL)
387  * @return zero on success or an error code on failure
388  */
389 PN_EXTERN int pn_message_set_subject (pn_message_t *msg, const char *subject);
390 
391 /**
392  * Get the reply_to for a message.
393  *
394  * This operation will return NULL if no reply_to has been set or if
395  * the reply_to has been set to NULL. The pointer returned by this
396  * operation is valid until any one of the following operations occur:
397  *
398  * - ::pn_message_free()
399  * - ::pn_message_clear()
400  * - ::pn_message_set_reply_to()
401  *
402  * @param[in] msg a message object
403  * @return a pointer to the reply_to of the message (or NULL)
404  */
406 
407 /**
408  * Set the reply_to for a message.
409  *
410  * The supplied reply_to pointer must either be NULL or reference a NUL
411  * terminated string. When the pointer is NULL, the reply_to is set to
412  * NULL. When the pointer is non NULL, the contents are copied into
413  * the message.
414  *
415  * @param[in] msg a message object
416  * @param[in] reply_to a pointer to the new reply_to (or NULL)
417  * @return zero on success or an error code on failure
418  */
419 PN_EXTERN int pn_message_set_reply_to (pn_message_t *msg, const char *reply_to);
420 
421 /**
422  * Get/set the correlation id for a message.
423  *
424  * A correlation id can be an a string, an unsigned long, a uuid or a
425  * binary value. This operation returns a pointer to a ::pn_data_t
426  * that can be used to access and/or modify the value of the
427  * correlation id. The pointer is valid until the message is freed.
428  * See ::pn_data_t for details on how to get/set the value.
429  *
430  * @param[in] msg a message object
431  * @return pointer to a ::pn_data_t holding the correlation id
432  */
434 
435 /**
436  * Get the correlation id for a message.
437  *
438  * A correlation id can be an a string, an unsigned long, a uuid or a
439  * binary value. This operation returns the value of the id using the
440  * ::pn_atom_t descriminated union. See ::pn_atom_t for details on how
441  * to access the value.
442  *
443  * @param[in] msg a message object
444  * @return the message id
445  */
447 
448 /**
449  * Set the correlation id for a message.
450  *
451  * See ::pn_message_get_correlation_id() for more details on the
452  * meaning of the correlation id. Note that only string, unsigned
453  * long, uuid, or binary values are permitted.
454  *
455  * @param[in] msg a message object
456  * @param[in] id the new value of the message id
457  * @return zero on success or an error code on failure
458  */
460 
461 /**
462  * Get the content_type for a message.
463  *
464  * This operation will return NULL if no content_type has been set or if
465  * the content_type has been set to NULL. The pointer returned by this
466  * operation is valid until any one of the following operations occur:
467  *
468  * - ::pn_message_free()
469  * - ::pn_message_clear()
470  * - ::pn_message_set_content_type()
471  *
472  * @param[in] msg a message object
473  * @return a pointer to the content_type of the message (or NULL)
474  */
476 
477 /**
478  * Set the content_type for a message.
479  *
480  * The supplied content_type pointer must either be NULL or reference a NUL
481  * terminated string. When the pointer is NULL, the content_type is set to
482  * NULL. When the pointer is non NULL, the contents are copied into
483  * the message.
484  *
485  * @param[in] msg a message object
486  * @param[in] type a pointer to the new content_type (or NULL)
487  * @return zero on success or an error code on failure
488  */
489 PN_EXTERN int pn_message_set_content_type (pn_message_t *msg, const char *type);
490 
491 /**
492  * Get the content_encoding for a message.
493  *
494  * This operation will return NULL if no content_encoding has been set or if
495  * the content_encoding has been set to NULL. The pointer returned by this
496  * operation is valid until any one of the following operations occur:
497  *
498  * - ::pn_message_free()
499  * - ::pn_message_clear()
500  * - ::pn_message_set_content_encoding()
501  *
502  * @param[in] msg a message object
503  * @return a pointer to the content_encoding of the message (or NULL)
504  */
506 
507 /**
508  * Set the content_encoding for a message.
509  *
510  * The supplied content_encoding pointer must either be NULL or reference a NUL
511  * terminated string. When the pointer is NULL, the content_encoding is set to
512  * NULL. When the pointer is non NULL, the contents are copied into
513  * the message.
514  *
515  * @param[in] msg a message object
516  * @param[in] encoding a pointer to the new content_encoding (or NULL)
517  * @return zero on success or an error code on failure
518  */
519 PN_EXTERN int pn_message_set_content_encoding (pn_message_t *msg, const char *encoding);
520 
521 /**
522  * Get the expiry time for a message.
523  *
524  * A zero value for the expiry time indicates that the message will
525  * never expire. This is the default value.
526  *
527  * @param[in] msg a message object
528  * @return the expiry time for the message
529  */
531 
532 /**
533  * Set the expiry time for a message.
534  *
535  * See ::pn_message_get_expiry_time() for more details.
536  *
537  * @param[in] msg a message object
538  * @param[in] time the new expiry time for the message
539  * @return zero on success or an error code on failure
540  */
542 
543 /**
544  * Get the creation time for a message.
545  *
546  * A zero value for the creation time indicates that the creation time
547  * has not been set. This is the default value.
548  *
549  * @param[in] msg a message object
550  * @return the creation time for the message
551  */
553 
554 /**
555  * Set the creation time for a message.
556  *
557  * See ::pn_message_get_creation_time() for more details.
558  *
559  * @param[in] msg a message object
560  * @param[in] time the new creation time for the message
561  * @return zero on success or an error code on failure
562  */
564 
565 /**
566  * Get the group_id for a message.
567  *
568  * This operation will return NULL if no group_id has been set or if
569  * the group_id has been set to NULL. The pointer returned by this
570  * operation is valid until any one of the following operations occur:
571  *
572  * - ::pn_message_free()
573  * - ::pn_message_clear()
574  * - ::pn_message_set_group_id()
575  *
576  * @param[in] msg a message object
577  * @return a pointer to the group_id of the message (or NULL)
578  */
580 
581 /**
582  * Set the group_id for a message.
583  *
584  * The supplied group_id pointer must either be NULL or reference a NUL
585  * terminated string. When the pointer is NULL, the group_id is set to
586  * NULL. When the pointer is non NULL, the contents are copied into
587  * the message.
588  *
589  * @param[in] msg a message object
590  * @param[in] group_id a pointer to the new group_id (or NULL)
591  * @return zero on success or an error code on failure
592  */
593 PN_EXTERN int pn_message_set_group_id (pn_message_t *msg, const char *group_id);
594 
595 /**
596  * Get the group sequence for a message.
597  *
598  * The group sequence of a message identifies the relative ordering of
599  * messages within a group. The default value for the group sequence
600  * of a message is zero.
601  *
602  * @param[in] msg a message object
603  * @return the group sequence for the message
604  */
606 
607 /**
608  * Set the group sequence for a message.
609  *
610  * See ::pn_message_get_group_sequence() for details on what the group
611  * sequence means.
612  *
613  * @param[in] msg a message object
614  * @param[in] n the new group sequence for the message
615  * @return zero on success or an error code on failure
616  */
618 
619 /**
620  * Get the reply_to_group_id for a message.
621  *
622  * This operation will return NULL if no reply_to_group_id has been set or if
623  * the reply_to_group_id has been set to NULL. The pointer returned by this
624  * operation is valid until any one of the following operations occur:
625  *
626  * - ::pn_message_free()
627  * - ::pn_message_clear()
628  * - ::pn_message_set_reply_to_group_id()
629  *
630  * @param[in] msg a message object
631  * @return a pointer to the reply_to_group_id of the message (or NULL)
632  */
634 
635 /**
636  * Set the reply_to_group_id for a message.
637  *
638  * The supplied reply_to_group_id pointer must either be NULL or reference a NUL
639  * terminated string. When the pointer is NULL, the reply_to_group_id is set to
640  * NULL. When the pointer is non NULL, the contents are copied into
641  * the message.
642  *
643  * @param[in] msg a message object
644  * @param[in] reply_to_group_id a pointer to the new reply_to_group_id (or NULL)
645  * @return zero on success or an error code on failure
646  */
647 PN_EXTERN int pn_message_set_reply_to_group_id (pn_message_t *msg, const char *reply_to_group_id);
648 
649 /**
650  * Get/set the delivery instructions for a message.
651  *
652  * This operation returns a pointer to a ::pn_data_t representing the
653  * content of the delivery instructions section of a message. The
654  * pointer is valid until the message is freed and may be used to both
655  * access and modify the content of the delivery instructions section
656  * of a message.
657  *
658  * The ::pn_data_t must either be empty or consist of a symbol keyed
659  * map in order to be considered valid delivery instructions.
660  *
661  * @param[in] msg a message object
662  * @return a pointer to the delivery instructions
663  */
665 
666 /**
667  * Get/set the annotations for a message.
668  *
669  * This operation returns a pointer to a ::pn_data_t representing the
670  * content of the annotations section of a message. The pointer is
671  * valid until the message is freed and may be used to both access and
672  * modify the content of the annotations section of a message.
673  *
674  * The ::pn_data_t must either be empty or consist of a symbol keyed
675  * map in order to be considered valid message annotations.
676  *
677  * @param[in] msg a message object
678  * @return a pointer to the message annotations
679  */
681 
682 /**
683  * Get/set the properties for a message.
684  *
685  * This operation returns a pointer to a ::pn_data_t representing the
686  * content of the properties section of a message. The pointer is
687  * valid until the message is freed and may be used to both access and
688  * modify the content of the properties section of a message.
689  *
690  * The ::pn_data_t must either be empty or consist of a string keyed
691  * map in order to be considered valid message properties.
692  *
693  * @param[in] msg a message object
694  * @return a pointer to the message properties
695  */
697 
698 /**
699  * Get/set the body of a message.
700  *
701  * This operation returns a pointer to a ::pn_data_t representing the
702  * body of a message. The pointer is valid until the message is freed
703  * and may be used to both access and modify the content of the
704  * message body.
705  *
706  * @param[in] msg a message object
707  * @return a pointer to the message body
708  */
710 
711 /**
712  * Decode/load message content from AMQP formatted binary data.
713  *
714  * Upon invoking this operation, any existing message content will be
715  * cleared and replaced with the content from the provided binary
716  * data.
717  *
718  * @param[in] msg a message object
719  * @param[in] bytes the start of the encoded AMQP data
720  * @param[in] size the size of the encoded AMQP data
721  * @return zero on success or an error code on failure
722  */
723 PN_EXTERN int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size);
724 
725 /**
726  * Encode/save message content as AMQP formatted binary data.
727  *
728  * If the buffer space provided is insufficient to store the content
729  * held in the message, the operation will fail and return a
730  * ::PN_OVERFLOW error code.
731  *
732  * @param[in] msg a message object
733  * @param[in] bytes the start of empty buffer space
734  * @param[in] size the amount of empty buffer space
735  * @param[out] size the amount of data written
736  * @return zero on success or an error code on failure
737  */
738 PN_EXTERN int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size);
739 
740 /**
741  * Save message content into a pn_data_t object data. The data object will first be cleared.
742  */
744 
745 /** @}
746  */
747 
748 #ifdef __cplusplus
749 }
750 #endif
751 
752 #endif /* message.h */
struct pn_error_t pn_error_t
Definition: error.h:32
PN_EXTERN pn_data_t * pn_message_id(pn_message_t *msg)
Get/set the id for a message.
PN_EXTERN pn_error_t * pn_message_error(pn_message_t *msg)
Access the error information for a message.
PN_EXTERN const char * pn_message_get_subject(pn_message_t *msg)
Get the subject for a message.
int32_t pn_sequence_t
Definition: types.h:45
A descriminated union that holds any scalar AMQP value.
Definition: codec.h:193
PN_EXTERN pn_message_t * pn_message(void)
Construct a new pn_message_t.
PN_EXTERN int pn_message_data(pn_message_t *msg, pn_data_t *data)
Save message content into a pn_data_t object data.
PN_EXTERN pn_bytes_t pn_message_get_user_id(pn_message_t *msg)
Get the user id for a message.
PN_EXTERN int pn_message_set_inferred(pn_message_t *msg, bool inferred)
Set the inferred flag for a message.
PN_EXTERN int pn_message_set_correlation_id(pn_message_t *msg, pn_atom_t id)
Set the correlation id for a message.
PN_EXTERN int pn_message_set_expiry_time(pn_message_t *msg, pn_timestamp_t time)
Set the expiry time for a message.
PN_EXTERN uint32_t pn_message_get_delivery_count(pn_message_t *msg)
Get the delivery count for a message.
PN_EXTERN const char * pn_message_get_content_type(pn_message_t *msg)
Get the content_type for a message.
PN_EXTERN int pn_message_set_address(pn_message_t *msg, const char *address)
Set the address for a message.
PN_EXTERN pn_timestamp_t pn_message_get_creation_time(pn_message_t *msg)
Get the creation time for a message.
struct pn_message_t pn_message_t
An AMQP Message object.
Definition: message.h:49
PN_EXTERN uint8_t pn_message_get_priority(pn_message_t *msg)
Get the priority for a message.
PN_EXTERN int pn_message_set_first_acquirer(pn_message_t *msg, bool first)
Set the first acquirer flag for a message.
PN_EXTERN int pn_message_set_content_type(pn_message_t *msg, const char *type)
Set the content_type for a message.
PN_EXTERN bool pn_message_is_inferred(pn_message_t *msg)
Get the inferred flag for a message.
PN_EXTERN int pn_message_set_user_id(pn_message_t *msg, pn_bytes_t user_id)
Set the user id for a message.
PN_EXTERN int pn_message_set_group_id(pn_message_t *msg, const char *group_id)
Set the group_id for a message.
PN_EXTERN int pn_message_set_priority(pn_message_t *msg, uint8_t priority)
Set the priority for a message.
PN_EXTERN pn_data_t * pn_message_instructions(pn_message_t *msg)
Get/set the delivery instructions for a message.
PN_EXTERN pn_atom_t pn_message_get_correlation_id(pn_message_t *msg)
Get the correlation id for a message.
Data API for proton.
PN_EXTERN int pn_message_set_ttl(pn_message_t *msg, pn_millis_t ttl)
Set the ttl for a message.
#define PN_EXTERN
Definition: import_export.h:53
PN_EXTERN int pn_message_set_delivery_count(pn_message_t *msg, uint32_t count)
Set the delivery count for a message.
PN_EXTERN int pn_message_errno(pn_message_t *msg)
Access the error code of a message.
PN_EXTERN pn_millis_t pn_message_get_ttl(pn_message_t *msg)
Get the ttl for a message.
PN_EXTERN int pn_message_set_creation_time(pn_message_t *msg, pn_timestamp_t time)
Set the creation time for a message.
PN_EXTERN bool pn_message_is_durable(pn_message_t *msg)
Get the durable flag for a message.
PN_EXTERN bool pn_message_is_first_acquirer(pn_message_t *msg)
Get the first acquirer flag for a message.
PN_EXTERN pn_data_t * pn_message_correlation_id(pn_message_t *msg)
Get/set the correlation id for a message.
PN_EXTERN const char * pn_message_get_content_encoding(pn_message_t *msg)
Get the content_encoding for a message.
PN_EXTERN 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:352
PN_EXTERN int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size)
Decode/load message content from AMQP formatted binary data.
PN_EXTERN pn_atom_t pn_message_get_id(pn_message_t *msg)
Get the id for a message.
uint32_t pn_millis_t
Definition: types.h:46
PN_EXTERN const char * pn_message_get_group_id(pn_message_t *msg)
Get the group_id for a message.
PN_EXTERN int pn_message_set_durable(pn_message_t *msg, bool durable)
Set the durable flag for a message.
PN_EXTERN void pn_message_free(pn_message_t *msg)
Free a previously constructed pn_message_t.
PN_EXTERN pn_data_t * pn_message_annotations(pn_message_t *msg)
Get/set the annotations for a message.
PN_EXTERN int pn_message_set_group_sequence(pn_message_t *msg, pn_sequence_t n)
Set the group sequence for a message.
PN_EXTERN const char * pn_message_get_reply_to_group_id(pn_message_t *msg)
Get the reply_to_group_id for a message.
PN_EXTERN pn_data_t * pn_message_properties(pn_message_t *msg)
Get/set the properties for a message.
PN_EXTERN int pn_message_set_id(pn_message_t *msg, pn_atom_t id)
Set the id for a message.
PN_EXTERN int pn_message_set_reply_to(pn_message_t *msg, const char *reply_to)
Set the reply_to for a message.
PN_EXTERN pn_data_t * pn_message_body(pn_message_t *msg)
Get/set the body of a message.
int64_t pn_timestamp_t
Definition: types.h:49
PN_EXTERN pn_timestamp_t pn_message_get_expiry_time(pn_message_t *msg)
Get the expiry time for a message.
PN_EXTERN void pn_message_clear(pn_message_t *msg)
Clears the content of a pn_message_t.
Definition: types.h:60
PN_EXTERN int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size)
Encode/save message content as AMQP formatted binary data.
PN_EXTERN pn_sequence_t pn_message_get_group_sequence(pn_message_t *msg)
Get the group sequence for a message.
PN_EXTERN const char * pn_message_get_reply_to(pn_message_t *msg)
Get the reply_to for a message.
PN_EXTERN 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_EXTERN int pn_message_set_subject(pn_message_t *msg, const char *subject)
Set the subject for a message.
PN_EXTERN const char * pn_message_get_address(pn_message_t *msg)
Get the address for a message.