getipnodebyname(3) Library Functions Manual getipnodebyname(3) NOMBRE getipnodebyname, getipnodebyaddr, freehostent - obtiene nombres y direcciones de host BIBLIOTECA Biblioteca Estandar C (libc, -lc) SINOPSIS #include #include #include [[a extinguir]] struct hostent *getipnodebyname(const char *name, int af, int flags, int *error_num); [[a extinguir]] struct hostent *getipnodebyaddr(const void addr[.len], size_t len, int af, int *error_num); [[a extinguir]] void freehostent(struct hostent *ip); DESCRIPCION Estas funciones estan obsoletas y tampoco estan disponibles en glibc. Use getaddrinfo(3) y getnameinfo(3) en su lugar. Las funciones getipnodebyname() y getipnodebyaddr() devuelven los nombres y las direcciones de un host. Estas funciones devuelven un puntero a la siguiente estructura: struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; }; Estas funciones reemplazan a las funciones gethostbyname(3) y gethostbyaddr(3) , las cuales solo podian manejar la familia de direcciones de red IPv4. Las funciones getipnodebyname() y getipnodebyaddr() pueden manejar multiples familias de direcciones de red. A diferencia de las funciones gethostby, estas funciones devuelven punteros a memoria reservada dinamicamente. La funcion freehostent() se emplea para liberar la memoria dinamica asignada despues de que el invocador deje de necesitar la estructura hostent. parametros de getipnodebyname() The getipnodebyname() function looks up network addresses for the host specified by the name argument. The af argument specifies one of the following values: AF_INET The name argument points to a dotted-quad IPv4 address or a name of an IPv4 network host. AF_INET6 The name argument points to a hexadecimal IPv6 address or a name of an IPv6 network host. The flags argument specifies additional options. More than one option can be specified by bitwise OR-ing them together. flags should be set to 0 if no options are desired. AI_V4MAPPED Esta opcion se usa con AF_INET6 para solicitar una consulta de direcciones IPv4 en lugar de direcciones IPv6; las direcciones IPv4 seran convertidas a direcciones IPv6. AI_ALL Esta opcion se usa con AI_V4MAPPED para solicitar una consulta de direcciones IPv4 y IPv6. Cualquier direccion IPv4 encontrada se convertira a una direccion IPv6. AI_ADDRCONFIG Esta opcion se usa con AF_INET6 para solicitar que las consultas de direcciones IPv6 no se realicen a menos que el sistema tenga al menos una direccion IPv6 asignada a una interfaz de red, y que las consultas de direcciones IPv4 no se realicen a menos que el sistema tenga al menos una direccion IPv4 asignada a una interfaz de red. Esta opcion puede usarse aislada o con la opcion AI_V4MAPPED. AI_DEFAULT Esta opcion es equivalente a (AI_ADDRCONFIG | AI_V4MAPPED). parametros de getipnodebyaddr() The getipnodebyaddr() function looks up the name of the host whose network address is specified by the addr argument. The af argument specifies one of the following values: AF_INET The addr argument points to a struct in_addr and len must be set to sizeof(struct in_addr). AF_INET6 The addr argument points to a struct in6_addr and len must be set to sizeof(struct in6_addr). VALOR DEVUELTO NULL is returned if an error occurred, and error_num will contain an error code from the following list: HOST_NOT_FOUND No se encontro el nombre de host o la direccion de red. NO_ADDRESS El servidor de nombres de dominio reconocio la direccion o nombre de red, pero no devolvio ninguna respuesta. Esto puede suceder si el host tiene solamente direcciones IPv4 y se realiza una consulta de direcciones IPv6 solamente, o viceversa. NO_RECOVERY El servidor de nombres de dominio devolvio una respuesta de fallo permanente. TRY_AGAIN El servidor de nombres de dominio devolvio una respuesta de fallo temporal. Puede que tenga mejor suerte la proxima vez. Una consulta exitosa devuelve un puntero a una estructura hostent que contiene los siguientes campos: h_name Nombre oficial del host. h_aliases Es un array de punteros a sinonimos no oficiales para el mismo host. Este array termina en un puntero null. h_addrtype This is a copy of the af argument to getipnodebyname() or getipnodebyaddr(). h_addrtype will always be AF_INET if the af argument was AF_INET. h_addrtype will always be AF_INET6 if the af argument was AF_INET6. h_length Este campo contendra el valor sizeof(struct in_addr) si h_addrtype es AF_INET, y el valor sizeof(struct in6_addr) si h_addrtype es AF_INET6. h_addr_list Es un array de uno o mas punteros a estructuras de direcciones de red para el host. Este array termina en un puntero null. ESTANDARES None. HISTORIAL RFC 2553. Present in glibc 2.1.91-95, but removed again. Several UNIX-like systems support them, but all call them deprecated. VEASE TAMBIEN getaddrinfo(3), getnameinfo(3), inet_ntop(3), inet_pton(3) TRADUCCION La traduccion al espanol de esta pagina del manual fue creada por Miguel Perez Ibars y Marcos Fouces Esta traduccion es documentacion libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. Si encuentra algun error en la traduccion de esta pagina del manual, envie un correo electronico a . Paginas de Manual de Linux 6.8 2 Mayo 2024 getipnodebyname(3)