ad1f0a9c4cdf4b7dd6176f0d13349bc271a1b4d9
[sim/o1-interface.git] / ntsimulator / ntsim-ng / core / app / manager.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 #include <libyang/libyang.h>
23
24 typedef struct {
25     //meta-data
26     char *docker_id;
27     bool is_configured;
28     bool is_mounted;
29
30     //yang data
31     char *name;
32     char *mount_point_addressing_method;
33     char *docker_ip;
34     uint16_t docker_port;
35     char *host_ip;
36     uint16_t host_port;
37 } manager_network_function_instance_t;
38
39 typedef struct {
40     //manager_docker data
41     manager_network_function_instance_t *instance;
42     bool data_changed;
43
44     //meta-data, constant
45     struct lys_ident *function_type;
46     char *function_type_string;
47     const char *docker_image_name;
48
49     //yang data
50     int started_instances;
51     int mounted_instances;
52     
53     char *docker_instance_name;
54     char *docker_version_tag;
55     char *docker_repository;
56
57     char *mount_point_addressing_method;
58 } manager_network_function_type;
59
60 //manager.c
61 int manager_run(void);
62
63 //manager_operations.c
64 void manager_operations_init(void);
65
66 int manager_start_instance(manager_network_function_type *function_type);
67 int manager_config_instance(manager_network_function_type *function_type, manager_network_function_instance_t *instance);
68 int manager_stop_instance(manager_network_function_type *function_type);
69 int manager_mount_instance(manager_network_function_type *function_type);
70 int manager_unmount_instance(manager_network_function_type *function_type);