Lines Matching refs:parse
2 * testpkts. Data file parse for test packets, and query matching.
109 /** parse MATCH line */
112 char* parse = line;
113 while(*parse) {
114 if(isendline(*parse))
116 if(str_keyword(&parse, "opcode")) {
118 } else if(str_keyword(&parse, "qtype")) {
120 } else if(str_keyword(&parse, "qname")) {
122 } else if(str_keyword(&parse, "rcode")) {
124 } else if(str_keyword(&parse, "question")) {
126 } else if(str_keyword(&parse, "answer")) {
128 } else if(str_keyword(&parse, "subdomain")) {
130 } else if(str_keyword(&parse, "all_noedns")) {
132 } else if(str_keyword(&parse, "all")) {
134 } else if(str_keyword(&parse, "ttl")) {
136 } else if(str_keyword(&parse, "DO")) {
138 } else if(str_keyword(&parse, "noedns")) {
140 } else if(str_keyword(&parse, "ednsdata")) {
142 } else if(str_keyword(&parse, "client_cookie")) {
144 } else if(str_keyword(&parse, "server_cookie")) {
146 } else if(str_keyword(&parse, "UDP")) {
148 } else if(str_keyword(&parse, "TCP")) {
150 } else if(str_keyword(&parse, "serial")) {
152 if(*parse != '=' && *parse != ':')
154 parse++;
155 e->ixfr_soa_serial = (uint32_t)strtol(parse, (char**)&parse, 10);
156 while(isspace((unsigned char)*parse))
157 parse++;
158 } else if(str_keyword(&parse, "ede")) {
160 if(*parse != '=' && *parse != ':')
162 parse++;
163 while(isspace((unsigned char)*parse))
164 parse++;
165 if(str_keyword(&parse, "any")) {
168 e->ede_info_code = (uint16_t)strtol(parse,
169 (char**)&parse, 10);
171 while(isspace((unsigned char)*parse))
172 parse++;
174 error("could not parse MATCH: '%s'", parse);
179 /** parse REPLY line */
183 char* parse = line;
185 while(*parse) {
186 if(isendline(*parse))
189 if(str_keyword(&parse, "QUERY")) {
191 } else if(str_keyword(&parse, "IQUERY")) {
193 } else if(str_keyword(&parse, "STATUS")) {
195 } else if(str_keyword(&parse, "NOTIFY")) {
197 } else if(str_keyword(&parse, "UPDATE")) {
200 } else if(str_keyword(&parse, "NOERROR")) {
202 } else if(str_keyword(&parse, "FORMERR")) {
204 } else if(str_keyword(&parse, "SERVFAIL")) {
206 } else if(str_keyword(&parse, "NXDOMAIN")) {
208 } else if(str_keyword(&parse, "NOTIMPL")) {
210 } else if(str_keyword(&parse, "REFUSED")) {
212 } else if(str_keyword(&parse, "YXDOMAIN")) {
214 } else if(str_keyword(&parse, "YXRRSET")) {
216 } else if(str_keyword(&parse, "NXRRSET")) {
218 } else if(str_keyword(&parse, "NOTAUTH")) {
220 } else if(str_keyword(&parse, "NOTZONE")) {
223 } else if(str_keyword(&parse, "QR")) {
225 } else if(str_keyword(&parse, "AA")) {
227 } else if(str_keyword(&parse, "TC")) {
229 } else if(str_keyword(&parse, "RD")) {
231 } else if(str_keyword(&parse, "CD")) {
233 } else if(str_keyword(&parse, "RA")) {
235 } else if(str_keyword(&parse, "AD")) {
237 } else if(str_keyword(&parse, "DO")) {
240 error("could not parse REPLY: '%s'", parse);
245 /** parse ADJUST line */
249 char* parse = line;
250 while(*parse) {
251 if(isendline(*parse))
253 if(str_keyword(&parse, "copy_id")) {
255 } else if(str_keyword(&parse, "copy_query")) {
257 } else if(str_keyword(&parse, "copy_ednsdata_assume_clientsubnet")) {
259 } else if(str_keyword(&parse, "increment_ecs_scope")) {
261 } else if(str_keyword(&parse, "sleep=")) {
262 e->sleeptime = (unsigned int) strtol(parse, (char**)&parse, 10);
263 while(isspace((unsigned char)*parse))
264 parse++;
265 } else if(str_keyword(&parse, "packet_sleep=")) {
266 pkt->packet_sleep = (unsigned int) strtol(parse, (char**)&parse, 10);
267 while(isspace((unsigned char)*parse))
268 parse++;
270 error("could not parse ADJUST: '%s'", parse);
458 /** parse ORIGIN */
460 get_origin(const char* name, struct sldns_file_parse_state* pstate, char* parse)
462 /* snip off rest of the text so as to make the parse work in ldns */
467 end=parse;
472 verbose(3, "parsing '%s'\n", parse);
473 status = sldns_str2wire_dname_buf(parse, pstate->origin,
478 sldns_get_errorstr_parse(status), parse);
486 /* it must be a RR, parse and add to packet. */
495 /* parse RR */
553 char* parse;
567 parse = line;
570 while(isspace((unsigned char)*parse))
571 parse++;
573 if(isendline(*parse))
575 if(str_keyword(&parse, "ENTRY_BEGIN")) {
584 } else if(str_keyword(&parse, "$ORIGIN")) {
585 get_origin(name, pstate, parse);
587 } else if(str_keyword(&parse, "$TTL")) {
588 pstate->default_ttl = (uint32_t)atoi(parse);
597 if(str_keyword(&parse, "MATCH")) {
598 matchline(parse, current);
599 } else if(str_keyword(&parse, "REPLY")) {
600 replyline(parse, pktbuf, pktlen, &do_flag);
601 } else if(str_keyword(&parse, "ADJUST")) {
602 adjustline(parse, current, cur_reply);
603 } else if(str_keyword(&parse, "EXTRA_PACKET")) {
613 } else if(str_keyword(&parse, "SECTION")) {
614 if(str_keyword(&parse, "QUESTION"))
616 else if(str_keyword(&parse, "ANSWER"))
618 else if(str_keyword(&parse, "AUTHORITY"))
620 else if(str_keyword(&parse, "ADDITIONAL"))
622 else error("%s line %d: bad section %s", name, pstate->lineno, parse);
623 } else if(str_keyword(&parse, "HEX_ANSWER_BEGIN")) {
626 } else if(str_keyword(&parse, "HEX_ANSWER_END")) {
636 } else if(str_keyword(&parse, "HEX_EDNSDATA_BEGIN")) {
639 } else if(str_keyword(&parse, "HEX_EDNSDATA_END")) {
650 } else if(str_keyword(&parse, "ENTRY_END")) {
674 add_rr(skip_whitespace?parse:line, pktbuf,