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

Technical Reference: Base Operating System and Extensions, Volume 1


pcap_lookupnet Subroutine

Purpose

Returns the network address and subnet mask for a network device.

Library

pcap Library (libpcap.a)

Syntax


#include <pcap.h>


int pcap_lookupnet(char * device, bpf_u_int32 * netp, bpf_u_int32 * maskp,
char *
errbuf);

Description

Use the pcap_lookupnet subroutine to determine the network address and subnet mask for the network device, device.

Parameters


device Specifies the name of the network device to use for the network lookup, for example, en0.
errbuf Returns error text and is only set when the pcap_lookupnet subroutine fails.
maskp Holds the subnet mask associated with device.
netp Holds the network address for the device.

Return Values

Upon successful completion, the pcap_lookupnet subroutine returns 0. If the pcap_lookupnet subroutine is unsuccessful, -1 is returned, and errbuf is filled in with an appropriate error message.

Related Information

The pcap_compile (pcap_compile Subroutine) subroutine, pcap_geterr (pcap_geterr Subroutine) subroutine, pcap_lookupdev (pcap_lookupdev Subroutine) subroutine, pcap_perror (pcap_perror Subroutine) subroutine.


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