1 /* dnssd-proxy.h 2 * 3 * Copyright (c) 2018-2024 Apple Inc. All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * https://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 * Discovery Proxy globals. 18 */ 19 20 #ifndef __DNSSD_PROXY_H__ 21 #define __DNSSD_PROXY_H__ 22 23 #include "srp-features.h" 24 #include "dns-msg.h" 25 #include "ioloop.h" 26 27 //====================================================================================================================== 28 // MARK: - Macros 29 30 #define MAX_ADDRS 10 31 extern comm_t *NULLABLE dnssd_proxy_listeners[4 + MAX_ADDRS]; 32 extern int dnssd_proxy_num_listeners; 33 extern uint16_t dnssd_proxy_udp_port; 34 extern uint16_t dnssd_proxy_tcp_port; 35 extern uint16_t dnssd_proxy_tls_port; 36 37 #ifdef SRP_TEST_SERVER 38 bool configure_dnssd_proxy(void); 39 #endif 40 41 #if (!SRP_FEATURE_COMBINED_SRP_DNSSD_PROXY) 42 // FIXME: set CERTWRITE_PROGRAM and GENKEY_PROGRAM to correct one. 43 #ifndef CERTWRITE_PROGRAM 44 #define CERTWRITE_PROGRAM "/bin/echo" 45 #endif 46 #ifndef GENKEY_PROGRAM 47 #define GENKEY_PROGRAM "/bin/echo" 48 #endif 49 #endif // #if (!SRP_FEATURE_COMBINED_SRP_DNSSD_PROXY) 50 51 #define AUTOMATIC_BROWSING_DOMAIN "lb._dns-sd._udp.local." 52 #define THREAD_NETWORK_NAME "openthread" 53 #define THREAD_BROWSING_DOMAIN THREAD_NETWORK_NAME ".thread.home.arpa." 54 55 #define LOCAL_ONLY_PSEUDO_INTERFACE "local only pseudo interface" 56 #define ALL_LOCALS_PSEUDO_INTERFACE "all locally-discoverable services pseudo interface" 57 #define INFRASTRUCTURE_PSEUDO_INTERFACE "infrastructure interface" 58 59 #define DNS_OVER_TLS_DEFAULT_PORT 853 60 61 typedef struct served_domain served_domain_t; 62 63 //====================================================================================================================== 64 // MARK: - Functions 65 66 // We can only initialize dnssd-proxy in srp-mdns-proxy if we combined it with srp-mdns-proxy. 67 #if (SRP_FEATURE_COMBINED_SRP_DNSSD_PROXY) && !defined(RA_TESTER) 68 #ifdef SRP_TEST_SERVER 69 extern served_domain_t *NULLABLE last_freed_domain; 70 #endif 71 bool init_dnssd_proxy(srp_server_t *NONNULL server_state); 72 served_domain_t *NULLABLE delete_served_domain_by_interface_name(const char *const NONNULL interface_name); 73 #endif // #if (SRP_FEATURE_COMBINED_SRP_DNSSD_PROXY) 74 75 void dnssd_proxy_ifaddr_callback(srp_server_t *NULLABLE server_state, void *NULLABLE context, const char *NONNULL name, 76 const addr_t *NONNULL address, const addr_t *NONNULL mask, uint32_t UNUSED flags, 77 enum interface_address_change event_type); 78 void dp_start_dropping(void); 79 void dns_proxy_input_for_server(comm_t *NONNULL comm, 80 srp_server_t *NONNULL server_state, message_t *NONNULL message, void *NULLABLE context); 81 #endif // #ifndef __DNSSD_PROXY_H__ 82 83 // Local Variables: 84 // mode: C 85 // tab-width: 4 86 // c-file-style: "bsd" 87 // c-basic-offset: 4 88 // fill-column: 108 89 // indent-tabs-mode: nil 90 // End: 91