Network-Music
0.1
An audible representation of network traffic
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Macros
Pages
packetcapturer.h
Go to the documentation of this file.
1
#ifndef PACKETCAPTURER_H
2
#define PACKETCAPTURER_H
3
4
#include <QObject>
5
#include <pcap.h>
6
7
#include <sys/socket.h>
8
#include <netinet/in.h>
9
#include <netinet/ip.h>
10
#include <netinet/ether.h>
11
#include <net/ethernet.h>
12
#include <arpa/inet.h>
13
14
class
PacketCapturer
:
public
QObject
15
{
16
Q_OBJECT
17
public
:
18
explicit
PacketCapturer
(QObject *
parent
= 0);
19
PacketCapturer
(
const
char
* deviceName);
20
void
ChangeEmitter
(
int
value,
int
often);
21
~PacketCapturer
();
22
23
private
:
24
pcap_t *handle;
/* Session handle */
25
char
*dev;
/* The device to sniff on */
26
char
errbuf[PCAP_ERRBUF_SIZE];
/* Error string */
27
struct
bpf_program fp;
/* The compiled filter */
28
//char* filter_exp; /* The filter expression */
29
bpf_u_int32 mask;
/* Our netmask */
30
bpf_u_int32 net;
/* Our IP */
31
struct
pcap_pkthdr header;
/* The header that pcap gives us */
32
const
u_char *packet;
/* The actual packet */
33
34
35
/* ethernet headers are always exactly 14 bytes */
36
#define SIZE_ETHERNET 14
37
38
signals:
39
void
SIG_NEW_TONE
(
int
,
int
);
40
41
public
slots:
42
void
SLOT_CAPTURE
();
43
};
44
45
#endif // PACKETCAPTURER_H
Network-Music
packetcapturer.h
Generated on Wed Apr 29 2015 17:40:05 for Network-Music by
1.8.1.2