├── .github └── workflows │ └── go-vet.yml ├── .gitignore ├── LICENSE ├── README.md ├── README_zh_CN.md ├── cgo_util.go ├── client.go ├── client_control.go ├── client_ld.go ├── client_rcb.go ├── client_report.go ├── client_sg.go ├── cmd └── scltool │ ├── cmds │ ├── commands.go │ ├── commands_test.go │ └── complexModel.cid │ └── main.go ├── config.go ├── config_armv7l.go ├── config_armv8.go ├── config_darwinarmv8.go ├── config_linux64.go ├── config_win64.go ├── data_model.go ├── doc.go ├── errors.go ├── fc.go ├── go.mod ├── go.sum ├── libiec61850 ├── inc │ ├── common │ │ └── inc │ │ │ ├── buffer_chain.h │ │ │ ├── byte_buffer.h │ │ │ ├── conversions.h │ │ │ ├── inc_common.go │ │ │ ├── libiec61850_common_api.h │ │ │ ├── libiec61850_platform_includes.h │ │ │ ├── linked_list.h │ │ │ ├── map.h │ │ │ ├── mem_alloc_linked_list.h │ │ │ ├── simple_allocator.h │ │ │ ├── string_map.h │ │ │ └── string_utilities.h │ ├── goose │ │ ├── goose_publisher.h │ │ ├── goose_receiver.h │ │ ├── goose_receiver_internal.h │ │ ├── goose_subscriber.h │ │ ├── iec61850_goose.asn │ │ └── inc_goose.go │ ├── hal │ │ └── inc │ │ │ ├── hal_base.h │ │ │ ├── hal_ethernet.h │ │ │ ├── hal_filesystem.h │ │ │ ├── hal_serial.h │ │ │ ├── hal_socket.h │ │ │ ├── hal_thread.h │ │ │ ├── hal_time.h │ │ │ ├── inc_hal.go │ │ │ ├── lib_memory.h │ │ │ ├── platform_endian.h │ │ │ ├── tls_config.h │ │ │ └── tls_socket.h │ ├── iec61850 │ │ ├── inc │ │ │ ├── iec61850_cdc.h │ │ │ ├── iec61850_client.h │ │ │ ├── iec61850_common.h │ │ │ ├── iec61850_config_file_parser.h │ │ │ ├── iec61850_dynamic_model.h │ │ │ ├── iec61850_model.h │ │ │ ├── iec61850_server.h │ │ │ └── inc_61850.go │ │ └── inc_private │ │ │ ├── control.h │ │ │ ├── iec61850_common_internal.h │ │ │ ├── ied_connection_private.h │ │ │ ├── ied_server_private.h │ │ │ ├── inc_61850_private.go │ │ │ ├── logging.h │ │ │ ├── mms_goose.h │ │ │ ├── mms_mapping.h │ │ │ ├── mms_mapping_internal.h │ │ │ ├── mms_sv.h │ │ │ └── reporting.h │ ├── logging │ │ ├── inc_logging.go │ │ └── logging_api.h │ └── mms │ │ ├── inc │ │ ├── inc_mms.go │ │ ├── iso_connection_parameters.h │ │ ├── mms_client_connection.h │ │ ├── mms_common.h │ │ ├── mms_server.h │ │ ├── mms_type_spec.h │ │ ├── mms_types.h │ │ └── mms_value.h │ │ ├── inc_private │ │ ├── acse.h │ │ ├── asn1_ber_primitive_value.h │ │ ├── ber_decode.h │ │ ├── ber_encoder.h │ │ ├── ber_integer.h │ │ ├── cotp.h │ │ ├── inc_mms_private.go │ │ ├── iso_client_connection.h │ │ ├── iso_presentation.h │ │ ├── iso_server.h │ │ ├── iso_server_private.h │ │ ├── iso_session.h │ │ ├── mms_client_internal.h │ │ ├── mms_common_internal.h │ │ ├── mms_device_model.h │ │ ├── mms_named_variable_list.h │ │ ├── mms_server_connection.h │ │ ├── mms_server_internal.h │ │ ├── mms_server_libinternal.h │ │ ├── mms_value_cache.h │ │ └── mms_value_internal.h │ │ └── iso_mms │ │ └── asn1c │ │ ├── AccessResult.h │ │ ├── Address.h │ │ ├── AlternateAccess.h │ │ ├── AlternateAccessSelection.h │ │ ├── BIT_STRING.h │ │ ├── BOOLEAN.h │ │ ├── ConcludeRequestPDU.h │ │ ├── ConcludeResponsePDU.h │ │ ├── ConfirmedErrorPDU.h │ │ ├── ConfirmedRequestPdu.h │ │ ├── ConfirmedResponsePdu.h │ │ ├── ConfirmedServiceRequest.h │ │ ├── ConfirmedServiceResponse.h │ │ ├── Data.h │ │ ├── DataAccessError.h │ │ ├── DataSequence.h │ │ ├── DefineNamedVariableListRequest.h │ │ ├── DefineNamedVariableListResponse.h │ │ ├── DeleteNamedVariableListRequest.h │ │ ├── DeleteNamedVariableListResponse.h │ │ ├── FloatingPoint.h │ │ ├── GeneralizedTime.h │ │ ├── GetNameListRequest.h │ │ ├── GetNameListResponse.h │ │ ├── GetNamedVariableListAttributesRequest.h │ │ ├── GetNamedVariableListAttributesResponse.h │ │ ├── GetVariableAccessAttributesRequest.h │ │ ├── GetVariableAccessAttributesResponse.h │ │ ├── INTEGER.h │ │ ├── Identifier.h │ │ ├── IndexRangeSeq.h │ │ ├── InformationReport.h │ │ ├── InitRequestDetail.h │ │ ├── InitResponseDetail.h │ │ ├── InitiateErrorPdu.h │ │ ├── InitiateRequestPdu.h │ │ ├── InitiateResponsePdu.h │ │ ├── Integer16.h │ │ ├── Integer32.h │ │ ├── Integer8.h │ │ ├── ListOfVariableSeq.h │ │ ├── MMSString.h │ │ ├── MmsPdu.h │ │ ├── NULL.h │ │ ├── NativeEnumerated.h │ │ ├── NativeInteger.h │ │ ├── OCTET_STRING.h │ │ ├── ObjectClass.h │ │ ├── ObjectName.h │ │ ├── ParameterSupportOptions.h │ │ ├── ReadRequest.h │ │ ├── ReadResponse.h │ │ ├── RejectPDU.h │ │ ├── ScatteredAccessDescription.h │ │ ├── ServiceError.h │ │ ├── ServiceSupportOptions.h │ │ ├── StructComponent.h │ │ ├── TimeOfDay.h │ │ ├── TypeSpecification.h │ │ ├── UTF8String.h │ │ ├── UnconfirmedPDU.h │ │ ├── UnconfirmedService.h │ │ ├── Unsigned16.h │ │ ├── Unsigned32.h │ │ ├── Unsigned8.h │ │ ├── UtcTime.h │ │ ├── VariableAccessSpecification.h │ │ ├── VariableSpecification.h │ │ ├── VisibleString.h │ │ ├── WriteRequest.h │ │ ├── WriteResponse.h │ │ ├── asn_SEQUENCE_OF.h │ │ ├── asn_SET_OF.h │ │ ├── asn_application.h │ │ ├── asn_codecs.h │ │ ├── asn_codecs_prim.h │ │ ├── asn_internal.h │ │ ├── asn_system.h │ │ ├── ber_decoder.h │ │ ├── ber_tlv_length.h │ │ ├── ber_tlv_tag.h │ │ ├── constr_CHOICE.h │ │ ├── constr_SEQUENCE.h │ │ ├── constr_SEQUENCE_OF.h │ │ ├── constr_SET_OF.h │ │ ├── constr_TYPE.h │ │ ├── constraints.h │ │ ├── der_encoder.h │ │ ├── inc_mms_asn1c.go │ │ ├── per_decoder.h │ │ ├── per_encoder.h │ │ ├── per_support.h │ │ ├── xer_decoder.h │ │ ├── xer_encoder.h │ │ └── xer_support.h └── lib │ ├── darwin_armv8 │ ├── lib_darwinarmv8.go │ └── libiec61850.a │ ├── linux64 │ ├── lib_linux64.go │ └── libiec61850.a │ ├── linux_armv7l │ ├── lib_armv7l.go │ └── libiec61850.a │ ├── linux_armv8 │ ├── lib_armv8.go │ └── libiec61850.a │ └── win64 │ ├── lib_win64.go │ └── libiec61850.a ├── mms.go ├── model.go ├── scl ├── information.go ├── interfaces.go ├── model.go ├── model_wrapper.go ├── parser.go └── static_model_generator.go ├── scl_xml └── scl.go ├── server.go ├── server_config.go ├── server_handler.go ├── test ├── client_control │ └── client_control_test.go ├── client_rcb │ └── client_rcb_test.go ├── client_rw │ ├── client_read_test.go │ └── client_write_test.go ├── client_sg │ └── client_sg_test.go ├── common.go ├── icd_file │ ├── complexModel.cid │ ├── sg_demo.cid │ └── simpleIO_control_tests.cid ├── scl │ ├── scl_test.go │ └── test.icd ├── server │ ├── complexModel.cfg │ ├── complexModel_test.go │ ├── simpleIO_control_test.go │ ├── simpleIO_control_tests.cfg │ ├── simpleIO_direct_control_goose.cfg │ └── simpleIO_direct_control_goose_test.go ├── tls_client │ ├── client_CA1_1.key │ ├── client_CA1_1.pem │ ├── client_read_test.go │ └── root_CA1.pem └── tls_server │ ├── client_CA1_1.pem │ ├── client_CA1_2.pem │ ├── complexModel.cfg │ ├── model.cfg │ ├── root_CA1.pem │ ├── server_CA1_1.key │ ├── server_CA1_1.pem │ └── tls_server_test.go ├── tls_config.go └── types.go /.github/workflows/go-vet.yml: -------------------------------------------------------------------------------- 1 | name: Go Vet 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths-ignore: 8 | - 'docs/**' 9 | - '**/*.md' 10 | pull_request: 11 | branches: 12 | - master 13 | paths-ignore: 14 | - 'docs/**' 15 | - '**/*.md' 16 | 17 | jobs: 18 | static-analysis: 19 | # 定义矩阵的值,指定不同的平台 20 | strategy: 21 | matrix: 22 | os: [ubuntu-latest, windows-latest, macos-latest] 23 | runs-on: ${{ matrix.os }} 24 | 25 | steps: 26 | - name: Check out repository 27 | uses: actions/checkout@v3 28 | 29 | - name: Set up Go 30 | uses: actions/setup-go@v4 31 | with: 32 | go-version: '1.19' 33 | 34 | - name: Cache Go modules 35 | uses: actions/cache@v3 36 | with: 37 | path: | 38 | ~/.cache/go-build 39 | ~/go/pkg/mod 40 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 41 | restore-keys: | 42 | ${{ runner.os }}-go- 43 | 44 | - name: Install Dependencies 45 | run: go mod download 46 | 47 | - name: Run Go Vet 48 | run: go vet ./... -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | release.properties 7 | dependency-reduced-pom.xml 8 | buildNumber.properties 9 | .mvn/timing.properties 10 | .mvn/wrapper/maven-wrapper.jar 11 | *.iml 12 | logs 13 | .idea 14 | rebel.xml 15 | 16 | -------------------------------------------------------------------------------- /README_zh_CN.md: -------------------------------------------------------------------------------- 1 | # iec61850 2 | 3 | [![License](https://img.shields.io/badge/license-GPL--3.0-green.svg)](https://www.gnu.org/licenses/gpl-3.0.html) 4 | [![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/wendy512/iec61850)](https://pkg.go.dev/mod/github.com/wendy512/iec61850) 5 | ![Go Version](https://img.shields.io/badge/go%20version-%3E=1.0-61CFDD.svg?style=flat-square) 6 | [![Go Report Card](https://goreportcard.com/badge/github.com/wendy512/iec61850?style=flat-square)](https://goreportcard.com/report/github.com/wendy512/iec61850) 7 | 8 | 9 | 中文 | [English](README.md) 10 | 11 | cgo 版本的 IEC 61850 库,参考[libiec61850](https://github.com/mz-automation/libiec61850) 12 | 13 | ## 概述 14 | 15 | iec61850 是实现 MMS、GOOSE 和 SV 协议的 IEC 61850 客户端和服务器库的开源 (GPL-3.0 license) 实现,它可用于在运行 Linux、Windows 的嵌入式系统和 PC 上实施符合 IEC 61850 的客户端和服务器应用程序。本项目依赖并参考了[libiec61850](https://github.com/mz-automation/libiec61850)。 16 | 17 | ## 功能特性 18 | 19 | 该库支持以下 IEC 61850 协议功能: 20 | 21 | - MMS 客户端/服务器、GOOSE (IEC 61850-8-1) 22 | - 采样值 (SV - IEC 61850-9-2) 23 | - 支持缓冲和非缓冲报告 24 | - 在线报告控制块配置 25 | - 数据访问服务(获取数据、设置数据) 26 | - 在线数据模型发现和浏览 27 | - 所有数据集服务(获取值、设置值、浏览) 28 | - 动态数据集服务(创建和删除) 29 | - 日志服务 30 | - MMS 文件服务(浏览、获取文件、设置文件、删除/重命名文件) 31 | - 设置组处理 32 | - 支持服务跟踪 33 | - GOOSE 和 SV 控制块处理 34 | - TLS 支持 35 | 36 | ## 如何使用 37 | 38 | ```shell 39 | go get -u github.com/wendy512/iec61850 40 | ``` 41 | 42 | - [客户端控制](test/client_control/client_control_test.go) 43 | - [客户端RCB](test/client_rcb/client_rcb_test.go) 44 | - [客户端读取和写入](test/client_rw) 45 | - [客户端SettingGroups](test/client_sg/client_sg_test.go) 46 | - [创建tls客户端](test/tls_client/client_read_test.go) 47 | - [服务端处理写入操作](test/server/complexModel_test.go) 48 | - [服务端处理控制操作](test/server/simpleIO_control_test.go) 49 | - [服务端定时更新](test/server/simpleIO_direct_control_goose_test.go) 50 | - [创建tls服务端](test/tls_server/tls_server_test.go) 51 | 52 | ## 开源许可 53 | 54 | iec61850 基于 [GPL-3.0 license](./LICENSE) 协议,iec61850 依赖了一些第三方组件,它们的开源协议也为 GPL-3.0 和 MIT。 55 | 56 | ## 联系方式 57 | 58 | - 邮箱: 59 | -------------------------------------------------------------------------------- /cgo_util.go: -------------------------------------------------------------------------------- 1 | package iec61850 2 | 3 | import "C" 4 | import sc "golang.org/x/text/encoding/simplifiedchinese" 5 | 6 | func C2GoStr(str *C.char) string { 7 | utf8str, _ := sc.GB18030.NewDecoder().String(C.GoString(str)) 8 | return utf8str 9 | } 10 | 11 | func Go2CStr(str string) *C.char { 12 | gbstr, _ := sc.GB18030.NewEncoder().String(str) 13 | return C.CString(gbstr) 14 | } 15 | 16 | func C2GoBool(i C.int) bool { 17 | if i == 1 { 18 | return true 19 | } 20 | return false 21 | } 22 | 23 | func Go2CBool(b bool) C.int { 24 | if b { 25 | return 1 26 | } 27 | return 0 28 | } 29 | -------------------------------------------------------------------------------- /client_sg.go: -------------------------------------------------------------------------------- 1 | package iec61850 2 | 3 | // #include 4 | import "C" 5 | import ( 6 | "fmt" 7 | "github.com/spf13/cast" 8 | "unsafe" 9 | ) 10 | 11 | const ( 12 | ActDA = "%s/%s.SGCB.ActSG" 13 | EditDA = "%s/%s.SGCB.EditSG" 14 | CnfDA = "%s/%s.SGCB.CnfEdit" 15 | ) 16 | 17 | type SettingGroup struct { 18 | NumOfSG int 19 | ActSG int 20 | EditSG int 21 | CnfEdit bool 22 | } 23 | 24 | // WriteSG 写入SettingGroup 25 | func (c *Client) WriteSG(ld, ln, objectRef string, fc FC, actSG int, value interface{}) error { 26 | // Set active setting group 27 | if err := c.Write(fmt.Sprintf(ActDA, ld, ln), SP, actSG); err != nil { 28 | return err 29 | } 30 | 31 | // Set edit setting group 32 | if err := c.Write(fmt.Sprintf(EditDA, ld, ln), SP, actSG); err != nil { 33 | return err 34 | } 35 | 36 | // Change a setting group value 37 | if err := c.Write(objectRef, fc, value); err != nil { 38 | return err 39 | } 40 | 41 | // Confirm new setting group values 42 | if err := c.Write(fmt.Sprintf(CnfDA, ld, ln), SP, true); err != nil { 43 | return err 44 | } 45 | return nil 46 | } 47 | 48 | // GetSG 获取SettingGroup 49 | func (c *Client) GetSG(objectRef string) (*SettingGroup, error) { 50 | var clientError C.IedClientError 51 | cObjectRef := C.CString(objectRef) 52 | defer C.free(unsafe.Pointer(cObjectRef)) 53 | 54 | // 获取类型 55 | sgcbVarSpec := C.IedConnection_getVariableSpecification(c.conn, &clientError, cObjectRef, C.FunctionalConstraint(SP)) 56 | if err := GetIedClientError(clientError); err != nil { 57 | return nil, err 58 | } 59 | defer C.MmsVariableSpecification_destroy(sgcbVarSpec) 60 | 61 | // Read SGCB 62 | sgcbVal := C.IedConnection_readObject(c.conn, &clientError, cObjectRef, C.FunctionalConstraint(SP)) 63 | if err := GetIedClientError(clientError); err != nil { 64 | return nil, err 65 | } 66 | //defer C.MmsValue_delete(sgcbVal) 67 | 68 | numOfSGValue, err := c.getSubElementValue(sgcbVal, sgcbVarSpec, "NumOfSG") 69 | if err != nil { 70 | return nil, err 71 | } 72 | 73 | actSGValue, err := c.getSubElementValue(sgcbVal, sgcbVarSpec, "ActSG") 74 | if err != nil { 75 | return nil, err 76 | } 77 | 78 | editSGValue, err := c.getSubElementValue(sgcbVal, sgcbVarSpec, "EditSG") 79 | if err != nil { 80 | return nil, err 81 | } 82 | 83 | cnfEditValue, err := c.getSubElementValue(sgcbVal, sgcbVarSpec, "CnfEdit") 84 | if err != nil { 85 | return nil, err 86 | } 87 | 88 | sg := &SettingGroup{ 89 | NumOfSG: cast.ToInt(numOfSGValue), 90 | ActSG: cast.ToInt(actSGValue), 91 | EditSG: cast.ToInt(editSGValue), 92 | CnfEdit: cast.ToBool(cnfEditValue), 93 | } 94 | return sg, nil 95 | } 96 | -------------------------------------------------------------------------------- /cmd/scltool/cmds/commands.go: -------------------------------------------------------------------------------- 1 | package cmds 2 | 3 | import ( 4 | "fmt" 5 | "github.com/spf13/cobra" 6 | "github.com/wendy512/iec61850/scl" 7 | "os" 8 | ) 9 | 10 | var ( 11 | icdFile string 12 | ied string 13 | ap string 14 | outDir string 15 | outFileName string 16 | modelPrefix string 17 | initializeOnce bool 18 | _scl *scl.SCL 19 | ) 20 | 21 | func New() *cobra.Command { 22 | rootCommand := &cobra.Command{ 23 | Use: "scltool", 24 | Short: "scltool is used to browse models and generate model code and configuration", 25 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error { 26 | icdFile = args[0] 27 | var err error 28 | 29 | if err = checkICDFileExists(icdFile, "ICD file does not exist: %s"); err != nil { 30 | return err 31 | } 32 | 33 | parser := scl.NewParser(icdFile) 34 | _scl, err = parser.Parse() 35 | if err != nil { 36 | return err 37 | } 38 | 39 | if len(args) > 1 { 40 | outDir = args[1] 41 | 42 | if _, err = os.Stat(outDir); err != nil { 43 | if os.IsNotExist(err) { 44 | if err = os.MkdirAll(outFileName, os.ModePerm); err != nil { 45 | return err 46 | } 47 | } 48 | 49 | if err != nil { 50 | return err 51 | } 52 | } 53 | return nil 54 | } 55 | 56 | return nil 57 | }, 58 | } 59 | 60 | genmodelCommand := &cobra.Command{ 61 | Use: "genmodel ", 62 | Short: "Generate model files from an ICD file", 63 | Args: cobra.ExactArgs(2), 64 | Run: runGenModel, 65 | } 66 | 67 | genmodelCommand.Flags().StringVar(&ied, "ied", "", "IED name") 68 | genmodelCommand.Flags().StringVar(&ap, "ap", "", "AccessPoints name") 69 | genmodelCommand.Flags().StringVarP(&outFileName, "out", "o", "static_model", "Output name") 70 | genmodelCommand.Flags().StringVarP(&modelPrefix, "modelPrefix", "m", "iedModel", "Model prefix name") 71 | genmodelCommand.Flags().BoolVarP(&initializeOnce, "initializeonce", "i", false, "Initialize once") 72 | 73 | rootCommand.AddCommand(genmodelCommand) 74 | 75 | return rootCommand 76 | } 77 | 78 | func checkICDFileExists(filePath, template string) error { 79 | if _, err := os.Stat(filePath); err != nil { 80 | if os.IsNotExist(err) { 81 | return fmt.Errorf(template, filePath) 82 | } 83 | return err 84 | } 85 | return nil 86 | } 87 | 88 | func runGenModel(cmd *cobra.Command, args []string) { 89 | if err := scl.NewStaticModelGenerator(_scl, ied, ap, outDir, outFileName, modelPrefix, initializeOnce).Generate(); err != nil { 90 | fmt.Fprintf(os.Stderr, "%v\n", err) 91 | os.Exit(1) 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /cmd/scltool/cmds/commands_test.go: -------------------------------------------------------------------------------- 1 | package cmds 2 | 3 | import "testing" 4 | 5 | func TestGenmodelCommand(t *testing.T) { 6 | args := []string{ 7 | "genmodel", 8 | "complexModel.cid", // Mock ICD file 9 | "/Users/jefftao/Documents/Code/GitHub/libiec61850-1.5/examples/server_example_write_handler", // Output directory 10 | } 11 | 12 | command := New() 13 | command.SetArgs(args) 14 | if err := command.Execute(); err != nil { 15 | t.Fatal(err) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /cmd/scltool/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/wendy512/iec61850/cmd/scltool/cmds" 6 | "os" 7 | ) 8 | 9 | func main() { 10 | if err := cmds.New().Execute(); err != nil { 11 | fmt.Fprintf(os.Stderr, "%v\n", err) 12 | os.Exit(1) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /config.go: -------------------------------------------------------------------------------- 1 | package iec61850 2 | 3 | // this file is used to import all the packages that are needed include cgo files 4 | // if you want to use the cgo files, you should import this file 5 | 6 | import ( 7 | _ "github.com/wendy512/iec61850/libiec61850/inc/common/inc" 8 | _ "github.com/wendy512/iec61850/libiec61850/inc/goose" 9 | _ "github.com/wendy512/iec61850/libiec61850/inc/hal/inc" 10 | _ "github.com/wendy512/iec61850/libiec61850/inc/iec61850/inc" 11 | _ "github.com/wendy512/iec61850/libiec61850/inc/iec61850/inc_private" 12 | _ "github.com/wendy512/iec61850/libiec61850/inc/logging" 13 | _ "github.com/wendy512/iec61850/libiec61850/inc/mms/inc" 14 | _ "github.com/wendy512/iec61850/libiec61850/inc/mms/inc_private" 15 | _ "github.com/wendy512/iec61850/libiec61850/inc/mms/iso_mms/asn1c" 16 | 17 | _ "github.com/wendy512/iec61850/libiec61850/lib/linux64" 18 | _ "github.com/wendy512/iec61850/libiec61850/lib/linux_armv7l" 19 | _ "github.com/wendy512/iec61850/libiec61850/lib/linux_armv8" 20 | _ "github.com/wendy512/iec61850/libiec61850/lib/win64" 21 | ) 22 | -------------------------------------------------------------------------------- /config_armv7l.go: -------------------------------------------------------------------------------- 1 | //go:build linux && arm 2 | 3 | package iec61850 4 | 5 | // #cgo CFLAGS: -I./libiec61850/inc/hal/inc -I./libiec61850/inc/common/inc -I./libiec61850/inc/goose -I./libiec61850/inc/iec61850/inc -I./libiec61850/inc/iec61850/inc_private -I./libiec61850/inc/logging -I./libiec61850/inc/mms/inc -I./libiec61850/inc/mms/inc_private -I./libiec61850/inc/mms/iso_mms/asn1c 6 | // #cgo LDFLAGS: -static-libgcc -static-libstdc++ -L./libiec61850/lib/linux_armv7l -liec61850 -lpthread 7 | import "C" 8 | -------------------------------------------------------------------------------- /config_armv8.go: -------------------------------------------------------------------------------- 1 | //go:build linux && arm64 2 | 3 | package iec61850 4 | 5 | // #cgo CFLAGS: -I./libiec61850/inc/hal/inc -I./libiec61850/inc/common/inc -I./libiec61850/inc/goose -I./libiec61850/inc/iec61850/inc -I./libiec61850/inc/iec61850/inc_private -I./libiec61850/inc/logging -I./libiec61850/inc/mms/inc -I./libiec61850/inc/mms/inc_private -I./libiec61850/inc/mms/iso_mms/asn1c 6 | // #cgo LDFLAGS: -static-libgcc -static-libstdc++ -L./libiec61850/lib/linux_armv8 -liec61850 -lpthread 7 | import "C" 8 | -------------------------------------------------------------------------------- /config_darwinarmv8.go: -------------------------------------------------------------------------------- 1 | //go:build darwin && arm64 2 | 3 | package iec61850 4 | 5 | // #cgo CFLAGS: -I./libiec61850/inc/hal/inc -I./libiec61850/inc/common/inc -I./libiec61850/inc/goose -I./libiec61850/inc/iec61850/inc -I./libiec61850/inc/iec61850/inc_private -I./libiec61850/inc/logging -I./libiec61850/inc/mms/inc -I./libiec61850/inc/mms/inc_private -I./libiec61850/inc/mms/iso_mms/asn1c 6 | // #cgo LDFLAGS: -static-libstdc++ -L./libiec61850/lib/darwin_armv8 -liec61850 -lpthread 7 | import "C" 8 | -------------------------------------------------------------------------------- /config_linux64.go: -------------------------------------------------------------------------------- 1 | //go:build linux && amd64 2 | 3 | package iec61850 4 | 5 | // #cgo CFLAGS: -I./libiec61850/inc/hal/inc -I./libiec61850/inc/common/inc -I./libiec61850/inc/goose -I./libiec61850/inc/iec61850/inc -I./libiec61850/inc/iec61850/inc_private -I./libiec61850/inc/logging -I./libiec61850/inc/mms/inc -I./libiec61850/inc/mms/inc_private -I./libiec61850/inc/mms/iso_mms/asn1c 6 | // #cgo LDFLAGS: -static-libgcc -static-libstdc++ -L./libiec61850/lib/linux64 -liec61850 -lpthread 7 | import "C" 8 | -------------------------------------------------------------------------------- /config_win64.go: -------------------------------------------------------------------------------- 1 | //go:build windows && amd64 2 | 3 | package iec61850 4 | 5 | // #cgo CFLAGS: -I./libiec61850/inc/hal/inc -I./libiec61850/inc/common/inc -I./libiec61850/inc/goose -I./libiec61850/inc/iec61850/inc -I./libiec61850/inc/iec61850/inc_private -I./libiec61850/inc/logging -I./libiec61850/inc/mms/inc -I./libiec61850/inc/mms/inc_private -I./libiec61850/inc/mms/iso_mms/asn1c 6 | // #cgo LDFLAGS: -static-libgcc -static-libstdc++ -L./libiec61850/lib/win64 -liec61850 -lws2_32 7 | import "C" 8 | -------------------------------------------------------------------------------- /data_model.go: -------------------------------------------------------------------------------- 1 | package iec61850 2 | 3 | type DataModel struct { 4 | LDs []LD 5 | } 6 | 7 | type LD struct { 8 | Data string 9 | LNs []LN 10 | } 11 | 12 | type LN struct { 13 | Data string 14 | DOs []DO 15 | DSs []DS 16 | URReports []URReport 17 | BRReports []BRReport 18 | } 19 | 20 | type URReport struct { 21 | Data string 22 | } 23 | 24 | type BRReport struct { 25 | Data string 26 | } 27 | 28 | type DS struct { 29 | Data string 30 | DSRefs []DSRef 31 | } 32 | 33 | type DSRef struct { 34 | Data string 35 | } 36 | 37 | type DO struct { 38 | Data string 39 | DAs []DA 40 | } 41 | 42 | type DA struct { 43 | Data string 44 | DAs []DA 45 | } 46 | -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | package iec61850 // import "github.com/wendy512/iec61850" 2 | -------------------------------------------------------------------------------- /fc.go: -------------------------------------------------------------------------------- 1 | package iec61850 2 | 3 | // #include 4 | import "C" 5 | 6 | type FC int 7 | 8 | // fc types 9 | const ( 10 | // ST Status information 11 | ST FC = iota 12 | // MX Measurands - analogue values 13 | MX 14 | // SP Setpoint 15 | SP 16 | // SV Substitution 17 | SV 18 | // CF Configuration 19 | CF 20 | // DC Description 21 | DC 22 | // SG Setting group 23 | SG 24 | // SE Setting group editable 25 | SE 26 | // SR service response / service tracking 27 | SR 28 | // OR Operate received 29 | OR 30 | // BL Blocking 31 | BL 32 | // EX Extended definition 33 | EX 34 | // CO Control, deprecated but kept here for backward compatibility 35 | CO 36 | // RP Unbuffered Reporting 37 | RP 38 | // BR Buffered Reporting 39 | BR 40 | // ALL All FCs - wildcard value 41 | ALL FC = 99 42 | NONE FC = -1 43 | ) 44 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/wendy512/iec61850 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/spf13/cast v1.6.0 7 | github.com/spf13/cobra v1.8.1 8 | golang.org/x/text v0.16.0 9 | gopkg.in/validator.v2 v2.0.1 10 | ) 11 | 12 | require ( 13 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 14 | github.com/spf13/pflag v1.0.5 // indirect 15 | ) 16 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 2 | github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= 3 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 4 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 5 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 6 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 7 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 8 | github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= 9 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 10 | github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= 11 | github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= 12 | github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= 13 | github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= 14 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 15 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 16 | golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= 17 | golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= 18 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 19 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 20 | gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY= 21 | gopkg.in/validator.v2 v2.0.1/go.mod h1:lIUZBlB3Im4s/eYp39Ry/wkR02yOPhZ9IwIRBjuPuG8= 22 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 23 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/buffer_chain.h: -------------------------------------------------------------------------------- 1 | /* 2 | * buffer_chain.h 3 | * 4 | * Copyright 2013-2018 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef BUFFER_CHAIN_H_ 25 | #define BUFFER_CHAIN_H_ 26 | 27 | #include "libiec61850_platform_includes.h" 28 | 29 | typedef struct sBufferChain* BufferChain; 30 | 31 | struct sBufferChain { 32 | int length; 33 | int partLength; 34 | int partMaxLength; 35 | uint8_t* buffer; 36 | BufferChain nextPart; 37 | }; 38 | 39 | LIB61850_INTERNAL void 40 | BufferChain_init(BufferChain self, int length, int partLength, BufferChain nextPart, uint8_t* buffer); 41 | 42 | typedef struct { 43 | uint8_t* memory; 44 | int currentPos; 45 | int size; 46 | } MemoryArea; 47 | 48 | LIB61850_INTERNAL void 49 | MemoryArea_initialize(MemoryArea* self, uint8_t* memory, int size); 50 | 51 | LIB61850_INTERNAL uint8_t* 52 | MemoryArea_getNextBlock(MemoryArea* self, int size); 53 | 54 | #if 0 55 | 56 | typedef struct sMemoryPool* MemoryPool; 57 | 58 | typedef struct sMemoryChunk MemoryChunk; 59 | 60 | struct sMemoryPool { 61 | uint8_t* memory; 62 | int size; 63 | MemoryChunk firstChunk; 64 | }; 65 | 66 | struct sMemoryChunk { 67 | MemoryChunk previous; 68 | MemoryChunk next; 69 | uint8_t* data; 70 | uint8_t free; 71 | int size; 72 | }; 73 | 74 | MemoryPool 75 | MemoryPool_create(uint8_t* memoryAddress, int size); 76 | 77 | void 78 | MemoryPool_destroy(MemoryPool self); 79 | 80 | MemoryChunk 81 | MemoryPool_allocateChunk(MemoryPool self, int size); 82 | MemoryPool_freeChunk(MemoryPool self, MemoryChunk chunk); 83 | 84 | #endif 85 | 86 | #endif /* BUFFER_CHAIN_H_ */ 87 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/byte_buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * byte_buffer.h 3 | * 4 | * Copyright 2013-2018 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef BYTE_BUFFER_H_ 25 | #define BYTE_BUFFER_H_ 26 | 27 | #include "libiec61850_common_api.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | typedef struct { 34 | uint8_t* buffer; 35 | int maxSize; 36 | int size; 37 | } ByteBuffer; 38 | 39 | LIB61850_INTERNAL ByteBuffer* 40 | ByteBuffer_create(ByteBuffer* self, int maxSize); 41 | 42 | LIB61850_INTERNAL void 43 | ByteBuffer_destroy(ByteBuffer* self); 44 | 45 | LIB61850_INTERNAL void 46 | ByteBuffer_wrap(ByteBuffer* self, uint8_t* buf, int size, int maxSize); 47 | 48 | LIB61850_INTERNAL int 49 | ByteBuffer_append(ByteBuffer* self, uint8_t* data, int dataSize); 50 | 51 | LIB61850_INTERNAL int 52 | ByteBuffer_appendByte(ByteBuffer* self, uint8_t byte); 53 | 54 | LIB61850_INTERNAL uint8_t* 55 | ByteBuffer_getBuffer(ByteBuffer* self); 56 | 57 | LIB61850_INTERNAL int 58 | ByteBuffer_getSize(ByteBuffer* self); 59 | 60 | LIB61850_INTERNAL int 61 | ByteBuffer_getMaxSize(ByteBuffer* self); 62 | 63 | LIB61850_INTERNAL int 64 | ByteBuffer_setSize(ByteBuffer* self, int size); 65 | 66 | LIB61850_INTERNAL void 67 | ByteBuffer_print(ByteBuffer* self, char* message); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | 74 | #endif /* BYTE_BUFFER_H_ */ 75 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/conversions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * conversions.h 3 | * 4 | * Some helper functions to convert data. 5 | * 6 | * Copyright 2014-2018 Michael Zillgith 7 | * 8 | * This file is part of libIEC61850. 9 | * 10 | * libIEC61850 is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * libIEC61850 is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with libIEC61850. If not, see . 22 | * 23 | * See COPYING file for the complete license text. 24 | */ 25 | 26 | #ifndef CONVERSIONS_H_ 27 | #define CONVERSIONS_H_ 28 | 29 | #include "libiec61850_common_api.h" 30 | 31 | LIB61850_INTERNAL void 32 | Conversions_intToStringBuffer(int intValue, int numberOfDigits, uint8_t* buffer); 33 | 34 | LIB61850_INTERNAL void 35 | Conversions_msTimeToGeneralizedTime(uint64_t msTime, uint8_t* buffer); 36 | 37 | LIB61850_INTERNAL uint64_t 38 | Conversions_generalizedTimeToMsTime(const char* gtString); 39 | 40 | LIB61850_INTERNAL void 41 | memcpyReverseByteOrder(uint8_t* dst, const uint8_t* src, int size); 42 | 43 | #endif /* CONVERSIONS_H_ */ 44 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/inc_common.go: -------------------------------------------------------------------------------- 1 | package inc_common 2 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/libiec61850_common_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libiec61850_common_api.h 3 | */ 4 | 5 | #ifndef LIBIEC61850_COMMON_API_INCLUDES_H_ 6 | #define LIBIEC61850_COMMON_API_INCLUDES_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #ifdef __GNUC__ 15 | #define ATTRIBUTE_PACKED __attribute__ ((__packed__)) 16 | #else 17 | #define ATTRIBUTE_PACKED 18 | #endif 19 | 20 | #ifndef DEPRECATED 21 | #if defined(__GNUC__) || defined(__clang__) 22 | #define DEPRECATED __attribute__((deprecated)) 23 | #else 24 | #define DEPRECATED 25 | #endif 26 | #endif 27 | 28 | #if defined _WIN32 || defined __CYGWIN__ 29 | #ifdef EXPORT_FUNCTIONS_FOR_DLL 30 | #define LIB61850_API __declspec(dllexport) 31 | #else 32 | #define LIB61850_API 33 | #endif 34 | 35 | #define LIB61850_INTERNAL 36 | #else 37 | #if __GNUC__ >= 4 38 | #define LIB61850_API __attribute__ ((visibility ("default"))) 39 | #define LIB61850_INTERNAL __attribute__ ((visibility ("hidden"))) 40 | #else 41 | #define LIB61850_API 42 | #define LIB61850_INTERNAL 43 | #endif 44 | #endif 45 | 46 | #include "hal_time.h" 47 | #include "mms_value.h" 48 | 49 | #endif /* LIBIEC61850_COMMON_API_INCLUDES_H_ */ 50 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/libiec61850_platform_includes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libiec61850_platform_includes.h 3 | */ 4 | 5 | #ifndef LIBIEC61850_PLATFORM_INCLUDES_H_ 6 | #define LIBIEC61850_PLATFORM_INCLUDES_H_ 7 | 8 | #include "stack_config.h" 9 | 10 | #include "libiec61850_common_api.h" 11 | 12 | #include "string_utilities.h" 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "platform_endian.h" 19 | 20 | #define LIBIEC61850_VERSION "1.5.3" 21 | 22 | #ifndef CONFIG_DEFAULT_MMS_VENDOR_NAME 23 | #define CONFIG_DEFAULT_MMS_VENDOR_NAME "libiec61850.com" 24 | #endif 25 | 26 | #ifndef CONFIG_DEFAULT_MMS_MODEL_NAME 27 | #define CONFIG_DEFAULT_MMS_MODEL_NAME "LIBIEC61850" 28 | #endif 29 | 30 | #ifndef CONFIG_DEFAULT_MMS_REVISION 31 | #define CONFIG_DEFAULT_MMS_REVISION LIBIEC61850_VERSION 32 | #endif 33 | 34 | #ifndef CONFIG_IEC61850_SAMPLED_VALUES_SUPPORT 35 | #define CONFIG_IEC61850_SAMPLED_VALUES_SUPPORT 0 36 | #endif 37 | 38 | #if (DEBUG != 1) 39 | #define NDEBUG 1 40 | #endif 41 | 42 | #include 43 | 44 | #include "lib_memory.h" 45 | 46 | #endif /* LIBIEC61850_PLATFORM_INCLUDES_H_ */ 47 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/map.h: -------------------------------------------------------------------------------- 1 | /* 2 | * map.h 3 | * 4 | * Copyright 2013-2018 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef MAP_H_ 25 | #define MAP_H_ 26 | 27 | #include "libiec61850_common_api.h" 28 | #include "linked_list.h" 29 | 30 | typedef struct sMap* Map; 31 | 32 | struct sMap { 33 | LinkedList entries; 34 | 35 | /* client provided function to compare two keys */ 36 | int (*compareKeys)(void* key1, void* key2); 37 | }; 38 | 39 | LIB61850_INTERNAL Map 40 | Map_create(void); 41 | 42 | LIB61850_INTERNAL int 43 | Map_size(Map map); 44 | 45 | LIB61850_INTERNAL void* 46 | Map_addEntry(Map map, void* key, void* value); 47 | 48 | LIB61850_INTERNAL void* 49 | Map_removeEntry(Map map, void* key, bool deleteKey); 50 | 51 | LIB61850_INTERNAL void* 52 | Map_getEntry(Map map, void* key); 53 | 54 | LIB61850_INTERNAL void 55 | Map_delete(Map map, bool deleteKey); 56 | 57 | LIB61850_INTERNAL void 58 | Map_deleteStatic(Map map, bool deleteKey); 59 | 60 | LIB61850_INTERNAL void 61 | Map_deleteDeep(Map map, bool deleteKey, void (*valueDeleteFunction) (void*)); 62 | 63 | 64 | #endif /* MAP_H_ */ 65 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/mem_alloc_linked_list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mem_alloc_linked_list.h 3 | * 4 | * Implementation of linked list (LinkedList) that uses the provided memory buffer as 5 | * memory pool for storage allocation. 6 | * 7 | * Copyright 2014 Michael Zillgith 8 | * 9 | * This file is part of libIEC61850. 10 | * 11 | * libIEC61850 is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * libIEC61850 is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with libIEC61850. If not, see . 23 | * 24 | * See COPYING file for the complete license text. 25 | */ 26 | 27 | #ifndef MEM_ALLOC_LINKED_LIST_H_ 28 | #define MEM_ALLOC_LINKED_LIST_H_ 29 | 30 | #include "libiec61850_common_api.h" 31 | #include "linked_list.h" 32 | #include "simple_allocator.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | typedef struct sMemAllocLinkedList* MemAllocLinkedList; 39 | 40 | LIB61850_INTERNAL MemAllocLinkedList 41 | MemAllocLinkedList_create(MemoryAllocator* ma); 42 | 43 | LIB61850_INTERNAL LinkedList 44 | MemAllocLinkedList_add(MemAllocLinkedList list, void* data); 45 | 46 | #endif /* MEM_ALLOC_LINKED_LIST_H_ */ 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/simple_allocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * simple_allocator.h 3 | * 4 | * Copyright 2013-2018 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef SIMPLE_ALLOCATOR_H_ 25 | #define SIMPLE_ALLOCATOR_H_ 26 | 27 | typedef struct { 28 | char* memoryBlock; 29 | char* currentPtr; 30 | int size; 31 | } MemoryAllocator; 32 | 33 | LIB61850_INTERNAL void 34 | MemoryAllocator_init(MemoryAllocator* self, char* memoryBlock, int size); 35 | 36 | LIB61850_INTERNAL int 37 | MemoryAllocator_getAlignedSize(int size); 38 | 39 | LIB61850_INTERNAL char* 40 | MemoryAllocator_allocate(MemoryAllocator* self, int size); 41 | 42 | #endif /* SIMPLE_ALLOCATOR_H_ */ 43 | -------------------------------------------------------------------------------- /libiec61850/inc/common/inc/string_map.h: -------------------------------------------------------------------------------- 1 | /* 2 | * string_map.h 3 | * 4 | * Copyright 2013 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #include "map.h" 25 | 26 | LIB61850_INTERNAL Map 27 | StringMap_create(void); 28 | 29 | -------------------------------------------------------------------------------- /libiec61850/inc/goose/goose_receiver_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * goose_receiver_internal.h 3 | * 4 | * Copyright 2014 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef GOOSE_RECEIVER_INTERNAL_H_ 25 | #define GOOSE_RECEIVER_INTERNAL_H_ 26 | 27 | 28 | #define ETH_BUFFER_LENGTH 1518 29 | 30 | #define ETH_P_GOOSE 0x88b8 31 | 32 | #ifndef DEBUG_GOOSE_SUBSCRIBER 33 | #define DEBUG_GOOSE_SUBSCRIBER 0 34 | #endif 35 | 36 | 37 | struct sGooseSubscriber { 38 | char goCBRef[130]; 39 | char datSet[130]; 40 | char goId[130]; 41 | int goCBRefLen; 42 | uint32_t timeAllowedToLive; 43 | uint32_t stNum; 44 | uint32_t sqNum; 45 | uint32_t confRev; 46 | MmsValue* timestamp; 47 | bool simulation; 48 | bool ndsCom; 49 | 50 | uint64_t invalidityTime; 51 | bool stateValid; 52 | GooseParseError parseError; 53 | 54 | uint8_t srcMac[6]; /* source mac address */ 55 | uint8_t dstMac[6]; /* destination mac address */ 56 | int32_t appId; /* APPID or -1 if APPID should be ignored */ 57 | 58 | MmsValue* dataSetValues; 59 | bool dataSetValuesSelfAllocated; 60 | bool dstMacSet; 61 | bool isObserver; 62 | bool vlanSet; 63 | uint16_t vlanId; 64 | uint8_t vlanPrio; 65 | 66 | GooseListener listener; 67 | void* listenerParameter; 68 | }; 69 | 70 | 71 | 72 | #endif /* GOOSE_RECEIVER_INTERNAL_H_ */ 73 | -------------------------------------------------------------------------------- /libiec61850/inc/goose/iec61850_goose.asn: -------------------------------------------------------------------------------- 1 | IEC61850 DEFINITIONS ::= BEGIN 2 | 3 | IEC61850SpecificProtocol ::= CHOICE { 4 | -- gseMngtPdu [APPLICATION 0] IMPLICIT GSEMngtPdu, 5 | goosePdu [APPLICATION 1] IMPLICIT IECGoosePdu 6 | } 7 | 8 | IECGoosePdu ::= SEQUENCE { 9 | gocbRef [0] IMPLICIT VisibleString, 10 | timeAllowedtoLive [1] IMPLICIT INTEGER, 11 | datSet [2] IMPLICIT VisibleString, 12 | goID [3] IMPLICIT VisibleString OPTIONAL, 13 | t [4] IMPLICIT UtcTime, 14 | stNum [5] IMPLICIT INTEGER, 15 | sqNum [6] IMPLICIT INTEGER, 16 | simulation [7] IMPLICIT BOOLEAN DEFAULT FALSE, 17 | confRev [8] IMPLICIT INTEGER, 18 | ndsCom [9] IMPLICIT BOOLEAN DEFAULT FALSE, 19 | numDatSetEntries [10] IMPLICIT INTEGER, 20 | allData [11] IMPLICIT SEQUENCE OF Data 21 | } 22 | 23 | Data ::= CHOICE 24 | { 25 | -- context tag 0 is reserved for AccessResult 26 | array [1] IMPLICIT DataSequence, 27 | structure [2] IMPLICIT DataSequence, 28 | boolean [3] IMPLICIT BOOLEAN, 29 | bitstring [4] IMPLICIT BIT STRING, 30 | integer [5] IMPLICIT INTEGER, 31 | unsigned [6] IMPLICIT INTEGER, -- shall not be negative 32 | floatingpoint [7] IMPLICIT FloatingPoint, 33 | -- [8] is reserved 34 | octetstring [9] IMPLICIT OCTET STRING, 35 | visiblestring [10] IMPLICIT VisibleString, 36 | generalizedtime [11] IMPLICIT GeneralizedTime, 37 | binarytime [12] IMPLICIT TimeOfDay, 38 | bcd [13] IMPLICIT INTEGER, 39 | booleanArray [14] IMPLICIT BIT STRING, 40 | --objId [15] IMPLICIT OBJECT IDENTIFIER 41 | mMSString [16] IMPLICIT MMSString, -- unicode string 42 | utctime [17] IMPLICIT UtcTime --UTC Time 43 | } 44 | 45 | DataSequence ::= SEQUENCE OF Data 46 | 47 | FloatingPoint ::= OCTET STRING 48 | 49 | UtcTime ::= OCTET STRING 50 | 51 | MMSString ::= UTF8String 52 | 53 | TimeOfDay ::= OCTET STRING -- (SIZE (4 | 6)) 54 | 55 | END 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /libiec61850/inc/goose/inc_goose.go: -------------------------------------------------------------------------------- 1 | package inc_goose 2 | -------------------------------------------------------------------------------- /libiec61850/inc/hal/inc/hal_base.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hal_base.h 3 | * 4 | * Copyright 2013-2021 Michael Zillgith 5 | * 6 | * This file is part of Platform Abstraction Layer (libpal) 7 | * for libiec61850, libmms, and lib60870. 8 | */ 9 | 10 | #ifndef HAL_INC_HAL_BASE_H_ 11 | #define HAL_INC_HAL_BASE_H_ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #ifdef __GNUC__ 20 | #define ATTRIBUTE_PACKED __attribute__ ((__packed__)) 21 | #else 22 | #define ATTRIBUTE_PACKED 23 | #endif 24 | 25 | #ifndef DEPRECATED 26 | #if defined(__GNUC__) || defined(__clang__) 27 | #define DEPRECATED __attribute__((deprecated)) 28 | #else 29 | #define DEPRECATED 30 | #endif 31 | #endif 32 | 33 | #if defined _WIN32 || defined __CYGWIN__ 34 | #ifdef EXPORT_FUNCTIONS_FOR_DLL 35 | #define PAL_API __declspec(dllexport) 36 | #else 37 | #define PAL_API 38 | #endif 39 | 40 | #define PAL_INTERNAL 41 | #else 42 | #if __GNUC__ >= 4 43 | #define PAL_API __attribute__ ((visibility ("default"))) 44 | #define PAL_INTERNAL __attribute__ ((visibility ("hidden"))) 45 | #else 46 | #define PAL_API 47 | #define PAL_INTERNAL 48 | #endif 49 | #endif 50 | 51 | #endif /* HAL_INC_HAL_BASE_H_ */ 52 | -------------------------------------------------------------------------------- /libiec61850/inc/hal/inc/hal_time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * time.c 3 | * 4 | * Copyright 2013-2021 Michael Zillgith 5 | * 6 | * This file is part of Platform Abstraction Layer (libpal) 7 | * for libiec61850, libmms, and lib60870. 8 | */ 9 | 10 | #ifndef HAL_C_ 11 | #define HAL_C_ 12 | 13 | #include "hal_base.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /** 20 | * \file hal_time.h 21 | * \brief Abstraction layer for system time access 22 | */ 23 | 24 | /*! \addtogroup hal 25 | * 26 | * @{ 27 | */ 28 | 29 | /** 30 | * @defgroup HAL_TIME Time related functions 31 | * 32 | * @{ 33 | */ 34 | 35 | typedef uint64_t nsSinceEpoch; 36 | typedef uint64_t msSinceEpoch; 37 | 38 | /** 39 | * Get the system time in milliseconds. 40 | * 41 | * The time value returned as 64-bit unsigned integer should represent the milliseconds 42 | * since the UNIX epoch (1970/01/01 00:00 UTC). 43 | * 44 | * \return the system time with millisecond resolution. 45 | */ 46 | PAL_API msSinceEpoch 47 | Hal_getTimeInMs(void); 48 | 49 | /** 50 | * Get the system time in nanoseconds. 51 | * 52 | * The time value returned as 64-bit unsigned integer should represent the nanoseconds 53 | * since the UNIX epoch (1970/01/01 00:00 UTC). 54 | * 55 | * \return the system time with nanosecond resolution. 56 | */ 57 | PAL_API nsSinceEpoch 58 | Hal_getTimeInNs(void); 59 | 60 | /** 61 | * Set the system time from ns time 62 | * 63 | * The time value returned as 64-bit unsigned integer should represent the nanoseconds 64 | * since the UNIX epoch (1970/01/01 00:00 UTC). 65 | * 66 | * \return true on success, otherwise false 67 | */ 68 | PAL_API bool 69 | Hal_setTimeInNs(nsSinceEpoch nsTime); 70 | 71 | /*! @} */ 72 | 73 | /*! @} */ 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | 80 | #endif /* HAL_C_ */ 81 | -------------------------------------------------------------------------------- /libiec61850/inc/hal/inc/inc_hal.go: -------------------------------------------------------------------------------- 1 | package inc_hal 2 | -------------------------------------------------------------------------------- /libiec61850/inc/hal/inc/lib_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lib_memory.h 3 | * 4 | * Copyright 2014-2021 Michael Zillgith 5 | * 6 | * This file is part of Platform Abstraction Layer (libpal) 7 | * for libiec61850, libmms, and lib60870. 8 | */ 9 | 10 | #ifndef MEMORY_H_ 11 | #define MEMORY_H_ 12 | 13 | #include "hal_base.h" 14 | 15 | #define CALLOC(nmemb, size) Memory_calloc(nmemb, size) 16 | #define MALLOC(size) Memory_malloc(size) 17 | #define REALLOC(oldptr, size) Memory_realloc(oldptr, size) 18 | #define FREEMEM(ptr) Memory_free(ptr) 19 | 20 | #define GLOBAL_CALLOC(nmemb, size) Memory_calloc(nmemb, size) 21 | #define GLOBAL_MALLOC(size) Memory_malloc(size) 22 | #define GLOBAL_REALLOC(oldptr, size) Memory_realloc(oldptr, size) 23 | #define GLOBAL_FREEMEM(ptr) Memory_free(ptr) 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #include 30 | 31 | typedef void 32 | (*MemoryExceptionHandler) (void* parameter); 33 | 34 | PAL_API void 35 | Memory_installExceptionHandler(MemoryExceptionHandler handler, void* parameter); 36 | 37 | PAL_API void* 38 | Memory_malloc(size_t size); 39 | 40 | PAL_API void* 41 | Memory_calloc(size_t nmemb, size_t size); 42 | 43 | PAL_API void * 44 | Memory_realloc(void *ptr, size_t size); 45 | 46 | PAL_API void 47 | Memory_free(void* memb); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* MEMORY_H_ */ 54 | -------------------------------------------------------------------------------- /libiec61850/inc/hal/inc/platform_endian.h: -------------------------------------------------------------------------------- 1 | /* 2 | * platform_endian.h 3 | * 4 | * Copyright 2013-2021 Michael Zillgith 5 | * 6 | * This file is part of Platform Abstraction Layer (libpal) 7 | * for libiec61850, libmms, and lib60870. 8 | */ 9 | 10 | #ifndef ENDIAN_H_ 11 | #define ENDIAN_H_ 12 | 13 | #ifndef PLATFORM_IS_BIGENDIAN 14 | #ifdef __GNUC__ 15 | #ifdef __BYTE_ORDER__ 16 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 17 | #define PLATFORM_IS_BIGENDIAN 1 18 | #endif 19 | 20 | #else 21 | 22 | /* older versions of GCC have __BYTE_ORDER__ not defined! */ 23 | #ifdef __PPC__ 24 | #define PLATFORM_IS_BIGENDIAN 1 25 | #endif 26 | 27 | #endif /* __BYTE_ORDER__ */ 28 | #endif /* __GNUC__ */ 29 | #endif 30 | 31 | #if (PLATFORM_IS_BIGENDIAN == 1) 32 | # define ORDER_LITTLE_ENDIAN 0 33 | #else 34 | # define ORDER_LITTLE_ENDIAN 1 35 | #endif 36 | 37 | #endif /* ENDIAN_H_ */ 38 | -------------------------------------------------------------------------------- /libiec61850/inc/iec61850/inc/iec61850_config_file_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * config_file_parser.h 3 | * 4 | * Copyright 2014 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef CONFIG_FILE_PARSER_H_ 25 | #define CONFIG_FILE_PARSER_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include "hal_filesystem.h" 32 | 33 | /** \addtogroup server_api_group 34 | * @{ 35 | */ 36 | 37 | /** 38 | * @defgroup CONFIG_FILE_PARSER Create data models by configuration files 39 | * 40 | * @{ 41 | */ 42 | 43 | /** 44 | * \brief Create a data model from simple text configuration file 45 | * 46 | * \param filename name or path of the configuraton file 47 | * 48 | * \return the data model to be used by \ref IedServer 49 | */ 50 | LIB61850_API IedModel* 51 | ConfigFileParser_createModelFromConfigFileEx(const char* filename); 52 | 53 | LIB61850_API IedModel* 54 | ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle); 55 | 56 | /**@}*/ 57 | 58 | /**@}*/ 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif /* CONFIG_FILE_PARSER_H_ */ 65 | -------------------------------------------------------------------------------- /libiec61850/inc/iec61850/inc/inc_61850.go: -------------------------------------------------------------------------------- 1 | package inc_61850 2 | -------------------------------------------------------------------------------- /libiec61850/inc/iec61850/inc_private/iec61850_common_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iec61850_common_internal.h 3 | * 4 | * Copyright 2019 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef SRC_IEC61850_INC_PRIVATE_IEC61850_COMMON_INTERNAL_H_ 25 | #define SRC_IEC61850_INC_PRIVATE_IEC61850_COMMON_INTERNAL_H_ 26 | 27 | #include "iec61850_model.h" 28 | 29 | LIB61850_INTERNAL char* 30 | MmsMapping_getMmsDomainFromObjectReference(const char* objectReference, char* buffer); 31 | 32 | LIB61850_INTERNAL char* 33 | MmsMapping_createMmsVariableNameFromObjectReference(const char* objectReference, FunctionalConstraint fc, char* buffer); 34 | 35 | LIB61850_INTERNAL MmsVariableAccessSpecification* 36 | MmsMapping_ObjectReferenceToVariableAccessSpec(char* objectReference); 37 | 38 | LIB61850_INTERNAL char* 39 | MmsMapping_varAccessSpecToObjectReference(MmsVariableAccessSpecification* varAccessSpec); 40 | 41 | #endif /* SRC_IEC61850_INC_PRIVATE_IEC61850_COMMON_INTERNAL_H_ */ 42 | -------------------------------------------------------------------------------- /libiec61850/inc/iec61850/inc_private/inc_61850_private.go: -------------------------------------------------------------------------------- 1 | package inc_61850_private 2 | -------------------------------------------------------------------------------- /libiec61850/inc/iec61850/inc_private/mms_sv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mms_sv.h 3 | * 4 | * Copyright 2015 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef LIBIEC61850_SRC_IEC61850_INC_PRIVATE_MMS_SV_H_ 25 | #define LIBIEC61850_SRC_IEC61850_INC_PRIVATE_MMS_SV_H_ 26 | 27 | 28 | typedef struct sMmsSampledValueControlBlock* MmsSampledValueControlBlock; 29 | 30 | LIB61850_INTERNAL MmsSampledValueControlBlock 31 | MmsSampledValueControlBlock_create(void); 32 | 33 | LIB61850_INTERNAL void 34 | MmsSampledValueControlBlock_destroy(MmsSampledValueControlBlock self); 35 | 36 | LIB61850_INTERNAL MmsVariableSpecification* 37 | LIBIEC61850_SV_createSVControlBlocks(MmsMapping* self, MmsDomain* domain, 38 | LogicalNode* logicalNode, int svCount, bool unicast); 39 | 40 | LIB61850_INTERNAL MmsValue* 41 | LIBIEC61850_SV_readAccessSampledValueControlBlock(MmsMapping* self, MmsDomain* domain, char* variableIdOrig); 42 | 43 | LIB61850_INTERNAL MmsDataAccessError 44 | LIBIEC61850_SV_writeAccessSVControlBlock(MmsMapping* self, MmsDomain* domain, char* variableIdOrig, 45 | MmsValue* value, MmsServerConnection connection); 46 | 47 | LIB61850_INTERNAL void 48 | LIBIEC61850_SV_setSVCBHandler(MmsMapping* self, SVControlBlock* svcb, SVCBEventHandler handler, void* parameter); 49 | 50 | #endif /* LIBIEC61850_SRC_IEC61850_INC_PRIVATE_MMS_SV_H_ */ 51 | -------------------------------------------------------------------------------- /libiec61850/inc/logging/inc_logging.go: -------------------------------------------------------------------------------- 1 | package inc_logging 2 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/inc/inc_mms.go: -------------------------------------------------------------------------------- 1 | package inc_mms 2 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/inc_private/asn1_ber_primitive_value.h: -------------------------------------------------------------------------------- 1 | /* 2 | * asn1_ber_primitive_value.h 3 | * 4 | * Copyright 2013-2018 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef ASN1_BER_PRIMITIVE_VALUE_H_ 25 | #define ASN1_BER_PRIMITIVE_VALUE_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | 32 | #include "libiec61850_common_api.h" 33 | 34 | typedef struct ATTRIBUTE_PACKED { 35 | uint8_t size; 36 | uint8_t maxSize; 37 | uint8_t* octets; 38 | } Asn1PrimitiveValue; 39 | 40 | LIB61850_INTERNAL Asn1PrimitiveValue* 41 | Asn1PrimitiveValue_create(int size); 42 | 43 | LIB61850_INTERNAL int 44 | Asn1PrimitiveValue_getSize(Asn1PrimitiveValue* self); 45 | 46 | LIB61850_INTERNAL int 47 | Asn1PrimitiveValue_getMaxSize(Asn1PrimitiveValue* self); 48 | 49 | LIB61850_INTERNAL Asn1PrimitiveValue* 50 | Asn1PrimitiveValue_clone(Asn1PrimitiveValue* self); 51 | 52 | LIB61850_INTERNAL bool 53 | Asn1PrimitivaValue_compare(Asn1PrimitiveValue* self, Asn1PrimitiveValue* otherValue); 54 | 55 | LIB61850_INTERNAL void 56 | Asn1PrimitiveValue_destroy(Asn1PrimitiveValue* self); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* ASN1_BER_PRIMITIVE_VALUE_H_ */ 63 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/inc_private/ber_decode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ber_decode.h 3 | * 4 | * Copyright 2013-2018 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef BER_DECODER_H_ 25 | #define BER_DECODER_H_ 26 | 27 | #include "libiec61850_platform_includes.h" 28 | 29 | LIB61850_INTERNAL int 30 | BerDecoder_decodeLength(uint8_t* buffer, int* length, int bufPos, int maxBufPos); 31 | 32 | LIB61850_INTERNAL char* 33 | BerDecoder_decodeString(uint8_t* buffer, int strlen, int bufPos, int maxBufPos); 34 | 35 | LIB61850_INTERNAL uint32_t 36 | BerDecoder_decodeUint32(uint8_t* buffer, int intlen, int bufPos); 37 | 38 | LIB61850_INTERNAL int32_t 39 | BerDecoder_decodeInt32(uint8_t* buffer, int intlen, int bufPos); 40 | 41 | LIB61850_INTERNAL float 42 | BerDecoder_decodeFloat(uint8_t* buffer, int bufPos); 43 | 44 | LIB61850_INTERNAL double 45 | BerDecoder_decodeDouble(uint8_t* buffer, int bufPos); 46 | 47 | LIB61850_INTERNAL bool 48 | BerDecoder_decodeBoolean(uint8_t* buffer, int bufPos); 49 | 50 | LIB61850_INTERNAL void 51 | BerDecoder_decodeOID(uint8_t* buffer, int bufPos, int length, ItuObjectIdentifier* oid); 52 | 53 | #endif /* BER_DECODER_H_ */ 54 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/inc_private/ber_integer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ber_integer.h 3 | * 4 | * Copyright 2013-2018 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef BER_INTEGER_H_ 25 | #define BER_INTEGER_H_ 26 | 27 | #include "asn1_ber_primitive_value.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | LIB61850_INTERNAL Asn1PrimitiveValue* 34 | BerInteger_createFromBuffer(uint8_t* buf, int size); 35 | 36 | LIB61850_INTERNAL Asn1PrimitiveValue* 37 | BerInteger_createInt32(void); 38 | 39 | LIB61850_INTERNAL int 40 | BerInteger_setFromBerInteger(Asn1PrimitiveValue* self, Asn1PrimitiveValue* value); 41 | 42 | LIB61850_INTERNAL int 43 | BerInteger_setInt32(Asn1PrimitiveValue* self, int32_t value); 44 | 45 | LIB61850_INTERNAL Asn1PrimitiveValue* 46 | BerInteger_createFromInt32(int32_t value); 47 | 48 | LIB61850_INTERNAL int 49 | BerInteger_setUint8(Asn1PrimitiveValue* self, uint8_t value); 50 | 51 | LIB61850_INTERNAL int 52 | BerInteger_setUint16(Asn1PrimitiveValue* self, uint16_t value); 53 | 54 | LIB61850_INTERNAL int 55 | BerInteger_setUint32(Asn1PrimitiveValue* self, uint32_t value); 56 | 57 | LIB61850_INTERNAL Asn1PrimitiveValue* 58 | BerInteger_createFromUint32(uint32_t value); 59 | 60 | LIB61850_INTERNAL Asn1PrimitiveValue* 61 | BerInteger_createFromInt64(int64_t value); 62 | 63 | LIB61850_INTERNAL Asn1PrimitiveValue* 64 | BerInteger_createInt64(void); 65 | 66 | LIB61850_INTERNAL int 67 | BerInteger_setInt64(Asn1PrimitiveValue* self, int64_t value); 68 | 69 | LIB61850_INTERNAL void 70 | BerInteger_toInt32(Asn1PrimitiveValue* self, int32_t* nativeValue); 71 | 72 | LIB61850_INTERNAL void 73 | BerInteger_toUint32(Asn1PrimitiveValue* self, uint32_t* nativeValue); 74 | 75 | LIB61850_INTERNAL void 76 | BerInteger_toInt64(Asn1PrimitiveValue* self, int64_t* nativeValue); 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* BER_INTEGER_H_ */ 83 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/inc_private/inc_mms_private.go: -------------------------------------------------------------------------------- 1 | package inc_mms_private 2 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/inc_private/iso_presentation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iso_presentation.h 3 | * 4 | * Copyright 2013-2019 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef ISO_PRESENTATION_H_ 25 | #define ISO_PRESENTATION_H_ 26 | 27 | #include "byte_buffer.h" 28 | #include "buffer_chain.h" 29 | #include "iso_connection_parameters.h" 30 | 31 | typedef struct { 32 | PSelector callingPresentationSelector; 33 | PSelector calledPresentationSelector; 34 | uint8_t nextContextId; 35 | uint8_t acseContextId; 36 | uint8_t mmsContextId; 37 | ByteBuffer nextPayload; 38 | } IsoPresentation; 39 | 40 | LIB61850_INTERNAL void 41 | IsoPresentation_init(IsoPresentation* session); 42 | 43 | LIB61850_INTERNAL int 44 | IsoPresentation_parseUserData(IsoPresentation* session, ByteBuffer* message); 45 | 46 | LIB61850_INTERNAL int 47 | IsoPresentation_parseConnect(IsoPresentation* session, ByteBuffer* message); 48 | 49 | LIB61850_INTERNAL void 50 | IsoPresentation_createConnectPdu(IsoPresentation* self, IsoConnectionParameters parameters, 51 | BufferChain buffer, BufferChain payload); 52 | 53 | LIB61850_INTERNAL void 54 | IsoPresentation_createCpaMessage(IsoPresentation* self, BufferChain writeBuffer, BufferChain payload); 55 | 56 | LIB61850_INTERNAL void 57 | IsoPresentation_createUserData(IsoPresentation* self, BufferChain writeBuffer, BufferChain payload); 58 | 59 | LIB61850_INTERNAL void 60 | IsoPresentation_createUserDataACSE(IsoPresentation* self, BufferChain writeBuffer, BufferChain payload); 61 | 62 | LIB61850_INTERNAL int 63 | IsoPresentation_parseAcceptMessage(IsoPresentation* self, ByteBuffer* byteBuffer); 64 | 65 | LIB61850_INTERNAL void 66 | IsoPresentation_createAbortUserMessage(IsoPresentation* self, BufferChain writeBuffer, BufferChain payload); 67 | 68 | #endif /* ISO_PRESENTATION_H_ */ 69 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/inc_private/mms_value_cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mms_value_cache.h 3 | * 4 | * Copyright 2013-2018 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef MMS_VARIABLE_CACHE_H_ 25 | #define MMS_VARIABLE_CACHE_H_ 26 | 27 | #include "mms_device_model.h" 28 | #include "mms_value.h" 29 | 30 | typedef struct sMmsValueCache* MmsValueCache; 31 | 32 | LIB61850_INTERNAL MmsValueCache 33 | MmsValueCache_create(MmsDomain* domain); 34 | 35 | LIB61850_INTERNAL void 36 | MmsValueCache_insertValue(MmsValueCache self, char* itemId, MmsValue* value); 37 | 38 | LIB61850_INTERNAL MmsValue* 39 | MmsValueCache_lookupValue(MmsValueCache self, const char* itemId, MmsVariableSpecification** outSpec); 40 | 41 | LIB61850_INTERNAL void 42 | MmsValueCache_destroy(MmsValueCache self); 43 | 44 | #endif /* MMS_VARIABLE_CACHE_H_ */ 45 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/inc_private/mms_value_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mms_value_internal.h 3 | * 4 | * Copyright 2013 Michael Zillgith 5 | * 6 | * This file is part of libIEC61850. 7 | * 8 | * libIEC61850 is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * libIEC61850 is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with libIEC61850. If not, see . 20 | * 21 | * See COPYING file for the complete license text. 22 | */ 23 | 24 | #ifndef MMS_VALUE_INTERNAL_H_ 25 | #define MMS_VALUE_INTERNAL_H_ 26 | 27 | #include "mms_value.h" 28 | #include "ber_integer.h" 29 | 30 | struct ATTRIBUTE_PACKED sMmsValue { 31 | MmsType type; 32 | uint8_t deleteValue; 33 | union uMmsValue { 34 | MmsDataAccessError dataAccessError; 35 | struct { 36 | int size; 37 | MmsValue** components; 38 | } structure; 39 | bool boolean; 40 | Asn1PrimitiveValue* integer; 41 | struct { 42 | uint8_t exponentWidth; 43 | uint8_t formatWidth; /* number of bits - either 32 or 64) */ 44 | uint8_t buf[8]; 45 | } floatingPoint; 46 | struct { 47 | uint16_t size; 48 | int maxSize; 49 | uint8_t* buf; 50 | } octetString; 51 | struct { 52 | int size; /* Number of bits */ 53 | uint8_t* buf; 54 | } bitString; 55 | struct { 56 | char* buf; 57 | int16_t size; /* size of the string, equals the amount of allocated memory - 1 */ 58 | } visibleString; 59 | uint8_t utcTime[8]; 60 | struct { 61 | uint8_t size; 62 | uint8_t buf[6]; 63 | } binaryTime; 64 | } value; 65 | }; 66 | 67 | 68 | LIB61850_INTERNAL MmsValue* 69 | MmsValue_newIntegerFromBerInteger(Asn1PrimitiveValue* berInteger); 70 | 71 | LIB61850_INTERNAL MmsValue* 72 | MmsValue_newUnsignedFromBerInteger(Asn1PrimitiveValue* berInteger); 73 | 74 | #endif /* MMS_VALUE_INTERNAL_H_ */ 75 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/AccessResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _AccessResult_H_ 9 | #define _AccessResult_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "DataAccessError.h" 16 | #include "DataSequence.h" 17 | #include 18 | #include 19 | #include 20 | #include "FloatingPoint.h" 21 | #include 22 | #include 23 | #include 24 | #include "TimeOfDay.h" 25 | #include "MMSString.h" 26 | #include "UtcTime.h" 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /* Dependencies */ 34 | typedef enum AccessResult_PR { 35 | AccessResult_PR_NOTHING, /* No components present */ 36 | AccessResult_PR_failure, 37 | AccessResult_PR_array, 38 | AccessResult_PR_structure, 39 | AccessResult_PR_boolean, 40 | AccessResult_PR_bitstring, 41 | AccessResult_PR_integer, 42 | AccessResult_PR_unsigned, 43 | AccessResult_PR_floatingpoint, 44 | AccessResult_PR_octetstring, 45 | AccessResult_PR_visiblestring, 46 | AccessResult_PR_generalizedtime, 47 | AccessResult_PR_binarytime, 48 | AccessResult_PR_bcd, 49 | AccessResult_PR_booleanArray, 50 | AccessResult_PR_mMSString, 51 | AccessResult_PR_utctime 52 | } AccessResult_PR; 53 | 54 | /* AccessResult */ 55 | typedef struct AccessResult { 56 | AccessResult_PR present; 57 | union AccessResult_u { 58 | DataAccessError_t failure; 59 | DataSequence_t array; 60 | DataSequence_t structure; 61 | BOOLEAN_t boolean; 62 | BIT_STRING_t bitstring; 63 | INTEGER_t integer; 64 | INTEGER_t Unsigned; 65 | FloatingPoint_t floatingpoint; 66 | OCTET_STRING_t octetstring; 67 | VisibleString_t visiblestring; 68 | GeneralizedTime_t generalizedtime; 69 | TimeOfDay_t binarytime; 70 | INTEGER_t bcd; 71 | BIT_STRING_t booleanArray; 72 | MMSString_t mMSString; 73 | UtcTime_t utctime; 74 | } choice; 75 | 76 | /* Context for parsing across buffer boundaries */ 77 | asn_struct_ctx_t _asn_ctx; 78 | } AccessResult_t; 79 | 80 | /* Implementation */ 81 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_AccessResult; 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif /* _AccessResult_H_ */ 88 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Address.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Address_H_ 9 | #define _Address_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Unsigned32.h" 16 | #include 17 | #include 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Dependencies */ 25 | typedef enum Address_PR { 26 | Address_PR_NOTHING, /* No components present */ 27 | Address_PR_numericAddress, 28 | Address_PR_symbolicAddress, 29 | Address_PR_unconstrainedAddress 30 | } Address_PR; 31 | 32 | /* Address */ 33 | typedef struct Address { 34 | Address_PR present; 35 | union Address_u { 36 | Unsigned32_t numericAddress; 37 | VisibleString_t symbolicAddress; 38 | OCTET_STRING_t unconstrainedAddress; 39 | } choice; 40 | 41 | /* Context for parsing across buffer boundaries */ 42 | asn_struct_ctx_t _asn_ctx; 43 | } Address_t; 44 | 45 | /* Implementation */ 46 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Address; 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* _Address_H_ */ 53 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/AlternateAccess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _AlternateAccess_H_ 9 | #define _AlternateAccess_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include "Identifier.h" 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Dependencies */ 26 | typedef enum AlternateAccess__Member_PR { 27 | AlternateAccess__Member_PR_NOTHING, /* No components present */ 28 | AlternateAccess__Member_PR_unnamed, 29 | AlternateAccess__Member_PR_named 30 | } AlternateAccess__Member_PR; 31 | 32 | /* Forward declarations */ 33 | struct AlternateAccessSelection; 34 | 35 | struct AlternateAccess__Member { 36 | AlternateAccess__Member_PR present; 37 | union AlternateAccess__Member_u { 38 | struct AlternateAccessSelection *unnamed; 39 | struct named { 40 | Identifier_t componentName; 41 | struct AlternateAccessSelection *access; 42 | 43 | /* Context for parsing across buffer boundaries */ 44 | asn_struct_ctx_t _asn_ctx; 45 | } named; 46 | } choice; 47 | 48 | /* Context for parsing across buffer boundaries */ 49 | asn_struct_ctx_t _asn_ctx; 50 | }; 51 | 52 | /* AlternateAccess */ 53 | typedef struct AlternateAccess { 54 | A_SEQUENCE_OF(struct AlternateAccess__Member) list; 55 | 56 | /* Context for parsing across buffer boundaries */ 57 | asn_struct_ctx_t _asn_ctx; 58 | } AlternateAccess_t; 59 | 60 | /* Implementation */ 61 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_AlternateAccess; 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | /* Referred external types */ 68 | #include "AlternateAccessSelection.h" 69 | 70 | #endif /* _AlternateAccess_H_ */ 71 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/BIT_STRING.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _BIT_STRING_H_ 6 | #define _BIT_STRING_H_ 7 | 8 | #include /* Some help from OCTET STRING */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct BIT_STRING_s { 15 | uint8_t *buf; /* BIT STRING body */ 16 | int size; /* Size of the above buffer */ 17 | 18 | int bits_unused;/* Unused trailing bits in the last octet (0..7) */ 19 | 20 | asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ 21 | } BIT_STRING_t; 22 | 23 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING; 24 | 25 | LIB61850_INTERNAL asn_struct_print_f BIT_STRING_print; /* Human-readable output */ 26 | LIB61850_INTERNAL asn_constr_check_f BIT_STRING_constraint; 27 | LIB61850_INTERNAL xer_type_encoder_f BIT_STRING_encode_xer; 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif /* _BIT_STRING_H_ */ 34 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/BOOLEAN.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _BOOLEAN_H_ 6 | #define _BOOLEAN_H_ 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* 15 | * The underlying integer may contain various values, but everything 16 | * non-zero is capped to 0xff by the DER encoder. The BER decoder may 17 | * yield non-zero values different from 1, beware. 18 | */ 19 | typedef int BOOLEAN_t; 20 | 21 | extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN; 22 | 23 | LIB61850_INTERNAL asn_struct_free_f BOOLEAN_free; 24 | LIB61850_INTERNAL asn_struct_print_f BOOLEAN_print; 25 | LIB61850_INTERNAL ber_type_decoder_f BOOLEAN_decode_ber; 26 | LIB61850_INTERNAL der_type_encoder_f BOOLEAN_encode_der; 27 | LIB61850_INTERNAL xer_type_decoder_f BOOLEAN_decode_xer; 28 | LIB61850_INTERNAL xer_type_encoder_f BOOLEAN_encode_xer; 29 | LIB61850_INTERNAL per_type_decoder_f BOOLEAN_decode_uper; 30 | LIB61850_INTERNAL per_type_encoder_f BOOLEAN_encode_uper; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* _BOOLEAN_H_ */ 37 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ConcludeRequestPDU.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ConcludeRequestPDU_H_ 9 | #define _ConcludeRequestPDU_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* ConcludeRequestPDU */ 22 | typedef NULL_t ConcludeRequestPDU_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ConcludeRequestPDU; 26 | LIB61850_INTERNAL asn_struct_free_f ConcludeRequestPDU_free; 27 | LIB61850_INTERNAL asn_struct_print_f ConcludeRequestPDU_print; 28 | LIB61850_INTERNAL asn_constr_check_f ConcludeRequestPDU_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f ConcludeRequestPDU_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f ConcludeRequestPDU_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f ConcludeRequestPDU_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f ConcludeRequestPDU_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _ConcludeRequestPDU_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ConcludeResponsePDU.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ConcludeResponsePDU_H_ 9 | #define _ConcludeResponsePDU_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* ConcludeResponsePDU */ 22 | typedef NULL_t ConcludeResponsePDU_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ConcludeResponsePDU; 26 | LIB61850_INTERNAL asn_struct_free_f ConcludeResponsePDU_free; 27 | LIB61850_INTERNAL asn_struct_print_f ConcludeResponsePDU_print; 28 | LIB61850_INTERNAL asn_constr_check_f ConcludeResponsePDU_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f ConcludeResponsePDU_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f ConcludeResponsePDU_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f ConcludeResponsePDU_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f ConcludeResponsePDU_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _ConcludeResponsePDU_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ConfirmedErrorPDU.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ConfirmedErrorPDU_H_ 9 | #define _ConfirmedErrorPDU_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Unsigned32.h" 16 | #include "ServiceError.h" 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* ConfirmedErrorPDU */ 24 | typedef struct ConfirmedErrorPDU { 25 | Unsigned32_t invokeID; 26 | ServiceError_t serviceError; 27 | 28 | /* Context for parsing across buffer boundaries */ 29 | asn_struct_ctx_t _asn_ctx; 30 | } ConfirmedErrorPDU_t; 31 | 32 | /* Implementation */ 33 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ConfirmedErrorPDU; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* _ConfirmedErrorPDU_H_ */ 40 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ConfirmedRequestPdu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ConfirmedRequestPdu_H_ 9 | #define _ConfirmedRequestPdu_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Unsigned32.h" 16 | #include "ConfirmedServiceRequest.h" 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* ConfirmedRequestPdu */ 24 | typedef struct ConfirmedRequestPdu { 25 | Unsigned32_t invokeID; 26 | ConfirmedServiceRequest_t confirmedServiceRequest; 27 | 28 | /* Context for parsing across buffer boundaries */ 29 | asn_struct_ctx_t _asn_ctx; 30 | } ConfirmedRequestPdu_t; 31 | 32 | /* Implementation */ 33 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ConfirmedRequestPdu; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* _ConfirmedRequestPdu_H_ */ 40 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ConfirmedResponsePdu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ConfirmedResponsePdu_H_ 9 | #define _ConfirmedResponsePdu_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Unsigned32.h" 16 | #include "ConfirmedServiceResponse.h" 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* ConfirmedResponsePdu */ 24 | typedef struct ConfirmedResponsePdu { 25 | Unsigned32_t invokeID; 26 | ConfirmedServiceResponse_t confirmedServiceResponse; 27 | 28 | /* Context for parsing across buffer boundaries */ 29 | asn_struct_ctx_t _asn_ctx; 30 | } ConfirmedResponsePdu_t; 31 | 32 | /* Implementation */ 33 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ConfirmedResponsePdu; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* _ConfirmedResponsePdu_H_ */ 40 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ConfirmedServiceRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ConfirmedServiceRequest_H_ 9 | #define _ConfirmedServiceRequest_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "GetNameListRequest.h" 16 | #include "ReadRequest.h" 17 | #include "WriteRequest.h" 18 | #include "GetVariableAccessAttributesRequest.h" 19 | #include "DefineNamedVariableListRequest.h" 20 | #include "GetNamedVariableListAttributesRequest.h" 21 | #include "DeleteNamedVariableListRequest.h" 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Dependencies */ 29 | typedef enum ConfirmedServiceRequest_PR { 30 | ConfirmedServiceRequest_PR_NOTHING, /* No components present */ 31 | ConfirmedServiceRequest_PR_getNameList, 32 | ConfirmedServiceRequest_PR_read, 33 | ConfirmedServiceRequest_PR_write, 34 | ConfirmedServiceRequest_PR_getVariableAccessAttributes, 35 | ConfirmedServiceRequest_PR_defineNamedVariableList, 36 | ConfirmedServiceRequest_PR_getNamedVariableListAttributes, 37 | ConfirmedServiceRequest_PR_deleteNamedVariableList 38 | } ConfirmedServiceRequest_PR; 39 | 40 | /* ConfirmedServiceRequest */ 41 | typedef struct ConfirmedServiceRequest { 42 | ConfirmedServiceRequest_PR present; 43 | union ConfirmedServiceRequest_u { 44 | GetNameListRequest_t getNameList; 45 | ReadRequest_t read; 46 | WriteRequest_t write; 47 | GetVariableAccessAttributesRequest_t getVariableAccessAttributes; 48 | DefineNamedVariableListRequest_t defineNamedVariableList; 49 | GetNamedVariableListAttributesRequest_t getNamedVariableListAttributes; 50 | DeleteNamedVariableListRequest_t deleteNamedVariableList; 51 | } choice; 52 | 53 | /* Context for parsing across buffer boundaries */ 54 | asn_struct_ctx_t _asn_ctx; 55 | } ConfirmedServiceRequest_t; 56 | 57 | /* Implementation */ 58 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ConfirmedServiceRequest; 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif /* _ConfirmedServiceRequest_H_ */ 65 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ConfirmedServiceResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ConfirmedServiceResponse_H_ 9 | #define _ConfirmedServiceResponse_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "GetNameListResponse.h" 16 | #include "ReadResponse.h" 17 | #include "WriteResponse.h" 18 | #include "GetVariableAccessAttributesResponse.h" 19 | #include "DefineNamedVariableListResponse.h" 20 | #include "GetNamedVariableListAttributesResponse.h" 21 | #include "DeleteNamedVariableListResponse.h" 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Dependencies */ 29 | typedef enum ConfirmedServiceResponse_PR { 30 | ConfirmedServiceResponse_PR_NOTHING, /* No components present */ 31 | ConfirmedServiceResponse_PR_getNameList, 32 | ConfirmedServiceResponse_PR_read, 33 | ConfirmedServiceResponse_PR_write, 34 | ConfirmedServiceResponse_PR_getVariableAccessAttributes, 35 | ConfirmedServiceResponse_PR_defineNamedVariableList, 36 | ConfirmedServiceResponse_PR_getNamedVariableListAttributes, 37 | ConfirmedServiceResponse_PR_deleteNamedVariableList 38 | } ConfirmedServiceResponse_PR; 39 | 40 | /* ConfirmedServiceResponse */ 41 | typedef struct ConfirmedServiceResponse { 42 | ConfirmedServiceResponse_PR present; 43 | union ConfirmedServiceResponse_u { 44 | GetNameListResponse_t getNameList; 45 | ReadResponse_t read; 46 | WriteResponse_t write; 47 | GetVariableAccessAttributesResponse_t getVariableAccessAttributes; 48 | DefineNamedVariableListResponse_t defineNamedVariableList; 49 | GetNamedVariableListAttributesResponse_t getNamedVariableListAttributes; 50 | DeleteNamedVariableListResponse_t deleteNamedVariableList; 51 | } choice; 52 | 53 | /* Context for parsing across buffer boundaries */ 54 | asn_struct_ctx_t _asn_ctx; 55 | } ConfirmedServiceResponse_t; 56 | 57 | /* Implementation */ 58 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ConfirmedServiceResponse; 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif /* _ConfirmedServiceResponse_H_ */ 65 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Data_H_ 9 | #define _Data_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include 17 | #include 18 | #include "FloatingPoint.h" 19 | #include 20 | #include 21 | #include 22 | #include "TimeOfDay.h" 23 | #include "MMSString.h" 24 | #include "UtcTime.h" 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Dependencies */ 32 | typedef enum Data_PR { 33 | Data_PR_NOTHING, /* No components present */ 34 | Data_PR_array, 35 | Data_PR_structure, 36 | Data_PR_boolean, 37 | Data_PR_bitstring, 38 | Data_PR_integer, 39 | Data_PR_unsigned, 40 | Data_PR_floatingpoint, 41 | Data_PR_octetstring, 42 | Data_PR_visiblestring, 43 | Data_PR_generalizedtime, 44 | Data_PR_binarytime, 45 | Data_PR_bcd, 46 | Data_PR_booleanArray, 47 | Data_PR_mMSString, 48 | Data_PR_utctime 49 | } Data_PR; 50 | 51 | /* Forward declarations */ 52 | struct DataSequence; 53 | 54 | /* Data */ 55 | typedef struct Data { 56 | Data_PR present; 57 | union Data_u { 58 | struct DataSequence *array; 59 | struct DataSequence *structure; 60 | BOOLEAN_t boolean; 61 | BIT_STRING_t bitstring; 62 | INTEGER_t integer; 63 | INTEGER_t Unsigned; 64 | FloatingPoint_t floatingpoint; 65 | OCTET_STRING_t octetstring; 66 | VisibleString_t visiblestring; 67 | GeneralizedTime_t generalizedtime; 68 | TimeOfDay_t binarytime; 69 | INTEGER_t bcd; 70 | BIT_STRING_t booleanArray; 71 | MMSString_t mMSString; 72 | UtcTime_t utctime; 73 | } choice; 74 | 75 | /* Context for parsing across buffer boundaries */ 76 | asn_struct_ctx_t _asn_ctx; 77 | } Data_t; 78 | 79 | /* Implementation */ 80 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Data; 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | /* Referred external types */ 87 | #include "DataSequence.h" 88 | 89 | #endif /* _Data_H_ */ 90 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/DataAccessError.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _DataAccessError_H_ 9 | #define _DataAccessError_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Dependencies */ 22 | typedef enum DataAccessError { 23 | DataAccessError_objectinvalidated = 0, 24 | DataAccessError_hardwarefault = 1, 25 | DataAccessError_temporarilyunavailable = 2, 26 | DataAccessError_objectaccessdenied = 3, 27 | DataAccessError_objectundefined = 4, 28 | DataAccessError_invalidaddress = 5, 29 | DataAccessError_typeunsupported = 6, 30 | DataAccessError_typeinconsistent = 7, 31 | DataAccessError_objectattributeinconsistent = 8, 32 | DataAccessError_objectaccessunsupported = 9, 33 | DataAccessError_objectnonexistent = 10, 34 | DataAccessError_objectvalueinvalid = 11 35 | } e_DataAccessError; 36 | 37 | /* DataAccessError */ 38 | typedef INTEGER_t DataAccessError_t; 39 | 40 | /* Implementation */ 41 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_DataAccessError; 42 | LIB61850_INTERNAL asn_struct_free_f DataAccessError_free; 43 | LIB61850_INTERNAL asn_struct_print_f DataAccessError_print; 44 | LIB61850_INTERNAL asn_constr_check_f DataAccessError_constraint; 45 | LIB61850_INTERNAL ber_type_decoder_f DataAccessError_decode_ber; 46 | LIB61850_INTERNAL der_type_encoder_f DataAccessError_encode_der; 47 | LIB61850_INTERNAL xer_type_decoder_f DataAccessError_decode_xer; 48 | LIB61850_INTERNAL xer_type_encoder_f DataAccessError_encode_xer; 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* _DataAccessError_H_ */ 55 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/DataSequence.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _DataSequence_H_ 9 | #define _DataSequence_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* Forward declarations */ 23 | struct Data; 24 | 25 | /* DataSequence */ 26 | typedef struct DataSequence { 27 | A_SEQUENCE_OF(struct Data) list; 28 | 29 | /* Context for parsing across buffer boundaries */ 30 | asn_struct_ctx_t _asn_ctx; 31 | } DataSequence_t; 32 | 33 | /* Implementation */ 34 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_DataSequence; 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | /* Referred external types */ 41 | #include "Data.h" 42 | 43 | #endif /* _DataSequence_H_ */ 44 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/DefineNamedVariableListRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _DefineNamedVariableListRequest_H_ 9 | #define _DefineNamedVariableListRequest_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "ObjectName.h" 16 | #include 17 | #include "VariableSpecification.h" 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Forward declarations */ 26 | struct AlternateAccess; 27 | 28 | struct DefineNamedVariableListRequest__listOfVariable__Member { 29 | VariableSpecification_t variableSpecification; 30 | struct AlternateAccess *alternateAccess /* OPTIONAL */; 31 | 32 | /* Context for parsing across buffer boundaries */ 33 | asn_struct_ctx_t _asn_ctx; 34 | } ; 35 | 36 | /* DefineNamedVariableListRequest */ 37 | typedef struct DefineNamedVariableListRequest { 38 | ObjectName_t variableListName; 39 | struct DefineNamedVariableListRequest__listOfVariable { 40 | A_SEQUENCE_OF(struct DefineNamedVariableListRequest__listOfVariable__Member) list; 41 | 42 | /* Context for parsing across buffer boundaries */ 43 | asn_struct_ctx_t _asn_ctx; 44 | } listOfVariable; 45 | 46 | /* Context for parsing across buffer boundaries */ 47 | asn_struct_ctx_t _asn_ctx; 48 | } DefineNamedVariableListRequest_t; 49 | 50 | /* Implementation */ 51 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_DefineNamedVariableListRequest; 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | /* Referred external types */ 58 | #include "AlternateAccess.h" 59 | 60 | #endif /* _DefineNamedVariableListRequest_H_ */ 61 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/DefineNamedVariableListResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _DefineNamedVariableListResponse_H_ 9 | #define _DefineNamedVariableListResponse_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* DefineNamedVariableListResponse */ 22 | typedef NULL_t DefineNamedVariableListResponse_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_DefineNamedVariableListResponse; 26 | LIB61850_INTERNAL asn_struct_free_f DefineNamedVariableListResponse_free; 27 | LIB61850_INTERNAL asn_struct_print_f DefineNamedVariableListResponse_print; 28 | LIB61850_INTERNAL asn_constr_check_f DefineNamedVariableListResponse_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f DefineNamedVariableListResponse_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f DefineNamedVariableListResponse_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f DefineNamedVariableListResponse_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f DefineNamedVariableListResponse_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _DefineNamedVariableListResponse_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/DeleteNamedVariableListRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _DeleteNamedVariableListRequest_H_ 9 | #define _DeleteNamedVariableListRequest_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include "Identifier.h" 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Dependencies */ 26 | typedef enum DeleteNamedVariableListRequest__scopeOfDelete { 27 | DeleteNamedVariableListRequest__scopeOfDelete_specific = 0, 28 | DeleteNamedVariableListRequest__scopeOfDelete_aaspecific = 1, 29 | DeleteNamedVariableListRequest__scopeOfDelete_domain = 2, 30 | DeleteNamedVariableListRequest__scopeOfDelete_vmd = 3 31 | } e_DeleteNamedVariableListRequest__scopeOfDelete; 32 | 33 | /* Forward declarations */ 34 | struct ObjectName; 35 | 36 | struct DeleteNamedVariableListRequest__listOfVariableListName { 37 | A_SEQUENCE_OF(struct ObjectName) list; 38 | 39 | /* Context for parsing across buffer boundaries */ 40 | asn_struct_ctx_t _asn_ctx; 41 | }; 42 | 43 | /* DeleteNamedVariableListRequest */ 44 | typedef struct DeleteNamedVariableListRequest { 45 | INTEGER_t *scopeOfDelete /* DEFAULT 0 */; 46 | struct DeleteNamedVariableListRequest__listOfVariableListName *listOfVariableListName; 47 | Identifier_t *domainName /* OPTIONAL */; 48 | 49 | /* Context for parsing across buffer boundaries */ 50 | asn_struct_ctx_t _asn_ctx; 51 | } DeleteNamedVariableListRequest_t; 52 | 53 | /* Implementation */ 54 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_DeleteNamedVariableListRequest; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | /* Referred external types */ 61 | #include "ObjectName.h" 62 | 63 | #endif /* _DeleteNamedVariableListRequest_H_ */ 64 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/DeleteNamedVariableListResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _DeleteNamedVariableListResponse_H_ 9 | #define _DeleteNamedVariableListResponse_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Unsigned32.h" 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* DeleteNamedVariableListResponse */ 23 | typedef struct DeleteNamedVariableListResponse { 24 | Unsigned32_t numberMatched; 25 | Unsigned32_t numberDeleted; 26 | 27 | /* Context for parsing across buffer boundaries */ 28 | asn_struct_ctx_t _asn_ctx; 29 | } DeleteNamedVariableListResponse_t; 30 | 31 | /* Implementation */ 32 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_DeleteNamedVariableListResponse; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _DeleteNamedVariableListResponse_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/FloatingPoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _FloatingPoint_H_ 9 | #define _FloatingPoint_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* FloatingPoint */ 22 | typedef OCTET_STRING_t FloatingPoint_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_FloatingPoint; 26 | LIB61850_INTERNAL asn_struct_free_f FloatingPoint_free; 27 | LIB61850_INTERNAL asn_struct_print_f FloatingPoint_print; 28 | LIB61850_INTERNAL asn_constr_check_f FloatingPoint_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f FloatingPoint_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f FloatingPoint_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f FloatingPoint_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f FloatingPoint_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _FloatingPoint_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/GetNameListRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _GetNameListRequest_H_ 9 | #define _GetNameListRequest_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "ObjectClass.h" 16 | #include "Identifier.h" 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Dependencies */ 26 | typedef enum GetNameListRequest__objectScope_PR { 27 | GetNameListRequest__objectScope_PR_NOTHING, /* No components present */ 28 | GetNameListRequest__objectScope_PR_vmdSpecific, 29 | GetNameListRequest__objectScope_PR_domainSpecific, 30 | GetNameListRequest__objectScope_PR_aaSpecific 31 | } GetNameListRequest__objectScope_PR; 32 | 33 | /* GetNameListRequest */ 34 | typedef struct GetNameListRequest { 35 | ObjectClass_t objectClass; 36 | struct GetNameListRequest__objectScope { 37 | GetNameListRequest__objectScope_PR present; 38 | union GetNameListRequest__objectScope_u { 39 | NULL_t vmdSpecific; 40 | Identifier_t domainSpecific; 41 | NULL_t aaSpecific; 42 | } choice; 43 | 44 | /* Context for parsing across buffer boundaries */ 45 | asn_struct_ctx_t _asn_ctx; 46 | } objectScope; 47 | Identifier_t *continueAfter /* OPTIONAL */; 48 | 49 | /* Context for parsing across buffer boundaries */ 50 | asn_struct_ctx_t _asn_ctx; 51 | } GetNameListRequest_t; 52 | 53 | /* Implementation */ 54 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_GetNameListRequest; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif /* _GetNameListRequest_H_ */ 61 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/GetNameListResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _GetNameListResponse_H_ 9 | #define _GetNameListResponse_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include "Identifier.h" 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* GetNameListResponse */ 26 | typedef struct GetNameListResponse { 27 | struct GetNameListResponse__listOfIdentifier { 28 | A_SEQUENCE_OF(Identifier_t) list; 29 | 30 | /* Context for parsing across buffer boundaries */ 31 | asn_struct_ctx_t _asn_ctx; 32 | } listOfIdentifier; 33 | BOOLEAN_t *moreFollows /* DEFAULT TRUE */; 34 | 35 | /* Context for parsing across buffer boundaries */ 36 | asn_struct_ctx_t _asn_ctx; 37 | } GetNameListResponse_t; 38 | 39 | /* Implementation */ 40 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_GetNameListResponse; 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* _GetNameListResponse_H_ */ 47 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/GetNamedVariableListAttributesRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _GetNamedVariableListAttributesRequest_H_ 9 | #define _GetNamedVariableListAttributesRequest_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "ObjectName.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* GetNamedVariableListAttributesRequest */ 22 | typedef ObjectName_t GetNamedVariableListAttributesRequest_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_GetNamedVariableListAttributesRequest; 26 | LIB61850_INTERNAL asn_struct_free_f GetNamedVariableListAttributesRequest_free; 27 | LIB61850_INTERNAL asn_struct_print_f GetNamedVariableListAttributesRequest_print; 28 | LIB61850_INTERNAL asn_constr_check_f GetNamedVariableListAttributesRequest_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f GetNamedVariableListAttributesRequest_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f GetNamedVariableListAttributesRequest_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f GetNamedVariableListAttributesRequest_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f GetNamedVariableListAttributesRequest_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _GetNamedVariableListAttributesRequest_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/GetNamedVariableListAttributesResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _GetNamedVariableListAttributesResponse_H_ 9 | #define _GetNamedVariableListAttributesResponse_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include 17 | #include "VariableSpecification.h" 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Forward declarations */ 26 | struct AlternateAccess; 27 | 28 | struct GetNamedVariableListAttributesResponse__listOfVariable__Member { 29 | VariableSpecification_t variableSpecification; 30 | struct AlternateAccess *alternateAccess /* OPTIONAL */; 31 | 32 | /* Context for parsing across buffer boundaries */ 33 | asn_struct_ctx_t _asn_ctx; 34 | } ; 35 | 36 | struct GetNamedVariableListAttributesResponse__listOfVariable { 37 | A_SEQUENCE_OF(struct GetNamedVariableListAttributesResponse__listOfVariable__Member) list; 38 | 39 | /* Context for parsing across buffer boundaries */ 40 | asn_struct_ctx_t _asn_ctx; 41 | }; 42 | 43 | /* GetNamedVariableListAttributesResponse */ 44 | typedef struct GetNamedVariableListAttributesResponse { 45 | BOOLEAN_t mmsDeletable; 46 | struct GetNamedVariableListAttributesResponse__listOfVariable listOfVariable; 47 | 48 | /* Context for parsing across buffer boundaries */ 49 | asn_struct_ctx_t _asn_ctx; 50 | } GetNamedVariableListAttributesResponse_t; 51 | 52 | /* Implementation */ 53 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_GetNamedVariableListAttributesResponse; 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | /* Referred external types */ 60 | #include "AlternateAccess.h" 61 | 62 | #endif /* _GetNamedVariableListAttributesResponse_H_ */ 63 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/GetVariableAccessAttributesRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _GetVariableAccessAttributesRequest_H_ 9 | #define _GetVariableAccessAttributesRequest_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "ObjectName.h" 16 | #include "Address.h" 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* Dependencies */ 24 | typedef enum GetVariableAccessAttributesRequest_PR { 25 | GetVariableAccessAttributesRequest_PR_NOTHING, /* No components present */ 26 | GetVariableAccessAttributesRequest_PR_name, 27 | GetVariableAccessAttributesRequest_PR_address 28 | } GetVariableAccessAttributesRequest_PR; 29 | 30 | /* GetVariableAccessAttributesRequest */ 31 | typedef struct GetVariableAccessAttributesRequest { 32 | GetVariableAccessAttributesRequest_PR present; 33 | union GetVariableAccessAttributesRequest_u { 34 | ObjectName_t name; 35 | Address_t address; 36 | } choice; 37 | 38 | /* Context for parsing across buffer boundaries */ 39 | asn_struct_ctx_t _asn_ctx; 40 | } GetVariableAccessAttributesRequest_t; 41 | 42 | /* Implementation */ 43 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_GetVariableAccessAttributesRequest; 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* _GetVariableAccessAttributesRequest_H_ */ 50 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/GetVariableAccessAttributesResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _GetVariableAccessAttributesResponse_H_ 9 | #define _GetVariableAccessAttributesResponse_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include "TypeSpecification.h" 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* Forward declarations */ 24 | struct Address; 25 | 26 | /* GetVariableAccessAttributesResponse */ 27 | typedef struct GetVariableAccessAttributesResponse { 28 | BOOLEAN_t mmsDeletable; 29 | struct Address *address /* OPTIONAL */; 30 | TypeSpecification_t typeSpecification; 31 | 32 | /* Context for parsing across buffer boundaries */ 33 | asn_struct_ctx_t _asn_ctx; 34 | } GetVariableAccessAttributesResponse_t; 35 | 36 | /* Implementation */ 37 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_GetVariableAccessAttributesResponse; 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | /* Referred external types */ 44 | #include "Address.h" 45 | 46 | #endif /* _GetVariableAccessAttributesResponse_H_ */ 47 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/INTEGER.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _INTEGER_H_ 6 | #define _INTEGER_H_ 7 | 8 | #include 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef ASN__PRIMITIVE_TYPE_t INTEGER_t; 16 | 17 | extern asn_TYPE_descriptor_t asn_DEF_INTEGER; 18 | 19 | /* Map with to integer value association */ 20 | typedef struct asn_INTEGER_enum_map_s { 21 | long nat_value; /* associated native integer value */ 22 | size_t enum_len; /* strlen("tag") */ 23 | const char *enum_name; /* "tag" */ 24 | } asn_INTEGER_enum_map_t; 25 | 26 | /* This type describes an enumeration for INTEGER and ENUMERATED types */ 27 | typedef struct asn_INTEGER_specifics_s { 28 | asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */ 29 | unsigned int *enum2value; /* "tag" => N; sorted by tag */ 30 | int map_count; /* Elements in either map */ 31 | int extension; /* This map is extensible */ 32 | int strict_enumeration; /* Enumeration set is fixed */ 33 | } asn_INTEGER_specifics_t; 34 | 35 | LIB61850_INTERNAL asn_struct_print_f INTEGER_print; 36 | LIB61850_INTERNAL ber_type_decoder_f INTEGER_decode_ber; 37 | LIB61850_INTERNAL der_type_encoder_f INTEGER_encode_der; 38 | LIB61850_INTERNAL xer_type_decoder_f INTEGER_decode_xer; 39 | LIB61850_INTERNAL xer_type_encoder_f INTEGER_encode_xer; 40 | LIB61850_INTERNAL per_type_decoder_f INTEGER_decode_uper; 41 | LIB61850_INTERNAL per_type_encoder_f INTEGER_encode_uper; 42 | 43 | /*********************************** 44 | * Some handy conversion routines. * 45 | ***********************************/ 46 | 47 | /* 48 | * Returns 0 if it was possible to convert, -1 otherwise. 49 | * -1/EINVAL: Mandatory argument missing 50 | * -1/ERANGE: Value encoded is out of range for long representation 51 | * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). 52 | */ 53 | LIB61850_INTERNAL int asn_INTEGER2long(const INTEGER_t *i, long *l); 54 | LIB61850_INTERNAL int asn_long2INTEGER(INTEGER_t *i, long l); 55 | 56 | /* 57 | * Convert the integer value into the corresponding enumeration map entry. 58 | */ 59 | LIB61850_INTERNAL const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* _INTEGER_H_ */ 66 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Identifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Identifier_H_ 9 | #define _Identifier_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Identifier */ 22 | typedef VisibleString_t Identifier_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Identifier; 26 | LIB61850_INTERNAL asn_struct_free_f Identifier_free; 27 | LIB61850_INTERNAL asn_struct_print_f Identifier_print; 28 | LIB61850_INTERNAL asn_constr_check_f Identifier_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f Identifier_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f Identifier_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f Identifier_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f Identifier_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _Identifier_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/IndexRangeSeq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _IndexRangeSeq_H_ 9 | #define _IndexRangeSeq_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Unsigned32.h" 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* IndexRangeSeq */ 23 | typedef struct IndexRangeSeq { 24 | Unsigned32_t lowIndex; 25 | Unsigned32_t numberOfElements; 26 | 27 | /* Context for parsing across buffer boundaries */ 28 | asn_struct_ctx_t _asn_ctx; 29 | } IndexRangeSeq_t; 30 | 31 | /* Implementation */ 32 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_IndexRangeSeq; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _IndexRangeSeq_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/InformationReport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _InformationReport_H_ 9 | #define _InformationReport_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "VariableAccessSpecification.h" 16 | #include 17 | #include 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Forward declarations */ 25 | struct AccessResult; 26 | 27 | /* InformationReport */ 28 | typedef struct InformationReport { 29 | VariableAccessSpecification_t variableAccessSpecification; 30 | struct InformationReport__listOfAccessResult { 31 | A_SEQUENCE_OF(struct AccessResult) list; 32 | 33 | /* Context for parsing across buffer boundaries */ 34 | asn_struct_ctx_t _asn_ctx; 35 | } listOfAccessResult; 36 | 37 | /* Context for parsing across buffer boundaries */ 38 | asn_struct_ctx_t _asn_ctx; 39 | } InformationReport_t; 40 | 41 | /* Implementation */ 42 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_InformationReport; 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | /* Referred external types */ 49 | #include "AccessResult.h" 50 | 51 | #endif /* _InformationReport_H_ */ 52 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/InitRequestDetail.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _InitRequestDetail_H_ 9 | #define _InitRequestDetail_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Integer16.h" 16 | #include "ParameterSupportOptions.h" 17 | #include "ServiceSupportOptions.h" 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* InitRequestDetail */ 25 | typedef struct InitRequestDetail { 26 | Integer16_t proposedVersionNumber; 27 | ParameterSupportOptions_t proposedParameterCBB; 28 | ServiceSupportOptions_t servicesSupportedCalling; 29 | 30 | /* Context for parsing across buffer boundaries */ 31 | asn_struct_ctx_t _asn_ctx; 32 | } InitRequestDetail_t; 33 | 34 | /* Implementation */ 35 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_InitRequestDetail; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* _InitRequestDetail_H_ */ 42 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/InitResponseDetail.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _InitResponseDetail_H_ 9 | #define _InitResponseDetail_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Integer16.h" 16 | #include "ParameterSupportOptions.h" 17 | #include "ServiceSupportOptions.h" 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* InitResponseDetail */ 25 | typedef struct InitResponseDetail { 26 | Integer16_t negotiatedVersionNumber; 27 | ParameterSupportOptions_t negotiatedParameterCBB; 28 | ServiceSupportOptions_t servicesSupportedCalled; 29 | 30 | /* Context for parsing across buffer boundaries */ 31 | asn_struct_ctx_t _asn_ctx; 32 | } InitResponseDetail_t; 33 | 34 | /* Implementation */ 35 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_InitResponseDetail; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* _InitResponseDetail_H_ */ 42 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/InitiateErrorPdu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _InitiateErrorPdu_H_ 9 | #define _InitiateErrorPdu_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "ServiceError.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* InitiateErrorPdu */ 22 | typedef ServiceError_t InitiateErrorPdu_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_InitiateErrorPdu; 26 | LIB61850_INTERNAL asn_struct_free_f InitiateErrorPdu_free; 27 | LIB61850_INTERNAL asn_struct_print_f InitiateErrorPdu_print; 28 | LIB61850_INTERNAL asn_constr_check_f InitiateErrorPdu_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f InitiateErrorPdu_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f InitiateErrorPdu_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f InitiateErrorPdu_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f InitiateErrorPdu_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _InitiateErrorPdu_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/InitiateRequestPdu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _InitiateRequestPdu_H_ 9 | #define _InitiateRequestPdu_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Integer32.h" 16 | #include "Integer16.h" 17 | #include "Integer8.h" 18 | #include "InitRequestDetail.h" 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* InitiateRequestPdu */ 26 | typedef struct InitiateRequestPdu { 27 | Integer32_t *localDetailCalling /* OPTIONAL */; 28 | Integer16_t proposedMaxServOutstandingCalling; 29 | Integer16_t proposedMaxServOutstandingCalled; 30 | Integer8_t *proposedDataStructureNestingLevel /* OPTIONAL */; 31 | InitRequestDetail_t mmsInitRequestDetail; 32 | 33 | /* Context for parsing across buffer boundaries */ 34 | asn_struct_ctx_t _asn_ctx; 35 | } InitiateRequestPdu_t; 36 | 37 | /* Implementation */ 38 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_InitiateRequestPdu; 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* _InitiateRequestPdu_H_ */ 45 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/InitiateResponsePdu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _InitiateResponsePdu_H_ 9 | #define _InitiateResponsePdu_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Integer32.h" 16 | #include "Integer16.h" 17 | #include "Integer8.h" 18 | #include "InitResponseDetail.h" 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* InitiateResponsePdu */ 26 | typedef struct InitiateResponsePdu { 27 | Integer32_t *localDetailCalled /* OPTIONAL */; 28 | Integer16_t negotiatedMaxServOutstandingCalling; 29 | Integer16_t negotiatedMaxServOutstandingCalled; 30 | Integer8_t *negotiatedDataStructureNestingLevel /* OPTIONAL */; 31 | InitResponseDetail_t mmsInitResponseDetail; 32 | 33 | /* Context for parsing across buffer boundaries */ 34 | asn_struct_ctx_t _asn_ctx; 35 | } InitiateResponsePdu_t; 36 | 37 | /* Implementation */ 38 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_InitiateResponsePdu; 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* _InitiateResponsePdu_H_ */ 45 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Integer16.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Integer16_H_ 9 | #define _Integer16_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Integer16 */ 22 | typedef long Integer16_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Integer16; 26 | LIB61850_INTERNAL asn_struct_free_f Integer16_free; 27 | LIB61850_INTERNAL asn_struct_print_f Integer16_print; 28 | LIB61850_INTERNAL asn_constr_check_f Integer16_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f Integer16_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f Integer16_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f Integer16_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f Integer16_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _Integer16_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Integer32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Integer32_H_ 9 | #define _Integer32_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Integer32 */ 22 | typedef long Integer32_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Integer32; 26 | LIB61850_INTERNAL asn_struct_free_f Integer32_free; 27 | LIB61850_INTERNAL asn_struct_print_f Integer32_print; 28 | LIB61850_INTERNAL asn_constr_check_f Integer32_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f Integer32_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f Integer32_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f Integer32_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f Integer32_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _Integer32_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Integer8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Integer8_H_ 9 | #define _Integer8_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Integer8 */ 22 | typedef long Integer8_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Integer8; 26 | LIB61850_INTERNAL asn_struct_free_f Integer8_free; 27 | LIB61850_INTERNAL asn_struct_print_f Integer8_print; 28 | LIB61850_INTERNAL asn_constr_check_f Integer8_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f Integer8_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f Integer8_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f Integer8_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f Integer8_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _Integer8_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ListOfVariableSeq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ListOfVariableSeq_H_ 9 | #define _ListOfVariableSeq_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "VariableSpecification.h" 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* Forward declarations */ 23 | struct AlternateAccess; 24 | 25 | /* ListOfVariableSeq */ 26 | typedef struct ListOfVariableSeq { 27 | VariableSpecification_t variableSpecification; 28 | struct AlternateAccess *alternateAccess /* OPTIONAL */; 29 | 30 | /* Context for parsing across buffer boundaries */ 31 | asn_struct_ctx_t _asn_ctx; 32 | } ListOfVariableSeq_t; 33 | 34 | /* Implementation */ 35 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ListOfVariableSeq; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | /* Referred external types */ 42 | #include "AlternateAccess.h" 43 | 44 | #endif /* _ListOfVariableSeq_H_ */ 45 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/MMSString.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _MMSString_H_ 9 | #define _MMSString_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* MMSString */ 22 | typedef UTF8String_t MMSString_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_MMSString; 26 | LIB61850_INTERNAL asn_struct_free_f MMSString_free; 27 | LIB61850_INTERNAL asn_struct_print_f MMSString_print; 28 | LIB61850_INTERNAL asn_constr_check_f MMSString_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f MMSString_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f MMSString_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f MMSString_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f MMSString_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _MMSString_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/MmsPdu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _MmsPdu_H_ 9 | #define _MmsPdu_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "ConfirmedRequestPdu.h" 16 | #include "ConfirmedResponsePdu.h" 17 | #include "ConfirmedErrorPDU.h" 18 | #include "UnconfirmedPDU.h" 19 | #include "RejectPDU.h" 20 | #include "InitiateRequestPdu.h" 21 | #include "InitiateResponsePdu.h" 22 | #include "InitiateErrorPdu.h" 23 | #include "ConcludeRequestPDU.h" 24 | #include "ConcludeResponsePDU.h" 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Dependencies */ 32 | typedef enum MmsPdu_PR { 33 | MmsPdu_PR_NOTHING, /* No components present */ 34 | MmsPdu_PR_confirmedRequestPdu, 35 | MmsPdu_PR_confirmedResponsePdu, 36 | MmsPdu_PR_confirmedErrorPDU, 37 | MmsPdu_PR_unconfirmedPDU, 38 | MmsPdu_PR_rejectPDU, 39 | MmsPdu_PR_initiateRequestPdu, 40 | MmsPdu_PR_initiateResponsePdu, 41 | MmsPdu_PR_initiateErrorPdu, 42 | MmsPdu_PR_concludeRequestPDU, 43 | MmsPdu_PR_concludeResponsePDU 44 | } MmsPdu_PR; 45 | 46 | /* MmsPdu */ 47 | typedef struct MmsPdu { 48 | MmsPdu_PR present; 49 | union MmsPdu_u { 50 | ConfirmedRequestPdu_t confirmedRequestPdu; 51 | ConfirmedResponsePdu_t confirmedResponsePdu; 52 | ConfirmedErrorPDU_t confirmedErrorPDU; 53 | UnconfirmedPDU_t unconfirmedPDU; 54 | RejectPDU_t rejectPDU; 55 | InitiateRequestPdu_t initiateRequestPdu; 56 | InitiateResponsePdu_t initiateResponsePdu; 57 | InitiateErrorPdu_t initiateErrorPdu; 58 | ConcludeRequestPDU_t concludeRequestPDU; 59 | ConcludeResponsePDU_t concludeResponsePDU; 60 | } choice; 61 | 62 | /* Context for parsing across buffer boundaries */ 63 | asn_struct_ctx_t _asn_ctx; 64 | } MmsPdu_t; 65 | 66 | /* Implementation */ 67 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_MmsPdu; 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* _MmsPdu_H_ */ 74 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/NULL.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef ASN_TYPE_NULL_H 6 | #define ASN_TYPE_NULL_H 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* 15 | * The value of the NULL type is meaningless: see BOOLEAN if you want to 16 | * carry true/false semantics. 17 | */ 18 | typedef int NULL_t; 19 | 20 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_NULL; 21 | 22 | LIB61850_INTERNAL asn_struct_print_f NULL_print; 23 | LIB61850_INTERNAL der_type_encoder_f NULL_encode_der; 24 | LIB61850_INTERNAL xer_type_decoder_f NULL_decode_xer; 25 | LIB61850_INTERNAL xer_type_encoder_f NULL_encode_xer; 26 | LIB61850_INTERNAL per_type_decoder_f NULL_decode_uper; 27 | LIB61850_INTERNAL per_type_encoder_f NULL_encode_uper; 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif /* NULL_H */ 34 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/NativeEnumerated.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004, 2005, 2006 Lev Walkin . 3 | * All rights reserved. 4 | * Redistribution and modifications are permitted subject to BSD license. 5 | */ 6 | /* 7 | * This type differs from the standard ENUMERATED in that it is modelled using 8 | * the fixed machine type (long, int, short), so it can hold only values of 9 | * limited length. There is no type (i.e., NativeEnumerated_t, any integer type 10 | * will do). 11 | * This type may be used when integer range is limited by subtype constraints. 12 | */ 13 | #ifndef _NativeEnumerated_H_ 14 | #define _NativeEnumerated_H_ 15 | 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated; 23 | 24 | LIB61850_INTERNAL xer_type_encoder_f NativeEnumerated_encode_xer; 25 | LIB61850_INTERNAL per_type_decoder_f NativeEnumerated_decode_uper; 26 | LIB61850_INTERNAL per_type_encoder_f NativeEnumerated_encode_uper; 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif /* _NativeEnumerated_H_ */ 33 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/NativeInteger.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | /* 6 | * This type differs from the standard INTEGER in that it is modelled using 7 | * the fixed machine type (long, int, short), so it can hold only values of 8 | * limited length. There is no type (i.e., NativeInteger_t, any integer type 9 | * will do). 10 | * This type may be used when integer range is limited by subtype constraints. 11 | */ 12 | #ifndef _NativeInteger_H_ 13 | #define _NativeInteger_H_ 14 | 15 | #include 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | LIB61850_INTERNAL 23 | extern asn_TYPE_descriptor_t asn_DEF_NativeInteger; 24 | 25 | LIB61850_INTERNAL 26 | asn_struct_free_f NativeInteger_free; 27 | 28 | LIB61850_INTERNAL 29 | asn_struct_print_f NativeInteger_print; 30 | 31 | LIB61850_INTERNAL 32 | ber_type_decoder_f NativeInteger_decode_ber; 33 | 34 | LIB61850_INTERNAL 35 | der_type_encoder_f NativeInteger_encode_der; 36 | 37 | LIB61850_INTERNAL 38 | xer_type_decoder_f NativeInteger_decode_xer; 39 | 40 | LIB61850_INTERNAL 41 | xer_type_encoder_f NativeInteger_encode_xer; 42 | 43 | LIB61850_INTERNAL 44 | per_type_decoder_f NativeInteger_decode_uper; 45 | 46 | LIB61850_INTERNAL 47 | per_type_encoder_f NativeInteger_encode_uper; 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* _NativeInteger_H_ */ 54 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ObjectClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ObjectClass_H_ 9 | #define _ObjectClass_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* Dependencies */ 23 | typedef enum ObjectClass_PR { 24 | ObjectClass_PR_NOTHING, /* No components present */ 25 | ObjectClass_PR_basicObjectClass 26 | } ObjectClass_PR; 27 | typedef enum ObjectClass__basicObjectClass { 28 | ObjectClass__basicObjectClass_namedVariable = 0, 29 | ObjectClass__basicObjectClass_scatteredAccess = 1, 30 | ObjectClass__basicObjectClass_namedVariableList = 2, 31 | ObjectClass__basicObjectClass_namedType = 3, 32 | ObjectClass__basicObjectClass_semaphore = 4, 33 | ObjectClass__basicObjectClass_eventCondition = 5, 34 | ObjectClass__basicObjectClass_eventAction = 6, 35 | ObjectClass__basicObjectClass_eventEnrollment = 7, 36 | ObjectClass__basicObjectClass_journal = 8, 37 | ObjectClass__basicObjectClass_domain = 9, 38 | ObjectClass__basicObjectClass_programInvocation = 10, 39 | ObjectClass__basicObjectClass_operatorStation = 11, 40 | ObjectClass__basicObjectClass_dataExchange = 12, 41 | ObjectClass__basicObjectClass_accessControlList = 13 42 | } e_ObjectClass__basicObjectClass; 43 | 44 | /* ObjectClass */ 45 | typedef struct ObjectClass { 46 | ObjectClass_PR present; 47 | union ObjectClass_u { 48 | INTEGER_t basicObjectClass; 49 | } choice; 50 | 51 | /* Context for parsing across buffer boundaries */ 52 | asn_struct_ctx_t _asn_ctx; 53 | } ObjectClass_t; 54 | 55 | /* Implementation */ 56 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ObjectClass; 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* _ObjectClass_H_ */ 63 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ObjectName.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ObjectName_H_ 9 | #define _ObjectName_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Identifier.h" 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* Dependencies */ 24 | typedef enum ObjectName_PR { 25 | ObjectName_PR_NOTHING, /* No components present */ 26 | ObjectName_PR_vmdspecific, 27 | ObjectName_PR_domainspecific, 28 | ObjectName_PR_aaspecific 29 | } ObjectName_PR; 30 | 31 | struct ObjectName__domainspecific { 32 | Identifier_t domainId; 33 | Identifier_t itemId; 34 | 35 | /* Context for parsing across buffer boundaries */ 36 | asn_struct_ctx_t _asn_ctx; 37 | }; 38 | 39 | /* ObjectName */ 40 | typedef struct ObjectName { 41 | ObjectName_PR present; 42 | union ObjectName_u { 43 | Identifier_t vmdspecific; 44 | struct ObjectName__domainspecific domainspecific; 45 | Identifier_t aaspecific; 46 | } choice; 47 | 48 | /* Context for parsing across buffer boundaries */ 49 | asn_struct_ctx_t _asn_ctx; 50 | } ObjectName_t; 51 | 52 | /* Implementation */ 53 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ObjectName; 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif /* _ObjectName_H_ */ 60 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ParameterSupportOptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ParameterSupportOptions_H_ 9 | #define _ParameterSupportOptions_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Dependencies */ 22 | typedef enum ParameterSupportOptions { 23 | ParameterSupportOptions_str1 = 0, 24 | ParameterSupportOptions_str2 = 1, 25 | ParameterSupportOptions_vnam = 2, 26 | ParameterSupportOptions_valt = 3, 27 | ParameterSupportOptions_vadr = 4, 28 | ParameterSupportOptions_vsca = 5, 29 | ParameterSupportOptions_tpy = 6, 30 | ParameterSupportOptions_vlis = 7, 31 | ParameterSupportOptions_real = 8, 32 | ParameterSupportOptions_cei = 10 33 | } e_ParameterSupportOptions; 34 | 35 | /* ParameterSupportOptions */ 36 | typedef BIT_STRING_t ParameterSupportOptions_t; 37 | 38 | /* Implementation */ 39 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ParameterSupportOptions; 40 | LIB61850_INTERNAL asn_struct_free_f ParameterSupportOptions_free; 41 | LIB61850_INTERNAL asn_struct_print_f ParameterSupportOptions_print; 42 | LIB61850_INTERNAL asn_constr_check_f ParameterSupportOptions_constraint; 43 | LIB61850_INTERNAL ber_type_decoder_f ParameterSupportOptions_decode_ber; 44 | LIB61850_INTERNAL der_type_encoder_f ParameterSupportOptions_encode_der; 45 | LIB61850_INTERNAL xer_type_decoder_f ParameterSupportOptions_decode_xer; 46 | LIB61850_INTERNAL xer_type_encoder_f ParameterSupportOptions_encode_xer; 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* _ParameterSupportOptions_H_ */ 53 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ReadRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ReadRequest_H_ 9 | #define _ReadRequest_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include "VariableAccessSpecification.h" 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* ReadRequest */ 24 | typedef struct ReadRequest { 25 | BOOLEAN_t *specificationWithResult /* DEFAULT FALSE */; 26 | VariableAccessSpecification_t variableAccessSpecification; 27 | 28 | /* Context for parsing across buffer boundaries */ 29 | asn_struct_ctx_t _asn_ctx; 30 | } ReadRequest_t; 31 | 32 | /* Implementation */ 33 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ReadRequest; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* _ReadRequest_H_ */ 40 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ReadResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ReadResponse_H_ 9 | #define _ReadResponse_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* Forward declarations */ 24 | struct VariableAccessSpecification; 25 | struct AccessResult; 26 | 27 | struct ReadResponse__listOfAccessResult { 28 | A_SEQUENCE_OF(struct AccessResult) list; 29 | 30 | /* Context for parsing across buffer boundaries */ 31 | asn_struct_ctx_t _asn_ctx; 32 | }; 33 | 34 | /* ReadResponse */ 35 | typedef struct ReadResponse { 36 | struct VariableAccessSpecification *variableAccessSpecification /* OPTIONAL */; 37 | struct ReadResponse__listOfAccessResult listOfAccessResult; 38 | 39 | /* Context for parsing across buffer boundaries */ 40 | asn_struct_ctx_t _asn_ctx; 41 | } ReadResponse_t; 42 | 43 | /* Implementation */ 44 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ReadResponse; 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | /* Referred external types */ 51 | #include "VariableAccessSpecification.h" 52 | #include "AccessResult.h" 53 | 54 | #endif /* _ReadResponse_H_ */ 55 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ScatteredAccessDescription.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _ScatteredAccessDescription_H_ 9 | #define _ScatteredAccessDescription_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include "Identifier.h" 17 | #include 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Forward declarations */ 25 | struct VariableSpecification; 26 | struct AlternateAccess; 27 | 28 | struct ScatteredAccessDescription__Member { 29 | Identifier_t *componentName /* OPTIONAL */; 30 | struct VariableSpecification *variableSpecification; 31 | struct AlternateAccess *alternateAccess /* OPTIONAL */; 32 | 33 | /* Context for parsing across buffer boundaries */ 34 | asn_struct_ctx_t _asn_ctx; 35 | }; 36 | 37 | 38 | 39 | /* ScatteredAccessDescription */ 40 | typedef struct ScatteredAccessDescription { 41 | A_SEQUENCE_OF(struct ScatteredAccessDescription__Member) list; 42 | 43 | /* Context for parsing across buffer boundaries */ 44 | asn_struct_ctx_t _asn_ctx; 45 | } ScatteredAccessDescription_t; 46 | 47 | /* Implementation */ 48 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_ScatteredAccessDescription; 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | /* Referred external types */ 55 | #include "VariableSpecification.h" 56 | #include "AlternateAccess.h" 57 | 58 | #endif /* _ScatteredAccessDescription_H_ */ 59 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/StructComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _StructComponent_H_ 9 | #define _StructComponent_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "Identifier.h" 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* Forward declarations */ 23 | struct TypeSpecification; 24 | 25 | /* StructComponent */ 26 | typedef struct StructComponent { 27 | Identifier_t *componentName /* OPTIONAL */; 28 | struct TypeSpecification *componentType; 29 | 30 | /* Context for parsing across buffer boundaries */ 31 | asn_struct_ctx_t _asn_ctx; 32 | } StructComponent_t; 33 | 34 | /* Implementation */ 35 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_StructComponent; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | /* Referred external types */ 42 | #include "TypeSpecification.h" 43 | 44 | #endif /* _StructComponent_H_ */ 45 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/TimeOfDay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _TimeOfDay_H_ 9 | #define _TimeOfDay_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* TimeOfDay */ 22 | typedef OCTET_STRING_t TimeOfDay_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_TimeOfDay; 26 | LIB61850_INTERNAL asn_struct_free_f TimeOfDay_free; 27 | LIB61850_INTERNAL asn_struct_print_f TimeOfDay_print; 28 | LIB61850_INTERNAL asn_constr_check_f TimeOfDay_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f TimeOfDay_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f TimeOfDay_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f TimeOfDay_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f TimeOfDay_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _TimeOfDay_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/UTF8String.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _UTF8String_H_ 6 | #define _UTF8String_H_ 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef OCTET_STRING_t UTF8String_t; /* Implemented via OCTET STRING */ 15 | 16 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_UTF8String; 17 | 18 | LIB61850_INTERNAL asn_struct_print_f UTF8String_print; 19 | LIB61850_INTERNAL asn_constr_check_f UTF8String_constraint; 20 | 21 | /* 22 | * Returns length of the given UTF-8 string in characters, 23 | * or a negative error code: 24 | * -1: UTF-8 sequence truncated 25 | * -2: Illegal UTF-8 sequence start 26 | * -3: Continuation expectation failed 27 | * -4: Not minimal length encoding 28 | * -5: Invalid arguments 29 | */ 30 | LIB61850_INTERNAL 31 | ssize_t UTF8String_length(const UTF8String_t *st); 32 | 33 | /* 34 | * Convert the UTF-8 string into a sequence of wide characters. 35 | * Returns the number of characters necessary. 36 | * Returned value might be greater than dstlen. 37 | * In case of conversion error, 0 is returned. 38 | * 39 | * If st points to a valid UTF-8 string, calling 40 | * UTF8String_to_wcs(st, 0, 0); 41 | * is equivalent to 42 | * UTF8String_length(const UTF8String_t *st); 43 | */ 44 | LIB61850_INTERNAL 45 | size_t UTF8String_to_wcs(const UTF8String_t *st, uint32_t *dst, size_t dstlen); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* _UTF8String_H_ */ 52 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/UnconfirmedPDU.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _UnconfirmedPDU_H_ 9 | #define _UnconfirmedPDU_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "UnconfirmedService.h" 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* UnconfirmedPDU */ 23 | typedef struct UnconfirmedPDU { 24 | UnconfirmedService_t unconfirmedService; 25 | 26 | /* Context for parsing across buffer boundaries */ 27 | asn_struct_ctx_t _asn_ctx; 28 | } UnconfirmedPDU_t; 29 | 30 | /* Implementation */ 31 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_UnconfirmedPDU; 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif /* _UnconfirmedPDU_H_ */ 38 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/UnconfirmedService.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _UnconfirmedService_H_ 9 | #define _UnconfirmedService_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "InformationReport.h" 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* Dependencies */ 23 | typedef enum UnconfirmedService_PR { 24 | UnconfirmedService_PR_NOTHING, /* No components present */ 25 | UnconfirmedService_PR_informationReport 26 | } UnconfirmedService_PR; 27 | 28 | /* UnconfirmedService */ 29 | typedef struct UnconfirmedService { 30 | UnconfirmedService_PR present; 31 | union UnconfirmedService_u { 32 | InformationReport_t informationReport; 33 | } choice; 34 | 35 | /* Context for parsing across buffer boundaries */ 36 | asn_struct_ctx_t _asn_ctx; 37 | } UnconfirmedService_t; 38 | 39 | /* Implementation */ 40 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_UnconfirmedService; 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* _UnconfirmedService_H_ */ 47 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Unsigned16.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Unsigned16_H_ 9 | #define _Unsigned16_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Unsigned16 */ 22 | typedef long Unsigned16_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Unsigned16; 26 | LIB61850_INTERNAL asn_struct_free_f Unsigned16_free; 27 | LIB61850_INTERNAL asn_struct_print_f Unsigned16_print; 28 | LIB61850_INTERNAL asn_constr_check_f Unsigned16_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f Unsigned16_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f Unsigned16_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f Unsigned16_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f Unsigned16_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _Unsigned16_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Unsigned32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Unsigned32_H_ 9 | #define _Unsigned32_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Unsigned32 */ 22 | typedef INTEGER_t Unsigned32_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Unsigned32; 26 | LIB61850_INTERNAL asn_struct_free_f Unsigned32_free; 27 | LIB61850_INTERNAL asn_struct_print_f Unsigned32_print; 28 | LIB61850_INTERNAL asn_constr_check_f Unsigned32_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f Unsigned32_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f Unsigned32_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f Unsigned32_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f Unsigned32_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _Unsigned32_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/Unsigned8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _Unsigned8_H_ 9 | #define _Unsigned8_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Unsigned8 */ 22 | typedef long Unsigned8_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_Unsigned8; 26 | LIB61850_INTERNAL asn_struct_free_f Unsigned8_free; 27 | LIB61850_INTERNAL asn_struct_print_f Unsigned8_print; 28 | LIB61850_INTERNAL asn_constr_check_f Unsigned8_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f Unsigned8_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f Unsigned8_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f Unsigned8_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f Unsigned8_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _Unsigned8_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/UtcTime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _UtcTime_H_ 9 | #define _UtcTime_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* UtcTime */ 22 | typedef OCTET_STRING_t UtcTime_t; 23 | 24 | /* Implementation */ 25 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_UtcTime; 26 | LIB61850_INTERNAL asn_struct_free_f UtcTime_free; 27 | LIB61850_INTERNAL asn_struct_print_f UtcTime_print; 28 | LIB61850_INTERNAL asn_constr_check_f UtcTime_constraint; 29 | LIB61850_INTERNAL ber_type_decoder_f UtcTime_decode_ber; 30 | LIB61850_INTERNAL der_type_encoder_f UtcTime_encode_der; 31 | LIB61850_INTERNAL xer_type_decoder_f UtcTime_decode_xer; 32 | LIB61850_INTERNAL xer_type_encoder_f UtcTime_encode_xer; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _UtcTime_H_ */ 39 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/VariableAccessSpecification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _VariableAccessSpecification_H_ 9 | #define _VariableAccessSpecification_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "ObjectName.h" 16 | #include 17 | #include 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Dependencies */ 25 | typedef enum VariableAccessSpecification_PR { 26 | VariableAccessSpecification_PR_NOTHING, /* No components present */ 27 | VariableAccessSpecification_PR_listOfVariable, 28 | VariableAccessSpecification_PR_variableListName 29 | } VariableAccessSpecification_PR; 30 | 31 | /* Forward declarations */ 32 | struct ListOfVariableSeq; 33 | 34 | struct VariableAccessSpecification__listOfVariable { 35 | A_SEQUENCE_OF(struct ListOfVariableSeq) list; 36 | 37 | /* Context for parsing across buffer boundaries */ 38 | asn_struct_ctx_t _asn_ctx; 39 | }; 40 | 41 | /* VariableAccessSpecification */ 42 | typedef struct VariableAccessSpecification { 43 | VariableAccessSpecification_PR present; 44 | union VariableAccessSpecification_u { 45 | struct VariableAccessSpecification__listOfVariable listOfVariable; 46 | ObjectName_t variableListName; 47 | } choice; 48 | 49 | /* Context for parsing across buffer boundaries */ 50 | asn_struct_ctx_t _asn_ctx; 51 | } VariableAccessSpecification_t; 52 | 53 | /* Implementation */ 54 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_VariableAccessSpecification; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | /* Referred external types */ 61 | #include "ListOfVariableSeq.h" 62 | 63 | #endif /* _VariableAccessSpecification_H_ */ 64 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/VariableSpecification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _VariableSpecification_H_ 9 | #define _VariableSpecification_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "ObjectName.h" 16 | #include "Address.h" 17 | #include 18 | #include "TypeSpecification.h" 19 | #include 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* Dependencies */ 27 | typedef enum VariableSpecification_PR { 28 | VariableSpecification_PR_NOTHING, /* No components present */ 29 | VariableSpecification_PR_name, 30 | VariableSpecification_PR_address, 31 | VariableSpecification_PR_variableDescription, 32 | VariableSpecification_PR_scatteredAccessDescription, 33 | VariableSpecification_PR_invalidated 34 | } VariableSpecification_PR; 35 | 36 | /* Forward declarations */ 37 | struct ScatteredAccessDescription; 38 | 39 | struct VariableSpecification__variableDescription { 40 | Address_t address; 41 | TypeSpecification_t typeSpecification; 42 | 43 | /* Context for parsing across buffer boundaries */ 44 | asn_struct_ctx_t _asn_ctx; 45 | }; 46 | 47 | /* VariableSpecification */ 48 | typedef struct VariableSpecification { 49 | VariableSpecification_PR present; 50 | union VariableSpecification_u { 51 | ObjectName_t name; 52 | Address_t address; 53 | struct VariableSpecification__variableDescription variableDescription; 54 | struct ScatteredAccessDescription *scatteredAccessDescription; 55 | NULL_t invalidated; 56 | } choice; 57 | 58 | /* Context for parsing across buffer boundaries */ 59 | asn_struct_ctx_t _asn_ctx; 60 | } VariableSpecification_t; 61 | 62 | /* Implementation */ 63 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_VariableSpecification; 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | /* Referred external types */ 70 | #include "ScatteredAccessDescription.h" 71 | 72 | #endif /* _VariableSpecification_H_ */ 73 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/VisibleString.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _VisibleString_H_ 6 | #define _VisibleString_H_ 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef OCTET_STRING_t VisibleString_t; /* Implemented via OCTET STRING */ 15 | 16 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_VisibleString; 17 | 18 | LIB61850_INTERNAL asn_constr_check_f VisibleString_constraint; 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif /* _VisibleString_H_ */ 25 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/WriteRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _WriteRequest_H_ 9 | #define _WriteRequest_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include "VariableAccessSpecification.h" 16 | #include 17 | #include 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Forward declarations */ 25 | struct Data; 26 | 27 | struct WriteRequest__listOfData { 28 | A_SEQUENCE_OF(struct Data) list; 29 | 30 | /* Context for parsing across buffer boundaries */ 31 | asn_struct_ctx_t _asn_ctx; 32 | }; 33 | 34 | /* WriteRequest */ 35 | typedef struct WriteRequest { 36 | VariableAccessSpecification_t variableAccessSpecification; 37 | struct WriteRequest__listOfData listOfData; 38 | 39 | /* Context for parsing across buffer boundaries */ 40 | asn_struct_ctx_t _asn_ctx; 41 | } WriteRequest_t; 42 | 43 | /* Implementation */ 44 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_WriteRequest; 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | /* Referred external types */ 51 | #include "Data.h" 52 | 53 | #endif /* _WriteRequest_H_ */ 54 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/WriteResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) 3 | * From ASN.1 module "MMS" 4 | * found in "../mms-extended.asn" 5 | * `asn1c -fskeletons-copy` 6 | */ 7 | 8 | #ifndef _WriteResponse_H_ 9 | #define _WriteResponse_H_ 10 | 11 | 12 | #include 13 | 14 | /* Including external dependencies */ 15 | #include 16 | #include "DataAccessError.h" 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Dependencies */ 26 | typedef enum WriteResponse__Member_PR { 27 | WriteResponse__Member_PR_NOTHING, /* No components present */ 28 | WriteResponse__Member_PR_failure, 29 | WriteResponse__Member_PR_success 30 | } WriteResponse__Member_PR; 31 | 32 | struct WriteResponse__Member { 33 | WriteResponse__Member_PR present; 34 | union WriteResponse__Member_u { 35 | DataAccessError_t failure; 36 | NULL_t success; 37 | } choice; 38 | 39 | /* Context for parsing across buffer boundaries */ 40 | asn_struct_ctx_t _asn_ctx; 41 | }; 42 | 43 | /* WriteResponse */ 44 | typedef struct WriteResponse { 45 | A_SEQUENCE_OF(struct WriteResponse__Member) list; 46 | 47 | /* Context for parsing across buffer boundaries */ 48 | asn_struct_ctx_t _asn_ctx; 49 | } WriteResponse_t; 50 | 51 | /* Implementation */ 52 | LIB61850_INTERNAL extern asn_TYPE_descriptor_t asn_DEF_WriteResponse; 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* _WriteResponse_H_ */ 59 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/asn_SEQUENCE_OF.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef ASN_SEQUENCE_OF_H 6 | #define ASN_SEQUENCE_OF_H 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* 15 | * SEQUENCE OF is the same as SET OF with a tiny difference: 16 | * the delete operation preserves the initial order of elements 17 | * and thus MAY operate in non-constant time. 18 | */ 19 | #define A_SEQUENCE_OF(type) A_SET_OF(type) 20 | 21 | #define ASN_SEQUENCE_ADD(headptr, ptr) \ 22 | asn_sequence_add((headptr), (ptr)) 23 | 24 | /*********************************************** 25 | * Implementation of the SEQUENCE OF structure. 26 | */ 27 | 28 | #define asn_sequence_add asn_set_add 29 | #define asn_sequence_empty asn_set_empty 30 | 31 | /* 32 | * Delete the element from the set by its number (base 0). 33 | * This is NOT a constant-time operation. 34 | * The order of elements is preserved. 35 | * If _do_free is given AND the (*free) is initialized, the element 36 | * will be freed using the custom (*free) function as well. 37 | */ 38 | LIB61850_INTERNAL void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free); 39 | 40 | /* 41 | * Cope with different conversions requirements to/from void in C and C++. 42 | * This is mostly useful for support library. 43 | */ 44 | typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_; 45 | #define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr)) 46 | #define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr)) 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* ASN_SEQUENCE_OF_H */ 53 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/asn_SET_OF.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef ASN_SET_OF_H 6 | #define ASN_SET_OF_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define A_SET_OF(type) \ 13 | struct { \ 14 | type **array; \ 15 | int count; /* Meaningful size */ \ 16 | int size; /* Allocated size */ \ 17 | void (*free)(type *); \ 18 | } 19 | 20 | #define ASN_SET_ADD(headptr, ptr) \ 21 | asn_set_add((headptr), (ptr)) 22 | 23 | /******************************************* 24 | * Implementation of the SET OF structure. 25 | */ 26 | 27 | /* 28 | * Add another structure into the set by its pointer. 29 | * RETURN VALUES: 30 | * 0 for success and -1/errno for failure. 31 | */ 32 | LIB61850_INTERNAL int asn_set_add(void *asn_set_of_x, void *ptr); 33 | 34 | /* 35 | * Delete the element from the set by its number (base 0). 36 | * This is a constant-time operation. The order of elements before the 37 | * deleted ones is guaranteed, the order of elements after the deleted 38 | * one is NOT guaranteed. 39 | * If _do_free is given AND the (*free) is initialized, the element 40 | * will be freed using the custom (*free) function as well. 41 | */ 42 | LIB61850_INTERNAL void asn_set_del(void *asn_set_of_x, int number, int _do_free); 43 | 44 | /* 45 | * Empty the contents of the set. Will free the elements, if (*free) is given. 46 | * Will NOT free the set itself. 47 | */ 48 | LIB61850_INTERNAL void asn_set_empty(void *asn_set_of_x); 49 | 50 | /* 51 | * Cope with different conversions requirements to/from void in C and C++. 52 | * This is mostly useful for support library. 53 | */ 54 | typedef A_SET_OF(void) asn_anonymous_set_; 55 | #define _A_SET_FROM_VOID(ptr) ((asn_anonymous_set_ *)(ptr)) 56 | #define _A_CSET_FROM_VOID(ptr) ((const asn_anonymous_set_ *)(ptr)) 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* ASN_SET_OF_H */ 63 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/asn_application.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | /* 6 | * Application-level ASN.1 callbacks. 7 | */ 8 | #ifndef _ASN_APPLICATION_H_ 9 | #define _ASN_APPLICATION_H_ 10 | 11 | #include "asn_system.h" /* for platform-dependent types */ 12 | #include "asn_codecs.h" /* for ASN.1 codecs specifics */ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* 19 | * Generic type of an application-defined callback to return various 20 | * types of data to the application. 21 | * EXPECTED RETURN VALUES: 22 | * -1: Failed to consume bytes. Abort the mission. 23 | * Non-negative return values indicate success, and ignored. 24 | */ 25 | typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size, 26 | void *application_specific_key); 27 | 28 | /* 29 | * A callback of this type is called whenever constraint validation fails 30 | * on some ASN.1 type. See "constraints.h" for more details on constraint 31 | * validation. 32 | * This callback specifies a descriptor of the ASN.1 type which failed 33 | * the constraint check, as well as human readable message on what 34 | * particular constraint has failed. 35 | */ 36 | typedef void (asn_app_constraint_failed_f)(void *application_specific_key, 37 | struct asn_TYPE_descriptor_s *type_descriptor_which_failed, 38 | const void *structure_which_failed_ptr, 39 | const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */ 46 | 47 | #endif /* _ASN_APPLICATION_H_ */ 48 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/asn_codecs_prim.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef ASN_CODECS_PRIM_H 6 | #define ASN_CODECS_PRIM_H 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct ASN__PRIMITIVE_TYPE_s { 15 | uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ 16 | int size; /* Size of the buffer */ 17 | } ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */ 18 | 19 | LIB61850_INTERNAL asn_struct_free_f ASN__PRIMITIVE_TYPE_free; 20 | LIB61850_INTERNAL ber_type_decoder_f ber_decode_primitive; 21 | LIB61850_INTERNAL der_type_encoder_f der_encode_primitive; 22 | 23 | /* 24 | * A callback specification for the xer_decode_primitive() function below. 25 | */ 26 | enum xer_pbd_rval { 27 | XPBD_SYSTEM_FAILURE, /* System failure (memory shortage, etc) */ 28 | XPBD_DECODER_LIMIT, /* Hit some decoder limitation or deficiency */ 29 | XPBD_BROKEN_ENCODING, /* Encoding of a primitive body is broken */ 30 | XPBD_NOT_BODY_IGNORE, /* Not a body format, but safe to ignore */ 31 | XPBD_BODY_CONSUMED /* Body is recognized and consumed */ 32 | }; 33 | typedef enum xer_pbd_rval (xer_primitive_body_decoder_f) 34 | (asn_TYPE_descriptor_t *td, void *struct_ptr, 35 | const void *chunk_buf, size_t chunk_size); 36 | 37 | /* 38 | * Specific function to decode simple primitive types. 39 | * Also see xer_decode_general() in xer_decoder.h 40 | */ 41 | LIB61850_INTERNAL asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, 42 | asn_TYPE_descriptor_t *type_descriptor, 43 | void **struct_ptr, size_t struct_size, 44 | const char *opt_mname, 45 | const void *buf_ptr, size_t size, 46 | xer_primitive_body_decoder_f *prim_body_decoder 47 | ); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* ASN_CODECS_PRIM_H */ 54 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ber_decoder.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _BER_DECODER_H_ 6 | #define _BER_DECODER_H_ 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct asn_TYPE_descriptor_s; /* Forward declaration */ 15 | struct asn_codec_ctx_s; /* Forward declaration */ 16 | 17 | /* 18 | * The BER decoder of any type. 19 | * This function may be invoked directly from the application. 20 | */ 21 | LIB61850_INTERNAL asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx, 22 | struct asn_TYPE_descriptor_s *type_descriptor, 23 | void **struct_ptr, /* Pointer to a target structure's pointer */ 24 | const void *buffer, /* Data to be decoded */ 25 | size_t size /* Size of that buffer */ 26 | ); 27 | 28 | /* 29 | * Type of generic function which decodes the byte stream into the structure. 30 | */ 31 | typedef asn_dec_rval_t (ber_type_decoder_f)( 32 | struct asn_codec_ctx_s *opt_codec_ctx, 33 | struct asn_TYPE_descriptor_s *type_descriptor, 34 | void **struct_ptr, const void *buf_ptr, size_t size, 35 | int tag_mode); 36 | 37 | /******************************* 38 | * INTERNALLY USEFUL FUNCTIONS * 39 | *******************************/ 40 | 41 | /* 42 | * Check that all tags correspond to the type definition (as given in head). 43 | * On return, last_length would contain either a non-negative length of the 44 | * value part of the last TLV, or the negative number of expected 45 | * "end of content" sequences. The number may only be negative if the 46 | * head->last_tag_form is non-zero. 47 | */ 48 | LIB61850_INTERNAL asn_dec_rval_t ber_check_tags( 49 | struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */ 50 | struct asn_TYPE_descriptor_s *type_descriptor, 51 | asn_struct_ctx_t *opt_ctx, /* saved decoding context */ 52 | const void *ptr, size_t size, 53 | int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ 54 | int last_tag_form, /* {-1,0:1}: any, primitive, constr */ 55 | ber_tlv_len_t *last_length, 56 | int *opt_tlv_form /* optional tag form */ 57 | ); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* _BER_DECODER_H_ */ 64 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ber_tlv_length.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _BER_TLV_LENGTH_H_ 6 | #define _BER_TLV_LENGTH_H_ 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef ssize_t ber_tlv_len_t; 13 | 14 | /* 15 | * This function tries to fetch the length of the BER TLV value and place it 16 | * in *len_r. 17 | * RETURN VALUES: 18 | * 0: More data expected than bufptr contains. 19 | * -1: Fatal error deciphering length. 20 | * >0: Number of bytes used from bufptr. 21 | * On return with >0, len_r is constrained as -1..MAX, where -1 mean 22 | * that the value is of indefinite length. 23 | */ 24 | LIB61850_INTERNAL ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, 25 | ber_tlv_len_t *len_r); 26 | 27 | /* 28 | * This function expects bufptr to be positioned over L in TLV. 29 | * It returns number of bytes occupied by L and V together, suitable 30 | * for skipping. The function properly handles indefinite length. 31 | * RETURN VALUES: 32 | * Standard {-1,0,>0} convention. 33 | */ 34 | LIB61850_INTERNAL ssize_t ber_skip_length( 35 | struct asn_codec_ctx_s *opt_codec_ctx, /* optional context */ 36 | int _is_constructed, const void *bufptr, size_t size); 37 | 38 | /* 39 | * This function serializes the length (L from TLV) in DER format. 40 | * It always returns number of bytes necessary to represent the length, 41 | * it is a caller's responsibility to check the return value 42 | * against the supplied buffer's size. 43 | */ 44 | LIB61850_INTERNAL size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif /* _BER_TLV_LENGTH_H_ */ 51 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/ber_tlv_tag.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _BER_TLV_TAG_H_ 6 | #define _BER_TLV_TAG_H_ 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | enum asn_tag_class { 13 | ASN_TAG_CLASS_UNIVERSAL = 0, /* 0b00 */ 14 | ASN_TAG_CLASS_APPLICATION = 1, /* 0b01 */ 15 | ASN_TAG_CLASS_CONTEXT = 2, /* 0b10 */ 16 | ASN_TAG_CLASS_PRIVATE = 3 /* 0b11 */ 17 | }; 18 | typedef unsigned ber_tlv_tag_t; /* BER TAG from Tag-Length-Value */ 19 | 20 | /* 21 | * Tag class is encoded together with tag value for optimization purposes. 22 | */ 23 | #define BER_TAG_CLASS(tag) ((tag) & 0x3) 24 | #define BER_TAG_VALUE(tag) ((tag) >> 2) 25 | #define BER_TLV_CONSTRUCTED(tagptr) (((*(const uint8_t *)tagptr)&0x20)?1:0) 26 | 27 | #define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2)) 28 | 29 | /* 30 | * Several functions for printing the TAG in the canonical form 31 | * (i.e. "[PRIVATE 0]"). 32 | * Return values correspond to their libc counterparts (if any). 33 | */ 34 | LIB61850_INTERNAL ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t buflen); 35 | LIB61850_INTERNAL ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *); 36 | LIB61850_INTERNAL char *ber_tlv_tag_string(ber_tlv_tag_t tag); 37 | 38 | 39 | /* 40 | * This function tries to fetch the tag from the input stream. 41 | * RETURN VALUES: 42 | * 0: More data expected than bufptr contains. 43 | * -1: Fatal error deciphering tag. 44 | * >0: Number of bytes used from bufptr. tag_r will contain the tag. 45 | */ 46 | LIB61850_INTERNAL ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r); 47 | 48 | /* 49 | * This function serializes the tag (T from TLV) in BER format. 50 | * It always returns number of bytes necessary to represent the tag, 51 | * it is a caller's responsibility to check the return value 52 | * against the supplied buffer's size. 53 | */ 54 | LIB61850_INTERNAL size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif /* _BER_TLV_TAG_H_ */ 61 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/constr_CHOICE.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2004, 2005 Lev Walkin . 3 | * All rights reserved. 4 | * Redistribution and modifications are permitted subject to BSD license. 5 | */ 6 | #ifndef _CONSTR_CHOICE_H_ 7 | #define _CONSTR_CHOICE_H_ 8 | 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct asn_CHOICE_specifics_s { 16 | /* 17 | * Target structure description. 18 | */ 19 | int struct_size; /* Size of the target structure. */ 20 | int ctx_offset; /* Offset of the asn_codec_ctx_t member */ 21 | int pres_offset; /* Identifier of the present member */ 22 | int pres_size; /* Size of the identifier (enum) */ 23 | 24 | /* 25 | * Tags to members mapping table. 26 | */ 27 | asn_TYPE_tag2member_t *tag2el; 28 | int tag2el_count; 29 | 30 | /* Canonical ordering of CHOICE elements, for PER */ 31 | int *canonical_order; 32 | 33 | /* 34 | * Extensions-related stuff. 35 | */ 36 | int ext_start; /* First member of extensions, or -1 */ 37 | } asn_CHOICE_specifics_t; 38 | 39 | /* 40 | * A set specialized functions dealing with the CHOICE type. 41 | */ 42 | LIB61850_INTERNAL asn_struct_free_f CHOICE_free; 43 | LIB61850_INTERNAL asn_struct_print_f CHOICE_print; 44 | LIB61850_INTERNAL asn_constr_check_f CHOICE_constraint; 45 | LIB61850_INTERNAL ber_type_decoder_f CHOICE_decode_ber; 46 | LIB61850_INTERNAL der_type_encoder_f CHOICE_encode_der; 47 | LIB61850_INTERNAL xer_type_decoder_f CHOICE_decode_xer; 48 | LIB61850_INTERNAL xer_type_encoder_f CHOICE_encode_xer; 49 | LIB61850_INTERNAL per_type_decoder_f CHOICE_decode_uper; 50 | LIB61850_INTERNAL per_type_encoder_f CHOICE_encode_uper; 51 | LIB61850_INTERNAL asn_outmost_tag_f CHOICE_outmost_tag; 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* _CONSTR_CHOICE_H_ */ 58 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/constr_SEQUENCE.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _CONSTR_SEQUENCE_H_ 6 | #define _CONSTR_SEQUENCE_H_ 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct asn_SEQUENCE_specifics_s { 15 | /* 16 | * Target structure description. 17 | */ 18 | int struct_size; /* Size of the target structure. */ 19 | int ctx_offset; /* Offset of the asn_struct_ctx_t member */ 20 | 21 | /* 22 | * Tags to members mapping table (sorted). 23 | */ 24 | asn_TYPE_tag2member_t *tag2el; 25 | int tag2el_count; 26 | 27 | /* 28 | * Optional members of the extensions root (roms) or additions (aoms). 29 | * Meaningful for PER. 30 | */ 31 | int *oms; /* Optional MemberS */ 32 | int roms_count; /* Root optional members count */ 33 | int aoms_count; /* Additions optional members count */ 34 | 35 | /* 36 | * Description of an extensions group. 37 | */ 38 | int ext_after; /* Extensions start after this member */ 39 | int ext_before; /* Extensions stop before this member */ 40 | } asn_SEQUENCE_specifics_t; 41 | 42 | 43 | /* 44 | * A set specialized functions dealing with the SEQUENCE type. 45 | */ 46 | LIB61850_INTERNAL asn_struct_free_f SEQUENCE_free; 47 | LIB61850_INTERNAL asn_struct_print_f SEQUENCE_print; 48 | LIB61850_INTERNAL asn_constr_check_f SEQUENCE_constraint; 49 | LIB61850_INTERNAL ber_type_decoder_f SEQUENCE_decode_ber; 50 | LIB61850_INTERNAL der_type_encoder_f SEQUENCE_encode_der; 51 | LIB61850_INTERNAL xer_type_decoder_f SEQUENCE_decode_xer; 52 | LIB61850_INTERNAL xer_type_encoder_f SEQUENCE_encode_xer; 53 | LIB61850_INTERNAL per_type_decoder_f SEQUENCE_decode_uper; 54 | LIB61850_INTERNAL per_type_encoder_f SEQUENCE_encode_uper; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif /* _CONSTR_SEQUENCE_H_ */ 61 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/constr_SEQUENCE_OF.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _CONSTR_SEQUENCE_OF_H_ 6 | #define _CONSTR_SEQUENCE_OF_H_ 7 | 8 | #include 9 | #include /* Implemented using SET OF */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | /* 16 | * A set specialized functions dealing with the SEQUENCE OF type. 17 | * Generally implemented using SET OF. 18 | */ 19 | #define SEQUENCE_OF_free SET_OF_free 20 | #define SEQUENCE_OF_print SET_OF_print 21 | #define SEQUENCE_OF_constraint SET_OF_constraint 22 | #define SEQUENCE_OF_decode_ber SET_OF_decode_ber 23 | #define SEQUENCE_OF_decode_xer SET_OF_decode_xer 24 | #define SEQUENCE_OF_decode_uper SET_OF_decode_uper 25 | LIB61850_INTERNAL der_type_encoder_f SEQUENCE_OF_encode_der; 26 | LIB61850_INTERNAL xer_type_encoder_f SEQUENCE_OF_encode_xer; 27 | LIB61850_INTERNAL per_type_encoder_f SEQUENCE_OF_encode_uper; 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif /* _CONSTR_SET_OF_H_ */ 34 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/constr_SET_OF.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _CONSTR_SET_OF_H_ 6 | #define _CONSTR_SET_OF_H_ 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct asn_SET_OF_specifics_s { 15 | /* 16 | * Target structure description. 17 | */ 18 | int struct_size; /* Size of the target structure. */ 19 | int ctx_offset; /* Offset of the asn_struct_ctx_t member */ 20 | 21 | /* XER-specific stuff */ 22 | int as_XMLValueList; /* The member type must be encoded like this */ 23 | } asn_SET_OF_specifics_t; 24 | 25 | /* 26 | * A set specialized functions dealing with the SET OF type. 27 | */ 28 | LIB61850_INTERNAL asn_struct_free_f SET_OF_free; 29 | LIB61850_INTERNAL asn_struct_print_f SET_OF_print; 30 | LIB61850_INTERNAL asn_constr_check_f SET_OF_constraint; 31 | LIB61850_INTERNAL ber_type_decoder_f SET_OF_decode_ber; 32 | LIB61850_INTERNAL der_type_encoder_f SET_OF_encode_der; 33 | LIB61850_INTERNAL xer_type_decoder_f SET_OF_decode_xer; 34 | LIB61850_INTERNAL xer_type_encoder_f SET_OF_encode_xer; 35 | LIB61850_INTERNAL per_type_decoder_f SET_OF_decode_uper; 36 | LIB61850_INTERNAL per_type_encoder_f SET_OF_encode_uper; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _CONSTR_SET_OF_H_ */ 43 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/constraints.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _ASN1_CONSTRAINTS_VALIDATOR_H_ 6 | #define _ASN1_CONSTRAINTS_VALIDATOR_H_ 7 | 8 | #include /* Platform-dependent types */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct asn_TYPE_descriptor_s; /* Forward declaration */ 15 | 16 | /* 17 | * Validate the structure according to the ASN.1 constraints. 18 | * If errbuf and errlen are given, they shall be pointing to the appropriate 19 | * buffer space and its length before calling this function. Alternatively, 20 | * they could be passed as NULL's. If constraints validation fails, 21 | * errlen will contain the actual number of bytes taken from the errbuf 22 | * to encode an error message (properly 0-terminated). 23 | * 24 | * RETURN VALUES: 25 | * This function returns 0 in case all ASN.1 constraints are met 26 | * and -1 if one or more constraints were failed. 27 | */ 28 | LIB61850_INTERNAL int 29 | asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, 30 | const void *struct_ptr, /* Target language's structure */ 31 | char *errbuf, /* Returned error description */ 32 | size_t *errlen /* Length of the error description */ 33 | ); 34 | 35 | 36 | /* 37 | * Generic type for constraint checking callback, 38 | * associated with every type descriptor. 39 | */ 40 | typedef int (asn_constr_check_f)( 41 | struct asn_TYPE_descriptor_s *type_descriptor, 42 | const void *struct_ptr, 43 | asn_app_constraint_failed_f *optional_callback, /* Log the error */ 44 | void *optional_app_key /* Opaque key passed to a callback */ 45 | ); 46 | 47 | /******************************* 48 | * INTERNALLY USEFUL FUNCTIONS * 49 | *******************************/ 50 | 51 | LIB61850_INTERNAL asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ 52 | LIB61850_INTERNAL asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */ 53 | 54 | /* 55 | * Invoke the callback with a complete error message. 56 | */ 57 | #define _ASN_CTFAIL if(ctfailcb) ctfailcb 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* _ASN1_CONSTRAINTS_VALIDATOR_H_ */ 64 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/der_encoder.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _DER_ENCODER_H_ 6 | #define _DER_ENCODER_H_ 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct asn_TYPE_descriptor_s; /* Forward declaration */ 15 | 16 | /* 17 | * The DER encoder of any type. May be invoked by the application. 18 | */ 19 | LIB61850_INTERNAL asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor, 20 | void *struct_ptr, /* Structure to be encoded */ 21 | asn_app_consume_bytes_f *consume_bytes_cb, 22 | void *app_key /* Arbitrary callback argument */ 23 | ); 24 | 25 | /* A variant of der_encode() which encodes data into the pre-allocated buffer */ 26 | LIB61850_INTERNAL asn_enc_rval_t der_encode_to_buffer( 27 | struct asn_TYPE_descriptor_s *type_descriptor, 28 | void *struct_ptr, /* Structure to be encoded */ 29 | void *buffer, /* Pre-allocated buffer */ 30 | size_t buffer_size /* Initial buffer size (maximum) */ 31 | ); 32 | 33 | /* 34 | * Type of the generic DER encoder. 35 | */ 36 | typedef asn_enc_rval_t (der_type_encoder_f)( 37 | struct asn_TYPE_descriptor_s *type_descriptor, 38 | void *struct_ptr, /* Structure to be encoded */ 39 | int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ 40 | ber_tlv_tag_t tag, 41 | asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ 42 | void *app_key /* Arbitrary callback argument */ 43 | ); 44 | 45 | 46 | /******************************* 47 | * INTERNALLY USEFUL FUNCTIONS * 48 | *******************************/ 49 | 50 | /* 51 | * Write out leading TL[v] sequence according to the type definition. 52 | */ 53 | LIB61850_INTERNAL ssize_t der_write_tags( 54 | struct asn_TYPE_descriptor_s *type_descriptor, 55 | size_t struct_length, 56 | int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ 57 | int last_tag_form, /* {0,!0}: prim, constructed */ 58 | ber_tlv_tag_t tag, 59 | asn_app_consume_bytes_f *consume_bytes_cb, 60 | void *app_key 61 | ); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* _DER_ENCODER_H_ */ 68 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/inc_mms_asn1c.go: -------------------------------------------------------------------------------- 1 | package inc_mms_asnic 2 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/per_decoder.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2005 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _PER_DECODER_H_ 6 | #define _PER_DECODER_H_ 7 | 8 | #include 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | struct asn_TYPE_descriptor_s; /* Forward declaration */ 16 | 17 | /* 18 | * Unaligned PER decoder of any ASN.1 type. May be invoked by the application. 19 | */ 20 | LIB61850_INTERNAL 21 | asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx, 22 | struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ 23 | void **struct_ptr, /* Pointer to a target structure's pointer */ 24 | const void *buffer, /* Data to be decoded */ 25 | size_t size, /* Size of data buffer */ 26 | int skip_bits, /* Number of unused leading bits, 0..7 */ 27 | int unused_bits /* Number of unused tailing bits, 0..7 */ 28 | ); 29 | 30 | 31 | /* 32 | * Type of the type-specific PER decoder function. 33 | */ 34 | typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, 35 | struct asn_TYPE_descriptor_s *type_descriptor, 36 | asn_per_constraints_t *constraints, 37 | void **struct_ptr, 38 | asn_per_data_t *per_data 39 | ); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* _PER_DECODER_H_ */ 46 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/per_encoder.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2006 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _PER_ENCODER_H_ 6 | #define _PER_ENCODER_H_ 7 | 8 | #include 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | struct asn_TYPE_descriptor_s; /* Forward declaration */ 16 | 17 | /* 18 | * Unaligned PER encoder of any ASN.1 type. May be invoked by the application. 19 | */ 20 | LIB61850_INTERNAL 21 | asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor, 22 | void *struct_ptr, /* Structure to be encoded */ 23 | asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */ 24 | void *app_key /* Arbitrary callback argument */ 25 | ); 26 | 27 | /* A variant of uper_encode() which encodes data into the existing buffer */ 28 | LIB61850_INTERNAL 29 | asn_enc_rval_t uper_encode_to_buffer( 30 | struct asn_TYPE_descriptor_s *type_descriptor, 31 | void *struct_ptr, /* Structure to be encoded */ 32 | void *buffer, /* Pre-allocated buffer */ 33 | size_t buffer_size /* Initial buffer size (max) */ 34 | ); 35 | 36 | 37 | /* 38 | * Type of the generic PER encoder function. 39 | */ 40 | typedef asn_enc_rval_t (per_type_encoder_f)( 41 | struct asn_TYPE_descriptor_s *type_descriptor, 42 | asn_per_constraints_t *constraints, 43 | void *struct_ptr, 44 | asn_per_outp_t *per_output 45 | ); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* _PER_ENCODER_H_ */ 52 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/xer_encoder.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004 Lev Walkin . All rights reserved. 3 | * Redistribution and modifications are permitted subject to BSD license. 4 | */ 5 | #ifndef _XER_ENCODER_H_ 6 | #define _XER_ENCODER_H_ 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct asn_TYPE_descriptor_s; /* Forward declaration */ 15 | 16 | /* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */ 17 | enum xer_encoder_flags_e { 18 | /* Mode of encoding */ 19 | XER_F_BASIC = 0x01, /* BASIC-XER (pretty-printing) */ 20 | XER_F_CANONICAL = 0x02 /* Canonical XER (strict rules) */ 21 | }; 22 | 23 | /* 24 | * The XER encoder of any type. May be invoked by the application. 25 | */ 26 | LIB61850_INTERNAL 27 | asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor, 28 | void *struct_ptr, /* Structure to be encoded */ 29 | enum xer_encoder_flags_e xer_flags, 30 | asn_app_consume_bytes_f *consume_bytes_cb, 31 | void *app_key /* Arbitrary callback argument */ 32 | ); 33 | 34 | /* 35 | * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) 36 | * output into the chosen file pointer. 37 | * RETURN VALUES: 38 | * 0: The structure is printed. 39 | * -1: Problem printing the structure. 40 | * WARNING: No sensible errno value is returned. 41 | */ 42 | LIB61850_INTERNAL 43 | int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr); 44 | 45 | /* 46 | * Type of the generic XER encoder. 47 | */ 48 | typedef asn_enc_rval_t (xer_type_encoder_f)( 49 | struct asn_TYPE_descriptor_s *type_descriptor, 50 | void *struct_ptr, /* Structure to be encoded */ 51 | int ilevel, /* Level of indentation */ 52 | enum xer_encoder_flags_e xer_flags, 53 | asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ 54 | void *app_key /* Arbitrary callback argument */ 55 | ); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* _XER_ENCODER_H_ */ 62 | -------------------------------------------------------------------------------- /libiec61850/inc/mms/iso_mms/asn1c/xer_support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. 3 | * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. 4 | * Redistribution and modifications are permitted subject to BSD license. 5 | */ 6 | #ifndef _XER_SUPPORT_H_ 7 | #define _XER_SUPPORT_H_ 8 | 9 | #include /* Platform-specific types */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | /* 16 | * Types of data transferred to the application. 17 | */ 18 | typedef enum { 19 | PXML_TEXT, /* Plain text between XML tags. */ 20 | PXML_TAG, /* A tag, starting with '<'. */ 21 | PXML_COMMENT, /* An XML comment, including "". */ 22 | /* 23 | * The following chunk types are reported if the chunk 24 | * terminates the specified XML element. 25 | */ 26 | PXML_TAG_END, /* Tag ended */ 27 | PXML_COMMENT_END /* Comment ended */ 28 | } pxml_chunk_type_e; 29 | 30 | /* 31 | * Callback function that is called by the parser when parsed data is 32 | * available. The _opaque is the pointer to a field containing opaque user 33 | * data specified in pxml_create() call. The chunk type is _type and the text 34 | * data is the piece of buffer identified by _bufid (as supplied to 35 | * pxml_feed() call) starting at offset _offset and of _size bytes size. 36 | * The chunk is NOT '\0'-terminated. 37 | */ 38 | typedef int (pxml_callback_f)(pxml_chunk_type_e _type, 39 | const void *_chunk_data, size_t _chunk_size, void *_key); 40 | 41 | /* 42 | * Parse the given buffer as it were a chunk of XML data. 43 | * Invoke the specified callback each time the meaninful data is found. 44 | * This function returns number of bytes consumed from the bufer. 45 | * It will always be lesser than or equal to the specified _size. 46 | * The next invocation of this function must account the difference. 47 | */ 48 | LIB61850_INTERNAL 49 | ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size, 50 | pxml_callback_f *cb, void *_key); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif /* _XER_SUPPORT_H_ */ 57 | -------------------------------------------------------------------------------- /libiec61850/lib/darwin_armv8/lib_darwinarmv8.go: -------------------------------------------------------------------------------- 1 | package darwin_armv8 2 | -------------------------------------------------------------------------------- /libiec61850/lib/darwin_armv8/libiec61850.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wendy512/iec61850/1d72b2441272946bf2bda77227e70c35475f1852/libiec61850/lib/darwin_armv8/libiec61850.a -------------------------------------------------------------------------------- /libiec61850/lib/linux64/lib_linux64.go: -------------------------------------------------------------------------------- 1 | package lib_linux64 2 | -------------------------------------------------------------------------------- /libiec61850/lib/linux64/libiec61850.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wendy512/iec61850/1d72b2441272946bf2bda77227e70c35475f1852/libiec61850/lib/linux64/libiec61850.a -------------------------------------------------------------------------------- /libiec61850/lib/linux_armv7l/lib_armv7l.go: -------------------------------------------------------------------------------- 1 | package lib_armv7l 2 | -------------------------------------------------------------------------------- /libiec61850/lib/linux_armv7l/libiec61850.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wendy512/iec61850/1d72b2441272946bf2bda77227e70c35475f1852/libiec61850/lib/linux_armv7l/libiec61850.a -------------------------------------------------------------------------------- /libiec61850/lib/linux_armv8/lib_armv8.go: -------------------------------------------------------------------------------- 1 | package linux_armv8 2 | -------------------------------------------------------------------------------- /libiec61850/lib/linux_armv8/libiec61850.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wendy512/iec61850/1d72b2441272946bf2bda77227e70c35475f1852/libiec61850/lib/linux_armv8/libiec61850.a -------------------------------------------------------------------------------- /libiec61850/lib/win64/lib_win64.go: -------------------------------------------------------------------------------- 1 | package lib_win64 2 | -------------------------------------------------------------------------------- /libiec61850/lib/win64/libiec61850.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wendy512/iec61850/1d72b2441272946bf2bda77227e70c35475f1852/libiec61850/lib/win64/libiec61850.a -------------------------------------------------------------------------------- /scl/interfaces.go: -------------------------------------------------------------------------------- 1 | package scl 2 | 3 | type SclType interface { 4 | GetId() string 5 | GetDesc() string 6 | GetUsed() bool 7 | SetUsed(used bool) 8 | } 9 | 10 | type DataModelNode interface { 11 | GetName() string 12 | GetSclType() SclType 13 | GetChildByName(childName string) DataModelNode 14 | } 15 | -------------------------------------------------------------------------------- /test/client_control/client_control_test.go: -------------------------------------------------------------------------------- 1 | package client_control 2 | 3 | import ( 4 | "github.com/wendy512/iec61850" 5 | "github.com/wendy512/iec61850/test" 6 | "testing" 7 | ) 8 | 9 | const DefValue = false 10 | 11 | func TestControl(t *testing.T) { 12 | client := test.CreateClient(t) 13 | defer test.CloseClient(client) 14 | 15 | objectRef := "simpleIOGenericIO/GGIO1.SPCSO1" 16 | 17 | param := iec61850.NewControlObjectParam(DefValue) 18 | param.OrIdent = "test" 19 | if err := client.ControlByControlModel(objectRef, iec61850.CONTROL_MODEL_DIRECT_NORMAL, param); err != nil { 20 | t.Errorf("[direct-with-normal-security] %s object error %v\n", objectRef, err) 21 | t.FailNow() 22 | } 23 | test.DoRead(t, client, objectRef+".stVal", iec61850.ST) 24 | 25 | objectRef = "simpleIOGenericIO/GGIO1.SPCSO2" 26 | if err := client.ControlForSboWithNormalSecurity(objectRef, DefValue); err != nil { 27 | t.Errorf("[sbo-with-normal-security] %s object error %v\n", objectRef, err) 28 | t.FailNow() 29 | } 30 | test.DoRead(t, client, objectRef+".stVal", iec61850.ST) 31 | 32 | objectRef = "simpleIOGenericIO/GGIO1.SPCSO3" 33 | if err := client.ControlForDirectWithEnhancedSecurity(objectRef, DefValue); err != nil { 34 | t.Errorf("[direct-with-enhanced-security] %s object error %v\n", objectRef, err) 35 | t.FailNow() 36 | } 37 | test.DoRead(t, client, objectRef+".stVal", iec61850.ST) 38 | 39 | objectRef = "simpleIOGenericIO/GGIO1.SPCSO4" 40 | if err := client.ControlForSboWithEnhancedSecurity(objectRef, DefValue); err != nil { 41 | t.Errorf("[sbo-with-enhanced-security] %s object error %v\n", objectRef, err) 42 | t.FailNow() 43 | } 44 | test.DoRead(t, client, objectRef+".stVal", iec61850.ST) 45 | } 46 | -------------------------------------------------------------------------------- /test/client_rcb/client_rcb_test.go: -------------------------------------------------------------------------------- 1 | package client_rcb 2 | 3 | import ( 4 | "github.com/wendy512/iec61850" 5 | "github.com/wendy512/iec61850/test" 6 | "log" 7 | "testing" 8 | ) 9 | 10 | func TestRBC(t *testing.T) { 11 | client := test.CreateClient(t) 12 | defer test.CloseClient(client) 13 | 14 | objectRef := "simpleIOGenericIO/GGIO1.SPCSO1.stVal" 15 | value, err := client.Read(objectRef, iec61850.ST) 16 | if err != nil { 17 | t.Fatal(err) 18 | } 19 | log.Printf("%s -> %v\n", objectRef, value) 20 | 21 | rbcRef := "simpleIOGenericIO/LLN0.RP.EventsRCB01" 22 | rcbValue, err := client.GetRCBValues(rbcRef) 23 | if err != nil { 24 | t.Fatal(err) 25 | } 26 | log.Printf("write before %s -> %#v\n", rbcRef, rcbValue) 27 | 28 | err = client.SetRCBValues(rbcRef, iec61850.ClientReportControlBlock{ 29 | Ena: true, 30 | IntgPd: 500, 31 | OptFlds: iec61850.OptFlds{ 32 | SequenceNumber: true, 33 | TimeOfEntry: true, 34 | ReasonForInclusion: true, 35 | DataSetName: true, 36 | DataReference: true, 37 | BufferOverflow: true, 38 | EntryID: true, 39 | ConfigRevision: true, 40 | }, 41 | TrgOps: iec61850.TrgOps{ 42 | DataChange: true, 43 | QualityChange: true, 44 | DataUpdate: true, 45 | TriggeredPeriodically: true, 46 | Gi: true, 47 | Transient: false, 48 | }, 49 | }) 50 | if err != nil { 51 | t.Fatal(err) 52 | } 53 | 54 | rcbValue, err = client.GetRCBValues(rbcRef) 55 | if err != nil { 56 | t.Error(err) 57 | return 58 | } 59 | log.Printf("write after %s -> %#v\n", rbcRef, rcbValue) 60 | } 61 | -------------------------------------------------------------------------------- /test/client_rw/client_read_test.go: -------------------------------------------------------------------------------- 1 | package client_rw 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "github.com/wendy512/iec61850" 7 | "github.com/wendy512/iec61850/test" 8 | "testing" 9 | ) 10 | 11 | const ( 12 | AnIn1ObjectRef = "simpleIOGenericIO/GGIO1.AnIn1.mag.f" 13 | Ind1ObjectRef = "simpleIOGenericIO/GGIO1.Ind1.stVal" 14 | ) 15 | 16 | func TestRead(t *testing.T) { 17 | client := test.CreateClient(t) 18 | defer test.CloseClient(client) 19 | 20 | test.DoRead(t, client, AnIn1ObjectRef, iec61850.MX) 21 | test.DoRead(t, client, Ind1ObjectRef, iec61850.ST) 22 | } 23 | 24 | func TestReadFloat(t *testing.T) { 25 | client := test.CreateClient(t) 26 | defer test.CloseClient(client) 27 | objectRef := AnIn1ObjectRef 28 | 29 | value, err := client.ReadFloat(objectRef, iec61850.MX) 30 | if err != nil { 31 | t.Fatalf("read %s object error %v\n", objectRef, err) 32 | } 33 | t.Logf("read %s float value -> %v\n", objectRef, value) 34 | } 35 | 36 | func TestReadBool(t *testing.T) { 37 | client := test.CreateClient(t) 38 | defer test.CloseClient(client) 39 | 40 | objectRef := Ind1ObjectRef 41 | value, err := client.ReadBool(objectRef, iec61850.ST) 42 | if err != nil { 43 | t.Fatalf("read %s object error %v\n", objectRef, err) 44 | } 45 | t.Logf("read %s bool value -> %v\n", objectRef, value) 46 | } 47 | 48 | func TestGetLogicalDeviceList(t *testing.T) { 49 | client := test.CreateClient(t) 50 | defer test.CloseClient(client) 51 | 52 | deviceList := client.GetLogicalDeviceList() 53 | marshal, err := json.Marshal(deviceList) 54 | if err != nil { 55 | t.Fatal(err) 56 | } 57 | fmt.Println(string(marshal)) 58 | } 59 | -------------------------------------------------------------------------------- /test/client_rw/client_write_test.go: -------------------------------------------------------------------------------- 1 | package client_rw 2 | 3 | import ( 4 | "github.com/wendy512/iec61850" 5 | "github.com/wendy512/iec61850/test" 6 | "testing" 7 | ) 8 | 9 | const ( 10 | OutVarObjectRef = "ied1Inverter/ZINV1.OutVarSet.setMag.f" 11 | ) 12 | 13 | func TestWrite(t *testing.T) { 14 | client := test.CreateClient(t) 15 | defer test.CloseClient(client) 16 | 17 | if err := client.Write(OutVarObjectRef, iec61850.SP, 100); err != nil { 18 | t.Fatalf("write %s error %v\n", OutVarObjectRef, err) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/client_sg/client_sg_test.go: -------------------------------------------------------------------------------- 1 | package client_sg 2 | 3 | import ( 4 | "github.com/wendy512/iec61850" 5 | "github.com/wendy512/iec61850/test" 6 | "testing" 7 | ) 8 | 9 | func TestWriteSG(t *testing.T) { 10 | client := test.CreateClient(t) 11 | defer test.CloseClient(client) 12 | 13 | if err := client.WriteSG("DEMOPROT", "LLN0", "DEMOPROT/PTOC1.StrVal.setMag.f", iec61850.SE, 2, float32(1.0)); err != nil { 14 | t.Fatalf("write setting group error %v\n", err) 15 | } 16 | } 17 | 18 | func TestGetSG(t *testing.T) { 19 | client := test.CreateClient(t) 20 | defer test.CloseClient(client) 21 | 22 | sgInfo, err := client.GetSG("DEMOPROT/LLN0.SGCB") 23 | if err != nil { 24 | t.Fatalf("get setting group error %v\n", err) 25 | } 26 | 27 | t.Logf("setting group info %#v\n", sgInfo) 28 | } 29 | -------------------------------------------------------------------------------- /test/common.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "github.com/wendy512/iec61850" 5 | "testing" 6 | "time" 7 | ) 8 | 9 | func CreateClient(t *testing.T) *iec61850.Client { 10 | settings := iec61850.NewSettings() 11 | 12 | client, err := iec61850.NewClient(settings) 13 | if err != nil { 14 | t.Fatalf("create client error %v\n", err) 15 | } 16 | return client 17 | } 18 | 19 | func CreateTlsClient(t *testing.T) *iec61850.Client { 20 | settings := iec61850.NewSettings() 21 | settings.Port = -1 22 | tlsConfig := iec61850.NewTLSConfig() 23 | 24 | tlsConfig.KeyFile = "client_CA1_1.key" 25 | tlsConfig.CertFile = "client_CA1_1.pem" 26 | tlsConfig.ChainValidation = true 27 | tlsConfig.AllowOnlyKnownCertificates = false 28 | tlsConfig.AddCACertificateFromFile("root_CA1.pem") 29 | 30 | client, err := iec61850.NewClientWithTlsSupport(settings, tlsConfig) 31 | if err != nil { 32 | t.Fatalf("create client error %v\n", err) 33 | } 34 | return client 35 | } 36 | 37 | func CloseClient(client *iec61850.Client) { 38 | time.Sleep(time.Second) 39 | client.Close() 40 | } 41 | 42 | func DoRead(t *testing.T, client *iec61850.Client, objectRef string, fc iec61850.FC) { 43 | value, err := client.Read(objectRef, fc) 44 | if err != nil { 45 | t.Fatalf("read %s object error %v\n", objectRef, err) 46 | } 47 | t.Logf("read %s value -> %v", objectRef, value) 48 | } 49 | -------------------------------------------------------------------------------- /test/scl/scl_test.go: -------------------------------------------------------------------------------- 1 | package scl 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/wendy512/iec61850/scl_xml" 7 | ) 8 | 9 | func TestLoadIcdXml(t *testing.T) { 10 | scl, err := scl_xml.GetSCL("test.icd") 11 | if err != nil { 12 | t.Error(err) 13 | } 14 | scl.Print() 15 | } 16 | -------------------------------------------------------------------------------- /test/server/complexModel_test.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "os" 5 | "os/signal" 6 | "syscall" 7 | "testing" 8 | 9 | "github.com/wendy512/iec61850" 10 | ) 11 | 12 | func TestCreateServerFromConfigFile2(t *testing.T) { 13 | model, err := iec61850.CreateModelFromConfigFileEx("complexModel.cfg") 14 | if err != nil { 15 | t.Fatalf("create model error %v\n", err) 16 | } 17 | 18 | server := iec61850.NewServerWithConfig(iec61850.NewServerConfig(), model) 19 | 20 | modelNode := model.GetModelNodeByObjectReference("ied1Inverter/ZINV1.OutVarSet.setMag.f") 21 | server.SetHandleWriteAccess(modelNode, func(node *iec61850.ModelNode, mmsValue *iec61850.MmsValue) iec61850.MmsDataAccessError { 22 | t.Logf("handle write access, value %#v\n", mmsValue) 23 | return iec61850.DATA_ACCESS_ERROR_SUCCESS 24 | }) 25 | 26 | server.Start(102) 27 | defer server.Destroy() 28 | t.Logf("Server start up\n") 29 | 30 | sig := make(chan os.Signal, 1) 31 | signal.Notify(sig, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM) 32 | <-sig 33 | t.Logf("Server stop\n") 34 | server.Stop() 35 | } 36 | -------------------------------------------------------------------------------- /test/server/simpleIO_control_test.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "os" 5 | "os/signal" 6 | "syscall" 7 | "testing" 8 | 9 | "github.com/wendy512/iec61850" 10 | ) 11 | 12 | func TestCreateServerFromConfigFile1(t *testing.T) { 13 | model, err := iec61850.CreateModelFromConfigFileEx("simpleIO_control_tests.cfg") 14 | if err != nil { 15 | t.Fatalf("create model error %v\n", err) 16 | } 17 | 18 | server := iec61850.NewServerWithConfig(iec61850.NewServerConfig(), model) 19 | 20 | modelNode := model.GetModelNodeByObjectReference("simpleIOGenericIO/GGIO1.SPCSO1") 21 | server.SetControlHandler(modelNode, func(node *iec61850.ModelNode, action *iec61850.ControlAction, mmsValue *iec61850.MmsValue, test bool) iec61850.ControlHandlerResult { 22 | t.Logf("control handler, action %#v, mmsValue %#v\n", action, mmsValue) 23 | return iec61850.CONTROL_RESULT_OK 24 | }) 25 | 26 | server.Start(102) 27 | defer server.Destroy() 28 | t.Logf("Server start up\n") 29 | 30 | sig := make(chan os.Signal, 1) 31 | signal.Notify(sig, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM) 32 | <-sig 33 | t.Logf("Server stop\n") 34 | server.Stop() 35 | } 36 | -------------------------------------------------------------------------------- /test/server/simpleIO_direct_control_goose_test.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "github.com/wendy512/iec61850" 5 | "math/rand" 6 | "os" 7 | "os/signal" 8 | "syscall" 9 | "testing" 10 | "time" 11 | ) 12 | 13 | const ( 14 | AnIn1ObjectRef = "simpleIOGenericIO/GGIO1.AnIn1" 15 | ) 16 | 17 | func TestCreateServerFromConfigFile3(t *testing.T) { 18 | model, err := iec61850.CreateModelFromConfigFileEx("simpleIO_direct_control_goose.cfg") 19 | if err != nil { 20 | t.Fatalf("create model error %v\n", err) 21 | } 22 | 23 | server := iec61850.NewServerWithConfig(iec61850.NewServerConfig(), model) 24 | server.Start(102) 25 | 26 | ticker := time.NewTicker(time.Second) 27 | go func() { 28 | for { 29 | select { 30 | case <-ticker.C: 31 | node := model.GetModelNodeByObjectReference(AnIn1ObjectRef + ".mag.f") 32 | rand.Seed(time.Now().UnixNano()) 33 | min, max := float32(10.0), float32(10000.0) 34 | fValue := rand.Float32()*(max-min) + min 35 | 36 | server.LockDataModel() 37 | server.UpdateFloatAttributeValue(node, fValue) 38 | server.UpdateUTCTimeAttributeValue(model.GetModelNodeByObjectReference(AnIn1ObjectRef+".t"), time.Now().UnixMilli()) 39 | server.UnlockDataModel() 40 | } 41 | } 42 | }() 43 | defer server.Destroy() 44 | t.Logf("Server start up\n") 45 | 46 | sig := make(chan os.Signal, 1) 47 | signal.Notify(sig, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM) 48 | <-sig 49 | t.Logf("Server stop\n") 50 | server.Stop() 51 | } 52 | -------------------------------------------------------------------------------- /test/tls_client/client_CA1_1.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpQIBAAKCAQEA2PuXMNUYO43NbEvBmEAru/uL1JdU6gFuhMKLuZOPaOGjGhth 3 | JiDO9AsnUGzKAk3m9QZ/YhAzY9CiEeYsnGaPeI0OBdkgWmpz5k9Fw+bqaqlxYQTy 4 | Bw69/kYbwNyMmGsb8XqXKZvhPXdLoaxkVmS+AMlxVcN/7c2ldZGTTDrhBtJnfuPK 5 | rGmH9cFg+XVvUskPQsUIwJtn1sN+niZ++hkuiCzmoZ4A+m73QACltdcr7aNtHJmh 6 | aU/p1bmLIhYfbxGmyvm2faJ8htYuaRBj6DcZq44IyDGz2LThmdWzpIcYbovCzB2X 7 | Pn26b0BXsXBpN+ptf2xpAEDWDdzaR6Xp4BgJwQIDAQABAoIBAQDQGLJOlgBQlVWv 8 | CBSaNOj8t2nKsHwylL7uujoQ95DxUH0BO8L3Mz3n1Y6V1lAC172pvtqKLOlsUBov 9 | OmYMdVwhjH4nY65gqHmRJvPMxviI5Qqktn58AEp8w7Y4SAza3NaGyECTGjlxnqi9 10 | XD06khGbZZa5Xu6hHboSwFPZJxrLU1jaopJUgFG+p9oUgiSp5cfGDwAsU9JELmkP 11 | MVF0GWedpypBBKi9JsniOulr1USpNZN2rzEkkxwY0QQttw3E9dgheIsut7dUYWLz 12 | 9NLKcRWIK/Y29NzS6Urye8lUTHHBrXgk5pUcdN3vuY7mkleqIn5tYY6xf93/5/VA 13 | jF+HcgolAoGBAPDhS986xppbfLmrresIUUZKxk2s/Vg+vHPLX0SJFF7Uhy8nMYoJ 14 | JqfG2mS+/tiM/wPBglVhsrlsfnDIag7Brqx7sjH2OHO6VX8jQPYgOuCbNwp7uL1w 15 | bG82R5rujcxxFAtMVAM3zYz9sNGSu8u7M/U3kfTBwtntFJ6iPC60REbjAoGBAOaa 16 | SdtX0bOQAYDM4moEDVnRPMHp8lZAjqKphGqTDrGOqU4usNW8+ZNBhn3vF1+n2Gq5 17 | KY2IWSF0j71jqpOXahW0EBoXpcTLs5JBWet8J5vKzbpN8Uq8TvTABn67G1F/DZub 18 | FOiCDy/Kku4yWT2aUqNwS07va7gzFhyyjMl/JWoLAoGAATpEtriH9pVsx012r3H1 19 | aBRNemvdRqvbLgPlUmYYcntGzRi4CeoOBmDfEBBhIB1n108PKPw8evFwm4aJ89VM 20 | 3JgsylBk7UIP2XwGgrqbUjW4TBdhU6XVB6QRLVr14grZfU1ASFvqckOAuTC0QE+N 21 | 7jwARG0QXyf0KPLOt7Y3et0CgYEAhJcd9EJQTsB0PMyROofN7WDDYHPVZQaFfL2f 22 | Z2/auPjgHBX4k0yu6553aB17AQMPCn4giEJnjTbqFukhgO9EjeoUgAwswjSlsWhl 23 | /WJLm+ZF1+NM473WYB+xHFkU4gz9lATdRrrRZJdDWDYW3bbH4TWF94LuGuE0y5dW 24 | H909c/UCgYEAiYY/TTZvfEsQvCo4Rv6qg7cI2/OdGwGhMmtziYy4SIAAm0Ga2s3R 25 | L7Kq72In+nbaDIUD2zTSGQmwTm3B0C73vIUAXvupcl28nE5px0YNV6NZJaaFSV66 26 | hP1CgPBYe6KjnVufOiqhcnDdJQ6XdqK0tblj+cavkZgW+UdeqVBXCFQ= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /test/tls_client/client_CA1_1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDWzCCAkMCFFTJkICEIidmnrisIFxZ99KKLhDFMA0GCSqGSIb3DQEBCwUAMGox 3 | CzAJBgNVBAYTAkRFMQswCQYDVQQIDAJCVzERMA8GA1UEBwwIRnJlaWJ1cmcxGzAZ 4 | BgNVBAoMEk1aIEF1dG9tYXRpb24gR21iSDEMMAoGA1UECwwDUiZEMRAwDgYDVQQD 5 | DAdyb290X0NBMB4XDTIyMDMxODA5MzMxOFoXDTIyMDQxNzA5MzMxOFowajELMAkG 6 | A1UEBhMCREUxCzAJBgNVBAgMAkJXMREwDwYDVQQHDAhGcmVpYnVyZzEbMBkGA1UE 7 | CgwSTVogQXV0b21hdGlvbiBHbWJIMQwwCgYDVQQLDANSJkQxEDAOBgNVBAMMB2Ns 8 | aWVudDEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDY+5cw1Rg7jc1s 9 | S8GYQCu7+4vUl1TqAW6Ewou5k49o4aMaG2EmIM70CydQbMoCTeb1Bn9iEDNj0KIR 10 | 5iycZo94jQ4F2SBaanPmT0XD5upqqXFhBPIHDr3+RhvA3IyYaxvxepcpm+E9d0uh 11 | rGRWZL4AyXFVw3/tzaV1kZNMOuEG0md+48qsaYf1wWD5dW9SyQ9CxQjAm2fWw36e 12 | Jn76GS6ILOahngD6bvdAAKW11yvto20cmaFpT+nVuYsiFh9vEabK+bZ9onyG1i5p 13 | EGPoNxmrjgjIMbPYtOGZ1bOkhxhui8LMHZc+fbpvQFexcGk36m1/bGkAQNYN3NpH 14 | pengGAnBAgMBAAEwDQYJKoZIhvcNAQELBQADggEBADSnrKdPqeUr3F1MIk6P8SKo 15 | yR1VrPmNCljaC1i3realDlG+7jlPHfTCkwZwlEfKGa/yANJAw4hv+2tR5m4CsgMB 16 | x6FkKG9p6NTXyv4gXZeLa3ivqFqz7awTVMBf1C1VVeTi/H2kvHSBRmbj6Z5p7/MN 17 | 9E1t5NsgbKKfbj4hQD+f7r6zgFdgTK8C5OYT2ijYryFl1Qqrl5CYPpswm3vL0KkM 18 | e3RMOBqamkFqr4OCZw5juNpGrp3bK3dLF+N6Ceb+PGnS0YU29NpUXo64lzIxdwxs 19 | NDqbFMYXEXGKqUDVQAuj1374M85Cvqlso0Jenc+hWN2/kfAgHGE1Ne3sD9oJg5w= 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /test/tls_client/client_read_test.go: -------------------------------------------------------------------------------- 1 | package tls_client 2 | 3 | import ( 4 | "github.com/wendy512/iec61850" 5 | "github.com/wendy512/iec61850/test" 6 | "testing" 7 | ) 8 | 9 | const ( 10 | AnIn1ObjectRef = "simpleIOGenericIO/GGIO1.AnIn1.mag.f" 11 | Ind1ObjectRef = "simpleIOGenericIO/GGIO1.Ind1.stVal" 12 | ) 13 | 14 | func TestReadForTls(t *testing.T) { 15 | client := test.CreateTlsClient(t) 16 | defer test.CloseClient(client) 17 | 18 | test.DoRead(t, client, AnIn1ObjectRef, iec61850.MX) 19 | test.DoRead(t, client, Ind1ObjectRef, iec61850.ST) 20 | 21 | objectRef := "simpleIOGenericIO/GGIO1.SPCSO1" 22 | param := iec61850.NewControlObjectParam(true) 23 | param.OrIdent = "test" 24 | if err := client.ControlByControlModel(objectRef, iec61850.CONTROL_MODEL_DIRECT_NORMAL, param); err != nil { 25 | t.Errorf("[direct-with-normal-security] %s object error %v\n", objectRef, err) 26 | t.FailNow() 27 | } 28 | test.DoRead(t, client, objectRef+".stVal", iec61850.ST) 29 | } 30 | -------------------------------------------------------------------------------- /test/tls_client/root_CA1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDtTCCAp2gAwIBAgIUJysTAOCqE3IaNO1QgtOPxMq6M8EwDQYJKoZIhvcNAQEL 3 | BQAwajELMAkGA1UEBhMCREUxCzAJBgNVBAgMAkJXMREwDwYDVQQHDAhGcmVpYnVy 4 | ZzEbMBkGA1UECgwSTVogQXV0b21hdGlvbiBHbWJIMQwwCgYDVQQLDANSJkQxEDAO 5 | BgNVBAMMB3Jvb3RfQ0EwHhcNMjIwMzE4MDkyNzEwWhcNMzIwMzE1MDkyNzEwWjBq 6 | MQswCQYDVQQGEwJERTELMAkGA1UECAwCQlcxETAPBgNVBAcMCEZyZWlidXJnMRsw 7 | GQYDVQQKDBJNWiBBdXRvbWF0aW9uIEdtYkgxDDAKBgNVBAsMA1ImRDEQMA4GA1UE 8 | AwwHcm9vdF9DQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOMyaDaT 9 | +a4DT0s2NCrjUN8coLPfFrLRdN0Gx0hRViuLUFxd001jXruRgXKt2g8lR+YnzUeA 10 | PQHbcIfRQhL+jy/ZMXpmz4Nrl7vyOWFdu8nBKU6c7y9LmSGbnOJZjDXwlX6ERwui 11 | qFzAvRA6YXbPN8gY0B3Ou+T/mjkWN9L1x+V+7bGs9rVIoM78fVyM2FERBfsBtT76 12 | QVQv3KZ+a9EOLxqcZ/nGqsFFysFOSkiRC6Cy4mC5CSik9S5D7X9lz/bdga7O+hqd 13 | SKfir6YMlQGV37JPqmz69N6vvb9UOX/G989T4qdVB/zQOvMdcIWXkqb3vSAXYi/c 14 | ClVS1Pymsy/MXQ0CAwEAAaNTMFEwHQYDVR0OBBYEFGYgIECdrhTsmgCKpVM0RHeC 15 | kFUmMB8GA1UdIwQYMBaAFGYgIECdrhTsmgCKpVM0RHeCkFUmMA8GA1UdEwEB/wQF 16 | MAMBAf8wDQYJKoZIhvcNAQELBQADggEBACsiuHFQjqOglenp/fcNbU034m/vvkyV 17 | SZXau9amXBWdeTEpc1HaPOYO7jFFnu/QoH6AbGZkpL0yWZJA2rf102AkOdAe6E0g 18 | 2H77/hHoHVCfxOiOl3+icsLXJ4VXqV2vmUOEVnWfHRtej4My6avT9uCNMO2bw9hm 19 | 56RAZrs82T9Mpg/1XQ9YUO1q4/JfP/+dCzPXAdwJ/h2cJ/q6Q9g1gRns8IzVlGOZ 20 | 0ZBQCLqLl8vUei+t6YgjyBbeNCz4CEcmXKIJeqMB1jhpsgr6BBMTNTU2Q60b9fzU 21 | OCGLw94EnKYtHWGy2WHMFNbwkNCR0/jwhxKkU0HXy1aNMUBWp99M7P8= 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /test/tls_server/client_CA1_1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDWzCCAkMCFFTJkICEIidmnrisIFxZ99KKLhDFMA0GCSqGSIb3DQEBCwUAMGox 3 | CzAJBgNVBAYTAkRFMQswCQYDVQQIDAJCVzERMA8GA1UEBwwIRnJlaWJ1cmcxGzAZ 4 | BgNVBAoMEk1aIEF1dG9tYXRpb24gR21iSDEMMAoGA1UECwwDUiZEMRAwDgYDVQQD 5 | DAdyb290X0NBMB4XDTIyMDMxODA5MzMxOFoXDTIyMDQxNzA5MzMxOFowajELMAkG 6 | A1UEBhMCREUxCzAJBgNVBAgMAkJXMREwDwYDVQQHDAhGcmVpYnVyZzEbMBkGA1UE 7 | CgwSTVogQXV0b21hdGlvbiBHbWJIMQwwCgYDVQQLDANSJkQxEDAOBgNVBAMMB2Ns 8 | aWVudDEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDY+5cw1Rg7jc1s 9 | S8GYQCu7+4vUl1TqAW6Ewou5k49o4aMaG2EmIM70CydQbMoCTeb1Bn9iEDNj0KIR 10 | 5iycZo94jQ4F2SBaanPmT0XD5upqqXFhBPIHDr3+RhvA3IyYaxvxepcpm+E9d0uh 11 | rGRWZL4AyXFVw3/tzaV1kZNMOuEG0md+48qsaYf1wWD5dW9SyQ9CxQjAm2fWw36e 12 | Jn76GS6ILOahngD6bvdAAKW11yvto20cmaFpT+nVuYsiFh9vEabK+bZ9onyG1i5p 13 | EGPoNxmrjgjIMbPYtOGZ1bOkhxhui8LMHZc+fbpvQFexcGk36m1/bGkAQNYN3NpH 14 | pengGAnBAgMBAAEwDQYJKoZIhvcNAQELBQADggEBADSnrKdPqeUr3F1MIk6P8SKo 15 | yR1VrPmNCljaC1i3realDlG+7jlPHfTCkwZwlEfKGa/yANJAw4hv+2tR5m4CsgMB 16 | x6FkKG9p6NTXyv4gXZeLa3ivqFqz7awTVMBf1C1VVeTi/H2kvHSBRmbj6Z5p7/MN 17 | 9E1t5NsgbKKfbj4hQD+f7r6zgFdgTK8C5OYT2ijYryFl1Qqrl5CYPpswm3vL0KkM 18 | e3RMOBqamkFqr4OCZw5juNpGrp3bK3dLF+N6Ceb+PGnS0YU29NpUXo64lzIxdwxs 19 | NDqbFMYXEXGKqUDVQAuj1374M85Cvqlso0Jenc+hWN2/kfAgHGE1Ne3sD9oJg5w= 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /test/tls_server/client_CA1_2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDWzCCAkMCFFTJkICEIidmnrisIFxZ99KKLhDGMA0GCSqGSIb3DQEBCwUAMGox 3 | CzAJBgNVBAYTAkRFMQswCQYDVQQIDAJCVzERMA8GA1UEBwwIRnJlaWJ1cmcxGzAZ 4 | BgNVBAoMEk1aIEF1dG9tYXRpb24gR21iSDEMMAoGA1UECwwDUiZEMRAwDgYDVQQD 5 | DAdyb290X0NBMB4XDTIyMDMxODA5MzY0OVoXDTIyMDQxNzA5MzY0OVowajELMAkG 6 | A1UEBhMCREUxCzAJBgNVBAgMAkJXMREwDwYDVQQHDAhGcmVpYnVyZzEbMBkGA1UE 7 | CgwSTVogQXV0b21hdGlvbiBHbWJIMQwwCgYDVQQLDANSJkQxEDAOBgNVBAMMB2Ns 8 | aWVudDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8hnd/sd/nLJrN 9 | wfei5lphgS71fpP567xgkrGaEy0/lyISeuYK8nkrHI3T5cz0IHsVRGai0cQPdrP5 10 | 0Vdn7kj2rM/WzD7RzSRZIBydd4tnCZBz/bktTRtYNVve7+HaP9t4FxQdkMF4K3Jm 11 | E/j/gYSYimR49DFjXI2om9kXWZ6pdQUyaKUr+zxgmovtQjtc7wdTdKmsKFQxQQhd 12 | zWQajEpaNTL+JTJyrCZctryaILgYv4cvQbpF54zbcRsdoPRkP6azsR9GDhCYydwz 13 | UGMr2CZ2C4BRwB8ChswDsU6iww5enF2vWIUY36VvjmSDDrsH1w4V9UCkSjYMg0VQ 14 | Mmwc8kerAgMBAAEwDQYJKoZIhvcNAQELBQADggEBALYG8KSPm82uvgmeto76kL+N 15 | nUgV1ojxj+X9yBrbrkgo4rnsXFU1NUqncdCfpvA7u9mqAjZ4KN+ORZIUp1SXUl3Z 16 | TIpBClO5ML7wz1Iy6QrExeFwb2783Gl1jeq0lSQwWffNMwkPEqG1QYr/2IK9eSRJ 17 | hDrure/Ys3s5F7grQ6vTWBQrEXynd81YqqZuBFFs7FuLhg0GK/OdpJ5i2BsLS+B3 18 | nEOxmgxZ1qLSqbYDjhawsjiSItvO8XxZjA99n3MpBVharqqwp0Xpkm+X30rWolUp 19 | wur154X0dMZh8jF98KVrB/3Te9aidtyuO9EiGU2Qbkre7jK+Ol3nITR50Gy8yYU= 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /test/tls_server/root_CA1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDtTCCAp2gAwIBAgIUJysTAOCqE3IaNO1QgtOPxMq6M8EwDQYJKoZIhvcNAQEL 3 | BQAwajELMAkGA1UEBhMCREUxCzAJBgNVBAgMAkJXMREwDwYDVQQHDAhGcmVpYnVy 4 | ZzEbMBkGA1UECgwSTVogQXV0b21hdGlvbiBHbWJIMQwwCgYDVQQLDANSJkQxEDAO 5 | BgNVBAMMB3Jvb3RfQ0EwHhcNMjIwMzE4MDkyNzEwWhcNMzIwMzE1MDkyNzEwWjBq 6 | MQswCQYDVQQGEwJERTELMAkGA1UECAwCQlcxETAPBgNVBAcMCEZyZWlidXJnMRsw 7 | GQYDVQQKDBJNWiBBdXRvbWF0aW9uIEdtYkgxDDAKBgNVBAsMA1ImRDEQMA4GA1UE 8 | AwwHcm9vdF9DQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOMyaDaT 9 | +a4DT0s2NCrjUN8coLPfFrLRdN0Gx0hRViuLUFxd001jXruRgXKt2g8lR+YnzUeA 10 | PQHbcIfRQhL+jy/ZMXpmz4Nrl7vyOWFdu8nBKU6c7y9LmSGbnOJZjDXwlX6ERwui 11 | qFzAvRA6YXbPN8gY0B3Ou+T/mjkWN9L1x+V+7bGs9rVIoM78fVyM2FERBfsBtT76 12 | QVQv3KZ+a9EOLxqcZ/nGqsFFysFOSkiRC6Cy4mC5CSik9S5D7X9lz/bdga7O+hqd 13 | SKfir6YMlQGV37JPqmz69N6vvb9UOX/G989T4qdVB/zQOvMdcIWXkqb3vSAXYi/c 14 | ClVS1Pymsy/MXQ0CAwEAAaNTMFEwHQYDVR0OBBYEFGYgIECdrhTsmgCKpVM0RHeC 15 | kFUmMB8GA1UdIwQYMBaAFGYgIECdrhTsmgCKpVM0RHeCkFUmMA8GA1UdEwEB/wQF 16 | MAMBAf8wDQYJKoZIhvcNAQELBQADggEBACsiuHFQjqOglenp/fcNbU034m/vvkyV 17 | SZXau9amXBWdeTEpc1HaPOYO7jFFnu/QoH6AbGZkpL0yWZJA2rf102AkOdAe6E0g 18 | 2H77/hHoHVCfxOiOl3+icsLXJ4VXqV2vmUOEVnWfHRtej4My6avT9uCNMO2bw9hm 19 | 56RAZrs82T9Mpg/1XQ9YUO1q4/JfP/+dCzPXAdwJ/h2cJ/q6Q9g1gRns8IzVlGOZ 20 | 0ZBQCLqLl8vUei+t6YgjyBbeNCz4CEcmXKIJeqMB1jhpsgr6BBMTNTU2Q60b9fzU 21 | OCGLw94EnKYtHWGy2WHMFNbwkNCR0/jwhxKkU0HXy1aNMUBWp99M7P8= 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /test/tls_server/server_CA1_1.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEA2FFfpxEqImd01A9Q+ccTRDroVpz840ektXr45V0RQkpz8zSu 3 | Iv5GXPqBXwSgKXsojoLkCYK+VmlX4GQ6xXblAKAd/flUS+WVsUq9kL9cud30dwYK 4 | h2V4/Tm/NvUiZsYV3b5/8RfUpYwVNBW/eScbNXrVHNkiBrcIJtixruKsyH+drckP 5 | 7K4j+AZh43LGsK6NY+ppf5wHBctGWFOCFdJSrabck4oem807COKX9PhTfD87OnjB 6 | QcqdHkus8WZP/SGnZV+6c1k0SN4O0E4MahpWkr8D2ZjsbhGFIW8AU4NdobsohClW 7 | AZ0MDR1N4oo0sj4HgY2hGR2AbR/5Y2LH4kRcpQIDAQABAoIBAEK2tf1cedYqegl8 8 | v8iI8RQ15rnvqL6ftdiSmHiEf3ImbCQxtxLrwN+kEoovbwXcCeIJ1DJqtDEKRCPc 9 | RZPo2y+aMiXF442UvNn05wnhOsPIBEFBB7ZCQVI3oRVd/MIdjVjaC7NbWiXEUjXC 10 | D09aFDYmL9u5y5iukkEIy6PYHNmokN0MlHwhFqqp72hGe6UvHfZ6yu46z1eF6zLN 11 | S4b2ULUzJ6Ov0Y7kmN7vP058yfZYHoj4TPeRBDm3Qx8g9c5d6da22vfkt61UzXEN 12 | ih8fIejq6BGila2wMuZKyCM/Oxv5WX0RTzVQO13+42f29BM47Mdk/a8ijBZCzXnC 13 | oAnHcwECgYEA7Isah3VNc4KkSNRrnV1UrInQ8BAlNLTN4cJTbyOkogCUECvfzAS+ 14 | K/l8YZOzZ7YoJkK7RzDeUqRfrZhyJut6x7J/3Vl6qLXpnx3iEPJdxaD5L1iftnIP 15 | NOytbphClO+VAjSO3frhlCwZ00Z6o6meTV+CNmRT2LDFEzxAMc3GtrECgYEA6hxh 16 | m3S5KX7Ze/m5v9l4vi2iGDNBJkk48Cc+qfgVLGa0TSd7cY+8bjYNufr6vqThKlVu 17 | RByZ3Wo5C5PfrkU69YbJ9LnQ+RTZPu+IxPIsUM3xlyTin7bufyOcWhPr1820MKqP 18 | A/mRJ/SKel7ubrURai7KDETR0mI9XajhtwF/qjUCgYEAvW1sclwTCVTuwVAzWhM6 19 | 0u2PACC92uaMFaYscM1nc0DpUcYA8/48WTTzUaUZwA1VO8am+Yz+DcqKwJdbmyVq 20 | 7u9YjGey3dbIX19sAcxGIhUWWL8tL8tJuEVtYirW7zSp7NkwLD5UVfe3OsWvQs97 21 | 8VRyD6LqrpZpTE0sz3WOFBECgYAxgOLa3mmw7pPKdVnjyXaQsFGQUHY8REt37LSB 22 | eGXxx53kmq6tqrkrjN6GLx4KZg7+xqXUXT/j4+xAGHq5/QWkmWXnC8u2f8QYXMpM 23 | 6vCX/ZRSY4hQQXxZAgyzt3atYV/y0n3/VyxsiHcnvR8p5bvS+iXbRkof9IoJXgas 24 | jfKS6QKBgQC6ZFuvYIeqkfZ0Yyxxum3qlGxpR41wcuIpb4hBQ0gr1haTL0aaoUiQ 25 | qqUfzVRst/oPxf6vqeCxtWh1/3lGa1QXP9KJDA5twFMqTg5jv92vjMIgPTEZ2Oif 26 | +YyTs72V197KHctx2/T4RxAGhxCLJwDzk2shvLS+1voU/w40YRy9yA== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /test/tls_server/server_CA1_1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDWzCCAkMCFFTJkICEIidmnrisIFxZ99KKLhDIMA0GCSqGSIb3DQEBCwUAMGox 3 | CzAJBgNVBAYTAkRFMQswCQYDVQQIDAJCVzERMA8GA1UEBwwIRnJlaWJ1cmcxGzAZ 4 | BgNVBAoMEk1aIEF1dG9tYXRpb24gR21iSDEMMAoGA1UECwwDUiZEMRAwDgYDVQQD 5 | DAdyb290X0NBMB4XDTIyMDUyNjEwNDc0NFoXDTMwMDgxMjEwNDc0NFowajELMAkG 6 | A1UEBhMCREUxCzAJBgNVBAgMAkJXMREwDwYDVQQHDAhGcmVpYnVyZzEbMBkGA1UE 7 | CgwSTVogQXV0b21hdGlvbiBHbWJIMQwwCgYDVQQLDANSJkQxEDAOBgNVBAMMB3Nl 8 | cnZlcjEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDYUV+nESoiZ3TU 9 | D1D5xxNEOuhWnPzjR6S1evjlXRFCSnPzNK4i/kZc+oFfBKApeyiOguQJgr5WaVfg 10 | ZDrFduUAoB39+VRL5ZWxSr2Qv1y53fR3BgqHZXj9Ob829SJmxhXdvn/xF9SljBU0 11 | Fb95Jxs1etUc2SIGtwgm2LGu4qzIf52tyQ/sriP4BmHjcsawro1j6ml/nAcFy0ZY 12 | U4IV0lKtptyTih6bzTsI4pf0+FN8Pzs6eMFByp0eS6zxZk/9IadlX7pzWTRI3g7Q 13 | TgxqGlaSvwPZmOxuEYUhbwBTg12huyiEKVYBnQwNHU3iijSyPgeBjaEZHYBtH/lj 14 | YsfiRFylAgMBAAEwDQYJKoZIhvcNAQELBQADggEBANPRnvfByVoKwfMcQYUnYT6l 15 | 5OhYt8f2tQfoa0EXirP0O2xG052ZBl3Z5ZzBCcsq1zveaPoeqXFl6HjqIqURB5NS 16 | imJIi7kB7o6C2z19yxOndPm3urKGyfvxtSy2iyzTMZ8eL8RFMJC5DVV+n5Y+1EgC 17 | pYIu//I0ojnFOemEJXVjfxQhiUbx6Nw8HalHOhW1i017XcOWMKji/lwHfWF2PFmn 18 | pIWZCFPCUtHzBUkXCRzn9ESeMDcMXN6qLb2wGJkRUDw+Ls1RGJd6dnB811vOuOd+ 19 | QQc8lyyBZ1byARcxQ8lAtof6Mv7Yzebv1OxRr7NcrV/+ujnSFyJWKrJdcMx7+10= 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /test/tls_server/tls_server_test.go: -------------------------------------------------------------------------------- 1 | package tls_server 2 | 3 | import ( 4 | "github.com/wendy512/iec61850" 5 | "os" 6 | "os/signal" 7 | "syscall" 8 | "testing" 9 | "unsafe" 10 | ) 11 | 12 | func TestTlsServer(t *testing.T) { 13 | model, err := iec61850.CreateModelFromConfigFileEx("model.cfg") 14 | if err != nil { 15 | t.Fatalf("create model error %v\n", err) 16 | } 17 | 18 | tlsConfig := iec61850.NewTLSConfig() 19 | tlsConfig.KeyFile = "server_CA1_1.key" 20 | tlsConfig.CertFile = "server_CA1_1.pem" 21 | tlsConfig.AddCACertificateFromFile("root_CA1.pem") 22 | tlsConfig.AddAllowedCertificateFromFile("client_CA1_1.pem") 23 | tlsConfig.AddAllowedCertificateFromFile("client_CA1_2.pem") 24 | tlsConfig.AllowOnlyKnownCertificates = true 25 | tlsConfig.ChainValidation = false 26 | 27 | server, err := iec61850.NewServerWithTlsSupport(iec61850.NewServerConfig(), tlsConfig, model) 28 | 29 | modelNode := model.GetModelNodeByObjectReference("simpleIOGenericIO/GGIO1.SPCSO1") 30 | server.SetControlHandler(modelNode, func(node *iec61850.ModelNode, action *iec61850.ControlAction, mmsValue *iec61850.MmsValue, test bool) iec61850.ControlHandlerResult { 31 | t.Logf("control handler, action %#v, mmsValue %#v\n", action, mmsValue) 32 | return iec61850.CONTROL_RESULT_OK 33 | }) 34 | server.SetAuthenticator(func(securityToken *unsafe.Pointer, authParameter *iec61850.AcseAuthenticationParameter, appReference *iec61850.IsoApplicationReference) bool { 35 | return true 36 | }) 37 | 38 | server.Start(-1) 39 | defer server.Destroy() 40 | t.Logf("Server start up\n") 41 | 42 | sig := make(chan os.Signal, 1) 43 | signal.Notify(sig, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM) 44 | <-sig 45 | t.Logf("Server stop\n") 46 | server.Stop() 47 | } 48 | --------------------------------------------------------------------------------