Home | History | Annotate | Download | only in nameser

Lines Matching full:handle

75 int ns_msg_getflag(ns_msg handle, int flag) {
76 return((u_int32_t)((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
105 ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
109 handle->_msg = msg;
110 handle->_eom = eom;
113 NS_GET16(handle->_id, msg);
116 NS_GET16(handle->_flags, msg);
120 NS_GET16(handle->_counts[i], msg);
123 if (handle->_counts[i] == 0)
124 handle->_sections[i] = NULL;
127 handle->_counts[i]);
131 handle->_sections[i] = msg;
136 setsection(handle, ns_s_max);
141 ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
149 if (section != handle->_sect)
150 setsection(handle, section);
154 rrnum = handle->_rrnum;
155 if (rrnum < 0 || rrnum >= handle->_counts[(int)section])
157 if (rrnum < handle->_rrnum)
158 setsection(handle, section);
159 if (rrnum > handle->_rrnum) {
160 b = ns_skiprr(handle->_msg_ptr, handle->_eom, section,
161 rrnum - handle->_rrnum);
165 handle->_msg_ptr += b;
166 handle->_rrnum = rrnum;
170 b = dn_expand(handle->_msg, handle->_eom,
171 handle->_msg_ptr, rr->name, NS_MAXDNAME);
174 handle->_msg_ptr += b;
175 if (handle->_msg_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
177 NS_GET16(rr->type, handle->_msg_ptr);
178 NS_GET16(rr->rr_class, handle->_msg_ptr);
184 if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
186 NS_GET32(rr->ttl, handle->_msg_ptr);
187 NS_GET16(rr->rdlength, handle->_msg_ptr);
188 if (handle->_msg_ptr + rr->rdlength > handle->_eom)
190 rr->rdata = handle->_msg_ptr;
191 handle->_msg_ptr += rr->rdlength;
193 if (++handle->_rrnum > handle->_counts[(int)section])
194 setsection(handle, (ns_sect)((int)section + 1));
204 ns_parserr2(ns_msg *handle, ns_sect section, int rrnum, ns_rr2 *rr) {
212 if (section != handle->_sect)
213 setsection(handle, section);
217 rrnum = handle->_rrnum;
218 if (rrnum < 0 || rrnum >= handle->_counts[(int)section])
220 if (rrnum < handle->_rrnum)
221 setsection(handle, section);
222 if (rrnum > handle->_rrnum) {
223 b = ns_skiprr(handle->_msg_ptr, handle->_eom, section,
224 rrnum - handle->_rrnum);
228 handle->_msg_ptr += b;
229 handle->_rrnum = rrnum;
233 b = ns_name_unpack2(handle->_msg, handle->_eom, handle->_msg_ptr,
237 handle->_msg_ptr += b;
238 if (handle->_msg_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
240 NS_GET16(rr->type, handle->_msg_ptr);
241 NS_GET16(rr->rr_class, handle->_msg_ptr);
247 if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
249 NS_GET32(rr->ttl, handle->_msg_ptr);
250 NS_GET16(rr->rdlength, handle->_msg_ptr);
251 if (handle->_msg_ptr + rr->rdlength > handle->_eom)
253 rr->rdata = handle->_msg_ptr;
254 handle->_msg_ptr += rr->rdlength;
256 if (++handle->_rrnum > handle->_counts[(int)section])
257 setsection(handle, (ns_sect)((int)section + 1));