8fe674a4aca8e7085ee81ba77b58e176c6dd4d40
[platform/core/connectivity/mtp-responder.git] / include / util / mtp_msgq.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef _MTP_MSGQ_H_
18 #define _MTP_MSGQ_H_
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #include "mtp_datatype.h"
25 #include "mtp_util.h"
26
27 typedef mtp_int32 msgq_id_t;
28
29 typedef struct {
30         msg_type_t mtype;
31         mtp_uint32 length;
32         mtp_uint32 signal;
33         unsigned char *buffer;
34 } msgq_ptr_t;
35
36 mtp_bool _util_msgq_init(msgq_id_t *mq_id, mtp_uint32 flags);
37 mtp_bool _util_msgq_send(msgq_id_t mq_id, void *buf, mtp_uint32 size,
38                 mtp_uint32 flags);
39 mtp_bool _util_msgq_receive(msgq_id_t mq_id, void *buf, mtp_uint32 size,
40                 mtp_uint32 flags, mtp_int32 *nbytes);
41 mtp_bool _util_msgq_deinit(msgq_id_t *msgq_id);
42 mtp_bool _util_msgq_set_size(msgq_id_t mq_id, mtp_uint32 nbytes);
43 mtp_bool _util_rcv_msg_from_mq(msgq_id_t mq_id, unsigned char **pkt,
44                 mtp_uint32 *pkt_len, msg_type_t *mtype);
45
46 #ifdef __cplusplus
47 }
48 #endif
49
50 #endif/*_MTP_MSGQ_H_*/