clibdocker  0.1.0-alpha.0
A Docker API for C
Macros | Typedefs | Functions
docker_networks.h File Reference

Docker Networks API. More...

#include <stdlib.h>
#include "docker_result.h"
#include "docker_util.h"
#include "docker_connection_util.h"
Include dependency graph for docker_networks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define docker_network_container_name_get(ctr)   get_attr_str((json_object*)ctr, "Name")
 Get the name of the container from the docker container. More...
 
#define docker_network_container_endpoint_id_get(ctr)   get_attr_str((json_object*)ctr, "EndpointID")
 Get the endpoint id of the container from the docker container. More...
 
#define docker_network_container_mac_address_get(ctr)   get_attr_str((json_object*)ctr, "MacAddress")
 Get the mac address of the container from the docker container. More...
 
#define docker_network_container_ipv4_address_get(ctr)   get_attr_str((json_object*)ctr, "IPv4Address")
 Get the ipv4 of the container from the docker container. More...
 
#define docker_network_container_ipv6_address_get(ctr)   get_attr_str((json_object*)ctr, "IPv6Address")
 Get the ipv6 of the container from the docker container. More...
 
#define docker_network_ipam_driver_get(ipam)   get_attr_str((json_object*)ipam, "Driver")
 Get the ipam driver. More...
 
#define docker_network_ipam_config_length(ipam)   json_object_array_length(get_attr_json_object((json_object*)ipam, "Config"))
 Get the ipam config length. More...
 
#define docker_network_ipam_config_get_idx(ipam, i)   json_object_array_get_idx(get_attr_json_object((json_object*)ipam, "Config"))
 Get ith ipam config. More...
 
#define free_docker_network(net)   json_object_put((json_object*) net)
 Free the docker network object. More...
 
#define docker_network_name_get(net)   get_attr_str((json_object*)net, "Name")
 Get the name of the docker network. More...
 
#define docker_network_id_get(net)   get_attr_str((json_object*)net, "Id")
 Get the id of the docker network. More...
 
#define docker_network_created_get(net)   get_attr_str((json_object*)net, "Created")
 Get the created datetime of the docker network. More...
 
#define docker_network_scope_get(net)   get_attr_str((json_object*)net, "Scope")
 Get the scope of the docker network. More...
 
#define docker_network_driver_get(net)   get_attr_str((json_object*)net, "Driver")
 Get the network driver of the docker network. More...
 
#define docker_network_enable_ipv6_get(net)   get_attr_boolean((json_object*)net, "EnableIPv6")
 Get the EnableIPv6 flag of the docker network. More...
 
#define docker_network_internal_get(net)   get_attr_boolean((json_object*)net, "Internal")
 Get the Internal flag of the docker network. More...
 
#define docker_network_attachable_get(net)   get_attr_boolean((json_object*)net, "Attachable")
 Get the Attachable flag of the docker network. More...
 
#define docker_network_ingress_get(net)   get_attr_boolean((json_object*)net, "Ingress")
 Get the Ingress flag of the docker network. More...
 
#define docker_network_options_get(net)   get_attr_json_object((json_object*)net, "Options")
 Get the network options json object of the docker network. More...
 
#define docker_network_options_foreach(net)   json_object_object_foreach(docker_network_options_get(net), key, val)
 Iterate the network options of the docker network. More...
 
#define docker_network_labels_get(net)   get_attr_json_object((json_object*)net, "Labels")
 Get the labels list for the docker network. More...
 
#define docker_network_labels_foreach(net)   json_object_object_foreach(docker_network_labels_get(net), key, val)
 Iterate over the labels of the docker network. More...
 
#define docker_network_ipam_get(net)   (docker_network_ipam*)get_attr_json_object((json_object*)net, "IPAM")
 Get the ipam object for the docker network. More...
 
#define docker_network_containers_get(net)   get_attr_json_object((json_object*)net, "Containers")
 Get the containers list for the docker network. More...
 
#define docker_network_containers_foreach(net)   json_object_object_foreach(docker_network_containers_get(net), key, val)
 Iterate over the containers list for the docker network. More...
 
#define free_docker_network_list(network_ls)   json_object_put(network_ls)
 Free the docker network list. More...
 
