use std::net::IpAddr;
use super::{AddressAddRequest, AddressDelRequest, AddressGetRequest};
use crate::Handle;
use netlink_packet_route::AddressMessage;
pub struct AddressHandle(Handle);
impl AddressHandle {
pub fn new(handle: Handle) -> Self {
AddressHandle(handle)
}
pub fn get(&self) -> AddressGetRequest {
AddressGetRequest::new(self.0.clone())
}
pub fn add(&self, index: u32, address: IpAddr, prefix_len: u8) -> AddressAddRequest {
AddressAddRequest::new(self.0.clone(), index, address, prefix_len)
}
pub fn del(&self, address: AddressMessage) -> AddressDelRequest {
AddressDelRequest::new(self.0.clone(), address)
}
}