]>
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 ZJS |
6 | SPDX-License-Identifier: LGPL-2.1+ |
7 | ||
99e0f83e LP |
8 | This file is part of systemd. |
9 | ||
10 | Copyright 2013 Lennart Poettering | |
99e0f83e LP |
11 | --> |
12 | ||
7d6b2723 ZJS |
13 | <refentry id="sd_bus_message_get_cookie" |
14 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
99e0f83e | 15 | |
798d3a52 ZJS |
16 | <refentryinfo> |
17 | <title>sd_bus_message_get_cookie</title> | |
18 | <productname>systemd</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 <systemd/sd-bus.h></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 | ||
7d6b2723 | 115 | <xi:include href="libsystemd-pkgconfig.xml" /> |
798d3a52 ZJS |
116 | |
117 | <refsect1> | |
118 | <title>See Also</title> | |
119 | ||
120 | <para> | |
121 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
122 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
123 | <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
124 | </para> | |
125 | </refsect1> | |
99e0f83e LP |
126 | |
127 | </refentry> |