1 #include "mDNSEmbeddedAPI.h"
2 #include "../mDNSCore/DNSCommon.h"
3 #include "ResourceRecordTest.h"
5 int TXTSetupTest(void);
7 int OPTSetupTest(void);
10 UNITTEST_HEADER(ResourceRecordTest
)
11 UNITTEST_TEST(TXTSetupTest
)
12 UNITTEST_TEST(ASetupTest
)
13 UNITTEST_TEST(OPTSetupTest
)
17 UNITTEST_HEADER(TXTSetupTest
)
20 mDNS_SetupResourceRecord(&authRec
, mDNSNULL
, mDNSInterface_Any
, kDNSType_TXT
, kStandardTTL
, kDNSRecordTypeShared
, AuthRecordAny
,mDNSNULL
, mDNSNULL
);
21 // This fails >> UNITTEST_ASSERT_RETURN(authRec.resrec.RecordType == kDNSType_TXT);
22 UNITTEST_ASSERT_RETURN(authRec
.resrec
.rdata
->MaxRDLength
== sizeof(RDataBody
));
24 // Retest with a RDataStorage set to a a buffer
28 UNITTEST_HEADER(ASetupTest
)
30 mDNS_SetupResourceRecord(&authRec
, mDNSNULL
, mDNSInterface_Any
, kDNSType_A
, kHostNameTTL
, kDNSRecordTypeUnique
, AuthRecordAny
, mDNSNULL
, mDNSNULL
);
32 // This fails >> UNITTEST_ASSERT_RETURN(authRec.resrec.RecordType == kDNSType_A);
33 // Add more verifications
38 UNITTEST_HEADER(OPTSetupTest
)
40 mDNSu32 updatelease
= 7200;
41 /* mDNSu8 data[AbsoluteMaxDNSMessageData];
43 mDNSu16 numAdditionals;
45 // Setup the OPT Record
46 mDNS_SetupResourceRecord(&opt
, mDNSNULL
, mDNSInterface_Any
, kDNSType_OPT
, kStandardTTL
, kDNSRecordTypeKnownUnique
, AuthRecordAny
, mDNSNULL
, mDNSNULL
);
48 // Verify the basic initialization is all ok
50 opt
.resrec
.rrclass
= NormalMaxDNSMessageData
;
51 opt
.resrec
.rdlength
= sizeof(rdataOPT
); // One option in this OPT record
52 opt
.resrec
.rdestimate
= sizeof(rdataOPT
);
53 opt
.resrec
.rdata
->u
.opt
[0].opt
= kDNSOpt_Lease
;
54 opt
.resrec
.rdata
->u
.opt
[0].u
.updatelease
= updatelease
;
56 // Put the resource record in and verify everything is fine
57 // p = PutResourceRecordTTLWithLimit(&data, p, &numAdditionals, &opt.resrec, opt.resrec.rroriginalttl, data + AbsoluteMaxDNSMessageData);
60 // Repeat with bad data to make sure it bails out cleanly