Debian Codegraph @

crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc.h

raw symbols SCIP
1 #ifndef AWS_EVENT_STREAM_RPC_H
2 #define AWS_EVENT_STREAM_RPC_H
3 /**
4 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: Apache-2.0.
6 */
7 #include <aws/event-stream/event_stream.h>
8
9 AWS_PUSH_SANE_WARNING_LEVEL
10
11 /**
12 * :message-type header name
13 */
14 extern AWS_EVENT_STREAM_API const struct aws_byte_cursor aws_event_stream_rpc_message_type_name;
15 /**
16 * :message-flags header name
17 */
18 extern AWS_EVENT_STREAM_API const struct aws_byte_cursor aws_event_stream_rpc_message_flags_name;
19 /**
20 * :stream-id header name
21 */
22 extern AWS_EVENT_STREAM_API const struct aws_byte_cursor aws_event_stream_rpc_stream_id_name;
23 /**
24 * operation header name.
25 */
26 extern AWS_EVENT_STREAM_API const struct aws_byte_cursor aws_event_stream_rpc_operation_name;
27
28 enum aws_event_stream_rpc_message_type {
29 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_APPLICATION_MESSAGE,
30 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_APPLICATION_ERROR,
31 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PING,
32 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PING_RESPONSE,
33 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_CONNECT,
34 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_CONNECT_ACK,
35 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PROTOCOL_ERROR,
36 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_INTERNAL_ERROR,
37
38 AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_COUNT,
39 };
40
41 enum aws_event_stream_rpc_message_flag {
42 AWS_EVENT_STREAM_RPC_MESSAGE_FLAG_CONNECTION_ACCEPTED = 1,
43 AWS_EVENT_STREAM_RPC_MESSAGE_FLAG_TERMINATE_STREAM = 2,
44 };
45
46 struct aws_event_stream_rpc_message_args {
47 /** array of headers for an event-stream message. */
48 struct aws_event_stream_header_value_pair *headers;
49 /** number of headers in the headers array.
50 * headers are copied in aws_event_stream_rpc_*_send_message()
51 * so you can free the memory immediately after calling it if you need to.*/
52 size_t headers_count;
53 /** payload buffer for the message, payload is copied in aws_event_stream_rpc_*_send_message()
54 * so you can free the memory immediately after calling it if you need to. */
55 struct aws_byte_buf *payload;
56 /** message type for the message. This will be added to the headers array
57 * and the ":message-type" header should not be included in headers */
58 enum aws_event_stream_rpc_message_type message_type;
59 /** message flags for the message. This will be added to the headers array
60 * and the ":message-flags" header should not be included in headers */
61 uint32_t message_flags;
62 };
63 AWS_POP_SANE_WARNING_LEVEL
64
65 #endif /* AWS_EVENT_STREAM_RPC_SERVER_H */