-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate the southbound into tx.rs and rx.rs modules. Separation of concerns and also readability. Signed-off-by: Paul Wekesa <[email protected]>
- Loading branch information
Showing
4 changed files
with
88 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// Copyright (c) The Holo Core Contributors | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// Sponsored by NLnet as part of the Next Generation Internet initiative. | ||
// See: https://nlnet.nl/NGI0 | ||
// | ||
|
||
pub mod rx; | ||
pub mod tx; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// Copyright (c) The Holo Core Contributors | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
use holo_utils::{ | ||
ibus::{IbusMsg, IbusSender}, | ||
southbound::{ | ||
InterfaceIpAddRequestMsg, InterfaceIpDeleteRequestMsg, MacvlanCreateMsg, | ||
}, | ||
}; | ||
use ipnetwork::IpNetwork; | ||
|
||
pub(crate) fn create_macvlan_iface( | ||
name: String, | ||
parent_name: String, | ||
mac_address: [u8; 6], | ||
ibus_tx: &IbusSender, | ||
) { | ||
let msg = MacvlanCreateMsg { | ||
parent_name, | ||
name, | ||
mac_address: Some(mac_address), | ||
}; | ||
let _ = ibus_tx.send(IbusMsg::CreateMacVlan(msg)); | ||
} | ||
|
||
pub(crate) fn mvlan_delete(ifindex: u32, ibus_tx: &IbusSender) { | ||
let _ = ibus_tx.send(IbusMsg::InterfaceDeleteRequest(ifindex)); | ||
} | ||
|
||
// adds an address to an interface | ||
pub(crate) fn addr_add(ifindex: u32, addr: IpNetwork, ibus_tx: &IbusSender) { | ||
let msg = InterfaceIpAddRequestMsg { ifindex, addr }; | ||
let _ = ibus_tx.send(IbusMsg::InterfaceIpAddRequest(msg)); | ||
} | ||
|
||
// removes a specific address from an interface | ||
pub(crate) fn addr_del(ifindex: u32, addr: IpNetwork, ibus_tx: &IbusSender) { | ||
let msg = InterfaceIpDeleteRequestMsg { ifindex, addr }; | ||
let _ = ibus_tx.send(IbusMsg::InterfaceIpDeleteRequest(msg)); | ||
} |