network stack: getsockopt/setsockopt are no longer optional for protocols, as suggested by Axel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21085 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6386c723a5
commit
45b5203b78
@ -129,6 +129,24 @@ icmp_control(net_protocol *protocol, int level, int option, void *value,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
icmp_getsockopt(net_protocol *protocol, int level, int option,
|
||||
void *value, int *length)
|
||||
{
|
||||
return protocol->next->module->getsockopt(protocol->next, level, option,
|
||||
value, length);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
icmp_setsockopt(net_protocol *protocol, int level, int option,
|
||||
const void *value, int length)
|
||||
{
|
||||
return protocol->next->module->setsockopt(protocol->next, level, option,
|
||||
value, length);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
icmp_bind(net_protocol *protocol, const struct sockaddr *address)
|
||||
{
|
||||
@ -330,8 +348,8 @@ net_protocol_module_info sICMPModule = {
|
||||
icmp_connect,
|
||||
icmp_accept,
|
||||
icmp_control,
|
||||
NULL, // getsockopt
|
||||
NULL, // setsockopt
|
||||
icmp_getsockopt,
|
||||
icmp_setsockopt,
|
||||
icmp_bind,
|
||||
icmp_unbind,
|
||||
icmp_listen,
|
||||
|
@ -1021,6 +1021,24 @@ udp_control(net_protocol *protocol, int level, int option, void *value,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
udp_getsockopt(net_protocol *protocol, int level, int option, void *value,
|
||||
int *length)
|
||||
{
|
||||
return protocol->next->module->getsockopt(protocol->next, level, option,
|
||||
value, length);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
udp_setsockopt(net_protocol *protocol, int level, int option,
|
||||
const void *value, int length)
|
||||
{
|
||||
return protocol->next->module->setsockopt(protocol->next, level, option,
|
||||
value, length);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
udp_bind(net_protocol *protocol, const struct sockaddr *address)
|
||||
{
|
||||
@ -1218,8 +1236,8 @@ net_protocol_module_info sUDPModule = {
|
||||
udp_connect,
|
||||
udp_accept,
|
||||
udp_control,
|
||||
NULL, // getsockopt
|
||||
NULL, // setsockopt
|
||||
udp_getsockopt,
|
||||
udp_setsockopt,
|
||||
udp_bind,
|
||||
udp_unbind,
|
||||
udp_listen,
|
||||
|
@ -319,6 +319,24 @@ link_control(net_protocol *_protocol, int level, int option, void *value,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
link_getsockopt(net_protocol *protocol, int level, int option, void *value,
|
||||
int *length)
|
||||
{
|
||||
return protocol->next->module->getsockopt(protocol, level, option,
|
||||
value, length);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
link_setsockopt(net_protocol *protocol, int level, int option,
|
||||
const void *value, int length)
|
||||
{
|
||||
return protocol->next->module->setsockopt(protocol, level, option,
|
||||
value, length);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
link_bind(net_protocol *protocol, const struct sockaddr *address)
|
||||
{
|
||||
@ -467,8 +485,8 @@ net_protocol_module_info gLinkModule = {
|
||||
link_connect,
|
||||
link_accept,
|
||||
link_control,
|
||||
NULL, // getsockopt
|
||||
NULL, // setsockopt
|
||||
link_getsockopt,
|
||||
link_setsockopt,
|
||||
link_bind,
|
||||
link_unbind,
|
||||
link_listen,
|
||||
|
@ -751,14 +751,8 @@ int
|
||||
socket_getsockopt(net_socket *socket, int level, int option, void *value,
|
||||
int *_length)
|
||||
{
|
||||
for (net_protocol *protocol = socket->first_protocol;
|
||||
protocol; protocol = protocol->next) {
|
||||
if (protocol->module->getsockopt)
|
||||
return protocol->module->getsockopt(protocol, level, option,
|
||||
value, _length);
|
||||
}
|
||||
|
||||
return socket_get_option(socket, level, option, value, _length);
|
||||
return socket->first_protocol->module->getsockopt(socket->first_protocol,
|
||||
level, option, value, _length);
|
||||
}
|
||||
|
||||
|
||||
@ -1069,14 +1063,8 @@ int
|
||||
socket_setsockopt(net_socket *socket, int level, int option, const void *value,
|
||||
int length)
|
||||
{
|
||||
for (net_protocol *protocol = socket->first_protocol;
|
||||
protocol; protocol = protocol->next) {
|
||||
if (protocol->module->setsockopt)
|
||||
return protocol->module->setsockopt(protocol, level, option,
|
||||
value, length);
|
||||
}
|
||||
|
||||
return socket_set_option(socket, level, option, value, length);
|
||||
return socket->first_protocol->module->setsockopt(socket->first_protocol,
|
||||
level, option, value, length);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user