Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

Joe_Scialabba

@Joe_Scialabba
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Someone Please Help (WinPCap/TCP Capture)
    J Joe_Scialabba

    Hey guys, I can't seem to figure out my problem trying to print out the data to the tcp packet. Please, someone help me out.. I've been searching the internet, trying to find something in the Wireshark source, I'm lost and confused... If you want the full source, please say something. Thanks!

    typedef struct IP_Address
    {
    u_char byte1;
    u_char byte2;
    u_char byte3;
    u_char byte4;

    } ip_addr;
    typedef struct IPv4_Header
    {
    u_char ver_ihl;
    u_char tos;

    u\_short tlen;
    u\_short id;
    u\_short flags\_off;
    
    u\_char ttl;
    u\_char proto;
    u\_short crc;
    
    ip\_addr srcaddr;
    ip\_addr dstaddr;
    
    u\_int opt\_pad;
    

    } ipv4_hdr;
    typedef struct TCP_Header
    {
    u_short srcport;
    u_short dstport;

    u\_int seq;
    u\_int ack;
    
    u\_char offset;
    u\_char reserved;
    
    u\_short window;
    u\_short crc;
    
    u\_int opt\_pad;
    
    u\_char data\[65535\];
    

    } tcp_hdr;

        for (;;)
    {
    	CErr = pcap\_next\_ex(edev\_open, &pkt\_header, &pkt\_data);
    	
    	if (CErr == -1)
    	{
    		cout<< "Encountered an error while reading!\\n";
    
    		pcap\_close(edev\_open);
    		return 0;
    	}
    
    	switch (CErr)
    	{
    		case 0: /\* Timeout \*/
    		{
    			break;
    		}
    		case 1:
    		{
    			ih = (ipv4\_hdr\*) (pkt\_data + 14);
    			th = (tcp\_hdr\*) ( (u\_char\*)ih + ((ih->ver\_ihl & 0xF0) \* 4) );
    
    			break;
    		}
    		case -2: /\* EOF reached reading from offline capture \*/
    		{
    			cout<< "End of Dump File!\\n";
    			break;
    		}
    	}
    }
    
    C / C++ / MFC help algorithms
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups