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