]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_message_get_cookie.xml
Merge pull request #9116 from poettering/tmpfiles-tmp-var-tmp
[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 This file is part of systemd.
9
10 Copyright 2013 Lennart Poettering
11 -->
12
13 <refentry id="sd_bus_message_get_cookie">
14
15 <refentryinfo>
16 <title>sd_bus_message_get_cookie</title>
17 <productname>systemd</productname>
18
19 <authorgroup>
20 <author>
21 <contrib>Developer</contrib>
22 <firstname>Lennart</firstname>
23 <surname>Poettering</surname>
24 <email>lennart@poettering.net</email>
25 </author>
26 </authorgroup>
27 </refentryinfo>
28
29 <refmeta>
30 <refentrytitle>sd_bus_message_get_cookie</refentrytitle>
31 <manvolnum>3</manvolnum>
32 </refmeta>
33
34 <refnamediv>
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>
38 </refnamediv>
39
40 <refsynopsisdiv>
41 <funcsynopsis>
42 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
43
44 <funcprototype>
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>
48 </funcprototype>
49
50 <funcprototype>
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>
54 </funcprototype>
55 </funcsynopsis>
56 </refsynopsisdiv>
57
58 <refsect1>
59 <title>Description</title>
60
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>
65
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
72 field.</para>
73
74 <para>Both functions take a message object as first parameter and
75 a place to store the 64-bit cookie in.</para>
76 </refsect1>
77
78 <refsect1>
79 <title>Return Value</title>
80
81 <para>On success, these calls return 0 or a positive integer. On
82 failure, these calls return a negative errno-style error
83 code.</para>
84
85 <para>On success, the cookie/reply cookie is returned in the
86 specified 64-bit unsigned integer variable.</para>
87 </refsect1>
88
89 <refsect1>
90 <title>Errors</title>
91
92 <para>Returned errors may indicate the following problems:</para>
93
94 <variablelist>
95 <varlistentry>
96 <term><constant>-EINVAL</constant></term>
97
98 <listitem><para>A specified parameter
99 is invalid.</para></listitem>
100 </varlistentry>
101
102 <varlistentry>
103 <term><constant>-ENODATA</constant></term>
104
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>
110 </varlistentry>
111 </variablelist>
112 </refsect1>
113
114 <refsect1>
115 <title>Notes</title>
116
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
120 linked to with the
121 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
122 file.</para>
123 </refsect1>
124
125 <refsect1>
126 <title>See Also</title>
127
128 <para>
129 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
131 <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
132 </para>
133 </refsect1>
134
135 </refentry>