rpcserver.c (d49d7b32) | rpcserver.c (305035be) |
---|---|
1/* 2 * PROJECT: ReactOS DNS Resolver 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: base/services/dnsrslvr/rpcserver.c 5 * PURPOSE: RPC server interface 6 * COPYRIGHT: Copyright 2016 Christoph von Wittich 7 */ 8 --- 31 unchanged lines hidden (view full) --- 40 DPRINT("RpcServerListen finished\n"); 41 return 0; 42} 43 44DWORD 45R_ResolverFlushCache( 46 DNSRSLVR_HANDLE pwszServerName) 47{ | 1/* 2 * PROJECT: ReactOS DNS Resolver 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: base/services/dnsrslvr/rpcserver.c 5 * PURPOSE: RPC server interface 6 * COPYRIGHT: Copyright 2016 Christoph von Wittich 7 */ 8 --- 31 unchanged lines hidden (view full) --- 40 DPRINT("RpcServerListen finished\n"); 41 return 0; 42} 43 44DWORD 45R_ResolverFlushCache( 46 DNSRSLVR_HANDLE pwszServerName) 47{ |
48 DPRINT("R_ResolverFlushCache()\n"); 49 |
|
48 // FIXME Should store (and flush) entries by server handle 49 DnsIntCacheFlush(); 50 return 0; 51} 52 53DWORD 54R_ResolverQuery( | 50 // FIXME Should store (and flush) entries by server handle 51 DnsIntCacheFlush(); 52 return 0; 53} 54 55DWORD 56R_ResolverQuery( |
55 DNSRSLVR_HANDLE pwszServerName, 56 LPCWSTR pwsName, | 57 DNSRSLVR_HANDLE pszServerName, 58 LPCWSTR pszName, |
57 WORD wType, | 59 WORD wType, |
58 DWORD Flags, | 60 DWORD dwFlags, |
59 DWORD *dwRecords, 60 DNS_RECORDW **ppResultRecords) 61{ | 61 DWORD *dwRecords, 62 DNS_RECORDW **ppResultRecords) 63{ |
62#if 0 63 DNS_QUERY_REQUEST QueryRequest = { 0 }; 64 DNS_QUERY_RESULT QueryResults = { 0 }; 65#endif 66 DNS_STATUS Status; 67 PDNS_RECORDW Record; | 64 PDNS_RECORDW Record; 65 DNS_STATUS Status; |
68 | 66 |
69 DPRINT1("R_ResolverQuery %p %p %x %lx %p %p\n", 70 pwszServerName, pwsName, wType, Flags, dwRecords, ppResultRecords); | 67 DPRINT("R_ResolverQuery(%S %S %x %lx %p %p)\n", 68 pszServerName, pszName, wType, dwFlags, dwRecords, ppResultRecords); |
71 | 69 |
72 if (!pwszServerName || !pwsName || !wType || !ppResultRecords) | 70 if (pszName == NULL || wType == 0 || ppResultRecords == NULL) |
73 return ERROR_INVALID_PARAMETER; 74 | 71 return ERROR_INVALID_PARAMETER; 72 |
75 // FIXME Should lookup entries by server handle 76 if (DnsIntCacheGetEntryFromName(pwsName, ppResultRecords)) | 73 if ((dwFlags & DNS_QUERY_WIRE_ONLY) != 0 && (dwFlags & DNS_QUERY_NO_WIRE_QUERY) != 0) 74 return ERROR_INVALID_PARAMETER; 75 76 if (DnsIntCacheGetEntryFromName(pszName, ppResultRecords)) |
77 { | 77 { |
78 DPRINT("DNS cache query successful!\n"); |
|
78 Status = ERROR_SUCCESS; 79 } 80 else 81 { | 79 Status = ERROR_SUCCESS; 80 } 81 else 82 { |
82#if 0 83 QueryRequest.Version = DNS_QUERY_REQUEST_VERSION1; 84 QueryRequest.QueryType = wType; 85 QueryRequest.QueryName = pwsName; 86 QueryRequest.QueryOptions = Flags; 87 QueryResults.Version = DNS_QUERY_REQUEST_VERSION1; 88 89 Status = DnsQueryEx(&QueryRequest, &QueryResults, NULL); | 83 DPRINT("DNS query!\n"); 84 Status = Query_Main(pszName, 85 wType, 86 dwFlags, 87 ppResultRecords); |
90 if (Status == ERROR_SUCCESS) 91 { | 88 if (Status == ERROR_SUCCESS) 89 { |
92 // FIXME Should store (and flush) entries by server handle 93 DnsIntCacheAddEntry(QueryResults.pQueryRecords); 94 *ppResultRecords = QueryResults.pQueryRecords; | 90 DPRINT("DNS query successful!\n"); 91 DnsIntCacheAddEntry(*ppResultRecords); |
95 } | 92 } |
96#endif | |
97 } 98 99 if (dwRecords) | 93 } 94 95 if (dwRecords) |
96 { |
|
100 *dwRecords = 0; 101 | 97 *dwRecords = 0; 98 |
102 if (Status == ERROR_SUCCESS) 103 { 104 Record = *ppResultRecords; 105 while (Record) | 99 if (Status == ERROR_SUCCESS) |
106 { | 100 { |
107 if (dwRecords) | 101 Record = *ppResultRecords; 102 while (Record) 103 { 104 DPRINT("Record: %S\n", Record->pName); |
108 (*dwRecords)++; | 105 (*dwRecords)++; |
109 Record = Record->pNext; | 106 Record = Record->pNext; 107 } |
110 } 111 } 112 | 108 } 109 } 110 |
113 DPRINT1("R_ResolverQuery result %ld %ld\n", Status, *dwRecords); | 111 DPRINT("R_ResolverQuery result %ld %ld\n", Status, *dwRecords); |
114 115 return Status; 116} 117 118void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len) 119{ 120 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); 121} 122 123void __RPC_USER midl_user_free(void __RPC_FAR * ptr) 124{ 125 HeapFree(GetProcessHeap(), 0, ptr); 126} 127 128void __RPC_USER WLANSVC_RPC_HANDLE_rundown(DNSRSLVR_HANDLE hClientHandle) 129{ 130} | 112 113 return Status; 114} 115 116void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len) 117{ 118 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); 119} 120 121void __RPC_USER midl_user_free(void __RPC_FAR * ptr) 122{ 123 HeapFree(GetProcessHeap(), 0, ptr); 124} 125 126void __RPC_USER WLANSVC_RPC_HANDLE_rundown(DNSRSLVR_HANDLE hClientHandle) 127{ 128} |