Branch data Line data Source code
1 : : /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- 2 : : * 3 : : * Copyright © 2018 Endless Mobile, Inc. 4 : : * 5 : : * This library is free software; you can redistribute it and/or 6 : : * modify it under the terms of the GNU Lesser General Public 7 : : * License as published by the Free Software Foundation; either 8 : : * version 2.1 of the License, or (at your option) any later version. 9 : : * 10 : : * This library is distributed in the hope that it will be useful, 11 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 : : * Lesser General Public License for more details. 14 : : * 15 : : * You should have received a copy of the GNU Lesser General Public 16 : : * License along with this library; if not, write to the Free Software 17 : : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 : : * 19 : : * Authors: 20 : : * - Philip Withnall <withnall@endlessm.com> 21 : : */ 22 : : 23 : : #pragma once 24 : : 25 : : #include <glib.h> 26 : : #include <glib-object.h> 27 : : 28 : : G_BEGIN_DECLS 29 : : 30 : : #define MWS_TYPE_PEER_MANAGER mws_peer_manager_get_type () 31 [ + + + - : 438 : G_DECLARE_INTERFACE (MwsPeerManager, mws_peer_manager, MWS, PEER_MANAGER, GObject) - + ] 32 : : 33 : : /** 34 : : * MwsPeerManagerInterface: 35 : : * @g_iface: parent interface 36 : : * @ensure_peer_credentials_async: Query for the credentials of the given peer, 37 : : * and ensure they are in the peer manager’s cache. 38 : : * @ensure_peer_credentials_finish: Finish an asynchronous query operation 39 : : * started with @ensure_peer_credentials_async. 40 : : * @get_peer_credentials: Get credentials for a peer out of the peer manager’s 41 : : * cache. If the peer is not known to the manager, return %NULL. 42 : : * 43 : : * An interface which exposes peers for the scheduler (typically, D-Bus clients 44 : : * which are adding schedule entries to the scheduler) and allows querying of 45 : : * their credentials, and notification of when they disappear. 46 : : * 47 : : * All virtual methods in this interface are mandatory to implement if the 48 : : * interface is implemented. 49 : : * 50 : : * Since: 0.1.0 51 : : */ 52 : : struct _MwsPeerManagerInterface 53 : : { 54 : : GTypeInterface g_iface; 55 : : 56 : : void (*ensure_peer_credentials_async) (MwsPeerManager *manager, 57 : : const gchar *sender, 58 : : GCancellable *cancellable, 59 : : GAsyncReadyCallback callback, 60 : : gpointer user_data); 61 : : gchar *(*ensure_peer_credentials_finish) (MwsPeerManager *manager, 62 : : GAsyncResult *result, 63 : : GError **error); 64 : : 65 : : const gchar *(*get_peer_credentials) (MwsPeerManager *manager, 66 : : const gchar *sender); 67 : : }; 68 : : 69 : : void mws_peer_manager_ensure_peer_credentials_async (MwsPeerManager *self, 70 : : const gchar *sender, 71 : : GCancellable *cancellable, 72 : : GAsyncReadyCallback callback, 73 : : gpointer user_data); 74 : : gchar *mws_peer_manager_ensure_peer_credentials_finish (MwsPeerManager *self, 75 : : GAsyncResult *result, 76 : : GError **error); 77 : : 78 : : const gchar *mws_peer_manager_get_peer_credentials (MwsPeerManager *self, 79 : : const gchar *sender); 80 : : 81 : : G_END_DECLS