History log of /haiku/src/add-ons/kernel/network/stack/utility.h
Revision Date Author Comments
# 715fed44 05-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Make sure the SIOCGIFCONF never returns an address with an address length
smaller than sizeof(sockaddr). This fixes a compatibility issue with other
platforms - portable software often assumes that the amount of bytes to
add to an ifreq structure is the larger amount between sizeof(ifreq), and
basically what the _SIZEOF_ADDR_IFREQ() macro returns, instead of always
relying on that macro.
* Renamed UserBuffer::Copy() to Push, ConsumedAmount() to BytesConsumed(),
added Pad() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37927 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 491da20d 19-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a is_timer_running() function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27631 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8f3c0d9f 17-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* wait_for_timer() now returns a status code.
* wait_for_timer() now detects if it has been called from within the timer
execution thread, and will return in error instead of waiting for itself
forever. This fixes bug #2682.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27620 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e8be8bb 15-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a net_timer::flags field, and used it to implement the new
wait_for_timer() function.
* Moved the internal Fifo class into utility.cpp - we should probably just
remove it again.
* Fixed uninit_timers() so that it would even work in combination with the
timer thread if there are timers left to be scheduled.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26980 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b07b8e0 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75015ff5 11-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed THREAD_FLAGS_IOCTL_SYSCALL to THREAD_FLAGS_SYSCALL,
syscall_restart_ioctl_is_restarted() to syscall_restart_is_restarted,
IoctlSyscallFlagUnsetter to SyscallFlagUnsetter, and
IoctlSyscallRestartWrapper to SyscallRestartWrapper, as they are no
longer only used for ioctl().
* Removed unused syscall_restart_ioctl_handle_post().
* Made SyscallRestartWrapper a lot fancier. Instead of storing a
reference to the result value, it stores the value itself, and it
features all the interesting operators that make it appear like that
value. This simplifies the use of the class quite a bit.
* THREAD_FLAGS_SYSCALL is now set for all socket function and the
read[v](), write[v]() syscalls.
* Added is_syscall() function and net_stack hook to the net stack.
* Removed "kernel" parameter from all net_stack_interface and net_socket
module hooks. They aren't need any longer, since is_syscall() can be
used instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24914 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 05849428 17-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld + bonefish:
* Added syscall restart support for connect(), accept(), send(), recv(),
which are implemented via ioctl()s. The actual restart support is done
in the net stack driver's ioctl() hook. Lower layers need to correctly
deal with socket timeouts, though, for which the stack module provides
support functions.
* TCPEndpoint::_WaitForEstablished() does abort now when an error
occurred earlier, so that trying to connect to an unused port fails
immediately, as it should.
* Fixed and refactored TCP connection reset handling. The new
TCPEndpoint::_HandleReset() does the job. Got rid of
TCPEndpoint::fError.
* Fixed sequence numbers for SYNC/FINI packets.
* The former two fix the problem that connections wouldn't be closed
correctly and could even be reused when trying to connect again (as
was reproducible with svnserve + svn).
* Some style cleanup in CPEndpoint.h.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23984 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9261b129 08-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

packet capture sockets are now properly notified when the device is going down.

- modified LinkProtocol::ReadData() a bit so it can safely react to external changes such as the device being monitored going down.
- fixed an issue in invalidate_routes() where in some cases the default route was being kept.
- fixed another issue related with the fifo implementation, the notifier semaphore was being created with count of 1, instead of 0.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20622 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e53357d5 08-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

Prepared net_device_monitor to accept device removal events.

- Introduced public net_device_monitor.
- Changed the link protocol to maintain a lock per instance instead of inside the FIFO. Now all of the link instance data is protected.
- Adapted the link protocol to use net_device_monitor.
- Introduced a private Fifo class which doesn't maintain it's own lock.
- Maybe we should add something like a public net_protocol_implementation which maintains a fifo and a benaphore? With the fifo using the structure's lock instead of maintaining it's own.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20614 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0d5afa4d 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

introduced fifo_socket_enqueue_buffer which clones the buffer, enqueues it to the fifo and notifies the socket.

- changed the link, ipv4 and udp modules to use fifo_socket_enqueue_buffer


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20587 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 298a7da9 01-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

