Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame^] | 1 | // Copyright (c) FIRST and other WPILib contributors. |
| 2 | // Open Source Software; you can modify and/or share it under the terms of |
| 3 | // the WPILib BSD license file in the root directory of this project. |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #ifndef UNICODE |
| 8 | #define UNICODE |
| 9 | #endif |
| 10 | |
| 11 | #include <windows.h> |
| 12 | |
| 13 | #include <WinDNS.h> |
| 14 | |
| 15 | namespace wpi { |
| 16 | class DynamicDns { |
| 17 | public: |
| 18 | using DnsServiceFreeInstanceFunc = |
| 19 | VOID(WINAPI*)(_In_ PDNS_SERVICE_INSTANCE pInstance); |
| 20 | |
| 21 | using DnsServiceConstructInstanceFunc = PDNS_SERVICE_INSTANCE(WINAPI*)( |
| 22 | _In_ PCWSTR pServiceName, _In_ PCWSTR pHostName, |
| 23 | _In_opt_ PIP4_ADDRESS pIp4, _In_opt_ PIP6_ADDRESS pIp6, _In_ WORD wPort, |
| 24 | _In_ WORD wPriority, _In_ WORD wWeight, _In_ DWORD dwPropertiesCount, |
| 25 | _In_reads_(dwPropertiesCount) PCWSTR* keys, |
| 26 | _In_reads_(dwPropertiesCount) PCWSTR* values); |
| 27 | |
| 28 | using DnsServiceRegisterFunc = |
| 29 | DWORD(WINAPI*)(_In_ PDNS_SERVICE_REGISTER_REQUEST pRequest, |
| 30 | _Inout_opt_ PDNS_SERVICE_CANCEL pCancel); |
| 31 | |
| 32 | using DnsServiceDeRegisterFunc = |
| 33 | DWORD(WINAPI*)(_In_ PDNS_SERVICE_REGISTER_REQUEST pRequest, |
| 34 | _Inout_opt_ PDNS_SERVICE_CANCEL pCancel); |
| 35 | |
| 36 | using DnsServiceBrowseFunc = |
| 37 | DNS_STATUS(WINAPI*)(_In_ PDNS_SERVICE_BROWSE_REQUEST pRequest, |
| 38 | _Inout_ PDNS_SERVICE_CANCEL pCancel); |
| 39 | |
| 40 | using DnsServiceBrowseCancelFunc = |
| 41 | DNS_STATUS(WINAPI*)(_In_ PDNS_SERVICE_CANCEL pCancelHandle); |
| 42 | |
| 43 | DnsServiceBrowseFunc DnsServiceBrowsePtr{nullptr}; |
| 44 | DnsServiceBrowseCancelFunc DnsServiceBrowseCancelPtr{nullptr}; |
| 45 | |
| 46 | DnsServiceFreeInstanceFunc DnsServiceFreeInstancePtr{nullptr}; |
| 47 | DnsServiceConstructInstanceFunc DnsServiceConstructInstancePtr{nullptr}; |
| 48 | DnsServiceRegisterFunc DnsServiceRegisterPtr{nullptr}; |
| 49 | DnsServiceDeRegisterFunc DnsServiceDeRegisterPtr{nullptr}; |
| 50 | |
| 51 | bool CanDnsAnnounce{false}; |
| 52 | bool CanDnsResolve{false}; |
| 53 | |
| 54 | static DynamicDns& GetDynamicDns(); |
| 55 | |
| 56 | private: |
| 57 | DynamicDns(); |
| 58 | }; |
| 59 | } // namespace wpi |