proton  0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros 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/types.h>
26 #include <proton/codec.h>
27 #include <sys/types.h>
28 #include <stdbool.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 typedef struct pn_message_t pn_message_t;
35 
36 typedef enum {
41 } pn_format_t;
42 
43 #define PN_DEFAULT_PRIORITY (4)
44 
46 void pn_message_free(pn_message_t *msg);
47 
50 const char * pn_message_error(pn_message_t *msg);
51 
53 int pn_message_set_inferred(pn_message_t *msg, bool inferred);
54 
55 // standard message headers and properties
57 int pn_message_set_durable (pn_message_t *msg, bool durable);
58 
60 int pn_message_set_priority (pn_message_t *msg, uint8_t priority);
61 
64 
66 int pn_message_set_first_acquirer (pn_message_t *msg, bool first);
67 
69 int pn_message_set_delivery_count (pn_message_t *msg, uint32_t count);
70 
74 
77 
78 const char * pn_message_get_address (pn_message_t *msg);
79 int pn_message_set_address (pn_message_t *msg, const char *address);
80 
81 const char * pn_message_get_subject (pn_message_t *msg);
82 int pn_message_set_subject (pn_message_t *msg, const char *subject);
83 
84 const char * pn_message_get_reply_to (pn_message_t *msg);
85 int pn_message_set_reply_to (pn_message_t *msg, const char *reply_to);
86 
90 
91 const char * pn_message_get_content_type (pn_message_t *msg);
92 int pn_message_set_content_type (pn_message_t *msg, const char *type);
93 
95 int pn_message_set_content_encoding (pn_message_t *msg, const char *encoding);
96 
99 
102 
103 const char * pn_message_get_group_id (pn_message_t *msg);
104 int pn_message_set_group_id (pn_message_t *msg, const char *group_id);
105 
108 
110 int pn_message_set_reply_to_group_id (pn_message_t *msg, const char *reply_to_group_id);
111 
113 int pn_message_set_format(pn_message_t *message, pn_format_t format);
114 
115 int pn_message_load(pn_message_t *message, const char *data, size_t size);
116 int pn_message_load_data(pn_message_t *message, const char *data, size_t size);
117 int pn_message_load_text(pn_message_t *message, const char *data, size_t size);
118 int pn_message_load_amqp(pn_message_t *message, const char *data, size_t size);
119 int pn_message_load_json(pn_message_t *message, const char *data, size_t size);
120 
121 int pn_message_save(pn_message_t *message, char *data, size_t *size);
122 int pn_message_save_data(pn_message_t *message, char *data, size_t *size);
123 int pn_message_save_text(pn_message_t *message, char *data, size_t *size);
124 int pn_message_save_amqp(pn_message_t *message, char *data, size_t *size);
125 int pn_message_save_json(pn_message_t *message, char *data, size_t *size);
126 
131 
132 int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size);
133 int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size);
134 
135 ssize_t pn_message_data(char *dst, size_t available, const char *src, size_t size);
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /* message.h */