summaryrefslogtreecommitdiffstats
path: root/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.c
blob: dd670ab1182be6ceaefff850d54e8854ec458f13 (plain) (blame)
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
/* -*- Mode: C; tab-width: 4 -*-
 *
 * Copyright (c) 2002-2012 Apple Inc. All rights reserved.
 *
 * 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.
 */

// Suppress "warning: 'DNSServiceDiscoveryMachPort' is deprecated" messages -- we already know this code is building the deprecated API
// Since we compile with all warnings treated as errors, we have to turn off the warnings here or the project won't compile
#include <AvailabilityMacros.h>
#undef AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED
#define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED
#undef AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3
#define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3

#include "../mDNSMacOSX/DNSServiceDiscovery.h"
#include "DNSServiceDiscoveryDefines.h"

#include <stdlib.h>
#include <stdio.h>
#include <servers/bootstrap.h>
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <pthread.h>

#include <netinet/in.h>

extern boolean_t DNSServiceDiscoveryReply_server(
    mach_msg_header_t *InHeadP,
    mach_msg_header_t *OutHeadP);

extern
kern_return_t DNSServiceBrowserCreate_rpc
(
    mach_port_t server,
    mach_port_t client,
    DNSCString regtype,
    DNSCString domain
);


extern
kern_return_t DNSServiceResolverResolve_rpc
(
    mach_port_t server,
    mach_port_t client,
    DNSCString name,
    DNSCString regtype,
    DNSCString domain
);


struct a_requests {
    struct a_requests       *next;
    mach_port_t client_port;
    union {
        DNSServiceBrowserReply browserCallback;
        DNSServiceDomainEnumerationReply enumCallback;
        DNSServiceRegistrationReply regCallback;
        DNSServiceResolverReply resolveCallback;
    } callout;
    void                    *context;
};

typedef struct _dns_service_discovery_t {
    mach_port_t port;
} dns_service_discovery_t;


dns_service_discovery_ref DNSServiceBrowserCreate (const char *regtype, const char *domain, DNSServiceBrowserReply callBack,void *context)
{
    
    (void) regtype;          // Unused
    (void) domain;           // Unused
    (void) callBack;         // Unused
    (void) context;          // Unused
    
    printf("DNSServiceBrowserCreate deprecated since 10.3 \n");
    return NULL;
    
}

dns_service_discovery_ref DNSServiceResolverResolve(const char *name, const char *regtype, const char *domain, DNSServiceResolverReply callBack, void *context)
{
    (void) name;             // Unused
    (void) regtype;          // Unused
    (void) domain;           // Unused
    (void) callBack;         // Unused
    (void) context;          // Unused
    
    printf("DNSServiceResolverResolve deprecated since 10.3 \n");
    return NULL;

}

void DNSServiceDiscovery_handleReply(void *replyMsg)
{
    (void) replyMsg;             // Unused
    printf("DNSServiceDiscovery_handleReply deprecated since 10.3 \n");
}

mach_port_t DNSServiceDiscoveryMachPort(dns_service_discovery_ref dnsServiceDiscovery)
{
    printf("DNSServiceDiscoveryMachPort deprecated since 10.3 \n");
    return dnsServiceDiscovery->port;
}

void DNSServiceDiscoveryDeallocate(dns_service_discovery_ref dnsServiceDiscovery)
{
    (void) dnsServiceDiscovery;             // Unused
    printf("DNSServiceDiscoveryDeallocate deprecated since 10.3 \n");
}