forked from zeromq/rfc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxrap_msg.h
226 lines (182 loc) · 7.04 KB
/
xrap_msg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/* =========================================================================
xrap_msg - XRAP serialization over ZMTP
Codec header for xrap_msg.
** WARNING *************************************************************
THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose
your changes at the next build cycle. This is great for temporary printf
statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places
for commits are:
* The XML model used for this code generation: spec_40.xml, or
* The code generation script that built this file: zproto_codec_c
************************************************************************
=========================================================================
*/
#ifndef XRAP_MSG_H_INCLUDED
#define XRAP_MSG_H_INCLUDED
/* These are the xrap_msg messages:
POST - Create a new, dynamically named resource in some parent.
parent string Schema/type/name
content_type string Content type
content_body longstr New resource specification
POST_OK - Success response for POST.
status_code number 2 Response status code 2xx
location string Schema/type/name
etag string Opaque hash tag
date_modified number 8 Date and time modified
content_type string Content type
content_body longstr Resource contents
GET - Retrieve a known resource.
resource string Schema/type/name
if_modified_since number 8 GET if more recent
if_none_match string GET if changed
content_type string Desired content type
GET_OK - Success response for GET.
status_code number 2 Response status code 2xx
content_type string Actual content type
content_body longstr Resource specification
GET_EMPTY - Conditional GET returned 304 Not Modified.
status_code number 2 Response status code 3xx
PUT - Update a known resource.
resource string Schema/type/name
if_unmodified_since number 8 Update if same date
if_match string Update if same ETag
content_type string Content type
content_body longstr New resource specification
PUT_OK - Success response for PUT.
status_code number 2 Response status code 2xx
location string Schema/type/name
etag string Opaque hash tag
date_modified number 8 Date and time modified
DELETE - Remove a known resource.
resource string schema/type/name
if_unmodified_since number 8 DELETE if same date
if_match string DELETE if same ETag
DELETE_OK - Success response for DELETE.
status_code number 2 Response status code 2xx
ERROR - Error response for any request.
status_code number 2 Response status code, 4xx or 5xx
status_text string Response status text
*/
#define XRAP_MSG_POST 1
#define XRAP_MSG_POST_OK 2
#define XRAP_MSG_GET 3
#define XRAP_MSG_GET_OK 4
#define XRAP_MSG_GET_EMPTY 5
#define XRAP_MSG_PUT 6
#define XRAP_MSG_PUT_OK 7
#define XRAP_MSG_DELETE 8
#define XRAP_MSG_DELETE_OK 9
#define XRAP_MSG_ERROR 10
#include <czmq.h>
#ifdef __cplusplus
extern "C" {
#endif
// Opaque class structure
#ifndef XRAP_MSG_T_DEFINED
typedef struct _xrap_msg_t xrap_msg_t;
#define XRAP_MSG_T_DEFINED
#endif
// @interface
// Create a new empty xrap_msg
xrap_msg_t *
xrap_msg_new (void);
// Destroy a xrap_msg instance
void
xrap_msg_destroy (xrap_msg_t **self_p);
// Receive a xrap_msg from the socket. Returns 0 if OK, -1 if
// there was an error. Blocks if there is no message waiting.
int
xrap_msg_recv (xrap_msg_t *self, zsock_t *input);
// Send the xrap_msg to the output socket, does not destroy it
int
xrap_msg_send (xrap_msg_t *self, zsock_t *output);
// Print contents of message to stdout
void
xrap_msg_print (xrap_msg_t *self);
// Get/set the message routing id
zframe_t *
xrap_msg_routing_id (xrap_msg_t *self);
void
xrap_msg_set_routing_id (xrap_msg_t *self, zframe_t *routing_id);
// Get the xrap_msg id and printable command
int
xrap_msg_id (xrap_msg_t *self);
void
xrap_msg_set_id (xrap_msg_t *self, int id);
const char *
xrap_msg_command (xrap_msg_t *self);
// Get/set the parent field
const char *
xrap_msg_parent (xrap_msg_t *self);
void
xrap_msg_set_parent (xrap_msg_t *self, const char *value);
// Get/set the content_type field
const char *
xrap_msg_content_type (xrap_msg_t *self);
void
xrap_msg_set_content_type (xrap_msg_t *self, const char *value);
// Get/set the content_body field
const char *
xrap_msg_content_body (xrap_msg_t *self);
void
xrap_msg_set_content_body (xrap_msg_t *self, const char *value);
// Get/set the status_code field
uint16_t
xrap_msg_status_code (xrap_msg_t *self);
void
xrap_msg_set_status_code (xrap_msg_t *self, uint16_t status_code);
// Get/set the location field
const char *
xrap_msg_location (xrap_msg_t *self);
void
xrap_msg_set_location (xrap_msg_t *self, const char *value);
// Get/set the etag field
const char *
xrap_msg_etag (xrap_msg_t *self);
void
xrap_msg_set_etag (xrap_msg_t *self, const char *value);
// Get/set the date_modified field
uint64_t
xrap_msg_date_modified (xrap_msg_t *self);
void
xrap_msg_set_date_modified (xrap_msg_t *self, uint64_t date_modified);
// Get/set the resource field
const char *
xrap_msg_resource (xrap_msg_t *self);
void
xrap_msg_set_resource (xrap_msg_t *self, const char *value);
// Get/set the if_modified_since field
uint64_t
xrap_msg_if_modified_since (xrap_msg_t *self);
void
xrap_msg_set_if_modified_since (xrap_msg_t *self, uint64_t if_modified_since);
// Get/set the if_none_match field
const char *
xrap_msg_if_none_match (xrap_msg_t *self);
void
xrap_msg_set_if_none_match (xrap_msg_t *self, const char *value);
// Get/set the if_unmodified_since field
uint64_t
xrap_msg_if_unmodified_since (xrap_msg_t *self);
void
xrap_msg_set_if_unmodified_since (xrap_msg_t *self, uint64_t if_unmodified_since);
// Get/set the if_match field
const char *
xrap_msg_if_match (xrap_msg_t *self);
void
xrap_msg_set_if_match (xrap_msg_t *self, const char *value);
// Get/set the status_text field
const char *
xrap_msg_status_text (xrap_msg_t *self);
void
xrap_msg_set_status_text (xrap_msg_t *self, const char *value);
// Self test of this class
int
xrap_msg_test (bool verbose);
// @end
// For backwards compatibility with old codecs
#define xrap_msg_dump xrap_msg_print
#ifdef __cplusplus
}
#endif
#endif