// // Interface for static routing // - interface class patterned after route(8) (Linux man page) // - the two main operations are "add" and "del" // // route [-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw] // [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] // [reinstate] [[dev] If] // // route [-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm] // [metric N] [[dev] If] // class Ipv4RouteMetrics { // This will be a class to allow to pass route metrics across the API, // such as "metric", "mss", "window", "irtt", "flags (mod, dyn, reinstate) } class Ipv4RouteObject; // analogous to routing struct in kernel that holds // state for the route; used to fetch at the API class Ipv4Route : public Object { public: static const InterfaceId iid; virtual void AddHostRoute (Ipv4Address target, Ipv4Mask netmask, Ipv4Address gateway) = 0; virtual void AddHostRoute (Ipv4Address target, Ipv4Mask netmask, uint32_t interface) = 0; virtual void AddNetworkRoute (Ipv4Address target, Ipv4Mask netmask, Ipv4Address gateway) = 0; virtual void AddNetworkRoute (Ipv4Address target, Ipv4Mask netmask, uint32_t interface) = 0; // Define future variants of the above that allow an Ipv4RouteMetrics to // also be passed virtual void AddDefaultRoute (Ipv4Address gateway) = 0; virtual void AddDefaultRoute (Ipv4Address gateway, uint32_t interface) = 0; virtual void DelHostRoute (Ipv4Address target) = 0; virtual void DelHostRoute (Ipv4Address target, Ipv4Mask netmask, Ipv4Address gateway) = 0; virtual void DelHostRoute (Ipv4Address target, Ipv4Mask netmask, uint32_t interface) = 0; virtual void DelNetworkRoute (Ipv4Address target, Ipv4Mask netmask) = 0; virtual void DelNetworkRoute (Ipv4Address target, Ipv4Mask netmask, Ipv4Address gateway) = 0; virtual void DelNetworkRoute (Ipv4Address target, Ipv4Mask netmask, uint32_t interface) = 0; virtual void DelDefaultRoute (void) = 0; virtual void DelInterfaceRoutes (uint32_t interface) = 0; /** * \returns the number of entries in the routing table. */ virtual uint32_t GetNRoutes (void) = 0; /** * \param i index of route to return * \returns the route whose index is i */ virtual Ipv4RouteObject *GetRoute (uint32_t i) = 0;