ReactOS 0.4.16-dev-240-gdb5fa3b
check.c File Reference
#include "internal.h"
Include dependency graph for check.c:

Go to the source code of this file.

Macros

#define DLIST_CHECK1(list, nodevar, body)
 
#define DLIST_CHECK2(list, nodevar, part, body)
 
#define DLIST_ASSERTON(node, nodevar, list, part)
 

Functions

void adns_checkconsistency (adns_state ads, adns_query qu)
 
static void checkc_query_alloc (adns_state ads, adns_query qu)
 
static void checkc_query (adns_state ads, adns_query qu)
 
static void checkc_notcpbuf (adns_state ads)
 
static void checkc_global (adns_state ads)
 
static void checkc_queue_udpw (adns_state ads)
 
static void checkc_queue_tcpw (adns_state ads)
 
static void checkc_queue_childw (adns_state ads)
 
static void checkc_queue_output (adns_state ads)
 
void adns__consistency (adns_state ads, adns_query qu, consistency_checks cc)
 

Macro Definition Documentation

◆ DLIST_ASSERTON

#define DLIST_ASSERTON (   node,
  nodevar,
  list,
  part 
)
Value:
do { \
for ((nodevar)= (list).head; \
(nodevar) != (node); \
(nodevar)= (nodevar)->part next) { \
assert((nodevar)); \
} \
} while(0)
struct outqueuenode * head
Definition: adnsresfilter.c:66
Definition: list.h:37
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: dlist.c:348

Definition at line 70 of file check.c.

◆ DLIST_CHECK1

#define DLIST_CHECK1 (   list,
  nodevar,
  body 
)
Value:
if ((list).head) { \
assert(! (list).head->back); \
for ((nodevar)= (list).head; (nodevar); (nodevar)= (nodevar)->next) { \
assert((nodevar)->next \
? (nodevar) == (nodevar)->next->back \
: (nodevar) == (list).tail); \
body \
} \
}
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:100

Definition at line 48 of file check.c.

◆ DLIST_CHECK2

#define DLIST_CHECK2 (   list,
  nodevar,
  part,
  body 
)
Value:
if ((list).head) { \
assert(! (list).head->part.back); \
for ((nodevar)= (list).head; (nodevar); (nodevar)= (nodevar)->part.next) { \
assert((nodevar)->part.next \
? (nodevar) == (nodevar)->part.next->part.back \
: (nodevar) == (list).tail); \
body \
} \
}

Definition at line 59 of file check.c.

Function Documentation

◆ adns__consistency()

void adns__consistency ( adns_state  ads,
adns_query  qu,
consistency_checks  cc 
)

Definition at line 185 of file check.c.

185 {
187
188 switch (cc) {
189 case cc_user:
190 break;
191 case cc_entex:
192 if (!(ads->iflags & adns_if_checkc_entex)) return;
193 break;
194 case cc_freq:
196 break;
197 default:
198 abort();
199 }
200
206
207 if (qu) {
208 switch (qu->state) {
209 case query_tosend:
210 DLIST_ASSERTON(qu, search, ads->udpw, );
211 break;
212 case query_tcpw:
213 DLIST_ASSERTON(qu, search, ads->tcpw, );
214 break;
215 case query_childw:
216 DLIST_ASSERTON(qu, search, ads->childw, );
217 break;
218 case query_done:
220 break;
221 default:
222 assert(!"specific query state");
223 }
224 }
225}
#define DLIST_ASSERTON(node, nodevar, list, part)
Definition: check.c:70
static void checkc_queue_tcpw(adns_state ads)
Definition: check.c:146
static void checkc_queue_childw(adns_state ads)
Definition: check.c:158
static void checkc_queue_udpw(adns_state ads)
Definition: check.c:133
static void checkc_global(adns_state ads)
Definition: check.c:102
static void checkc_queue_output(adns_state ads)
Definition: check.c:173
void query_done(struct query_node *qun, adns_answer *answer)
Definition: adh-query.c:253
adns_state ads
Definition: adh-query.c:35
@ adns_if_checkc_freq
Definition: adns.h:97
@ adns_if_checkc_entex
Definition: adns.h:96
#define assert(x)
Definition: debug.h:53
#define abort()
Definition: i386-dis.c:34
uint32_t cc
Definition: isohybrid.c:75
static short search(int val, const short *table, int size)
Definition: msg711.c:255
@ cc_user
Definition: internal.h:85
@ cc_freq
Definition: internal.h:87
@ cc_entex
Definition: internal.h:86
enum adns__query::@4227 state
struct query_queue udpw tcpw childw output
Definition: internal.h:295
adns_initflags iflags
Definition: internal.h:292

Referenced by adns_afterselect(), adns_beforeselect(), adns_cancel(), adns_check(), adns_checkconsistency(), adns_finish(), adns_firsttimeout(), adns_forallqueries_begin(), adns_forallqueries_next(), adns_globalsystemfailure(), adns_init(), adns_init_strcfg(), adns_processany(), adns_processexceptional(), adns_processreadable(), adns_processtimeouts(), adns_processwriteable(), adns_submit(), and adns_wait().

◆ adns_checkconsistency()

void adns_checkconsistency ( adns_state  ads,
adns_query  qu 
)

Definition at line 30 of file check.c.

