after many changes, the network stack can now be build
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1776 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
# define in_setpeeraddr core->in_setpeeraddr
|
||||
# define in_pcbnotify core->in_pcbnotify
|
||||
# define inetctlerrmap core->inetctlerrmap
|
||||
# define in_cksum core->in_cksum
|
||||
|
||||
# define ifa_ifwithdstaddr core->ifa_ifwithdstaddr
|
||||
# define ifa_ifwithaddr core->ifa_ifwithaddr
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
#ifndef OBOS_CORE_MODULE_H
|
||||
#define OBOS_CORE_MODULE_H
|
||||
|
||||
#include "sys/mbuf.h"
|
||||
#include "sys/protosw.h"
|
||||
#include "sys/socketvar.h"
|
||||
#include "netinet/in_pcb.h"
|
||||
#include "net/if.h"
|
||||
#include "net_timer.h"
|
||||
#include "net_module.h"
|
||||
#include <mbuf.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <netinet/in_pcb.h>
|
||||
#include <net/if.h>
|
||||
#include <net_timer.h>
|
||||
#include <net_module.h>
|
||||
|
||||
struct core_module_info {
|
||||
module_info module;
|
||||
@@ -79,6 +79,8 @@ struct core_module_info {
|
||||
uint16, struct in_addr, uint16,
|
||||
int, void (*)(struct inpcb *, int));
|
||||
int (*inetctlerrmap)(int);
|
||||
uint16 (*in_cksum)(struct mbuf *m, int len, int off);
|
||||
|
||||
|
||||
/* mbuf routines... */
|
||||
struct mbuf * (*m_gethdr)(int);
|
||||
@@ -128,8 +130,8 @@ struct core_module_info {
|
||||
struct in_ifaddr *(*get_primary_addr)(void);
|
||||
|
||||
/* socket functions - used by socket driver */
|
||||
int (*initsocket)(void **);
|
||||
int (*socreate)(int, void *, int, int);
|
||||
int (*initsocket)(struct socket **);
|
||||
int (*socreate)(int, struct socket *, int, int);
|
||||
int (*soclose)(void *);
|
||||
int (*sobind)(void *, caddr_t, int);
|
||||
int (*solisten)(void *, int);
|
||||
@@ -145,7 +147,7 @@ struct core_module_info {
|
||||
int (*set_socket_event_callback)(void *, socket_event_callback, void *, int);
|
||||
int (*sogetpeername)(void *, struct sockaddr *, int *);
|
||||
int (*sogetsockname)(void *, struct sockaddr *, int *);
|
||||
int (*soaccept)(void *, void **, void *, int *);
|
||||
int (*soaccept)(struct socket *s, struct socket **news, void *, int *);
|
||||
};
|
||||
|
||||
#ifdef _KERNEL_MODE
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
|
||||
#include "net_module.h"
|
||||
|
||||
#ifdef _KERNEL_
|
||||
#ifdef _KERNEL_MODE
|
||||
#include <KernelExport.h>
|
||||
#define ICMP_MODULE_PATH "network/protocol/icmp"
|
||||
#else /* _KERNEL_ */
|
||||
#else /* _KERNEL_MODE */
|
||||
#define ICMP_MODULE_PATH "modules/protocol/icmp"
|
||||
#endif /* _KERNEL_ */
|
||||
#endif /* _KERNEL_MODE */
|
||||
|
||||
struct icmp_module_info {
|
||||
struct kernel_net_module_info info;
|
||||
|
||||
#ifndef _KERNEL_
|
||||
#ifndef _KERNEL_MODE
|
||||
void (*set_core)(struct core_module_info *);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
|
||||
#include "net_module.h"
|
||||
|
||||
#ifdef _KERNEL_
|
||||
#ifdef _KERNEL_MODE
|
||||
#include <KernelExport.h>
|
||||
#define IPV4_MODULE_PATH "network/protocol/ipv4"
|
||||
#else /* _KERNEL_ */
|
||||
#else /* _KERNEL_MODE */
|
||||
#define IPV4_MODULE_PATH "modules/protocol/ipv4"
|
||||
#endif /* _KERNEL_ */
|
||||
#endif /* _KERNEL_MODE */
|
||||
|
||||
struct ipv4_module_info {
|
||||
struct kernel_net_module_info info;
|
||||
#ifndef _KERNEL_
|
||||
#ifndef _KERNEL_MODE
|
||||
void (*set_core)(struct core_module_info *);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ struct rw_lock {
|
||||
|
||||
typedef struct rw_lock rw_lock;
|
||||
|
||||
#ifndef _KERNEL_
|
||||
#ifndef _KERNEL_MODE
|
||||
#define INIT_BENAPHORE(lock,name) \
|
||||
{ \
|
||||
(lock).count = 1; \
|
||||
@@ -70,7 +70,7 @@ typedef struct rw_lock rw_lock;
|
||||
}
|
||||
|
||||
/* read/write lock */
|
||||
#ifndef _KERNEL_
|
||||
#ifndef _KERNEL_MODE
|
||||
#define INIT_RW_LOCK(lock,name) \
|
||||
{ \
|
||||
(lock).sem = create_sem(0, name); \
|
||||
|
||||
@@ -2,18 +2,16 @@
|
||||
* Miscellaneous networking stuff that doesn't yet have a home.
|
||||
*/
|
||||
|
||||
#ifdef _NETWORK_STACK
|
||||
|
||||
#include <kernel/OS.h>
|
||||
#include <ByteOrder.h>
|
||||
#include <Errors.h>
|
||||
|
||||
#include "sys/mbuf.h"
|
||||
//#ifdef _NETWORK_STACK
|
||||
|
||||
#ifndef OBOS_NET_MISC_H
|
||||
#define OBOS_NET_MISC_H
|
||||
|
||||
#ifdef _KERNEL_
|
||||
//#include <kernel/OS.h>
|
||||
#include <Errors.h>
|
||||
#include <mbuf.h>
|
||||
|
||||
#ifdef _KERNEL_MODE
|
||||
#include <KernelExport.h>
|
||||
#define printf dprintf
|
||||
#endif
|
||||
@@ -77,7 +75,8 @@ typedef uint32 ipv4_addr;
|
||||
*/
|
||||
|
||||
void net_server_add_device(ifnet *ifn);
|
||||
uint16 in_cksum(struct mbuf *m, int len, int off);
|
||||
//XXX already in netinet/in.h
|
||||
//uint16 in_cksum(struct mbuf *m, int len, int off);
|
||||
void local_init(void);
|
||||
|
||||
/* sockets and in_pcb init */
|
||||
@@ -98,5 +97,5 @@ void dump_sockaddr(void *ptr);
|
||||
|
||||
#endif /* OBOS_NET_MISC_H */
|
||||
|
||||
#endif /* _NETWORK_STACK */
|
||||
//#endif /* _NETWORK_STACK */
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <kernel/OS.h>
|
||||
#include <image.h>
|
||||
|
||||
#include "sys/mbuf.h"
|
||||
#include "mbuf.h"
|
||||
#include "net_misc.h"
|
||||
#include "sys/socketvar.h"
|
||||
#include "net/if.h"
|
||||
@@ -39,18 +39,19 @@ struct net_module {
|
||||
struct net_module *next;
|
||||
char *name;
|
||||
struct kernel_net_module_info *ptr;
|
||||
#ifndef _KERNEL_
|
||||
#ifndef _KERNEL_MODE
|
||||
image_id iid;
|
||||
#endif
|
||||
int status;
|
||||
};
|
||||
|
||||
enum {
|
||||
NET_LAYER1 = 1, /* link layer */
|
||||
NET_LAYER2, /* network layer */
|
||||
NET_LAYER3, /* transport layer */
|
||||
NET_LAYER4 /* socket layer */
|
||||
};
|
||||
|
||||
//XXX already in posix/sys/protosw.h
|
||||
//enum {
|
||||
// NET_LAYER1 = 1, /* link layer */
|
||||
// NET_LAYER2, /* network layer */
|
||||
// NET_LAYER3, /* transport layer */
|
||||
// NET_LAYER4 /* socket layer */
|
||||
//};
|
||||
|
||||
#endif /* OBOS_NET_MODULE_H */
|
||||
|
||||
|
||||
@@ -2,22 +2,23 @@
|
||||
#define _NET_SOCKET_H
|
||||
|
||||
#include <sys/socketvar.h>
|
||||
#include <mbuf.h>
|
||||
|
||||
uint32 sb_max;
|
||||
//uint32 sb_max;
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* These are the ones we export to libnet.so */
|
||||
|
||||
int initsocket(void **);
|
||||
int socreate (int, struct socket **, int, int);
|
||||
int initsocket(struct socket **);
|
||||
int socreate (int, struct socket *, int, int);//XXX
|
||||
int soshutdown(void *, int);
|
||||
int soclose (void *);
|
||||
|
||||
int sobind (void *, char *, int);
|
||||
int solisten (void *, int);
|
||||
int soconnect (void *, char *, int);
|
||||
int soaccept (void *, void **, void *, int *);
|
||||
int soaccept (struct socket *, struct socket **, void *, int *);
|
||||
|
||||
int writeit (void *, struct iovec *, int);
|
||||
int readit (void *, struct iovec *, int *);
|
||||
@@ -28,6 +29,7 @@ int recvit (void *, struct msghdr *, char *, int *);
|
||||
int sosysctl (int *, uint, void *, size_t *, void *, size_t);
|
||||
int sosetopt (void *, int, int, const void *, size_t);
|
||||
int sogetopt (void *, int, int, void *, size_t *);
|
||||
int soo_ioctl(void *sp, int cmd, caddr_t data);
|
||||
|
||||
int sogetpeername(void *, struct sockaddr *, int *);
|
||||
int sogetsockname(void *, struct sockaddr *, int *);
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
#include <sys/select.h>
|
||||
|
||||
#define NET_STACK_DRIVER_PATH "net/stack"
|
||||
#define NET_STACK_DRIVER_DEV "net/stack"
|
||||
#define NET_STACK_DRIVER_PATH "/dev/" ## NET_STACK_DRIVER_DEV
|
||||
|
||||
enum {
|
||||
// Paranoia mode: be far away of B_DEVICE_OP_CODES_END opcodes!!!
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "net_module.h"
|
||||
|
||||
#ifdef _KERNEL_
|
||||
#ifdef _KERNEL_MODE
|
||||
#include <KernelExport.h>
|
||||
#define RAW_MODULE_PATH "network/protocol/raw"
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user