c87b834a0cf2d9ce3bbd464fb8d97bf137a50186
[src/drm-lease-manager.git] / drm-lease-manager / lease-server.h
1 /* Copyright 2020-2021 IGEL Co., Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef LEASE_SERVER_H
17 #define LEASE_SERVER_H
18 #include <stdbool.h>
19
20 #include "drm-lease.h"
21
22 struct ls;
23 struct ls_server;
24 enum ls_req_type {
25         LS_REQ_GET_LEASE,
26         LS_REQ_RELEASE_LEASE,
27 };
28
29 struct ls_req {
30         struct lease_handle *lease_handle;
31         struct ls_server *server;
32         enum ls_req_type type;
33 };
34
35 struct ls *ls_create(struct lease_handle **lease_handles, int count);
36 void ls_destroy(struct ls *ls);
37
38 bool ls_get_request(struct ls *ls, struct ls_req *req);
39 bool ls_send_fd(struct ls *ls, struct ls_server *server, int fd);
40
41 void ls_disconnect_client(struct ls *ls, struct ls_server *server);
42 #endif