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:
@@ -1,319 +0,0 @@
|
||||
/* mbuf.h
|
||||
* network buffer definitions
|
||||
*
|
||||
* Based on BSD's mbuf principal.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OBOS_MBUF_H
|
||||
#define OBOS_MBUF_H
|
||||
|
||||
#include <pools.h>
|
||||
|
||||
/* MBuf's are all of a single size, MSIZE bytes. If we have more data
|
||||
* than can be fitted we can add a single "MBuf cluster" which is of
|
||||
* fixed size MCLBYTES.
|
||||
* If the data to be written is larger than MCLMINBYTES bytes we won't use
|
||||
* the storage provided within the MBuf, but rather all data will go
|
||||
* directly into an added cluster.
|
||||
*/
|
||||
|
||||
#define MSIZE 256 /* total size of structure */
|
||||
#define MCLSHIFT 11
|
||||
#define MCLBYTES (1 << MCLSHIFT)
|
||||
|
||||
#define MCLMAXBYTES 2048 /* they can't be bigger than 2k */
|
||||
#define MLEN (MSIZE - sizeof(struct m_hdr)) /* data length w/o a pkt_hdr */
|
||||
#define MHLEN (MLEN - sizeof(struct pkt_hdr)) /* data length w/pkt_hdr */
|
||||
#define CLLEN (MCLBYTES - sizeof(struct cl_hdr))
|
||||
|
||||
#define MINCLSIZE (MHLEN + 1)
|
||||
|
||||
/* mbuf header structure
|
||||
* This appears at teh start of every MBuf
|
||||
*/
|
||||
struct m_hdr {
|
||||
struct mbuf *m_next; /* next mbuf in a chain */
|
||||
struct mbuf *m_nxtpkt; /* next chain in a packet/queue */
|
||||
char * m_data; /* pointer to data */
|
||||
uint32 m_len; /* length data in this mbuf NB NOT total length */
|
||||
uint16 m_type; /* what sort of data do we have ? */
|
||||
uint16 m_flags; /* flags as defined below */
|
||||
uint16 m_cksum; /* flags about the checksum on the packet */
|
||||
};
|
||||
|
||||
/* pkt_hdr
|
||||
* This is ONLY found in the first MBuf in a chain and is valid
|
||||
* ONLY if we have the M_PKTHDR flag is set
|
||||
*/
|
||||
/* XXX - we also need to record things like the interface and also maintain
|
||||
* a list of the packets associated with this message here.
|
||||
*/
|
||||
struct pkt_hdr {
|
||||
struct ifnet *rcvif; /* interface we came it on */
|
||||
int len; /* total length */
|
||||
int csum; /* hardware cksum info... */
|
||||
};
|
||||
|
||||
/* m_ext
|
||||
* External storage, i.e. a cluster
|
||||
*/
|
||||
struct m_ext {
|
||||
char *ext_buf; /* start of the buffer */
|
||||
// void *(ext_free)(); /* free routine (if not standard) */
|
||||
uint ext_size; /* how big is the buffer */
|
||||
};
|
||||
|
||||
/* struct mbuf
|
||||
* The actual buffer structure.
|
||||
* This is defined as unions as the size is slightly variable
|
||||
* depending on the options set.
|
||||
*/
|
||||
|
||||
struct mbuf {
|
||||
struct m_hdr m_hdr;
|
||||
union {
|
||||
struct {
|
||||
struct pkt_hdr MH_pkthdr;
|
||||
union {
|
||||
struct m_ext MH_ext;
|
||||
char MH_databuf[MHLEN];
|
||||
} MH_dat;
|
||||
} MH;
|
||||
char m_databuf[MLEN];
|
||||
} um_dat;
|
||||
};
|
||||
|
||||
/* these are simply shortcuts... */
|
||||
#define m_next m_hdr.m_next
|
||||
#define m_len m_hdr.m_len
|
||||
#define m_data m_hdr.m_data
|
||||
#define m_type m_hdr.m_type
|
||||
#define m_flags m_hdr.m_flags
|
||||
#define m_cksum m_hdr.m_cksum
|
||||
#define m_nextpkt m_hdr.m_nxtpkt
|
||||
#define m_ext um_dat.MH.MH_dat.MH_ext
|
||||
#define m_pktdat um_dat.MH.MH_dat.MH_databuf
|
||||
#define m_pkthdr um_dat.MH.MH_pkthdr
|
||||
#define m_dat um_dat.m_databuf
|
||||
|
||||
/* define a little macro that gives us the data pointer for an mbuf */
|
||||
#define mtod(m, t) ((t)((m)->m_data))
|
||||
#define dtom(x) ((struct mbuf *)((int)(x) & ~(MSIZE-1)))
|
||||
|
||||
/* mbuf flags */
|
||||
enum {
|
||||
M_EXT = 0x0001, /* has extenal storage attached */
|
||||
M_PKTHDR = 0x0002, /* contains the packet header */
|
||||
M_EOR = 0x0004, /* end of record (not used for tcp/udp) */
|
||||
M_CLUSTER = 0x0008, /* external storage is a cluster */
|
||||
/*
|
||||
M_PROTO = 0x0010, * protocol specific *
|
||||
*/
|
||||
M_BCAST = 0x0100, /* rx/tx as a link-level broadcast */
|
||||
M_MCAST = 0x0200, /* rx/tx as a link-level multicast */
|
||||
M_CONF = 0x0400, /* packet was encrypted?? */
|
||||
M_AUTH = 0x0800, /* packet was authenticated */
|
||||
M_COMP = 0x1000, /* packet was compressed */
|
||||
M_ANYCAST6 = 0x4000 /* it was an IPv6 anycast packet */
|
||||
};
|
||||
/* the M_COPYFLAGS lists the flags that can be copied when we copy
|
||||
* an mbuf with the M_PKTHDR flag set */
|
||||
#define M_COPYFLAGS (M_PKTHDR | M_EOR | M_BCAST | M_MCAST)
|
||||
|
||||
/* checksum flags */
|
||||
enum {
|
||||
M_IPV4_CSUM_OUT = 0x0001, /* ipv4 checksum required */
|
||||
M_TCPV4_CSUM_OUT = 0x0002, /* TCP v4 checksum required */
|
||||
M_UDPV4_CSUM_OUT = 0x0004,
|
||||
|
||||
M_IPV4_CSUM_IN_OK = 0x0008,
|
||||
M_IPV4_CSUM_IN_OUT = 0x0010,
|
||||
|
||||
M_TCP_CSUM_IN_OK = 0x0020,
|
||||
M_TCP_CSUM_IN_BAD = 0x0040,
|
||||
|
||||
M_UDP_CSUM_IN_OK = 0x0080,
|
||||
M_UDP_CSUM_IN_BAD = 0x0100
|
||||
};
|
||||
|
||||
/* MBuf types */
|
||||
enum {
|
||||
MT_FREE = 0, /* should be on free list */
|
||||
MT_DATA = 1, /* dynamic data allocation */
|
||||
MT_HEADER = 2, /* packet header */
|
||||
MT_SONAME = 3,
|
||||
MT_SOOPTS = 4,
|
||||
MT_FTABLE = 5, /* fragment reassembly header */
|
||||
MT_CONTROL = 6, /* extra-data protocol message */
|
||||
MT_OOBDATA = 7 /* out-of-band data */
|
||||
};
|
||||
|
||||
/* length to m_copy to copy all */
|
||||
#define M_COPYALL 1000000000
|
||||
|
||||
/* now some macro's to make life easier... */
|
||||
|
||||
/* need to add the macro's here :) */
|
||||
|
||||
#define MRESETDATA(m) do { \
|
||||
if ((m)->m_flags & M_EXT) \
|
||||
(m)->m_data = (m)->m_ext.ext_buf; \
|
||||
else if ((m)->m_flags & M_PKTHDR) \
|
||||
(m)->m_data = (m)->m_pktdat; \
|
||||
else \
|
||||
(m)->m_data = (m)->dat; \
|
||||
} while (0)
|
||||
|
||||
/* fill in an mbuf */
|
||||
#define MGET(n, type) \
|
||||
n = (struct mbuf*) pool_get(mbpool); \
|
||||
if (n) { \
|
||||
(n)->m_type = (type); \
|
||||
(n)->m_next = NULL; \
|
||||
(n)->m_nextpkt = NULL; \
|
||||
(n)->m_data = (n)->m_dat; \
|
||||
(n)->m_flags = 0; \
|
||||
(n)->m_cksum = 0; \
|
||||
}
|
||||
|
||||
#define MGETHDR(n, type) \
|
||||
n = (struct mbuf*) pool_get(mbpool); \
|
||||
if (n) { \
|
||||
(n)->m_type = (type); \
|
||||
(n)->m_next = NULL; \
|
||||
(n)->m_nextpkt = NULL; \
|
||||
(n)->m_data = (n)->m_pktdat; \
|
||||
(n)->m_flags = M_PKTHDR; \
|
||||
(n)->m_cksum = 0; \
|
||||
}
|
||||
|
||||
#define _MEXTREMOVE(m) do { \
|
||||
if ((m)->m_flags & M_CLUSTER) { \
|
||||
pool_put(clpool, (m)->m_ext.ext_buf); \
|
||||
} \
|
||||
(m)->m_flags &= ~(M_CLUSTER|M_EXT); \
|
||||
(m)->m_ext.ext_size = 0; \
|
||||
} while (0)
|
||||
|
||||
#define MFREE(m, n) \
|
||||
if ((m)->m_flags & M_EXT) { \
|
||||
_MEXTREMOVE(m); \
|
||||
} \
|
||||
(n) = (m)->m_next; \
|
||||
pool_put(mbpool, m);
|
||||
|
||||
/* set the data pointer to place an object of size len at the end
|
||||
* of the mbuf, aligned to long word (16 bits)
|
||||
*/
|
||||
#define M_ALIGN(m, len) \
|
||||
{ (m)->m_data += (MLEN - (len)) &~ (sizeof(int16) -1);}
|
||||
|
||||
#define MH_ALIGN(m, len) \
|
||||
{ (m)->m_data += (MHLEN - (len)) &~ (sizeof(int16) -1);}
|
||||
|
||||
#define M_MOVE_HDR(to, from) { \
|
||||
(to)->m_pkthdr = (from)->m_pkthdr; \
|
||||
(from)->m_flags &= ~M_PKTHDR; \
|
||||
}
|
||||
|
||||
#define M_MOVE_PKTHDR(to, from) { \
|
||||
(to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
|
||||
M_MOVE_HDR((to), (from)); \
|
||||
(to)->m_data = (to)->m_pktdat; \
|
||||
}
|
||||
|
||||
#define MCLGET(m) do { \
|
||||
(m)->m_ext.ext_buf = pool_get(clpool); \
|
||||
if ((m)->m_ext.ext_buf != NULL) { \
|
||||
(m)->m_data = (m)->m_ext.ext_buf; \
|
||||
(m)->m_flags |= M_EXT|M_CLUSTER; \
|
||||
(m)->m_ext.ext_size = MCLBYTES; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define M_LEADINGSPACE(m) \
|
||||
((m)->m_flags & M_EXT ? (m)->m_data - (m)->m_ext.ext_buf : \
|
||||
(m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
|
||||
(m)->m_data - (m)->m_dat)
|
||||
|
||||
#define M_PREPEND(m, plen) { \
|
||||
if (M_LEADINGSPACE(m) >= (plen)) { \
|
||||
(m)->m_data -= (plen); \
|
||||
(m)->m_len += (plen); \
|
||||
} else \
|
||||
(m) = m_prepend((m), (plen)); \
|
||||
if ((m) && (m)->m_flags & M_PKTHDR) \
|
||||
(m)->m_pkthdr.len += (plen); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Duplicate just m_pkthdr from from to to.
|
||||
*/
|
||||
#define M_DUP_HDR(to, from) { \
|
||||
(to)->m_pkthdr = (from)->m_pkthdr; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Duplicate mbuf pkthdr from from to to.
|
||||
* from must have M_PKTHDR set, and to must be empty.
|
||||
*/
|
||||
#define M_DUP_PKTHDR(to, from) { \
|
||||
(to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
|
||||
M_DUP_HDR((to), (from)); \
|
||||
(to)->m_data = (to)->m_pktdat; \
|
||||
}
|
||||
|
||||
#define M_TRAILINGSPACE(m) \
|
||||
((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \
|
||||
((m)->m_data + (m)->m_len) : \
|
||||
&(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
|
||||
|
||||
#define M_IS_CLUSTER(m) ((m)->m_flags & M_EXT)
|
||||
|
||||
#define M_DATASTART(m) \
|
||||
(M_IS_CLUSTER(m) ? (m)->m_ext.ext_buf : \
|
||||
(m)->m_flags & M_PKTHDR ? (m)->m_pktdat : (m)->m_dat)
|
||||
|
||||
#define M_DATASIZE(m) \
|
||||
(M_IS_CLUSTER(m) ? (m)->m_ext.ext_size : \
|
||||
(m)->m_flags & M_PKTHDR ? MHLEN: MLEN)
|
||||
|
||||
/* Functions! */
|
||||
void mbinit(void);
|
||||
struct mbuf *m_get(int type);
|
||||
|
||||
struct mbuf *m_gethdr(int type);
|
||||
struct mbuf *m_getclr(int type);
|
||||
|
||||
struct mbuf *m_prepend(struct mbuf *m, int len);
|
||||
struct mbuf *m_devget(char *buf, int totlen, int off0,
|
||||
struct ifnet *ifp,
|
||||
void (*copy)(const void *, void *, size_t));
|
||||
struct mbuf *m_pullup(struct mbuf *, int len);
|
||||
void m_copyback(struct mbuf *m0, int off, int len, char * cp);
|
||||
|
||||
struct mbuf *m_free(struct mbuf *mfree);
|
||||
void m_freem(struct mbuf *m);
|
||||
|
||||
void m_reserve(struct mbuf *mp, int len);
|
||||
void m_cat(struct mbuf *m, struct mbuf *n);
|
||||
void m_adj(struct mbuf *mp, int req_len);
|
||||
void m_copydata(struct mbuf *m, int off, int len, char * cp);
|
||||
struct mbuf *m_copym(struct mbuf *m, int off0, int len);
|
||||
|
||||
/* debug functions */
|
||||
void dump_freelist(void);
|
||||
|
||||
/* Stats structure */
|
||||
/* XXX - add me! */
|
||||
|
||||
|
||||
struct pool_ctl *mbpool;
|
||||
struct pool_ctl *clpool;
|
||||
|
||||
int max_hdr; /* largest link+protocol header */
|
||||
int max_linkhdr; /* largest link level header */
|
||||
int max_protohdr; /* largest protocol header */
|
||||
|
||||
#endif /* OBOS_MBUF_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
/* nhash.h
|
||||
*/
|
||||
|
||||
#ifndef OBOS_NHASH_H
|
||||
#define OBOS_NHASH_H
|
||||
|
||||
#include <pools.h>
|
||||
|
||||
typedef struct net_hash_entry net_hash_entry;
|
||||
typedef struct net_hash net_hash;
|
||||
typedef struct net_hash_index net_hash_index;
|
||||
|
||||
struct net_hash_entry {
|
||||
net_hash_entry *next;
|
||||
int hash;
|
||||
const void *key;
|
||||
ssize_t klen;
|
||||
const void *val;
|
||||
};
|
||||
|
||||
struct net_hash_index {
|
||||
net_hash *nh;
|
||||
net_hash_entry *this;
|
||||
net_hash_entry *next;
|
||||
int index;
|
||||
};
|
||||
|
||||
struct net_hash {
|
||||
net_hash_entry **array;
|
||||
net_hash_index iterator;
|
||||
int count;
|
||||
int max;
|
||||
struct pool_ctl *pool;
|
||||
};
|
||||
|
||||
net_hash *nhash_make(void);
|
||||
void *nhash_get(net_hash *, const void *key, ssize_t klen);
|
||||
void nhash_set(net_hash *, const void *, ssize_t , const void *);
|
||||
|
||||
#endif /* OBOS_NHASH_H */
|
||||
@@ -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