#define docker_network_list_length(network_ls)   json_object_array_length(network_ls)
 Length of the docker network list. More...
 
#define docker_network_list_get_idx(network_ls, i)   (docker_network*) json_object_array_get_idx(network_ls, i)
 Get the ith network object from the docker networks list. More...
 

Typedefs

typedef json_object docker_network_container
 Docker Network Container json object. More...
 
typedef json_object docker_network_ipam
 Docker Network Ipam json object.
 
typedef json_object docker_network
 Docker Network json object.
 
typedef json_object docker_network_list
 docker network list object
 

Functions

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)
 
d_err_t docker_network_inspect (docker_context *ctx, docker_network **net, char *id_or_name, int verbose, char *scope)
 

Detailed Description

Docker Networks API.

Macro Definition Documentation

◆ docker_network_attachable_get

#define docker_network_attachable_get (   net)    get_attr_boolean((json_object*)net, "Attachable")

Get the Attachable flag of the docker network.

Parameters
netdocker network object
Returns
bool attachable flag

◆ docker_network_container_endpoint_id_get

#define docker_network_container_endpoint_id_get (   ctr)    get_attr_str((json_object*)ctr, "EndpointID")

Get the endpoint id of the container from the docker container.

Parameters
ctrdocker container
Returns
char* endpoint id

◆ docker_network_container_ipv4_address_get

#define docker_network_container_ipv4_address_get (   ctr)    get_attr_str((json_object*)ctr, "IPv4Address")

Get the ipv4 of the container from the docker container.

Parameters
ctrdocker container
Returns
char* ipv4

◆ docker_network_container_ipv6_address_get

#define docker_network_container_ipv6_address_get (   ctr)    get_attr_str((json_object*)ctr, "IPv6Address")

Get the ipv6 of the container from the docker container.

Parameters
ctrdocker container
Returns
char* ipv6

◆ docker_network_container_mac_address_get

#define docker_network_container_mac_address_get (   ctr)    get_attr_str((json_object*)ctr, "MacAddress")

Get the mac address of the container from the docker container.

Parameters
ctrdocker container
Returns
char* mac address

◆ docker_network_container_name_get

#define docker_network_container_name_get (   ctr)    get_attr_str((json_object*)ctr, "Name")

Get the name of the container from the docker container.

Parameters
ctrdocker container
Returns
char* name

◆ docker_network_containers_foreach

#define docker_network_containers_foreach (   net)    json_object_object_foreach(docker_network_containers_get(net), key, val)

Iterate over the containers list for the docker network.

Parameters
netdocker network object

◆ docker_network_containers_get

#define docker_network_containers_get (   net)    get_attr_json_object((json_object*)net, "Containers")

Get the containers list for the docker network.

Parameters
netdocker network object
Returns
json_object* containers list

◆ docker_network_created_get

#define docker_network_created_get (   net)    get_attr_str((json_object*)net, "Created")

Get the created datetime of the docker network.

Parameters
netdocker network object
Returns
char* created datetime

◆ docker_network_driver_get

#define docker_network_driver_get (   net)    get_attr_str((json_object*)net, "Driver")

Get the network driver of the docker network.

Parameters
netdocker network object
Returns
char* network driver

◆ docker_network_enable_ipv6_get

#define docker_network_enable_ipv6_get (   net)    get_attr_boolean((json_object*)net, "EnableIPv6")

Get the EnableIPv6 flag of the docker network.

Parameters
netdocker network object
Returns
bool enable ipv6 flag

◆ docker_network_id_get

#define docker_network_id_get (   net)    get_attr_str((json_object*)net, "Id")

Get the id of the docker network.

Parameters
netdocker network object
Returns
char* id

◆ docker_network_ingress_get

#define docker_network_ingress_get (   net)    get_attr_boolean((json_object*)net, "Ingress")

Get the Ingress flag of the docker network.

Parameters
netdocker network object
Returns
bool ingress flag

◆ docker_network_internal_get

#define docker_network_internal_get (   net)    get_attr_boolean((json_object*)net, "Internal")

Get the Internal flag of the docker network.

Parameters
netdocker network object
Returns
bool internal flag

