Tizen 2.1 base
[framework/multimedia/media-server.git] / lib / include / media-util-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 api utilities of IPC.
24  *
25  * @file                media-util-ipc.h
26  * @author      Haejeong Kim(backto.kim@samsung.com)
27  * @version     1.0
28  * @brief
29  */
30  #ifndef _MEDIA_UTIL_IPC_H_
31 #define _MEDIA_UTIL_IPC_H_
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #include <sys/socket.h>
38 #include <netinet/in.h>
39 #include <arpa/inet.h>
40
41 #include "media-server-ipc.h"
42
43 #define SERVER_IP                       "127.0.0.1"
44
45 typedef enum {
46         MS_PROTOCOL_UDP,
47         MS_PROTOCOL_TCP
48 } ms_protocol_e;
49
50 int ms_ipc_create_client_socket(ms_protocol_e protocol, int timeout_sec, int *sock_fd);
51 int ms_ipc_create_server_socket(ms_protocol_e protocol, int port, int *sock_fd);
52 int ms_ipc_send_msg_to_server(int sockfd, int port, ms_comm_msg_s *send_msg, struct sockaddr_in *serv_addr);
53 int ms_ipc_send_msg_to_client(int sockfd, ms_comm_msg_s *send_msg, struct sockaddr_in *client_addr);
54 int ms_ipc_receive_message(int sockfd, void *recv_msg, unsigned int msg_size, struct sockaddr_in *client_addr, unsigned int *size);
55 int ms_ipc_wait_message(int sockfd, void  *recv_msg, unsigned int msg_size, struct sockaddr_in *recv_addr, unsigned int *size);
56
57 #ifdef __cplusplus
58 }
59 #endif
60
61 #endif /*_MEDIA_UTIL_IPC_H_*/