Lines Matching refs:cp
109 uint8_t *cp, *ep; in res_nmkquery() local
127 cp = buf + HFIXEDSZ; in res_nmkquery()
140 if (ep - cp < QFIXEDSZ) return (-1); in res_nmkquery()
141 if ((n = dn_comp(dname, cp, ep - cp - QFIXEDSZ, dnptrs, lastdnptr)) < 0) return (-1); in res_nmkquery()
142 cp += n; in res_nmkquery()
143 *reinterpret_cast<uint16_t*>(cp) = htons(type); in res_nmkquery()
144 cp += INT16SZ; in res_nmkquery()
145 *reinterpret_cast<uint16_t*>(cp) = htons(cl); in res_nmkquery()
146 cp += INT16SZ; in res_nmkquery()
152 if ((ep - cp) < RRFIXEDSZ) return (-1); in res_nmkquery()
153 n = dn_comp((const char*) data, cp, ep - cp - RRFIXEDSZ, dnptrs, lastdnptr); in res_nmkquery()
155 cp += n; in res_nmkquery()
156 *reinterpret_cast<uint16_t*>(cp) = htons(ns_t_null); in res_nmkquery()
157 cp += INT16SZ; in res_nmkquery()
158 *reinterpret_cast<uint16_t*>(cp) = htons(cl); in res_nmkquery()
159 cp += INT16SZ; in res_nmkquery()
160 *reinterpret_cast<uint32_t*>(cp) = htonl(0); in res_nmkquery()
161 cp += INT32SZ; in res_nmkquery()
162 *reinterpret_cast<uint16_t*>(cp) = htons(0); in res_nmkquery()
163 cp += INT16SZ; in res_nmkquery()
171 if (ep - cp < 1 + RRFIXEDSZ + datalen) return (-1); in res_nmkquery()
172 *cp++ = '\0'; /* no domain name */ in res_nmkquery()
173 *reinterpret_cast<uint16_t*>(cp) = htons(type); in res_nmkquery()
174 cp += INT16SZ; in res_nmkquery()
175 *reinterpret_cast<uint16_t*>(cp) = htons(cl); in res_nmkquery()
176 cp += INT16SZ; in res_nmkquery()
177 *reinterpret_cast<uint32_t*>(cp) = htonl(0); in res_nmkquery()
178 cp += INT32SZ; in res_nmkquery()
179 *reinterpret_cast<uint16_t*>(cp) = htons(datalen); in res_nmkquery()
180 cp += INT16SZ; in res_nmkquery()
182 memcpy(cp, data, (size_t) datalen); in res_nmkquery()
183 cp += datalen; in res_nmkquery()
191 return (cp - buf); in res_nmkquery()
200 uint8_t *cp, *ep; in res_nopt() local
206 cp = buf + n0; in res_nopt()
209 if ((ep - cp) < 1 + RRFIXEDSZ) return (-1); in res_nopt()
211 *cp++ = 0; /* "." */ in res_nopt()
214 *reinterpret_cast<uint16_t*>(cp) = htons(ns_t_opt); /* TYPE */ in res_nopt()
215 cp += INT16SZ; in res_nopt()
217 *reinterpret_cast<uint16_t*>(cp) = htons(anslen); /* CLASS = UDP payload size */ in res_nopt()
218 cp += INT16SZ; in res_nopt()
219 *cp++ = NOERROR; /* extended RCODE */ in res_nopt()
220 *cp++ = 0; /* EDNS version */ in res_nopt()
225 *reinterpret_cast<uint16_t*>(cp) = htons(flags); in res_nopt()
226 cp += INT16SZ; in res_nopt()
229 const uint16_t minlen = static_cast<uint16_t>(cp - buf) + 3 * INT16SZ; in res_nopt()
236 *reinterpret_cast<uint16_t*>(cp) = htons(padlen + 2 * INT16SZ); /* RDLEN */ in res_nopt()
237 cp += INT16SZ; in res_nopt()
238 *reinterpret_cast<uint16_t*>(cp) = htons(NS_OPT_PADDING); /* OPTION-CODE */ in res_nopt()
239 cp += INT16SZ; in res_nopt()
240 *reinterpret_cast<uint16_t*>(cp) = htons(padlen); /* OPTION-LENGTH */ in res_nopt()
241 cp += INT16SZ; in res_nopt()
242 memset(cp, 0, padlen); in res_nopt()
243 cp += padlen; in res_nopt()
246 return (cp - buf); in res_nopt()