Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

# inet.c File Reference

`#include <pcap-stdinc.h>`
`#include <ctype.h>`
`#include <errno.h>`
`#include <memory.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include "pcap-int.h"`

Go to the source code of this file.

## Defines
#define | INT_MAX 2147483647
#define | ISLOOPBACK(name, flags)
## Functions
sockaddr * | dup_sockaddr (struct sockaddr *sa, size_t sa_length)
int | get_instance (const char *name)
int | add_or_find_if (pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name, u_int flags, const char *description, char *errbuf)
int | add_addr_to_iflist (pcap_if_t **alldevs, char *name, u_int flags, struct sockaddr *addr, size_t addr_size, struct sockaddr *netmask, size_t netmask_size, struct sockaddr *broadaddr, size_t broadaddr_size, struct sockaddr *dstaddr, size_t dstaddr_size, char *errbuf)
int | pcap_add_if (pcap_if_t **devlist, char *name, u_int flags, const char *description, char *errbuf)
void | pcap_freealldevs (pcap_if_t *alldevs)
| Frees an interface list returned by pcap_findalldevs().
char * | pcap_lookupdev (char *errbuf)
| It returns the first valid device in the system.
int | pcap_lookupnet (char *device, bpf_u_int32 *netp, bpf_u_int32 *maskp, char *errbuf) const
## Variables
const char rcsid[] | _U_

## Define Documentation

#define INT_MAX 2147483647

| Definition at line 75 of file inet.c. Referenced by get_instance().

#define ISLOOPBACK | ( | name,
|  | flags |  | ) |

| Value:
    ((name)[0] == 'l' && (name)[1] == 'o' && \
        (isdigit((unsigned char)((name)[2])) || (name)[2] == '\0'))
Definition at line 91 of file inet.c. Referenced by add_or_find_if().

## Function Documentation

int add_addr_to_iflist | ( | pcap_if_t ** | alldevs,
|  | char * | name,
|  | u_int | flags,
|  | struct sockaddr * | addr,
|  | size_t | addr_size,
|  | struct sockaddr * | netmask,
|  | size_t | netmask_size,
|  | struct sockaddr * | broadaddr,
|  | size_t | broadaddr_size,
|  | struct sockaddr * | dstaddr,
|  | size_t | dstaddr_size,
|  | char * | errbuf
| ) |

| Definition at line 285 of file inet.c. References add_or_find_if(), pcap_addr::addr, pcap_if::addresses, pcap_addr::broadaddr, pcap_addr::dstaddr, dup_sockaddr(), pcap_addr::netmask, pcap_addr::next, pcap_addr_t, PCAP_ERRBUF_SIZE, pcap_strerror(), and snprintf.

int add_or_find_if | ( | pcap_if_t ** | curdev_ret,
|  | pcap_if_t ** | alldevs,
|  | const char * | name,
|  | u_int | flags,
|  | const char * | description,
|  | char * | errbuf
| ) |

| Definition at line 132 of file inet.c. References pcap_if::addresses, pcap_if::description, pcap_if::flags, get_instance(), ISLOOPBACK, pcap_if::name, pcap_if::next, PCAP_ERRBUF_SIZE, PCAP_IF_LOOPBACK, pcap_strerror(), and snprintf. Referenced by add_addr_to_iflist(), and pcap_add_if().

struct sockaddr* dup_sockaddr | ( | struct sockaddr * | sa,
|  | size_t | sa_length
| ) |

| Definition at line 96 of file inet.c. Referenced by add_addr_to_iflist().

int get_instance | ( | const char * | name | ) | `[static]`

| Definition at line 106 of file inet.c. References INT_MAX. Referenced by add_or_find_if().

int pcap_add_if | ( | pcap_if_t ** | devlist,
|  | char * | name,
|  | u_int | flags,
|  | const char * | description,
|  | char * | errbuf
| ) |

| Definition at line 397 of file inet.c. References add_or_find_if().

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

| Definition at line 665 of file inet.c. References npf_if_addr::IPAddress, MAX_NETWORK_ADDRESSES, PacketGetNetInfoEx(), and npf_if_addr::SubnetMask.

## Variable Documentation

const char rcsid [] _U_`[static]`

| Initial value:
        "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.58.2.2 2004/04/30 09:07:21 risso Exp $ (LBL)"
Definition at line 36 of file inet.c.

documentation. Copyright (c) 2002-2003 Politecnico di Torino. All rights reserved.