2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef MESSAGE_COMMAND_H
18 #define MESSAGE_COMMAND_H
21 #include "messages/message.h"
24 * @brief Command message data
26 typedef struct message_command {
27 message_t base; /** Base class */
28 command_s command; /** Command carried by message */
32 * @brief Initializes message_command_t object.
34 * @param[in] message ack message.
36 void message_command_init(message_command_t *message);
39 * @brief Get command for mesage.
41 * @param[in] message ack message.
43 * @return command const pointer.
45 const command_s *message_command_get_command(message_command_t *message);
48 * @brief Set command for mesage.
50 * @param[in] message ack message.
51 * @param[in] command command to be set.
53 void message_command_set_command(message_command_t *message, const command_s *cmd);
56 * @brief Destroys message_command_t object.
58 * @param[in] message ack message.
60 void message_command_destroy(message_command_t *message);
63 * @brief Deserializes message_command_t from reader's buffer.
65 * @param[in] message ack message.
66 * @param[in] reader reader object.
68 * @return 0 on success, other value on failure.
70 int message_command_deserialize(message_command_t *message, reader_t *reader);
73 * @brief Serializes message_command_t into writer's buffer.
75 * @param[in] message message object.
76 * @param[in] writer writer object.
78 * @return 0 on success, other value on failure.
80 int message_command_serialize(message_command_t *message, writer_t *writer);
82 #endif /* end of include guard: MESSAGE_COMMAND_H */