{"id":6996,"date":"2022-12-20T19:34:36","date_gmt":"2022-12-20T22:34:36","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/getprotoent-man3\/"},"modified":"2022-12-20T19:34:36","modified_gmt":"2022-12-20T22:34:36","slug":"getprotoent-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/getprotoent-man3\/","title":{"rendered":"GETPROTOENT (man3)"},"content":{"rendered":"<h1 align=\"center\">GETPROTOENT<\/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=\"#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\">getprotoent, getprotobyname, getprotobynumber, setprotoent, endprotoent \u2212 get protocol 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 protoent *getprotoent(void);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>struct protoent *getprotobyname(const char *<\/b><i>name<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>struct protoent *getprotobynumber(int<\/b> <i>proto<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>void setprotoent(int<\/b> <i>stayopen<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>void endprotoent(void);<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getprotoent<\/b>() function reads the next entry from the protocols database (see <b>protocols<\/b>(5)) and returns a <i>protoent<\/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>getprotobyname<\/b>() function returns a <i>protoent<\/i> structure for the entry from the database that matches the protocol name <i>name<\/i>. A connection is opened to the database if necessary.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getprotobynumber<\/b>() function returns a <i>protoent<\/i> structure for the entry from the database that matches the protocol number <i>number<\/i>. A connection is opened to the database if necessary.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>setprotoent<\/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>getproto*<\/b>() functions.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>endprotoent<\/b>() function closes the connection to the database.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>protoent<\/i> structure is defined in <i><netdb.h><\/i> as follows:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">struct protoent { <br \/> char *p_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 protocol name bodies\/ usr\/ <br \/> char **p_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 p_proto; \/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 protocol number bodies\/ usr\/ <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The members of the <i>protoent<\/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>p_name<\/i><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"52%\">\n<p>The official name of the protocol.<\/p>\n<\/td>\n<td width=\"26%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><i>p_aliases<\/i><\/p>\n<p style=\"margin-left:22%;\">A NULL-terminated list of alternative names for the protocol.<\/p>\n<p style=\"margin-left:11%;\"><i>p_proto<\/i><\/p>\n<p style=\"margin-left:22%;\">The protocol number.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getprotoent<\/b>(), <b>getprotobyname<\/b>(), and <b>getprotobynumber<\/b>() functions return a pointer to a statically allocated <i>protoent<\/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\/protocols<\/i><\/p>\n<p style=\"margin-left:22%;\">protocol 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-1664821.png\" alt=\"Image grohtml-1664821.png\"><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In the above table, <i>protoent<\/i> in <i>race:protoent<\/i> signifies that if any of the functions <b>setprotoent<\/b>(), <b>getprotoent<\/b>(), or <b>endprotoent<\/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>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getnetent<\/b>(3), <b>getprotoent_r<\/b>(3), <b>getservent<\/b>(3), <b>protocols<\/b>(5)<\/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>  getprotoent, getprotobyname, getprotobynumber, setprotoent, endprotoent \u2212 get protocol 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,3346,3007],"class_list":["post-6996","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-getprotoent","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6996","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=6996"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6996\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}