Revision | e966cf302aa3b7fc0748d5cdb510d2757bbff4a5 (tree) |
---|---|
Zeit | 2021-08-09 10:36:58 |
Autor | mirabilos <m@mirb...> |
Commiter | mirabilos |
make {en,de}code_dotted into macros
they merely call dn_{comp,expand} slightly rearranging the arguments
Signed-off-by: mirabilos <mirabilos@evolvis.org>
@@ -26,7 +26,7 @@ CSRC-$(V4_OR_V6) += \ | ||
26 | 26 | inet_lnaof.c inet_netof.c |
27 | 27 | # multi source resolv.c |
28 | 28 | CSRC-$(V4_OR_V6) += \ |
29 | - encodeh.c decodeh.c encoded.c decoded.c \ | |
29 | + encodeh.c decodeh.c \ | |
30 | 30 | encodeq.c encodea.c \ |
31 | 31 | read_etc_hosts_r.c \ |
32 | 32 | dnslookup.c opennameservers.c closenameservers.c \ |
@@ -1,8 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> | |
3 | - * | |
4 | - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | |
5 | - */ | |
6 | - | |
7 | -#define L_decoded | |
8 | -#include RESOLVER |
@@ -1,8 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> | |
3 | - * | |
4 | - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | |
5 | - */ | |
6 | - | |
7 | -#define L_encoded | |
8 | -#include RESOLVER |
@@ -396,14 +396,6 @@ extern int __dns_lookup(const char *name, | ||
396 | 396 | int type, |
397 | 397 | unsigned char **outpacket, |
398 | 398 | struct resolv_answer *a) attribute_hidden; |
399 | -extern int __encode_dotted(const char *dotted, | |
400 | - unsigned char *dest, | |
401 | - int maxlen) attribute_hidden; | |
402 | -extern int __decode_dotted(const unsigned char *packet, | |
403 | - int offset, | |
404 | - int packet_len, | |
405 | - char *dest, | |
406 | - int dest_len) attribute_hidden; | |
407 | 399 | extern int __encode_header(struct resolv_header *h, |
408 | 400 | unsigned char *dest, |
409 | 401 | int maxlen) attribute_hidden; |
@@ -418,6 +410,12 @@ extern int __encode_answer(struct resolv_answer *a, | ||
418 | 410 | extern void __open_nameservers(void) attribute_hidden; |
419 | 411 | extern void __close_nameservers(void) attribute_hidden; |
420 | 412 | |
413 | +#define __encode_dotted(dotted,dest,maxlen) \ | |
414 | + dn_comp((dotted), (dest), (maxlen), NULL, NULL) | |
415 | +#define __decode_dotted(packet,offset,packet_len,dest,dest_len) \ | |
416 | + dn_expand((packet), (packet) + (packet_len), (packet) + (offset), \ | |
417 | + (dest), (dest_len)) | |
418 | + | |
421 | 419 | /* |
422 | 420 | * Theory of operation. |
423 | 421 | * |
@@ -553,33 +551,6 @@ void __decode_header(unsigned char *data, | ||
553 | 551 | #endif /* L_decodeh */ |
554 | 552 | |
555 | 553 | |
556 | -#ifdef L_encoded | |
557 | - | |
558 | -/* Encode a dotted string into nameserver transport-level encoding. | |
559 | - This routine is fairly dumb, and doesn't attempt to compress | |
560 | - the data */ | |
561 | -int __encode_dotted(const char *dotted, unsigned char *dest, int maxlen) | |
562 | -{ | |
563 | - return (dn_comp(dotted, dest, maxlen, NULL, NULL)); | |
564 | -} | |
565 | -#endif /* L_encoded */ | |
566 | - | |
567 | - | |
568 | -#ifdef L_decoded | |
569 | - | |
570 | -/* Decode a dotted string from nameserver transport-level encoding. | |
571 | - This routine understands compressed data. */ | |
572 | -int __decode_dotted(const unsigned char *packet, | |
573 | - int offset, | |
574 | - int packet_len, | |
575 | - char *dest, | |
576 | - int dest_len) | |
577 | -{ | |
578 | - return (dn_expand(packet, packet + packet_len, packet + offset, dest, dest_len)); | |
579 | -} | |
580 | -#endif /* L_decoded */ | |
581 | - | |
582 | - | |
583 | 554 | #ifdef L_encodeq |
584 | 555 | |
585 | 556 | int __encode_question(const struct resolv_question *q, |