mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-23 16:23:24 +00:00
uevent should be format Enum of smoltcp socket should be optimized. need to add interface for routing subsys actix is still not abled to run. clean some casual added code to other places
31 lines
930 B
Rust
31 lines
930 B
Rust
//! # 网络模块
|
||
//! 注意,net模块下,为了方便导入,模块细分,且共用部分模块直接使用
|
||
//! `pub use`导出,导入时也常见`use crate::net::socket::*`的写法,
|
||
//! 敬请注意。
|
||
use core::{
|
||
fmt::{self, Debug},
|
||
sync::atomic::AtomicUsize,
|
||
};
|
||
|
||
use alloc::{collections::BTreeMap, sync::Arc};
|
||
|
||
use crate::{driver::net::Iface, libs::rwlock::RwLock};
|
||
|
||
pub mod event_poll;
|
||
pub mod net_core;
|
||
pub mod socket;
|
||
pub mod syscall;
|
||
pub mod syscall_util;
|
||
|
||
lazy_static! {
|
||
/// # 所有网络接口的列表
|
||
/// 这个列表在中断上下文会使用到,因此需要irqsave
|
||
pub static ref NET_DEVICES: RwLock<BTreeMap<usize, Arc<dyn Iface>>> = RwLock::new(BTreeMap::new());
|
||
}
|
||
|
||
/// 生成网络接口的id (全局自增)
|
||
pub fn generate_iface_id() -> usize {
|
||
static IFACE_ID: AtomicUsize = AtomicUsize::new(0);
|
||
return IFACE_ID.fetch_add(1, core::sync::atomic::Ordering::SeqCst);
|
||
}
|