1dlpi_open(3DLPI)Data Link Provider Interface Library Functionsdlpi_open(3DLPI)
2
3
4

NAME

6       dlpi_open - open DLPI link
7

SYNOPSIS

9       cc [ flag ... ] file ... -ldlpi [ library ... ]
10       #include <libdlpi.h>
11
12       int dlpi_open(const char *linkname, dlpi_handle_t *dhp,
13            uint_t flags);
14
15

DESCRIPTION

17       The dlpi_open() function creates an open instance of the DLPI Version 2
18       link named by linkname and associates it with  a  dynamically-allocated
19       dlpi_handle_t, which is returned to the caller in dhp upon success. The
20       DLPI handle is left in the DL_UNBOUND DLPI  state  after  a  successful
21       open  of the DLPI link. The DLPI handles can only be used by one thread
22       at a time, but multiple handles can be used by multiple  threads.  This
23       function can open both DL_STYLE1 and DL_STYLE2 DLPI links.
24
25
26       By  default  (if  DLPI_DEVIPNET  is  not set in flags), the dlpi_open()
27       function scans the /dev/net and /dev directories  for  DLPI  links,  in
28       order.  Within  each  scanned  directory, dlpi_open() first looks for a
29       matching DL_STYLE1  link,  then  for  a  matching  DL_STYLE2  link.  If
30       provider is considered the linkname with its trailing digits removed, a
31       matching DL_STYLE1 link has a filename  of  linkname,  and  a  matching
32       DL_STYLE2  link  has  a  filename  of  provider. If a DL_STYLE2 link is
33       opened, dlpi_open() automatically performs the  necessary  DLPI  opera‐
34       tions to place the DLPI link instance and the associated DLPI handle in
35       the DL_UNBOUND state. See dlpi(7P) for the definition of linkname.
36
37
38       If DLPI_DEVIPNET is set in flags, dlpi_open() opens the  file  linkname
39       in /dev/ipnet as a DL_STYLE1 DLPI device and does not look in any other
40       directories.
41
42
43       The value of flags is constructed  by  a  bitwise-inclusive-OR  of  the
44       flags listed below, defined in <libdlpi.h>.
45
46       DLPI_DEVIPNET     Specify  that  the named DLPI device is an IP observ‐
47                         ability device (see ipnet(7D)),  and  dl_open()  will
48                         open the device from the /dev/ipnet/ directory.
49
50
51       DLPI_IPNETINFO    This  flag is applicable only when opening IP Observ‐
52                         ability devices (with DLPI_DEVIPNET or by opening the
53                         /dev/lo0  device).  This flag causes the ipnet driver
54                         to prepend  an  ipnet  header  to  each  received  IP
55                         packet.  See  ipnet(7D)  for  the  contents  of  this
56                         header.
57
58
59       DLPI_NATIVE       Enable DLPI native mode (see DLIOCNATIVE in dlpi(7P))
60                         on  a  DLPI link instance. Native mode persists until
61                         the DLPI handle is closed by dlpi_close(3DLPI).
62
63
64       DLPI_PASSIVE      Enable  DLPI  passive  mode  (see  DL_PASSIVE_REQ  in
65                         dlpi(7P))  on a DLPI link instance. Passive mode per‐
66                         sists  until   the   DLPI   handle   is   closed   by
67                         dlpi_close(3DLPI).
68
69
70       DLPI_RAW          Enable  DLPI raw mode (see DLIOCRAW in dlpi(7P)) on a
71                         DLPI link instance. Raw mode persists until the  DLPI
72                         handle is closed by dlpi_close(3DLPI).
73
74
75
76       Each  DLPI  handle  has  an  associated timeout value that is used as a
77       timeout interval for certain libdlpi operations.  The  default  timeout
78       value  ensures that DLPI_ETIMEDOUT is returned from a libdlpi operation
79       only in the event that the DLPI link becomes unresponsive. The  timeout
80       value can be changed with dlpi_set_timeout(3DLPI), although this should
81       seldom be necessary.
82

RETURN VALUES

84       Upon success, DLPI_SUCCESS is returned. If DL_SYSERR is returned, errno
85       contains  the specific UNIX system error value. Otherwise, a DLPI error
86       value defined in <sys/dlpi.h> or listed in  the  following  section  is
87       returned.
88

ERRORS

90       The dlpi_open() function will fail if:
91
92       DLPI_EBADLINK            Bad DLPI link
93
94
95       DLPI_EIPNETINFONOTSUP    The DLPI_IPNETINFO flag was set but the device
96                                opened does  not  support  the  DLIOCIPNETINFO
97                                ioctl.
98
99
100       DLPI_ELINKNAMEINVAL      Invalid DLPI linkname
101
102
103       DLPI_ENOLINK             DLPI link does not exist
104
105
106       DLPI_ERAWNOTSUP          DLPI raw mode not supported
107
108
109       DLPI_ETIMEDOUT           DLPI operation timed out
110
111
112       DLPI_FAILURE             DLPI operation failed
113
114

ATTRIBUTES

116       See attributes(5) for description of the following attributes:
117
118
119
120
121       ┌─────────────────────────────┬─────────────────────────────┐
122       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
123       ├─────────────────────────────┼─────────────────────────────┤
124       │Interface Stability          │Committed                    │
125       ├─────────────────────────────┼─────────────────────────────┤
126       │MT-Level                     │Safe                         │
127       └─────────────────────────────┴─────────────────────────────┘
128

SEE ALSO

130       dlpi_close(3DLPI),        dlpi_set_timeout(3DLPI),       libdlpi(3LIB),
131       attributes(5), dlpi(7P), ipnet(7D)
132
133
134
135SunOS 5.11                        17 Nov 2008                 dlpi_open(3DLPI)
Impressum