Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
libvasum-client

C library for interfacing Vasum. More...

Typedefs

typedef void * VsmClient
 vasum-server's opaque client pointer. More...
 
typedef char * VsmString
 NULL-terminated string type. More...
 
typedef VsmStringVsmArrayString
 NULL-terminated array of strings type. More...
 
typedef void * VsmAddrList
 
typedef unsigned int VsmSubscriptionId
 Subscription id. More...
 
typedef void * VsmZone
 Zone information. More...
 
typedef void * VsmNetdev
 Network device information. More...
 
typedef void(* VsmZoneDbusStateCallback )(const char *zoneId, const char *address, void *data)
 Zone's D-Bus state change callback function signature. More...
 

Enumerations

enum  VsmStatus {
  VSMCLIENT_CUSTOM_ERROR, VSMCLIENT_IO_ERROR, VSMCLIENT_OPERATION_FAILED, VSMCLIENT_INVALID_ARGUMENT,
  VSMCLIENT_OTHER_ERROR, VSMCLIENT_SUCCESS
}
 Completion status of libvasum-client's functions. More...
 
enum  VsmZoneState {
  STOPPED, STARTING, RUNNING, STOPPING,
  ABORTING, FREEZING, FROZEN, THAWED,
  LOCKED, MAX_STATE, ACTIVATING = 128
}
 States of zone. More...
 
enum  VsmNetdevType { VSMNETDEV_VETH, VSMNETDEV_PHYS, VSMNETDEV_MACVLAN }
 Netowrk device type. More...
 
enum  VsmFileType { VSMFILE_DIRECTORY, VSMFILE_FIFO, VSMFILE_REGULAR }
 File type. More...
 
enum  VsmDispacherType { VSMDISPATCHER_EXTERNAL, VSMDISPATCHER_INTERNAL }
 Event dispacher types. More...
 

Functions

VsmStatus vsm_get_poll_fd (VsmClient client, int *fd)
 Get file descriptor associated with event dispatcher of zone client. More...
 
VsmStatus vsm_enter_eventloop (VsmClient client, int flags, int timeout)
 Wait for an I/O event on a vsm client. More...
 
VsmStatus vsm_set_dispatcher_type (VsmClient client, VsmDispacherType dispacher)
 Set dispatching method. More...
 
VsmStatus vsm_get_dispatcher_type (VsmClient client, VsmDispacherType *dispacher)
 Get dispatching method. More...
 
VsmClient vsm_client_create ()
 Create a new vasum-server's client. More...
 
void vsm_client_free (VsmClient client)
 Release client resources. More...
 
VsmStatus vsm_get_status (VsmClient client)
 Get status code of last vasum-server communication. More...
 
const char * vsm_get_status_message (VsmClient client)
 Get status message of the last vasum-server communication. More...
 
VsmStatus vsm_connect (VsmClient client)
 Connect client to the vasum-server. More...
 
VsmStatus vsm_connect_custom (VsmClient client, const char *address)
 Connect client to the vasum-server via custom address. More...
 
VsmStatus vsm_disconnect (VsmClient client)
 Disconnect client from vasum-server. More...
 
void vsm_array_string_free (VsmArrayString astring)
 Release VsmArrayString. More...
 
void vsm_string_free (VsmString string)
 Release VsmString. More...
 
VsmString vsm_zone_get_id (VsmZone zone)
 Get zone id (offline) More...
 
int vsm_zone_get_terminal (VsmZone zone)
 Get zone terminal (offline) More...
 
VsmZoneState vsm_zone_get_state (VsmZone zone)
 Get zone state (offline) More...
 
VsmString vsm_zone_get_rootfs (VsmZone zone)
 Get zone rootfs path (offline) More...
 
void vsm_zone_free (VsmZone zone)
 Release VsmZone. More...
 
VsmString vsm_netdev_get_name (VsmNetdev netdev)
 Get netdev name (offline) More...
 
VsmNetdevType vsm_netdev_get_type (VsmNetdev netdev)
 Get netdev type (offline) More...
 
