dlpi_info - get DLPI information
cc [ flag ... ] file ... -ldlpi [ library ... ] #include <libdlpi.h> int dlpi_info(dlpi_handle_t dh, dlpi_info_t *infop, uint_t opt);
The dlpi_info() function provides DLPI information about the open DLPI link instance associated with DLPI handle dh. DLPI information can be retrieved in any state of dh, but some of the information might not be available if dh is in the DL_UNBOUND DLPI state. The DLPI information received is copied into infop, which must point to a dlpi_info_t allocated by the caller. The opt argument is reserved for future use and must be set to 0.
The dlpi_info_t is a structure defined in <libdlpi.h> as follows:
typedef struct { uint_t di_opts; uint_t di_max_sdu; uint_t di_min_sdu; uint_t di_state; uchar_t di_mactype; char di_linkname[DLPI_LINKNAME_MAX]; uchar_t di_physaddr[DLPI_PHYSADDR_MAX]; uchar_t di_physaddrlen; uchar_t di_bcastaddr[DLPI_PHYSADDR_MAX]; uchar_t di_bcastaddrlen; uint_t di_sap; int di_timeout; dl_qos_cl_sel1_t di_qos_sel; dl_qos_cl_range1_t di_qos_range; } dlpi_info_t;
di_opts
di_max_sdu
di_min_sdu
di_state
di_mactype
di_linkname
di_physaddr
di_physaddrlen
di_bcastaddr
di_bcastaddrlen
di_sap
di_timeout
di_qos_sel
di_qos_range
Upon success, DLPI_SUCCESS is returned. If DL_SYSERR is returned, errno contains the specific UNIX system error value. Otherwise, a DLPI error value defined in <sys/dlpi.h> or an error value listed in the following section is returned.
DLPI_EBADMSG
DLPI_EINHANDLE
DLPI_EINVAL
DLPI_EMODENOTSUP
DLPI_ETIMEDOUT
DLPI_EVERNOTSUP
DLPI_FAILURE
Example 1 Get link-layer broadcast address
The following example shows how dlpi_info() can be used.
#include <libdlpi.h> uchar_t * get_bcastaddr(const char *linkname, uchar_t *baddrlenp) { dlpi_handle_t dh; dlpi_info_t dlinfo; uchar_t *baddr; if (dlpi_open(linkname, &dh, 0) != DLPI_SUCCESS) return (NULL); if (dlpi_info(dh, &dlinfo, 0) != DLPI_SUCCESS) { dlpi_close(dh); return (NULL); } dlpi_close(dh); *baddrlenp = dlinfo.di_bcastaddrlen; if ((baddr = malloc(*baddrlenp)) == NULL) return (NULL); return (memcpy(baddr, dlinfo.di_bcastaddr, *baddrlenp)); }
See attributes(5) for description of the following attributes:
|
dlpi_bind(3DLPI), libdlpi(3LIB), attributes(5)
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |