Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lxcpp Namespace Reference

Namespaces

 api
 
 provision
 

Classes

struct  AttachConfig
 
class  AttachHelper
 Implementation of the Intermediate helper process. More...
 
struct  SubsystemConfig
 
struct  CGroupParam
 
struct  CGroupConfig
 
struct  CGroupsConfig
 
class  CGroup
 
struct  DevicePermission
 
class  DevicesCGroup
 
class  Subsystem
 
class  Attach
 
class  CGroupMakeAll
 
class  SubsystemMake
 
class  CGroupMake
 
class  CGroupAssignPidAll
 
class  CGroupAssignPid
 
class  Command
 
class  Console
 
class  NetCreateAll
 
class  NetConfigureAll
 
class  NetInteraceCreate
 
class  NetInterfaceSetAttrs
 
class  NetInterfaceAddInetAddr
 
class  PrepGuestTerminal
 
class  PrepHostTerminal
 
class  Provisions
 
class  ProvisionFile
 
class  ProvisionMount
 
class  ProvisionLink
 
class  SetupUserNS
 
class  Start
 Starts the container. More...
 
class  Stop
 
struct  ContainerConfig
 
class  ContainerImpl
 
struct  NetworkInterfaceInfo
 
class  Container
 
struct  Exception
 Base class for exceptions in lxcpp. More...
 
struct  NotImplementedException
 
struct  ProcessSetupException
 
struct  FileSystemSetupException
 
struct  EnvironmentSetupException
 
struct  CredentialSetupException
 
struct  CapabilitySetupException
 
struct  UtilityException
 
struct  TerminalException
 
struct  BadArgument
 
struct  NoSuchValue
 
struct  NetworkException
 
struct  CGroupException
 
struct  ConfigureException
 
struct  ProvisionException
 
struct  UserNSException
 
struct  ForbiddenActionException
 
class  Guard
 Guard process used for container's init configuration and control. More...
 
struct  LoggerConfig
 Logger configuration. More...
 
class  NetworkInterfaceConfig
 Network interface configuration. More...
 
class  NetworkConfig
 Network interface configuration. More...
 
class  InetAddr
 Unified ip address. More...
 
struct  Route
 
struct  Attr
 
class  NetworkInterface
 Network operations to be performed on given container and interface operates on netlink device. More...
 
struct  ProvisionConfig
 
struct  TerminalConfig
 
struct  TerminalsConfig
 
struct  UserNSConfig
 

Typedefs

typedef std::vector< AttrAttrs
 
typedef std::vector
< provision::File
FileVector
 
typedef std::vector
< provision::Mount
MountVector
 
typedef std::vector
< provision::Link
LinkVector
 

Enumerations

enum  InetAddrType { InetAddrType::IPV4, InetAddrType::IPV6 }
 Suported address types. More...
 
enum  RoutingTable {
  RoutingTable::UNSPEC, RoutingTable::COMPAT, RoutingTable::DEFAULT, RoutingTable::MAIN,
  RoutingTable::LOCAL, RoutingTable::USER
}
 
enum  AttrName {
  AttrName::MAC, AttrName::FLAGS, AttrName::CHANGE, AttrName::TYPE,
  AttrName::MTU, AttrName::LINK, AttrName::TXQLEN
}
 
enum  InterfaceType : int { InterfaceType::VETH, InterfaceType::BRIDGE, InterfaceType::MACVLAN }
 Created interface type. More...
 
enum  MacVLanMode { MacVLanMode::PRIVATE, MacVLanMode::VEPA, MacVLanMode::BRIDGE, MacVLanMode::PASSTHRU }
 Suported MacVLan modes. More...
 
enum  NetStatus { NetStatus::DOWN, NetStatus::UP }
 

Functions

void dropCapsFromBoundingExcept (unsigned long long mask)
 
void setgroups (const std::vector< gid_t > &gids)
 
void setregid (const gid_t rgid, const gid_t egid)
 
void setreuid (const uid_t ruid, const uid_t euid)
 
pid_t setsid ()
 
void clearenvExcept (const std::vector< std::string > &names)
 Clears the env variables except those listed. More...
 
void clearenv ()
 
std::string getenv (const std::string &name)
 
void setenv (const std::string &name, const std::string &value)
 
void setenv (const std::vector< std::pair< std::string, std::string >> &variables)
 
