Top |
void | gss_peer_manager_ensure_peer_credentials_async () |
gchar * | gss_peer_manager_ensure_peer_credentials_finish () |
const gchar * | gss_peer_manager_get_peer_credentials () |
A peer manager is an abstraction over the management of peers on a D-Bus connection, monitoring when they disappear, and allowing querying and caching of their credentials.
Currently, the only credential stored is the path to the peer’s executable, which can be used to identify that peer. In future, other credentials may be added (and the API will change accordingly).
The default implementation for production use is GssPeerManagerDBus, which uses the D-Bus daemon to get credentials. Unit tests will use a different implementation, allowing them to provide fake data to the service easily.
void gss_peer_manager_ensure_peer_credentials_async (GssPeerManager *self
,const gchar *sender
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Ensure the credentials for a peer are in the peer manager, querying them from
the D-Bus daemon if needed. Also start watching the sender
, so that if it
disappears from the bus, a “peer-vanished” signal will be
emitted.
self |
||
sender |
D-Bus unique name for the peer |
|
cancellable |
a GCancellable, or |
[nullable] |
callback |
callback to call once the asynchronous operation is complete |
|
user_data |
data to pass to |
Since: 0.1.0
gchar * gss_peer_manager_ensure_peer_credentials_finish (GssPeerManager *self
,GAsyncResult *result
,GError **error
);
Finish ensuring the credentials for a peer are in the peer manager. See
gss_peer_manager_ensure_peer_credentials_async()
.
Since: 0.1.0
const gchar * gss_peer_manager_get_peer_credentials (GssPeerManager *self
,const gchar *sender
);
Get the credentials for the given peer. If no credentials are in the cache
for sender
, NULL
will be returned.
Since: 0.1.0
typedef struct _GssPeerManager GssPeerManager;
An interface for D-Bus peer management. The typical production implementation of this is GssPeerManagerDBus; other implementations can be written to be used during testing, returning mock results.
Since: 0.1.0
struct GssPeerManagerInterface { GTypeInterface g_iface; void (*ensure_peer_credentials_async) (GssPeerManager *manager, const gchar *sender, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gchar *(*ensure_peer_credentials_finish) (GssPeerManager *manager, GAsyncResult *result, GError **error); const gchar *(*get_peer_credentials) (GssPeerManager *manager, const gchar *sender); };
An interface which exposes peers for the service (typically, D-Bus clients which are calling its methods) and allows querying of their credentials, and notification of when they disappear.
All virtual methods in this interface are mandatory to implement if the interface is implemented.
Query for the credentials of the given peer, and ensure they are in the peer manager’s cache. |
||
Finish an asynchronous query operation
started with |
||
Get credentials for a peer out of the peer manager’s
cache. If the peer is not known to the manager, return |
Since: 0.1.0