clibdocker  0.1.0-alpha.0
A Docker API for C
docker_networks.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2018-2022 Abhishek Mishra
4  *
5  * This file is part of clibdocker.
6  *
7  * clibdocker is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation,
10  * either version 3 of the License, or (at your option)
11  * any later version.
12  *
13  * clibdocker is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public
19  * License along with clibdocker.
20  * If not, see <https://www.gnu.org/licenses/>.
21  *
22  */
23 
29 #ifndef SRC_DOCKER_NETWORKS_H_
30 #define SRC_DOCKER_NETWORKS_H_
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <stdlib.h>
37 #include "docker_result.h"
38 #include "docker_util.h"
39 #include "docker_connection_util.h"
40 
47 typedef json_object docker_network_container;
48 
55 #define docker_network_container_name_get(ctr) get_attr_str((json_object*)ctr, "Name")
56 
63 #define docker_network_container_endpoint_id_get(ctr) get_attr_str((json_object*)ctr, "EndpointID")
64 
71 #define docker_network_container_mac_address_get(ctr) get_attr_str((json_object*)ctr, "MacAddress")
72 
79 #define docker_network_container_ipv4_address_get(ctr) get_attr_str((json_object*)ctr, "IPv4Address")
80 
87 #define docker_network_container_ipv6_address_get(ctr) get_attr_str((json_object*)ctr, "IPv6Address")
88 
92 typedef json_object docker_network_ipam;
93 
100 #define docker_network_ipam_driver_get(ipam) get_attr_str((json_object*)ipam, "Driver")
101 
108 #define docker_network_ipam_config_length(ipam) json_object_array_length(get_attr_json_object((json_object*)ipam, "Config"))
109 
117 #define docker_network_ipam_config_get_idx(ipam, i) json_object_array_get_idx(get_attr_json_object((json_object*)ipam, "Config"))
118 
122 typedef json_object docker_network;
123 
129 #define free_docker_network(net) json_object_put((json_object*) net)
130 
137 #define docker_network_name_get(net) get_attr_str((json_object*)net, "Name")
138 
145 #define docker_network_id_get(net) get_attr_str((json_object*)net, "Id")
146 
153 #define docker_network_created_get(net) get_attr_str((json_object*)net, "Created")
154 
161 #define docker_network_scope_get(net) get_attr_str((json_object*)net, "Scope")
162 
169 #define docker_network_driver_get(net) get_attr_str((json_object*)net, "Driver")
170 
177 #define docker_network_enable_ipv6_get(net) get_attr_boolean((json_object*)net, "EnableIPv6")
178 
185 #define docker_network_internal_get(net) get_attr_boolean((json_object*)net, "Internal")
186 
193 #define docker_network_attachable_get(net) get_attr_boolean((json_object*)net, "Attachable")
194 
201 #define docker_network_ingress_get(net) get_attr_boolean((json_object*)net, "Ingress")
202 
209 #define docker_network_options_get(net) get_attr_json_object((json_object*)net, "Options")
210 
216 #define docker_network_options_foreach(net) json_object_object_foreach(docker_network_options_get(net), key, val)
217 
224 #define docker_network_labels_get(net) get_attr_json_object((json_object*)net, "Labels")
225 
231 #define docker_network_labels_foreach(net) json_object_object_foreach(docker_network_labels_get(net), key, val)
232 
239 #define docker_network_ipam_get(net) (docker_network_ipam*)get_attr_json_object((json_object*)net, "IPAM")
240 
247 #define docker_network_containers_get(net) get_attr_json_object((json_object*)net, "Containers")
248 
254 #define docker_network_containers_foreach(net) json_object_object_foreach(docker_network_containers_get(net), key, val)
255 
259 typedef json_object docker_network_list;
260 
266 #define free_docker_network_list(network_ls) json_object_put(network_ls)
267 
274 #define docker_network_list_length(network_ls) json_object_array_length(network_ls)
275 
283 #define docker_network_list_get_idx(network_ls, i) (docker_network*) json_object_array_get_idx(network_ls, i)
284 
300  char* filter_driver, char* filter_id,
301  char* filter_label, char* filter_name, char* filter_scope,
302  char* filter_type);
303 
315  char* id_or_name, int verbose, char* scope);
316 
317 #ifdef __cplusplus
318 }
319 #endif
320 
321 #endif /* SRC_DOCKER_NETWORKS_H_ */
Docker Connection Utils.
json_object docker_network_ipam
Docker Network Ipam json object.
Definition: docker_networks.h:92
json_object docker_network
Docker Network json object.
Definition: docker_networks.h:122
d_err_t docker_networks_list(docker_context *ctx, docker_network_list **networks, char *filter_driver, char *filter_id, char *filter_label, char *filter_name, char *filter_scope, char *filter_type)
Definition: docker_networks.c:27
d_err_t docker_network_inspect(docker_context *ctx, docker_network **net, char *id_or_name, int verbose, char *scope)
Definition: docker_networks.c:65
json_object docker_network_container
Docker Network Container json object.
Definition: docker_networks.h:47
json_object docker_network_list
docker network list object
Definition: docker_networks.h:259
Docker Results.
enum _config_error d_err_t
Definition: docker_result.h:60
Docker API utils.
A docker context for a specific docker server.
Definition: docker_connection_util.h:141