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+
8 Copyright 2013 Lennart Poettering
11 <refentry id="sd_bus_message_get_cookie"
12 xmlns:xi="http://www.w3.org/2001/XInclude">
15 <title>sd_bus_message_get_cookie</title>
16 <productname>elogind</productname>
20 <contrib>Developer</contrib>
21 <firstname>Lennart</firstname>
22 <surname>Poettering</surname>
23 <email>lennart@poettering.net</email>
29 <refentrytitle>sd_bus_message_get_cookie</refentrytitle>
30 <manvolnum>3</manvolnum>
34 <refname>sd_bus_message_get_cookie</refname>
35 <refname>sd_bus_message_get_reply_cookie</refname>
36 <refpurpose>Returns the transaction cookie of a message</refpurpose>
41 <funcsynopsisinfo>#include <elogind/sd-bus.h></funcsynopsisinfo>
44 <funcdef>int <function>sd_bus_message_get_cookie</function></funcdef>
45 <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
46 <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
50 <funcdef>int <function>sd_bus_message_get_reply_cookie</function></funcdef>
51 <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
52 <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
58 <title>Description</title>
60 <para><function>sd_bus_message_get_cookie()</function> returns the
61 transaction cookie of a message. The cookie uniquely identifies a
62 message within each bus peer, but is not globally unique. It is
63 assigned when a message is sent.</para>
65 <para><function>sd_bus_message_get_reply_cookie()</function>
66 returns the transaction cookie of the message the specified
67 message is a response to. When a reply message is generated for a
68 method call message, its cookie is copied over into this field.
69 Note that while every message that is transferred is identified by
70 a cookie, only response messages carry a reply cookie
73 <para>Both functions take a message object as first parameter and
74 a place to store the 64-bit cookie in.</para>
78 <title>Return Value</title>
80 <para>On success, these calls return 0 or a positive integer. On
81 failure, these calls return a negative errno-style error
84 <para>On success, the cookie/reply cookie is returned in the
85 specified 64-bit unsigned integer variable.</para>
91 <para>Returned errors may indicate the following problems:</para>
95 <term><constant>-EINVAL</constant></term>
97 <listitem><para>A specified parameter
98 is invalid.</para></listitem>
102 <term><constant>-ENODATA</constant></term>
104 <listitem><para>No cookie has been assigned to this message.
105 This either indicates that the message has not been sent yet
106 and hence has no cookie assigned, or that the message is not a
107 method response message and hence carries a reply cookie
108 field.</para></listitem>
113 <xi:include href="libelogind-pkgconfig.xml" />
116 <title>See Also</title>
119 <!-- 0 /// elogind is in section 8
120 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
122 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
124 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
125 <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>