📄 getprotoent.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved --><title>endprotoent</title></head><body bgcolor="white"><basefont size="3"> <a name="endprotoent"></a> <a name="tag_03_120"></a><!-- endprotoent --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright © 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_120_01"></a>NAME</h4><blockquote>endprotoent, getprotobyname, getprotobynumber, getprotoent, setprotoent - network protocol databasefunctions</blockquote><h4><a name="tag_03_120_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>#include <<a href="../basedefs/netdb.h.html">netdb.h</a>><br><br> void endprotoent(void);<br> struct protoent *getprotobyname(const char *</tt><i>name</i><tt>);<br> struct protoent *getprotobynumber(int</tt> <i>proto</i><tt>);<br> struct protoent *getprotoent(void);<br> void setprotoent(int</tt> <i>stayopen</i><tt>);<br></tt></code></p></blockquote><h4><a name="tag_03_120_03"></a>DESCRIPTION</h4><blockquote><p>These functions shall retrieve information about protocols. This information is considered to be stored in a database that canbe accessed sequentially or randomly. The implementation of this database is unspecified.</p><p>The <i>setprotoent</i>() function shall open a connection to the database, and set the next entry to the first entry. If the<i>stayopen</i> argument is non-zero, the connection to the network protocol database shall not be closed after each call to<i>getprotoent</i>() (either directly, or indirectly through one of the other <a href="../functions/getprotobyname.html"><i>getproto*</i>()</a> functions), and the implementation may maintain an open file descriptor forthe database.</p><p>The <i>getprotobyname</i>() function shall search the database from the beginning and find the first entry for which theprotocol name specified by <i>name</i> matches the <i>p_name</i> member, opening and closing a connection to the database asnecessary.</p><p>The <i>getprotobynumber</i>() function shall search the database from the beginning and find the first entry for which theprotocol number specified by <i>proto</i> matches the <i>p_proto</i> member, opening and closing a connection to the database asnecessary.</p><p>The <i>getprotoent</i>() function shall read the next entry of the database, opening and closing a connection to the database asnecessary.</p><p>The <i>getprotobyname</i>(), <i>getprotobynumber</i>(), and <i>getprotoent</i>() functions shall each return a pointer to a<b>protoent</b> structure, the members of which shall contain the fields of an entry in the network protocol database.</p><p>The <i>endprotoent</i>() function shall close the connection to the database, releasing any open file descriptor.</p><p>These functions need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe.</p></blockquote><h4><a name="tag_03_120_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, <i>getprotobyname</i>(), <i>getprotobynumber</i>(), and <i>getprotoent</i>() return a pointer to a<b>protoent</b> structure if the requested entry was found, and a null pointer if the end of the database was reached or therequested entry was not found. Otherwise, a null pointer is returned.</p></blockquote><h4><a name="tag_03_120_05"></a>ERRORS</h4><blockquote><p>No errors are defined.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_120_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_120_07"></a>APPLICATION USAGE</h4><blockquote><p>The <i>getprotobyname</i>(), <i>getprotobynumber</i>(), and <i>getprotoent</i>() functions may return pointers to static data,which may be overwritten by subsequent calls to any of these functions.</p></blockquote><h4><a name="tag_03_120_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_120_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_120_10"></a>SEE ALSO</h4><blockquote><p>The Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/netdb.h.html"><i><netdb.h></i></a></p></blockquote><h4><a name="tag_03_120_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 6. Derived from the XNS, Issue 5.2 specification.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -