networkservice
Public Member Functions | List of all members
service::plugins::network::INetwork Interface Referenceabstract

Configure the network (enable network interfaces, set IP addresses, add new network interfaces, ...) More...

#include "service/plugins/INetwork.h"

Inheritance diagram for service::plugins::network::INetwork:
Inheritance graph
[legend]

Public Member Functions

 INetwork ()=default
 
virtual ~INetwork ()=default
 
 INetwork (const INetwork &)=delete
 
INetworkoperator= (const INetwork &)=delete
 
 INetwork (INetwork &&)=delete
 
INetworkoperator= (INetwork &&)=delete
 
virtual bool hasInterface (const std::string &interfaceName) const =0
 Check if the network interface whose name is "interfaceName" exists. More...
 
virtual void applyInterfaceCommands (const std::vector< std::string > &interfaceCommands) const =0
 Apply "interface commands" i.e network commands more or less related to setting up a network interface (Add a new interface using "ip tuntap" or label for example, set IP addresses, set interfaces up, add an interface to a network bridge, ...). More...
 
virtual void applyLayerCommands (const std::vector< service::plugins::config::ConfigData::Network::LayerCommand > &layerCommands) const =0
 Apply "layer commands" i.e commands that simply consist in writing a given value to a specific network-related file (IP forwarding: /proc/sys/net/ipv4/ip_forward is a common example) More...
 

Detailed Description

Configure the network (enable network interfaces, set IP addresses, add new network interfaces, ...)

This class is the high level interface that must be implemented by network plugin. The core service depends on it and not on its implementation(s) to respect the Dependency Inversion Principle. The network plugin must be capable of applying network commands (based on "ip" tool for example) and configuring the network layer (understand update some network-related files in the filesystem with new values).

Note
Copy contructor, copy-assignment operator, move constructor and move assignment operator are defined to be compliant with the "Rule of five".
See also
https://en.cppreference.com/w/cpp/language/rule_of_three
Author
Boubacar DIENE bouba.nosp@m.car..nosp@m.diene.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Date
April 2020

Constructor & Destructor Documentation

◆ INetwork() [1/3]

service::plugins::network::INetwork::INetwork ( )
default

Class constructor

◆ ~INetwork()

virtual service::plugins::network::INetwork::~INetwork ( )
virtualdefault

Class destructor made virtual because it is used as base class by derived classes in network plugin

◆ INetwork() [2/3]

service::plugins::network::INetwork::INetwork ( const INetwork )
delete

Class copy constructor

◆ INetwork() [3/3]

service::plugins::network::INetwork::INetwork ( INetwork &&  )
delete

Class move constructor

Member Function Documentation

◆ applyInterfaceCommands()

virtual void service::plugins::network::INetwork::applyInterfaceCommands ( const std::vector< std::string > &  interfaceCommands) const
pure virtual

Apply "interface commands" i.e network commands more or less related to setting up a network interface (Add a new interface using "ip tuntap" or label for example, set IP addresses, set interfaces up, add an interface to a network bridge, ...).

Parameters
interfaceCommandsThee list of interface commands to apply
See also
ConfigData

Implemented in service::plugins::network::Network.

◆ applyLayerCommands()

virtual void service::plugins::network::INetwork::applyLayerCommands ( const std::vector< service::plugins::config::ConfigData::Network::LayerCommand > &  layerCommands) const
pure virtual

Apply "layer commands" i.e commands that simply consist in writing a given value to a specific network-related file (IP forwarding: /proc/sys/net/ipv4/ip_forward is a common example)

Parameters
layerCommandsThe list of layer commands to apply
See also
ConfigData

Implemented in service::plugins::network::Network.

◆ hasInterface()

virtual bool service::plugins::network::INetwork::hasInterface ( const std::string &  interfaceName) const
pure virtual

Check if the network interface whose name is "interfaceName" exists.

Parameters
interfaceNameThe network interface to check
Returns
true if the interface exists, false otherwise

Implemented in service::plugins::network::Network.

◆ operator=() [1/2]

INetwork& service::plugins::network::INetwork::operator= ( const INetwork )
delete

Class copy-assignment operator

◆ operator=() [2/2]

INetwork& service::plugins::network::INetwork::operator= ( INetwork &&  )
delete

Class move-assignment operator


The documentation for this interface was generated from the following file: