aboutsummaryrefslogtreecommitdiff
path: root/src/lib/include/gnunet_dbus_lib_interface.h
blob: 83cd598e7f53c4c3c66a983a4e49bd127ee51f82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef GNUNET_DBUS_LIB_INTERFACE_H
#define GNUNET_DBUS_LIB_INTERFACE_H

#include <stdbool.h>

/**
 * Represents a DBus interface.  An interface consists of a set of methods and
 * signals.
 */
struct GNUNET_DBUS_Interface;

#include "gnunet_dbus_lib_object.h"
#include "gnunet_dbus_lib_method.h"
#include "gnunet_dbus_lib_method_context.h"
#include "gnunet_dbus_lib_signal.h"

struct GNUNET_DBUS_InterfaceIterator
{
  /* linked list */
  struct GNUNET_DBUS_InterfaceIterator *next;
  struct GNUNET_DBUS_InterfaceIterator *prev;

  struct GNUNET_DBUS_Interface *interface;
};

/**
 * Create a DBus interface with the given name. After populating this interface
 * with methods and signals it can be added to an object with
 * GNUNET_DBUS_object_add_interface.
 */
struct GNUNET_DBUS_Interface *
GNUNET_DBUS_interface_create (
    const char *name);

/**
 * Increase the reference count of this GNUNET_DBUS_Interface by one.
 */
void
GNUNET_DBUS_interface_ref (
    struct GNUNET_DBUS_Interface *interface);

/**
 * Decrease the reference count of this GNUNET_DBUS_Interface by one.
 */
void
GNUNET_DBUS_interface_unref (
    struct GNUNET_DBUS_Interface *interface);

/**
 * Add a method to this interface. This will increase the reference count of
 * the GNUNET_DBUS_Method by one.
 */
void
GNUNET_DBUS_interface_add_method (
    struct GNUNET_DBUS_Interface *interface,
    struct GNUNET_DBUS_Method *method);

/**
 * Add a signal to this interface. This will increase the reference count of
 * the GNUNET_DBUS_Signal by one.
 */
void
GNUNET_DBUS_interface_add_signal (
    struct GNUNET_DBUS_Interface *interface,
    struct GNUNET_DBUS_Signal *signal);

/**
 * Get the name of this GNUNET_DBUS_Interface.
 */
const char *
GNUNET_DBUS_interface_get_name (
    const struct GNUNET_DBUS_Interface *interface);

/**
 * Iterate over the methods of this GNUNET_DBUS_Interface.
 */
const struct GNUNET_DBUS_MethodIterator *
GNUNET_DBUS_interface_iterate_methods (
    const struct GNUNET_DBUS_Interface *interface);

/**
 * Iterate over the signals of this GNUNET_DBUS_Interface.
 */
const struct GNUNET_DBUS_SignalIterator *
GNUNET_DBUS_interface_iterate_signals (
    const struct GNUNET_DBUS_Interface *interface);

/**
 * Returns the org.freedesktop.DBus.Introspectable interface.
 */
struct GNUNET_DBUS_Interface *
GNUNET_DBUS_interface_introspectable ();

/**
 * Return the position in the given linked-list of the GNUNET_DBUS_Interface
 * with the given name. Returns NULL if the interface could not be found.
 */
const struct GNUNET_DBUS_InterfaceIterator *
GNUNET_DBUS_interface_find (
    const struct GNUNET_DBUS_InterfaceIterator *int_it,
    const char *name);

#endif