sd_bus_message_get_cookie.xml revision 7c071fda945a8f9e3b11d37dc04c8bdfa615d44a
45632c3574ce843b9e85b9f73efe75b7b809f789slive<?xml version='1.0'?> <!--*-nxml-*-->
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd<!--
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd This file is part of systemd.
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
3f08db06526d6901aa08c110b5bc7dde6bc39905nd Copyright 2013 Lennart Poettering
6df89e6e4adeb986b41b7ec6b7593a887e031ce7nd
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim systemd is free software; you can redistribute it and/or modify it
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim under the terms of the GNU Lesser General Public License as published by
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen the Free Software Foundation; either version 2.1 of the License, or
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen (at your option) any later version.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen systemd is distributed in the hope that it will be useful, but
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim WITHOUT ANY WARRANTY; without even the implied warranty of
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd Lesser General Public License for more details.
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen
3f08db06526d6901aa08c110b5bc7dde6bc39905nd You should have received a copy of the GNU Lesser General Public License
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim along with systemd; If not, see <http://www.gnu.org/licenses/>.
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim-->
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
4b5981e276e93df97c34e4da05ca5cf8bbd937dand<refentry id="sd_bus_message_get_cookie" conditional="ENABLE_KDBUS">
3f08db06526d6901aa08c110b5bc7dde6bc39905nd
6df89e6e4adeb986b41b7ec6b7593a887e031ce7nd <refentryinfo>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd <title>sd_bus_message_get_cookie</title>
ed1d958582984a7c54a6ca859e15939a414fa733nd <productname>systemd</productname>
ed1d958582984a7c54a6ca859e15939a414fa733nd
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <authorgroup>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <author>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <contrib>Developer</contrib>
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd <firstname>Lennart</firstname>
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd <surname>Poettering</surname>
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end <email>lennart@poettering.net</email>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen </author>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen </authorgroup>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd </refentryinfo>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <refmeta>
a29610af88e278144045bfa1bc63b4a1a4b5ff14trawick <refentrytitle>sd_bus_message_get_cookie</refentrytitle>
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz <manvolnum>3</manvolnum>
35b1112eadc3479a2d81ea1b836aa87f21505ee9jerenkrantz </refmeta>
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz
a12dd6260a66f51e25119982390def72e2db4be5nd <refnamediv>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <refname>sd_bus_message_get_cookie</refname>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <refname>sd_bus_message_get_reply_cookie</refname>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <refpurpose>Returns the transaction cookie of a message</refpurpose>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd </refnamediv>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen <refsynopsisdiv>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <funcsynopsis>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <funcprototype>
63581ee088272ef76aa8d053609dc1705c222deesf <funcdef>int <function>sd_bus_message_get_cookie</function></funcdef>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <paramdef>sd_bus_message* <parameter>message</parameter></paramdef>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <paramdef>uint64_t* <parameter>cookie</parameter></paramdef>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd </funcprototype>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
562b6e25d7f0ca73dca724b09b555a91399448d5rbowen <funcprototype>
562b6e25d7f0ca73dca724b09b555a91399448d5rbowen <funcdef>int <function>sd_bus_message_get_reply_cookie</function></funcdef>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <paramdef>sd_bus_message* <parameter>message</parameter></paramdef>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <paramdef>uint64_t* <parameter>cookie</parameter></paramdef>
4af55bbfdbff2cae0cd3195876c93ea991523d1fcolm </funcprototype>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd </funcsynopsis>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd </refsynopsisdiv>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <refsect1>
64f23d7fddbd8bacb8c18434baedb5f1f86b432aminfrin <title>Description</title>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <para><function>sd_bus_message_get_cookie()</function> returns
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd the transaction cookie of a message. The cookie
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd uniquely identifies a message within each bus peer,
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd but is not globally unique. It is assigned when a
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd message is sent.</para>
38819b9bf8b10d6db4842fb5a4ede7828b409819rbowen
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <para><function>sd_bus_message_get_reply_cookie()</function>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd returns the transaction cookie of the message the
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd specified message is a response to. When a reply
1844bb5f7939bd31f51dffaf8d8cf1c00657a681rbowen message is generated for a method call message, its
1844bb5f7939bd31f51dffaf8d8cf1c00657a681rbowen cookie is copied over into this field. Note that while
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd every message that is transferred is identified by a
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd cookie, only response messages carry a reply cookie
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd field.</para>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <para>Both functions take a message object as first
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd parameter and a place to store the 64-bit cookie
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd in.</para>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd </refsect1>
664e667e221a15fa5f456e73948c67710f43f1b4minfrin
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <refsect1>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <title>Return Value</title>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
c5ac4f57bfd156a62495b9c6a049f05bbcb69acarbowen <para>On success, these calls return 0 or a positive
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd integer. On failure, these calls return a negative
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd errno-style error code.</para>
0f6a0052bbfc841b1067c1ce0ca37880121d4713rbowen
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd <para>On success, the cookie/reply cookie is returned
e930328445e961ade1bd37ed7ca01c293b586400noodl in the specified 64-bit unsigned integer variable.</para>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd </refsect1>
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd <refsect1>
ed1d958582984a7c54a6ca859e15939a414fa733nd <title>Errors</title>
ed1d958582984a7c54a6ca859e15939a414fa733nd
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <para>Returned errors may indicate the following problems:</para>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <variablelist>
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd <varlistentry>
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd <term><varname>-EINVAL</varname></term>
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen <listitem><para>A specified parameter
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen is invalid.</para></listitem>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd </varlistentry>
1a1356f375e36db7bee379ea0684ab389579f798rbowen
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen <varlistentry>
0d0ba3a410038e179b695446bb149cce6264e0abnd <term><varname>-ENODATA</varname></term>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd <listitem><para>No cookie has been
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd assigned to this message. This either
29fb68cf24dbdb4985cbb4734cb6074ea4bbab26nd indicates that the message has not
been sent yet and hence has no cookie
assigned, or that the message is not a
method response message and hence
carries a reply cookie
field.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<para>The <function>sd_bus_message_get_cookie()</function>
and <function>sd_bus_message_get_reply_cookie()</function>
interfaces are available as a shared library, which can
be compiled and linked to with the
<constant>libsystemd</constant> <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
file.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>