* Added TCPEndpoint::GetOption(), currently only supports TCP_NODELAY, and
TCP_MAXSEG. * Note, TCP_MAXSEG cannot be set yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25241 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -905,6 +905,32 @@ TCPEndpoint::SetReceiveBufferSize(size_t length)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TCPEndpoint::GetOption(int option, void* _value, int* _length)
|
||||
{
|
||||
if (*_length != sizeof(int))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
int* value = (int*)_value;
|
||||
|
||||
switch (option) {
|
||||
case TCP_NODELAY:
|
||||
if ((fOptions & TCP_NODELAY) != 0)
|
||||
*value = 1;
|
||||
else
|
||||
*value = 0;
|
||||
return B_OK;
|
||||
|
||||
case TCP_MAXSEG:
|
||||
*value = fReceiveMaxSegmentSize;
|
||||
return B_OK;
|
||||
|
||||
default:
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TCPEndpoint::SetOption(int option, const void* _value, int length)
|
||||
{
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
status_t SetSendBufferSize(size_t length);
|
||||
status_t SetReceiveBufferSize(size_t length);
|
||||
|
||||
status_t GetOption(int option, void* value, int* _length);
|
||||
status_t SetOption(int option, const void* value, int length);
|
||||
|
||||
tcp_state State() const { return fState; }
|
||||
|
||||
@@ -507,7 +507,9 @@ tcp_getsockopt(net_protocol *_protocol, int level, int option, void *value,
|
||||
{
|
||||
TCPEndpoint *protocol = (TCPEndpoint *)_protocol;
|
||||
|
||||
/* TODO getting IPPROTO_TCP options is missing */
|
||||
if (level == IPPROTO_TCP)
|
||||
return protocol->GetOption(option, value, _length);
|
||||
|
||||
return protocol->next->module->getsockopt(protocol->next, level, option,
|
||||
value, _length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user