void mount (const std::string &source, const std::string &target, const std::string &filesystemtype, unsigned long mountflags, const std::string &data)
 
void umount (const std::string &path, const int flags)
 
bool isMountPoint (const std::string &path)
 
bool isMountPointShared (const std::string &path)
 Detect whether path is mounted as MS_SHARED. More...
 
void fchdir (int fd)
 
void chdir (const std::string &path)
 
ContainercreateContainer (const std::string &name, const std::string &rootPath, const std::string &workPath)
 
std::string nsToString (const int ns)
 
std::string getNsPath (const pid_t pid)
 
std::string getPath (const pid_t pid, const int ns)
 
std::string toString (const in_addr &addr)
 
std::string toString (const in6_addr &addr)
 
void fromString (const std::string &s, in_addr &addr)
 
void fromString (const std::string &s, in6_addr &addr)
 
std::string toString (const InetAddr &a)
 
static rt_class_t getRoutingTableClass (const RoutingTable rt)
 
static RoutingTable getRoutingTable (unsigned tbl)
 
static std::vector< RoutegetRoutesImpl (pid_t pid, rt_class_t tbl, const std::string &ifname, int family)
 
static bool operator== (const in_addr &a, const in_addr &b)
 
static bool operator== (const in6_addr &a, const in6_addr &b)
 
static bool operator== (const InetAddr &a, const InetAddr &b)
 
std::string toString (const RoutingTable rt)
 
std::ostream & operator<< (std::ostream &os, const AttrName &a)
 
pid_t fork ()
 
pid_t clone (int(*function)(void *), void *args, const int flags)
 
void setns (const pid_t pid, int requestedNamespaces)
 
int waitpid (const pid_t pid)
 
void unshare (const int ns)
 
void execve (const std::vector< std::string > &argv)
 
int nullStdFDs ()
 Nullifies all standard file descriptors (stdin, stdout, stderr) replacing them with file descriptor to /dev/null. More...
 
bool isatty (int fd)
 Checks if a file descriptor is a terminal. More...
 
void tcgetattr (const int fd, struct termios *termios_p)
 Get terminal attributes. More...
 
void tcsetattr (const int fd, const int optional_actions, const struct termios *termios_p)
 Set terminal attributes. More...
 
void setupIOControlTTY (const int ttyFD)
 Setups the passed fd as a new control and IO (in, out, err) terminal. More...
 
std::pair< int, std::string > openPty (bool rawMode)
 This function creates a new pair of virtual character devices using a pseudtoreminal interface. More...
 
