Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / net_phygetnext.9f
blob61d0b2207be7f1f7796805fa78cd214f16f6710b
1 '\" te
2 .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH NET_PHYGETNEXT 9F "May 1, 2008"
7 .SH NAME
8 net_phygetnext \- search through the current list of network interfaces
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/neti.h>
14 \fBphy_if_t\fR \fBnet_phygetnext\fR(\fBconst\fR \fBnet_data_t\fR \fInet\fR, \fBconst\fR \fBphy_if_t\fR \fIifp\fR);
15 .fi
17 .SH INTERFACE LEVEL
18 .sp
19 .LP
20 Solaris DDI specific (Solaris DDI).
21 .SH PARAMETERS
22 .sp
23 .ne 2
24 .na
25 \fB\fInet\fR\fR
26 .ad
27 .RS 7n
28 value returned from a successful call to \fBnet_protocol_lookup\fR(9F).
29 .RE
31 .sp
32 .ne 2
33 .na
34 \fB\fIifp\fR\fR
35 .ad
36 .RS 7n
37 value returned from a successful call to this function or
38 \fBnet_phylookup\fR(9F).
39 .RE
41 .SH DESCRIPTION
42 .sp
43 .LP
44 The \fBnet_phygetnext()\fR function searches through all of the network
45 interfaces that a network protocol "owns". To start searching through all of
46 the interfaces owned by a protocol, a value of 0 should be passed through as
47 the value of \fBifp\fR. When 0 is returned by this function, the last of the
48 interfaces owned by this protocol has been reached.
49 .sp
50 .LP
51 When called successfully, the value returned represents a network interface
52 that exists, at the time of the call, within the scope of the network
53 interface. This value is only guaranteed to be unique for a name within the
54 scope of the network protocol.
55 .SH EXAMPLES
56 .sp
57 .in +2
58 .nf
59    net_data_t net;
60     phy_if_t ifp;
61     char buffer[32];
63     net = net_protocol_lookup("inet");
65     if (net != NULL) {
66          for (ifp = net_phygetnext(net, 0); ifp != 0;
67               ifp = net_phygetnext(net, ifp)) {
68               /* Do something with ifp */
69               if (net_getifname(net, ifp, buffer,
70                    sizeof(buffer) >= 0)
71                     printf("Interface %s0, buffer);
72           }
73       }
74 .fi
75 .in -2
76 .sp
78 .SH RETURN VALUES
79 .sp
80 .LP
81 The \fBnet_phygetnext()\fR function returns -1 if it is not supported by the
82 network  protocol or 0 if an attempt to go beyond the last network  interface
83 is  made. Otherwise, it returns  a  value representing a network interface.
84 .SH CONTEXT
85 .sp
86 .LP
87 The \fBnet_phygetnext()\fR function may be called from user,  kernel, or
88 interrupt context.
89 .SH ATTRIBUTES
90 .sp
91 .LP
92 See \fBattributes\fR(5) for descriptions of the following attributes:
93 .sp
95 .sp
96 .TS
97 box;
98 c | c
99 l | l .
100 ATTRIBUTE TYPE  ATTRIBUTE VALUE
102 Interface Stability     Committed
105 .SH SEE ALSO
108 \fBnet_phylookup\fR(9F), \fBnet_protocol_lookup\fR(9F), \fBattributes\fR(5)