• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef DISCOVERY_COMMON_REPORTING_CLIENT_H_
6 #define DISCOVERY_COMMON_REPORTING_CLIENT_H_
7 
8 #include "platform/base/error.h"
9 
10 namespace openscreen {
11 namespace discovery {
12 
13 // This class is implemented by the embedder who wishes to use discovery. The
14 // discovery implementation will use this API to report back errors and metrics.
15 // NOTE: All methods in the reporting client will be called from the task runner
16 // thread.
17 // TODO(rwkeane): Report state changes back to the caller.
18 class ReportingClient {
19  public:
20   virtual ~ReportingClient() = default;
21 
22   // This method is called when an error is detected by the underlying
23   // infrastructure from which recovery cannot be initiated. For example, an
24   // error binding a multicast socket.
25   virtual void OnFatalError(Error error) = 0;
26 
27   // This method is called when an error is detected by the underlying
28   // infrastructure which does not prevent further functionality of the runtime.
29   // For example, a conversion failure between DnsSdInstanceRecord and the
30   // externally supplied class.
31   virtual void OnRecoverableError(Error error) = 0;
32 };
33 
34 }  // namespace discovery
35 }  // namespace openscreen
36 
37 #endif  // DISCOVERY_COMMON_REPORTING_CLIENT_H_
38