Hi!
On 15:02 Mon 11 Jan , Kapuddi wrote:
> In funciton:
>
> static int tcp_v4_init_sock(struct sock *sk)
> {
> struct inet_connection_sock *icsk = inet_csk(sk);
> struct tcp_sock *tp = tcp_sk(sk);
>
> ...
> }
>
> Why can struct sock convert to struct tcp_sock?
Because struct tcp_sock contains struct sock as the first member:
struct tcp_sock {
struct inet_connection_sock inet_conn;
...
};
struct inet_connection_sock {
struct inet_sock icsk_inet;
...
};
struct inet_sock {
struct sock sk;
...
};
-Michi
--
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