void setProcTitle (const std::string &title)
 Changes the tittle of a current process title (e.g. More...
 
void setupMountPoints ()
 
bool setupControlTTY (const int ttyFD)
 

Typedef Documentation

typedef std::vector<Attr> lxcpp::Attrs
typedef std::vector<provision::File> lxcpp::FileVector
typedef std::vector<provision::Link> lxcpp::LinkVector
typedef std::vector<provision::Mount> lxcpp::MountVector

Enumeration Type Documentation

enum lxcpp::AttrName
strong
Enumerator
MAC 
FLAGS 
CHANGE 
TYPE 
MTU 
LINK 
TXQLEN 
enum lxcpp::InetAddrType
strong

Suported address types.

Enumerator
IPV4 
IPV6 
enum lxcpp::InterfaceType : int
strong

Created interface type.

Enumerator
VETH 
BRIDGE 
MACVLAN 
enum lxcpp::MacVLanMode
strong

Suported MacVLan modes.

Enumerator
PRIVATE 
VEPA 
BRIDGE 
PASSTHRU 
enum lxcpp::NetStatus
strong
Enumerator
DOWN 
UP 
enum lxcpp::RoutingTable
strong
Enumerator
UNSPEC 
COMPAT 
DEFAULT 
MAIN 
LOCAL 
USER 

Function Documentation

void lxcpp::chdir ( const std::string &  path)
void lxcpp::clearenv ( )
void lxcpp::clearenvExcept ( const std::vector< std::string > &  names)

Clears the env variables except those listed.

There's a race condition - a moment when listed variables aren't set Function should be used only for setting up a new process.

Parameters
namesnames of the variables to keep
pid_t lxcpp::clone ( int(*)(void *)  function,
void *  args,
const int  flags 
)
Container * lxcpp::createContainer ( const std::string &  name,
const std::string &  rootPath,
const std::string &  workPath 
)
void lxcpp::dropCapsFromBoundingExcept ( unsigned long long  mask)
void lxcpp::execve ( const std::vector< std::string > &  argv)
void lxcpp::fchdir ( int  fd)
pid_t lxcpp::fork ( )
void lxcpp::fromString ( const std::string &  s,
in_addr &  addr 
)
void lxcpp::fromString ( const std::string &  s,
in6_addr &  addr 
)
std::string lxcpp::getenv ( const std::string &  name)
std::string lxcpp::getNsPath ( const pid_t  pid)
std::string lxcpp::getPath ( const pid_t  pid,
const int  ns 
)
static std::vector<Route> lxcpp::getRoutesImpl ( pid_t  pid,
rt_class_t  tbl,
const std::string &  ifname,
int  family 
)
static
static RoutingTable lxcpp::getRoutingTable ( unsigned  tbl)
static
static rt_class_t lxcpp::getRoutingTableClass ( const RoutingTable  rt)
static
bool lxcpp::isatty ( int  fd)

Checks if a file descriptor is a terminal.

bool lxcpp::isMountPoint ( const std::string &  path)
bool lxcpp::isMountPointShared ( const std::string &  path)

Detect whether path is mounted as MS_SHARED.

Parses /proc/self/mountinfo

Parameters
pathmount point
Returns
is the mount point shared
void lxcpp::mount ( const std::string &  source,
const std::string &  target,
const std::string &  filesystemtype,
unsigned long  mountflags,
const std::string &  data 
)
std::string lxcpp::nsToString ( const int  ns)
int lxcpp::nullStdFDs ( )

Nullifies all standard file descriptors (stdin, stdout, stderr) replacing them with file descriptor to /dev/null.

Used to as a part of a process to detach a process from a control terminal.

This function has to be safe in regard to signal(7)

Returns
an error code in case of failure.
std::pair< int, std::string > lxcpp::openPty ( bool  rawMode)

This function creates a new pair of virtual character devices using a pseudtoreminal interface.

It also configures as much as it can so the devices are immediately usable.

Parameters
rawModeWhether to set the terminal in the raw mode (termios(2))
Returns
file descriptor to the master device and the path/name of the pts slace device.
std::ostream& lxcpp::operator<< ( std::ostream &  os,
const AttrName &  a 
)
inline
static bool lxcpp::operator== ( const in_addr &  a,
const in_addr &  b 
)
inlinestatic
static bool lxcpp::operator== ( const in6_addr &  a,
const in6_addr &  b 
)
inlinestatic
static bool lxcpp::operator== ( const InetAddr a,
const InetAddr b 
)
inlinestatic
void lxcpp::setenv ( const std::string &  name,
const std::string &  value 
)
void lxcpp::setenv ( const std::vector< std::pair< std::string, std::string >> &  variables)
void lxcpp::setgroups ( const std::vector< gid_t > &  gids)
void lxcpp::setns ( const pid_t  pid,
int  requestedNamespaces 
)
void lxcpp::setProcTitle ( const std::string &  title)

Changes the tittle of a current process title (e.g.

visible in ps tool).

Parameters
titleA new tittle to be set
void lxcpp::setregid ( const gid_t  rgid,
const gid_t  egid 
)
void lxcpp::setreuid ( const uid_t  ruid,
const uid_t  euid 
)
pid_t lxcpp::setsid ( )
bool lxcpp::setupControlTTY ( const int  ttyFD)
void lxcpp::setupIOControlTTY ( const int  ttyFD)

Setups the passed fd as a new control and IO (in, out, err) terminal.

void lxcpp::setupMountPoints ( )
void lxcpp::tcgetattr ( const int  fd,
struct termios *  termios_p 
)

Get terminal attributes.

void lxcpp::tcsetattr ( const int  fd,
const int  optional_actions,
const struct termios *  termios_p 
)

Set terminal attributes.

std::string lxcpp::toString ( const RoutingTable  rt)
inline
std::string lxcpp::toString ( const in_addr &  addr)
std::string lxcpp::toString ( const in6_addr &  addr)
std::string lxcpp::toString ( const InetAddr a)
void lxcpp::umount ( const std::string &  path,
const int  flags 
)
void lxcpp::unshare ( const int  ns)
int lxcpp::waitpid ( const pid_t  pid)