UserBuffer: generic userspace supplied buffer and copy management


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20501 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2bd388f6 29-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added two more utility functions to the timer service:
* cancel_timer() cancels a timer, and returns true if the timer was running
* is_timer_active() determines if the timer is currently running or not.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19393 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a7028ce6 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented select support for sockets and notifications, not yet tested, though;
this closes ticket #811.
* Added notification support to IPv4 and UDP.
* Implemented reading out SO_ERROR.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19017 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c22d69bf 08-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* Completed the previous commit and merger of the team/network/new_stack branch.
* Removed ppp_up and pppcontrol from the image for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18457 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 715fed4479b4711a1c0e44b5f1411509ce34f725 05-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Make sure the SIOCGIFCONF never returns an address with an address length
smaller than sizeof(sockaddr). This fixes a compatibility issue with other
platforms - portable software often assumes that the amount of bytes to
add to an ifreq structure is the larger amount between sizeof(ifreq), and
basically what the _SIZEOF_ADDR_IFREQ() macro returns, instead of always
relying on that macro.
* Renamed UserBuffer::Copy() to Push, ConsumedAmount() to BytesConsumed(),
added Pad() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37927 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 491da20dbf296d9fdf44ae5fffde54f254059f4d 19-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a is_timer_running() function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27631 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8f3c0d9fcc9be04b38f8a9fee6ff315d8710ef76 17-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* wait_for_timer() now returns a status code.
* wait_for_timer() now detects if it has been called from within the timer
execution thread, and will return in error instead of waiting for itself
forever. This fixes bug #2682.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27620 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e8be8bb9c7c2f02c2b109654c4bdab659654a82 15-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a net_timer::flags field, and used it to implement the new
wait_for_timer() function.
* Moved the internal Fifo class into utility.cpp - we should probably just
remove it again.
* Fixed uninit_timers() so that it would even work in combination with the
timer thread if there are timers left to be scheduled.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26980 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b07b8e0f1a7f1e76f31db24a21a42cbb01d7b9c 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75015ff525050d1d716f499732c566956c6078ad 11-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed THREAD_FLAGS_IOCTL_SYSCALL to THREAD_FLAGS_SYSCALL,
syscall_restart_ioctl_is_restarted() to syscall_restart_is_restarted,
IoctlSyscallFlagUnsetter to SyscallFlagUnsetter, and
IoctlSyscallRestartWrapper to SyscallRestartWrapper, as they are no
longer only used for ioctl().
* Removed unused syscall_restart_ioctl_handle_post().
* Made SyscallRestartWrapper a lot fancier. Instead of storing a
reference to the result value, it stores the value itself, and it
features all the interesting operators that make it appear like that
value. This simplifies the use of the class quite a bit.
* THREAD_FLAGS_SYSCALL is now set for all socket function and the
read[v](), write[v]() syscalls.
* Added is_syscall() function and net_stack hook to the net stack.
* Removed "kernel" parameter from all net_stack_interface and net_socket
module hooks. They aren't need any longer, since is_syscall() can be
used instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24914 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 058494285aafd433af5618aeb52abd76a4b39c6a 17-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld + bonefish:
* Added syscall restart support for connect(), accept(), send(), recv(),
which are implemented via ioctl()s. The actual restart support is done
in the net stack driver's ioctl() hook. Lower layers need to correctly
deal with socket timeouts, though, for which the stack module provides
support functions.
* TCPEndpoint::_WaitForEstablished() does abort now when an error
occurred earlier, so that trying to connect to an unused port fails
immediately, as it should.
* Fixed and refactored TCP connection reset handling. The new
TCPEndpoint::_HandleReset() does the job. Got rid of
TCPEndpoint::fError.
* Fixed sequence numbers for SYNC/FINI packets.
* The former two fix the problem that connections wouldn't be closed
correctly and could even be reused when trying to connect again (as
was reproducible with svnserve + svn).
* Some style cleanup in CPEndpoint.h.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23984 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9261b129886d285ddb488b27b608efb25c733e88 08-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

packet capture sockets are now properly notified when the device is going down.

- modified LinkProtocol::ReadData() a bit so it can safely react to external changes such as the device being monitored going down.
- fixed an issue in invalidate_routes() where in some cases the default route was being kept.
- fixed another issue related with the fifo implementation, the notifier semaphore was being created with count of 1, instead of 0.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20622 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e53357d57adc145e4c36a3dc35cecde8bea07297 08-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

Prepared net_device_monitor to accept device removal events.

- Introduced public net_device_monitor.
- Changed the link protocol to maintain a lock per instance instead of inside the FIFO. Now all of the link instance data is protected.
- Adapted the link protocol to use net_device_monitor.
- Introduced a private Fifo class which doesn't maintain it's own lock.
- Maybe we should add something like a public net_protocol_implementation which maintains a fifo and a benaphore? With the fifo using the structure's lock instead of maintaining it's own.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20614 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0d5afa4decb83fc03232a420d85c7838f70d2266 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

introduced fifo_socket_enqueue_buffer which clones the buffer, enqueues it to the fifo and notifies the socket.

- changed the link, ipv4 and udp modules to use fifo_socket_enqueue_buffer


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20587 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 298a7da920f65afaf04ab49341a19388bedfa4a4 01-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

UserBuffer: generic userspace supplied buffer and copy management


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20501 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2bd388f69679fcc496cb2c376d7ec5ec20be6f72 29-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added two more utility functions to the timer service:
* cancel_timer() cancels a timer, and returns true if the timer was running
* is_timer_active() determines if the timer is currently running or not.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19393 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a7028ce6802b20c7fea03c8b4defa0770a50b850 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented select support for sockets and notifications, not yet tested, though;
this closes ticket #811.
* Added notification support to IPv4 and UDP.
* Implemented reading out SO_ERROR.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19017 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c22d69bf1f5f60f7ebddd79108a53c8f97f300fe 08-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* Completed the previous commit and merger of the team/network/new_stack branch.
* Removed ppp_up and pppcontrol from the image for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18457 a95241bf-73f2-0310-859d-f6bbb57e9c96