]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/ref/net-common-tcpip-manpages-getservent.html
RedBoot TX53 Release 2012-02-15
[karo-tx-redboot.git] / doc / html / ref / net-common-tcpip-manpages-getservent.html
1 <!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2 <!-- This material may be distributed only subject to the terms      -->
3 <!-- and conditions set forth in the Open Publication License, v1.0  -->
4 <!-- or later (the latest version is presently available at          -->
5 <!-- http://www.opencontent.org/openpub/).                           -->
6 <!-- Distribution of the work or derivative of the work in any       -->
7 <!-- standard (paper) book form is prohibited unless prior           -->
8 <!-- permission is obtained from the copyright holder.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >getservent</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
21 REL="UP"
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
24 REL="PREVIOUS"
25 TITLE="getrrsetbyname"
26 HREF="net-common-tcpip-manpages-getrrsetbyname.html"><LINK
27 REL="NEXT"
28 TITLE="if_nametoindex"
29 HREF="net-common-tcpip-manpages-if-nametoindex.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos Reference Manual</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="net-common-tcpip-manpages-getrrsetbyname.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 38. TCP/IP Library Reference</TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="net-common-tcpip-manpages-if-nametoindex.html"
72 ACCESSKEY="N"
73 >Next</A
74 ></TD
75 ></TR
76 ></TABLE
77 ><HR
78 ALIGN="LEFT"
79 WIDTH="100%"></DIV
80 ><DIV
81 CLASS="SECT1"
82 ><H1
83 CLASS="SECT1"
84 ><A
85 NAME="NET-COMMON-TCPIP-MANPAGES-GETSERVENT">getservent</H1
86 ><TABLE
87 BORDER="5"
88 BGCOLOR="#E0E0F0"
89 WIDTH="70%"
90 ><TR
91 ><TD
92 ><PRE
93 CLASS="SCREEN"
94 >GETSERVENT(3)           System Library Functions Manual          GETSERVENT(3)
95
96 NAME
97      getservent, getservbyport, getservbyname, setservent, endservent - get
98      service entry
99
100 SYNOPSIS
101      #include &lt;netdb.h&#62;
102
103      struct servent *
104      getservent(void);
105
106      struct servent *
107      getservbyname(char *name, char *proto);
108
109      struct servent *
110      getservbyport(int port, char *proto);
111
112      void
113      setservent(int stayopen);
114
115      void
116      endservent(void);
117
118 DESCRIPTION
119      The getservent(), getservbyname(), and getservbyport() functions each
120      return a pointer to an object with the following structure containing the
121      broken-out fields of a line in the network services database,
122      /etc/services.
123
124            struct  servent {
125                    char    *s_name;        /* official name of service */
126                    char    **s_aliases;    /* alias list */
127                    int     s_port;         /* port service resides at */
128                    char    *s_proto;       /* protocol to use */
129            };
130
131      The members of this structure are:
132
133      s_name     The official name of the service.
134
135      s_aliases  A zero-terminated list of alternate names for the service.
136
137      s_port     The port number at which the service resides.  Port numbers
138                 are returned in network byte order.
139
140      s_proto    The name of the protocol to use when contacting the service.
141
142      The getservent() function reads the next line of the file, opening the
143      file if necessary.
144
145      The setservent() function opens and rewinds the file.  If the stayopen
146      flag is non-zero, the net database will not be closed after each call to
147      getservbyname() or getservbyport().
148
149      The endservent() function closes the file.
150
151      The getservbyname() and getservbyport() functions sequentially search
152      from the beginning of the file until a matching protocol name or port
153      number (specified in network byte order) is found, or until EOF is
154      encountered.  If a protocol name is also supplied (non-null), searches
155      must also match the protocol.
156
157 FILES
158      /etc/services
159
160 DIAGNOSTICS
161      Null pointer (0) returned on EOF or error.
162
163 SEE ALSO
164      getprotoent(3), services(5)
165
166 HISTORY
167      The getservent(), getservbyport(), getservbyname(), setservent(), and
168      endservent() functions appeared in 4.2BSD.
169
170 BUGS
171      These functions use static data storage; if the data is needed for future
172      use, it should be copied before any subsequent calls overwrite it.
173      Expecting port numbers to fit in a 32-bit quantity is probably naive.
174
175 BSD                            January 12, 1994                            BSD
176     </PRE
177 ></TD
178 ></TR
179 ></TABLE
180 ></DIV
181 ><DIV
182 CLASS="NAVFOOTER"
183 ><HR
184 ALIGN="LEFT"
185 WIDTH="100%"><TABLE
186 SUMMARY="Footer navigation table"
187 WIDTH="100%"
188 BORDER="0"
189 CELLPADDING="0"
190 CELLSPACING="0"
191 ><TR
192 ><TD
193 WIDTH="33%"
194 ALIGN="left"
195 VALIGN="top"
196 ><A
197 HREF="net-common-tcpip-manpages-getrrsetbyname.html"
198 ACCESSKEY="P"
199 >Prev</A
200 ></TD
201 ><TD
202 WIDTH="34%"
203 ALIGN="center"
204 VALIGN="top"
205 ><A
206 HREF="ecos-ref.html"
207 ACCESSKEY="H"
208 >Home</A
209 ></TD
210 ><TD
211 WIDTH="33%"
212 ALIGN="right"
213 VALIGN="top"
214 ><A
215 HREF="net-common-tcpip-manpages-if-nametoindex.html"
216 ACCESSKEY="N"
217 >Next</A
218 ></TD
219 ></TR
220 ><TR
221 ><TD
222 WIDTH="33%"
223 ALIGN="left"
224 VALIGN="top"
225 >getrrsetbyname</TD
226 ><TD
227 WIDTH="34%"
228 ALIGN="center"
229 VALIGN="top"
230 ><A
231 HREF="tcpip-library-reference.html"
232 ACCESSKEY="U"
233 >Up</A
234 ></TD
235 ><TD
236 WIDTH="33%"
237 ALIGN="right"
238 VALIGN="top"
239 >if_nametoindex</TD
240 ></TR
241 ></TABLE
242 ></DIV
243 ></BODY
244 ></HTML
245 >