2 /* Testcase by Ryan Mansfield <rmansfield@qnx.com> */
4 /* { dg-do compile } */
5 /* { dg-options "-O -g" } */
13 typedef mDNSOpaque16 mDNSIPPort
;
18 typedef struct DNSQuestion_struct DNSQuestion
;
19 typedef struct mDNS_struct mDNS
;
20 typedef struct __attribute__ ((__packed__
))
27 typedef struct __attribute__ ((__packed__
))
33 struct DNSQuestion_struct
37 mDNSOpaque16 TargetQID
;
42 DNSQuestion
*Questions
;
44 extern long mDNSPlatformOneSecond
;
47 kDNSFlag0_QR_Mask
= 0x80, kDNSFlag0_QR_Query
= 0x00, kDNSFlag0_QR_Response
=
48 0x80, kDNSFlag0_OP_Mask
= 0x78, kDNSFlag0_OP_StdQuery
=
49 0x00, kDNSFlag0_OP_Iquery
= 0x08, kDNSFlag0_OP_Status
=
50 0x10, kDNSFlag0_OP_Unused3
= 0x18, kDNSFlag0_OP_Notify
=
51 0x20, kDNSFlag0_OP_Update
= 0x28, kDNSFlag0_QROP_Mask
=
52 kDNSFlag0_QR_Mask
| kDNSFlag0_OP_Mask
, kDNSFlag0_AA
= 0x04, kDNSFlag0_TC
=
53 0x02, kDNSFlag0_RD
= 0x01, kDNSFlag1_RA
= 0x80, kDNSFlag1_Zero
=
54 0x40, kDNSFlag1_AD
= 0x20, kDNSFlag1_CD
= 0x10, kDNSFlag1_RC_Mask
=
55 0x0F, kDNSFlag1_RC_NoErr
= 0x00, kDNSFlag1_RC_FormErr
=
56 0x01, kDNSFlag1_RC_ServFail
= 0x02, kDNSFlag1_RC_NXDomain
=
57 0x03, kDNSFlag1_RC_NotImpl
= 0x04, kDNSFlag1_RC_Refused
=
58 0x05, kDNSFlag1_RC_YXDomain
= 0x06, kDNSFlag1_RC_YXRRSet
=
59 0x07, kDNSFlag1_RC_NXRRSet
= 0x08, kDNSFlag1_RC_NotAuth
=
60 0x09, kDNSFlag1_RC_NotZone
= 0x0A
64 uDNS_ReceiveMsg (mDNS
* const m
, DNSMessage
* const msg
,
65 const char * const end
, const mDNSAddr
* const srcaddr
,
66 const mDNSIPPort srcport
)
69 char StdR
= kDNSFlag0_QR_Response
| kDNSFlag0_OP_StdQuery
;
70 char QR_OP
= (char) (msg
->h
.flags
.b
[0] & kDNSFlag0_QROP_Mask
);
73 if (uDNS_ReceiveTestQuestionResponse (m
, msg
, end
, srcaddr
, srcport
))
75 for (qptr
= m
->Questions
; qptr
; qptr
= qptr
->next
)
76 if (msg
->h
.flags
.b
[0] & kDNSFlag0_TC
77 && ((qptr
->TargetQID
).NotAnInteger
== (msg
->h
.id
).NotAnInteger
)
78 && m
->timenow
- qptr
->LastQTime
< (60 * mDNSPlatformOneSecond
))