AUTOSAR SOME/IP container: Go parsing library

KS implementation details

License: CC0-1.0
Minimal Kaitai Struct required: 0.9

This page hosts a formal specification of AUTOSAR SOME/IP container using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.

Go source code to parse AUTOSAR SOME/IP container

some_ip_container.go

// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

import "github.com/kaitai-io/kaitai_struct_go_runtime/kaitai"

type SomeIpContainer struct {
	SomeIpPackages []*SomeIp
	_io *kaitai.Stream
	_root *SomeIpContainer
	_parent interface{}
}
func NewSomeIpContainer() *SomeIpContainer {
	return &SomeIpContainer{
	}
}

func (this *SomeIpContainer) Read(io *kaitai.Stream, parent interface{}, root *SomeIpContainer) (err error) {
	this._io = io
	this._parent = parent
	this._root = root

	for i := 1;; i++ {
		tmp1, err := this._io.EOF()
		if err != nil {
			return err
		}
		if tmp1 {
			break
		}
		tmp2 := NewSomeIp()
		err = tmp2.Read(this._io, this, nil)
		if err != nil {
			return err
		}
		this.SomeIpPackages = append(this.SomeIpPackages, tmp2)
	}
	return err
}