crossvm_codec

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ontology is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The ontology. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	ByteArrayType byte = 0x00
	StringType    byte = 0x01
	AddressType   byte = 0x02
	BooleanType   byte = 0x03
	IntType       byte = 0x04
	H256Type      byte = 0x05

	//reserved for other types
	ListType byte = 0x10

	MAX_PARAM_LENGTH      = 1024
	VERSION          byte = 0
)

Variables

View Source
var ERROR_PARAM_FORMAT = fmt.Errorf("error param format")
View Source
var ERROR_PARAM_NOT_SUPPORTED_TYPE = fmt.Errorf("error param format:not supported type")

Functions

func DecodeValue

func DecodeValue(source *common.ZeroCopySource) (interface{}, error)

func DeserializeCallParam

func DeserializeCallParam(input []byte) (interface{}, error)

input byte array should be the following format version(1byte) + type(1byte) + data...

func DeserializeNotify

func DeserializeNotify(input []byte) interface{}

func EncodeAddress

func EncodeAddress(sink *common.ZeroCopySink, addr common.Address)

func EncodeBigInt

func EncodeBigInt(sink *common.ZeroCopySink, intval *big.Int) error

func EncodeBool

func EncodeBool(sink *common.ZeroCopySink, b bool)

func EncodeBytes

func EncodeBytes(sink *common.ZeroCopySink, buf []byte)

func EncodeH256

func EncodeH256(sink *common.ZeroCopySink, hash common.Uint256)

func EncodeInt128

func EncodeInt128(sink *common.ZeroCopySink, val common.I128)

func EncodeList

func EncodeList(sink *common.ZeroCopySink, list []interface{}) error

func EncodeString

func EncodeString(sink *common.ZeroCopySink, buf string)

func EncodeValue

func EncodeValue(value interface{}) ([]byte, error)

currently only used by test case

Types

This section is empty.

Jump to

Keyboard shortcuts

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