C AMQP Protocol Engine API  0.6
 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 <proton/error.h>
29 #include <sys/types.h>
30 #ifndef __cplusplus
31 #include <stdbool.h>
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 typedef struct pn_message_t pn_message_t;
39 
40 typedef enum {
45 } pn_format_t;
46 
47 #define PN_DEFAULT_PRIORITY (4)
48 
51 
55 
57 PN_EXTERN int pn_message_set_inferred(pn_message_t *msg, bool inferred);
58 
59 // standard message headers and properties
61 PN_EXTERN int pn_message_set_durable (pn_message_t *msg, bool durable);
62 
64 PN_EXTERN int pn_message_set_priority (pn_message_t *msg, uint8_t priority);
65 
68 
71 
73 PN_EXTERN int pn_message_set_delivery_count (pn_message_t *msg, uint32_t count);
74 
78 
81 
83 PN_EXTERN int pn_message_set_address (pn_message_t *msg, const char *address);
84 
86 PN_EXTERN int pn_message_set_subject (pn_message_t *msg, const char *subject);
87 
89 PN_EXTERN int pn_message_set_reply_to (pn_message_t *msg, const char *reply_to);
90 
94 
96 PN_EXTERN int pn_message_set_content_type (pn_message_t *msg, const char *type);
97 
99 PN_EXTERN int pn_message_set_content_encoding (pn_message_t *msg, const char *encoding);
100 
103 
106 
108 PN_EXTERN int pn_message_set_group_id (pn_message_t *msg, const char *group_id);
109 
112 
114 PN_EXTERN int pn_message_set_reply_to_group_id (pn_message_t *msg, const char *reply_to_group_id);
115 
118 
119 PN_EXTERN int pn_message_load(pn_message_t *message, const char *data, size_t size);
120 PN_EXTERN int pn_message_load_data(pn_message_t *message, const char *data, size_t size);
121 PN_EXTERN int pn_message_load_text(pn_message_t *message, const char *data, size_t size);
122 PN_EXTERN int pn_message_load_amqp(pn_message_t *message, const char *data, size_t size);
123 PN_EXTERN int pn_message_load_json(pn_message_t *message, const char *data, size_t size);
124 
125 PN_EXTERN int pn_message_save(pn_message_t *message, char *data, size_t *size);
126 PN_EXTERN int pn_message_save_data(pn_message_t *message, char *data, size_t *size);
127 PN_EXTERN int pn_message_save_text(pn_message_t *message, char *data, size_t *size);
128 PN_EXTERN int pn_message_save_amqp(pn_message_t *message, char *data, size_t *size);
129 PN_EXTERN int pn_message_save_json(pn_message_t *message, char *data, size_t *size);
130 
135 
136 PN_EXTERN int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size);
137 PN_EXTERN int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size);
138 
139 PN_EXTERN ssize_t pn_message_data(char *dst, size_t available, const char *src, size_t size);
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif /* message.h */