pdutext

package
v0.0.0-...-b401bab Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2016 License: MIT Imports: 3 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

func Decode

func Decode(typ DataCoding, text []byte) []byte

Decode text.

func Encode

func Encode(typ DataCoding, text []byte) []byte

Encode text.

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 (
	Latin1Type DataCoding = 0x03
	UCS2Type   DataCoding = 0x08
)

Supported text codecs.

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