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