{"id":6680,"date":"2022-12-20T19:33:23","date_gmt":"2022-12-20T22:33:23","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/getnetent-man3\/"},"modified":"2022-12-20T19:33:23","modified_gmt":"2022-12-20T22:33:23","slug":"getnetent-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/getnetent-man3\/","title":{"rendered":"GETNETENT (man3)"},"content":{"rendered":"<h1 align=\"center\">GETNETENT<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#ATTRIBUTES\">ATTRIBUTES<\/a><br \/> <a href=\"#CONFORMING TO\">CONFORMING TO<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COLOPHON\">COLOPHON<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent \u2212 get network entry<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <netdb.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>struct netent *getnetent(void);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>struct netent *getnetbyname(const char *<\/b><i>name<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>struct netent *getnetbyaddr(uint32_t<\/b> <i>net<\/i><b>, int<\/b> <i>type<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>void setnetent(int<\/b> <i>stayopen<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>void endnetent(void);<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getnetent<\/b>() function reads the next entry from the networks database and returns a <i>netent<\/i> structure containing the broken-out fields from the entry. A connection is opened to the database if necessary.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getnetbyname<\/b>() function returns a <i>netent<\/i> structure for the entry from the database that matches the network <i>name<\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getnetbyaddr<\/b>() function returns a <i>netent<\/i> structure for the entry from the database that matches the network number <i>net<\/i> of type <i>type<\/i>. The <i>net<\/i> argument must be in host byte order.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>setnetent<\/b>() function opens a connection to the database, and sets the next entry to the first entry. If <i>stayopen<\/i> is nonzero, then the connection to the database will not be closed between calls to one of the <b>getnet*<\/b>() functions.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>endnetent<\/b>() function closes the connection to the database.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>netent<\/i> structure is defined in <i><netdb.h><\/i> as follows:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">struct netent { <br \/> char *n_name; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var official network name bodies\/ usr\/ <br \/> char **n_aliases; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var alias list bodies\/ usr\/ <br \/> int n_addrtype; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var net address type bodies\/ usr\/ <br \/> uint32_t n_net; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var network number bodies\/ usr\/ <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The members of the <i>netent<\/i> structure are:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><i>n_name<\/i><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"50%\">\n<p>The official name of the network.<\/p>\n<\/td>\n<td width=\"28%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><i>n_aliases<\/i><\/p>\n<p style=\"margin-left:22%;\">A NULL-terminated list of alternative names for the network.<\/p>\n<p style=\"margin-left:11%;\"><i>n_addrtype<\/i><\/p>\n<p style=\"margin-left:22%;\">The type of the network number; always <b>AF_INET<\/b>.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><i>n_net<\/i><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"58%\">\n<p>The network number in host byte order.<\/p>\n<\/td>\n<td width=\"20%\"> <\/td>\n<\/tr>\n<\/table>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getnetent<\/b>(), <b>getnetbyname<\/b>(), and <b>getnetbyaddr<\/b>() functions return a pointer to a statically allocated <i>netent<\/i> structure, or a null pointer if an error occurs or the end of the file is reached.<\/p>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>\/etc\/networks<\/i><\/p>\n<p style=\"margin-left:22%;\">networks database file<\/p>\n<h2>ATTRIBUTES <a name=\"ATTRIBUTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">For an explanation of the terms used in this section, see <b>attributes<\/b>(7).<\/p>\n<p align=\"center\" style=\"margin-top: 1em\"><img decoding=\"async\" src=\"grohtml-1662111.png\" alt=\"Image grohtml-1662111.png\"><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In the above table, <i>netent<\/i> in <i>race:netent<\/i> signifies that if any of the functions <b>setnetent<\/b>(), <b>getnetent<\/b>(), or <b>endnetent<\/b>() are used in parallel in different threads of a program, then data races could occur.<\/p>\n<h2>CONFORMING TO <a name=\"CONFORMING TO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">POSIX.1-2001, POSIX.1-2008, 4.3BSD.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">In glibc versions before 2.2, the <i>net<\/i> argument of <b>getnetbyaddr<\/b>() was of type <i>long<\/i>.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getnetent_r<\/b>(3), <b>getprotoent<\/b>(3), <b>getservent<\/b>(3) <br \/> RFC\u00a01101<\/p>\n<h2>COLOPHON <a name=\"COLOPHON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This page is part of release 5.10 of the Linux <i>man-pages<\/i> project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https:\/\/www.kernel.org\/doc\/man\u2212pages\/.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent \u2212 get network entry <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,3059,3007],"class_list":["post-6680","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-getnetent","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6680"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6680\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}