2 * Copyright (c) 2020 Collabora Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <systemd/sd-event.h>
22 /* linker will complain it can't find them and given they're only for C */
24 #include "afb/afb-ws-client.h"
25 #include "afb/afb-proto-ws.h"
28 #define TIMEOUT_SD_LOOP 30000000
30 struct pws_data_source_json_reply;
32 struct pws_data_source {
33 struct sd_event *loop;
34 struct afb_proto_ws *pws;
36 int num_id; /* key id */
38 struct json_object *reply;
43 pws_data_source_reply_destroy(struct pws_data_source *pws);
45 /* inits a connection to connect_to
48 struct pws_data_source *
49 pws_data_source_init(const char *connect_to);
51 /* destroys connection init'ed by pws_data_source_init
54 pws_data_source_destroy(struct pws_data_source *pws);
58 * starts the app by @afm_name
60 * returns 0 in case of success, negative in case of failure
64 pws_start_process(struct pws_data_source *pws, const char *afm_name);
67 * terminates the app by @afm_name
69 * returns true case of success, false in case of failure
72 pws_stop_process(struct pws_data_source *pws, const char *afm_name);
74 /* returns pid or -1 in case the @afm_name is not running
78 pws_check_process_is_running(struct pws_data_source *pws, const char *afm_name);
80 /* returns #no of (current) active, running applications
85 pws_list_runners(struct pws_data_source *pws);
87 /* returns #no of (all) applications
92 pws_list_runnables(struct pws_data_source *pws);
97 pws_get_list_runnables(struct pws_data_source *pws, struct json_object **json_obj);