1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
3 |
|
---|
4 | #ifndef UWS_FRAME_ENCODER_H
|
---|
5 | #define UWS_FRAME_ENCODER_H
|
---|
6 |
|
---|
7 | #ifdef __cplusplus
|
---|
8 | #include <cstddef>
|
---|
9 | #else
|
---|
10 | #include <stdbool.h>
|
---|
11 | #include <stddef.h>
|
---|
12 | #endif
|
---|
13 |
|
---|
14 | #include "azure_c_shared_utility/buffer_.h"
|
---|
15 | #include "umock_c/umock_c_prod.h"
|
---|
16 | #include "azure_macro_utils/macro_utils.h"
|
---|
17 |
|
---|
18 | #ifdef __cplusplus
|
---|
19 | extern "C" {
|
---|
20 | #endif
|
---|
21 |
|
---|
22 | #define RESERVED_1 0x04
|
---|
23 | #define RESERVED_2 0x02
|
---|
24 | #define RESERVED_3 0x01
|
---|
25 |
|
---|
26 | #define WS_FRAME_TYPE_VALUES \
|
---|
27 | WS_CONTINUATION_FRAME, \
|
---|
28 | WS_TEXT_FRAME, \
|
---|
29 | WS_BINARY_FRAME, \
|
---|
30 | WS_RESERVED_NON_CONTROL_FRAME_3, \
|
---|
31 | WS_RESERVED_NON_CONTROL_FRAME_4, \
|
---|
32 | WS_RESERVED_NON_CONTROL_FRAME_5, \
|
---|
33 | WS_RESERVED_NON_CONTROL_FRAME_6, \
|
---|
34 | WS_RESERVED_NON_CONTROL_FRAME_7, \
|
---|
35 | WS_CLOSE_FRAME, \
|
---|
36 | WS_PING_FRAME, \
|
---|
37 | WS_PONG_FRAME, \
|
---|
38 | WS_RESERVED_CONTROL_FRAME_B, \
|
---|
39 | WS_RESERVED_CONTROL_FRAME_C, \
|
---|
40 | WS_RESERVED_CONTROL_FRAME_D, \
|
---|
41 | WS_RESERVED_CONTROL_FRAME_E, \
|
---|
42 | WS_RESERVED_CONTROL_FRAME_F
|
---|
43 |
|
---|
44 | MU_DEFINE_ENUM_WITHOUT_INVALID(WS_FRAME_TYPE, WS_FRAME_TYPE_VALUES);
|
---|
45 |
|
---|
46 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, uws_frame_encoder_encode, WS_FRAME_TYPE, opcode, const unsigned char*, payload, size_t, length, bool, is_masked, bool, is_final, unsigned char, reserved);
|
---|
47 |
|
---|
48 | #ifdef __cplusplus
|
---|
49 | }
|
---|
50 | #endif /* __cplusplus */
|
---|
51 |
|
---|
52 | #endif /* UWS_FRAME_ENCODER_H */
|
---|