2 * Copyright (c) 2019-2020 Apple Inc. All rights reserved.
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
8 * https://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __MDNS_TRUST_CHECKS_H__
18 #define __MDNS_TRUST_CHECKS_H__
20 #include "mdns_base.h"
21 #include <dispatch/dispatch.h>
23 OS_CLOSED_ENUM(trust_policy_state
, int,
24 trust_policy_state_denied
= 0,
25 trust_policy_state_granted
= 1,
26 trust_policy_state_pending
= 2
29 OS_CLOSED_ENUM(trust_request
, int,
30 trust_request_bonjour
= 0,
31 trust_request_reg_service
= 1,
32 trust_request_query
= 2
35 MDNS_ASSUME_NONNULL_BEGIN
37 static inline const char *
38 _mdns_trust_checks_policy_to_string(trust_policy_state_t state
)
41 case trust_policy_state_denied
: return "denied";
42 case trust_policy_state_granted
: return "granted";
43 case trust_policy_state_pending
: return "pending";
44 default: return "<INVALID STATE>";
48 static inline const char *
49 _mdns_trust_checks_request_to_string(trust_request_t request
)
52 case trust_request_bonjour
: return "bonjour";
53 case trust_request_reg_service
: return "reg_service";
54 case trust_request_query
: return "query";
55 default: return "<INVALID REQUEST>";
60 mdns_trust_checks_init(void);
63 (^_mdns_trust_checks_update_handler_t
)(trust_policy_state_t status
);
66 mdns_trust_checks_local_network_access_policy_update(audit_token_t
*auditToken
, dispatch_queue_t queue
,
67 const char * _Nullable query
, mdns_trust_flags_t flags
, _mdns_trust_checks_update_handler_t handler
);
70 mdns_trust_checks_check(audit_token_t
*audit_token
, trust_request_t request
, const char * _Nullable query_name
,
71 const char * _Nullable service_name
, uint16_t qtype
, bool force_multicast
, mdns_trust_flags_t
* _Nullable flags
);
73 MDNS_ASSUME_NONNULL_END
75 #endif // __MDNS_TRUST_CHECKS_H__