Add vsm_get_event_fd and vsm_enter_eventloop
[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  * Get dbus address of each zone.
408  *
409  * @param[in] client vasum-server's client
410  * @param[out] keys array of zones name
411  * @param[out] values array of zones dbus address
412  * @return status of this function call
413  * @post keys[i] corresponds to values[i]
414  * @remark Use vsm_array_string_free() to free memory occupied by @p keys and @p values.
415  */
416 VsmStatus vsm_get_zone_dbuses(VsmClient client, VsmArrayString* keys, VsmArrayString* values);
417
418 /**
419  * Get zones name.
420  *
421  * @param[in] client vasum-server's client
422  * @param[out] array array of zones name
423  * @return status of this function call
424  * @remark Use vsm_array_string_free() to free memory occupied by @p array.
425  */
426 VsmStatus vsm_get_zone_ids(VsmClient client, VsmArrayString* array);
427
428 /**
429  * Get active (foreground) zone name.
430  *
431  * @param[in] client vasum-server's client
432  * @param[out] id active zone name
433  * @return status of this function call
434  * @remark Use @p vsm_string_free() to free memory occupied by @p id.
435  */
436 VsmStatus vsm_get_active_zone_id(VsmClient client, VsmString* id);
437
438 /**
439  * Get zone rootfs path.
440  *
441  * @param[in] client vasum-server's client
442  * @param[in] id zone name
443  * @param[out] rootpath zone rootfs path
444  * @return status of this function call
445  * @remark Use @p vsm_string_free() to free memory occupied by @p rootpath.
446  */
447 VsmStatus vsm_get_zone_rootpath(VsmClient client, const char* id, VsmString* rootpath);
448
449 /**
450  * Get zone name of process with given pid.
451  *
452  * @param[in] client vasum-server's client
453  * @param[in] pid process id
454  * @param[out] id active zone name
455  * @return status of this function call
456  * @remark Use @p vsm_string_free() to free memory occupied by @p id.
457  */
458 VsmStatus vsm_lookup_zone_by_pid(VsmClient client, int pid, VsmString* id);
459
460 /**
461  * Get zone informations of zone with given id.
462  *
463  * @param[in] client vasum-server's client
464  * @param[in] id zone name
465  * @param[out] zone zone informations
466  * @return status of this function call
467  * @remark Use @p vsm_zone_free() to free memory occupied by @p zone
468  */
469 VsmStatus vsm_lookup_zone_by_id(VsmClient client, const char* id, VsmZone* zone);
470
471 /**
472  * Get zone name with given terminal.
473  *
474  * @param[in] client vasum-server's client
475  * @param[in] terminal terminal id
476  * @param[out] id zone name with given terminal
477  * @return status of this function call
478  * @remark Use @p vsm_string_free() to free memory occupied by @p id.
479  */
480 VsmStatus vsm_lookup_zone_by_terminal_id(VsmClient client, int terminal, VsmString* id);
481
482 /**
483  * Set active (foreground) zone.
484  *
485  * @param[in] client vasum-server's client
486  * @param[in] id zone name
487  * @return status of this function call
488  */
489 VsmStatus vsm_set_active_zone(VsmClient client, const char* id);
490
491 /**
492  * Create and add zone
493  *
494  * @param[in] client vasum-server's client
495  * @param[in] id zone id
496  * @param[in] tname template name, NULL is equivalent to "default"
497  * @return status of this function call
498  */
499 VsmStatus vsm_create_zone(VsmClient client, const char* id, const char* tname);
500
501 /**
502  * Remove zone
503  *
504  * @param[in] client vasum-server's client
505  * @param[in] id zone id
506  * @param[in] force if 0 data will be kept, otherwise data will be lost
507  * @return status of this function call
508  */
509 VsmStatus vsm_destroy_zone(VsmClient client, const char* id, int force);
510
511 /**
512  * Shutdown zone
513  *
514  * @param[in] client vasum-server's client
515  * @param[in] id zone name
516  * @return status of this function call
517  */
518 VsmStatus vsm_shutdown_zone(VsmClient client, const char* id);
519
520 /**
521  * Start zone
522  *
523  * @param[in] client vasum-server's client
524  * @param[in] id zone name
525  * @return status of this function call
526  */
527 VsmStatus vsm_start_zone(VsmClient client, const char* id);
528
529 /**
530  * Lock zone
531  *
532  * @param[in] client vasum-server's client
533  * @param[in] id zone name
534  * @return status of this function call
535  */
536 VsmStatus vsm_lock_zone(VsmClient client, const char* id);
537
538 /**
539  * Unlock zone
540  *
541  * @param[in] client vasum-server's client
542  * @param[in] id zone name
543  * @return status of this function call
544  */
545 VsmStatus vsm_unlock_zone(VsmClient client, const char* id);
546
547 /**
548  * Register dbus state change callback function.
549  *
550  * @note The callback function will be invoked on a different thread.
551  *
552  * @param[in] client vasum-server's client
553  * @param[in] zoneDbusStateCallback callback function
554  * @param[in] data some extra data that will be passed to callback function
555  * @param[out] subscriptionId subscription identifier that can be used to unsubscribe signal,
556  *                      pointer can be NULL.
557  * @return status of this function call
558  */
559 VsmStatus vsm_add_state_callback(VsmClient client,
560                                  VsmZoneDbusStateCallback zoneDbusStateCallback,
561                                  void* data,
562                                  VsmSubscriptionId* subscriptionId);
563
564 /**
565  * Unregister dbus state change callback function.
566  *
567  * @param[in] client vasum-server's client
568  * @param[in] subscriptionId subscription identifier returned by vsm_add_state_callback
569  * @return status of this function call
570  */
571 VsmStatus vsm_del_state_callback(VsmClient client, VsmSubscriptionId subscriptionId);
572
573 /**
574  * Grant access to device
575  *
576  * @param[in] client vasum-server's client
577  * @param[in] zone zone name
578  * @param[in] device device path
579  * @param[in] flags access flags
580  * @return status of this function call
581  */
582 VsmStatus vsm_grant_device(VsmClient client,
583                            const char* zone,
584                            const char* device,
585                            uint32_t flags);
586
587 /**
588  * Revoke access to device
589  *
590  * @param[in] client vasum-server's client
591  * @param[in] zone zone name
592  * @param[in] device device path
593  * @return status of this function call
594  */
595 VsmStatus vsm_revoke_device(VsmClient client, const char* zone, const char* device);
596
597 /**
598  * Get array of netdev from given zone
599  *
600  * @param[in] client vasum-server's client
601  * @param[in] zone zone name
602  * @param[out] netdevIds array of netdev id
603  * @return status of this function call
604  * @remark Use vsm_array_string_free() to free memory occupied by @p netdevIds.
605  */
606 VsmStatus vsm_zone_get_netdevs(VsmClient client, const char* zone, VsmArrayString* netdevIds);
607
608 /**
609  * Get ipv4 address for given netdevId
610  *
611  * @param[in] client vasum-server's client
612  * @param[in] zone zone name
613  * @param[in] netdevId netdev id
614  * @param[out] addr ipv4 address
615  * @return status of this function call
616  */
617 VsmStatus vsm_netdev_get_ipv4_addr(VsmClient client,
618                                    const char* zone,
619                                    const char* netdevId,
620                                    struct in_addr *addr);
621
622 /**
623  * Get ipv6 address for given netdevId
624  *
625  * @param[in] client vasum-server's client
626  * @param[in] zone zone name
627  * @param[in] netdevId netdev id
628  * @param[out] addr ipv6 address
629  * @return status of this function call
630  */
631 VsmStatus vsm_netdev_get_ipv6_addr(VsmClient client,
632                                    const char* zone,
633                                    const char* netdevId,
634                                    struct in6_addr *addr);
635
636 /**
637  * Set ipv4 address for given netdevId
638  *
639  * @param[in] client vasum-server's client
640  * @param[in] zone zone name
641  * @param[in] netdevId netdev id
642  * @param[in] addr ipv4 address
643  * @param[in] prefix bit-length of the network prefix
644  * @return status of this function call
645  */
646 VsmStatus vsm_netdev_set_ipv4_addr(VsmClient client,
647                                    const char* zone,
648                                    const char* netdevId,
649                                    struct in_addr *addr,
650                                    int prefix);
651
652 /**
653  * Set ipv6 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 ipv6 address
659  * @param[in] prefix bit-length of the network prefix
660  * @return status of this function call
661  */
662 VsmStatus vsm_netdev_set_ipv6_addr(VsmClient client,
663                                    const char* zone,
664                                    const char* netdevId,
665                                    struct in6_addr *addr,
666                                    int prefix);
667
668 /**
669  * Remove ipv4 address from netdev
670  *
671  * @param[in] client vasum-server's client
672  * @param[in] zone zone name
673  * @param[in] netdevId network device id
674  * @param[in] addr ipv4 address
675  * @param[in] prefix bit-length of the network prefix
676  * @return status of this function call
677  */
678 VsmStatus vsm_netdev_del_ipv4_addr(VsmClient client,
679                                    const char* zone,
680                                    const char* netdevId,
681                                    struct in_addr* addr,
682                                    int prefix);
683
684 /**
685  * Remove ipv6 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 ipv6 address
691  * @param[in] prefix bit-length of the network prefix
692  * @return status of this function call
693  */
694 VsmStatus vsm_netdev_del_ipv6_addr(VsmClient client,
695                                    const char* zone,
696                                    const char* netdevId,
697                                    struct in6_addr* addr,
698                                    int prefix);
699
700 /**
701  * Turn up a network device in the zone
702  *
703  * @param[in] client vasum-server's client
704  * @param[in] zone zone name
705  * @param[in] netdevId netdev id
706  * @return status of this function call
707  */
708 VsmStatus vsm_netdev_up(VsmClient client,
709                         const char* zone,
710                         const char* netdevId);
711
712 /**
713  * Turn down a network device in the zone
714  *
715  * @param[in] client vasum-server's client
716  * @param[in] zone zone name
717  * @param[in] netdevId netdev id
718  * @return status of this function call
719  */
720 VsmStatus vsm_netdev_down(VsmClient client,
721                           const char* zone,
722                           const char* netdevId);
723
724
725 /**
726  * Create veth netdev in zone
727  *
728  * @param[in] client vasum-server's client
729  * @param[in] zone zone name
730  * @param[in] zoneDev in host network device id
731  * @param[in] hostDev in zone network device id
732  * @return status of this function call
733  */
734 VsmStatus vsm_create_netdev_veth(VsmClient client,
735                                  const char* zone,
736                                  const char* zoneDev,
737                                  const char* hostDev);
738 /**
739  * Create macvlab in zone
740  *
741  * @param[in] client vasum-server's client
742  * @param[in] zone zone name
743  * @param[in] zoneDev in host network device id
744  * @param[in] hostDev in zone network device id
745  * @return status of this function call
746  */
747 VsmStatus vsm_create_netdev_macvlan(VsmClient client,
748                                     const char* zone,
749                                     const char* zoneDev,
750                                     const char* hostDev,
751                                     enum macvlan_mode mode);
752 /**
753  * Create/move phys netdev in/to zone
754  *
755  * @param[in] client vasum-server's client
756  * @param[in] zone zone name
757  * @param[in] devId network device id
758  * @return status of this function call
759  */
760 VsmStatus vsm_create_netdev_phys(VsmClient client, const char* zone, const char* devId);
761
762 /**
763  * Get netdev informations
764  *
765  * @param[in] client vasum-server's client
766  * @param[in] zone zone name
767  * @param[in] netdevId network device id
768  * @param[out] netdev netdev informations
769  * @return status of this function call
770  * @remark Use vsm_netdev_free() to free memory occupied by @p netdev.
771  */
772 VsmStatus vsm_lookup_netdev_by_name(VsmClient client,
773                                     const char* zone,
774                                     const char* netdevId,
775                                     VsmNetdev* netdev);
776
777 /**
778  * Remove netdev from zone
779  *
780  * @param[in] client vasum-server's client
781  * @param[in] zone zone name
782  * @param[in] devId network device id
783  * @return status of this function call
784  */
785 VsmStatus vsm_destroy_netdev(VsmClient client, const char* zone, const char* devId);
786
787 /**
788  * Create file, directory or pipe in zone
789  *
790  * Declare file, directory or pipe that will be created while zone startup
791  *
792  * @param[in] client vasum-server's client
793  * @param[in] type file type
794  * @param[in] zone zone id
795  * @param[in] path path to file
796  * @param[in] flags if O_CREAT bit is set then file will be created in zone,
797  *                  otherwise file will by copied from host;
798  *                  it is meaningful only when O_CREAT is set
799  * @param[in] mode mode of file
800  * @return status of this function call
801  */
802 VsmStatus vsm_declare_file(VsmClient client,
803                            const char* zone,
804                            VsmFileType type,
805                            const char* path,
806                            int32_t flags,
807                            mode_t mode);
808
809 /**
810  * Create mount point in zone
811  *
812  * Declare mount that will be created while zone startup
813  * Parameters are passed to mount system function
814  *
815  * @param[in] client vasum-server's client
816  * @param[in] source device path (path in host)
817  * @param[in] zone zone id
818  * @param[in] target mount point (path in zone)
819  * @param[in] type filesystem type
820  * @param[in] flags mount flags as in mount function
821  * @param[in] data additional data as in mount function
822  * @return status of this function call
823  */
824 VsmStatus vsm_declare_mount(VsmClient client,
825                             const char* source,
826                             const char* zone,
827                             const char* target,
828                             const char* type,
829                             uint64_t flags,
830                             const char* data);
831
832 /**
833  * Create link in zone
834  *
835  * Declare link that will be created while zone startup
836  * Parameters are passed to link system function
837  *
838  * @param[in] client vasum-server's client
839  * @param[in] source path to link source (in host)
840  * @param[in] zone zone id
841  * @param[in] target path to link name (in zone)
842  * @return status of this function call
843  */
844 VsmStatus vsm_declare_link(VsmClient client,
845                            const char *source,
846                            const char* zone,
847                            const char *target);
848
849 /**
850  * Get all declarations
851  *
852  * Gets all declarations of resourcies
853  * (@see ::vsm_declare_link, @see ::vsm_declare_mount, @see ::vsm_declare_linki)
854  *
855  * @param[in] client vasum-server's client
856  * @param[in] zone zone id
857  * @param[out] declarations array of declarations id
858  * @return status of this function call
859  */
860 VsmStatus vsm_list_declarations(VsmClient client,
861                                 const char* zone,
862                                 VsmArrayString* declarations);
863
864 /**
865  * Remove declaration
866  *
867  * Removes given declaration by its id (@see ::vsm_list_declarations)
868  *
869  * @param[in] client vasum-server's client
870  * @param[in] zone zone id
871  * @param[in] declaration declaration id
872  * @return status of this function call
873  */
874 VsmStatus vsm_remove_declaration(VsmClient client,
875                                  const char* zone,
876                                  VsmString declaration);
877
878
879 /** @} Host API */
880
881
882 /**
883  * @name Zone API
884  *
885  * Functions using org.tizen.vasum.zone.manager D-Bus interface.
886  *
887  * @{
888  */
889
890 /**
891  * Notification callback function signature.
892  *
893  * @param[in] zone source zone
894  * @param[in] application sending application name
895  * @param[in] message notification message
896  * @param data custom user's data pointer passed to vsm_add_notification_callback()
897  */
898 typedef void (*VsmNotificationCallback)(const char* zone,
899                                         const char* application,
900                                         const char* message,
901                                         void* data);
902 /**
903  * Send message to active zone.
904  *
905  * @param[in] client vasum-server's client
906  * @param[in] application application name
907  * @param[in] message message
908  * @return status of this function call
909  */
910 VsmStatus vsm_notify_active_zone(VsmClient client, const char* application, const char* message);
911
912 /**
913  * Move file between zones.
914  *
915  * @param[in] client vasum-server's client
916  * @param[in] destZone destination zone id
917  * @param[in] path path to moved file
918  * @return status of this function call
919  */
920 VsmStatus vsm_file_move_request(VsmClient client, const char* destZone, const char* path);
921
922 /**
923  * Register notification callback function.
924  *
925  * @note The callback function will be invoked on a different thread.
926  *
927  * @param[in] client vasum-server's client
928  * @param[in] notificationCallback callback function
929  * @param[in] data some extra data that will be passed to callback function
930  * @param[out] subscriptionId subscription identifier that can be used to unsubscribe signal,
931  *                      pointer can be NULL.
932  * @return status of this function call
933  */
934 VsmStatus vsm_add_notification_callback(VsmClient client,
935                                         VsmNotificationCallback notificationCallback,
936                                         void* data,
937                                         VsmSubscriptionId* subscriptionId);
938
939 /**
940  * Unregister notification callback function.
941  *
942  * @param[in] client vasum-server's client
943  * @param[in] subscriptionId subscription identifier returned by vsm_add_notification_callback
944  * @return status of this function call
945  */
946 VsmStatus vsm_del_notification_callback(VsmClient client, VsmSubscriptionId subscriptionId);
947
948 #endif /* __VASUM_WRAPPER_SOURCE__ */
949
950 /** @} Zone API */
951
952 #ifdef __cplusplus
953 }
954 #endif
955
956 #endif /* VASUM_CLIENT_H */