]>
Commit | Line | Data |
---|---|---|
99e0f83e | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
99e0f83e | 5 | |
7d6b2723 ZJS |
6 | <refentry id="sd_bus_message_get_cookie" |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
99e0f83e | 8 | |
798d3a52 ZJS |
9 | <refentryinfo> |
10 | <title>sd_bus_message_get_cookie</title> | |
11 | <productname>systemd</productname> | |
798d3a52 ZJS |
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 <systemd/sd-bus.h></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 | ||
b1de39de ZJS |
66 | <para>On success, these calls return 0 or a positive integer. On failure, they return a negative |
67 | errno-style error code.</para> | |
798d3a52 | 68 | |
b1de39de ZJS |
69 | <para>On success, the cookie/reply cookie is returned in the specified 64-bit unsigned integer |
70 | variable.</para> | |
798d3a52 | 71 | |
b1de39de ZJS |
72 | <refsect2> |
73 | <title>Errors</title> | |
798d3a52 | 74 | |
b1de39de | 75 | <para>Returned errors may indicate the following problems:</para> |
798d3a52 | 76 | |
b1de39de ZJS |
77 | <variablelist> |
78 | <varlistentry> | |
79 | <term><constant>-EINVAL</constant></term> | |
798d3a52 | 80 | |
b1de39de ZJS |
81 | <listitem><para>A specified parameter is invalid.</para></listitem> |
82 | </varlistentry> | |
798d3a52 | 83 | |
b1de39de ZJS |
84 | <varlistentry> |
85 | <term><constant>-ENODATA</constant></term> | |
798d3a52 | 86 | |
b1de39de ZJS |
87 | <listitem><para>No cookie has been assigned to this message. This either indicates that the |
88 | message has not been sent yet and hence has no cookie assigned, or that the message is not a method | |
89 | response message and hence carries a reply cookie field.</para></listitem> | |
90 | </varlistentry> | |
91 | </variablelist> | |
92 | </refsect2> | |
798d3a52 ZJS |
93 | </refsect1> |
94 | ||
7d6b2723 | 95 | <xi:include href="libsystemd-pkgconfig.xml" /> |
798d3a52 ZJS |
96 | |
97 | <refsect1> | |
98 | <title>See Also</title> | |
99 | ||
100 | <para> | |
101 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
102 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
103 | <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
104 | </para> | |
105 | </refsect1> | |
99e0f83e LP |
106 | |
107 | </refentry> |