Skip to contentSkip to conversation

difference between struct proto and struct proto_ops

DISCUSSION nawab 2 participants 2 messages Jan 25, 2015

lore
Share & tools
lore

nawab

author
#0 lore raw

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....

#1 lore raw

Hi!

Quoted 6 lines · nawab

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

Signature · 2 lines
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com