4 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: YoungHun Kim <yh8004.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __MUSE_CORE_INTERNAL_H__
23 #define __MUSE_CORE_INTERNAL_H__
37 #include "muse_core.h"
45 #include <sys/socket.h>
49 #include <iniparser.h>
52 #define CONFFILE SYSCONFDIR"/multimedia/mused.conf"
53 #define MUSE_HOST "muse:hosts"
54 #define INI_PARSER_COMMA ","
55 #define MUSE_DATA_ROOT_PATH TZ_SYS_DATA_PATH"/mused/"
56 #define MUSE_DEFAULT_PIDFILE "/tmp/.muse-server.pid"
57 #define MUSE_SOCK_FILE0 "/tmp/.muse_server_socket"
58 #define MUSE_SOCK_FILE1 "/tmp/.muse_server_data_socket"
59 #define MUSE_LOG_PATH "/var/log/mused"
60 #define MUSE_LOG_FILE MUSE_LOG_PATH"/muselog"
61 #define MUSE_USE_LOG "yes"
69 #define MUSE_PARAM_MAX 10
70 #define MUSE_LOG_MSG_NUM 10
72 #define PARSE_ERROR -1
75 #define MUSE_MSG_LEN 32
76 #define MUSE_MSG_TIME_LEN 64
77 #define MUSE_MSG_LEN_MAX 128
80 #define MUSE_DISPATCHER_MAX 512
82 #define MSG_KEY_API "api"
83 #define MSG_KEY_MODULE_INDEX "module"
84 #define MSG_KEY_MODULE_ADDR "module_addr"
86 #define DISPATCHER "dispatcher"
87 #define DISPATCHER_PTR "dispatcher_pointer"
88 #define CMD_DISPATCHER "cmd_dispatcher"
90 #define END_DELIM_STR " }"
92 #define muse_return_if_fail(expr) \
95 LOGE("failed [%s]", #expr); \
100 #define muse_return_val_if_fail(expr, val) \
103 LOGE("failed [%s]", #expr); \
108 #define MUSE_FREE(src) \
116 #define MUSE_G_FREE(src) \
131 } muse_core_module_e;
136 API_MAX = MUSE_DISPATCHER_MAX
139 typedef struct muse_channel_info {
142 int tbm_fd[MUSE_NUM_FD];
151 } muse_channel_info_t;
153 typedef struct muse_module {
154 muse_channel_info_t ch[MUSE_CHANNEL_MAX];
155 char recv_msg[MUSE_MSG_MAX_LENGTH + 1];
163 GMutex dispatch_lock;
166 typedef struct muse_recv_data_head {
170 } muse_recv_data_head_t;
172 typedef struct muse_recv_data {
173 muse_recv_data_head_t header;
174 /* Dynamic allocated data area */
178 MUSE_MSG_TYPE_NORMAL,
182 typedef struct muse_msg_info {
184 muse_msg_type_e type;
189 #ifdef MUSE_GCOV_TEST
190 void muse_core_gcov_flush(void);
191 void muse_core_setenv(const char *name, const char *value, int replace);
194 bool muse_core_msg_recv_len(int fd, char *buf, int msg_len);
195 void muse_core_update_fd_state(int fd);
196 void muse_core_get_cur_time(struct timespec *time, char *time_buf);
201 #endif /*__MUSE_CORE_INTERNAL_H__*/