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.
All parsing code for C# generated by Kaitai Struct depends on the C# runtime library. You have to install it before you can parse data.
The C# runtime library is available in the NuGet Gallery. Installation instructions can also be found there.
Parse a local file and get structure in memory:
var data = SomeIpContainer.FromFile("path/to/local/file.bin");
Or parse structure from a byte array:
byte[] someArray = new byte[] { ... };
var data = new SomeIpContainer(new KaitaiStream(someArray));
After that, one can get various attributes from the structure by accessing properties like:
data.SomeIpPackages // => get some ip packages
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
using System.Collections.Generic;
namespace Kaitai
{
public partial class SomeIpContainer : KaitaiStruct
{
public static SomeIpContainer FromFile(string fileName)
{
return new SomeIpContainer(new KaitaiStream(fileName));
}
public SomeIpContainer(KaitaiStream p__io, KaitaiStruct p__parent = null, SomeIpContainer p__root = null) : base(p__io)
{
m_parent = p__parent;
m_root = p__root ?? this;
_read();
}
private void _read()
{
_someIpPackages = new List<SomeIp>();
{
var i = 0;
while (!m_io.IsEof) {
_someIpPackages.Add(new SomeIp(m_io));
i++;
}
}
}
private List<SomeIp> _someIpPackages;
private SomeIpContainer m_root;
private KaitaiStruct m_parent;
public List<SomeIp> SomeIpPackages { get { return _someIpPackages; } }
public SomeIpContainer M_Root { get { return m_root; } }
public KaitaiStruct M_Parent { get { return m_parent; } }
}
}