1ZHTTP_RESPONSE(3) CZMQ Manual ZHTTP_RESPONSE(3)
2
3
4
6 zhttp_response - Class for zhttp server request.
7
9 // This is a draft class, and may change without notice. It is disabled in
10 // stable builds by default. If you use this in applications, please ask
11 // for it to be pushed to stable state. Use --enable-drafts to enable.
12 #ifdef CZMQ_BUILD_DRAFT_API
13 // *** Draft method, for development use, may change without warning ***
14 // Create a new zhttp_response.
15 CZMQ_EXPORT zhttp_response_t *
16 zhttp_response_new (void);
17
18 // *** Draft method, for development use, may change without warning ***
19 // Destroy the zhttp_response.
20 CZMQ_EXPORT void
21 zhttp_response_destroy (zhttp_response_t **self_p);
22
23 // *** Draft method, for development use, may change without warning ***
24 // Send a response to a request.
25 // Returns 0 if successful and -1 otherwise.
26 CZMQ_EXPORT int
27 zhttp_response_send (zhttp_response_t *self, zsock_t *sock, void **connection);
28
29 // *** Draft method, for development use, may change without warning ***
30 // Receive a response from zhttp_client.
31 // On success return 0, -1 otherwise.
32 //
33 // Recv returns the two user arguments which was provided with the request.
34 // The reason for two, is to be able to pass around the server connection when forwarding requests or both a callback function and an argument.
35 CZMQ_EXPORT int
36 zhttp_response_recv (zhttp_response_t *self, zhttp_client_t *client, void **arg, void **arg2);
37
38 // *** Draft method, for development use, may change without warning ***
39 // Get the response content type
40 CZMQ_EXPORT const char *
41 zhttp_response_content_type (zhttp_response_t *self);
42
43 // *** Draft method, for development use, may change without warning ***
44 // Set the content type of the response.
45 CZMQ_EXPORT void
46 zhttp_response_set_content_type (zhttp_response_t *self, const char *value);
47
48 // *** Draft method, for development use, may change without warning ***
49 // Get the status code of the response.
50 CZMQ_EXPORT uint32_t
51 zhttp_response_status_code (zhttp_response_t *self);
52
53 // *** Draft method, for development use, may change without warning ***
54 // Set the status code of the response.
55 CZMQ_EXPORT void
56 zhttp_response_set_status_code (zhttp_response_t *self, uint32_t status_code);
57
58 // *** Draft method, for development use, may change without warning ***
59 // Get the headers of the response.
60 CZMQ_EXPORT zhash_t *
61 zhttp_response_headers (zhttp_response_t *self);
62
63 // *** Draft method, for development use, may change without warning ***
64 // Get the content length of the response
65 CZMQ_EXPORT size_t
66 zhttp_response_content_length (zhttp_response_t *self);
67
68 // *** Draft method, for development use, may change without warning ***
69 // Get the content of the response.
70 CZMQ_EXPORT const char *
71 zhttp_response_content (zhttp_response_t *self);
72
73 // *** Draft method, for development use, may change without warning ***
74 // Get the content of the response.
75 // Caller owns return value and must destroy it when done.
76 CZMQ_EXPORT char *
77 zhttp_response_get_content (zhttp_response_t *self);
78
79 // *** Draft method, for development use, may change without warning ***
80 // Set the content of the response.
81 // Content must by dynamically allocated string.
82 // Takes ownership of the content.
83 CZMQ_EXPORT void
84 zhttp_response_set_content (zhttp_response_t *self, char **content);
85
86 // *** Draft method, for development use, may change without warning ***
87 // Set the content of the response.
88 // The content is assumed to be constant-memory and will therefore not be copied or deallocated in any way.
89 CZMQ_EXPORT void
90 zhttp_response_set_content_const (zhttp_response_t *self, const char *content);
91
92 // *** Draft method, for development use, may change without warning ***
93 // Set the content to NULL
94 CZMQ_EXPORT void
95 zhttp_response_reset_content (zhttp_response_t *self);
96
97 // *** Draft method, for development use, may change without warning ***
98 // Self test of this class.
99 CZMQ_EXPORT void
100 zhttp_response_test (bool verbose);
101
102 #endif // CZMQ_BUILD_DRAFT_API
103 Please add '@interface' section in './../src/zhttp_response.c'.
104
106 zhttp_response - zhttp server request. Class can be reused.
107
108 Please add @discuss section in ./../src/zhttp_response.c.
109
111 From zhttp_response_test method.
112
113 Please add '@selftest' section in './../src/zhttp_response.c'.
114
115
117 The czmq manual was written by the authors in the AUTHORS file.
118
120 Main web site:
121
122 Report bugs to the email <zeromq-dev@lists.zeromq.org[1]>
123
125 Copyright (c) the Contributors as noted in the AUTHORS file. This file
126 is part of CZMQ, the high-level C binding for 0MQ:
127 http://czmq.zeromq.org. This Source Code Form is subject to the terms
128 of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
129 distributed with this file, You can obtain one at
130 http://mozilla.org/MPL/2.0/. LICENSE included with the czmq
131 distribution.
132
134 1. zeromq-dev@lists.zeromq.org
135 mailto:zeromq-dev@lists.zeromq.org
136
137
138
139CZMQ 4.2.0 01/28/2020 ZHTTP_RESPONSE(3)