Debian Codegraph @

crt/aws-c-event-stream/include/aws/event-stream/private/event_stream_rpc_priv.h

raw symbols SCIP
1 #ifndef AWS_EVENT_STREAM_RPC_PRIV_H
2 #define AWS_EVENT_STREAM_RPC_PRIV_H
3 /**
4 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: Apache-2.0.
6 */
7
8 #include <aws/event-stream/event_stream_rpc.h>
9
10 enum aws_event_stream_connection_handshake_state {
11 CONNECTION_HANDSHAKE_STATE_INITIALIZED = 0u,
12 CONNECTION_HANDSHAKE_STATE_CONNECT_PROCESSED = 1u,
13 CONNECTION_HANDSHAKE_STATE_CONNECT_ACK_PROCESSED = 2u,
14 };
15
16 int aws_event_stream_rpc_extract_message_metadata(
17 const struct aws_array_list *message_headers,
18 int32_t *stream_id,
19 int32_t *message_type,
20 int32_t *message_flags,
21 struct aws_byte_buf *operation_name);
22
23 uint64_t aws_event_stream_rpc_hash_streamid(const void *to_hash);
24 bool aws_event_stream_rpc_streamid_eq(const void *a, const void *b);
25
26 static const struct aws_byte_cursor s_json_content_type_name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL(":content-type");
27 static const struct aws_byte_cursor s_json_content_type_value =
28 AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("application/json");
29
30 static const struct aws_byte_cursor s_invalid_stream_id_error =
31 AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("{ \"message\": \"non-zero stream-id field is only allowed for messages of "
32 "type APPLICATION_MESSAGE. The stream id max value is INT32_MAX.\" }");
33
34 static const struct aws_byte_cursor s_invalid_client_stream_id_error =
35 AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("{ \"message\": \"stream-id values must be monotonically incrementing. A "
36 "stream-id arrived that was lower than the last seen stream-id.\" }");
37
38 static const struct aws_byte_cursor s_invalid_new_client_stream_id_error =
39 AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("{ \"message\": \"stream-id values must be monotonically incrementing. A new "
40 "stream-id arrived that was incremented by more than 1.\" }");
41
42 static const struct aws_byte_cursor s_invalid_message_type_error =
43 AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("{ \"message\": \"an invalid value for message-type field was received.\" }");
44
45 static const struct aws_byte_cursor s_invalid_message_error = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL(
46 "{ \"message\": \"A message was received with missing required fields. Check that your client is sending at least, "
47 ":message-type, :message-flags, and :stream-id\" }");
48
49 static const struct aws_byte_cursor s_internal_error = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL(
50 "{ \"message\": \"An error occurred on the peer endpoint. This is not likely caused by your endpoint.\" }");
51
52 static const struct aws_byte_cursor s_connect_not_completed_error = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL(
53 "{ \"message\": \"A CONNECT message must be received, and the CONNECT_ACK must be sent in response, before any "
54 "other message-types can be sent on this connection. In addition, only one CONNECT message is allowed on a "
55 "connection.\" }");
56
57 #endif /* #define AWS_EVENT_STREAM_RPC_PRIV_H */