Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Aug 2002 15:55:42 +0430
From:      "soheil h" <soheil_h_y@hotmail.com>
To:        freebsd-net@FreeBSD.ORG
Message-ID:  <F268jQ8vjqueolj8Jec0000d5e0@hotmail.com>

next in thread | raw e-mail | index | archive | help
Hi list

which of these cast is true for accessing the tcphdr outof the 'struct mbuf'
in the ip_input function of ip_input.c ?
struct mbuf m;
struct ip * ip = mtod(m, ip);
int iphlen;
struct tcpShdr* th; /* it is a copy of the tcphdr struct i made the 
definition is type at the bottom*/

hlen = IP_VHL_HL(ip->ip_vhl) < 2;
1. th = (struct tcpShdr *)(ip + 1);
2. th = (struct tcpShdr *)((caddr_t)ip + hlen);

PLEASE HELP ME
I THINK THE SECOND ONE IS TRUE BUT IT DOESN' Work .

struct tcpShdr {
	u_short	th_sport;		/* source port */
	u_short	th_dport;		/* destination port */
	tcpS_seq th_seq;			/* sequence number */
	tcpS_seq	th_ack;			/* acknowledgement number */
	u_short th_soheil;
	u_short	th_win;			/* window */
	u_short	th_sum;			/* checksum */
	u_short	th_urp;			/* urgent pointer */
};



_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F268jQ8vjqueolj8Jec0000d5e0>