1.1 --- a/libfsserver/include/fsserver/notification.h Fri Mar 11 22:16:00 2022 +0100
1.2 +++ b/libfsserver/include/fsserver/notification.h Sun Mar 13 01:24:40 2022 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Notification support.
1.6 *
1.7 - * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -21,6 +21,7 @@
1.13
1.14 #pragma once
1.15
1.16 +#include <map>
1.17 #include <mutex>
1.18 #include <set>
1.19 #include <vector>
1.20 @@ -29,9 +30,14 @@
1.21
1.22
1.23
1.24 +/* Forward declaration. */
1.25 +
1.26 +class NotifierPeerEndpoint;
1.27 +
1.28 /* Collection data types. */
1.29
1.30 typedef std::set<l4_cap_idx_t> NotifierSet;
1.31 +typedef std::map<l4_cap_idx_t, NotifierPeerEndpoint *> NotifierPeerMap;
1.32
1.33 /* Notification endpoint details. */
1.34
1.35 @@ -62,6 +68,10 @@
1.36
1.37 NotificationEndpointList _endpoints;
1.38
1.39 + /* Notifier peer details. */
1.40 +
1.41 + NotifierPeerMap _peers;
1.42 +
1.43 /* Deferred notifications for new endpoints. */
1.44
1.45 notify_flags_t _deferred = 0;
1.46 @@ -70,7 +80,10 @@
1.47
1.48 virtual void _notify(unsigned int endpoint, notify_flags_t flags);
1.49
1.50 - virtual void _subscribe(unsigned int endpoint, l4_cap_idx_t notifier, notify_flags_t flags);
1.51 + virtual long _subscribe(unsigned int endpoint, l4_cap_idx_t notifier,
1.52 + notify_flags_t flags, l4_cap_idx_t *peer);
1.53 +
1.54 + virtual void _unsubscribe(unsigned int endpoint, l4_cap_idx_t notifier);
1.55
1.56 public:
1.57 explicit NotificationSupport(unsigned int endpoints=0);
1.58 @@ -83,9 +96,13 @@
1.59
1.60 virtual void notify_others(unsigned int endpoint, notify_flags_t flags);
1.61
1.62 - virtual unsigned int subscribe(l4_cap_idx_t notifier, notify_flags_t flags);
1.63 + virtual long subscribe(l4_cap_idx_t notifier, notify_flags_t flags,
1.64 + l4_cap_idx_t *peer, unsigned int *endpoint_number);
1.65
1.66 - virtual void subscribe(unsigned int endpoint, l4_cap_idx_t notifier, notify_flags_t flags);
1.67 + virtual long subscribe(unsigned int endpoint, l4_cap_idx_t notifier,
1.68 + notify_flags_t flags, l4_cap_idx_t *peer);
1.69 +
1.70 + virtual void unsubscribe(unsigned int endpoint, l4_cap_idx_t notifier);
1.71 };
1.72
1.73 // vim: tabstop=4 expandtab shiftwidth=4