teldata

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2021 License: MIT Imports: 4 Imported by: 1

README

teldata

General data format for telecommunication.

Below format are provided.

  • E.164
  • TBCD
  • IMSI

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type E164

type E164 TBCD

E164 value

func B2E164

func B2E164(b []byte) (m E164, e error)

B2E164 makes E164 from this TBCD value

func ParseE164

func ParseE164(s string) (m E164, e error)

ParseE164 makes E164 data from string

func (E164) Bytes

func (m E164) Bytes() []byte

Bytes returns TBCD format byte data

func (E164) Length

func (m E164) Length() int

Length of this E164

func (E164) MarshalJSON

func (m E164) MarshalJSON() ([]byte, error)

MarshalJSON provide custom marshaller

func (E164) String

func (m E164) String() string

func (E164) UnmarshalJSON

func (m E164) UnmarshalJSON(b []byte) (e error)

UnmarshalJSON provide custom marshaller

type IMSI

type IMSI string

IMSI value

func B2IMSI

func B2IMSI(b []byte) (m IMSI, e error)

B2IMSI makes IMSI from this TBCD value

func ParseIMSI

func ParseIMSI(s string) (IMSI, error)

ParseIMSI makes IMSI data from string

func (IMSI) Bytes

func (i IMSI) Bytes() []byte

Bytes returns TBCD format byte data

func (IMSI) Length

func (i IMSI) Length() int

Length of this IMSI

func (IMSI) MCC

func (i IMSI) MCC() string

MCC value of this IMSI

func (IMSI) MNC2

func (i IMSI) MNC2() string

MNC2 return 2 charactor MNC value of this IMSI

func (IMSI) MNC3

func (i IMSI) MNC3() string

MNC3 return 2 charactor MNC value of this IMSI

func (IMSI) MarshalJSON

func (i IMSI) MarshalJSON() ([]byte, error)

MarshalJSON provide custom marshaller

func (IMSI) String

func (i IMSI) String() string

func (IMSI) UnmarshalJSON

func (i IMSI) UnmarshalJSON(b []byte) (e error)

UnmarshalJSON provide custom marshaller

type InvalidDataError

type InvalidDataError struct {
	Name  string
	Bytes []byte
}

InvalidDataError show invalid data

func (InvalidDataError) Error

func (e InvalidDataError) Error() string

type TBCD

type TBCD []byte

TBCD is Telephony Binary Coded Decimal value that is defined in TS29.002.

TBCD-STRING ::= OCTET STRING

This type (Telephony Binary Coded Decimal String) is used to represent several digits from 0 through 9, *, #, a, b, c, two digits per octet, each digit encoded 0000 to 1001 (0 to 9), 1010 (*), 1011 (#), 1100 (a), 1101 (b) or 1110 (c); 1111 used as filler when there is an odd number of digits. bits 8765 of octet n encoding digit 2n bits 4321 of octet n encoding digit 2(n-1) +1

func ParseTBCD

func ParseTBCD(s string) (TBCD, error)

ParseTBCD create TBCD value from string

func (TBCD) Bytes

func (t TBCD) Bytes() []byte

Bytes return byte data

func (TBCD) Length

func (t TBCD) Length() int

Length return length of the TBCD digit

func (TBCD) MarshalJSON

func (t TBCD) MarshalJSON() ([]byte, error)

MarshalJSON provide custom marshaller

func (TBCD) String

func (t TBCD) String() string

String return string value of the TBCD digit

func (TBCD) UnmarshalJSON

func (t TBCD) UnmarshalJSON(b []byte) (e error)

UnmarshalJSON provide custom marshaller

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL