Forgot to commit changes for control() support and some fixes.

Also added header for PPPoE support in ethernet module.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5115 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Waldemar Kornewald 2003-10-23 17:50:45 +00:00
parent 8055343f23
commit 7f015ac671
5 changed files with 40 additions and 6 deletions

View File

@ -18,6 +18,8 @@ struct core_module_info {
int (*start)(void);
int (*stop)(void);
status_t (*control_net_module)(const char *name, uint32 op, void *data,
size_t length);
void (*add_domain)(struct domain *, int);
void (*remove_domain)(int);
void (*add_protocol)(struct protosw *, int);

View File

@ -0,0 +1,22 @@
/*
ethernet_module.h
*/
#ifndef ETHERNET_MODULE_H
#define ETHERNET_MODULE_H
#include "net_module.h"
#include <KernelExport.h>
#define NET_ETHERNET_MODULE_NAME "network/interfaces/ethernet"
typedef void (*ethernet_receiver_func)(struct mbuf *buf);
struct ethernet_module_info {
struct kernel_net_module_info info;
void (*set_pppoe_receiver)(ethernet_receiver_func func);
void (*unset_pppoe_receiver)(void);
};
#endif /* ETHERNET_MODULE_H */

View File

@ -21,6 +21,7 @@ struct kernel_net_module_info {
module_info info;
int (*start)(void *);
int (*stop)(void);
status_t (*control)(uint32 op, void *data, size_t length);
};
struct net_module {

View File

@ -44,6 +44,8 @@ enum {
NET_STACK_NOTIFY_SOCKET_EVENT, // notify_socket_event_args * (userland stack only)
NET_STACK_CONTROL_NET_MODULE,
NET_STACK_IOCTL_MAX
};
@ -88,6 +90,13 @@ struct sysctl_args { // used by NET_STACK_SYSCTL
size_t newlen;
};
struct control_net_module_args { // used by NET_STACK_CONTROL_NET_MODULE
char *name;
uint32 op;
void *data;
size_t length;
};
/*
Userland stack driver on_socket_event() callback mecanism implementation:
the driver start a kernel thread waiting on a port for

View File

@ -11,10 +11,10 @@
struct mbuf;
struct sockbuf {
uint32 sb_cc; /* actual chars in buffer */
uint32 sb_hiwat; /* max actual char count (high water mark) */
uint32 sb_mbcnt; /* chars of mbufs used */
uint32 sb_mbmax; /* max chars of mbufs to use */
int32 sb_cc; /* actual chars in buffer */
int32 sb_hiwat; /* max actual char count (high water mark) */
int32 sb_mbcnt; /* chars of mbufs used */
int32 sb_mbmax; /* max chars of mbufs to use */
int32 sb_lowat; /* low water mark */
struct mbuf *sb_mb; /* the mbuf chain */
int16 sb_flags; /* flags, see below */
@ -101,8 +101,8 @@ struct socket {
}
#define sbspace(sb) \
((uint32) min((int)((sb)->sb_hiwat - (sb)->sb_cc), \
(int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
(abs(min((int)((sb)->sb_hiwat - (sb)->sb_cc), \
(int)((sb)->sb_mbmax - (sb)->sb_mbcnt))))
/* do we have to send all at once on a socket? */
#define sosendallatonce(so) \