~ubuntu-branches/ubuntu/karmic/xprobe/karmic

« back to all changes in this revision

Viewing changes to libs-external/USI++/samples/synping.cc

  • Committer: Bazaar Package Importer
  • Author(s): Richard Atterer
  • Date: 2005-02-22 22:54:24 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050222225424-6cqy8rr45pkna819
Tags: 0.2.2-1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <iostream>
 
2
#include <stdio.h>
 
3
#include <errno.h>
 
4
#include <stdlib.h>
 
5
#include <string.h>
 
6
#include <unistd.h>
 
7
#include <usi++/usi++.h>
 
8
 
 
9
 
 
10
int main(int argc, char **argv)
 
11
{
 
12
        char buf[100];
 
13
        
 
14
        if (argc < 3) {
 
15
                cout<<"Usage: "<<argv[0]<<" host port\n";
 
16
                exit(1);
 
17
        }
 
18
        TCP *tmp = new TCP(argv[1]);
 
19
 
 
20
        TCP tcp("0");
 
21
 
 
22
        tcp = *tmp;     // test for operator=()
 
23
 
 
24
        delete tmp;
 
25
        tcp.init_device("eth0", 1, 100);
 
26
        tcp.setfilter("tcp and dst port 8000");
 
27
 
 
28
        tcp.set_flags(TH_SYN|TH_ACK);
 
29
        tcp.set_dstport(atoi(argv[2]));
 
30
        tcp.set_srcport(8000);
 
31
 
 
32
 
 
33
        tcp.set_src("192.0.0.1");
 
34
        
 
35
        tcp.sendpack("");
 
36
        tcp.sniffpack(buf, 100);
 
37
        cout<<tcp.get_id();
 
38
                        
 
39
        return 0;
 
40
}