Giter Site home page Giter Site logo

Comments (1)

ivanovuri avatar ivanovuri commented on August 25, 2024

Hi friend,
Looks like library simply misses this logic and to create VSA containing reply we should craft packet manually.
To create this type of reply:
Снимок экрана от 2023-04-11 17-42-21
We need something like this:

fn hardcode_bytes_vsa() -> Vec<u8> {
    // let avp_type = 26 as u8;
    // let avp_length = 23 as u8;
    let mut avp_vendor_id = 4874_i32.to_be_bytes().to_vec();
    let vsa_type = 65 as u8;
    let vsa_length = 17 as u8;
    let vsa_tag = 5 as u8;
    let mut vsa_usa = "bar(1000,5441)".as_bytes().to_vec();

    let mut vsa: Vec<u8> = Vec::new();

    vsa.append(&mut avp_vendor_id);
    vsa.push(vsa_type);
    vsa.push(vsa_length);
    vsa.push(vsa_tag);
    vsa.append(&mut vsa_usa);

    vsa
}

After that construct with the help of from_bytes function:

let vsa = AVP::from_bytes(VENDOR_SPECIFIC_TYPE, &hardcode_bytes_vsa());
_ = p.add(vsa);

Please note that you should omit type and length values. Type is specified as first parameter and length is calculated automatically.

from radius-rs.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.