void vsm_netdev_free (VsmNetdev netdev)
 Release VsmNetdev. More...
 
VsmStatus vsm_lock_queue (VsmClient client)
 Lock the command queue exclusively. More...
 
VsmStatus vsm_unlock_queue (VsmClient client)
 Unlock the command queue. More...
 
VsmStatus vsm_get_zone_dbuses (VsmClient client, VsmArrayString *keys, VsmArrayString *values)
 Get dbus address of each zone. More...
 
VsmStatus vsm_get_zone_ids (VsmClient client, VsmArrayString *array)
 Get zones name. More...
 
VsmStatus vsm_get_active_zone_id (VsmClient client, VsmString *id)
 Get active (foreground) zone name. More...
 
VsmStatus vsm_lookup_zone_by_pid (VsmClient client, int pid, VsmString *id)
 Get zone name of process with given pid. More...
 
VsmStatus vsm_lookup_zone_by_id (VsmClient client, const char *id, VsmZone *zone)
 Get zone informations of zone with given id. More...
 
VsmStatus vsm_lookup_zone_by_terminal_id (VsmClient client, int terminal, VsmString *id)
 Get zone name with given terminal. More...
 
VsmStatus vsm_set_active_zone (VsmClient client, const char *id)
 Set active (foreground) zone. More...
 
VsmStatus vsm_create_zone (VsmClient client, const char *id, const char *tname)
 Create and add zone. More...
 
VsmStatus vsm_destroy_zone (VsmClient client, const char *id, int force)
 Remove zone. More...
 
VsmStatus vsm_shutdown_zone (VsmClient client, const char *id)
 Shutdown zone. More...
 
VsmStatus vsm_start_zone (VsmClient client, const char *id)
 Start zone. More...
 
VsmStatus vsm_lock_zone (VsmClient client, const char *id)
 Lock zone. More...
 
VsmStatus vsm_unlock_zone (VsmClient client, const char *id)
 Unlock zone. More...
 
VsmStatus vsm_add_state_callback (VsmClient client, VsmZoneDbusStateCallback zoneDbusStateCallback, void *data, VsmSubscriptionId *subscriptionId)
 Register dbus state change callback function. More...
 
VsmStatus vsm_del_state_callback (VsmClient client, VsmSubscriptionId subscriptionId)
 Unregister dbus state change callback function. More...
 
VsmStatus vsm_grant_device (VsmClient client, const char *zone, const char *device, uint32_t flags)
 Grant access to device. More...
 
VsmStatus vsm_revoke_device (VsmClient client, const char *zone, const char *device)
 Revoke access to device. More...
 
VsmStatus vsm_zone_get_netdevs (VsmClient client, const char *zone, VsmArrayString *netdevIds)
 Get array of netdev from given zone. More...
 
VsmStatus vsm_netdev_get_ip_addr (VsmClient client, const char *zone, const char *netdevId, VsmAddrList *addrs)
 Get ipv4 address for given netdevId. More...
 
void vsm_addrlist_free (VsmAddrList addrs)
 Release VsmAddrList. More...
 
VsmStatus vsm_netdev_get_ipv4_addr (VsmClient client, const char *zone, const char *netdevId, struct in_addr *addr)
 Get ipv4 address for given netdevId. More...
 
VsmStatus vsm_netdev_get_ipv6_addr (VsmClient client, const char *zone, const char *netdevId, struct in6_addr *addr)
 Get ipv6 address for given netdevId. More...
 
VsmStatus vsm_netdev_add_ipv4_addr (VsmClient client, const char *zone, const char *netdevId, struct in_addr *addr, int prefix)
 Add ipv4 address for given netdevId. More...
 
VsmStatus vsm_netdev_add_ipv6_addr (VsmClient client, const char *zone, const char *netdevId, struct in6_addr *addr, int prefix)
 Add ipv6 address for given netdevId. More...
 
VsmStatus vsm_netdev_del_ipv4_addr (VsmClient client, const char *zone, const char *netdevId, struct in_addr *addr, int prefix)
 Remove ipv4 address from netdev. More...
 
VsmStatus vsm_netdev_del_ipv6_addr (VsmClient client, const char *zone, const char *netdevId, struct in6_addr *addr, int prefix)
 Remove ipv6 address from netdev. More...
 
VsmStatus vsm_netdev_up (VsmClient client, const char *zone, const char *netdevId)
 Turn up a network device in the zone. More...
 
VsmStatus vsm_netdev_down (VsmClient client, const char *zone, const char *netdevId)
 Turn down a network device in the zone. More...
 
VsmStatus vsm_create_netdev_veth (VsmClient client, const char *zone, const char *zoneDev, const char *hostDev)
 Create veth netdev in zone. More...
 
VsmStatus vsm_create_netdev_macvlan (VsmClient client, const char *zone, const char *zoneDev, const char *hostDev, enum macvlan_mode mode)
 Create macvlan in zone. More...
 
VsmStatus vsm_create_netdev_phys (VsmClient client, const char *zone, const char *devId)
 Create/move phys netdev in/to zone. More...
 
VsmStatus vsm_lookup_netdev_by_name (VsmClient client, const char *zone, const char *netdevId, VsmNetdev *netdev)
 Get netdev informations. More...
 
VsmStatus vsm_destroy_netdev (VsmClient client, const char *zone, const char *devId)
 Remove netdev from zone. More...
 
VsmStatus vsm_declare_file (VsmClient client, const char *zone, VsmFileType type, const char *path, int32_t flags, mode_t mode)
 Create file, directory or pipe in zone. More...
 
VsmStatus vsm_declare_mount (VsmClient client, const char *source, const char *zone, const char *target, const char *type, uint64_t flags, const char *data)
 Create mount point in zone. More...
 
VsmStatus vsm_declare_link (VsmClient client, const char *source, const char *zone, const char *target)
 Create link in zone. More...
 
VsmStatus vsm_list_declarations (VsmClient client, const char *zone, VsmArrayString *declarations)
 Get all declarations. More...
 
VsmStatus vsm_remove_declaration (VsmClient client, const char *zone, VsmString declaration)
 Remove declaration. More...
 
VsmStatus vsm_clean_up_zones_root (VsmClient client)
 Clean up zones root directory. More...
 
unsigned int vsm_addrlist_size (VsmAddrList addrs)
 Retrieve array size. More...
 
int vsm_addrlist_get_type (VsmAddrList addrs, unsigned int i)
 Get address type for i'th entry. More...
 
const void * vsm_addrlist_get_addr (VsmAddrList addrs, unsigned int i)
 Get pointer to in_addr property for i'th entry see inet_ntop man pages. More...
 
unsigned int vsm_addrlist_get_prefix (VsmAddrList addrs, unsigned int i)
 Get address prefix for i'th entry. More...
 

Detailed Description

C library for interfacing Vasum.

All functionalities that are possible using the Vasum's Command Line Interface can also be done with libvasum-client's calls.

Simple usage:
Basic usage:
#include <stdio.h>
#include <vasum-client.h>
int main(int argc, char** argv)
{
VsmStatus status;
VsmClient client;
VsmArrayString values = NULL;
int ret = 0;
// Create client handle
client = vsm_client_create();
if (NULL == client) {
// error!
ret = 1;
goto finish;
}
// Connect to Vasum
status = vsm_connect(client);
if (VSMCLIENT_SUCCESS != status) {
// error!
ret = 1;
goto finish;
}
status = vsm_get_zone_ids(client, &values);
if (VSMCLIENT_SUCCESS != status) {
// error!
ret = 1;
goto finish;
}
// print array
for (VsmArrayString iValues = values; *iValues; iValues++) {
printf("%s\n", *iValues);
}
finish:
vsm_array_string_free(values); // free memory
vsm_client_free(client); // destroy client handle
return ret;
}
Polling loop

By default libVasum will create a separate thread for his communication with Vasum. Most of the time it'll sleep so it shouldn't be a concern. It's also possible to connect to an existing polling loop. To do this you'll need to:

For example:

#include <pthread.h>
#include <assert.h>
#include <stdio.h>
#include <signal.h>
#include <sys/epoll.h>
#include <vasum-client.h>
volatile static sig_atomic_t running;
static int LOOP_INTERVAL = 1000; // ms
void* main_loop(void* client)
{
int fd = -1;
VsmStatus status = vsm_get_poll_fd(client, &fd);
assert(VSMCLIENT_SUCCESS == status);
while (running) {
struct epoll_event event;
int num = epoll_wait(fd, &event, 1, LOOP_INTERVAL);
if (num > 0) {
status = vsm_enter_eventloop(client, 0 , 0);
assert(VSMCLIENT_SUCCESS == status);
}
}
return NULL;
}
int main(int argc, char** argv)
{
pthread_t loop;
VsmStatus status;
VsmClient client;
int ret = 0;
client = vsm_client_create();
assert(client);
assert(VSMCLIENT_SUCCESS == status);
status = vsm_connect(client);
assert(VSMCLIENT_SUCCESS == status);
// start event loop
running = 1;
ret = pthread_create(&loop, NULL, main_loop, client);
assert(ret == 0);
// make vsm_* calls on client
// ...
status = vsm_disconnect(client);
assert(VSMCLIENT_SUCCESS == status);
//stop event loop
running = 0;
ret = pthread_join(loop, NULL);
assert(ret == 0);
vsm_client_free(client); // destroy client handle
return ret;
}

Typedef Documentation

typedef void* VsmAddrList

NULL-terminated array of strings type.

See Also
vsm_array_string_free
typedef void* VsmClient

vasum-server's opaque client pointer.

typedef void* VsmNetdev

Network device information.

typedef char* VsmString

NULL-terminated string type.

See Also
vsm_string_free
typedef unsigned int VsmSubscriptionId

Subscription id.

typedef void* VsmZone

Zone information.

typedef void(* VsmZoneDbusStateCallback)(const char *zoneId, const char *address, void *data)

Zone's D-Bus state change callback function signature.

Parameters
[in]zoneIdaffected zone id
[in]addressnew D-Bus address
datacustom user's data pointer passed to vsm_add_state_callback() function

Enumeration Type Documentation

Event dispacher types.

Enumerator
VSMDISPATCHER_EXTERNAL 

User must handle dispatching messages.

VSMDISPATCHER_INTERNAL 

Library will take care of dispatching messages.

File type.

Enumerator
VSMFILE_DIRECTORY 
VSMFILE_FIFO 
VSMFILE_REGULAR 

Netowrk device type.

Enumerator
VSMNETDEV_VETH 
VSMNETDEV_PHYS 
VSMNETDEV_MACVLAN 
enum VsmStatus

Completion status of libvasum-client's functions.

Enumerator
VSMCLIENT_CUSTOM_ERROR 

User specified error.

VSMCLIENT_IO_ERROR 

Input/Output error.

VSMCLIENT_OPERATION_FAILED 

Operation failed.

VSMCLIENT_INVALID_ARGUMENT 

Invalid argument.

VSMCLIENT_OTHER_ERROR 

Other error.

VSMCLIENT_SUCCESS 

Success.

States of zone.

Enumerator
STOPPED 
STARTING 
RUNNING 
STOPPING 
ABORTING 
FREEZING 
FROZEN 
THAWED 
LOCKED 
MAX_STATE 
ACTIVATING 

Function Documentation

VsmStatus vsm_add_state_callback ( VsmClient  client,
VsmZoneDbusStateCallback  zoneDbusStateCallback,
void *  data,
VsmSubscriptionId subscriptionId 
)

Register dbus state change callback function.

Note
The callback function will be invoked on a different thread.
Parameters
[in]clientvasum-server's client
[in]zoneDbusStateCallbackcallback function
[in]datasome extra data that will be passed to callback function
[out]subscriptionIdsubscription identifier that can be used to unsubscribe signal, pointer can be NULL.
Returns
status of this function call
void vsm_addrlist_free ( VsmAddrList  addrs)

Release VsmAddrList.

Parameters
addrsVsmAddrList
const void* vsm_addrlist_get_addr ( VsmAddrList  addrs,
unsigned int  i 
)

