You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
852 B
Go
58 lines
852 B
Go
1 year ago
|
package common
|
||
|
|
||
|
type NetIdentity struct {
|
||
|
SSI uint32
|
||
|
MNC uint16
|
||
|
MCC uint16
|
||
|
}
|
||
|
|
||
|
func (identity *NetIdentity) IsValid() bool {
|
||
|
return identity.SSI > 0
|
||
|
}
|
||
|
|
||
|
type TetraFlexAddressKind byte
|
||
|
|
||
|
const (
|
||
|
SSI TetraFlexAddressKind = 0
|
||
|
UserNo TetraFlexAddressKind = 1
|
||
|
)
|
||
|
|
||
|
type TetraFlexAddress struct {
|
||
|
Kind TetraFlexAddressKind
|
||
|
UserNo string
|
||
|
TSI NetIdentity
|
||
|
}
|
||
|
|
||
|
func NewAddress() (addr *TetraFlexAddress) {
|
||
|
return &TetraFlexAddress{
|
||
|
Kind: SSI,
|
||
|
UserNo: "",
|
||
|
TSI: NetIdentity{
|
||
|
SSI: 0,
|
||
|
MNC: 0,
|
||
|
MCC: 0,
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
func NewAddressFromSSINumber(ssi uint16) (addr *TetraFlexAddress) {
|
||
|
return &TetraFlexAddress{
|
||
|
Kind: SSI,
|
||
|
UserNo: "",
|
||
|
TSI: NetIdentity{
|
||
|
SSI: uint32(ssi),
|
||
|
MNC: 0,
|
||
|
MCC: 0,
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var TetraFlexAddressEmpty = TetraFlexAddress{
|
||
|
Kind: SSI,
|
||
|
UserNo: "",
|
||
|
TSI: NetIdentity{
|
||
|
SSI: 0,
|
||
|
MNC: 0,
|
||
|
MCC: 0,
|
||
|
},
|
||
|
}
|