Line | Branch | Exec | Source |
---|---|---|---|
1 | /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- | ||
2 | * | ||
3 | * Copyright © 2018 Endless Mobile, Inc. | ||
4 | * | ||
5 | * SPDX-License-Identifier: LGPL-2.1-or-later | ||
6 | * | ||
7 | * This library is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU Lesser General Public | ||
9 | * License as published by the Free Software Foundation; either | ||
10 | * version 2.1 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | * | ||
21 | * Authors: | ||
22 | * - Philip Withnall <withnall@endlessm.com> | ||
23 | */ | ||
24 | |||
25 | #pragma once | ||
26 | |||
27 | #include <glib.h> | ||
28 | #include <glib-object.h> | ||
29 | |||
30 | G_BEGIN_DECLS | ||
31 | |||
32 | /** | ||
33 | * GssPeerManagerError: | ||
34 | * @GSS_PEER_MANAGER_ERROR_IDENTIFYING_PEER: A peer which was interacting with | ||
35 | * this service could not be identified. | ||
36 | * | ||
37 | * Errors which can be returned by #GssPeerManager. | ||
38 | * | ||
39 | * Since: 0.1.0 | ||
40 | */ | ||
41 | typedef enum | ||
42 | { | ||
43 | GSS_PEER_MANAGER_ERROR_IDENTIFYING_PEER = 0, | ||
44 | } GssPeerManagerError; | ||
45 | |||
46 | GQuark gss_peer_manager_error_quark (void); | ||
47 | #define GSS_PEER_MANAGER_ERROR gss_peer_manager_error_quark () | ||
48 | |||
49 | #define GSS_TYPE_PEER_MANAGER gss_peer_manager_get_type () | ||
50 |
4/7✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
|
10 | G_DECLARE_INTERFACE (GssPeerManager, gss_peer_manager, GSS, PEER_MANAGER, GObject) |
51 | |||
52 | /** | ||
53 | * GssPeerManagerInterface: | ||
54 | * @g_iface: parent interface | ||
55 | * @ensure_peer_credentials_async: Query for the credentials of the given peer, | ||
56 | * and ensure they are in the peer manager’s cache. | ||
57 | * @ensure_peer_credentials_finish: Finish an asynchronous query operation | ||
58 | * started with @ensure_peer_credentials_async. | ||
59 | * @get_peer_credentials: Get credentials for a peer out of the peer manager’s | ||
60 | * cache. If the peer is not known to the manager, return %NULL. | ||
61 | * | ||
62 | * An interface which exposes peers for the service (typically, D-Bus clients | ||
63 | * which are calling its methods) and allows querying of their credentials, and | ||
64 | * notification of when they disappear. | ||
65 | * | ||
66 | * All virtual methods in this interface are mandatory to implement if the | ||
67 | * interface is implemented. | ||
68 | * | ||
69 | * Since: 0.1.0 | ||
70 | */ | ||
71 | struct _GssPeerManagerInterface | ||
72 | { | ||
73 | GTypeInterface g_iface; | ||
74 | |||
75 | void (*ensure_peer_credentials_async) (GssPeerManager *manager, | ||
76 | const gchar *sender, | ||
77 | GCancellable *cancellable, | ||
78 | GAsyncReadyCallback callback, | ||
79 | gpointer user_data); | ||
80 | gchar *(*ensure_peer_credentials_finish) (GssPeerManager *manager, | ||
81 | GAsyncResult *result, | ||
82 | GError **error); | ||
83 | |||
84 | const gchar *(*get_peer_credentials) (GssPeerManager *manager, | ||
85 | const gchar *sender); | ||
86 | }; | ||
87 | |||
88 | void gss_peer_manager_ensure_peer_credentials_async (GssPeerManager *self, | ||
89 | const gchar *sender, | ||
90 | GCancellable *cancellable, | ||
91 | GAsyncReadyCallback callback, | ||
92 | gpointer user_data); | ||
93 | gchar *gss_peer_manager_ensure_peer_credentials_finish (GssPeerManager *self, | ||
94 | GAsyncResult *result, | ||
95 | GError **error); | ||
96 | |||
97 | const gchar *gss_peer_manager_get_peer_credentials (GssPeerManager *self, | ||
98 | const gchar *sender); | ||
99 | |||
100 | G_END_DECLS | ||
101 |