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:
@@ -8,7 +8,6 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <ByteOrder.h> /* htonl, htons, ntohl, ntohs */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -150,7 +150,7 @@ struct ifnet {
|
||||
void (*input) (struct mbuf*);
|
||||
int (*output)(struct ifnet *, struct mbuf*,
|
||||
struct sockaddr*, struct rtentry *);
|
||||
int (*ioctl) (struct ifnet *, ulong, char *);
|
||||
int (*ioctl) (struct ifnet *, ulong, caddr_t);
|
||||
};
|
||||
#define if_mtu ifd.ifi_mtu
|
||||
#define if_type ifd.ifi_type
|
||||
@@ -268,7 +268,7 @@ struct ifa_msghdr {
|
||||
void if_attach(struct ifnet *ifp);
|
||||
void if_detach(struct ifnet *ifp);
|
||||
|
||||
int ifioctl(struct socket *so, ulong cmd, char *data);
|
||||
int ifioctl(struct socket *so, ulong cmd, caddr_t data);
|
||||
int ifconf(int cmd, char *data);
|
||||
void if_init(void);
|
||||
#endif
|
||||
|
||||
@@ -142,10 +142,10 @@ struct radix_node_head {
|
||||
#define Bcopy(a, b, n) memcpy(((char *)(b)), ((char *)(a)), (unsigned)(n))
|
||||
#define Bzero(p, n) memset((char *)(p),0, (int)(n));
|
||||
#define R_Malloc(p, t, n) do { \
|
||||
(p = (t) kmalloc((unsigned int)(n))); \
|
||||
(p = (t) malloc((unsigned int)(n))); \
|
||||
memset(p, 0, sizeof(*p)); \
|
||||
} while (0)
|
||||
#define Free(p) kfree((char *)p);
|
||||
#define Free(p) free((char *)p);
|
||||
|
||||
void rn_init (void);
|
||||
int rn_inithead (void **, int);
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#ifndef NETINET_ICMP_VAR_H
|
||||
#define NETINET_ICMP_VAR_H
|
||||
|
||||
#include <ByteOrder.h>
|
||||
|
||||
#include "netinet/ip_icmp.h"
|
||||
|
||||
struct icmpstat {
|
||||
@@ -54,8 +52,8 @@ struct icmpstat {
|
||||
int32 icps_inhist[ICMP_MAXTYPE + 1];
|
||||
};
|
||||
|
||||
#ifdef _KERNEL_MODE
|
||||
struct icmpstat icmpstat;
|
||||
#endif
|
||||
//#ifdef _KERNEL_MODE
|
||||
//struct icmpstat icmpstat;
|
||||
//#endif
|
||||
|
||||
#endif /* NETINET_ICMP_VAR_H */
|
||||
|
||||
@@ -80,7 +80,7 @@ struct ether_header {
|
||||
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
||||
|
||||
|
||||
#ifdef _NETWORK_STACK
|
||||
//#ifdef _NETWORK_STACK
|
||||
|
||||
/*
|
||||
* Macro to map an IP multicast address to an Ethernet multicast address.
|
||||
@@ -115,7 +115,7 @@ struct ether_header {
|
||||
(enaddr)[4] = ((u_int8_t *)ip6addr)[14]; \
|
||||
(enaddr)[5] = ((u_int8_t *)ip6addr)[15]; \
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
/*
|
||||
* Structure shared between the ethernet driver modules and
|
||||
@@ -179,14 +179,14 @@ struct sockaddr_inarp {
|
||||
#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */
|
||||
#define RTF_PERMANENT_ARP RTF_PROTO3 /* only manual overwrite of entry */
|
||||
|
||||
#ifdef _NETWORK_STACK
|
||||
//#ifdef _NETWORK_STACK
|
||||
|
||||
int arpresolve(struct arpcom *ac, struct rtentry *rt, struct mbuf *m,
|
||||
struct sockaddr *dst, uint8 *desten);
|
||||
void arpwhohas(struct arpcom *ac, struct in_addr *ia);
|
||||
//void arpwhohas(struct arpcom *ac, struct in_addr *ia);
|
||||
|
||||
|
||||
#else
|
||||
//#else
|
||||
|
||||
char *ether_ntoa (struct ether_addr *);
|
||||
struct ether_addr *ether_aton (char *);
|
||||
@@ -194,7 +194,7 @@ int ether_ntohost (char *, struct ether_addr *);
|
||||
int ether_hostton (char *, struct ether_addr *);
|
||||
int ether_line(char *line, struct ether_addr *e, char *hostname);
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#endif /* NETINET_IF_ETHER_H */
|
||||
|
||||
|
||||
@@ -3,16 +3,36 @@
|
||||
#ifndef _NETINET_IN_H_
|
||||
#define _NETINET_IN_H_
|
||||
|
||||
//#include <ByteOrder.h> /* for htonl */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <net/if.h>
|
||||
#include <endian.h>
|
||||
|
||||
typedef unsigned short in_port_t;
|
||||
typedef unsigned long in_addr_t;
|
||||
|
||||
/* We can't include <ByteOrder.h> since we are a posix file,
|
||||
* and we are not allowed to import all the BeOS types here.
|
||||
*/
|
||||
#ifndef htonl
|
||||
extern unsigned long __swap_int32(unsigned long); /* private */
|
||||
extern unsigned short __swap_int16(unsigned short); /* private */
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define htonl(x) __swap_int32(x)
|
||||
#define ntohl(x) __swap_int32(x)
|
||||
#define htons(x) __swap_int16(x)
|
||||
#define ntohs(x) __swap_int16(x)
|
||||
#elif BYTE_ORDER == BIG_ENDIAN
|
||||
#define htonl(x) (x)
|
||||
#define ntohl(x) (x)
|
||||
#define htons(x) (x)
|
||||
#define ntohs(x) (x)
|
||||
#else
|
||||
#error Unknown byte order.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef uint16 in_port_t;
|
||||
typedef uint32 in_addr_t;
|
||||
|
||||
/* Protocol definitions - add to as required... */
|
||||
|
||||
enum {
|
||||
IPPROTO_IP = 0, /* 0, IPv4 */
|
||||
IPPROTO_ICMP = 1, /* 1, ICMP (v4) */
|
||||
@@ -137,12 +157,15 @@ struct sockaddr_in {
|
||||
#define satosin(sa) ((struct sockaddr_in *)(sa))
|
||||
#define sintosa(sin) ((struct sockaddr *)(sin))
|
||||
|
||||
struct ifnet; // forward declaration
|
||||
|
||||
/* Prototypes... */
|
||||
int in_broadcast (struct in_addr, struct ifnet *);
|
||||
int in_canforward (struct in_addr);
|
||||
int in_localaddr (struct in_addr);
|
||||
void in_socktrim (struct sockaddr_in*);
|
||||
uint16 in_cksum (struct mbuf *, int);
|
||||
/* uint16 in_cksum (struct mbuf *, int); */
|
||||
uint16 in_cksum(struct mbuf *m, int len, int off);
|
||||
|
||||
#endif /* _KERNEL_MODE */
|
||||
#endif /* NETINET_IN_H */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* internet protcol control blocks
|
||||
*/
|
||||
|
||||
#include <sys/socketvar.h>
|
||||
//#include <sys/socketvar.h>
|
||||
#include <sys/socket.h>
|
||||
#include <pools.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
@@ -56,7 +56,7 @@ struct in_multi {
|
||||
|
||||
#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
|
||||
|
||||
extern struct in_ifaddr *in_ifaddr;
|
||||
// extern struct in_ifaddr *in_ifaddr;
|
||||
|
||||
int in_control(struct socket *so, int cmd, char *data, struct ifnet *ifp);
|
||||
int in_ifinit(struct ifnet *dev, struct in_ifaddr *ia, struct sockaddr_in *sin,
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#ifndef _NETINET_IP_H
|
||||
#define _NETINET_IP_H
|
||||
|
||||
//#include <ByteOrder.h>
|
||||
|
||||
#include <mbuf.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
@@ -138,7 +138,7 @@ struct ipstat {
|
||||
int32 ips_outhwcsum; /* hardware checksummed on output */
|
||||
};
|
||||
|
||||
#ifdef _KERNEL_MODE
|
||||
//#ifdef _KERNEL_MODE
|
||||
|
||||
#define IP_FORWARDING 0x1 /* most of ip header exists */
|
||||
#define IP_RAWOUTPUT 0x2 /* raw ip header exists */
|
||||
@@ -146,7 +146,8 @@ struct ipstat {
|
||||
#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
|
||||
#define IP_MTUDISC 0x0400 /* pmtu discovery, set DF */
|
||||
|
||||
struct ipstat ipstat;
|
||||
#if 0
|
||||
//struct ipstat ipstat;
|
||||
|
||||
void ipv4_input(struct mbuf *, int);
|
||||
int ipv4_output(struct mbuf *, struct mbuf *, struct route *, int, void *);
|
||||
|
||||
@@ -52,10 +52,10 @@ struct tcp_debug {
|
||||
#define TA_RESPOND 3
|
||||
#define TA_DROP 4
|
||||
|
||||
#ifdef TANAMES
|
||||
char *tanames[] =
|
||||
{ "input", "output", "user", "respond", "drop" };
|
||||
#endif /* TANAMES */
|
||||
//#ifdef TANAMES
|
||||
//char *tanames[] =
|
||||
// { "input", "output", "user", "respond", "drop" };
|
||||
//#endif /* TANAMES */
|
||||
|
||||
#define TCP_NDEBUG 100
|
||||
struct tcp_debug tcp_debug[TCP_NDEBUG];
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
|
||||
#define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */
|
||||
|
||||
#ifdef _NETWORK_STACK
|
||||
tcp_seq tcp_iss; /* tcp initial send seq # */
|
||||
#endif /* _NETWORK_STACK */
|
||||
//#ifdef _NETWORK_STACK
|
||||
extern tcp_seq tcp_iss; /* tcp initial send seq # */
|
||||
//#endif /* _NETWORK_STACK */
|
||||
|
||||
#endif /* _NETINET_TCP_SEQ_H_ */
|
||||
|
||||
@@ -106,10 +106,11 @@
|
||||
#define TCP_LINGERTIME 120 /* at most 2 minutes... */
|
||||
#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
|
||||
|
||||
#ifdef TCPTIMERS
|
||||
char *tcptimers[] =
|
||||
{ "REXMT", "PERSIST", "KEEP", "2MSL" };
|
||||
#endif /* TCPTIMERS */
|
||||
//#ifdef TCPTIMERS
|
||||
//char *tcptimers[] =
|
||||
// { "REXMT", "PERSIST", "KEEP", "2MSL" };
|
||||
//#endif /* TCPTIMERS */
|
||||
extern char *tcptimers[];
|
||||
|
||||
/*
|
||||
* Force a time value to be in a certain range.
|
||||
@@ -122,7 +123,7 @@ char *tcptimers[] =
|
||||
(tv) = (tvmax); \
|
||||
}
|
||||
|
||||
#ifdef _NETWORK_STACK
|
||||
//#ifdef _NETWORK_STACK
|
||||
extern int tcptv_keep_init;
|
||||
extern int tcp_keepidle; /* time before keepalive probes begin */
|
||||
extern int tcp_keepintvl; /* time between keepalive probes */
|
||||
@@ -131,6 +132,6 @@ extern int tcp_ttl; /* time to live for TCP segs */
|
||||
extern int tcp_backoff[];
|
||||
|
||||
|
||||
#endif /* _NETWORK_STACK */
|
||||
//#endif /* _NETWORK_STACK */
|
||||
|
||||
#endif /* NETINET_TCP_TIMERS_H */
|
||||
|
||||
@@ -241,12 +241,14 @@ struct tcpstat {
|
||||
#define TCPCTL_RSTPPSLIMIT 12 /* RST pps limit */
|
||||
#define TCPCTL_MAXID 13
|
||||
|
||||
#ifdef _NETWORK_STACK
|
||||
struct inpcb tcb;
|
||||
struct tcpstat tcpstat;
|
||||
int tcp_mssdflt;
|
||||
int tcp_do_rfc1323;
|
||||
unsigned long tcp_now;
|
||||
//#ifdef _NETWORK_STACK
|
||||
|
||||
extern struct inpcb tcb;
|
||||
extern struct tcpstat tcpstat;
|
||||
extern int tcp_mssdflt;
|
||||
extern int tcp_do_rfc1323;
|
||||
extern unsigned long tcp_now;
|
||||
|
||||
|
||||
void tcp_input(struct mbuf *, int);
|
||||
int tcp_output(struct tcpcb*);
|
||||
@@ -275,6 +277,6 @@ void tcp_fasttimer(void *data);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#endif /* NETINET_TCP_VAR_H */
|
||||
|
||||
@@ -145,8 +145,9 @@ struct protosw {
|
||||
NET_LAYER3,
|
||||
NET_LAYER4
|
||||
};
|
||||
|
||||
void add_protosw (struct protosw *prt[], int);
|
||||
|
||||
//XXX conflicts with src/add-ons/kernel/network/core/core.c:69
|
||||
// void add_protosw (struct protosw *prt[], int);
|
||||
void add_protocol (struct protosw *, int);
|
||||
void remove_protocol (struct protosw *);
|
||||
#endif
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
#define _SYS_SOCKETVAR_H
|
||||
|
||||
#include <OS.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
struct mbuf;
|
||||
|
||||
struct sockbuf {
|
||||
uint32 sb_cc; /* actual chars in buffer */
|
||||
uint32 sb_hiwat; /* max actual char count (high water mark) */
|
||||
|
||||
Reference in New Issue
Block a user