d89d78c7d8ea0f7445ba0f50df19d04ff5b21c17
[platform/core/appfw/pkgmgr-server.git] / include / queue.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
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
18 #ifndef _QUEUE_H_
19 #define _QUEUE_H_
20
21 #include <sys/types.h>
22
23 struct job_extra_info {
24         int getsize_fd;
25         char *getsize_fifo;
26         GIOChannel *getsize_io;
27 };
28
29 struct backend_job {
30         uid_t target_uid;
31         uid_t caller_uid;
32         int req_type;
33         char *req_id;
34         char *pkgid;
35         char *appid;
36         char *args;
37         int backend_slot;
38         char *backend_type;
39         char *backend_path;
40         struct job_extra_info *extra;
41 };
42
43 int _is_queue_empty(int pos);
44 int _push_queue(uid_t target_uid, uid_t caller_uid, const char *req_id,
45                 int req_type, const char *queue_type, const char *pkgid,
46                 const char *args);
47 struct backend_job *_pop_queue(int pos);
48 void _free_backend_job(struct backend_job *job);
49 int _init_backend_queue(void);
50 void _fini_backend_queue(void);
51 void __free_extra_info(struct backend_job *job);
52
53 #endif  // _QUEUE_H_