X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/384545ce291041b819661bf6d66b00e4c8ee88fd..f17a708ff0e870baf2709bb0d63f32f166e082d3:/practicas/pipi/src/nameserver.h?ds=inline diff --git a/practicas/pipi/src/nameserver.h b/practicas/pipi/src/nameserver.h index d0fa98d..dbaecf7 100644 --- a/practicas/pipi/src/nameserver.h +++ b/practicas/pipi/src/nameserver.h @@ -2,7 +2,7 @@ #define _NAMESERVER_H_ #include "ipaddr.h" -//XXX#include "resolvproto.h" +#include "resolvproto.h" #include #include #include @@ -65,12 +65,12 @@ struct NameServer /// Time to live size_t ttl; /// Dirección IP del registro - typedef std::vector< Record > records_t; - records_t records; + typedef ResolvProtoResponse::ipvec_t ipvec_t; + ipvec_t ips; /// Constructor CacheRecord(): ttl(0) {} - CacheRecord(size_t ttl, const records_t& records): - ttl(ttl), records(records) {} + CacheRecord(size_t ttl, const ipvec_t& ips): + ttl(ttl), ips(ips) {} }; /// Cache de records @@ -80,8 +80,20 @@ struct NameServer /// Constructor NameServer(std::istream& is) throw (std::runtime_error); - /// Resuelve un nombre de forma no recursiva - void resolv_next(const Name& n); + /// Resuelve un nombre de forma directa (no recursiva) + ResolvProtoResponse resolv_direct(const Name& n); + + /// Resuelve un nombre de forma recursiva + ResolvProtoResponse resolv_recursive(const Name& n); + + /// Consulta a otro name server sobre un nombre + ResolvProtoResponse query(const Name&n, const IPAddr& ip); + + private: + /// Resuelve un nombre de forma recursiva entrando a otros ns + ResolvProtoResponse resolv_recursive_r(const Name& n, + ResolvProtoResponse rpr); + }; /// Impresión (para debug)