7251ed91182f7ec6ece003dbf42a52e6f36a1ad5
[platform/core/multimedia/libmedia-thumbnail.git] / src / include / ipc / media-thumb-ipc.h
1 /*
2  * libmedia-thumbnail
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@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 #include <sys/un.h>
24 #include <sys/stat.h>
25 #include <arpa/inet.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <unistd.h>
29 #include <errno.h>
30 #include <signal.h>
31 #include <sys/types.h>
32
33 #include "media-thumb-internal.h"
34 #include "media-util-ipc.h"
35 #include "media-server-ipc.h"
36
37 #ifndef _MEDIA_THUMB_IPC_H_
38 #define _MEDIA_THUMB_IPC_H_
39
40 #define MAX_PATH_SIZE 4096
41 #define MAX_TRIES               3
42
43 enum {
44         THUMB_REQUEST_DB_INSERT,
45         THUMB_REQUEST_SAVE_FILE,
46         THUMB_REQUEST_ALL_MEDIA,
47         THUMB_REQUEST_CANCEL_MEDIA,
48         THUMB_REQUEST_CANCEL_ALL,
49         THUMB_REQUEST_KILL_SERVER,
50         THUMB_RESPONSE,
51         THUMB_REQUEST_RAW_DATA,
52         THUMB_REQUEST_CANCEL_RAW_DATA,
53         THUMB_REQUEST_CANCEL_ALL_RAW_DATA,
54         THUMB_RESPONSE_RAW_DATA,
55 };
56
57 enum {
58         THUMB_SUCCESS,
59         THUMB_FAIL
60 };
61
62 int _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg);
63
64 int _media_thumb_recv_udp_msg(int sock, int header_size, thumbMsg *msg, struct sockaddr_un *from_addr, unsigned int *from_size);
65
66 int _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size);
67
68 int _media_thumb_set_buffer_for_response(thumbMsg *req_msg, unsigned char **buf, int *buf_size);
69
70 int _media_thumb_set_add_raw_data_buffer(thumbRawAddMsg *req_msg, unsigned char **buf, int *buf_size);
71
72 int _media_thumb_request(int msg_type,
73                                         const char *origin_path,
74                                         char *thumb_path,
75                                         int max_length,
76                                         media_thumb_info *thumb_info,
77                                         uid_t uid);
78
79 int _media_thumb_request_async(int msg_type,
80                                         const char *origin_path,
81                                         thumbUserData *userData,
82                                         uid_t uid);
83
84 int _media_thumb_request_raw_data_async(int msg_type,
85                                         int request_id,
86                                         const char *origin_path,
87                                         int width,
88                                         int height,
89                                         thumbRawUserData *userData,
90                                         uid_t uid);
91
92 #endif /*_MEDIA_THUMB_IPC_H_*/