[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


pcap_lookupdev Subroutine

Purpose

Obtains the name of a network device on the system.

Library

pcap Library (libpcap.a)

Syntax


#include <pcap.h>


char *pcap_lookupdev(char * errbuf);

Description

The pcap_lookupdev subroutine gets a network device suitable for use with the pcap_open_live and the pcap_lookupnet subroutines. If no interface can be found, or none are configured to be up, Null is returned. In the case of multiple network devices attached to the system, the pcap_lookupdev subroutine returns the first one it finds to be up, other than the loopback interface. (Loopback is always ignored.)

Parameters


errbuf Returns error text and is only set when the pcap_lookupdev subroutine fails.

Return Values

Upon successful completion, the pcap_lookupdev subroutine returns a pointer to the name of a network device attached to the system. If pcap_lookupdev subroutine is unsuccessful, Null is returned, and text indicating the specific error is written to errbuf.

Related Information

The pcap_geterr (pcap_geterr Subroutine) subroutine, pcap_lookupnet (pcap_lookupnet Subroutine) subroutine, pcap_open_live (pcap_open_live Subroutine) subroutine, pcap_perror (pcap_perror Subroutine) subroutine.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]