Get pointer to in_addr property for i'th entry see inet_ntop man pages.

Returns
poiner of in_addr
unsigned int vsm_addrlist_get_prefix ( VsmAddrList  addrs,
unsigned int  i 
)

Get address prefix for i'th entry.

Returns
adress prefix (mask bits count)
int vsm_addrlist_get_type ( VsmAddrList  addrs,
unsigned int  i 
)

Get address type for i'th entry.

Returns
network type (AF_INET or AF_INET6)
unsigned int vsm_addrlist_size ( VsmAddrList  addrs)

Retrieve array size.

Returns
array size
void vsm_array_string_free ( VsmArrayString  astring)

Release VsmArrayString.

Parameters
[in]astringVsmArrayString
VsmStatus vsm_clean_up_zones_root ( VsmClient  client)

Clean up zones root directory.

Removes all unknown zones root directory entry

Returns
status of this function call
VsmClient vsm_client_create ( )

Create a new vasum-server's client.

Returns
Created client pointer or NULL on failure.
void vsm_client_free ( VsmClient  client)

Release client resources.

Parameters
[in]clientvasum-server's client
VsmStatus vsm_connect ( VsmClient  client)

Connect client to the vasum-server.

Parameters
[in]clientvasum-server's client
Returns
status of this function call
VsmStatus vsm_connect_custom ( VsmClient  client,
const char *  address 
)

Connect client to the vasum-server via custom address.

Parameters
[in]clientvasum-server's client
[in]addressdbus address
Returns
status of this function call
VsmStatus vsm_create_netdev_macvlan ( VsmClient  client,
const char *  zone,
const char *  zoneDev,
const char *  hostDev,
enum macvlan_mode  mode 
)

Create macvlan in zone.

Parameters
[in]clientvasum-server's client
[in]zoneZone name
[in]zoneDevDevice ID in Zone network
[in]hostDevDevice ID in Host network
[in]modeMode with which macvlan will be created.
Returns
status of this function call
See Also
macvlan_mode
VsmStatus vsm_create_netdev_phys ( VsmClient  client,
const char *  zone,
const char *  devId 
)

Create/move phys netdev in/to zone.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]devIdnetwork device id
Returns
status of this function call
VsmStatus vsm_create_netdev_veth ( VsmClient  client,
const char *  zone,
const char *  zoneDev,
const char *  hostDev 
)

Create veth netdev in zone.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]zoneDevDevice ID in Zone network
[in]hostDevDevice ID in Host network
Returns
status of this function call
VsmStatus vsm_create_zone ( VsmClient  client,
const char *  id,
const char *  tname 
)

Create and add zone.

Parameters
[in]clientvasum-server's client
[in]idzone id
[in]tnametemplate name, NULL is equivalent to "default"
Returns
status of this function call
VsmStatus vsm_declare_file ( VsmClient  client,
const char *  zone,
VsmFileType  type,
const char *  path,
int32_t  flags,
mode_t  mode 
)

Create file, directory or pipe in zone.

Declare file, directory or pipe that will be created while zone startup

Parameters
[in]clientvasum-server's client
[in]typefile type
[in]zonezone id
[in]pathpath to file
[in]flagsif O_CREAT bit is set then file will be created in zone, otherwise file will by copied from host; it is meaningful only when O_CREAT is set
[in]modemode of file
Returns
status of this function call
VsmStatus vsm_declare_link ( VsmClient  client,
const char *  source,
const char *  zone,
const char *  target 
)

Create link in zone.

Declare link that will be created while zone startup Parameters are passed to link system function

Parameters
[in]clientvasum-server's client
[in]sourcepath to link source (in host)
[in]zonezone id
[in]targetpath to link name (in zone)
Returns
status of this function call
VsmStatus vsm_declare_mount ( VsmClient  client,
const char *  source,
const char *  zone,
const char *  target,
const char *  type,
uint64_t  flags,
const char *  data 
)

Create mount point in zone.

Declare mount that will be created while zone startup Parameters are passed to mount system function

Parameters
[in]clientvasum-server's client
[in]sourcedevice path (path in host)
[in]zonezone id
[in]targetmount point (path in zone)
[in]typefilesystem type
[in]flagsmount flags as in mount function
[in]dataadditional data as in mount function
Returns
status of this function call
VsmStatus vsm_del_state_callback ( VsmClient  client,
VsmSubscriptionId  subscriptionId 
)

Unregister dbus state change callback function.

Parameters
[in]clientvasum-server's client
[in]subscriptionIdsubscription identifier returned by vsm_add_state_callback
Returns
status of this function call
VsmStatus vsm_destroy_netdev ( VsmClient  client,
const char *  zone,
const char *  devId 
)

Remove netdev from zone.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]devIdnetwork device id
Returns
status of this function call
VsmStatus vsm_destroy_zone ( VsmClient  client,
const char *  id,
int  force 
)

Remove zone.

Parameters
[in]clientvasum-server's client
[in]idzone id
[in]forceif 0 data will be kept, otherwise data will be lost
Returns
status of this function call
VsmStatus vsm_disconnect ( VsmClient  client)

Disconnect client from vasum-server.

Parameters
[in]clientvasum-server's client
Returns
status of this function call
VsmStatus vsm_enter_eventloop ( VsmClient  client,
int  flags,
int  timeout 
)

Wait for an I/O event on a vsm client.

vsm_enter_eventloop() waits for event on the vsm client

The call waits for a maximum time of timout milliseconds. Specifying a timeout of -1 makes vsm_enter_eventloop() wait indefinitely, while specifying a timeout equal to zero makes vsm_enter_eventloop() to return immediately even if no events are available.

Parameters
[in]clientvasum-server's client
[in]flagsReserved
[in]timeoutTimeout time (milisecond), -1 is infinite
Returns
status of this function call
VsmStatus vsm_get_active_zone_id ( VsmClient  client,
VsmString id 
)

Get active (foreground) zone name.

Parameters
[in]clientvasum-server's client
[out]idactive zone name
Returns
status of this function call
Remarks
Use vsm_string_free() to free memory occupied by id.
VsmStatus vsm_get_dispatcher_type ( VsmClient  client,
VsmDispacherType dispacher 
)

Get dispatching method.

Parameters
[in]clientvasum-server's client
[out]dispacherdispatching method
Returns
status of this function call
VsmStatus vsm_get_poll_fd ( VsmClient  client,
int *  fd 
)

Get file descriptor associated with event dispatcher of zone client.

The function vsm_get_poll_fd() returns the file descriptor associated with the event dispatcher of vsm client. The file descriptor can be bound to another I/O multiplexing facilities like epoll, select, and poll.

Parameters
[in]clientvsm client
[out]fdepoll file descriptor
Returns
status of this function call
VsmStatus vsm_get_status ( VsmClient  client)

Get status code of last vasum-server communication.

Parameters
[in]clientvasum-server's client
Returns
status of this function call
const char* vsm_get_status_message ( VsmClient  client)

Get status message of the last vasum-server communication.

Parameters
[in]clientvasum-server's client
Returns
last status message from vasum-server communication
VsmStatus vsm_get_zone_dbuses ( VsmClient  client,
VsmArrayString keys,
VsmArrayString values 
)

Get dbus address of each zone.

Parameters
[in]clientvasum-server's client
[out]keysarray of zones name
[out]valuesarray of zones dbus address
Returns
status of this function call
Postcondition
keys[i] corresponds to values[i]
Remarks
Use vsm_array_string_free() to free memory occupied by keys and values.
VsmStatus vsm_get_zone_ids ( VsmClient  client,
VsmArrayString array 
)

Get zones name.

Parameters
[in]clientvasum-server's client
[out]arrayarray of zones name
Returns
status of this function call
Remarks
Use vsm_array_string_free() to free memory occupied by array.
VsmStatus vsm_grant_device ( VsmClient  client,
const char *  zone,
const char *  device,
uint32_t  flags 
)

