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