Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route/route_ctl.h
Show All 29 Lines | |||||
/* | /* | ||||
* This header file contains public functions and structures used for | * This header file contains public functions and structures used for | ||||
* routing table manipulations. | * routing table manipulations. | ||||
*/ | */ | ||||
#ifndef _NET_ROUTE_ROUTE_CTL_H_ | #ifndef _NET_ROUTE_ROUTE_CTL_H_ | ||||
#define _NET_ROUTE_ROUTE_CTL_H_ | #define _NET_ROUTE_ROUTE_CTL_H_ | ||||
#include <sys/ck.h> | |||||
struct rib_cmd_info { | struct rib_cmd_info { | ||||
uint8_t rc_cmd; /* RTM_ADD|RTM_DEL|RTM_CHANGE */ | uint8_t rc_cmd; /* RTM_ADD|RTM_DEL|RTM_CHANGE */ | ||||
uint8_t spare[3]; | uint8_t spare[3]; | ||||
uint32_t rc_nh_weight; /* new nhop weight */ | uint32_t rc_nh_weight; /* new nhop weight */ | ||||
struct rtentry *rc_rt; /* Target entry */ | struct rtentry *rc_rt; /* Target entry */ | ||||
struct nhop_object *rc_nh_old; /* Target nhop OR mpath */ | struct nhop_object *rc_nh_old; /* Target nhop OR mpath */ | ||||
struct nhop_object *rc_nh_new; /* Target nhop OR mpath */ | struct nhop_object *rc_nh_new; /* Target nhop OR mpath */ | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | const struct rtentry *rib_lookup_prefix(uint32_t fibnum, int family, | ||||
struct route_nhop_data *rnd); | struct route_nhop_data *rnd); | ||||
const struct rtentry *rib_lookup_lpm(uint32_t fibnum, int family, | const struct rtentry *rib_lookup_lpm(uint32_t fibnum, int family, | ||||
const struct sockaddr *dst, struct route_nhop_data *rnd); | const struct sockaddr *dst, struct route_nhop_data *rnd); | ||||
/* rtentry accessors */ | /* rtentry accessors */ | ||||
bool rt_is_host(const struct rtentry *rt); | bool rt_is_host(const struct rtentry *rt); | ||||
sa_family_t rt_get_family(const struct rtentry *); | sa_family_t rt_get_family(const struct rtentry *); | ||||
struct nhop_object *rt_get_raw_nhop(const struct rtentry *rt); | struct nhop_object *rt_get_raw_nhop(const struct rtentry *rt); | ||||
void rt_get_rnd(const struct rtentry *rt, struct route_nhop_data *rnd); | |||||
#ifdef INET | #ifdef INET | ||||
struct in_addr; | struct in_addr; | ||||
void rt_get_inet_prefix_plen(const struct rtentry *rt, struct in_addr *paddr, | void rt_get_inet_prefix_plen(const struct rtentry *rt, struct in_addr *paddr, | ||||
int *plen, uint32_t *pscopeid); | int *plen, uint32_t *pscopeid); | ||||
void rt_get_inet_prefix_pmask(const struct rtentry *rt, struct in_addr *paddr, | void rt_get_inet_prefix_pmask(const struct rtentry *rt, struct in_addr *paddr, | ||||
struct in_addr *pmask, uint32_t *pscopeid); | struct in_addr *pmask, uint32_t *pscopeid); | ||||
struct rtentry *rt_get_inet_parent(uint32_t fibnum, struct in_addr addr, int plen); | struct rtentry *rt_get_inet_parent(uint32_t fibnum, struct in_addr addr, int plen); | ||||
#endif | #endif | ||||
Show All 14 Lines | |||||
uint32_t nhops_get_count(struct rib_head *rh); | uint32_t nhops_get_count(struct rib_head *rh); | ||||
/* Multipath */ | /* Multipath */ | ||||
struct weightened_nhop; | struct weightened_nhop; | ||||
const struct weightened_nhop *nhgrp_get_nhops(const struct nhgrp_object *nhg, | const struct weightened_nhop *nhgrp_get_nhops(const struct nhgrp_object *nhg, | ||||
uint32_t *pnum_nhops); | uint32_t *pnum_nhops); | ||||
uint32_t nhgrp_get_count(struct rib_head *rh); | uint32_t nhgrp_get_count(struct rib_head *rh); | ||||
int nhgrp_get_group(struct rib_head *rh, struct weightened_nhop *wn, int num_nhops, | |||||
uint32_t uidx, struct nhgrp_object **pnhg); | |||||
/* Route subscriptions */ | /* Route subscriptions */ | ||||
enum rib_subscription_type { | enum rib_subscription_type { | ||||
RIB_NOTIFY_IMMEDIATE, | RIB_NOTIFY_IMMEDIATE, | ||||
RIB_NOTIFY_DELAYED | RIB_NOTIFY_DELAYED | ||||
}; | }; | ||||
struct rib_subscription; | struct rib_subscription; | ||||
typedef void rib_subscription_cb_t(struct rib_head *rnh, struct rib_cmd_info *rc, | typedef void rib_subscription_cb_t(struct rib_head *rnh, struct rib_cmd_info *rc, | ||||
void *arg); | void *arg); | ||||
struct rib_subscription *rib_subscribe(uint32_t fibnum, int family, | struct rib_subscription *rib_subscribe(uint32_t fibnum, int family, | ||||
rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, | rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, | ||||
bool waitok); | bool waitok); | ||||
struct rib_subscription *rib_subscribe_internal(struct rib_head *rnh, | struct rib_subscription *rib_subscribe_internal(struct rib_head *rnh, | ||||
rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, | rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, | ||||
bool waitok); | bool waitok); | ||||
struct rib_subscription *rib_subscribe_locked(struct rib_head *rnh, | struct rib_subscription *rib_subscribe_locked(struct rib_head *rnh, | ||||
rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type); | rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type); | ||||
void rib_unsubscribe(struct rib_subscription *rs); | void rib_unsubscribe(struct rib_subscription *rs); | ||||
void rib_unsubscribe_locked(struct rib_subscription *rs); | void rib_unsubscribe_locked(struct rib_subscription *rs); | ||||
void rib_notify(struct rib_head *rnh, enum rib_subscription_type type, | void rib_notify(struct rib_head *rnh, enum rib_subscription_type type, | ||||
struct rib_cmd_info *rc); | struct rib_cmd_info *rc); | ||||
/* Event bridge */ | |||||
/* Types of events */ | |||||
#define NLBR_EVENT_ROUTE 1 | |||||
/* Event providers */ | |||||
#define NLBR_PROVIDER_KERNEL 1 | |||||
#define NLBR_PROVIDER_RTSOCK 2 | |||||
#define NLBR_PROVIDER_NETLINK 3 | |||||
struct rib_event_bridge; | |||||
typedef void rib_event_bridge_cb_t(uint32_t event_type, uint32_t fibnum, | |||||
const struct rt_addrinfo *info, const struct rib_cmd_info *rc, void *arg); | |||||
struct rib_event_bridge { | |||||
rib_event_bridge_cb_t *reb_cb; | |||||
void *reb_cb_arg; | |||||
int reb_provider_id; | |||||
CK_STAILQ_ENTRY(rib_event_bridge) reb_link; | |||||
}; | |||||
void rib_bridge_generic_event(int provider_id, uint32_t event_type, uint32_t val1, | |||||
void *ptr1, void *ptr2); | |||||
void rib_bridge_rt_event(int provider_id, uint32_t fibnum, struct rt_addrinfo *info, | |||||
struct rib_cmd_info *rc); | |||||
void rib_bridge_link(struct rib_event_bridge *reb); | |||||
void rib_bridge_unlink(struct rib_event_bridge *reb); | |||||
#endif | #endif |