C AMQP Protocol Engine API  0.4
 All Classes 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/import_export.h>
26 #include <proton/types.h>
27 #include <proton/codec.h>
28 #include <sys/types.h>
29 #ifndef __cplusplus
30 #include <stdbool.h>
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 typedef struct pn_message_t pn_message_t;
38 
39 typedef enum {
44 } pn_format_t;
45 
46 #define PN_DEFAULT_PRIORITY (4)
47 
50 
53 PN_EXTERN const char * pn_message_error(pn_message_t *msg);
54 
56 PN_EXTERN int pn_message_set_inferred(pn_message_t *msg, bool inferred);
57 
58 // standard message headers and properties
60 PN_EXTERN int pn_message_set_durable (pn_message_t *msg, bool durable);
61 
63 PN_EXTERN int pn_message_set_priority (pn_message_t *msg, uint8_t priority);
64 
67 
70 
72 PN_EXTERN int pn_message_set_delivery_count (pn_message_t *msg, uint32_t count);
73 
77 
80 
82 PN_EXTERN int pn_message_set_address (pn_message_t *msg, const char *address);
83 
85 PN_EXTERN int pn_message_set_subject (pn_message_t *msg, const char *subject);
86 
88 PN_EXTERN int pn_message_set_reply_to (pn_message_t *msg, const char *reply_to);
89 
93 
95 PN_EXTERN int pn_message_set_content_type (pn_message_t *msg, const char *type);
96 
98 PN_EXTERN int pn_message_set_content_encoding (pn_message_t *msg, const char *encoding);
99 
102 
105 
107 PN_EXTERN int pn_message_set_group_id (pn_message_t *msg, const char *group_id);
108 
111 
113 PN_EXTERN int pn_message_set_reply_to_group_id (pn_message_t *msg, const char *reply_to_group_id);
114 
117 
118 PN_EXTERN int pn_message_load(pn_message_t *message, const char *data, size_t size);
119 PN_EXTERN int pn_message_load_data(pn_message_t *message, const char *data, size_t size);
120 PN_EXTERN int pn_message_load_text(pn_message_t *message, const char *data, size_t size);
121 PN_EXTERN int pn_message_load_amqp(pn_message_t *message, const char *data, size_t size);
122 PN_EXTERN int pn_message_load_json(pn_message_t *message, const char *data, size_t size);
123 
124 PN_EXTERN int pn_message_save(pn_message_t *message, char *data, size_t *size);
125 PN_EXTERN int pn_message_save_data(pn_message_t *message, char *data, size_t *size);
126 PN_EXTERN int pn_message_save_text(pn_message_t *message, char *data, size_t *size);
127 PN_EXTERN int pn_message_save_amqp(pn_message_t *message, char *data, size_t *size);
128 PN_EXTERN int pn_message_save_json(pn_message_t *message, char *data, size_t *size);
129 
134 
135 PN_EXTERN int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size);
136 PN_EXTERN int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size);
137 
138 PN_EXTERN ssize_t pn_message_data(char *dst, size_t available, const char *src, size_t size);
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif /* message.h */