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 (errbuf) register char *errbuf
## Variables
const char | rcsid []
register bpf_u_int32 * | netp
register bpf_u_int32 * | maskp
register char * | errbuf

## 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 300 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_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_close(), PCAP_IF_LOOPBACK, pcap_open_live(), pcap_strerror(), pcap_t, 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. References dup_sockaddr(). Referenced by add_addr_to_iflist(), and dup_sockaddr().

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

| Definition at line 106 of file inet.c. References INT_MAX, and n. 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 412 of file inet.c. References add_or_find_if().

void pcap_freealldevs | ( | pcap_if_t * | alldevsp | ) |

| Frees an interface list returned by pcap_findalldevs(). pcap_freealldevs() is used to free a list allocated by pcap_findalldevs(). See also: pcap_findalldevs() Definition at line 426 of file inet.c. References pcap_addr::addr, pcap_if::addresses, pcap_addr::broadaddr, pcap_if::description, pcap_addr::dstaddr, pcap_if::name, pcap_addr::netmask, pcap_addr::next, and pcap_if::next. Referenced by daemon_findalldevs(), and main().

char* pcap_lookupdev | ( | errbuf |  | ) |

## Variable Documentation

register char* errbuf

| Definition at line 632 of file inet.c. Referenced by daemon_serviceloop(), daemon_thrdatamain(), main(), main_active(), main_passive(), main_startup(), pcap_win32strerror(), rpcap_checkmsg(), sock_bufferize(), sock_check_hostlist(), sock_getascii_addrport(), sock_geterror(), sock_init(), sock_initaddress(), sock_open(), sock_present2network(), and sock_recv().

register bpf_u_int32 * maskp

| Definition at line 631 of file inet.c. Referenced by PacketGetNetInfo().

register bpf_u_int32* netp

| Definition at line 631 of file inet.c. Referenced by PacketGetNetInfo().

const char rcsid[]`[static]`

| Initial value:
        "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.54 2002/12/22 02:36:48 guy Exp $ (LBL)"
Definition at line 36 of file inet.c.

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