4 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
23 #include <stdlib.h> /* size_t */
26 #define MAX_MSG_CAPACITY 4096
27 #define MAX_HEADER_RESERVED 3
31 typedef struct message_header {
36 void *ancillary[MAX_HEADER_RESERVED];
41 message(size_t capacity = MAX_MSG_CAPACITY);
42 message(const void *msg, size_t size);
43 message(const message &msg);
47 void enclose(const void *msg, const size_t size);
48 void enclose(int error);
49 void disclose(void *msg);
52 void set_type(uint32_t type);
60 message_header *header(void);
64 message_header m_header;
69 std::atomic<int> ref_cnt;
74 #endif /* __MESSAGE_H__ */