如何使用iOS SDK获取所有DNSlogging
我期待这么久得到解决scheme,通过使用iOS SDK获取DNSlogging?
我能够解决ip addesses对主机名在这里,但这不是我想要的…我需要得到所有的DNSlogging,包括PTR , 名称 , NS , MX , CNAME等..请你的帮助或代码段是非常非常感激
尝试探索
DNSServiceErrorType DNSSD_API DNSServiceQueryRecord ( DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context /* may be NULL */ );
从
#include <dns_util.h>
我实际上已经写了我的Objective-C包装使用这个函数的所有types的DNSlogging..但我不能得到时间发布的地方
以防其他人在search中遇到这种情况,并希望看到更多的细节:
我发现它来自#include <dns_sd.h>
// domain is a NSString DNSServiceRef sdRef; DNSServiceQueryRecord(&sdRef, 0, 0, [domain UTF8String], kDNSServiceType_MX, kDNSServiceClass_IN, callBack, NULL); DNSServiceProcessResult(sdRef); DNSServiceRefDeallocate(sdRef);
这是为了如果你想要一个域的MXlogging。 callBack
是一个C方法
static void callBack( DNSServiceRef sdRef, DNSServiceFlags theFlags, uint32_t theInterfaceIndex, DNSServiceErrorType theErrorCode, const char* theName, uint16_t theType, uint16_t theClass, uint16_t theDataLength, const void* theData, uint32_t theTTL, void* theContext) { // do your magic here... }
callback方法一旦find回应就被调用,注意你可以接收多个callback。 例如,当我检查我的办公室的电子邮件域时,我收到了7回电话。