The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pcap_min.h File Reference

Simple libpcap interface definitions. More...

#include <projectcommon.h>
#include <pcap.h>
Include dependency graph for pcap_min.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ENABLE_LLDP   0x1
 Enable LLDP protocol. More...
 
#define ENABLE_CDP   0x2
 Enable CDP protocol. More...
 
#define ENABLE_ARP   0x4
 Enable ARP protocol. More...
 

Functions

WINEXPORT pcap_t * create_pcap_listener (const char *dev, gboolean blocking, unsigned listenmask, struct bpf_program *)
 Set up pcap listener for the given interfaces and protocols. More...
 
WINEXPORT void close_pcap_listener (pcap_t *, const char *dev, unsigned listenmask)
 Close this pcap_listener, and undo listens for multicast addresses. More...
 

Detailed Description

Simple libpcap interface definitions.

Creates a libpcap pcap_t listener for the given set of protocols. This is a much higher level, but much less flexible approach than the native libpcap interface.

This file is part of the Assimilation Project.

Author
Copyright © 2011, 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file pcap_min.h.

Function Documentation

WINEXPORT void close_pcap_listener ( pcap_t *  ,
const char *  dev,
unsigned  listenmask 
)

Close this pcap_listener, and undo listens for multicast addresses.

Parameters
devdevice that this is opened on
listenmaskThe 'listenmask' given to create_pcap_listener

Definition at line 191 of file pcap_min.c.

References _enable_mcast_address(), and DIMOF.

Referenced by create_pcap_listener(), and g_source_pcap_finalize().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT pcap_t* create_pcap_listener ( const char *  dev,
gboolean  blocking,
unsigned  listenmask,
struct bpf_program *  prog 
)

Set up pcap listener for the given interfaces and protocols.

Returns
a properly configured pcap_t* object for listening for the given protocols - NULL on error
See Also
Protocols known to (supported by) create_pcap_listener().
Todo:
deal with pcap_set_timeout() call here.
Parameters
[in]devDevice name to listen on
[in]blockingTRUE if this is a blocking connection
[in]listenmaskBit mask of protocols to listen for (see list of valid bits)
[out]progCompiled PCAP program

Definition at line 65 of file pcap_min.c.

References _enable_mcast_address(), BINDDEBUG, close_pcap_listener(), DEBUGMSG1, and DIMOF.

Referenced by g_source_pcap_new().

Here is the call graph for this function:

Here is the caller graph for this function: