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