Add supoprt for D release use-case.
[sim/o1-interface.git] / ntsimulator / ntsim-ng / core / docker.h
1 /*************************************************************************
2 *
3 * Copyright 2020 highstreet technologies GmbH and others
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 ***************************************************************************/
17
18 #pragma once
19
20 #include <stdbool.h>
21 #include <stdint.h>
22
23 typedef struct {
24     char *repo;
25     char *tag;
26 } docker_available_images_t;
27
28 typedef struct {
29     char *image;
30     docker_available_images_t *available_images;
31     int available_images_count;
32 } docker_context_t;
33
34 typedef struct {
35     char *name;
36     char *id;
37
38     char *docker_ip;
39     uint16_t docker_netconf_ssh_port;
40     uint16_t docker_netconf_tls_port;
41     uint16_t docker_ftp_port;
42     uint16_t docker_sftp_port;
43
44     char *host_ip;
45     uint16_t host_netconf_ssh_port;
46     uint16_t host_netconf_tls_port;
47     uint16_t host_ftp_port;
48     uint16_t host_sftp_port;
49 } docker_container_t;
50
51 typedef struct {
52     float cpu;
53     float mem;
54 } docker_usage_t;
55
56 //docker container functions for manager
57 int docker_init(const char **filter, int filter_count, const char *min_version, docker_context_t **context);
58 void docker_free(docker_context_t *context, int count);
59
60 int docker_start(const char *container_name, const char *tag, const char *image, const char *repo, uint16_t host_netconf_ssh_port, uint16_t host_netconf_tls_port, uint16_t host_ftp_port, uint16_t host_sftp_port, docker_container_t *container);
61 int docker_stop(docker_container_t *container);
62
63 int docker_usage_get(const char **instances_id, int count, docker_usage_t *usage);