Fix Doxygen warnings
[platform/core/security/vasum.git] / client / vasum-client.h
1 /*
2  *  Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Contact: Mateusz Malicki <m.malicki2@samsung.com>
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License
17  */
18
19
20 /**
21  * @file
22  * @author  Mateusz Malicki (m.malicki2@samsung.com)
23  * @brief   This file contains the public API for Vasum Client
24  *
25  * @par Example usage:
26  * @code
27 #include <stdio.h>
28 #include "client/vasum-client.h"
29
30 int main(int argc, char** argv)
31 {
32     VsmStatus status;
33     VsmClient client;
34     VsmArrayString values = NULL;
35     int ret = 0;
36
37     client = vsm_client_create(); // create client handle
38     if (NULL == client) {
39         // error!
40         ret = 1;
41         goto finish;
42     }
43
44     status = vsm_connect(client); // connect to dbus
45     if (VSMCLIENT_SUCCESS != status) {
46         // error!
47         ret = 1;
48         goto finish;
49     }
50
51     status = vsm_get_zone_ids(client, &values);
52     if (VSMCLIENT_SUCCESS != status) {
53         // error!
54         ret = 1;
55         goto finish;
56     }
57
58     // print array
59     for (VsmArrayString iValues = values; *iValues; iValues++) {
60         printf("%s\n", *iValues);
61     }
62
63 finish:
64     vsm_array_string_free(values); // free memory
65     vsm_client_free(client); // destroy client handle
66     return ret;
67 }
68  @endcode
69  */
70
71 #ifndef VASUM_CLIENT_H
72 #define VASUM_CLIENT_H
73
74 #include <stdint.h>
75 #include <sys/stat.h>
76 #include <netinet/ip.h>
77 #include <linux/if_link.h>
78
79 #ifdef __cplusplus
80 extern "C"
81 {
82 #endif
83
84 /**
85  * vasum-server's client pointer.
86  */
87 typedef void* VsmClient;
88
89 /**
90  * NULL-terminated string type.
91  *
92  * @sa vsm_array_string_free
93  */
94 typedef char* VsmString;
95
96 /**
97  * NULL-terminated array of strings type.
98  *
99  * @sa vsm_string_free
100  */
101 typedef VsmString* VsmArrayString;
102
103 /**
104  * Completion status of communication function.
105  */
106 typedef enum {
107     VSMCLIENT_CUSTOM_ERROR,     /**< User specified error */
108     VSMCLIENT_IO_ERROR,         /**< Input/Output error */
109     VSMCLIENT_OPERATION_FAILED, /**< Operation failed */
110     VSMCLIENT_INVALID_ARGUMENT, /**< Invalid argument */
111     VSMCLIENT_OTHER_ERROR,      /**< Other error */
112     VSMCLIENT_SUCCESS           /**< Success */
113 } VsmStatus;
114
115 /**
116  * Subscription id
117  */
118 typedef unsigned int VsmSubscriptionId;
119
120 /**
121  * States of zone
122  */
123 typedef enum {
124     STOPPED,
125     STARTING,
126     RUNNING,
127     STOPPING,
128     ABORTING,
129     FREEZING,
130     FROZEN,
131     THAWED,
132     LOCKED,
133     MAX_STATE,
134     ACTIVATING = 128
135 } VsmZoneState;
136
137 /**
138  * Zone information structure
139  */
140 typedef struct {
141     char* id;
142     int terminal;
143     VsmZoneState state;
144     char *rootfs_path;
145 } VsmZoneStructure;
146
147 /**
148  * Zone information
149  */
150 typedef VsmZoneStructure* VsmZone;
151
152 /**
153  * Netowrk device type
154  */
155 typedef enum {
156     VSMNETDEV_VETH,
157     VSMNETDEV_PHYS,
158     VSMNETDEV_MACVLAN
159 } VsmNetdevType;
160
161 /**
162  * Network device information structure
163  */
164 typedef struct {
165     char* name;
166     VsmNetdevType type;
167 } VsmNetdevStructure;
168
169 /**
170  * Network device information
171  */
172 typedef VsmNetdevStructure* VsmNetdev;
173
174 /**
175  * File type
176  */
177 typedef enum {
178     VSMFILE_DIRECTORY,
179     VSMFILE_FIFO,
180     VSMFILE_REGULAR
181 } VsmFileType;
182
183 /**
184  * Event dispacher types.
185  *
186  * @par Example usage:
187  * @code
188 #include <pthread.h>
189 #include <assert.h>
190 #include <stdio.h>
191 #include <signal.h>
192 #include <sys/epoll.h>
193 #include <vasum-client.h>
194
195 volatile static sig_atomic_t running;
196 static int LOOP_INTERVAL = 1000; // ms
197
198 void* main_loop(void* client)
199 {
200     int fd = -1;
201     VsmStatus status = vsm_get_poll_fd(client, &fd);
202     assert(VSMCLIENT_SUCCESS == status);
203
204     while (running) {
205         struct epoll_event event;
206         int num = epoll_wait(fd, &event, 1, LOOP_INTERVAL);
207         if (num > 0) {
208             status = vsm_enter_eventloop(client, 0 , 0);
209             assert(VSMCLIENT_SUCCESS == status);
210         }
211     }
212     return NULL;
213 }
214
215 int main(int argc, char** argv)
216 {
217     pthread_t loop;
218     VsmStatus status;
219     VsmClient client;
220     int ret = 0;
221
222     client = vsm_client_create();
223     assert(client);
224
225     status = vsm_set_dispatcher_type(client, VSMDISPATCHER_EXTERNAL);
226     assert(VSMCLIENT_SUCCESS == status);
227
228     status = vsm_connect(client);
229     assert(VSMCLIENT_SUCCESS == status);
230
231     // start event loop
232     running = 1;
233     ret = pthread_create(&loop, NULL, main_loop, client);
234     assert(ret == 0);
235
236     // make vsm_* calls on client
237     // ...
238
239     status = vsm_disconnect(client);
240     assert(VSMCLIENT_SUCCESS == status);
241
242     //stop event loop
243     running = 0;
244     ret = pthread_join(loop, NULL);
245     assert(ret == 0);
246
247     vsm_client_free(client); // destroy client handle
248     return ret;
249 }
250  @endcode
251  */
252 typedef enum {
253     VSMDISPATCHER_EXTERNAL,         /**< User must handle dispatching messages */
254     VSMDISPATCHER_INTERNAL          /**< Library will take care of dispatching messages */
255 } VsmDispacherType;
256
257 #ifndef __VASUM_WRAPPER_SOURCE__
258
259 /**
260  * Get file descriptor associated with event dispatcher of zone client
261  *
262  * The function vsm_get_poll_fd() returns the file descriptor associated with the event dispatcher of vsm client.
263  * The file descriptor can be bound to another I/O multiplexing facilities like epoll, select, and poll.
264  *
265  * @param[in] client vsm client
266  * @param[out] fd epoll file descriptor
267  * @return status of this function call
268 */
269 VsmStatus vsm_get_poll_fd(VsmClient client, int* fd);
270
271 /**
272  * Wait for an I/O event on a vsm client
273  *
274  * vsm_enter_eventloop() waits for event on the vsm client
275  *
276  * The call waits for a maximum time of timout milliseconds. Specifying a timeout of -1 makes vsm_enter_eventloop() wait indefinitely,
277  * while specifying a timeout equal to zero makes vsm_enter_eventloop() to return immediately even if no events are available.
278  *
279  * @param[in] client vasum-server's client
280  * @param[in] flags Reserved
281  * @param[in] timeout Timeout time (milisecond), -1 is infinite
282  * @return status of this function call
283 */
284 VsmStatus vsm_enter_eventloop(VsmClient client, int flags, int timeout);
285
286 /**
287  * Set dispatching method
288  *
289  * @param[in] client vasum-server's client
290  * @param[in] dispacher dispatching method
291  * @return status of this function call
292  */
293 VsmStatus vsm_set_dispatcher_type(VsmClient client, VsmDispacherType dispacher);
294
295 /**
296  * Get dispatching method
297  *
298  * @param[in] client vasum-server's client
299  * @param[out] dispacher dispatching method
300  * @return status of this function call
301  */
302 VsmStatus vsm_get_dispatcher_type(VsmClient client, VsmDispacherType* dispacher);
303
304 /**
305  * Create a new vasum-server's client.
306  *
307  * @return Created client pointer or NULL on failure.
308  */
309 VsmClient vsm_client_create();
310
311 /**
312  * Release client resources.
313  *
314  * @param[in] client vasum-server's client
315  */
316 void vsm_client_free(VsmClient client);
317
318 /**
319  * Get status code of last vasum-server communication.
320  *
321  * @param[in] client vasum-server's client
322  * @return status of this function call
323  */
324 VsmStatus vsm_get_status(VsmClient client);
325
326 /**
327  * Get status message of the last vasum-server communication.
328  *
329  * @param[in] client vasum-server's client
330  * @return last status message from vasum-server communication
331  */
332 const char* vsm_get_status_message(VsmClient client);
333
334 /**
335  * Connect client to the vasum-server.
336  *
337  * @param[in] client vasum-server's client
338  * @return status of this function call
339  */
340 VsmStatus vsm_connect(VsmClient client);
341
342 /**
343  * Connect client to the vasum-server via custom address.
344  *
345  * @param[in] client vasum-server's client
346  * @param[in] address dbus address
347  * @return status of this function call
348  */
349 VsmStatus vsm_connect_custom(VsmClient client, const char* address);
350
351 /**
352  * Disconnect client from vasum-server.
353  *
354  * @param[in] client vasum-server's client
355  * @return status of this function call
356  */
357 VsmStatus vsm_disconnect(VsmClient client);
358
359 /**
360  * Release VsmArrayString.
361  *
362  * @param[in] astring VsmArrayString
363  */
364 void vsm_array_string_free(VsmArrayString astring);
365
366 /**
367  * Release VsmString.
368  *
369  * @param string VsmString
370  */
371 void vsm_string_free(VsmString string);
372
373 /**
374  * Release VsmZone
375  *
376  * @param zone VsmZone
377  */
378 void vsm_zone_free(VsmZone zone);
379
380 /**
381  * Release VsmNetdev
382  *
383  * @param netdev VsmNetdev
384  */
385 void vsm_netdev_free(VsmNetdev netdev);
386
387 /**
388  * @name Host API
389  *
390  * Functions using org.tizen.vasum.host.manager D-Bus interface.
391  *
392  * @{
393  */
394
395 /**
396  * Zone's D-Bus state change callback function signature.
397  *
398  * @param[in] zoneId affected zone id
399  * @param[in] address new D-Bus address
400  * @param data custom user's data pointer passed to vsm_add_state_callback() function
401  */
402 typedef void (*VsmZoneDbusStateCallback)(const char* zoneId,
403                                              const char* address,
404                                              void* data);
405
406 /**
407  * Lock the command queue exclusively.
408  *
409  * @param[in] client vasum-server's client
410  * @return status of this function call
411  */
412 VsmStatus vsm_lock_queue(VsmClient client);
413
414 /**
415  * Unlock the command queue.
416  *
417  * @param[in] client vasum-server's client
418  * @return status of this function call
419  */
420 VsmStatus vsm_unlock_queue(VsmClient client);
421
422 /**
423  * Get dbus address of each zone.
424  *
425  * @param[in] client vasum-server's client
426  * @param[out] keys array of zones name
427  * @param[out] values array of zones dbus address
428  * @return status of this function call
429  * @post keys[i] corresponds to values[i]
430  * @remark Use vsm_array_string_free() to free memory occupied by @p keys and @p values.
431  */
432 VsmStatus vsm_get_zone_dbuses(VsmClient client, VsmArrayString* keys, VsmArrayString* values);
433
434 /**
435  * Get zones name.
436  *
437  * @param[in] client vasum-server's client
438  * @param[out] array array of zones name
439  * @return status of this function call
440  * @remark Use vsm_array_string_free() to free memory occupied by @p array.
441  */
442 VsmStatus vsm_get_zone_ids(VsmClient client, VsmArrayString* array);
443
444 /**
445  * Get active (foreground) zone name.
446  *
447  * @param[in] client vasum-server's client
448  * @param[out] id active zone name
449  * @return status of this function call
450  * @remark Use @p vsm_string_free() to free memory occupied by @p id.
451  */
452 VsmStatus vsm_get_active_zone_id(VsmClient client, VsmString* id);
453
454 /**
455  * Get zone rootfs path.
456  *
457  * @param[in] client vasum-server's client
458  * @param[in] id zone name
459  * @param[out] rootpath zone rootfs path
460  * @return status of this function call
461  * @remark Use @p vsm_string_free() to free memory occupied by @p rootpath.
462  */
463 VsmStatus vsm_get_zone_rootpath(VsmClient client, const char* id, VsmString* rootpath);
464
465 /**
466  * Get zone name of process with given pid.
467  *
468  * @param[in] client vasum-server's client
469  * @param[in] pid process id
470  * @param[out] id active zone name
471  * @return status of this function call
472  * @remark Use @p vsm_string_free() to free memory occupied by @p id.
473  */
474 VsmStatus vsm_lookup_zone_by_pid(VsmClient client, int pid, VsmString* id);
475
476 /**
477  * Get zone informations of zone with given id.
478  *
479  * @param[in] client vasum-server's client
480  * @param[in] id zone name
481  * @param[out] zone zone informations
482  * @return status of this function call
483  * @remark Use @p vsm_zone_free() to free memory occupied by @p zone
484  */
485 VsmStatus vsm_lookup_zone_by_id(VsmClient client, const char* id, VsmZone* zone);
486
487 /**
488  * Get zone name with given terminal.
489  *
490  * @param[in] client vasum-server's client
491  * @param[in] terminal terminal id
492  * @param[out] id zone name with given terminal
493  * @return status of this function call
494  * @remark Use @p vsm_string_free() to free memory occupied by @p id.
495  */
496 VsmStatus vsm_lookup_zone_by_terminal_id(VsmClient client, int terminal, VsmString* id);
497
498 /**
499  * Set active (foreground) zone.
500  *
501  * @param[in] client vasum-server's client
502  * @param[in] id zone name
503  * @return status of this function call
504  */
505 VsmStatus vsm_set_active_zone(VsmClient client, const char* id);
506
507 /**
508  * Create and add zone
509  *
510  * @param[in] client vasum-server's client
511  * @param[in] id zone id
512  * @param[in] tname template name, NULL is equivalent to "default"
513  * @return status of this function call
514  */
515 VsmStatus vsm_create_zone(VsmClient client, const char* id, const char* tname);
516
517 /**
518  * Remove zone
519  *
520  * @param[in] client vasum-server's client
521  * @param[in] id zone id
522  * @param[in] force if 0 data will be kept, otherwise data will be lost
523  * @return status of this function call
524  */
525 VsmStatus vsm_destroy_zone(VsmClient client, const char* id, int force);
526
527 /**
528  * Shutdown zone
529  *
530  * @param[in] client vasum-server's client
531  * @param[in] id zone name
532  * @return status of this function call
533  */
534 VsmStatus vsm_shutdown_zone(VsmClient client, const char* id);
535
536 /**
537  * Start zone
538  *
539  * @param[in] client vasum-server's client
540  * @param[in] id zone name
541  * @return status of this function call
542  */
543 VsmStatus vsm_start_zone(VsmClient client, const char* id);
544
545 /**
546  * Lock zone
547  *
548  * @param[in] client vasum-server's client
549  * @param[in] id zone name
550  * @return status of this function call
551  */
552 VsmStatus vsm_lock_zone(VsmClient client, const char* id);
553
554 /**
555  * Unlock zone
556  *
557  * @param[in] client vasum-server's client
558  * @param[in] id zone name
559  * @return status of this function call
560  */
561 VsmStatus vsm_unlock_zone(VsmClient client, const char* id);
562
563 /**
564  * Register dbus state change callback function.
565  *
566  * @note The callback function will be invoked on a different thread.
567  *
568  * @param[in] client vasum-server's client
569  * @param[in] zoneDbusStateCallback callback function
570  * @param[in] data some extra data that will be passed to callback function
571  * @param[out] subscriptionId subscription identifier that can be used to unsubscribe signal,
572  *                      pointer can be NULL.
573  * @return status of this function call
574  */
575 VsmStatus vsm_add_state_callback(VsmClient client,
576                                  VsmZoneDbusStateCallback zoneDbusStateCallback,
577                                  void* data,
578                                  VsmSubscriptionId* subscriptionId);
579
580 /**
581  * Unregister dbus state change callback function.
582  *
583  * @param[in] client vasum-server's client
584  * @param[in] subscriptionId subscription identifier returned by vsm_add_state_callback
585  * @return status of this function call
586  */
587 VsmStatus vsm_del_state_callback(VsmClient client, VsmSubscriptionId subscriptionId);
588
589 /**
590  * Grant access to device
591  *
592  * @param[in] client vasum-server's client
593  * @param[in] zone zone name
594  * @param[in] device device path
595  * @param[in] flags access flags
596  * @return status of this function call
597  */
598 VsmStatus vsm_grant_device(VsmClient client,
599                            const char* zone,
600                            const char* device,
601                            uint32_t flags);
602
603 /**
604  * Revoke access to device
605  *
606  * @param[in] client vasum-server's client
607  * @param[in] zone zone name
608  * @param[in] device device path
609  * @return status of this function call
610  */
611 VsmStatus vsm_revoke_device(VsmClient client, const char* zone, const char* device);
612
613 /**
614  * Get array of netdev from given zone
615  *
616  * @param[in] client vasum-server's client
617  * @param[in] zone zone name
618  * @param[out] netdevIds array of netdev id
619  * @return status of this function call
620  * @remark Use vsm_array_string_free() to free memory occupied by @p netdevIds.
621  */
622 VsmStatus vsm_zone_get_netdevs(VsmClient client, const char* zone, VsmArrayString* netdevIds);
623
624 /**
625  * Get ipv4 address for given netdevId
626  *
627  * @param[in] client vasum-server's client
628  * @param[in] zone zone name
629  * @param[in] netdevId netdev id
630  * @param[out] addr ipv4 address
631  * @return status of this function call
632  */
633 VsmStatus vsm_netdev_get_ipv4_addr(VsmClient client,
634                                    const char* zone,
635                                    const char* netdevId,
636                                    struct in_addr *addr);
637
638 /**
639  * Get ipv6 address for given netdevId
640  *
641  * @param[in] client vasum-server's client
642  * @param[in] zone zone name
643  * @param[in] netdevId netdev id
644  * @param[out] addr ipv6 address
645  * @return status of this function call
646  */
647 VsmStatus vsm_netdev_get_ipv6_addr(VsmClient client,
648                                    const char* zone,
649                                    const char* netdevId,
650                                    struct in6_addr *addr);
651
652 /**
653  * Set ipv4 address for given netdevId
654  *
655  * @param[in] client vasum-server's client
656  * @param[in] zone zone name
657  * @param[in] netdevId netdev id
658  * @param[in] addr ipv4 address
659  * @param[in] prefix bit-length of the network prefix
660  * @return status of this function call
661  */
662 VsmStatus vsm_netdev_set_ipv4_addr(VsmClient client,
663                                    const char* zone,
664                                    const char* netdevId,
665                                    struct in_addr *addr,
666                                    int prefix);
667
668 /**
669  * Set ipv6 address for given netdevId
670  *
671  * @param[in] client vasum-server's client
672  * @param[in] zone zone name
673  * @param[in] netdevId netdev id
674  * @param[in] addr ipv6 address
675  * @param[in] prefix bit-length of the network prefix
676  * @return status of this function call
677  */
678 VsmStatus vsm_netdev_set_ipv6_addr(VsmClient client,
679                                    const char* zone,
680                                    const char* netdevId,
681                                    struct in6_addr *addr,
682                                    int prefix);
683
684 /**
685  * Remove ipv4 address from netdev
686  *
687  * @param[in] client vasum-server's client
688  * @param[in] zone zone name
689  * @param[in] netdevId network device id
690  * @param[in] addr ipv4 address
691  * @param[in] prefix bit-length of the network prefix
692  * @return status of this function call
693  */
694 VsmStatus vsm_netdev_del_ipv4_addr(VsmClient client,
695                                    const char* zone,
696                                    const char* netdevId,
697                                    struct in_addr* addr,
698                                    int prefix);
699
700 /**
701  * Remove ipv6 address from netdev
702  *
703  * @param[in] client vasum-server's client
704  * @param[in] zone zone name
705  * @param[in] netdevId network device id
706  * @param[in] addr ipv6 address
707  * @param[in] prefix bit-length of the network prefix
708  * @return status of this function call
709  */
710 VsmStatus vsm_netdev_del_ipv6_addr(VsmClient client,
711                                    const char* zone,
712                                    const char* netdevId,
713                                    struct in6_addr* addr,
714                                    int prefix);
715
716 /**
717  * Turn up a network device in the zone
718  *
719  * @param[in] client vasum-server's client
720  * @param[in] zone zone name
721  * @param[in] netdevId netdev id
722  * @return status of this function call
723  */
724 VsmStatus vsm_netdev_up(VsmClient client,
725                         const char* zone,
726                         const char* netdevId);
727
728 /**
729  * Turn down a network device in the zone
730  *
731  * @param[in] client vasum-server's client
732  * @param[in] zone zone name
733  * @param[in] netdevId netdev id
734  * @return status of this function call
735  */
736 VsmStatus vsm_netdev_down(VsmClient client,
737                           const char* zone,
738                           const char* netdevId);
739
740
741 /**
742  * Create veth netdev in zone
743  *
744  * @param[in] client vasum-server's client
745  * @param[in] zone zone name
746  * @param[in] zoneDev  Device ID in Zone network
747  * @param[in] hostDev  Device ID in Host network
748  * @return status of this function call
749  */
750 VsmStatus vsm_create_netdev_veth(VsmClient client,
751                                  const char* zone,
752                                  const char* zoneDev,
753                                  const char* hostDev);
754 /**
755  * Create macvlan in zone
756  *
757  * @param[in] client   vasum-server's client
758  * @param[in] zone     Zone name
759  * @param[in] zoneDev  Device ID in Zone network
760  * @param[in] hostDev  Device ID in Host network
761  * @param[in] mode     Mode with which macvlan will be created.
762  * @return status of this function call
763  *
764  * @see macvlan_mode
765  */
766 VsmStatus vsm_create_netdev_macvlan(VsmClient client,
767                                     const char* zone,
768                                     const char* zoneDev,
769                                     const char* hostDev,
770                                     enum macvlan_mode mode);
771 /**
772  * Create/move phys netdev in/to zone
773  *
774  * @param[in] client vasum-server's client
775  * @param[in] zone zone name
776  * @param[in] devId network device id
777  * @return status of this function call
778  */
779 VsmStatus vsm_create_netdev_phys(VsmClient client, const char* zone, const char* devId);
780
781 /**
782  * Get netdev informations
783  *
784  * @param[in] client vasum-server's client
785  * @param[in] zone zone name
786  * @param[in] netdevId network device id
787  * @param[out] netdev netdev informations
788  * @return status of this function call
789  * @remark Use vsm_netdev_free() to free memory occupied by @p netdev.
790  */
791 VsmStatus vsm_lookup_netdev_by_name(VsmClient client,
792                                     const char* zone,
793                                     const char* netdevId,
794                                     VsmNetdev* netdev);
795
796 /**
797  * Remove netdev from zone
798  *
799  * @param[in] client vasum-server's client
800  * @param[in] zone zone name
801  * @param[in] devId network device id
802  * @return status of this function call
803  */
804 VsmStatus vsm_destroy_netdev(VsmClient client, const char* zone, const char* devId);
805
806 /**
807  * Create file, directory or pipe in zone
808  *
809  * Declare file, directory or pipe that will be created while zone startup
810  *
811  * @param[in] client vasum-server's client
812  * @param[in] type file type
813  * @param[in] zone zone id
814  * @param[in] path path to file
815  * @param[in] flags if O_CREAT bit is set then file will be created in zone,
816  *                  otherwise file will by copied from host;
817  *                  it is meaningful only when O_CREAT is set
818  * @param[in] mode mode of file
819  * @return status of this function call
820  */
821 VsmStatus vsm_declare_file(VsmClient client,
822                            const char* zone,
823                            VsmFileType type,
824                            const char* path,
825                            int32_t flags,
826                            mode_t mode);
827
828 /**
829  * Create mount point in zone
830  *
831  * Declare mount that will be created while zone startup
832  * Parameters are passed to mount system function
833  *
834  * @param[in] client vasum-server's client
835  * @param[in] source device path (path in host)
836  * @param[in] zone zone id
837  * @param[in] target mount point (path in zone)
838  * @param[in] type filesystem type
839  * @param[in] flags mount flags as in mount function
840  * @param[in] data additional data as in mount function
841  * @return status of this function call
842  */
843 VsmStatus vsm_declare_mount(VsmClient client,
844                             const char* source,
845                             const char* zone,
846                             const char* target,
847                             const char* type,
848                             uint64_t flags,
849                             const char* data);
850
851 /**
852  * Create link in zone
853  *
854  * Declare link that will be created while zone startup
855  * Parameters are passed to link system function
856  *
857  * @param[in] client vasum-server's client
858  * @param[in] source path to link source (in host)
859  * @param[in] zone zone id
860  * @param[in] target path to link name (in zone)
861  * @return status of this function call
862  */
863 VsmStatus vsm_declare_link(VsmClient client,
864                            const char *source,
865                            const char* zone,
866                            const char *target);
867
868 /**
869  * Get all declarations
870  *
871  * Gets all declarations of resourcies
872  * (@see ::vsm_declare_link, @see ::vsm_declare_mount, @see ::vsm_declare_file)
873  *
874  * @param[in] client vasum-server's client
875  * @param[in] zone zone id
876  * @param[out] declarations array of declarations id
877  * @return status of this function call
878  */
879 VsmStatus vsm_list_declarations(VsmClient client,
880                                 const char* zone,
881                                 VsmArrayString* declarations);
882
883 /**
884  * Remove declaration
885  *
886  * Removes given declaration by its id (@see ::vsm_list_declarations)
887  *
888  * @param[in] client vasum-server's client
889  * @param[in] zone zone id
890  * @param[in] declaration declaration id
891  * @return status of this function call
892  */
893 VsmStatus vsm_remove_declaration(VsmClient client,
894                                  const char* zone,
895                                  VsmString declaration);
896
897
898 /** @} Host API */
899
900
901 #endif /* __VASUM_WRAPPER_SOURCE__ */
902
903 #ifdef __cplusplus
904 }
905 #endif
906
907 #endif /* VASUM_CLIENT_H */