LibItsGeoNetworking_TypesAndValues.ttcn 38 KB
Newer Older
tepelmann's avatar
tepelmann committed
 *  @author     ETSI / STF405 / STF449
 *  @version    $URL$
 *              $Id$
 *  @desc       Module containing types and values for GeoNetworking Protocol
 *
 */
module LibItsGeoNetworking_TypesAndValues {
tepelmann's avatar
tepelmann committed
    
    //LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
tepelmann's avatar
tepelmann committed
    
    import from LibItsCommon_TypesAndValues all;
berge's avatar
berge committed
    import from LibItsBtp_TypesAndValues {type BtpPacket;}
    import from LibItsIpv6OverGeoNetworking_TypesAndValues {type Ipv6Packet;}
tepelmann's avatar
tepelmann committed
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues {
        type SecuredMessage
    }
    
    group geoConfigurationValues {
        
        const charstring c_compIut := "IUT";
        const charstring c_compMTC := "MTC";
        const charstring c_compNodeA := "NodeA";
        const charstring c_compNodeB := "NodeB";
        const charstring c_compNodeC := "NodeC";
        const charstring c_compNodeD := "NodeD";
tepelmann's avatar
tepelmann committed
        const charstring c_compNodeE := "NodeE";
        const charstring c_compNodeF := "NodeF";
berge's avatar
berge committed
        const charstring c_area1 := "AREA1";
        const charstring c_area2 := "AREA2";
berge's avatar
berge committed
        const integer c_latitudeFactorNodeA := 10;
        const integer c_latitudeFactorNodeB := 2;
        const integer c_latitudeFactorNodeC := -6;
        const integer c_latitudeFactorNodeD := 1;
berge's avatar
berge committed
        const integer c_latitudeFactorNodeE := -1;
        const integer c_latitudeFactorNodeF := 2;
        const integer c_longitudeFactorNodeA := 0;
        const integer c_longitudeFactorNodeB := 0;
        const integer c_longitudeFactorNodeC := 0;
        const integer c_longitudeFactorNodeD := 0;
berge's avatar
berge committed
        const integer c_longitudeFactorNodeE := 0;
        const integer c_longitudeFactorNodeF := -3;
    } // end geoConfigurationValues
tepelmann's avatar
tepelmann committed
    
    group geoSyncMessages {
        
        const charstring c_msgSent := "Message sent";
        
    } // end geoSyncMessages
    
berge's avatar
berge committed
    group geoTestingConstants {
        
berge's avatar
berge committed
        const UInt6 c_defaultLifetime := 10; // in seconds
tepelmann's avatar
tepelmann committed
        const UInt16 c_lifetime := 1000 * c_defaultLifetime; // in seconds
berge's avatar
berge committed
        
    } // end geoTestingConstants
    
tepelmann's avatar
tepelmann committed
    group units {
        
        const float c_squareKm := 1000000.0;
        
    } // end units
    
    group geoConfigurationTypes {
        
        /**
         * @desc    Entry of position table
         * @member  key         Reference key of the entry
         * @member  position    Position vector stored in the entry
         */
        type record PositionEntry {
            charstring key,
tepelmann's avatar
tepelmann committed
            LongPosVector position
        /**
         * @desc    Table containing node positions
         */
        type record of PositionEntry PositionTable;
        
        /**
         * @desc    Parameters of a geometric area
         * @member  geoAreaPosLatitude  Latitude of area's center
         * @member  geoAreaPosLongitude Longitude of area's center
         * @member  distanceA           Distance A
         * @member  distanceB           Distance B
         * @member  angle               Angle
         */
berge's avatar
berge committed
        type record Area {
            Int32  geoAreaPosLatitude,
            Int32  geoAreaPosLongitude,
berge's avatar
berge committed
            UInt16 distanceA,
            UInt16 distanceB,
tepelmann's avatar
tepelmann committed
            UInt16 angle
berge's avatar
berge committed
        }
        /**
         * @desc    Compact definition of GeoBroadcastArea
         * @member  geoBroadcastSubType Type of GeoBroadcastArea (=shape)
tepelmann's avatar
tepelmann committed
         * @member  geoBroadcastArea    Parameters of the geometric area
        type record GeoBroadcastArea {
berge's avatar
berge committed
            HeaderSubTypeGeoBroadcast geoBroadcastSubType,
            Area geoBroadcastArea
        }
        /**
         * @desc    Compact definition of GeoAnycastArea
         * @member  geoAnycastSubType   Type of GeoAnycastArea (=shape)
         * @member  geoAnycastArea      Parameters of the geometric area
         */
        type record GeoAnycastArea {
berge's avatar
berge committed
            HeaderSubTypeGeoAnycast geoAnycastSubType,
tepelmann's avatar
tepelmann committed
            Area geoAnycastArea
berge's avatar
berge committed
        }
        /**
         * @desc    Compact definition of a GeoArea (either GeoBroadcastArea or GeoAnycastArea)
         * @member  shape   Shape of the GeoArea
         * @member  area    Parameters of the geometric area
         */
        type record GeoArea {
            GeoShape shape,
            Area area
        }
        
        /**
         * @desc    Geometric shapes used to define GeoAreas
         */
        type enumerated GeoShape {
            e_geoCircle(0),
            e_geoRect(1),
            e_geoElip(2),
            e_reserved
        }
        
        /**
         * @desc    Entry of GeoArea table
         * @member  key     Reference key of the entry
         * @member  geoArea GeoArea stored in the entry
         */
        type record GeoAreaEntry {
            charstring key,
            GeoArea geoArea
        }
        
        /**
         * @desc    Table containing geoArea definitions
         */
        type record of GeoAreaEntry GeoAreaTable;
tepelmann's avatar
tepelmann committed
        
    } // end geoConfigurationTypes
    group geoNwValues {
        
        group geoNwHeaderConstants {
            const UInt4 c_geoNwProtocolVersion := 0;
            
            const UInt8 c_hopLimit1 := 1;
            const UInt8 c_defaultHopLimit := 10;
        } // end geoNwHeaderConstants
        
berge's avatar
berge committed
    } // end geoNwValues
    group geoNetworkingPdus {
        /**
         * @desc GeoNetworking Packet
tepelmann's avatar
tepelmann committed
         *
tepelmann's avatar
tepelmann committed
         * @see ETSI EN 302 636-4-1 chapter 8.2, 8.3, 8.4
tepelmann's avatar
tepelmann committed
         *
tepelmann's avatar
tepelmann committed
         * @member basicHeader
         * @member gnPacket
tepelmann's avatar
tepelmann committed
        type record GeoNetworkingPdu {
            BasicHeader         basicHeader,
            GeoNetworkingPacket gnPacket
        type record GeoNetworkingPacket {
            SecuredMessage      securedMsg optional,
            GnNonSecuredPacket  packet
        } with {
        	encode (securedPacket) "LibIts_Security"
tepelmann's avatar
tepelmann committed
        }
        
        type record GnNonSecuredPacket {
            CommonHeader    commonHeader,
            ExtendedHeader  extendedHeader optional,
            Payload         payload optional
    } // end group geoNetworkingPdus
    
    group geoNetworkingHeader {
tepelmann's avatar
tepelmann committed
        
        group geoNetworkingBasicHeader {
            
            /**
             * @desc Basic Header
tepelmann's avatar
tepelmann committed
             *
tepelmann's avatar
tepelmann committed
             * <pre>
             *  0               1               2               3
             *  0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
             * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             * |   V   |  NH   |    Reserved   |      LT       |      RHL      |
             * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             * </pre>
             *
             * @see ETSI EN 302 636-4-1 chapter 8.6.1
tepelmann's avatar
tepelmann committed
             *
tepelmann's avatar
tepelmann committed
             * @member version
             * @member nextHeader
             * @member reserved
             * @member lifeTime
             * @member routerHopLimit
             */
            type record BasicHeader {
                UInt4           version,
                BasicNextHeader nextHeader,
                UInt8           reserved,
                Lifetime        lifeTime,
                UInt8           routerHopLimit
            }
            
            type enumerated BasicNextHeader {
                e_any(0),
                e_commonHeader(1),
                e_securedPacket(2),
                e_reserved
            } with {
                variant "4 bit"
            }
            
            /**
             * @desc Indicates the maximum tolerable time a packet can be buffered until it reaches its destination.
             * @member multiplier
             * @member ltBase
             */
            type record Lifetime {
                UInt6   multiplier,
                LtBase  ltBase
            }
            
            /**
             * @desc The base for the calculation of the lifetime.
             */
            type enumerated LtBase {
                e_50ms(0),
                e_1s(1),
                e_10s(2),
                e_100s(3)
            } with {
                variant "2 bit"
            }
            
        } // end group geoNetworkingBasicHeader
        
        group geoNetworkingCommonHeader {
            
            /**
             * @desc Common header for GeoNetworking
tepelmann's avatar
tepelmann committed
             *
tepelmann's avatar
tepelmann committed
             * <pre>
             *  0               1               2               3
             *  0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
             * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             * |  NH   |   R   |  HT   |  HST  |      TC       |     Flags     |
             * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             * |              PL               |     MHL       |    Reserved   |
             * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             * </pre>
             *
             * @see ETSI EN 302 636-4-1 chapter 8.7.2
tepelmann's avatar
tepelmann committed
             *
tepelmann's avatar
tepelmann committed
             * @member nextHeader
             * @member reserved
             * @member headerTST Header type + Header Sub Type
             * @member trafficClass
             * @member flags
             * @member plLength
             * @member maxHopLimit
             * @member reserved2
             */
            type record CommonHeader {
                NextHeader      nextHeader,
                UInt4           reserved,
tepelmann's avatar
tepelmann committed
                HeaderTST       headerTST,
                TrafficClass    trafficClass,
                Bit8            flags,
                UInt16          plLength, // The Codec shall set the length of the paylaod if present
                UInt8           maxHopLimit,
                UInt8           reserved2
tepelmann's avatar
tepelmann committed
            }
tepelmann's avatar
tepelmann committed
            
            /**
             * @desc Identifies the type of header immediately following the Common Header (4Bits).
             */
            type enumerated NextHeader {
                e_any(0),
                e_btpA(1),
                e_btpB(2),
                e_ipv6(3),
                e_reserved
            } with {
                variant "4 bits"
            }
            
wattelet's avatar
wattelet committed
            /**
             * @desc TrafficClass
             *
             * <pre>
             *  0   1   2   3   4   5   6   7
             * +---+---+---+---+---+---+---+---+
             * |SCF|Ch.|         TC ID         |
             * |   |Off|                       |
             * +---+---+---+---+---+---+---+---+
             * </pre>
             *
             * @see ETSI EN 302 636-4-1 chapter 8.7.5
             *
             * @member scf
             * @member channelOffload
             * @member tcId
             */
            type record TrafficClass {
                SCF                     scf,
                ChannelOffload          channelOffload,
                TcId                    tcId
            }
            type enumerated SCF {
                e_scfDisabled(0),
                e_scfEnable (1)
            } with {
                variant "1 bit"
            }
            type enumerated ChannelOffload {
                e_choffDisabled(0),
                e_choffEnable (1)
            } with {
                variant "1 bit"
            }
            type UInt6 TcId;
tepelmann's avatar
tepelmann committed
            
        } // end group geoNetworkingCommonHeader
        
        group geoNetworkingExtendedHeaders {
            
            /**
             * @desc GeoNetworking ExtendedHeader
tepelmann's avatar
tepelmann committed
             *
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.3
tepelmann's avatar
tepelmann committed
             *
tepelmann's avatar
tepelmann committed
             * @member commonHeader
             * @member gnExtHeader
             */
            type union ExtendedHeader {
                GeoUnicastHeader    geoUnicastHeader,
                TSBHeader           tsbHeader,
                SHBHeader           shbHeader,
                GeoBroadcastHeader  geoBroadcastHeader,
                GeoAnycastHeader    geoAnycastHeader,
                BeaconHeader        beaconHeader,
                LSRequestHeader     lsRequestHeader,
                LSReplyHeader       lsReplyHeader,
                AnyHeader           anyHeader
            }
            
            /**
             * @desc The unspecified ANY header.
tepelmann's avatar
tepelmann committed
             *
             * @member seqNumber
             * @member reserved
             */
            type record AnyHeader {
                UInt16          seqNumber,
tepelmann's avatar
tepelmann committed
                UInt16          reserved
            }
            
            /**
             * @desc The BEACON packet header.
             *
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.8.6
             *
             * @member commonHeader
             */
            type record BeaconHeader {
tepelmann's avatar
tepelmann committed
                LongPosVector   srcPosVector
             * @desc The GEOANYCAST packet header.
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.8.5
             *
             * @member seqNumber
             * @member reserved
             * @member srcPosVector
             * @member geoAreaPosLatitude
             * @member geoAreaPosLongitude
             * @member distanceA
             * @member distanceB
             * @member angle
             * @member reserved
            type record GeoAnycastHeader {
                UInt16          seqNumber,
tepelmann's avatar
tepelmann committed
                UInt16          reserved,
                LongPosVector   srcPosVector,
                Int32           geoAreaPosLatitude,
                Int32           geoAreaPosLongitude,
                UInt16          distanceA,
                UInt16          distanceB,
                UInt16          angle,
             * @desc The GEOBROADCAST packet header.
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.8.5
             *
             * @member seqNumber
             * @member reserved
             * @member srcPosVector
             * @member geoAreaPosLatitude
             * @member geoAreaPosLongitude
             * @member distanceA
             * @member distanceB
             * @member angle
             * @member reserved
            type GeoAnycastHeader GeoBroadcastHeader;
             * @desc The GEOUNICAST packet header.
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.8.2
             *
             * @member seqNumber
             * @member reserved
             * @member srcPosVector
             * @member dstPosVector
            type record GeoUnicastHeader {
                UInt16          seqNumber,
tepelmann's avatar
tepelmann committed
                UInt16          reserved,
                LongPosVector   srcPosVector,
                ShortPosVector  dstPosVector
             * @desc The Location Service (LS) Reply packet header.
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.8.8
             *
             * @member seqNumber
             * @member reserved
             * @member srcPosVector
tepelmann's avatar
tepelmann committed
             * @member dstPosVector
            type record LSReplyHeader {
                UInt16          seqNumber,
tepelmann's avatar
tepelmann committed
                UInt16          reserved,
                LongPosVector   srcPosVector,
                ShortPosVector  dstPosVector
            
            /**
             * @desc The Location Service (LS) Request packet header.
             *
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.8.7
             *
             * @member seqNumber
             * @member reserved
             * @member srcPosVector
             * @member gnAddress
             */
            type record LSRequestHeader {
                UInt16          seqNumber,
tepelmann's avatar
tepelmann committed
                UInt16          reserved,
                LongPosVector   srcPosVector,
                GN_Address      gnAddress
            }
            
            /**
             * The Single Hop Broadcast (SHB) packet header.
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.8.4
tepelmann's avatar
tepelmann committed
             * @member srcPosVector
             * @member reserved
             */
            type record SHBHeader {
tepelmann's avatar
tepelmann committed
                LongPosVector   srcPosVector,
                UInt32          reserved
            }
            
            /**
             * @desc The Topologically-Scoped Broadcast (TSB) packet header.
             *
tepelmann's avatar
tepelmann committed
             * @see ETSI EN 302 636-4-1 chapter 8.8.3
             *
             * @member seqNumber
             * @member reserved
             * @member srcPosVector
             */
            type record TSBHeader {
                UInt16          seqNumber,
tepelmann's avatar
tepelmann committed
                UInt16          reserved,
                LongPosVector   srcPosVector
            }
            
            group geoNetworkingHeadersSubtypes {
                
                /**
                 * @desc Identifies the header type and the header subtype for ANY.
                 * @member headerType
                 * @member reserved
                type record AnyHeaderType {
                    HeaderType  headerType(e_any),
tepelmann's avatar
tepelmann committed
                    UInt4       headerSubType
                 * @desc Identifies the header type and the header subtype for BEACON.
                 * @member headerType
                 * @member reserved
                type record BeaconHeaderType {
                    HeaderType  headerType(e_beacon),
fischer's avatar
fischer committed
                    UInt4       headerSubType
                 * @desc Identifies the header type and the header subtype for GEOANYCAST.
                 * @member headerType
                 * @member reserved
                type record GeoAnycastHeaderType {
                    HeaderType              headerType(e_geoAnycast),
                    HeaderSubTypeGeoAnycast headerSubType
                 * @desc Identifies the header type and the header subtype for GEOBROADCAST.
                 * @member headerType
                 * @member reserved
                 */
                type record GeoBroadcastHeaderType {
                    HeaderType                  headerType(e_geoBroadcast),
                    HeaderSubTypeGeoBroadcast   headerSubType
                 * @desc Identifies the header type and the header subtype for GEOUNICAST.
                 * @member headerType
                 * @member reserved
                 */
                type record GeoUnicastHeaderType {
                    HeaderType  headerType(e_geoUnicast),
fischer's avatar
fischer committed
                    UInt4       headerSubType
tepelmann's avatar
tepelmann committed
                /**
                 * @desc Identifies the header type and the header subtype for Location Service LS.
                 * @member headerType
                 * @member reserved
                 */
                type record LsHeaderType {
                    HeaderType      headerType(e_locationService),
                    HeaderSubTypeLs headerSubType
                }
                
                /**
                 * @desc Identifies the header type and the header subtype for Service Announcement SA.
                 * @member headerType
                 * @member reserved
                 */
                type record SaHeaderType {
                    HeaderType      headerType(e_serviceAnnouncement),
                    HeaderSubTypeSa headerSubType
                }
                
                /**
                 * @desc Identifies the header type and the header subtype for Topologically-Scoped Broadcast TSB.
                 * @member headerType
                 * @member headerSubType
                 */
                type record TsbHeaderType {
                    HeaderType       headerType(e_topologicallyScopedBroadcast),
                    HeaderSubTypeTSB headerSubType
                }
                
                 * @desc Identifies the header subtype for GEOANYCAST.
                type enumerated HeaderSubTypeGeoAnycast {
                    e_geoAnycastCircle(0),
                    e_geoAnycastRect(1),
                    e_geoAnycastElip(2),
                    e_reserved
                } with {
                    variant "4 bits"
                 * @desc Identifies the header subtype for GEOBROADCAST.
                type enumerated HeaderSubTypeGeoBroadcast {
                    e_geoBroadcastCircle(0),
                    e_geoBroadcastRect(1),
                    e_geoBroadcastElip(2),
                    e_reserved
                } with {
                    variant "4 bits"
tepelmann's avatar
tepelmann committed
                /**
                 * @desc Identifies the header subtype for Topologically-scoped broadcast TSB.
                 */
                type enumerated HeaderSubTypeTSB {
                    e_singleHop(0),
                    e_multiHop(1),
                    e_reserved
                } with {
                    variant "4 bits"
                 * @desc Identifies the header subtype for Location Service LS.
                type enumerated HeaderSubTypeLs {
                    e_lsRequest(0),
                    e_lsReply(1),
                    e_reserved
                } with {
                    variant "4 bits"
                 * @desc Identifies the header subtype for Service Announcement SA.
                type enumerated HeaderSubTypeSa {
                    e_sa(0),
                    e_saEos(1),
                    e_reserved
                } with {
                    variant "4 bits"
                 * @desc Identifies the header type and the header subtype.
                 * @member anyHdr
                 * @member beaconHdr
                 * @member geoUnicastHdr
                 * @member geoAnycastHdr
                 * @member geoBroadcastHdr
                 * @member tsbHdr
                 * @member lsHdr
                 * @member saHdr
                 * @member reserved
                 */
                type union HeaderTST {
                    AnyHeaderType           anyHdr,
                    BeaconHeaderType        beaconHdr,
                    GeoUnicastHeaderType    geoUnicastHdr,
                    GeoAnycastHeaderType    geoAnycastHdr,
                    GeoBroadcastHeaderType  geoBroadcastHdr,
                    TsbHeaderType           tsbHdr,
                    LsHeaderType            lsHdr,
                    SaHeaderType            saHdr,
                    UInt8                   reserved
                 * @desc Identifies the type of the GeoAdhoc header type (4Bits).
                type enumerated HeaderType {
                    e_any(0),
                    e_beacon(1),
                    e_geoUnicast(2),
                    e_geoAnycast(3),
                    e_geoBroadcast(4),
                    e_topologicallyScopedBroadcast(5),
                    e_locationService(6),
                    e_serviceAnnouncement(7),
                    e_reserved
garciay's avatar
garciay committed
                } with {
                    variant "4 bits"
                 * @desc Long Position Vector
tepelmann's avatar
tepelmann committed
                 *
                 * <pre>
                 *  0               1               2               3
                 *  0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * |                           GN_ADDR                             |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * |                             TST                               |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * |                             Lat                               |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * |                             Long                              |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
tepelmann's avatar
tepelmann committed
                 * |P|              S              |               H               |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * </pre>
                 *
tepelmann's avatar
tepelmann committed
                 * @see ETSI EN 302 636-4-1 chapter 8.5.2
tepelmann's avatar
tepelmann committed
                 *
                 * @member gnAddr
                 * @member timestamp
                 * @member latitude
                 * @member longitude
tepelmann's avatar
tepelmann committed
                 * @member pai Position Accuracy Indicator
                 * @member speed
                 * @member heading
                type record LongPosVector {
                    GN_Address  gnAddr,
                    UInt32      timestamp,
                    Int32       latitude,
                    Int32       longitude,
wattelet's avatar
wattelet committed
                    Bit1        pai,
tepelmann's avatar
tepelmann committed
                    Int15       speed,
                    UInt16      heading
                 * @desc Short Position Vector
tepelmann's avatar
tepelmann committed
                 *
                 * <pre>
                 *  0               1               2               3
                 *  0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * |                           GN_ADDR                             |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * |                             TST                               |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * |                             Lat                               |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * |                             Long                              |
                 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                 * </pre>
                 *
tepelmann's avatar
tepelmann committed
                 * @see ETSI EN 302 636-4-1 chapter 8.5.3
tepelmann's avatar
tepelmann committed
                 *
                 * @member gnAddr
                 * @member timestamp
                 * @member latitude
                 * @member longitude
                type record ShortPosVector {
                    GN_Address  gnAddr,
                    UInt32      timestamp,
                    Int32       latitude,
                    Int32       longitude
                }
                
                group geoNetworkingAddress {
                    /**
                     * @desc GeoNetworking address
tepelmann's avatar
tepelmann committed
                     *
                     * <pre>
                     *  0               1               2               3
                     *  0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
                     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
tepelmann's avatar
tepelmann committed
                     * |M|  S_T    |       S_CC        |             M_ID              |
                     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                     * |                              M_ID                             |
                     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                     * </pre>
                     *
tepelmann's avatar
tepelmann committed
                     * @see ETSI EN 302 636-4-1 chapter 6.2
tepelmann's avatar
tepelmann committed
                     *
                     * @member typeOfAddress
                     * @member stationType
                     * @member mid
                     */
                    type record GN_Address {
                        TypeOfAddress   typeOfAddress,
                        StationType     stationType,
fischer's avatar
fischer committed
                        UInt10          stationCountryCode,
                    }
                    
                    group geoNetworkingAddressSubtypes {
                        
                        /**
tepelmann's avatar
tepelmann committed
                         * @desc Identifies the ITS station (5Bits).
tepelmann's avatar
tepelmann committed
                        type enumerated StationType {
                            e_unknown(0),
                            e_pedestrian(1),
                            e_cyclist(2),
                            e_moped(3),
                            e_motorcycle(4),
                            e_passengerCar(5),
                            e_bus(6),
                            e_lightTruck(7),
                            e_heavyTruck(8),
                            e_trailer(9),
                            e_specialVehicle(10),
                            e_tram(11),
                            e_roadSideUnit(15)
garciay's avatar
garciay committed
                        } with {
tepelmann's avatar
tepelmann committed
                            variant "5 bit"
tepelmann's avatar
tepelmann committed
                         * @desc Distinguish between manually configured
                         * network address and the initial GeoNetwork address (1Bit).
                        type enumerated TypeOfAddress {
                            e_manual(1),
                            e_initial(0)
garciay's avatar
garciay committed
                        } with {
                            variant "1 bit"
                        }
                        
                    } // end group geoNetworkingAddressSubtypes
                } // end group geoNetworkingAddress
                
            } // end group geoNetworkingHeadersSubtypes
tepelmann's avatar
tepelmann committed
            
        } // end group geoNetworkingExtendedHeaders
        
    } // end group geoNetworkingHeader
    
    group geoNetworkingPayload {
        
        type octetstring GnRawPayload;
        
tepelmann's avatar
tepelmann committed
        /**
         * @desc The payload of the GN packet
         * @member decodedPayload The decoded payload
         * @member rawPayload Raw payload as it is received
tepelmann's avatar
tepelmann committed
         */
        type record Payload {
            DecodedPayload decodedPayload optional,
            GnRawPayload rawPayload
        /**
         * @desc The decoded payload of the GN packet
         * @member ipv6Packet The IPv6 packet
         * @member btpPacket BTP packet
tepelmann's avatar
tepelmann committed
         */
        type union DecodedPayload {
tepelmann's avatar
tepelmann committed
            BtpPacket btpPacket
tepelmann's avatar
tepelmann committed
        } with {
            encode (ipv6Packet) "LibItsIpv6OverGeoNetworking";
            encode (btpPacket) "LibItsBtp"
        
    } //end group geoNetworkingPayload
    
    group geoNwPicsTypes {
tepelmann's avatar
tepelmann committed
        
        /**
         * @desc The GeoUnicast forwarding algorithm.
         */
        type enumerated GeoUnicastForwardingAlgorithm {
            e_unspecified(0),
            e_greedy(1),
            e_cbf(2)
        }
        
        /**
         * @desc The GeoBroadcast forwarding algorithm.
         */
        type enumerated GeoBroadcastForwardingAlgorithm {
            e_unspecified(0),
            e_simple(1),
            e_cbf(2),
            e_advanced(3)
tepelmann's avatar
tepelmann committed
        }
        
    } // end geoNwPicsTypes
    group utPrimitives {
        /**
         * @desc    UT primitives for GeoNetworking
         * @member  geoUnicast      -
         * @member  geoBroadcast    -
         * @member  geoAnycast      -
         * @member  shb             -
         * @member  tsb             -
         * @member  changePosition  -
         * @member  checkPacket     -
         */
        type union UtGnTrigger {
            GenerateGeoUnicastMessage geoUnicast,
            GenerateGeoBroadcastMessage geoBroadcast,
            GenerateGeoAnycastMessage geoAnycast,
            GenerateSHBMessage shb,
berge's avatar
berge committed
            GenerateTSBMessage tsb
wattelet's avatar
wattelet committed
        type boolean UtGnTriggerResult;
        
        /**
         * @desc    UT primitive for IUT to send a GeoUnicast packet
         * @member  gnAddress       Destination of the packet
         * @member  lifetime        Lifetime of the packet
         * @member  trafficClass    Traffic class of the packet
         * @member  payload         Payload of the packet
        type record GenerateGeoUnicastMessage {
            GN_Address gnAddress,
            UInt16 lifetime,
            TrafficClass trafficClass,
wattelet's avatar
wattelet committed
            Payload payload 
        /**
         * @desc    UT primitive for IUT to send a GeoBroadcast packet
         * @member  shape           Shape of the area
         * @member  lifetime        Lifetime of the packet
         * @member  trafficClass    Traffic class of the packet
         * @member  area            Destination GeoArea
         * @member  payload         Payload of the packet
        type record GenerateGeoBroadcastMessage {
            UInt16 lifetime,
            TrafficClass trafficClass,
wattelet's avatar
wattelet committed
            Payload payload 
        /**
         * @desc    UT primitive for IUT to send a Geoanycast packet
         */
        type GenerateGeoBroadcastMessage GenerateGeoAnycastMessage;
        
        /**
         * @desc    UT primitive for IUT to send a SHB packet
         * @member  trafficClass    Traffic class of the packet
         * @member  payload         Payload of the packet
        type record GenerateSHBMessage {
        	TrafficClass trafficClass,
wattelet's avatar
wattelet committed
            Payload payload 
         * @desc    UT primitive for IUT to send a SHB packet
         * @member  nbHops          Number of Hops
         * @member  trafficClass    Traffic class of the packet
         * @member  payload         Payload of the packet
        type record GenerateTSBMessage {
        	UInt8   nbHops,
        	TrafficClass trafficClass,
            Payload payload 
        }
        /**
         * @desc Upper Tester message to check Upper Layer message transmission on GN IUT 
         */
        type record UtGnEventInd {
//            GeoNetworkingPdu gnPdu
            GnRawPayload rawPayload
        }
        
        /**
         * @desc List of Upper Tester messages to check Upper Layer message transmission on GN IUT 
         */
        type record of UtGnEventInd UtGnEventIndList;
        
    } // end utPrimitives
    with {
        encode "UpperTester"
    }
    
    group acPrimitives {
        /**
         * @desc    TA primitives for GeoNetworking
         * @member  startBeaconing                  -
         * @member  stopBeaconing                   -
         * @member  startPassBeaconing              -
         * @member  stopPassBeaconing               -
         * @member  startBeaconingMultipleNeighbour -