/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000,2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* retransmission behavior and are included in the routing structure.
*/
struct rt_metrics {
- u_long rmx_locks; /* Kernel must leave these values alone */
- u_long rmx_mtu; /* MTU for this path */
- u_long rmx_hopcount; /* max hops expected */
- int32_t rmx_expire; /* lifetime for route, e.g. redirect */
- u_long rmx_recvpipe; /* inbound delay-bandwidth product */
- u_long rmx_sendpipe; /* outbound delay-bandwidth product */
- u_long rmx_ssthresh; /* outbound gateway buffer limit */
- u_long rmx_rtt; /* estimated round trip time */
- u_long rmx_rttvar; /* estimated rtt variance */
- u_long rmx_pksent; /* packets sent using this route */
- u_long rmx_filler[4]; /* will be used for T/TCP later */
+ u_int32_t rmx_locks; /* Kernel must leave these values alone */
+ u_int32_t rmx_mtu; /* MTU for this path */
+ u_int32_t rmx_hopcount; /* max hops expected */
+ int32_t rmx_expire; /* lifetime for route, e.g. redirect */
+ u_int32_t rmx_recvpipe; /* inbound delay-bandwidth product */
+ u_int32_t rmx_sendpipe; /* outbound delay-bandwidth product */
+ u_int32_t rmx_ssthresh; /* outbound gateway buffer limit */
+ u_int32_t rmx_rtt; /* estimated round trip time */
+ u_int32_t rmx_rttvar; /* estimated rtt variance */
+ u_int32_t rmx_pksent; /* packets sent using this route */
+ u_int32_t rmx_filler[4]; /* will be used for T/TCP later */
};
/*
* rmx_rtt and rmx_rttvar are stored as microseconds;
- * RTTTOPRHZ(rtt) converts to a value suitable for use
- * by a protocol slowtimo counter.
*/
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
-#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
/*
* XXX kernel function pointer `rt_output' is visible to applications.
struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */
struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */
int (*rt_output)(struct ifnet *, struct mbuf *,
- struct sockaddr *, struct rtentry *);
+ struct sockaddr *, struct rtentry *);
/* output routine for this (rt,if) */
- struct rtentry *rt_parent; /* cloning parent of this route */
+ struct rtentry *rt_parent; /* cloning parent of this route */
u_long generation_id; /* route generation id */
};
#endif /* PRIVATE */
#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
/* 0x80000 unused */
#define RTF_PINNED 0x100000 /* future use */
-#define RTF_LOCAL 0x200000 /* route represents a local address */
+#define RTF_LOCAL 0x200000 /* route represents a local address */
#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
+#define RTF_TRACKREFS 0x1000000 /* Debug references and releases */
/* 0x1000000 and up unassigned */
/*
* Structures for routing messages.
*/
struct rt_msghdr {
- u_short rtm_msglen; /* to skip over non-understood messages */
- u_char rtm_version; /* future binary compatibility */
- u_char rtm_type; /* message type */
- u_short rtm_index; /* index for associated ifp */
- int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
- int rtm_addrs; /* bitmask identifying sockaddrs in msg */
- pid_t rtm_pid; /* identify sender */
- int rtm_seq; /* for sender to identify action */
- int rtm_errno; /* why failed */
- int rtm_use; /* from rtentry */
- u_long rtm_inits; /* which metrics we are initializing */
- struct rt_metrics rtm_rmx; /* metrics themselves */
+ u_short rtm_msglen; /* to skip over non-understood messages */
+ u_char rtm_version; /* future binary compatibility */
+ u_char rtm_type; /* message type */
+ u_short rtm_index; /* index for associated ifp */
+ int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
+ int rtm_addrs; /* bitmask identifying sockaddrs in msg */
+ pid_t rtm_pid; /* identify sender */
+ int rtm_seq; /* for sender to identify action */
+ int rtm_errno; /* why failed */
+ int rtm_use; /* from rtentry */
+ u_int32_t rtm_inits; /* which metrics we are initializing */
+ struct rt_metrics rtm_rmx; /* metrics themselves */
};
struct rt_msghdr2 {
- u_short rtm_msglen; /* to skip over non-understood messages */
- u_char rtm_version; /* future binary compatibility */
- u_char rtm_type; /* message type */
- u_short rtm_index; /* index for associated ifp */
- int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
- int rtm_addrs; /* bitmask identifying sockaddrs in msg */
- int32_t rtm_refcnt; /* reference count */
- int rtm_parentflags; /* flags of the parent route */
- int rtm_reserved; /* reserved field set to 0 */
- int rtm_use; /* from rtentry */
- u_long rtm_inits; /* which metrics we are initializing */
- struct rt_metrics rtm_rmx; /* metrics themselves */
+ u_short rtm_msglen; /* to skip over non-understood messages */
+ u_char rtm_version; /* future binary compatibility */
+ u_char rtm_type; /* message type */
+ u_short rtm_index; /* index for associated ifp */
+ int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
+ int rtm_addrs; /* bitmask identifying sockaddrs in msg */
+ int32_t rtm_refcnt; /* reference count */
+ int rtm_parentflags; /* flags of the parent route */
+ int rtm_reserved; /* reserved field set to 0 */
+ int rtm_use; /* from rtentry */
+ u_int32_t rtm_inits; /* which metrics we are initializing */
+ struct rt_metrics rtm_rmx; /* metrics themselves */
};
struct ifmultiaddr;
struct proc;
-void route_init(void);
-void rt_ifmsg(struct ifnet *);
-void rt_missmsg(int, struct rt_addrinfo *, int, int);
-void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
-void rt_newmaddrmsg(int, struct ifmultiaddr *);
-int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *);
-void rtalloc(struct route *);
-void rtalloc_ign(struct route *, u_long);
-struct rtentry *
- rtalloc1(struct sockaddr *, int, u_long);
-struct rtentry *
- rtalloc1_locked(const struct sockaddr *, int, u_long);
-void rtfree(struct rtentry *);
-void rtfree_locked(struct rtentry *);
-void rtref(struct rtentry *);
+__private_extern__ int rttrash;
+
+extern void route_init(void) __attribute__((section("__TEXT, initcode")));
+extern void rt_ifmsg(struct ifnet *);
+extern void rt_missmsg(int, struct rt_addrinfo *, int, int);
+extern void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
+extern void rt_newmaddrmsg(int, struct ifmultiaddr *);
+extern int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *);
+extern void rtalloc(struct route *);
+extern void rtalloc_ign(struct route *, u_long);
+extern void rtalloc_ign_locked(struct route *, u_long );
+extern struct rtentry *rtalloc1(struct sockaddr *, int, u_long);
+extern struct rtentry *rtalloc1_locked(struct sockaddr *, int, u_long);
+extern void rtfree(struct rtentry *);
+extern void rtfree_locked(struct rtentry *);
+extern void rtref(struct rtentry *);
/*
* rtunref will decrement the refcount, rtfree will decrement and free if
* the refcount has reached zero and the route is not up.
* Unless you have good reason to do otherwise, use rtfree.
*/
-void rtunref(struct rtentry *);
-void rtsetifa(struct rtentry *, struct ifaddr *);
-int rtinit(struct ifaddr *, int, int);
-int rtinit_locked(struct ifaddr *, int, int);
-int rtioctl(int, caddr_t, struct proc *);
-void rtredirect(struct sockaddr *, struct sockaddr *,
- struct sockaddr *, int, struct sockaddr *, struct rtentry **);
-int rtrequest(int, struct sockaddr *,
- struct sockaddr *, struct sockaddr *, int, struct rtentry **);
-int rtrequest_locked(int, struct sockaddr *,
- struct sockaddr *, struct sockaddr *, int, struct rtentry **);
+extern void rtunref(struct rtentry *);
+extern void rtsetifa(struct rtentry *, struct ifaddr *);
+extern int rtinit(struct ifaddr *, int, int);
+extern int rtinit_locked(struct ifaddr *, int, int);
+extern int rtioctl(int, caddr_t, struct proc *);
+extern void rtredirect(struct sockaddr *, struct sockaddr *,
+ struct sockaddr *, int, struct sockaddr *, struct rtentry **);
+extern int rtrequest(int, struct sockaddr *,
+ struct sockaddr *, struct sockaddr *, int, struct rtentry **);
+extern int rtrequest_locked(int, struct sockaddr *,
+ struct sockaddr *, struct sockaddr *, int, struct rtentry **);
+extern struct rtentry *rte_alloc(void);
+extern void rte_free(struct rtentry *);
#endif KERNEL_PRIVATE
#endif