Bring these files up to date.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@126 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
David Reid 2002-07-12 09:36:23 +00:00
parent ed7e0da5b5
commit 4fc6751684
8 changed files with 97 additions and 90 deletions

View File

@ -54,7 +54,7 @@ struct icmpstat {
int32 icps_inhist[ICMP_MAXTYPE + 1];
};
#ifdef _NETWORK_STACK
#ifdef _KERNEL_MODE
struct icmpstat icmpstat;
#endif

View File

@ -1,18 +1,11 @@
/* in.h */
#ifndef _NETINET_IN_H_
#define _NETINET_IN_H_
#include <ByteOrder.h> /* for htonl */
//#include <ByteOrder.h> /* for htonl */
#ifdef _NETWORK_STACK
#include "net_misc.h"
#endif
#include "net/if.h"
/* XXX - This really doesn't belong in here... */
/* XXX - move these to sys/param.h */
typedef uint32 in_addr_t;
typedef uint16 in_port_t;
#include <net/if.h>
/* Protocol definitions - add to as required... */
@ -78,7 +71,7 @@ struct sockaddr_in {
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
#ifdef _NETWORK_STACK
#ifdef _KERNEL_MODE
#define __IPADDR(x) ((uint32) htonl((uint32)(x)))
#else
#define __IPADDR(x) ((uint32)(x))
@ -95,7 +88,7 @@ struct sockaddr_in {
#define IN_LOOPBACKNET 127 /* official! */
#ifndef _NETWORK_STACK
#ifndef _KERNEL_MODE
#define INADDR_NONE __IPADDR(0xffffffff)
#endif
@ -133,16 +126,19 @@ struct sockaddr_in {
#define IP_MAX_MEMBERSHIPS 20
/* some helpful macro's :) */
#define in_hosteq(s,t) ((s).s_addr == (t).s_addr)
#define in_nullhost(x) ((x).s_addr == INADDR_ANY)
#define satosin(sa) ((struct sockaddr_in *)(sa))
#define sintosa(sin) ((struct sockaddr *)(sin))
/* 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*);
#ifdef _KERNEL_MODE
/* some helpful macro's :) */
#define in_hosteq(s,t) ((s).s_addr == (t).s_addr)
#define in_nullhost(x) ((x).s_addr == INADDR_ANY)
#define satosin(sa) ((struct sockaddr_in *)(sa))
#define sintosa(sin) ((struct sockaddr *)(sin))
/* 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);
#endif /* _KERNEL_MODE */
#endif /* NETINET_IN_H */

View File

@ -2,16 +2,15 @@
* internet protcol control blocks
*/
#include "sys/socketvar.h"
#include "sys/socket.h"
#include "net_misc.h"
#include "pools.h"
#include "netinet/ip.h"
#include "netinet/in.h"
#include "net/route.h"
#include <sys/socketvar.h>
#include <sys/socket.h>
#include <pools.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <net/route.h>
#ifndef IN_PCB_H
#define IN_PCB_H
#ifndef _NETINET_INPCB_H
#define _NETINET_INPCB_H
enum {
INP_HDRINCL = 0x01,
@ -34,38 +33,41 @@ struct inpcb {
struct inpcb *inp_head;
struct in_addr faddr; /* foreign address */
uint16 fport; /* foreign port # */
uint16 fport; /* foreign port # */
struct in_addr laddr; /* local address */
uint16 lport; /* local port # */
uint16 lport; /* local port # */
struct socket *inp_socket;
caddr_t inp_ppcb; /* pointer to a per protocol pcb*/
struct ip inp_ip; /* header prototype */
int inp_flags; /* flags */
struct mbuf *inp_options; /* IP options */
char *inp_ppcb; /* pointer to a per protocol pcb*/
struct ip inp_ip; /* header prototype */
int inp_flags; /* flags */
struct mbuf *inp_options; /* IP options */
/* more will be required */
struct route inp_route; /* the route to host */
struct route inp_route; /* the route to host */
};
int in_pcballoc (struct socket *, struct inpcb *);
int in_pcbbind (struct inpcb *, struct mbuf *);
int in_pcbconnect (struct inpcb *, struct mbuf *);
void in_pcbdetach (struct inpcb *);
int in_pcbdisconnect (struct inpcb *);
void in_losing (struct inpcb *);
void in_setpeeraddr (struct inpcb *, struct mbuf *);
void in_setsockaddr (struct inpcb *, struct mbuf *);
#ifdef _KERNEL_MODE
int in_pcbinit (void);
int in_pcballoc (struct socket *, struct inpcb *);
int in_pcbbind (struct inpcb *, struct mbuf *);
int in_pcbconnect (struct inpcb *, struct mbuf *);
void in_pcbdetach (struct inpcb *);
int in_pcbdisconnect (struct inpcb *);
void in_losing (struct inpcb *);
void in_setpeeraddr (struct inpcb *, struct mbuf *);
void in_setsockaddr (struct inpcb *, struct mbuf *);
struct inpcb *in_pcblookup(struct inpcb *head, struct in_addr faddr,
uint16 fport_a, struct in_addr laddr,
uint16 lport_a, int flags);
struct rtentry *in_pcbrtentry (struct inpcb *);
void in_pcbnotify (struct inpcb *, struct sockaddr *,
uint16, struct in_addr, uint16,
int, void (*)(struct inpcb *, int));
struct inpcb *in_pcblookup(struct inpcb *head, struct in_addr faddr,
uint16 fport_a, struct in_addr laddr,
uint16 lport_a, int flags);
struct rtentry *in_pcbrtentry (struct inpcb *);
void in_pcbnotify (struct inpcb *, struct sockaddr *,
uint16, struct in_addr, uint16,
int, void (*)(struct inpcb *, int));
/* helpful macro's */
#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
/* helpful macro's */
#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
#endif /* _KERNEL_MODE */
#endif /* IN_PCB_H */
#endif /* _NETINET_INPCB_H */

View File

@ -54,9 +54,9 @@ typedef uint32 n_long; /* long as received from the net */
typedef uint32 n_time; /* ms since 00:00 GMT, byte rev */
#ifdef _NETWORK_STACK
#ifdef _KERNEL_MODE
#define iptime() (htonl((uint32)real_time_clock_usecs()))
#endif /* _NETWORK_STACK */
#endif /* _KERNEL_MODE */
#endif /* NETINET_IN_SYSTM_H */

View File

@ -2,8 +2,8 @@
#ifndef NETINET_IN_VAR_H
#define NETINET_IN_VAR_H
#include "netinet/in.h"
#include "net/if.h"
#include <netinet/in.h>
#include <net/if.h>
struct in_ifaddr {
struct ifaddr ia_ifa;
@ -37,28 +37,32 @@ struct in_aliasreq {
struct in_multi {
struct in_addr inm_addr;
struct ifnet *inm_ifp;
struct in_addr inm_addr;
struct ifnet *inm_ifp;
struct in_ifaddr *inm_ia;
uint inm_refcount;
uint inm_timer;
struct in_multi *next;
uint inm_refcount;
uint inm_timer;
struct in_multi *next;
struct in_multi **prev;
uint inm_state;
uint inm_state;
};
/*
* Given a pointer to an in_ifaddr (ifaddr),
* return a pointer to the addr as a sockaddr_in.
*/
#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
struct in_ifaddr *in_ifaddr;
#ifdef _KERNEL_MODE
int in_control(struct socket *so, int cmd, caddr_t data, struct ifnet *ifp);
int in_ifinit(struct ifnet *dev, struct in_ifaddr *ia, struct sockaddr_in *sin,
#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
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,
int scrub);
int inetctlerr(int cmd);
struct in_ifaddr *get_primary_addr(void);
int inetctlerr(int cmd);
struct in_ifaddr *get_primary_addr(void);
#endif
#endif /* NETINET_IN_VAR_H */

View File

@ -2,15 +2,14 @@
* definitions for ipv4 protocol
*/
#ifndef NETINET_IP_H
#define NETINET_IP_H
#ifndef _NETINET_IP_H
#define _NETINET_IP_H
#include <ByteOrder.h>
//#include <ByteOrder.h>
#include "sys/mbuf.h"
#include "net_misc.h"
#include "netinet/in_systm.h"
#include "netinet/in.h"
#include <mbuf.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
/* Based on RFC 791 */

View File

@ -37,10 +37,9 @@
#ifndef NETINET_IP_ICMP_H
#define NETINET_IP_ICMP_H
#include <ByteOrder.h>
#include <endian.h>
#include "net_misc.h"
#include "netinet/in.h"
#include <netinet/in.h>
struct icmp {
uint8 icmp_type;

View File

@ -37,14 +37,14 @@
#ifndef NETINET_IP_VAR_H
#define NETINET_IP_VAR_H
#include "sys/socket.h"
#include <sys/socket.h>
/*
* Overlay for ip header used by other protocols (tcp, udp).
*/
struct ipovly {
caddr_t ih_next;
caddr_t ih_prev;
char * ih_next;
char * ih_prev;
uint8 ih_x1; /* (unused) */
uint8 ih_pr; /* protocol */
uint16 ih_len; /* protocol length */
@ -138,7 +138,7 @@ struct ipstat {
int32 ips_outhwcsum; /* hardware checksummed on output */
};
#ifdef _NETWORK_STACK
#ifdef _KERNEL_MODE
#define IP_FORWARDING 0x1 /* most of ip header exists */
#define IP_RAWOUTPUT 0x2 /* raw ip header exists */
@ -148,8 +148,15 @@ struct ipstat {
struct ipstat ipstat;
void ip_stripoptions (struct mbuf *, struct mbuf *);
void ipv4_input(struct mbuf *, int);
int ipv4_output(struct mbuf *, struct mbuf *, struct route *, int, void *);
int ipv4_ctloutput(int, struct socket *, int, int, struct mbuf **);
#endif /* _NETWORK_STACK */
int ip_dooptions(struct mbuf *);
void ip_stripoptions (struct mbuf *, struct mbuf *);
struct mbuf *ip_srcroute(void);
#endif /* _KERNEL_MODE */
#endif /* NETINET_IP_VAR_H */