1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
9 <refentry id="sd_bus_message_get_cookie"
10 xmlns:xi="http://www.w3.org/2001/XInclude">
13 <title>sd_bus_message_get_cookie</title>
14 <productname>elogind</productname>
18 <contrib>Developer</contrib>
19 <firstname>Lennart</firstname>
20 <surname>Poettering</surname>
21 <email>lennart@poettering.net</email>
27 <refentrytitle>sd_bus_message_get_cookie</refentrytitle>
28 <manvolnum>3</manvolnum>
32 <refname>sd_bus_message_get_cookie</refname>
33 <refname>sd_bus_message_get_reply_cookie</refname>
34 <refpurpose>Returns the transaction cookie of a message</refpurpose>
39 <funcsynopsisinfo>#include <elogind/sd-bus.h></funcsynopsisinfo>
42 <funcdef>int <function>sd_bus_message_get_cookie</function></funcdef>
43 <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
44 <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
48 <funcdef>int <function>sd_bus_message_get_reply_cookie</function></funcdef>
49 <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
50 <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
56 <title>Description</title>
58 <para><function>sd_bus_message_get_cookie()</function> returns the
59 transaction cookie of a message. The cookie uniquely identifies a
60 message within each bus peer, but is not globally unique. It is
61 assigned when a message is sent.</para>
63 <para><function>sd_bus_message_get_reply_cookie()</function>
64 returns the transaction cookie of the message the specified
65 message is a response to. When a reply message is generated for a
66 method call message, its cookie is copied over into this field.
67 Note that while every message that is transferred is identified by
68 a cookie, only response messages carry a reply cookie
71 <para>Both functions take a message object as first parameter and
72 a place to store the 64-bit cookie in.</para>
76 <title>Return Value</title>
78 <para>On success, these calls return 0 or a positive integer. On
79 failure, these calls return a negative errno-style error
82 <para>On success, the cookie/reply cookie is returned in the
83 specified 64-bit unsigned integer variable.</para>
89 <para>Returned errors may indicate the following problems:</para>
93 <term><constant>-EINVAL</constant></term>
95 <listitem><para>A specified parameter
96 is invalid.</para></listitem>
100 <term><constant>-ENODATA</constant></term>
102 <listitem><para>No cookie has been assigned to this message.
103 This either indicates that the message has not been sent yet
104 and hence has no cookie assigned, or that the message is not a
105 method response message and hence carries a reply cookie
106 field.</para></listitem>
111 <xi:include href="libelogind-pkgconfig.xml" />
114 <title>See Also</title>
117 <!-- 0 /// elogind is in section 8
118 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
120 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
122 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
123 <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>