31 #include <sys/types.h>
33 #include <sys/bufmod.h>
34 #include <sys/stream.h>
109 retv = dlpi_open(p->
opt.
device, &dh, DLPI_RAW|DLPI_PASSIVE);
110 if (retv != DLPI_SUCCESS) {
111 if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK)
113 else if (retv == DL_SYSERR &&
134 if ((retv = dlpi_bind(
pd->dlpi_hd, DLPI_ANY_SAP, 0)) != DLPI_SUCCESS) {
199 if ((retv = dlpi_info(
pd->dlpi_hd, &dlinfo, 0)) != DLPI_SUCCESS) {
210 p->
fd = dlpi_fd(
pd->dlpi_hd);
213 if (pcap_conf_bufmod(p, p->
snapshot) != 0) {
221 if (
ioctl(p->
fd, I_FLUSH, FLUSHR) != 0) {
256 #define STRINGIFY(n) #n
265 retv = dlpi_promiscon(
pd->dlpi_hd, level);
266 if (retv != DLPI_SUCCESS) {
267 if (retv == DL_SYSERR &&
359 NULL, errbuf) == NULL)
364 for (entry = lw.
lw_list; entry != NULL; entry = next) {
406 retv = dlpi_recv(
pd->dlpi_hd, NULL, NULL, bufp,
408 if (retv != DLPI_SUCCESS) {
414 if (retv == DL_SYSERR &&
errno == EINTR) {
419 "dlpi_recv", retv, p->
errbuf);
435 retv = dlpi_send(
pd->dlpi_hd, NULL, 0, buf, size, NULL);
436 if (retv != DLPI_SUCCESS) {
457 if (
pd->dlpi_hd != NULL) {
458 dlpi_close(
pd->dlpi_hd);
472 func, linkname, dlpi_strerror(err));
int pcap_process_mactype(pcap_t *p, u_int mactype)
int pcap_alloc_databuf(pcap_t *p)
int pcap_stats_dlpi(pcap_t *p, struct pcap_stat *ps)
int pcap_process_pkts(pcap_t *p, pcap_handler callback, u_char *user, int count, u_char *bufp, int len)
int pcap_findalldevs_interfaces(pcap_if_list_t *devlistp, char *errbuf, int(*check_usable)(const char *), get_if_flags_func get_flags_func)
void pcap_fmt_errmsg_for_errno(char *errbuf, size_t errbuflen, int errnum, const char *fmt,...)
int install_bpf_program(pcap_t *p, struct bpf_program *fp)
int snprintf(char *, size_t, const char *,...)
int ioctl(int, int, caddr_t)
void pcap_cleanup_live_common(pcap_t *)
pcap_if_t * find_or_add_dev(pcap_if_list_t *, const char *, bpf_u_int32, get_if_flags_func, const char *, char *)
int pcap_getnonblock_fd(pcap_t *)
int pcap_setnonblock_fd(pcap_t *p, int)
#define PCAP_VERSION_STRING
#define PCAP_CREATE_COMMON(ebuf, type)
static int get_if_flags(const char *name, bpf_u_int32 *flags, char *errbuf)
struct linkwalk linkwalk_t
const char * pcap_lib_version(void)
static int dlpromiscon(pcap_t *, bpf_u_int32)
static int is_dlpi_interface(const char *name)
int pcap_platform_finddevs(pcap_if_list_t *devlistp, char *errbuf)
pcap_t * pcap_create_interface(const char *device, char *ebuf)
static void pcap_cleanup_libdlpi(pcap_t *)
static boolean_t list_interfaces(const char *, void *)
static int pcap_activate_libdlpi(pcap_t *p)
static int pcap_read_libdlpi(pcap_t *, int, pcap_handler, u_char *)
static void pcap_libdlpi_err(const char *, const char *, int, char *)
static int pcap_inject_libdlpi(pcap_t *, const void *, int)
struct linknamelist linknamelist_t
#define PCAP_ERROR_PERM_DENIED
#define PCAP_ERROR_RFMON_NOTSUP
#define PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE
void(* pcap_handler)(u_char *, const struct pcap_pkthdr *, const u_char *)
#define PCAP_ERROR_PROMISC_PERM_DENIED
#define PCAP_ERROR_NO_SUCH_DEVICE
size_t pcap_strlcpy(char *restrict dst, const char *restrict src, size_t dsize)
char linkname[DLPI_LINKNAME_MAX]
struct linknamelist * lnl_next
activate_op_t activate_op
setnonblock_op_t setnonblock_op
setfilter_op_t setfilter_op
getnonblock_op_t getnonblock_op
setdirection_op_t setdirection_op
set_datalink_op_t set_datalink_op