2022-08-28 19:02:06 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: AuNetResolver.NT.hpp
|
|
|
|
Date: 2022-8-17
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "AuNetSocketOverlappedOperation.hpp"
|
|
|
|
#include "AuNetSocket.hpp"
|
|
|
|
|
|
|
|
namespace Aurora::IO::Net
|
|
|
|
{
|
|
|
|
struct Socket;
|
|
|
|
|
|
|
|
struct NetResolver :
|
|
|
|
SocketOverlappedOperation,
|
|
|
|
IResolver,
|
|
|
|
AuEnableSharedFromThis<NetResolver>
|
|
|
|
{
|
|
|
|
NetResolver(const AuSPtr<INetWorker> &pWorker);
|
|
|
|
NetResolver(const AuSPtr<INetWorker> &pWorker,
|
|
|
|
const AuSPtr<AuAsync::PromiseCallback<AuList<IPAddress>, NetError>> &pCompletion);
|
|
|
|
~NetResolver();
|
|
|
|
|
|
|
|
bool bA {};
|
|
|
|
bool bAAAA {};
|
|
|
|
AuString hostname;
|
|
|
|
|
|
|
|
bool Start();
|
|
|
|
|
|
|
|
void SetCompletion(const AuSPtr<AuAsync::PromiseCallback<AuList<IPAddress>, NetError>> &callback);
|
|
|
|
|
|
|
|
void OnOverlappedComplete() override;
|
|
|
|
void OnOverlappedFailure(const NetError &error) override;
|
|
|
|
|
|
|
|
bool HasFinished() override;
|
|
|
|
void Cancel() override;
|
|
|
|
const NetError &GetError() override;
|
|
|
|
|
|
|
|
bool Unpack();
|
|
|
|
|
|
|
|
private:
|
|
|
|
AuSPtr<INetWorker> pWorker_;
|
|
|
|
AuList<IPAddress> processedIps_;
|
|
|
|
AuSPtr<AuAsync::PromiseCallback<AuList<IPAddress>, NetError>> pCompletion_;
|
|
|
|
bool bHasCompleted_ {};
|
2023-07-27 18:39:43 +00:00
|
|
|
bool bForceError_ {};
|
2022-08-28 19:02:06 +00:00
|
|
|
PADDRINFOEXW resultHandle_ {};
|
|
|
|
NetError error_;
|
|
|
|
HANDLE hName_ { NULL };
|
|
|
|
};
|
|
|
|
}
|