2006-08-08 17:07:07 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
|
|
|
|
* This file may be used under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef NET_STACK_DRIVER_H
|
|
|
|
#define NET_STACK_DRIVER_H
|
|
|
|
|
|
|
|
|
2006-12-19 05:06:07 +03:00
|
|
|
#include <net_stat.h>
|
2006-08-08 17:07:07 +04:00
|
|
|
|
|
|
|
#include <sys/select.h>
|
|
|
|
|
|
|
|
|
|
|
|
// Forward declaration
|
|
|
|
struct sockaddr;
|
|
|
|
|
2006-11-11 15:27:30 +03:00
|
|
|
#define NET_STACK_DRIVER_DEVICE "net/stack"
|
|
|
|
#define NET_STACK_DRIVER_PATH "/dev/" NET_STACK_DRIVER_DEVICE
|
2006-08-08 17:07:07 +04:00
|
|
|
|
|
|
|
enum {
|
|
|
|
NET_STACK_IOCTL_BASE = 8800,
|
|
|
|
NET_STACK_IOCTL_END = 8999,
|
|
|
|
|
|
|
|
// ops not acting on an existing socket
|
|
|
|
NET_STACK_SOCKET = NET_STACK_IOCTL_BASE, // socket_args *
|
2007-05-23 23:56:40 +04:00
|
|
|
NET_STACK_GET_COOKIE, // void **
|
2006-08-08 17:07:07 +04:00
|
|
|
NET_STACK_CONTROL_NET_MODULE, // control_net_module_args *
|
2006-12-19 05:06:07 +03:00
|
|
|
NET_STACK_GET_NEXT_STAT, // get_next_stat_args *
|
|
|
|
|
2006-08-08 17:07:07 +04:00
|
|
|
// ops acting on an existing socket
|
|
|
|
NET_STACK_BIND, // sockaddr_args *
|
2007-04-05 18:26:46 +04:00
|
|
|
NET_STACK_RECEIVE, // message_args *
|
|
|
|
NET_STACK_SEND, // message_args *
|
2006-08-08 17:07:07 +04:00
|
|
|
NET_STACK_LISTEN, // int_args * (value = backlog)
|
|
|
|
NET_STACK_ACCEPT, // sockaddr_args *
|
|
|
|
NET_STACK_CONNECT, // sockaddr_args *
|
|
|
|
NET_STACK_SHUTDOWN, // int_args * (value = how)
|
|
|
|
NET_STACK_GETSOCKOPT, // sockopt_args *
|
|
|
|
NET_STACK_SETSOCKOPT, // sockopt_args *
|
|
|
|
NET_STACK_GETSOCKNAME, // sockaddr_args *
|
|
|
|
NET_STACK_GETPEERNAME, // sockaddr_args *
|
|
|
|
NET_STACK_SOCKETPAIR, // socketpair_args *
|
2006-12-19 05:06:07 +03:00
|
|
|
|
2006-08-08 17:07:07 +04:00
|
|
|
NET_STACK_NOTIFY_SOCKET_EVENT, // notify_socket_event_args * (userland stack only)
|
2006-12-19 05:06:07 +03:00
|
|
|
|
2006-08-08 17:07:07 +04:00
|
|
|
NET_STACK_IOCTL_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sockaddr_args { // used by NET_STACK_CONNECT/_BIND/_GETSOCKNAME/_GETPEERNAME
|
|
|
|
struct sockaddr *address;
|
|
|
|
socklen_t address_length;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sockopt_args { // used by NET_STACK_SETSOCKOPT/_GETSOCKOPT
|
|
|
|
int level;
|
|
|
|
int option;
|
|
|
|
void *value;
|
|
|
|
int length;
|
|
|
|
};
|
|
|
|
|
2007-04-05 18:26:46 +04:00
|
|
|
struct message_args {
|
2007-04-04 21:39:43 +04:00
|
|
|
struct msghdr *header;
|
2007-04-05 18:26:46 +04:00
|
|
|
void *data;
|
|
|
|
size_t length;
|
2007-04-04 21:39:43 +04:00
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
|
2006-08-08 17:07:07 +04:00
|
|
|
struct socket_args { // used by NET_STACK_SOCKET
|
|
|
|
int family;
|
|
|
|
int type;
|
|
|
|
int protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct socketpair_args { // used by NET_STACK_SOCKETPAIR
|
2007-05-23 23:56:40 +04:00
|
|
|
int second_socket;
|
2006-08-08 17:07:07 +04:00
|
|
|
};
|
|
|
|
|
2007-05-23 23:56:40 +04:00
|
|
|
struct accept_args { // used by NET_STACK_ACCEPT
|
|
|
|
int accept_socket;
|
|
|
|
struct sockaddr *address;
|
|
|
|
socklen_t address_length;
|
2006-08-08 17:07:07 +04:00
|
|
|
};
|
|
|
|
|
2006-12-19 05:06:07 +03:00
|
|
|
struct get_next_stat_args { // used by NET_STACK_GET_NEXT_STAT
|
|
|
|
uint32 cookie;
|
|
|
|
int family;
|
|
|
|
struct net_stat stat;
|
2006-08-08 17:07:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct control_net_module_args { // used by NET_STACK_CONTROL_NET_MODULE
|
|
|
|
const char *name;
|
|
|
|
uint32 op;
|
|
|
|
void *data;
|
|
|
|
size_t length;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* NET_STACK_DRIVER_H */
|