chiark / gitweb /
Prep v239: As we need the rootlibexecdir, 73-seat-late.rules.m4 must be configured...
[elogind.git] / man / sd_bus_message_get_cookie.xml
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">
4
5 <!--
6   SPDX-License-Identifier: LGPL-2.1+
7 -->
8
9 <refentry id="sd_bus_message_get_cookie"
10           xmlns:xi="http://www.w3.org/2001/XInclude">
11
12   <refentryinfo>
13     <title>sd_bus_message_get_cookie</title>
14     <productname>elogind</productname>
15   </refentryinfo>
16
17   <refmeta>
18     <refentrytitle>sd_bus_message_get_cookie</refentrytitle>
19     <manvolnum>3</manvolnum>
20   </refmeta>
21
22   <refnamediv>
23     <refname>sd_bus_message_get_cookie</refname>
24     <refname>sd_bus_message_get_reply_cookie</refname>
25     <refpurpose>Returns the transaction cookie of a message</refpurpose>
26   </refnamediv>
27
28   <refsynopsisdiv>
29     <funcsynopsis>
30       <funcsynopsisinfo>#include &lt;elogind/sd-bus.h&gt;</funcsynopsisinfo>
31
32       <funcprototype>
33         <funcdef>int <function>sd_bus_message_get_cookie</function></funcdef>
34         <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
35         <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
36       </funcprototype>
37
38       <funcprototype>
39         <funcdef>int <function>sd_bus_message_get_reply_cookie</function></funcdef>
40         <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
41         <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
42       </funcprototype>
43     </funcsynopsis>
44   </refsynopsisdiv>
45
46   <refsect1>
47     <title>Description</title>
48
49     <para><function>sd_bus_message_get_cookie()</function> returns the
50     transaction cookie of a message. The cookie uniquely identifies a
51     message within each bus peer, but is not globally unique. It is
52     assigned when a message is sent.</para>
53
54     <para><function>sd_bus_message_get_reply_cookie()</function>
55     returns the transaction cookie of the message the specified
56     message is a response to. When a reply message is generated for a
57     method call message, its cookie is copied over into this field.
58     Note that while every message that is transferred is identified by
59     a cookie, only response messages carry a reply cookie
60     field.</para>
61
62     <para>Both functions take a message object as first parameter and
63     a place to store the 64-bit cookie in.</para>
64   </refsect1>
65
66   <refsect1>
67     <title>Return Value</title>
68
69     <para>On success, these calls return 0 or a positive integer. On
70     failure, these calls return a negative errno-style error
71     code.</para>
72
73     <para>On success, the cookie/reply cookie is returned in the
74     specified 64-bit unsigned integer variable.</para>
75   </refsect1>
76
77   <refsect1>
78     <title>Errors</title>
79
80     <para>Returned errors may indicate the following problems:</para>
81
82     <variablelist>
83       <varlistentry>
84         <term><constant>-EINVAL</constant></term>
85
86         <listitem><para>A specified parameter
87         is invalid.</para></listitem>
88       </varlistentry>
89
90       <varlistentry>
91         <term><constant>-ENODATA</constant></term>
92
93         <listitem><para>No cookie has been assigned to this message.
94         This either indicates that the message has not been sent yet
95         and hence has no cookie assigned, or that the message is not a
96         method response message and hence carries a reply cookie
97         field.</para></listitem>
98       </varlistentry>
99     </variablelist>
100   </refsect1>
101
102   <xi:include href="libelogind-pkgconfig.xml" />
103
104   <refsect1>
105     <title>See Also</title>
106
107     <para>
108       <!-- 0 /// elogind is in section 8
109       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
110       --><!-- else -->
111       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
112       <!-- // 0 -->
113       <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
114       <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
115     </para>
116   </refsect1>
117
118 </refentry>