Lines Matching +full:byte +full:- +full:len
21 PRIVATE int insert_generic(struct shared_bindata *, byte **, int *);
37 dovend_rfc1497(struct host *hp, byte *buf, int len) in dovend_rfc1497() argument
39 int bytesleft = len; in dovend_rfc1497()
40 byte *vp = buf; in dovend_rfc1497()
43 #define NEED(LEN, MSG) do \ in dovend_rfc1497() argument
44 if (bytesleft < (LEN)) { \ in dovend_rfc1497()
46 hp->hostname->string, MSG); \ in dovend_rfc1497()
47 return (vp - buf); \ in dovend_rfc1497()
60 * Also, why is the hostname so far down the list? -gwr in dovend_rfc1497()
63 if (hp->flags.time_offset) { in dovend_rfc1497()
65 *vp++ = TAG_TIME_OFFSET;/* -1 byte */ in dovend_rfc1497()
66 *vp++ = 4; /* -1 byte */ in dovend_rfc1497()
67 insert_u_long(htonl(hp->time_offset), &vp); /* -4 bytes */ in dovend_rfc1497()
68 bytesleft -= 6; in dovend_rfc1497()
73 if (hp->flags.swap_server) { in dovend_rfc1497()
76 *vp++ = TAG_SWAP_SERVER;/* -1 byte */ in dovend_rfc1497()
77 *vp++ = 4; /* -1 byte */ in dovend_rfc1497()
78 insert_u_long(hp->swap_server.s_addr, &vp); /* -4 bytes */ in dovend_rfc1497()
79 bytesleft -= 6; /* Fix real count */ in dovend_rfc1497()
81 if (hp->flags.root_path) { in dovend_rfc1497()
86 len = strlen(hp->root_path->string); in dovend_rfc1497()
87 NEED((len + 2), "rp"); in dovend_rfc1497()
89 *vp++ = (byte) (len & 0xFF); in dovend_rfc1497()
90 bcopy(hp->root_path->string, vp, len); in dovend_rfc1497()
91 vp += len; in dovend_rfc1497()
92 bytesleft -= len + 2; in dovend_rfc1497()
94 if (hp->flags.dump_file) { in dovend_rfc1497()
99 len = strlen(hp->dump_file->string); in dovend_rfc1497()
100 NEED((len + 2), "df"); in dovend_rfc1497()
102 *vp++ = (byte) (len & 0xFF); in dovend_rfc1497()
103 bcopy(hp->dump_file->string, vp, len); in dovend_rfc1497()
104 vp += len; in dovend_rfc1497()
105 bytesleft -= len + 2; in dovend_rfc1497()
110 if (hp->flags.domain_server) { in dovend_rfc1497()
112 hp->domain_server, in dovend_rfc1497()
116 if (hp->flags.domain_name) { in dovend_rfc1497()
121 len = strlen(hp->domain_name->string); in dovend_rfc1497()
122 NEED((len + 2), "dn"); in dovend_rfc1497()
124 *vp++ = (byte) (len & 0xFF); in dovend_rfc1497()
125 bcopy(hp->domain_name->string, vp, len); in dovend_rfc1497()
126 vp += len; in dovend_rfc1497()
127 bytesleft -= len + 2; in dovend_rfc1497()
132 if (hp->flags.nis_server) { in dovend_rfc1497()
134 hp->nis_server, in dovend_rfc1497()
138 if (hp->flags.nis_domain) { in dovend_rfc1497()
143 len = strlen(hp->nis_domain->string); in dovend_rfc1497()
144 NEED((len + 2), "yn"); in dovend_rfc1497()
146 *vp++ = (byte) (len & 0xFF); in dovend_rfc1497()
147 bcopy(hp->nis_domain->string, vp, len); in dovend_rfc1497()
148 vp += len; in dovend_rfc1497()
149 bytesleft -= len + 2; in dovend_rfc1497()
152 if (hp->flags.name_server) { in dovend_rfc1497()
154 hp->name_server, in dovend_rfc1497()
158 if (hp->flags.rlp_server) { in dovend_rfc1497()
160 hp->rlp_server, in dovend_rfc1497()
165 if (hp->flags.time_server) { in dovend_rfc1497()
167 hp->time_server, in dovend_rfc1497()
172 if (hp->flags.ntp_server) { in dovend_rfc1497()
174 hp->ntp_server, in dovend_rfc1497()
186 * packet length as the client request packet. -gwr in dovend_rfc1497()
188 if (hp->flags.name_switch && hp->flags.send_name) { in dovend_rfc1497()
193 len = strlen(hp->hostname->string); in dovend_rfc1497()
196 * XXX - Too much magic. The user can always set the hostname in dovend_rfc1497()
197 * to the short version in the bootptab file. -gwr in dovend_rfc1497()
199 if ((len + 2) > bytesleft) { in dovend_rfc1497()
201 * Not enough room for full (domain-qualified) hostname, try in dovend_rfc1497()
204 char *tmpstr = hp->hostname->string; in dovend_rfc1497()
205 len = 0; in dovend_rfc1497()
208 len++; in dovend_rfc1497()
212 NEED((len + 2), "hn"); in dovend_rfc1497()
214 *vp++ = (byte) (len & 0xFF); in dovend_rfc1497()
215 bcopy(hp->hostname->string, vp, len); in dovend_rfc1497()
216 vp += len; in dovend_rfc1497()
217 bytesleft -= len + 2; in dovend_rfc1497()
222 if (hp->flags.lpr_server) { in dovend_rfc1497()
224 hp->lpr_server, in dovend_rfc1497()
228 if (hp->flags.cookie_server) { in dovend_rfc1497()
230 hp->cookie_server, in dovend_rfc1497()
234 if (hp->flags.log_server) { in dovend_rfc1497()
236 hp->log_server, in dovend_rfc1497()
241 * XXX - Add new tags here (to insert options) in dovend_rfc1497()
243 if (hp->flags.generic) { in dovend_rfc1497()
244 if (insert_generic(hp->generic, &vp, &bytesleft)) in dovend_rfc1497()
250 return (vp - buf); in dovend_rfc1497()
265 * This is used to fill the vendor-specific area of a bootp packet in
270 insert_ip(byte tag, struct in_addr_list *iplist, byte **dest, int *bytesleft) in insert_ip()
274 byte *d; in insert_ip()
283 (*bytesleft) -= 2; /* Account for tag and length */ in insert_ip()
284 addrptr = iplist->addr; in insert_ip()
285 addrcount = iplist->addrcount; in insert_ip()
287 insert_u_long(addrptr->s_addr, dest); in insert_ip()
289 addrcount--; in insert_ip()
290 (*bytesleft) -= 4; /* Four bytes per address */ in insert_ip()
292 d[1] = (byte) ((*dest - d - 2) & 0xFF); in insert_ip()
301 * be in RFC1048 format. It is inserted using a first-fit algorithm which
309 insert_generic(struct shared_bindata *gendata, byte **buff, int *bytesleft) in insert_generic()
311 byte *srcptr; in insert_generic()
318 srcptr = gendata->data; in insert_generic()
319 length = gendata->length; in insert_generic()
327 (*bytesleft)--; in insert_generic()
328 length--; in insert_generic()
337 (*bytesleft) -= numbytes; in insert_generic()
340 length -= numbytes; in insert_generic()
348 * Insert the unsigned long "value" into memory starting at the byte
349 * pointed to by the byte pointer (*dest). (*dest) is updated to
350 * point to the next available byte.
353 * byte order (in struct in_addr's), this routine expects longs to be
354 * passed in network byte order.
357 * host byte order, thus necessitating the use of ntohl() first.
361 insert_u_long(u_int32 value, byte **dest) in insert_u_long()
363 byte *temp; in insert_u_long()
366 value = ntohl(value); /* Must use host byte order here */ in insert_u_long()
368 for (n = 4; n > 0; n--) { in insert_u_long()
369 *--temp = (byte) (value & 0xFF); in insert_u_long()
372 /* Final result is network byte order */ in insert_u_long()
377 * tab-width: 4
378 * c-indent-level: 4
379 * c-argdecl-indent: 4
380 * c-continued-statement-offset: 4
381 * c-continued-brace-offset: -4
382 * c-label-offset: -4
383 * c-brace-offset: 0