diff --git a/headers/posix/core_funcs.h b/headers/posix/core_funcs.h deleted file mode 100644 index 0ad72846f0..0000000000 --- a/headers/posix/core_funcs.h +++ /dev/null @@ -1,115 +0,0 @@ -/* core_funcs.h - * convenience macros to for calling core functions in the kernel - */ - -#ifndef OBOS_CORE_FUNCS_H -#define OBOS_CORE_FUNCS_H - -#include "core_module.h" - -# define add_protosw core->add_protosw -# define add_domain core->add_domain -# define remove_domain core->remove_domain -# define add_protocol core->add_protocol -# define remove_protocol core->remove_protocol -# define start_rx_thread core->start_rx_thread -# define start_tx_thread core->start_tx_thread - -# define net_add_timer core->net_add_timer -# define net_remove_timer core->net_remove_timer - -# define start_ifq core->start_ifq -# define stop_ifq core->stop_ifq - -# define pool_init core->pool_init -# define pool_get core->pool_get -# define pool_put core->pool_put - -# define m_get core->m_get -# define m_gethdr core->m_gethdr -# define m_free core->m_free -# define m_freem core->m_freem -# define m_cat core->m_cat -# define m_adj core->m_adj -# define m_prepend core->m_prepend -# define m_pullup core->m_pullup -# define m_copydata core->m_copydata -# define m_copyback core->m_copyback -# define m_copym core->m_copym -# define m_reserve core->m_reserve -# define m_devget core->m_devget - -# define if_attach core->if_attach -# define if_detach core->if_detach - -# define in_pcballoc core->in_pcballoc -# define in_pcbconnect core->in_pcbconnect -# define in_pcbdisconnect core->in_pcbdisconnect -# define in_pcbbind core->in_pcbbind -# define in_pcblookup core->in_pcblookup -# define in_pcbdetach core->in_pcbdetach -# define in_pcbrtentry core->in_pcbrtentry -# define in_canforward core->in_canforward -# define in_localaddr core->in_localaddr -# define in_losing core->in_losing -# define in_broadcast core->in_broadcast -# define in_control core->in_control -# define in_setsockaddr core->in_setsockaddr -# define in_setpeeraddr core->in_setpeeraddr -# define in_pcbnotify core->in_pcbnotify -# define inetctlerrmap core->inetctlerrmap - -# define ifa_ifwithdstaddr core->ifa_ifwithdstaddr -# define ifa_ifwithaddr core->ifa_ifwithaddr -# define ifa_ifwithnet core->ifa_ifwithnet -# define ifa_ifwithroute core->ifa_ifwithroute -# define ifaof_ifpforaddr core->ifaof_ifpforaddr -# define ifafree core->ifafree - -# define sbappend core->sbappend -# define sbappendaddr core->sbappendaddr -# define sbdrop core->sbdrop -# define sbflush core->sbflush -# define sbreserve core->sbreserve - -# define soreserve core->soreserve -# define sowakeup core->sowakeup -# define sonewconn core->sonewconn -# define soisconnected core->soisconnected -# define soisconnecting core->soisconnecting -# define soisdisconnected core->soisdisconnected -# define soisdisconnecting core->soisdisconnecting -# define sohasoutofband core->sohasoutofband -# define socantsendmore core->socantsendmore -# define socantrcvmore core->socantrcvmore - -# define rtfree core->rtfree -# define rtalloc core->rtalloc -# define rtalloc1 core->rtalloc1 -# define rtrequest core->rtrequest - -# define rt_setgate core->rt_setgate -# define get_rt_tables core->get_rt_tables - -# define rn_addmask core->rn_addmask -# define rn_head_search core->rn_head_search - -# define get_interfaces core->get_interfaces -# define get_primary_addr core->get_primary_addr - -# define initsocket core->initsocket -# define socreate core->socreate -# define soclose core->soclose - -# define sobind core->sobind -# define soconnect core->soconnect -# define solisten core->solisten -# define soaccept core->soaccept - -# define soo_ioctl core->soo_ioctl -# define net_sysctl core->net_sysctl - -# define readit core->readit -# define writeit core->writeit - -#endif /* OBOS_CORE_FUNCS_H */ diff --git a/headers/posix/core_module.h b/headers/posix/core_module.h deleted file mode 100644 index 5f2dd7f873..0000000000 --- a/headers/posix/core_module.h +++ /dev/null @@ -1,158 +0,0 @@ -/* core_module.h - * definitions needed by the core networking module - */ - -#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" - -struct core_module_info { - module_info module; - - int (*start)(void); - int (*stop)(void); - void (*add_domain)(struct domain *, int); - void (*remove_domain)(int); - void (*add_protocol)(struct protosw *, int); - void (*remove_protocol)(struct protosw *pr); - void (*add_protosw)(struct protosw *prt[], int layer); - void (*start_rx_thread)(struct ifnet *dev); - void (*start_tx_thread)(struct ifnet *dev); - - /* timer functions */ - net_timer_id (*net_add_timer)(net_timer_hook ,void *, - bigtime_t); - status_t (*net_remove_timer)(net_timer_id); - - /* ifq functions */ - struct ifq *(*start_ifq)(void); - void (*stop_ifq)(struct ifq *); - - /* pool functions */ - status_t (*pool_init)(pool_ctl **p, size_t sz); - char *(*pool_get)(pool_ctl *p); - void (*pool_put)(pool_ctl *p, void *ptr); - void (*pool_destroy)(pool_ctl *p); - - /* socket functions - called "internally" */ - struct socket *(*sonewconn)(struct socket *, int); - int (*soreserve)(struct socket *, uint32, uint32); - int (*sbreserve)(struct sockbuf *, uint32); - void (*sbappend)(struct sockbuf *, struct mbuf *); - int (*sbappendaddr)(struct sockbuf *, struct sockaddr *, - struct mbuf *, struct mbuf *); - void (*sbdrop)(struct sockbuf *, int); - void (*sbflush)(struct sockbuf *sb); - void (*sowakeup)(struct socket *, struct sockbuf *); - void (*soisconnected)(struct socket *); - void (*soisconnecting)(struct socket*); - void (*soisdisconnected)(struct socket *); - void (*soisdisconnecting)(struct socket *); - void (*sohasoutofband)(struct socket *so); - void (*socantrcvmore)(struct socket*); - void (*socantsendmore)(struct socket *); - - /* pcb options */ - int (*in_pcballoc)(struct socket *, struct inpcb *); - void (*in_pcbdetach)(struct inpcb *); - int (*in_pcbbind)(struct inpcb *, struct mbuf *); - int (*in_pcbconnect)(struct inpcb *, struct mbuf *); - int (*in_pcbdisconnect)(struct inpcb *); - struct inpcb * (*in_pcblookup)(struct inpcb *, - struct in_addr, uint16, struct in_addr, uint16, int); - int (*in_control)(struct socket *, int, caddr_t, - struct ifnet *); - void (*in_losing)(struct inpcb *); - int (*in_canforward)(struct in_addr); - int (*in_localaddr)(struct in_addr); - struct rtentry *(*in_pcbrtentry)(struct inpcb *); - void (*in_setsockaddr)(struct inpcb *, struct mbuf *); - void (*in_setpeeraddr)(struct inpcb *, struct mbuf *); - void (*in_pcbnotify)(struct inpcb *, struct sockaddr *, - uint16, struct in_addr, uint16, - int, void (*)(struct inpcb *, int)); - int (*inetctlerrmap)(int); - - /* mbuf routines... */ - struct mbuf * (*m_gethdr)(int); - struct mbuf * (*m_get)(int); - void (*m_cat)(struct mbuf *, struct mbuf *); - void (*m_adj)(struct mbuf*, int); - struct mbuf * (*m_prepend)(struct mbuf*, int); - struct mbuf *(*m_pullup)(struct mbuf *, int); - void (*m_copyback)(struct mbuf *, int, int, caddr_t); - void (*m_copydata)(struct mbuf *, int, int, caddr_t); - struct mbuf *(*m_copym)(struct mbuf *, int, int); - struct mbuf * (*m_free)(struct mbuf *); - void (*m_freem)(struct mbuf *); - void (*m_reserve)(struct mbuf *, int); - struct mbuf *(*m_devget)(char *, int, int, struct ifnet *, - void (*copy)(const void *, void *, size_t)); - - /* module control routines... */ - void (*add_device)(struct ifnet *); - struct ifnet *(*get_interfaces)(void); - int (*in_broadcast)(struct in_addr, struct ifnet *); - - /* routing */ - void (*rtalloc)(struct route *ro); - struct rtentry *(*rtalloc1)(struct sockaddr *, int); - void (*rtfree)(struct rtentry *); - int (*rtrequest)(int, struct sockaddr *, - struct sockaddr *, struct sockaddr *, int, - struct rtentry **); - struct radix_node *(*rn_addmask)(void *, int, int); - struct radix_node *(*rn_head_search)(void *argv_v); - struct radix_node_head **(*get_rt_tables)(void); - int (*rt_setgate)(struct rtentry *, struct sockaddr *, - struct sockaddr *); - - /* ifnet functions */ - struct ifaddr *(*ifa_ifwithdstaddr)(struct sockaddr *addr); - struct ifaddr *(*ifa_ifwithnet)(struct sockaddr *addr); - void (*if_attach)(struct ifnet *); - void (*if_detach)(struct ifnet *); - struct ifaddr *(*ifa_ifwithaddr)(struct sockaddr *); - struct ifaddr *(*ifa_ifwithroute)(int, struct sockaddr *, - struct sockaddr *); - struct ifaddr *(*ifaof_ifpforaddr)(struct sockaddr *, struct ifnet *); - void (*ifafree)(struct ifaddr *); - - struct in_ifaddr *(*get_primary_addr)(void); - - /* socket functions - used by socket driver */ - int (*initsocket)(void **); - int (*socreate)(int, void *, int, int); - int (*soclose)(void *); - int (*sobind)(void *, caddr_t, int); - int (*solisten)(void *, int); - int (*soconnect)(void *, caddr_t, int); - int (*recvit)(void *, struct msghdr *, caddr_t, int *); - int (*sendit)(void *, struct msghdr *, int, int *); - int (*soo_ioctl)(void *, int, caddr_t); - int (*net_sysctl)(int *, uint, void *, size_t *, void *, size_t); - int (*writeit)(void *, struct iovec *, int); - int (*readit)(void*, struct iovec *, int *); - int (*sosetopt)(void *, int, int, const void *, size_t); - int (*sogetopt)(void *, int, int, void *, size_t *); - 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 *); -}; - -#ifdef _KERNEL_ -#define CORE_MODULE_PATH "network/core" -#else -#define CORE_MODULE_PATH "modules/core" -#endif - -#endif /* OBOS_CORE_MODULE_H */ - diff --git a/headers/posix/net_malloc.h b/headers/posix/net_malloc.h deleted file mode 100644 index 4b041f79a4..0000000000 --- a/headers/posix/net_malloc.h +++ /dev/null @@ -1,37 +0,0 @@ -/* net_malloc.h - * - * Are we useing the system amlloc or our own... - */ - -#ifndef NET_MALLOC_H -#define NET_MALLOC_H - -#include -#include "net_misc.h" - -#if USE_DEBUG_MALLOC - - - -/* We check the boundary of the malloc'd area at one end of the - * area allocated. If we are outside the area it'll stop, but we can - * check only one end of the boundary. So the following essentially - * allows us to choose which end. - */ -//#define OVERRUN -#ifdef OVERRUN -#define CHECK_OVERRUN 1 -#else -#define CHECK_UNDERRUN 1 -#endif - -/* use the area malloc code from marcus Overhagen */ -void *dbg_malloc(char *file, int line, size_t size); -void dbg_free (char *file, int line, void *ptr); - -#define malloc(s) dbg_malloc(__FILE__, __LINE__, s) -#define free(s) do { dbg_free(__FILE__, __LINE__, s); s = NULL; } while (0) -#endif /* USE_DEBUG_MALLOC */ - -#endif /* NET_MALLOC_H */ - diff --git a/headers/posix/net_misc.h b/headers/posix/net_misc.h deleted file mode 100644 index ad714fcd87..0000000000 --- a/headers/posix/net_misc.h +++ /dev/null @@ -1,102 +0,0 @@ -/* net_misc.h - * Miscellaneous networking stuff that doesn't yet have a home. - */ - -#ifdef _NETWORK_STACK - -#include -#include -#include - -#include "sys/mbuf.h" - -#ifndef OBOS_NET_MISC_H -#define OBOS_NET_MISC_H - -#ifdef _KERNEL_ -#include -#define printf dprintf -#endif - -/* Not really sure if this is safe... */ -#define EHOSTDOWN (B_POSIX_ERROR_BASE + 45) - -/* These are GCC only, so we'll need PPC version eventually... */ -struct quehead { - struct quehead *qh_link; - struct quehead *qh_rlink; -}; - -static __inline void insque(void *a, void *b) -{ - struct quehead *element = (struct quehead *)a, - *head = (struct quehead *)b; - - element->qh_link = head->qh_link; - element->qh_rlink = head; - head->qh_link = element; - element->qh_link->qh_rlink = element; -} - -static __inline void remque(void *a) -{ - struct quehead *element = (struct quehead *)a; - - element->qh_link->qh_rlink = element->qh_rlink; - element->qh_rlink->qh_link = element->qh_link; - element->qh_rlink = 0; -} - -/* DEBUG Options! - * - * Having a single option is sort of lame so I'm going to start adding more here... - * - */ -#define SHOW_DEBUG 0 /* general debugging stuff (verbose!) */ -#define SHOW_ROUTE 0 /* show routing information */ -#define ARP_DEBUG 0 /* show ARP debug info */ -#define USE_DEBUG_MALLOC 0 /* use the debug malloc code*/ - -typedef struct ifnet ifnet; - -/* ARP lookup return codes... */ -enum { - ARP_LOOKUP_OK = 1, - ARP_LOOKUP_QUEUED = 2, - ARP_LOOKUP_FAILED = 3 -}; - -typedef uint32 ipv4_addr; - -/* These should be in KernelExport.h */ -#define B_SELECT_READ 1 -#define B_SELECT_WRITE 2 -#define B_SELECT_EXCEPTION 3 - -/* XXX - add some macro's for inserting various types of address - */ - -void net_server_add_device(ifnet *ifn); -uint16 in_cksum(struct mbuf *m, int len, int off); -void local_init(void); - -/* sockets and in_pcb init */ -int sockets_init(void); -void sockets_shutdown(void); -int inpcb_init(void); - -void start_tx_thread(ifnet *dev); -void start_rx_thread(ifnet *dev); - -/* Useful debugging functions */ -void dump_ipv4_addr(char *msg, void *ad); -void print_ipv4_addr(void *ad); -void dump_ether_addr(char *msg, void *ma); -void print_ether_addr(void *ea); -void dump_buffer(char *buffer, int len); -void dump_sockaddr(void *ptr); - -#endif /* OBOS_NET_MISC_H */ - -#endif /* _NETWORK_STACK */ - diff --git a/headers/posix/net_module.h b/headers/posix/net_module.h deleted file mode 100644 index cba4a18fd1..0000000000 --- a/headers/posix/net_module.h +++ /dev/null @@ -1,56 +0,0 @@ -/* net_module.h - * fundtions and staructures for all modules using the - * net_server - */ - -#ifndef OBOS_NET_MODULE_H -#define OBOS_NET_MODULE_H - -#include -#include - -#include "sys/mbuf.h" -#include "net_misc.h" -#include "sys/socketvar.h" -#include "net/if.h" -#include "net/route.h" - -#ifdef _KERNEL_ -#include -#else -typedef struct module_info { - const char *name; - uint32 flags; - status_t (*std_ops)(int32, ...); -} module_info; - -#define B_MODULE_INIT 1 -#define B_MODULE_UNINIT 2 -#define B_KEEP_LOADED 0x00000001 -#endif - -struct kernel_net_module_info { - module_info info; - int (*start)(void *); - int (*stop)(void); -}; - -struct net_module { - struct net_module *next; - char *name; - struct kernel_net_module_info *ptr; -#ifndef _KERNEL_ - image_id iid; -#endif - int status; -}; - -enum { - NET_LAYER1 = 1, /* link layer */ - NET_LAYER2, /* network layer */ - NET_LAYER3, /* transport layer */ - NET_LAYER4 /* socket layer */ -}; - -#endif /* OBOS_NET_MODULE_H */ -