I've got a TCP packet off the network and have put it into the tcphdr struct, which is defined as follows in netinet/tcp.h.
Getting the source and dest weren't much of an issue as I could use htons to get the port numbers. However, I couldn't get the right sequence and ack_sequence for it; I tried both htons and htonl. I'm using the ones displayed by Ethereal as reference and am trying to match those.
No luck yet getting the seq and ack_seq out of the struct