Giter Club home page Giter Club logo

Comments (4)

mogaika avatar mogaika commented on June 5, 2024

Also Time Threshold currently converted as uint32, but it should be treated as time.Duration.
Overall I like uint32 more, because it enforces you to think about rounding to seconds correctly, but for consistency it probably should be time.Duration.

from go-pfcp.

wmnsk avatar wmnsk commented on June 5, 2024

Thanks, fixed in #123.

Overall I like uint32 more, because it enforces you to think about rounding to seconds correctly, but for consistency it probably should be time.Duration.

I understand it, and when passing values from a protocol to another this "friendliness" would bother as well. As you may already know, there is ie.New function as a generic constructor for creating anything by hand, but this time I also exported these functions to make manual creation easier (and updated README). For value retrieval, I may add something to return "raw" type or may not - for now I don't think it's worth, but let me know your opinion if any.

// NewUint8ValIE creates a new IE with uint8 value.
func NewUint8IE(itype uint16, v uint8) *IE {
	return newUint8ValIE(itype, v)
}

// NewUint16ValIE creates a new IE with uint16 value.
func NewUint16IE(itype uint16, v uint16) *IE {
	return newUint16ValIE(itype, v)
}

// NewUint32ValIE creates a new IE with uint32 value.
func NewUint32IE(itype uint16, v uint32) *IE {
	return newUint32ValIE(itype, v)
}

// NewUint64ValIE creates a new IE with uint64 value.
func NewUint64IE(itype uint16, v uint64) *IE {
	return newUint64ValIE(itype, v)
}

// NewStringIE creates a new IE with string value.
func NewStringIE(itype uint16, v string) *IE {
	return newStringIE(itype, v)
}

// NewFQDNIE creates a new IE with FQDN value.
func NewFQDNIE(itype uint16, v string) *IE {
	return newFQDNIE(itype, v)
}

from go-pfcp.

mogaika avatar mogaika commented on June 5, 2024

Indeed it is good idea to expose some common methods like these, especially this could help with vendor ies

from go-pfcp.

wmnsk avatar wmnsk commented on June 5, 2024

Great, thanks for your feedback.
I haven't considered much about vendor-specific IEs so far, but now I'm wondering to add a value retrieving methods like ValueAsUint32() for easier handling of vendor-specific IEs. I guess current users already have such functions on their own, but anyway.

from go-pfcp.

Related Issues (20)

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.