Skip to content

mmrs: bearer management #403

@cachebag

Description

@cachebag

implement bearer (data session) create/connect/disconnect/delete flow.

bearer config builder

impl BearerConfig {
    pub fn new(apn: &str) -> Self;
    pub fn with_ip_type(self, ip_type: IpType) -> Self;
    pub fn with_credentials(self, user: &str, password: &str) -> Self;
    pub fn with_auth_method(self, method: AuthMethod) -> Self;
    pub fn with_roaming(self, allow: bool) -> Self;
}

api methods

impl ModemManager {
    pub async fn list_bearers(&self) -> Result<Vec<Bearer>>;
    pub async fn create_bearer(&self, config: &BearerConfig) -> Result<Bearer>;
    pub async fn delete_bearer(&self, path: &str) -> Result<()>;
}

impl Bearer {
    pub async fn connect(&self) -> Result<()>;
    pub async fn disconnect(&self) -> Result<()>;
}

ip config extraction

parse Ip4Config / Ip6Config dicts from bearer properties:

pub struct Ip4Config {
    pub address: String,
    pub prefix: u32,
    pub gateway: Option<String>,
    pub dns: Vec<String>,
    pub mtu: Option<u32>,
}

bearer stats

pub struct BearerStats {
    pub rx_bytes: u64,
    pub tx_bytes: u64,
    pub duration: u32,
}

files

  • mmrs/src/api/builders/bearer.rs
  • mmrs/src/core/bearer.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestmmrsmodemmanager bindings cratemodemmodem device and bearer management

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions