summaryrefslogtreecommitdiff
path: root/common/netd/binder/android/net/mdns/aidl/IMDns.aidl
blob: 255d70ffeab5ef53029eae2eefd271c5f2f700a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net.mdns.aidl;

import android.net.mdns.aidl.DiscoveryInfo;
import android.net.mdns.aidl.GetAddressInfo;
import android.net.mdns.aidl.IMDnsEventListener;
import android.net.mdns.aidl.RegistrationInfo;
import android.net.mdns.aidl.ResolutionInfo;

/** {@hide} */
interface IMDns {
    /**
     * Start the MDNSResponder daemon.
     *
     * @throws ServiceSpecificException with unix errno EALREADY if daemon is already running.
     */
    void startDaemon();

    /**
     * Stop the MDNSResponder daemon.
     *
     * @throws ServiceSpecificException with unix errno EBUSY if daemon is still in use.
     */
    void stopDaemon();

    /**
     * Start registering a service.
     * This operation will send a service registration request to MDNSResponder. Register a listener
     * via IMDns#registerEventListener to get the registration result SERVICE_REGISTERED/
     * SERVICE_REGISTRATION_FAILED from callback IMDnsEventListener#onServiceRegistrationStatus.
     *
     * @param info The service information to register.
     *
     * @throws ServiceSpecificException with one of the following error values:
     *         - Unix errno EBUSY if request id is already in use.
     *         - kDNSServiceErr_* list in dns_sd.h if registration fail.
     */
    void registerService(in RegistrationInfo info);

    /**
     * Start discovering services.
     * This operation will send a request to MDNSResponder to discover services. Register a listener
     * via IMDns#registerEventListener to get the discovery result SERVICE_FOUND/SERVICE_LOST/
     * SERVICE_DISCOVERY_FAILED from callback IMDnsEventListener#onServiceDiscoveryStatus.
     *
     * @param info The service to discover.
     *
     * @throws ServiceSpecificException with one of the following error values:
     *         - Unix errno EBUSY if request id is already in use.
     *         - kDNSServiceErr_* list in dns_sd.h if discovery fail.
     */
    void discover(in DiscoveryInfo info);

    /**
     * Start resolving the target service.
     * This operation will send a request to MDNSResponder to resolve the target service. Register a
     * listener via IMDns#registerEventListener to get the resolution result SERVICE_RESOLVED/
     * SERVICE_RESOLUTION_FAILED from callback IMDnsEventListener#onServiceResolutionStatus.
     *
     * @param info The service to resolve.
     *
     * @throws ServiceSpecificException with one of the following error values:
     *         - Unix errno EBUSY if request id is already in use.
     *         - kDNSServiceErr_* list in dns_sd.h if resolution fail.
     */
    void resolve(in ResolutionInfo info);

    /**
     * Start getting the target service address.
     * This operation will send a request to MDNSResponder to get the target service address.
     * Register a listener via IMDns#registerEventListener to get the query result
     * SERVICE_GET_ADDR_SUCCESS/SERVICE_GET_ADDR_FAILED from callback
     * IMDnsEventListener#onGettingServiceAddressStatus.
     *
     * @param info the getting service address information.
     *
     * @throws ServiceSpecificException with one of the following error values:
     *         - Unix errno EBUSY if request id is already in use.
     *         - kDNSServiceErr_* list in dns_sd.h if getting address fail.
     */
    void getServiceAddress(in GetAddressInfo info);

    /**
     * Stop a operation which's requested before.
     *
     * @param id the operation id to be stopped.
     *
     * @throws ServiceSpecificException with unix errno ESRCH if request id is not in use.
     */
    void stopOperation(int id);

    /**
     * Register an event listener.
     *
     * @param listener The listener to be registered.
     *
     * @throws ServiceSpecificException with one of the following error values:
     *         - Unix errno EINVAL if listener is null.
     *         - Unix errno EEXIST if register duplicated listener.
     */
    void registerEventListener(in IMDnsEventListener listener);

    /**
     * Unregister an event listener.
     *
     * @param listener The listener to be unregistered.
     *
     * @throws ServiceSpecificException with unix errno EINVAL if listener is null.
     */
    void unregisterEventListener(in IMDnsEventListener listener);
}