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