Hello list,
I've got a quick question:
I'm trying to compile the following code, and am getting these errors; any help 
would be awesome.
#include <pcap.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include <iostream>

void capture(u_char *args,const struct pcap_pkthdr *header,const u_char 
*packet);

//structure definitions:
#define ETHER_ADDR_LEN 6
typedef struct {
u_char dest[ETHER_ADDR_LEN];
u_char source [ETHER_ADDR_LEN];
u_short protocol;
} ether_header;
typedef struct {
u_char version;
u_char tos;
u_short len;
u_short id;
u_short offset;
#define ip_rf 0x8000;
#define ip_df 0x4000;
#define ip_mf 0x2000;
#define offmask 0x1fff;
u_char ttl;
u_char protocol;
u_short checksum;
  struct in_addr ip_src,ip_dst; /* source and dest address */
} ip_header;
 #define IP_HL(ip)  (((ip)->version) & 0x0f)
 #define IP_V(ip)  (((ip)->version) >> 4)
typedef struct {
u_short sport;
u_short dport;
tcp_seq seq;
tcp_seq ack;
u_char offset;
 #define TH_OFF(th) (((th)->offset & 0xf0) >> 4)
u_char flags;
#define fin 0x01
#define syn 0x02
#define rsd 0x04
#define push 0x08
#define ack 0x10
#define urg 0x20
#define ece 0x40
#define cwr 0x80
#define FLAGS (fin,syn|rst|ack|urg|ece|cwr)
u_short window;
u_short checksum;
u_short urp;
} tcp_header;

using namespace std;

int main(int argc,char **argv)
{
char errbuf[PCAP_ERRBUF_SIZE];
char * dev;
char filter[]="port 8888";
struct bpf_program fret;
bpf_u_int32 netmask,ip;
dev=pcap_lookupdev(errbuf);
if (dev==NULL)
{
cout << "Couldn't determine your device." << endl;
return 1;
}
cout << "listening on " << dev << endl;
if (pcap_lookupnet(dev,&netmask,&ip,errbuf)==-1)
{
cout << "Couldn't determine your netmask and device IP." << endl;
return 1;
}
cout << "Found netmask: " << netmask << " and listening with IP of: " << ip << 
endl;
pcap_t *handle;
handle=pcap_open_live(dev,500,1,500,errbuf);
if (handle==NULL)
{
cout << "Couldn't open your device." << endl;
return 1;
}
if (pcap_compile(handle,&fret,filter,1,netmask)==-1)
{
cout << "Couldn't insert filter." << endl;
return 1;
}
pcap_setfilter(handle,&fret);
cout << "ip_header: " << sizeof(ip_header) << endl;
cout << "tcp_header: " << sizeof(tcp_header) << endl;
pcap_loop(handle,-1,capture,NULL);

return 0;
}

void capture(u_char *args,const struct pcap_pkthdr *header,const u_char *packet)
{
return;
} 
//errors:
dev.cpp:39: error: â?~tcp_seqâ?T does not name a type
dev.cpp:40: error: â?~tcp_seqâ?T does not name a type 
I'm not really sure what to use here, as this is what the tutorial told me to 
do.

Thanks,
_|_|_|_|_|  _|        _|_|_|_|            
    _|      _|_|_|    _|          _|_|_|  
    _|      _|    _|  _|_|_|    _|        
    _|      _|    _|  _|        _|        
    _|      _|    _|  _|_|_|_|    _|_|_|  
Visit TDS for quality software and website production
http://tysdomain.com
msn: [EMAIL PROTECTED]
aim: st8amnd2005
skype: st8amnd127

[Non-text portions of this message have been removed]

Reply via email to