CroatiaControlLtd / asterix

Asterix is utility used to read and parse EUROCONTROL ASTERIX protocol data from stdin, file or network multicast stream and print it to standard output in text, XML or JSON format. Source can be used to generate Wireshark dissector for ASTERIX protocol. All ASTERIX categories are defined through XML definition file.
GNU General Public License v2.0
166 stars 89 forks source link

Reserved Expansion Field #212

Open robrechtrosseel opened 1 year ago

robrechtrosseel commented 1 year ago

There seems to be a problem for the tool to decode reserved expansion fields that are composed using different layers of compound types. I generated an example xml script that should decode the explicit RE data item, with a 'Field 1' as first bit of the first compound item and 'M5N' as the second bit of the first compound item. The rest is not used in the data. In my ASTERIX data, I only have data with the 'M5N' bit set to 1. With this bit set, the code should jump to the last compound part of the xml below, which it does correctly (When I just read a 'fixed' variable with length 1 instead of interpreting the data as a compound - see commented part, I can see the FSPEC and first byte of data of this compound item, but whenever it is defined as 'compound', the code returns errors. Is there a way to decode a RE field with this outlay: Explicit

                <Compound>
                    <Variable>
                        <Fixed length="1">
                            <Bits bit="8">
                                <BitsShortName>SUM</BitsShortName>
                                <BitsName>Mode 5 Summary</BitsName>
                                <BitsPresence>1</BitsPresence>
                            </Bits>
                            <Bits bit="7">
                                <BitsShortName>PMN</BitsShortName>
                                <BitsName>Mode 5 PIN NO Mission Code</BitsName>
                                <BitsPresence>2</BitsPresence>
                            </Bits>  
                            <Bits bit="6">
                                <BitsShortName>POS</BitsShortName>
                                <BitsName>Mode 5 required position</BitsName>
                                <BitsPresence>3</BitsPresence>
                            </Bits>
                            <Bits bit="5">
                                <BitsShortName>GA</BitsShortName>
                                <BitsName>Mode 5 GNSSderived Altitude</BitsName>
                                <BitsPresence>4</BitsPresence>
                            </Bits>
                            <Bits bit="4">
                                <BitsShortName>EM1</BitsShortName>
                                <BitsName>Extended Mode 1 in octal representation</BitsName>
                                <BitsPresence>5</BitsPresence>
                            </Bits>
                            <Bits bit="3">
                                <BitsShortName>TOS</BitsShortName>
                                <BitsName>Time offset for POS and GA</BitsName>
                                <BitsPresence>6</BitsPresence>
                            </Bits>
                            <Bits bit="2">
                                <BitsShortName>XP</BitsShortName>
                                <BitsName>X-Pulse Present</BitsName>
                                <BitsPresence>7</BitsPresence>
                            </Bits>                  
                            <Bits bit="1" fx="1">
                                <BitsShortName>FX</BitsShortName>
                                <BitsName>Extension Indicator</BitsName>
                                <BitsConst>0</BitsConst>
                            </Bits>
                        </Fixed>
                    </Variable>
                    <Fixed length="1">
                        <Bits from="8" to="1">
                            <BitsShortName>test</BitsShortName>
                            <BitsName>SUM</BitsName>                        
                        </Bits>
                    </Fixed>
                </Compound> 

            </Compound>
        </Explicit>
    </DataItemFormat>
</DataItem>