]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_message_get_cookie.xml
tree-wide: remove Lennart's copyright lines
[thirdparty/systemd.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>systemd</productname>
15
16 <authorgroup>
17 <author>
18 <contrib>Developer</contrib>
19 <firstname>Lennart</firstname>
20 <surname>Poettering</surname>
21 <email>lennart@poettering.net</email>
22 </author>
23 </authorgroup>
24 </refentryinfo>
25
26 <refmeta>
27 <refentrytitle>sd_bus_message_get_cookie</refentrytitle>
28 <manvolnum>3</manvolnum>
29 </refmeta>
30
31 <refnamediv>
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>
35 </refnamediv>
36
37 <refsynopsisdiv>
38 <funcsynopsis>
39 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
40
41 <funcprototype>
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>
45 </funcprototype>
46
47 <funcprototype>
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>
51 </funcprototype>
52 </funcsynopsis>
53 </refsynopsisdiv>
54
55 <refsect1>
56 <title>Description</title>
57
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>
62
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
69 field.</para>
70
71 <para>Both functions take a message object as first parameter and
72 a place to store the 64-bit cookie in.</para>
73 </refsect1>
74
75 <refsect1>
76 <title>Return Value</title>
77
78 <para>On success, these calls return 0 or a positive integer. On
79 failure, these calls return a negative errno-style error
80 code.</para>
81
82 <para>On success, the cookie/reply cookie is returned in the
83 specified 64-bit unsigned integer variable.</para>
84 </refsect1>
85
86 <refsect1>
87 <title>Errors</title>
88
89 <para>Returned errors may indicate the following problems:</para>
90
91 <variablelist>
92 <varlistentry>
93 <term><constant>-EINVAL</constant></term>
94
95 <listitem><para>A specified parameter
96 is invalid.</para></listitem>
97 </varlistentry>
98
99 <varlistentry>
100 <term><constant>-ENODATA</constant></term>
101
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>
107 </varlistentry>
108 </variablelist>
109 </refsect1>
110
111 <xi:include href="libsystemd-pkgconfig.xml" />
112
113 <refsect1>
114 <title>See Also</title>
115
116 <para>
117 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
118 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
119 <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
120 </para>
121 </refsect1>
122
123 </refentry>