error: ‘struct tcphdr’ has no member named ‘th_dport

This is a discussion on error: ‘struct tcphdr’ has no member named ‘th_dport within the C Programming forums, part of the General Programming Boards category; hello, i am getting this kind of error, though i declared my header file like this. so what i did ...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    Thumbs down error: ‘struct tcphdr’ has no member named ‘th_dport

    hello,
    i am getting this kind of error, though i declared my header file like this. so what i did mistake here.........

    PHP Code:
    error‘struct tcphdr’ has no member named ‘th_flags’
    error
    ‘struct tcphdr’ has no member named ‘th_flags’
    error
    ‘struct tcphdr’ has no member named ‘th_sport’
    error
    ‘struct tcphdr’ has no member named ‘th_dport’
    error
    ‘struct tcphdr’ has no member named ‘th_win’
    error
    ‘struct tcphdr’ has no member named ‘th_dport’
    error
    ‘struct tcphdr’ has no member named ‘th_sport’
    error
    ‘struct tcphdr’ has no member named ‘th_dport’
    error
    ‘struct tcphdr’ has no member named ‘th_seq’
    error
    ‘TCP_H’ undeclared (first use in this function)
    error: (Each undeclared identifier is reported only once
    error
    : for each function it appears in.)
    error‘IP_H’ undeclared (first use in this function)
    error‘struct tcphdr’ has no member named ‘th_seq’
    error
    ‘struct 
    This is the header file....

    Code:
    #include <libnet.h>
    #include <syslog.h>
    #include <errno.h>
    #define __FAVOR_BSD
    #include <netinet/tcp.h>
    Code:
    if((pkt.tcp.th_flags&TH_SYN)&&(!(pkt.tcp.th_flags&TH_ACK))) {
       /* Normal logging of SYN&!ACK packets... */
       src_addr.s_addr=0;
       src_addr.s_addr=pkt.ip.saddr;
       syslog(LOG_INFO, "TCP connection attempt from %s:%d to port %d.", inet_ntoa(src_addr), ntohs(pkt.tcp.th_sport), ntohs(pkt.tcp.th

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Check netinet/tcp.h and see whether struct tcphdr has those fields. (Apparently the answer is going to be no.)

    Edit: Wikipedia says that you also need #define __USE_BSD at the top of the file as well, if'n you have the Linux/BSD header.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  2. TCP Header problem (error)
    By nasim751 in forum C Programming
    Replies: 1
    Last Post: 04-25-2008, 08:30 AM
  3. Replies: 2
    Last Post: 04-22-2008, 01:07 PM
  4. Replies: 2
    Last Post: 04-19-2008, 01:06 AM
  5. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21