Grant access to device.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]devicedevice path
[in]flagsaccess flags
Returns
status of this function call
VsmStatus vsm_list_declarations ( VsmClient  client,
const char *  zone,
VsmArrayString declarations 
)

Get all declarations.

Gets all declarations of resourcies (

See Also
vsm_declare_link,
vsm_declare_mount,
vsm_declare_file)
Parameters
[in]clientvasum-server's client
[in]zonezone id
[out]declarationsarray of declarations id
Returns
status of this function call
VsmStatus vsm_lock_queue ( VsmClient  client)

Lock the command queue exclusively.

Parameters
[in]clientvasum-server's client
Returns
status of this function call
VsmStatus vsm_lock_zone ( VsmClient  client,
const char *  id 
)

Lock zone.

Parameters
[in]clientvasum-server's client
[in]idzone name
Returns
status of this function call
VsmStatus vsm_lookup_netdev_by_name ( VsmClient  client,
const char *  zone,
const char *  netdevId,
VsmNetdev netdev 
)

Get netdev informations.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetwork device id
[out]netdevnetdev informations
Returns
status of this function call
Remarks
Use vsm_netdev_free() to free memory occupied by netdev.
VsmStatus vsm_lookup_zone_by_id ( VsmClient  client,
const char *  id,
VsmZone zone 
)

Get zone informations of zone with given id.

Parameters
[in]clientvasum-server's client
[in]idzone name
[out]zonezone informations
Returns
status of this function call
Remarks
Use vsm_zone_free() to free memory occupied by zone
VsmStatus vsm_lookup_zone_by_pid ( VsmClient  client,
int  pid,
VsmString id 
)

Get zone name of process with given pid.

Parameters
[in]clientvasum-server's client
[in]pidprocess id
[out]idactive zone name
Returns
status of this function call
Remarks
Use vsm_string_free() to free memory occupied by id.
VsmStatus vsm_lookup_zone_by_terminal_id ( VsmClient  client,
int  terminal,
VsmString id 
)

Get zone name with given terminal.

Parameters
[in]clientvasum-server's client
[in]terminalterminal id
[out]idzone name with given terminal
Returns
status of this function call
Remarks
Use vsm_string_free() to free memory occupied by id.
VsmStatus vsm_netdev_add_ipv4_addr ( VsmClient  client,
const char *  zone,
const char *  netdevId,
struct in_addr *  addr,
int  prefix 
)

Add ipv4 address for given netdevId.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetdev id
[in]addripv4 address
[in]prefixbit-length of the network prefix
Returns
status of this function call
VsmStatus vsm_netdev_add_ipv6_addr ( VsmClient  client,
const char *  zone,
const char *  netdevId,
struct in6_addr *  addr,
int  prefix 
)

Add ipv6 address for given netdevId.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetdev id
[in]addripv6 address
[in]prefixbit-length of the network prefix
Returns
status of this function call
VsmStatus vsm_netdev_del_ipv4_addr ( VsmClient  client,
const char *  zone,
const char *  netdevId,
struct in_addr *  addr,
int  prefix 
)

Remove ipv4 address from netdev.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetwork device id
[in]addripv4 address
[in]prefixbit-length of the network prefix
Returns
status of this function call
VsmStatus vsm_netdev_del_ipv6_addr ( VsmClient  client,
const char *  zone,
const char *  netdevId,
struct in6_addr *  addr,
int  prefix 
)

Remove ipv6 address from netdev.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetwork device id
[in]addripv6 address
[in]prefixbit-length of the network prefix
Returns
status of this function call
VsmStatus vsm_netdev_down ( VsmClient  client,
const char *  zone,
const char *  netdevId 
)

Turn down a network device in the zone.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetdev id
Returns
status of this function call
void vsm_netdev_free ( VsmNetdev  netdev)

Release VsmNetdev.

Parameters
netdevVsmNetdev
VsmStatus vsm_netdev_get_ip_addr ( VsmClient  client,
const char *  zone,
const char *  netdevId,
VsmAddrList addrs 
)

Get ipv4 address for given netdevId.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetdev id
[out]addrsip address array
Returns
status of this function call
Remarks
Use vsm_netdev_addr_free() to free memory occupied by address array.
VsmStatus vsm_netdev_get_ipv4_addr ( VsmClient  client,
const char *  zone,
const char *  netdevId,
struct in_addr *  addr 
)

Get ipv4 address for given netdevId.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetdev id
[out]addripv4 address
Returns
status of this function call
VsmStatus vsm_netdev_get_ipv6_addr ( VsmClient  client,
const char *  zone,
const char *  netdevId,
struct in6_addr *  addr 
)

Get ipv6 address for given netdevId.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetdev id
[out]addripv6 address
Returns
status of this function call
VsmString vsm_netdev_get_name ( VsmNetdev  netdev)

Get netdev name (offline)

Parameters
netdevVsmNetdev
Returns
netdev name
VsmNetdevType vsm_netdev_get_type ( VsmNetdev  netdev)

Get netdev type (offline)

Parameters
netdevVsmNetdev
Returns
netdev type
VsmStatus vsm_netdev_up ( VsmClient  client,
const char *  zone,
const char *  netdevId 
)

Turn up a network device in the zone.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]netdevIdnetdev id
Returns
status of this function call
VsmStatus vsm_remove_declaration ( VsmClient  client,
const char *  zone,
VsmString  declaration 
)

Remove declaration.

Removes given declaration by its id (

See Also
vsm_list_declarations)
Parameters
[in]clientvasum-server's client
[in]zonezone id
[in]declarationdeclaration id
Returns
status of this function call
VsmStatus vsm_revoke_device ( VsmClient  client,
const char *  zone,
const char *  device 
)

Revoke access to device.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[in]devicedevice path
Returns
status of this function call
VsmStatus vsm_set_active_zone ( VsmClient  client,
const char *  id 
)

Set active (foreground) zone.

Parameters
[in]clientvasum-server's client
[in]idzone name
Returns
status of this function call
VsmStatus vsm_set_dispatcher_type ( VsmClient  client,
VsmDispacherType  dispacher 
)

Set dispatching method.

Parameters
[in]clientvasum-server's client
[in]dispacherdispatching method
Returns
status of this function call
VsmStatus vsm_shutdown_zone ( VsmClient  client,
const char *  id 
)

Shutdown zone.

Parameters
[in]clientvasum-server's client
[in]idzone name
Returns
status of this function call
VsmStatus vsm_start_zone ( VsmClient  client,
const char *  id 
)

Start zone.

Parameters
[in]clientvasum-server's client
[in]idzone name
Returns
status of this function call
void vsm_string_free ( VsmString  string)

Release VsmString.

Parameters
stringVsmString
VsmStatus vsm_unlock_queue ( VsmClient  client)

Unlock the command queue.

Parameters
[in]clientvasum-server's client
Returns
status of this function call
VsmStatus vsm_unlock_zone ( VsmClient  client,
const char *  id 
)

Unlock zone.

Parameters
[in]clientvasum-server's client
[in]idzone name
Returns
status of this function call
void vsm_zone_free ( VsmZone  zone)

Release VsmZone.

Parameters
zoneVsmZone
VsmString vsm_zone_get_id ( VsmZone  zone)

Get zone id (offline)

Parameters
zoneVsmZone
Returns
zone id
VsmStatus vsm_zone_get_netdevs ( VsmClient  client,
const char *  zone,
VsmArrayString netdevIds 
)

Get array of netdev from given zone.

Parameters
[in]clientvasum-server's client
[in]zonezone name
[out]netdevIdsarray of netdev id
Returns
status of this function call
Remarks
Use vsm_array_string_free() to free memory occupied by netdevIds.
VsmString vsm_zone_get_rootfs ( VsmZone  zone)

Get zone rootfs path (offline)

Parameters
zoneVsmZone
Returns
zone rootfs path
VsmZoneState vsm_zone_get_state ( VsmZone  zone)

Get zone state (offline)

Parameters
zoneVsmZone
Returns
zone state
int vsm_zone_get_terminal ( VsmZone  zone)

Get zone terminal (offline)

Parameters
zoneVsmZone
Returns
zone terminal