What members does struct udphdr(linux) have?

This is a discussion on What members does struct udphdr(linux) have? within the C Programming forums, part of the General Programming Boards category; hi I need to know the names and members of structs that represent TCP and UDP headers in linux.As far ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    21

    What members does struct udphdr(linux) have?

    hi

    I need to know the names and members of structs that represent TCP and UDP headers in linux.As far as I know,the following are names of header structures:
    -struct ip
    -struct udphdr
    -struct icmp

    I googled to see what members struct udphdr has and :
    struct udphdr {
    u_short uh_sport; /* src port */
    u_short uh_dport; /* dst port */
    short uh_ulen; /* udp length */
    u_short uh_sum; /* checksum */
    };

    But for some reason cc reports that struct udphdr doesn't contain any of those members.So what are the names of members in linux?


    Are there any alternatives to these structures(maybe struct iphdr or struct udp)?

    thank you

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >So what are the names of members in linux?
    The nice thing about Linux is that it comes with the complete source code. Grep the appropriate header in your source tree and you should have no trouble finding out what members the structure has. Alternatively, you can take the weenie way out and just use man.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    21
    When do I use struct udp and when struct udphdr(same question goes for for struct ip and struct iphdr)?
    Last edited by failure_to; 05-27-2004 at 01:21 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with linked list sorting function
    By Jaggid1x in forum C Programming
    Replies: 6
    Last Post: 06-02-2009, 02:14 AM
  2. Concatenating in linked list
    By drater in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 11:10 PM
  3. Replies: 16
    Last Post: 10-29-2006, 04:04 AM
  4. What's wrong with my search program?
    By sherwi in forum C Programming
    Replies: 5
    Last Post: 04-28-2006, 09:57 AM
  5. Function validation.
    By Fhl in forum C Programming
    Replies: 10
    Last Post: 02-22-2006, 07:18 AM

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