pdutext

package
v0.0.0-...-c6b7289 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pdutext provides text conversion for PDU fields.

See 2.2.2 from http://opensmpp.org/specs/smppv34_gsmumts_ig_v10.pdf for details.

pdutext supports Latin1 (0x03) and UCS2 (0x08).

Latin1 encoding is Windows-1252 (CP1252) for now, not ISO-8859-1. http://www.i18nqa.com/debug/table-iso8859-1-vs-windows-1252.html

UCS2 is UTF-16-BE. Here be dragons.

TODO(fiorix): Fix this.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	// Type returns the value for the data_coding PDU.
	Type() DataCoding

	// Encode text.
	Encode() []byte

	// Decode text.
	Decode() []byte
}

Codec defines a text codec.

type DataCoding

type DataCoding uint8

DataCoding to define text codecs.

const (
	DefaultType DataCoding = 0x00 // SMSC Default Alphabet
	//	IA5Type       DataCoding = 0x01 // IA5 (CCITT T.50)/ASCII (ANSI X3.4)
	//	BinaryType    DataCoding = 0x02 // Octet unspecified (8-bit binary)
	Latin1Type DataCoding = 0x03 // Latin 1 (ISO-8859-1)
	//	Binary2Type   DataCoding = 0x04 // Octet unspecified (8-bit binary)
	//	JISType       DataCoding = 0x05 // JIS (X 0208-1990)
	ISO88595Type DataCoding = 0x06 // Cyrillic (ISO-8859-5)
	//	ISO88598Type  DataCoding = 0x07 // Latin/Hebrew (ISO-8859-8)
	UCS2Type DataCoding = 0x08 // UCS2 (ISO/IEC-10646)

)

Supported text codecs.

type GSM7

type GSM7 []byte

GSM 7-bit (unpacked)

func (GSM7) Decode

func (s GSM7) Decode() []byte

Decode from GSM 7-bit (unpacked)

func (GSM7) Encode

func (s GSM7) Encode() []byte

Encode to GSM 7-bit (unpacked)

func (GSM7) Type

func (s GSM7) Type() DataCoding

Type implements the Codec interface.

type GSM7Packed

type GSM7Packed []byte

GSM 7-bit (packed)

func (GSM7Packed) Decode

func (s GSM7Packed) Decode() []byte

Decode from GSM 7-bit (packed)

func (GSM7Packed) Encode

func (s GSM7Packed) Encode() []byte

Encode to GSM 7-bit (packed)

func (GSM7Packed) Type

func (s GSM7Packed) Type() DataCoding

Type implements the Codec interface.

type ISO88595

type ISO88595 []byte

ISO88595 text codec.

func (ISO88595) Decode

func (s ISO88595) Decode() []byte

Decode from ISO88595.

func (ISO88595) Encode

func (s ISO88595) Encode() []byte

Encode to ISO88595.

func (ISO88595) Type

func (s ISO88595) Type() DataCoding

Type implements the Codec interface.

type Latin1

type Latin1 []byte

Latin1 text codec.

func (Latin1) Decode

func (s Latin1) Decode() []byte

Decode from Latin1.

func (Latin1) Encode

func (s Latin1) Encode() []byte

Encode to Latin1.

func (Latin1) Type

func (s Latin1) Type() DataCoding

Type implements the Codec interface.

type Raw

type Raw []byte

Raw text codec, no encoding.

func (Raw) Decode

func (s Raw) Decode() []byte

Decode raw text.

func (Raw) Encode

func (s Raw) Encode() []byte

Encode raw text.

func (Raw) Type

func (s Raw) Type() DataCoding

Type implements the Codec interface.

type UCS2

type UCS2 []byte

UCS2 text codec.

func (UCS2) Decode

func (s UCS2) Decode() []byte

Decode from UCS2.

func (UCS2) Encode

func (s UCS2) Encode() []byte

Encode to UCS2.

func (UCS2) Type

func (s UCS2) Type() DataCoding

Type implements the Codec interface.

Jump to

Keyboard shortcuts

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