634 lines
21 KiB
HTML
634 lines
21 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SD_BUS_ADD_OBJECT_VTABLE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SD_BUS_ADD_OBJECT_VTABLE</H1>
|
|
Section: sd_bus_add_object_vtable (3)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sd_bus_add_object_vtable, sd_bus_add_fallback_vtable, SD_BUS_VTABLE_START, SD_BUS_VTABLE_END, SD_BUS_METHOD_WITH_NAMES_OFFSET, SD_BUS_METHOD_WITH_NAMES, SD_BUS_METHOD_WITH_OFFSET, SD_BUS_METHOD, SD_BUS_SIGNAL_WITH_NAMES, SD_BUS_SIGNAL, SD_BUS_WRITABLE_PROPERTY, SD_BUS_PROPERTY, SD_BUS_PARAM - Declare properties and methods for a D-Bus path
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>
|
|
</B><PRE>
|
|
#include <<A HREF="file:///usr/include/systemd/sd-bus-vtable.h">systemd/sd-bus-vtable.h</A>>
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>typedef int (*sd_bus_message_handler_t)(sd_bus_message *</B><I>m</I><B>, void *</B><I>userdata</I><B>, sd_bus_error *</B><I>ret_error</I><B>);</B>
|
|
|
|
<DT id="2">
|
|
<B>typedef int (*sd_bus_property_get_t)(sd_bus *</B><I>bus</I><B>, const char *</B><I>path</I><B>, const char *</B><I>interface</I><B>, const char *</B><I>property</I><B>, sd_bus_message *</B><I>reply</I><B>, void *</B><I>userdata</I><B>, sd_bus_error *</B><I>ret_error</I><B>);</B>
|
|
|
|
<DT id="3">
|
|
<B>typedef int (*sd_bus_property_set_t)(sd_bus *</B><I>bus</I><B>, const char *</B><I>path</I><B>, const char *</B><I>interface</I><B>, const char *</B><I>property</I><B>, sd_bus_message *</B><I>value</I><B>, void *</B><I>userdata</I><B>, sd_bus_error *</B><I>ret_error</I><B>);</B>
|
|
|
|
<DT id="4">
|
|
<B>typedef int (*sd_bus_object_find_t)(const char *</B><I>path</I><B>, const char *</B><I>interface</I><B>, void *</B><I>userdata</I><B>, void **</B><I>ret_found</I><B>, sd_bus_error *</B><I>ret_error</I><B>);</B>
|
|
|
|
<DT id="5">
|
|
<B>int sd_bus_add_object_vtable(sd_bus *</B><I>bus</I><B>, sd_bus_slot **</B><I>slot</I><B>, const char *</B><I>path</I><B>, const char *</B><I>interface</I><B>, const sd_bus_vtable *</B><I>vtable</I><B>, void *</B><I>userdata</I><B>);</B>
|
|
|
|
<DT id="6">
|
|
<B>int sd_bus_add_fallback_vtable(sd_bus *</B><I>bus</I><B>, sd_bus_slot **</B><I>slot</I><B>, const char *</B><I>prefix</I><B>, const char *</B><I>interface</I><B>, const sd_bus_vtable *</B><I>vtable</I><B>, sd_bus_object_find_t </B><I>find</I><B>, void *</B><I>userdata</I><B>);</B>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_START(</B><B></B><I>flags</I><B>)</B>
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_END</B>
|
|
<P>
|
|
|
|
<B>SD_BUS_METHOD_WITH_NAMES_OFFSET( </B><B></B><I>member</I><B>, </B><B></B><I>signature</I><B>, </B><B></B><I>in_names</I><B>, </B><B></B><I>result</I><B>, </B><B></B><I>out_names</I><B>, </B><B></B><I>handler</I><B>, </B><B></B><I>offset</I><B>, </B><B></B><I>flags</I><B>) </B>
|
|
<P>
|
|
|
|
<B>SD_BUS_METHOD_WITH_NAMES( </B><B></B><I>member</I><B>, </B><B></B><I>signature</I><B>, </B><B></B><I>in_names</I><B>, </B><B></B><I>result</I><B>, </B><B></B><I>out_names</I><B>, </B><B></B><I>handler</I><B>, </B><B></B><I>flags</I><B>) </B>
|
|
<P>
|
|
|
|
<B>SD_BUS_METHOD_WITH_OFFSET( </B><B></B><I>member</I><B>, </B><B></B><I>signature</I><B>, </B><B></B><I>result</I><B>, </B><B></B><I>handler</I><B>, </B><B></B><I>offset</I><B>, </B><B></B><I>flags</I><B>) </B>
|
|
<P>
|
|
|
|
<B>SD_BUS_METHOD( </B><B></B><I>member</I><B>, </B><B></B><I>signature</I><B>, </B><B></B><I>result</I><B>, </B><B></B><I>handler</I><B>, </B><B></B><I>flags</I><B>) </B>
|
|
<P>
|
|
|
|
<B>SD_BUS_SIGNAL_WITH_NAMES( </B><B></B><I>member</I><B>, </B><B></B><I>signature</I><B>, </B><B></B><I>names</I><B>, </B><B></B><I>flags</I><B>) </B>
|
|
<P>
|
|
|
|
<B>SD_BUS_SIGNAL( </B><B></B><I>member</I><B>, </B><B></B><I>signature</I><B>, </B><B></B><I>flags</I><B>) </B>
|
|
<P>
|
|
|
|
<B>SD_BUS_WRITABLE_PROPERTY( </B><B></B><I>member</I><B>, </B><B></B><I>signature</I><B>, </B><B></B><I>get</I><B>, </B><B></B><I>set</I><B>, </B><B></B><I>offset</I><B>, </B><B></B><I>flags</I><B>) </B>
|
|
<P>
|
|
|
|
<B>SD_BUS_PROPERTY( </B><B></B><I>member</I><B>, </B><B></B><I>signature</I><B>, </B><B></B><I>get</I><B>, </B><B></B><I>offset</I><B>, </B><B></B><I>flags</I><B>) </B>
|
|
<P>
|
|
|
|
<B>SD_BUS_PARAM(</B><B></B><I>name</I><B>)</B>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<B>sd_bus_add_object_vtable()</B>
|
|
<DD>is used to declare attributes for the path object path
|
|
<I>path</I>
|
|
connected to the bus connection
|
|
<I>bus</I>
|
|
under the interface
|
|
<I>interface</I>. The table
|
|
<I>vtable</I>
|
|
may contain property declarations using
|
|
<B>SD_BUS_PROPERTY()</B>
|
|
or
|
|
<B>SD_BUS_WRITABLE_PROPERTY()</B>, method declarations using
|
|
<B>SD_BUS_METHOD()</B>,
|
|
<B>SD_BUS_METHOD_WITH_NAMES()</B>,
|
|
<B>SD_BUS_METHOD_WITH_OFFSET()</B>, or
|
|
<B>SD_BUS_METHOD_WITH_NAMES_OFFSET()</B>, and signal declarations using
|
|
<B>SD_BUS_SIGNAL_WITH_NAMES()</B>
|
|
or
|
|
<B>SD_BUS_SIGNAL()</B>, see below. The
|
|
<I>userdata</I>
|
|
parameter contains a pointer that will be passed to various callback functions. It may be specified as
|
|
<B>NULL</B>
|
|
if no value is necessary.
|
|
<P>
|
|
|
|
<B>sd_bus_add_fallback_vtable()</B>
|
|
is similar to
|
|
<B>sd_bus_add_object_vtable()</B>, but is used to register "fallback" attributes. When looking for an attribute declaration, bus object paths registered with
|
|
<B>sd_bus_add_object_vtable()</B>
|
|
are checked first. If no match is found, the fallback vtables are checked for each prefix of the bus object path, i.e. with the last slash-separated components successively removed. This allows the vtable to be used for an arbitrary number of dynamically created objects.
|
|
<P>
|
|
|
|
Parameter
|
|
<I>find</I>
|
|
is a function which is used to locate the target object based on the bus object path
|
|
<I>path</I>. It must return
|
|
<B>1</B>
|
|
and set the
|
|
<I>ret_found</I>
|
|
output parameter if the object is found, return
|
|
<B>0</B>
|
|
if the object was not found, and return a negative errno-style error code or initialize the error structure
|
|
<I>ret_error</I>
|
|
on error. The pointer passed in
|
|
<I>ret_found</I>
|
|
will be used as the
|
|
<I>userdata</I>
|
|
parameter for the callback functions (offset by the
|
|
<I>offset</I>
|
|
offsets as specified in the vtable entries).
|
|
<P>
|
|
|
|
For both functions, a match slot is created internally. If the output parameter
|
|
<I>slot</I>
|
|
is
|
|
<B>NULL</B>, a "floating" slot object is created, see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_slot_set_floating">sd_bus_slot_set_floating</A></B>(3). Otherwise, a pointer to the slot object is returned. In that case, the reference to the slot object should be dropped when the vtable is not needed anymore, see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_slot_unref">sd_bus_slot_unref</A></B>(3).
|
|
<A NAME="lbAE"> </A>
|
|
<H3>The sd_bus_vtable array</H3>
|
|
|
|
<P>
|
|
|
|
The array consists of the structures of type
|
|
sd_bus_vtable, but it should never be filled in manually, but through one of the following macros:
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_START()</B>, <B>SD_BUS_VTABLE_END</B>
|
|
<DL COMPACT><DT id="7"><DD>
|
|
Those must always be the first and last element.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_METHOD_WITH_NAMES_OFFSET()</B>, <B>SD_BUS_METHOD_WITH_NAMES()</B>, <B>SD_BUS_METHOD_WITH_OFFSET()</B>, <B>SD_BUS_METHOD()</B>
|
|
<DL COMPACT><DT id="8"><DD>
|
|
Declare a D-Bus method with the name
|
|
<I>member</I>, parameter signature
|
|
<I>signature</I>, result signature
|
|
<I>result</I>. Parameters
|
|
<I>in_names</I>
|
|
and
|
|
<I>out_names</I>
|
|
specify the argument names of the input and output arguments in the function signature. The handler function
|
|
<I>handler</I>
|
|
must be of type
|
|
<B>sd_bus_message_handler_t</B>. It will be called to handle the incoming messages that call this method. It receives a pointer that is the
|
|
<I>userdata</I>
|
|
parameter passed to the registration function offset by
|
|
<I>offset</I>
|
|
bytes. This may be used to pass pointers to different fields in the same data structure to different methods in the same vtable.
|
|
<I>in_names</I>
|
|
and
|
|
<I>out_names</I>
|
|
should be created using the
|
|
<B>SD_BUS_PARAM()</B>
|
|
macro, see below. Parameter
|
|
<I>flags</I>
|
|
is a combination of flags, see below.
|
|
<P>
|
|
<B>SD_BUS_METHOD_WITH_NAMES()</B>,
|
|
<B>SD_BUS_METHOD_WITH_OFFSET()</B>, and
|
|
<B>SD_BUS_METHOD()</B>
|
|
are variants which specify zero offset (<I>userdata</I>
|
|
parameter is passed with no change), leave the names unset (i.e. no parameter names), or both.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_SIGNAL_WITH_NAMES()</B>, <B>SD_BUS_SIGNAL()</B>
|
|
<DL COMPACT><DT id="9"><DD>
|
|
Declare a D-Bus signal with the name
|
|
<I>member</I>, parameter signature
|
|
<I>signature</I>, and argument names
|
|
<I>names</I>.
|
|
<I>names</I>
|
|
should be created using the
|
|
<B>SD_BUS_PARAM()</B>
|
|
macro, see below. Parameter
|
|
<I>flags</I>
|
|
is a combination of flags, see below.
|
|
<P>
|
|
Equivalent to
|
|
<B>SD_BUS_SIGNAL_WITH_NAMES()</B>
|
|
with the
|
|
<I>names</I>
|
|
parameter unset (i.e. no parameter names).
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_WRITABLE_PROPERTY()</B>, <B>SD_BUS_PROPERTY()</B>
|
|
<DL COMPACT><DT id="10"><DD>
|
|
Declare a D-Bus property with the name
|
|
<I>member</I>
|
|
and value signature
|
|
<I>signature</I>. Parameters
|
|
<I>get</I>
|
|
and
|
|
<I>set</I>
|
|
are the getter and setter methods. They are called with a pointer that is the
|
|
<I>userdata</I>
|
|
parameter passed to the registration function offset by
|
|
<I>offset</I>
|
|
bytes. This may be used pass pointers to different fields in the same data structure to different setters and getters in the same vtable. Parameter
|
|
<I>flags</I>
|
|
is a combination of flags, see below.
|
|
<P>
|
|
The setter and getter methods may be omitted (specified as
|
|
<B>NULL</B>), if the property has one of the basic types or
|
|
"as"
|
|
in case of read-only properties. In those cases, the
|
|
<I>userdata</I>
|
|
and
|
|
<I>offset</I>
|
|
parameters must together point to valid variable of the corresponding type. A default setter and getters will be provided, which simply copy the argument between this variable and the message.
|
|
<P>
|
|
<B>SD_BUS_PROPERTY()</B>
|
|
is used to define a read-only property.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_PARAM()</B>
|
|
<DL COMPACT><DT id="11"><DD>
|
|
Parameter names should be wrapped in this macro, see the example below.
|
|
</DL>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Flags</H3>
|
|
|
|
<P>
|
|
|
|
The
|
|
<I>flags</I>
|
|
parameter is used to specify a combination of
|
|
m[blue]<B>D-Bus annotations</B>m[]<FONT SIZE="-2">[1]</FONT>.
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_DEPRECATED</B>
|
|
<DL COMPACT><DT id="12"><DD>
|
|
Mark this vtable entry as deprecated using the
|
|
<B>org.freedesktop.DBus.Deprecated</B>
|
|
annotation in introspection data. If specified for
|
|
<B>SD_BUS_VTABLE_START()</B>, the annotation is applied to the enclosing interface.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_HIDDEN</B>
|
|
<DL COMPACT><DT id="13"><DD>
|
|
Make this vtable entry hidden. It will not be shown in introspection data. If specified for
|
|
<B>SD_BUS_VTABLE_START()</B>, all entries in the array are hidden.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_UNPRIVILEGED</B>
|
|
<DL COMPACT><DT id="14"><DD>
|
|
Mark this vtable entry as unprivileged. If not specified, the
|
|
<B>org.freedesktop.systemd1.Privileged</B>
|
|
annotation with value
|
|
"true"
|
|
will be shown in introspection data.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_METHOD_NO_REPLY</B>
|
|
<DL COMPACT><DT id="15"><DD>
|
|
Mark his vtable entry as a method that will not return a reply using the
|
|
<B>org.freedesktop.DBus.Method.NoReply</B>
|
|
annotation in introspection data.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_PROPERTY_CONST</B>, <B>SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE</B>, <B>SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION</B>
|
|
<DL COMPACT><DT id="16"><DD>
|
|
Those three flags correspond to different values of the
|
|
<B>org.freedesktop.DBus.Property.EmitsChangedSignal</B>
|
|
annotation, which specifies whether the
|
|
<B>org.freedesktop.DBus.Properties.PropertiesChanged</B>
|
|
signal is emitted whenever the property changes.
|
|
<B>SD_BUS_VTABLE_PROPERTY_CONST</B>
|
|
corresponds to
|
|
<B>const</B>
|
|
and means that the property never changes during the lifetime of the object it belongs to, so no signal needs to be emitted.
|
|
<B>SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE</B>
|
|
corresponds to
|
|
<B>true</B>
|
|
and means that the signal is emitted.
|
|
<B>SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION</B>
|
|
corresponds to
|
|
<B>invalidates</B>
|
|
and means that the signal is emitted, but the value is not included in the signal.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>SD_BUS_VTABLE_PROPERTY_EXPLICIT</B>
|
|
<DL COMPACT><DT id="17"><DD>
|
|
Mark this vtable property entry as requiring explicit request to for the value to be shown (generally because the value is large or slow to calculate). This entry cannot be combined with
|
|
<B>SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE</B>, and will not be shown in property listings by default (e.g.
|
|
<B>busctl introspect</B>). This corresponds to the
|
|
<B>org.freedesktop.systemd1.Explicit</B>
|
|
annotation in introspection data.
|
|
</DL>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
|
|
<B>Example 1. Create a simple listener on the bus</B>
|
|
<P>
|
|
<DL COMPACT><DT id="18"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
#include <<A HREF="file:///usr/include/errno.h">errno.h</A>>
|
|
#include <<A HREF="file:///usr/include/stdbool.h">stdbool.h</A>>
|
|
#include <<A HREF="file:///usr/include/stddef.h">stddef.h</A>>
|
|
#include <<A HREF="file:///usr/include/stdlib.h">stdlib.h</A>>
|
|
#include <<A HREF="file:///usr/include/stdio.h">stdio.h</A>>
|
|
#include <<A HREF="file:///usr/include/systemd/sd-bus.h">systemd/sd-bus.h</A>>
|
|
|
|
#define _cleanup_(f) __attribute__((cleanup(f)))
|
|
|
|
typedef struct object {
|
|
char *name;
|
|
uint32_t number;
|
|
} object;
|
|
|
|
static int method(sd_bus_message *m, void *userdata, sd_bus_error *error) {
|
|
printf("Got called with userdata=%p\n", userdata);
|
|
return 1;
|
|
}
|
|
|
|
static const sd_bus_vtable vtable[] = {
|
|
SD_BUS_VTABLE_START(0),
|
|
SD_BUS_METHOD(
|
|
"Method1", "s", "s", method, 0),
|
|
SD_BUS_METHOD_WITH_NAMES_OFFSET(
|
|
"Method2",
|
|
"so", SD_BUS_PARAM(string) SD_BUS_PARAM(path),
|
|
"s", SD_BUS_PARAM(returnstring),
|
|
method, offsetof(object, number),
|
|
SD_BUS_VTABLE_DEPRECATED),
|
|
SD_BUS_WRITABLE_PROPERTY(
|
|
"AutomaticStringProperty", "s", NULL, NULL,
|
|
offsetof(object, name),
|
|
SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
|
SD_BUS_WRITABLE_PROPERTY(
|
|
"AutomaticIntegerProperty", "u", NULL, NULL,
|
|
offsetof(object, number),
|
|
SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
|
|
SD_BUS_VTABLE_END
|
|
};
|
|
|
|
#define check(x) ({ \
|
|
int r = x; \
|
|
errno = r < 0 ? -r : 0; \
|
|
printf(#x ": %m\n"); \
|
|
if (r < 0) \
|
|
return EXIT_FAILURE; \
|
|
})
|
|
|
|
int main(int argc, char **argv) {
|
|
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
|
|
|
sd_bus_default(&bus);
|
|
|
|
object object = { .number = 666 };
|
|
check((object.name = strdup("name")) != NULL);
|
|
|
|
check(sd_bus_add_object_vtable(bus, NULL, "/object",
|
|
"org.freedesktop.systemd.VtableExample",
|
|
vtable,
|
|
&object));
|
|
|
|
for (;;) {
|
|
check(sd_bus_wait(bus, UINT64_MAX));
|
|
check(sd_bus_process(bus, NULL));
|
|
}
|
|
|
|
free(object.name);
|
|
|
|
return 0;
|
|
}
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
This creates a simple client on the bus (the user bus, when run as normal user). We may use the D-Bus
|
|
<B>org.freedesktop.DBus.Introspectable.Introspect</B>
|
|
call to acquire the XML description of the interface:
|
|
<P>
|
|
<DL COMPACT><DT id="19"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
|
"<A HREF="http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd</A>">
|
|
<node>
|
|
<interface name="org.freedesktop.DBus.Peer">
|
|
<method name="Ping"/>
|
|
<method name="GetMachineId">
|
|
<arg type="s" name="machine_uuid" direction="out"/>
|
|
</method>
|
|
</interface>
|
|
<interface name="org.freedesktop.DBus.Introspectable">
|
|
<method name="Introspect">
|
|
<arg name="data" type="s" direction="out"/>
|
|
</method>
|
|
</interface>
|
|
<interface name="org.freedesktop.DBus.Properties">
|
|
<method name="Get">
|
|
<arg name="interface" direction="in" type="s"/>
|
|
<arg name="property" direction="in" type="s"/>
|
|
<arg name="value" direction="out" type="v"/>
|
|
</method>
|
|
<method name="GetAll">
|
|
<arg name="interface" direction="in" type="s"/>
|
|
<arg name="properties" direction="out" type="a{sv}"/>
|
|
</method>
|
|
<method name="Set">
|
|
<arg name="interface" direction="in" type="s"/>
|
|
<arg name="property" direction="in" type="s"/>
|
|
<arg name="value" direction="in" type="v"/>
|
|
</method>
|
|
<signal name="PropertiesChanged">
|
|
<arg type="s" name="interface"/>
|
|
<arg type="a{sv}" name="changed_properties"/>
|
|
<arg type="as" name="invalidated_properties"/>
|
|
</signal>
|
|
</interface>
|
|
<interface name="org.freedesktop.systemd.VtableExample">
|
|
<method name="Method1">
|
|
<arg type="s" direction="in"/>
|
|
<arg type="s" direction="out"/>
|
|
</method>
|
|
<method name="Method2">
|
|
<arg type="s" name="string" direction="in"/>
|
|
<arg type="o" name="path" direction="in"/>
|
|
<arg type="s" name="returnstring" direction="out"/>
|
|
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
|
|
</method>
|
|
<property name="AutomaticStringProperty" type="s" access="readwrite">
|
|
</property>
|
|
<property name="AutomaticIntegerProperty" type="u" access="readwrite">
|
|
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="invalidates"/>
|
|
</property>
|
|
</interface>
|
|
</node>
|
|
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<P>
|
|
|
|
On success,
|
|
<B>sd_bus_add_object_vtable</B>
|
|
and
|
|
<B>sd_bus_add_fallback_vtable</B>
|
|
calls return 0 or a positive integer. On failure, they return a negative errno-style error code.
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Errors</H3>
|
|
|
|
<P>
|
|
|
|
Returned errors may indicate the following problems:
|
|
<P>
|
|
|
|
<B>-EINVAL</B>
|
|
<DL COMPACT><DT id="20"><DD>
|
|
One of the required parameters is
|
|
<B>NULL</B>
|
|
or invalid. A reserved D-Bus interface was passed as the
|
|
<I>interface</I>
|
|
parameter.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ENOPKG</B>
|
|
<DL COMPACT><DT id="21"><DD>
|
|
The bus cannot be resolved.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ECHILD</B>
|
|
<DL COMPACT><DT id="22"><DD>
|
|
The bus was created in a different process.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ENOMEM</B>
|
|
<DL COMPACT><DT id="23"><DD>
|
|
Memory allocation failed.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-EPROTOTYPE</B>
|
|
<DL COMPACT><DT id="24"><DD>
|
|
<B>sd_bus_add_object_vtable</B>
|
|
and
|
|
<B>sd_bus_add_fallback_vtable</B>
|
|
have been both called for the same bus object path, which is not allowed.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-EEXIST</B>
|
|
<DL COMPACT><DT id="25"><DD>
|
|
This vtable has already been registered for this
|
|
<I>interface</I>
|
|
and
|
|
<I>path</I>.
|
|
</DL>
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<P>
|
|
|
|
These APIs are implemented as a shared library, which can be compiled and linked to with the
|
|
<B>libsystemd</B> <B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
|
|
file.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd-bus">sd-bus</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?1+busctl">busctl</A></B>(1)
|
|
<A NAME="lbAL"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="26"> 1.<DD>
|
|
D-Bus annotations
|
|
<DL COMPACT><DT id="27"><DD>
|
|
<A HREF="https://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format">https://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format</A>
|
|
</DL>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="28"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="29"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="30"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="31"><A HREF="#lbAE">The sd_bus_vtable array</A><DD>
|
|
<DT id="32"><A HREF="#lbAF">Flags</A><DD>
|
|
</DL>
|
|
<DT id="33"><A HREF="#lbAG">EXAMPLES</A><DD>
|
|
<DT id="34"><A HREF="#lbAH">RETURN VALUE</A><DD>
|
|
<DL>
|
|
<DT id="35"><A HREF="#lbAI">Errors</A><DD>
|
|
</DL>
|
|
<DT id="36"><A HREF="#lbAJ">NOTES</A><DD>
|
|
<DT id="37"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
<DT id="38"><A HREF="#lbAL">NOTES</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:54 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|