Find the answer to your Linux question:
Results 1 to 3 of 3
I am writing a module for tcptrace. In that module I need to process payload. TCPTRACE _read function passes struct ip *pip /* the packet */ as an argument. how ...
  1. #1
    Just Joined!
    Join Date
    Feb 2007
    Posts
    31

    how to extract payload from struct ip *pip

    I am writing a module for tcptrace. In that module I need to process payload. TCPTRACE _read function passes
    struct ip *pip /* the packet */
    as an argument.

    how I can extract payload by using struct ip pointer.

  2. #2
    Just Joined! raj.aprilfool's Avatar
    Join Date
    Dec 2006
    Location
    Mumbai, India
    Posts
    35
    ip datagram = ip header + data,
    hence, u can do as following,

    int iphlen = (pip->ip_hl) * 4;
    const char *ippkt = (char *) pip;
    const char *tcppkt = ippkt + iphlen;

    struct tcphdr *thdr = (struct tcphdr *) tcppkt;........ and so on

  3. #3
    Just Joined!
    Join Date
    Feb 2007
    Posts
    31
    thanks ...it is really helpful

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...