haiku/headers/private/net/net_stack_interface.h
Ingo Weinhold 75015ff525 * 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
2008-04-11 16:13:47 +00:00

82 lines
2.7 KiB
C

/*
* Copyright 2008, Haiku, Inc. All Rights Reserved.
* This file may be used under the terms of the MIT License.
*/
#ifndef NET_STACK_INTERFACE_H
#define NET_STACK_INTERFACE_H
#include <sys/socket.h>
// name of the kernel stack interface
#define NET_STACK_INTERFACE_MODULE_NAME "network/stack/kernel_interface/v1"
// name of the userland stack interface
#define NET_STACK_USERLAND_INTERFACE_MODULE_NAME \
"network/stack/userland_interface/v1"
struct net_socket;
struct net_stat;
struct net_stack_interface_module_info {
module_info info;
status_t (*open)(int family, int type, int protocol, net_socket** _socket);
status_t (*close)(net_socket* socket);
status_t (*free)(net_socket* socket);
status_t (*bind)(net_socket* socket, const struct sockaddr* address,
socklen_t addressLength);
status_t (*shutdown)(net_socket* socket, int how);
status_t (*connect)(net_socket* socket, const struct sockaddr* address,
socklen_t addressLength);
status_t (*listen)(net_socket* socket, int backlog);
status_t (*accept)(net_socket* socket, struct sockaddr* address,
socklen_t* _addressLength, net_socket** _acceptedSocket);
ssize_t (*recv)(net_socket* socket, void* data, size_t length, int flags);
ssize_t (*recvfrom)(net_socket* socket, void* data, size_t length,
int flags, struct sockaddr* address,
socklen_t* _addressLength);
ssize_t (*recvmsg)(net_socket* socket, struct msghdr* message, int flags);
ssize_t (*send)(net_socket* socket, const void* data, size_t length,
int flags);
ssize_t (*sendto)(net_socket* socket, const void* data, size_t length,
int flags, const struct sockaddr* address,
socklen_t addressLength);
ssize_t (*sendmsg)(net_socket* socket, const struct msghdr* message,
int flags);
status_t (*getsockopt)(net_socket* socket, int level, int option,
void* value, socklen_t* _length);
status_t (*setsockopt)(net_socket* socket, int level, int option,
const void* value, socklen_t length);
status_t (*getpeername)(net_socket* socket, struct sockaddr* address,
socklen_t* _addressLength);
status_t (*getsockname)(net_socket* socket, struct sockaddr* address,
socklen_t* _addressLength);
int (*sockatmark)(net_socket* socket);
status_t (*socketpair)(int family, int type, int protocol,
net_socket* _sockets[2]);
status_t (*ioctl)(net_socket* socket, uint32 op, void *buffer,
size_t length);
status_t (*select)(net_socket* socket, uint8 event,
struct selectsync *sync);
status_t (*deselect)(net_socket* socket, uint8 event,
struct selectsync *sync);
status_t (*get_next_socket_stat)(int family, uint32 *cookie,
struct net_stat *stat);
};
#endif // NET_STACK_INTERFACE_H