Documentation
pub mod buffer_pool;
pub mod error;
pub mod tcp;
pub mod udp;

pub use buffer_pool::{BufferPool, BufferPoolConfig, SocketBufferAllocation};
pub use error::{NetworkError, Result};

use crate::sync::once::OnceLock;
use alloc::sync::Arc;

/// Global buffer pool for all network operations  
pub static GLOBAL_BUFFER_POOL: OnceLock<Arc<BufferPool>> = OnceLock::new();

/// Get the global buffer pool, initializing if needed
pub async fn get_buffer_pool() -> &'static Arc<BufferPool> {
    GLOBAL_BUFFER_POOL
        .get_or_init(|| async { Arc::new(BufferPool::new(BufferPoolConfig::default())) })
        .await
}