Lines Matching refs:cp
112 u_char *cp, *ep; in res_nmkquery() local
130 cp = buf + HFIXEDSZ; in res_nmkquery()
143 if (ep - cp < QFIXEDSZ) return (-1); in res_nmkquery()
144 if ((n = dn_comp(dname, cp, ep - cp - QFIXEDSZ, dnptrs, lastdnptr)) < 0) return (-1); in res_nmkquery()
145 cp += n; in res_nmkquery()
146 *reinterpret_cast<uint16_t*>(cp) = htons(type); in res_nmkquery()
147 cp += INT16SZ; in res_nmkquery()
148 *reinterpret_cast<uint16_t*>(cp) = htons(cl); in res_nmkquery()
149 cp += INT16SZ; in res_nmkquery()
155 if ((ep - cp) < RRFIXEDSZ) return (-1); in res_nmkquery()
156 n = dn_comp((const char*) data, cp, ep - cp - RRFIXEDSZ, dnptrs, lastdnptr); in res_nmkquery()
158 cp += n; in res_nmkquery()
159 *reinterpret_cast<uint16_t*>(cp) = htons(ns_t_null); in res_nmkquery()
160 cp += INT16SZ; in res_nmkquery()
161 *reinterpret_cast<uint16_t*>(cp) = htons(cl); in res_nmkquery()
162 cp += INT16SZ; in res_nmkquery()
163 *reinterpret_cast<uint32_t*>(cp) = htonl(0); in res_nmkquery()
164 cp += INT32SZ; in res_nmkquery()
165 *reinterpret_cast<uint16_t*>(cp) = htons(0); in res_nmkquery()
166 cp += INT16SZ; in res_nmkquery()
174 if (ep - cp < 1 + RRFIXEDSZ + datalen) return (-1); in res_nmkquery()
175 *cp++ = '\0'; /* no domain name */ in res_nmkquery()
176 *reinterpret_cast<uint16_t*>(cp) = htons(type); in res_nmkquery()
177 cp += INT16SZ; in res_nmkquery()
178 *reinterpret_cast<uint16_t*>(cp) = htons(cl); in res_nmkquery()
179 cp += INT16SZ; in res_nmkquery()
180 *reinterpret_cast<uint32_t*>(cp) = htonl(0); in res_nmkquery()
181 cp += INT32SZ; in res_nmkquery()
182 *reinterpret_cast<uint16_t*>(cp) = htons(datalen); in res_nmkquery()
183 cp += INT16SZ; in res_nmkquery()
185 memcpy(cp, data, (size_t) datalen); in res_nmkquery()
186 cp += datalen; in res_nmkquery()
194 return (cp - buf); in res_nmkquery()
203 u_char *cp, *ep; in res_nopt() local
209 cp = buf + n0; in res_nopt()
212 if ((ep - cp) < 1 + RRFIXEDSZ) return (-1); in res_nopt()
214 *cp++ = 0; /* "." */ in res_nopt()
217 *reinterpret_cast<uint16_t*>(cp) = htons(ns_t_opt); /* TYPE */ in res_nopt()
218 cp += INT16SZ; in res_nopt()
220 *reinterpret_cast<uint16_t*>(cp) = htons(anslen); /* CLASS = UDP payload size */ in res_nopt()
221 cp += INT16SZ; in res_nopt()
222 *cp++ = NOERROR; /* extended RCODE */ in res_nopt()
223 *cp++ = 0; /* EDNS version */ in res_nopt()
228 *reinterpret_cast<uint16_t*>(cp) = htons(flags); in res_nopt()
229 cp += INT16SZ; in res_nopt()
232 const uint16_t minlen = static_cast<uint16_t>(cp - buf) + 3 * INT16SZ; in res_nopt()
239 *reinterpret_cast<uint16_t*>(cp) = htons(padlen + 2 * INT16SZ); /* RDLEN */ in res_nopt()
240 cp += INT16SZ; in res_nopt()
241 *reinterpret_cast<uint16_t*>(cp) = htons(NS_OPT_PADDING); /* OPTION-CODE */ in res_nopt()
242 cp += INT16SZ; in res_nopt()
243 *reinterpret_cast<uint16_t*>(cp) = htons(padlen); /* OPTION-LENGTH */ in res_nopt()
244 cp += INT16SZ; in res_nopt()
245 memset(cp, 0, padlen); in res_nopt()
246 cp += padlen; in res_nopt()
249 return (cp - buf); in res_nopt()