Change from INET tcp to Unix domain socket
[framework/multimedia/media-server.git] / lib / include / media-server-ipc.h
1 /*
2  *  Media Utility
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Yong Yeon Kim <yy9875.kim@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21
22 /**
23  * This file defines IPC protocol
24  *
25  * @file                media-server-ipc.h
26  * @author      Haejeong Kim(backto.kim@samsung.com)
27  * @version     1.0
28  * @brief
29  */
30 #ifndef _MEDIA_SERVER_IPC_H_
31 #define _MEDIA_SERVER_IPC_H_
32
33 #define MS_TIMEOUT_SEC_3                                        3               /**< Response from Server time out */
34 #define MS_TIMEOUT_SEC_10                                       10              /**< Response from Server time out */
35 #define MS_TIMEOUT_SEC_20                       20              /**< Response from Media server time out */
36
37 #ifdef _USE_UDS_SOCKET_
38 typedef enum{
39         MS_DB_BATCH_UPDATE_PORT = 0,    /**< Media DB batch update */
40         MS_SCAN_DAEMON_PORT,            /**< Port of communication between scanner and server */
41         MS_SCAN_COMM_PORT,              /**< Port of communication between scanner and server */
42         MS_SCANNER_PORT,                /**< Directory Scanner */
43         MS_DB_UPDATE_PORT,              /**< Media DB Update */
44         MS_THUMB_CREATOR_PORT,  /**< Create thumbnail */
45         MS_THUMB_COMM_PORT,             /**< Port of communication between creator and server */
46         MS_THUMB_DAEMON_PORT,   /**< Port of Thumbnail server */
47         MS_PORT_MAX,
48 }ms_msg_port_type_e;
49 #else
50 #define MS_SCANNER_PORT                 1001            /**< Directory Scanner */
51 #define MS_DB_UPDATE_PORT                       1002            /**< Media DB Update */
52 #define MS_THUMB_CREATOR_PORT   1003            /**< Create thumbnail */
53 #define MS_THUMB_DAEMON_PORT    1004            /**< Port of Thumbnail server */
54 #define MS_THUMB_COMM_PORT              1005            /**< Port of communication between creator and server */
55 #define MS_DB_BATCH_UPDATE_PORT         1006    /**< Media DB batch update */
56 #define MS_SCAN_DAEMON_PORT            1007             /**< Port of communication between scanner and server */
57 #define MS_SCAN_COMM_PORT                      1008             /**< Port of communication between scanner and server */
58 #endif
59
60 #ifdef _USE_UDS_SOCKET_TCP_
61 typedef enum{
62         MS_DB_BATCH_UPDATE_TCP_PORT = 0,        /**< Media DB batch update */
63         MS_THUMB_CREATOR_TCP_PORT,      /**< Create thumbnail */
64         MS_PORT_MAX,
65 }ms_msg_port_type_e;
66 #endif
67
68 #define MAX_MSG_SIZE                            4096
69
70 typedef enum{
71         MS_MSG_DB_UPDATE = 0,           /**< Media DB Update */
72         MS_MSG_DB_UPDATE_BATCH_START,           /**< Start of media DB update batch */
73         MS_MSG_DB_UPDATE_BATCH,                         /**< Perform of media DB update batch */
74         MS_MSG_DB_UPDATE_BATCH_END,             /**< End of media DB update batch */
75         MS_MSG_DIRECTORY_SCANNING,                      /**< Non recursive Directory Scan and Media DB Update*/
76         MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE,/**< Recursive Directory Scan and Media DB Update*/
77         MS_MSG_BURSTSHOT_INSERT,
78         MS_MSG_BULK_INSERT,                                     /**< Request bulk insert */
79         MS_MSG_STORAGE_ALL,
80         MS_MSG_STORAGE_PARTIAL,
81         MS_MSG_STORAGE_INVALID,
82         MS_MSG_THUMB_SERVER_READY,                      /**< Ready from thumbnail server */
83         MS_MSG_THUMB_EXTRACT_ALL_DONE,          /**< Done of all-thumbnail extracting */
84         MS_MSG_SCANNER_READY,                           /**< Ready from media scanner */
85         MS_MSG_SCANNER_RESULT,                          /**< Result of directory scanning */
86         MS_MSG_SCANNER_BULK_RESULT,                     /**< Request bulk insert */
87         MS_MSG_MAX                                                      /**< Invalid msg type */
88 }ms_msg_type_e;
89
90 typedef struct
91 {
92         ms_msg_type_e msg_type;
93         int pid;
94         int result;
95         size_t msg_size; /*this is size of message below and this does not include the terminationg null byte ('\0'). */
96         char msg[MAX_MSG_SIZE];
97 }ms_comm_msg_s;
98
99 typedef enum {
100         CLIENT_SOCKET,
101         SERVER_SOCKET
102 } ms_socket_type_e;
103
104 typedef enum {
105         MS_MEDIA_THUMB_LARGE,
106         MS_MEDIA_THUMB_SMALL,
107 } ms_thumb_type_e;
108
109 typedef struct {
110         ms_msg_type_e msg_type;
111 } ms_thumb_server_msg;
112
113 typedef struct _thumbMsg{
114         int msg_type;
115         int thumb_type;
116         int status;
117         int pid;
118         int thumb_size;
119         int thumb_width;
120         int thumb_height;
121         int origin_width;
122         int origin_height;
123         int origin_path_size;
124         int dest_path_size;
125         char org_path[MAX_MSG_SIZE];
126         char dst_path[MAX_MSG_SIZE];
127 } thumbMsg;
128
129
130 #endif /*_MEDIA_SERVER_IPC_H_*/