30 {
32}
void adns__consistency(adns_state ads, adns_query qu, consistency_checks cc)
Definition: check.c:185

◆ checkc_global()

static void checkc_global ( adns_state  ads)
static

Definition at line 102 of file check.c.

102 {
103 int i;
104
105 assert(ads->udpsocket >= 0);
106
107 for (i=0; i<ads->nsortlist; i++)
108 assert(!(ads->sortlist[i].base.s_addr & ~ads->sortlist[i].mask.s_addr));
109
111
112 switch (ads->tcpstate) {
113 case server_connecting:
114 assert(ads->tcpsocket >= 0);
116 break;
117 case server_disconnected:
118 case server_broken:
119 assert(ads->tcpsocket == -1);
121 break;
122 case server_ok:
123 assert(ads->tcpsocket >= 0);
125 break;
126 default:
127 assert(!"ads->tcpstate value");
128 }
129
131}
static void checkc_notcpbuf(adns_state ads)
Definition: check.c:96
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int nservers
Definition: internal.h:300
ADNS_SOCKET tcpsocket
Definition: internal.h:298
struct adns__state::sortlist sortlist[MAXSORTLIST]
int tcprecv_skip
Definition: internal.h:300
enum adns__state::adns__tcpstate tcpstate
vbuf tcprecv
Definition: internal.h:299
ADNS_SOCKET udpsocket
Definition: internal.h:298
int nsearchlist
Definition: internal.h:300
int tcpserver
Definition: internal.h:300
int nsortlist
Definition: internal.h:300
char ** searchlist
Definition: internal.h:322
int used
Definition: internal.h:111

Referenced by adns__consistency().

◆ checkc_notcpbuf()

static void checkc_notcpbuf ( adns_state  ads)
static

Definition at line 96 of file check.c.

96 {
100}
vbuf tcpsend
Definition: internal.h:299

Referenced by checkc_global().

◆ checkc_query()

static void checkc_query ( adns_state  ads,
adns_query  qu 
)
static

Definition at line 87 of file check.c.

87 {
89
91 assert(!(qu->udpsent & (~0UL << ads->nservers)));
93 if (qu->parent) DLIST_ASSERTON(qu, child, qu->parent->children, siblings.);
94}
static HWND child
Definition: cursoricon.c:298
adns_query parent
Definition: internal.h:184
int search_pos
Definition: internal.h:217
unsigned long udpsent
Definition: internal.h:229
int udpnextserver
Definition: internal.h:228
struct adns__query::@4228 children
#define UL
Definition: tui.h:165

Referenced by checkc_queue_childw().

◆ checkc_query_alloc()

static void checkc_query_alloc ( adns_state  ads,
adns_query  qu 
)
static

Definition at line 79 of file check.c.

79 {
80 allocnode *an;
81
82
83 DLIST_CHECK1(qu->allocations, an, {
84 });
85}
#define DLIST_CHECK1(list, nodevar, body)
Definition: check.c:48
struct adns__query::@4230 allocations

Referenced by checkc_queue_childw().

◆ checkc_queue_childw()

static void checkc_queue_childw ( adns_state  ads)
static

Definition at line 158 of file check.c.

158 {
160
161 DLIST_CHECK1(ads->childw, parent, {
162 assert(parent->state == query_childw);
163 assert(parent->children.head);
164 DLIST_CHECK2(parent->children, child, siblings, {
165 assert(child->parent == parent);
166 assert(child->state != query_done);
167 });
170 });
171}
static void checkc_query(adns_state ads, adns_query qu)
Definition: check.c:87
static void checkc_query_alloc(adns_state ads, adns_query qu)
Definition: check.c:79
r parent
Definition: btrfs.c:3010

Referenced by adns__consistency().

◆ checkc_queue_output()

static void checkc_queue_output ( adns_state  ads)
static

Definition at line 173 of file check.c.

173 {
174 adns_query qu;
175
176 DLIST_CHECK1(ads->output, qu, {
177 assert(qu->state == query_done);
178 assert(!qu->children.head && !qu->children.tail);
179 assert(!qu->parent);
180 assert(!qu->allocations.head && !qu->allocations.tail);
181 checkc_query(ads,qu);
182 });
183}

Referenced by adns__consistency().

◆ checkc_queue_tcpw()

static void checkc_queue_tcpw ( adns_state  ads)
static

Definition at line 146 of file check.c.

146 {
147 adns_query qu;
148
149 DLIST_CHECK1(ads->tcpw, qu, {
150 assert(qu->state==query_tcpw);
151 assert(!qu->children.head && !qu->children.tail);
152 assert(qu->retries <= ads->nservers+1);
153 checkc_query(ads,qu);
154 checkc_query_alloc(ads,qu);
155 });
156}

Referenced by adns__consistency().

◆ checkc_queue_udpw()

static void checkc_queue_udpw ( adns_state  ads)
static

Definition at line 133 of file check.c.

133 {
134 adns_query qu;
135
136 DLIST_CHECK1(ads->udpw, qu, {
137 assert(qu->state==query_tosend);
138 assert(qu->retries <= UDPMAXRETRIES);
139 assert(qu->udpsent);
140 assert(!qu->children.head && !qu->children.tail);
141 checkc_query(ads,qu);
142 checkc_query_alloc(ads,qu);
143 });
144}

Referenced by adns__consistency().