- The net_stack driver is no longer used. Instead we have a kernel
module which is directly used by syscall implementations in the
kernel. I.e. we no longer tunnel those functions through ioctls, but
have normal syscalls.
- Removed the superfluous net starter module.
- Implemented the FDTYPE_SOCKET type file_descriptors, that is sockets
are no longer vnode based.
- Adjusted libnetwork (the socket function implementations)
accordingly.
- Adjusted netstat accordingly.
* Socket module:
- Implemented socketpair().
- Added "kernel" parameter to the control hook. Quite a few more hooks
would actually need the parameter, but I didn't change those yet,
since that would probably also require changes to the protocol
module interface.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24908 a95241bf-73f2-0310-859d-f6bbb57e9c96
84 lines
2.8 KiB
C
84 lines
2.8 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, bool kernel);
|
|
status_t (*shutdown)(net_socket* socket, int how);
|
|
status_t (*connect)(net_socket* socket, const struct sockaddr* address,
|
|
socklen_t addressLength, bool kernel);
|
|
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,
|
|
bool kernel);
|
|
ssize_t (*recvfrom)(net_socket* socket, void* data, size_t length,
|
|
int flags, struct sockaddr* address,
|
|
socklen_t* _addressLength, bool kernel);
|
|
ssize_t (*recvmsg)(net_socket* socket, struct msghdr* message, int flags,
|
|
bool kernel);
|
|
|
|
ssize_t (*send)(net_socket* socket, const void* data, size_t length,
|
|
int flags, bool kernel);
|
|
ssize_t (*sendto)(net_socket* socket, const void* data, size_t length,
|
|
int flags, const struct sockaddr* address,
|
|
socklen_t addressLength, bool kernel);
|
|
ssize_t (*sendmsg)(net_socket* socket, const struct msghdr* message,
|
|
int flags, bool kernel);
|
|
|
|
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, bool kernel);
|
|
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
|