◆ docker_network_ipam_config_get_idx

#define docker_network_ipam_config_get_idx (   ipam,
 
)    json_object_array_get_idx(get_attr_json_object((json_object*)ipam, "Config"))

Get ith ipam config.

Parameters
ipamnetwork ipam object
iindex
Returns
json_object* ith ipam config object

◆ docker_network_ipam_config_length

#define docker_network_ipam_config_length (   ipam)    json_object_array_length(get_attr_json_object((json_object*)ipam, "Config"))

Get the ipam config length.

Parameters
ipamnetwork ipam object
Returns
size_t ipam config length

◆ docker_network_ipam_driver_get

#define docker_network_ipam_driver_get (   ipam)    get_attr_str((json_object*)ipam, "Driver")

Get the ipam driver.

Parameters
ipamnetwork ipam object
Returns
char* driver

◆ docker_network_ipam_get

#define docker_network_ipam_get (   net)    (docker_network_ipam*)get_attr_json_object((json_object*)net, "IPAM")

Get the ipam object for the docker network.

Parameters
netdocker network object
Returns
docker_network_ipam* ipam object

◆ docker_network_labels_foreach

#define docker_network_labels_foreach (   net)    json_object_object_foreach(docker_network_labels_get(net), key, val)

Iterate over the labels of the docker network.

Parameters
netdocker network object

◆ docker_network_labels_get

#define docker_network_labels_get (   net)    get_attr_json_object((json_object*)net, "Labels")

Get the labels list for the docker network.

Parameters
netdocker network object
Returns
json_object* labels list object

◆ docker_network_list_get_idx

#define docker_network_list_get_idx (   network_ls,
 
)    (docker_network*) json_object_array_get_idx(network_ls, i)

Get the ith network object from the docker networks list.

Parameters
network_lsnetwork list object
iindex
Returns
docker_network* network object

◆ docker_network_list_length

#define docker_network_list_length (   network_ls)    json_object_array_length(network_ls)

Length of the docker network list.

Parameters
network_lsnetwork list object
Returns
size_t network list length

◆ docker_network_name_get

#define docker_network_name_get (   net)    get_attr_str((json_object*)net, "Name")

Get the name of the docker network.

Parameters
netdocker network object
Returns
char* name

◆ docker_network_options_foreach

#define docker_network_options_foreach (   net)    json_object_object_foreach(docker_network_options_get(net), key, val)

Iterate the network options of the docker network.

Parameters
netdocker network object

◆ docker_network_options_get

#define docker_network_options_get (   net)    get_attr_json_object((json_object*)net, "Options")

Get the network options json object of the docker network.

Parameters
netdocker network object
Returns
json_object* network options

◆ docker_network_scope_get

#define docker_network_scope_get (   net)    get_attr_str((json_object*)net, "Scope")

Get the scope of the docker network.

Parameters
netdocker network object
Returns
char* scope

◆ free_docker_network

#define free_docker_network (   net)    json_object_put((json_object*) net)

Free the docker network object.

Parameters
netdocker network object

◆ free_docker_network_list

#define free_docker_network_list (   network_ls)    json_object_put(network_ls)

Free the docker network list.

Parameters
network_lsnetwork list object

Typedef Documentation

◆ docker_network_container

typedef json_object docker_network_container

Docker Network Container json object.

This object represents the container details inside the response of the docker network api call response.

Function Documentation

◆ docker_network_inspect()

d_err_t docker_network_inspect ( docker_context ctx,
docker_network **  net,
char *  id_or_name,
int  verbose,
char *  scope 
)

Inspect details of a network looked up by name or id.

Parameters
ctxdocker context
netdetails of the network returned
id_or_nameid or name of the network to be looked up
verbosewhether inspect output is verbose (0 means false, true otherwise)
scopefilter by one of swarm, global, or local
Returns
error code

◆ docker_networks_list()

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 
)

List all networks which match the filters given. If all filters are null, then all networks are listed.

Parameters
ctxdocker context
networksthe array_list of networks to be returned
filter_driver
filter_id
filter_label
filter_name
filter_scope
filter_type
Returns
error code

References make_docker_call(), and docker_context_t::url.