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 This file is part of elogind.
7 SPDX-License-Identifier: LGPL-2.1+
10 Copyright 2013 Lennart Poettering
13 <refentry id="sd_bus_message_get_cookie">
16 <title>sd_bus_message_get_cookie</title>
17 <productname>elogind</productname>
21 <contrib>Developer</contrib>
22 <firstname>Lennart</firstname>
23 <surname>Poettering</surname>
24 <email>lennart@poettering.net</email>
30 <refentrytitle>sd_bus_message_get_cookie</refentrytitle>
31 <manvolnum>3</manvolnum>
35 <refname>sd_bus_message_get_cookie</refname>
36 <refname>sd_bus_message_get_reply_cookie</refname>
37 <refpurpose>Returns the transaction cookie of a message</refpurpose>
42 <funcsynopsisinfo>#include <elogind/sd-bus.h></funcsynopsisinfo>
45 <funcdef>int <function>sd_bus_message_get_cookie</function></funcdef>
46 <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
47 <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
51 <funcdef>int <function>sd_bus_message_get_reply_cookie</function></funcdef>
52 <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
53 <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
59 <title>Description</title>
61 <para><function>sd_bus_message_get_cookie()</function> returns the
62 transaction cookie of a message. The cookie uniquely identifies a
63 message within each bus peer, but is not globally unique. It is
64 assigned when a message is sent.</para>
66 <para><function>sd_bus_message_get_reply_cookie()</function>
67 returns the transaction cookie of the message the specified
68 message is a response to. When a reply message is generated for a
69 method call message, its cookie is copied over into this field.
70 Note that while every message that is transferred is identified by
71 a cookie, only response messages carry a reply cookie
74 <para>Both functions take a message object as first parameter and
75 a place to store the 64-bit cookie in.</para>
79 <title>Return Value</title>
81 <para>On success, these calls return 0 or a positive integer. On
82 failure, these calls return a negative errno-style error
85 <para>On success, the cookie/reply cookie is returned in the
86 specified 64-bit unsigned integer variable.</para>
92 <para>Returned errors may indicate the following problems:</para>
96 <term><constant>-EINVAL</constant></term>
98 <listitem><para>A specified parameter
99 is invalid.</para></listitem>
103 <term><constant>-ENODATA</constant></term>
105 <listitem><para>No cookie has been assigned to this message.
106 This either indicates that the message has not been sent yet
107 and hence has no cookie assigned, or that the message is not a
108 method response message and hence carries a reply cookie
109 field.</para></listitem>
117 <para>The <function>sd_bus_message_get_cookie()</function> and
118 <function>sd_bus_message_get_reply_cookie()</function> interfaces
119 are available as a shared library, which can be compiled and
121 <constant>libelogind</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
126 <title>See Also</title>
129 <!-- 0 /// elogind is in section 8
130 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
132 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>