difference between struct proto and struct proto_ops

michi1 at michaelblizek.twilightparadox.com michi1 at michaelblizek.twilightparadox.com
Sun Jan 25 05:19:45 EST 2015


Hi!

On 10:39 Sun 25 Jan     , nawab wrote:
> 
> 
> What is the difference between struct proto and struct proto_ops : Both 
> are having the same functions:setsockopt,getsockopt,bind,connect etc...
> 
> So which functions are called when we call connect ,bind from userspace....

The entry point from userspace is net/socket.c . The functions which are
called is those from "struct proto_ops".

Both "struct sock" and "struct proto" look pretty weird to me too. It seems
that they are meant to be tools which make implementing protocols easier,
but they are sometimes required by upper layers. Take a look at e.g.
sock_getsockopt().

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com



More information about the Kernelnewbies mailing list