Lines Matching defs:handle

74 int ns_msg_getflag(ns_msg handle, int flag) {
75 return((u_int32_t)((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
103 ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
107 memset(handle, 0x5e, sizeof *handle);
108 handle->_msg = msg;
109 handle->_eom = eom;
112 NS_GET16(handle->_id, msg);
115 NS_GET16(handle->_flags, msg);
119 NS_GET16(handle->_counts[i], msg);
122 if (handle->_counts[i] == 0)
123 handle->_sections[i] = NULL;
126 handle->_counts[i]);
130 handle->_sections[i] = msg;
135 setsection(handle, ns_s_max);
140 ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
146 if (section != handle->_sect)
147 setsection(handle, section);
151 rrnum = handle->_rrnum;
152 if (rrnum < 0 || rrnum >= handle->_counts[(int)section])
154 if (rrnum < handle->_rrnum)
155 setsection(handle, section);
156 if (rrnum > handle->_rrnum) {
157 b = ns_skiprr(handle->_msg_ptr, handle->_eom, section,
158 rrnum - handle->_rrnum);
162 handle->_msg_ptr += b;
163 handle->_rrnum = rrnum;
167 b = dn_expand(handle->_msg, handle->_eom,
168 handle->_msg_ptr, rr->name, NS_MAXDNAME);
171 handle->_msg_ptr += b;
172 if (handle->_msg_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
174 NS_GET16(rr->type, handle->_msg_ptr);
175 NS_GET16(rr->rr_class, handle->_msg_ptr);
181 if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
183 NS_GET32(rr->ttl, handle->_msg_ptr);
184 NS_GET16(rr->rdlength, handle->_msg_ptr);
185 if (handle->_msg_ptr + rr->rdlength > handle->_eom)
187 rr->rdata = handle->_msg_ptr;
188 handle->_msg_ptr += rr->rdlength;
190 if (++handle->_rrnum > handle->_counts[(int)section])
191 setsection(handle, (ns_sect)((int)section + 1));