• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2022, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "MDnsEventReporter.h"
20 #include "MDnsSdListener.h"
21 
22 #include <android/net/mdns/aidl/BnMDns.h>
23 #include <binder/BinderService.h>
24 
25 namespace android::net {
26 
27 class MDnsService : public BinderService<MDnsService>, public android::net::mdns::aidl::BnMDns {
28   public:
29     static status_t start();
getServiceName()30     static char const* getServiceName() { return "mdns"; }
31 
32     binder::Status startDaemon() override;
33     binder::Status stopDaemon() override;
34     binder::Status registerService(
35             const ::android::net::mdns::aidl::RegistrationInfo& info) override;
36     binder::Status discover(const ::android::net::mdns::aidl::DiscoveryInfo& info) override;
37     binder::Status resolve(const ::android::net::mdns::aidl::ResolutionInfo& info) override;
38     binder::Status getServiceAddress(
39             const ::android::net::mdns::aidl::GetAddressInfo& info) override;
40     binder::Status stopOperation(int32_t id) override;
41     binder::Status registerEventListener(
42             const android::sp<android::net::mdns::aidl::IMDnsEventListener>& listener) override;
43     binder::Status unregisterEventListener(
44             const android::sp<android::net::mdns::aidl::IMDnsEventListener>& listener) override;
45 
46   private:
47     MDnsSdListener mListener;
48 };
49 
50 }  // namespace android::net
51