Skip to content
LibItsGeoNetworking_Templates.ttcn 66.4 KiB
Newer Older
berge's avatar
berge committed
/**
berge's avatar
berge committed
 *  @author     ETSI / STF405
 *  @version    $URL$
 *              $Id$
 *  @desc       GeoNetworking Templates
berge's avatar
berge committed
 *
 */
module LibItsGeoNetworking_Templates {
berge's avatar
berge committed
    
    // Libcommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
berge's avatar
berge committed
    
    // LibIts
    import from LibIts_Interface all;
    import from LibItsGeoNetworking_TypesAndValues all;
berge's avatar
berge committed
    
    group geoNwPrimitivesTemplates {
berge's avatar
berge committed

        /**
         * @desc    Send template for GeoNetworking packet (GeonetworkingPort Primitive)
         * @param   p_geoNwMsg GeoNetworking packet to be sent
         */    
        template (value) GeoNetworkingReq m_geoNwReq(
            template (value) GeoNetworkingPacket p_geoNwMsg
            ) := {
            msgOut := p_geoNwMsg
        }
berge's avatar
berge committed

        /**
         * @desc    Receive template for GeoNetworking packet (GeonetworkingPort Primitive)
         * @param   p_geoNwMsg GeoNetworking packet to be received
         */            
        template GeoNetworkingInd mw_geoNwInd(
            template (present) GeoNetworkingPacket p_geoNwMsg
            ) := {
            msgIn := p_geoNwMsg
        }
        
        group utPrimitives {
            
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a GeoUnicast message to a specific destination
             * @param   p_destinationGnAddr Destination of the GeoUnicast message  
             */
            template UtGNEvent m_generateGeoUnicastMessage(GN_Address p_destinationGnAddr) := {
                geoUnicast := {
                    gnAddress := p_destinationGnAddr,
                    lifetime := omit,
                    payload := omit
                }
            }
            
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a GeoUnicast message to a specific destination with specific lifetime
             * @param   p_destinationGnAddr Destination of the GeoUnicast message
             * @param   p_lifetime          Lifetime of the GeoUnicast message
             * @see     m_generateGeoUnicastMessage
             */
            template UtGNEvent m_generateGeoUnicastMessageWithLifetime(
                GN_Address p_destinationGnAddr,
                integer p_lifetime
            ) modifies m_generateGeoUnicastMessage := {
                geoUnicast := {
                    lifetime := p_lifetime
                }
            }
            
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a GeoUnicast message to a specific destination with a payload
             * @param   p_destinationGnAddr Destination of the GeoUnicast message
             * @param   p_payload           Payload of the GeoUnicast message
             * @see     m_generateGeoUnicastMessage
             */
            template UtGNEvent m_generateGeoUnicastMessageWithPayload(
                GN_Address p_destinationGnAddr,
                Payload p_payload
            ) modifies m_generateGeoUnicastMessage := {
                geoUnicast := {
                    payload := p_payload
                }
            }
            
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a GeoBroadcast message to a specific area
             * @param   p_area  Destination area of the message
             */
            template UtGNEvent m_generateGeoBroadcastMessage(
berge's avatar
berge committed
                GeoArea p_area
            ) := {
                geoBroadcast := {
                    area := p_area,
                    payload := omit
                }
            }
            
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a GeoBroadcast message to a specific area with a payload
             * @param   p_area      Destination area of the message
             * @param   p_payload   Payload of the GeoBroadcast message
             * @see     m_generateGeoBroadcastMessage
             */
            template UtGNEvent m_generateGeoBroadcastMessageWithPayload(
berge's avatar
berge committed
                GeoArea p_area,
                Payload p_payload
            ) modifies m_generateGeoBroadcastMessage := {
                geoBroadcast := {
                    payload := p_payload
                }
            }
                    
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a GeoAnycast message to a specific area
             * @param   p_area  Destination area of the message 
             */
            template UtGNEvent m_generateGeoAnycastMessage(
berge's avatar
berge committed
                GeoArea p_area
            ) := {
                geoAnycast := {
                    area := p_area,
                    payload := omit
                }
            }
            
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a GeoAnycast message to a specific area with a payload
             * @param   p_area      Destination area of the message
             * @param   p_payload   Payload of the GeoAnycast message
             * @see     m_generateGeoAnycastMessage
             */
            template UtGNEvent m_generateGeoAnycastMessageWithPayload(
berge's avatar
berge committed
                GeoArea p_area,
                Payload p_payload
            ) modifies m_generateGeoAnycastMessage := {
                geoAnycast := {
                    payload := p_payload
                }
            }
            
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a SHB message
             */
            template UtGNEvent m_generateSHBMessage := {
                shb := {
                    payload := omit
                }
            }
            
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a SHB message with a payload
             * @param   p_payload   Payload of the SHB message
             * @see     m_generateSHBMessage
             */
            template UtGNEvent m_generateSHBMessageWithPayload(
                Payload p_payload
            ) modifies m_generateSHBMessage := {
                shb := {
                    payload := p_payload
                }
            }
berge's avatar
berge committed
            
            /**
             * @desc    Request IUT to send a TSB message
             */            
            template UtGNEvent m_generateTSBMessage := {
                tsb := {
                    payload := omit
                }
            }
            
        } // end utPrimitives
        
        group taPrimitives {
            
berge's avatar
berge committed
            /**
             * @desc Testsystem will start beaconing for the given neighbor
             * @param p_beaconHeader The neighbor information
berge's avatar
berge committed
            template (value) AcGNEvent m_startBeaconing(
                template (value) BeaconHeader p_beaconHeader
            ) := {
                startBeaconing := {
                    beaconHeader := p_beaconHeader
                }
            }
            
berge's avatar
berge committed
            /**
             * @desc Testsystem will stop beaconing for the given neighbor
             * @param p_compName The neighbor
            template AcGNEvent m_stopBeaconing := {
                stopBeaconing:= {
                }
            }
            
            /**
             * @desc Testsystem will pass received to the TTCN-3
             * @param p_beaconHeader The neighbor information
             */
berge's avatar
berge committed
            template AcGNEvent m_startPassBeaconing(
                template (value) BeaconHeader p_beaconHeader
            ) := {
                startPassBeaconing := {
                    beaconHeader := p_beaconHeader
                }
            }
            
            /**
             * @desc Testsystem will stop passing beacon information to the TTCN-3
             */
                stopPassBeaconing := {
                }
            }
        
        } // end taPrimitives
            
    } // geoNwPrimitivesTemplates
    
    group geoNwPduTemplates {
        
berge's avatar
berge committed
        /**
         * @desc    Send template for GeoNetworking PDU
         * @param   p_header Header value of GeoNetworking message
         */
        template (value) GeoNetworkingPacket m_geoNwPdu(
            in template (value) Header p_header
        ) := {
            header := p_header,
            secHeader := omit,
berge's avatar
berge committed
            payload := omit           
        }
        
        /**
         * @desc    Send template for GeoNetworking PDU with payload
         * @param   p_header    Header value of GeoNetworking message
         * @param   p_payload   Payload
         * @see     m_geoNwPdu
         */
        template (value) GeoNetworkingPacket m_geoNwPduWithPayload(
            in template (value) Header p_header, 
            in template (value) Payload p_payload
        ) modifies m_geoNwPdu := {
berge's avatar
berge committed
        /**
         * @desc    Receive template for GeoNetworking PDU
         * @param   p_header Header value of GeoNetworking message
         */
        template GeoNetworkingPacket mw_geoNwPdu(
            in template (present) Header p_header
        ) := {
            header := p_header,
            secHeader := *,
            payload := *          
berge's avatar
berge committed
        /**
         * @desc    Receive template for GeoNetworking PDU with any payload
         * @param   p_header Header value of GeoNetworking message
         * @see     mw_geoNwPdu
         */
        template GeoNetworkingPacket mw_geoNwPduAnyPayload(
            in template (present) Header p_header
        ) modifies mw_geoNwPdu := {
fischer's avatar
fischer committed
            payload := ?          
        }     
                
berge's avatar
berge committed
        /**
         * @desc    Receive template for GeoNetworking PDU with payload
         * @param   p_header    Header value of GeoNetworking message
         * @param   p_payload   Payload
         * @see     mw_geoNwPdu
         */
        template GeoNetworkingPacket mw_geoNwPduWithPayload(
            in template (present) Header p_header, 
            in template (present) Payload p_payload
        ) modifies mw_geoNwPdu := {
    } // end geoNwPduTemplates
    
    group geoNwHeadersTemplates {
        
        group geoNwCommonHeaderTemplates {
        
berge's avatar
berge committed
            /**
             * @desc    Send template for Common header 
             * @param   p_nextHeader    Id of next header
             * @param   p_headerTST     Header's type and sub-type
             * @param   p_trafficClass  Packet's traffic class
             * @param   p_hopLimit      Maximum number of hops
             * @param   p_senderPosVec  Long position vector of sender
berge's avatar
berge committed
             * @remark  plLength field is set to 0 and has to be computed by codec 
             */
            template (value) CommonHeader m_commonHeader (
berge's avatar
berge committed
                in template (value) NextHeader p_nextHeader,
                in template (value) HeaderTST p_headerTST,
                in template (value) TrafficClass p_trafficClass,
                in template (value) UInt8 p_hopLimit,
                in template (value) LongPosVector p_senderPosVec
berge's avatar
berge committed
                version := c_geoNwProtocolVersion,
                nextHeader := p_nextHeader,
berge's avatar
berge committed
                headerTST := p_headerTST,
                reserved := c_uInt8Zero,
                flags := c_8ZeroBits,
                plLength := 0, // will be computed by Codec
                trafficClass := p_trafficClass,
                hopLimit := p_hopLimit,
berge's avatar
berge committed
                senderPosVector := p_senderPosVec    
berge's avatar
berge committed
            /**
             * @desc    Receive template for Common header
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_nextHeader        Id of next header
             * @param   p_headerTST         Header's type and sub-type
             */
            template CommonHeader mw_commonHeader (
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTST
                version := c_geoNwProtocolVersion,
                nextHeader := p_nextHeader,
                reserved := c_uInt8Zero,
                flags := c_8ZeroBits,
                plLength := ?, 
                trafficClass := ?,
                hopLimit := ?,
                senderPosVector := p_senderLongPosVec    
berge's avatar
berge committed
            /**
             * @desc    Receive template for Beacon header
             * @param   p_trafficClass      Packet's traffic class
             * @param   p_hopLimit          Maximum number of hops
             * @param   p_senderLongPosVec  Long position vector of sender
             */
fischer's avatar
fischer committed
            template CommonHeader mw_commonHeaderBeacon (
berge's avatar
berge committed
                in template (present) TrafficClass p_trafficClass,
                in template (present) UInt8 p_hopLimit,
fischer's avatar
fischer committed
                in template (present) LongPosVector p_senderLongPosVec
berge's avatar
berge committed
            ) := {
berge's avatar
berge committed
                version := c_geoNwProtocolVersion,
                nextHeader := e_any, // 0
                headerTST := {
                    beaconHdr := {    
                        headerType := e_beacon, // 0
                        headerSubType := 0
                    }
                },
                reserved := c_uInt8Zero,
                flags := c_8ZeroBits,
berge's avatar
berge committed
                plLength := 0,
                trafficClass := p_trafficClass,
                hopLimit := p_hopLimit,
                senderPosVector := p_senderLongPosVec
            }
berge's avatar
berge committed
            /**
             * @desc    Receive template for Common header with specific Hop limit
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_nextHeader        Id of next header
             * @param   p_headerTST         Header's type and sub-type
berge's avatar
berge committed
             * @param   p_hopLimit          Maximum number of hops
             * @see     mw_commonHeader
             */
            template CommonHeader mw_commonHeaderWithHopLimit (
                in template (present) LongPosVector p_senderLongPosVec,
berge's avatar
berge committed
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTST,
                in template (present) UInt8 p_hopLimit
            ) modifies mw_commonHeader := {
                hopLimit := p_hopLimit   
            }
            
berge's avatar
berge committed
            /**
             * @desc    Receive template for Common header with specific Hop limit
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_nextHeader        Id of next header
             * @param   p_headerTST         Header's type and sub-type
berge's avatar
berge committed
             * @param   p_trafficClass      Packet's traffic class
             */
            template CommonHeader mw_commonHeaderWithTrafficClass (
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTST,
                in template (present) TrafficClass p_trafficClass
            ) modifies mw_commonHeader := {
                trafficClass := p_trafficClass
            }
berge's avatar
berge committed
            /**
             * @desc    Default send template for traffic class
             */
            template (value) TrafficClass m_trafficClass := {
                reserved := c_uInt1Zero,
                relevance := c_uInt3Zero,
                reliability := e_veryHigh,
                latency := e_veryLow
            }
            
berge's avatar
berge committed
            /**
             * @desc    Receive template for traffic class
             * @param   p_reliability   Reliability
             * @param   p_latency       Latency
             */
berge's avatar
berge committed
            template TrafficClass mw_trafficClass(
                in template (present) Reliability p_reliability,
                in template (present) Latency p_latency
berge's avatar
berge committed
            ) := {
                reserved := c_uInt1Zero,
                relevance := c_uInt3Zero,
                reliability := p_reliability,
                latency := p_latency
            }
            
berge's avatar
berge committed
            /**
             * @desc    Receive template for any GN_Address
             */
fischer's avatar
fischer committed
            template GN_Address mw_gnAddressAny := {
                typeOfAddress := ?,
                stationType := ?,
                stationSubType := ?,
                stationCountryCode := ?,
                mid := ?
            }
berge's avatar
berge committed

berge's avatar
berge committed
            /**
             * @desc    Receive template for GN_Address
             * @param   p_stationType           Station's type
             * @param   p_stationSubType        Station's sub-type
             * @param   p_stationCountryCode    Station's country code
             */
berge's avatar
berge committed
            template GN_Address mw_gnAddress(
                in template (present) StationType p_stationType,
                in template (present) StationSubType p_stationSubType,
                in template (present) UInt10 p_stationCountryCode
            ) := {
                typeOfAddress := ?,
                stationType := p_stationType,
                stationSubType := p_stationSubType,
                stationCountryCode := p_stationCountryCode,
                mid := ?
            }

fischer's avatar
fischer committed
            
berge's avatar
berge committed
            /**
             * @desc    Receive template for long position vector with specific GN_Address
             * @param   p_gnAddress GN_Address to be contained in the long position vector
             */
fischer's avatar
fischer committed
            template LongPosVector mw_longPosVectorAny(
berge's avatar
berge committed
                in template (present) GN_Address p_gnAddress
            ) := {
fischer's avatar
fischer committed
                    gnAddr := p_gnAddress,
                    timestamp := ?,
                    latitude := ?,
fischer's avatar
fischer committed
                    longitude := ?,
                    speed := ?,
                    heading := ?,
                    altitude := ?,
                    timeAccuracy := ?,
                    posAccuracy := ?,
                    speedAccuracy := ?,
                    headingAccuracy := ?,
                    altitudeAccuracy := ?
            }
         
berge's avatar
berge committed
           } // end geoNwCommonHeaderTemplates
berge's avatar
berge committed
        group geoUnicastHeaderTemplates {
            
            /**
             * @desc    Send template for GeoUnicast header
             * @param   p_sourceLongPosVec      Long position vector of source 
             * @param   p_destinationLongPosVec Long position vector of destination 
             * @param   p_senderLongPosVec      Long position vector of sender
berge's avatar
berge committed
             * @param   p_seqNumber             Sequence number of GeoUnicast packet
             */
            template (value) Header m_geoUnicastHeader(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) ShortPosVector p_destinationLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber
            ) := {
                geoUnicastHeader := {
                    commonHeader := m_commonHeader(
berge's avatar
berge committed
                        e_ipv6,
                        m_geoUnicastHeaderType,
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_defaultLifetime,
                    reserved := c_uInt8Zero,
berge's avatar
berge committed
                       srcPosVector := p_sourceLongPosVec,
                    dstPosVector := p_destinationLongPosVec
berge's avatar
berge committed
            }    
berge's avatar
berge committed
            /**
             * @desc    Send template for GeoUnicast header with Hop limit
             * @param   p_sourceLongPosVec      Long position vector of source 
             * @param   p_destinationLongPosVec Long position vector of destination 
             * @param   p_senderLongPosVec      Long position vector of sender
berge's avatar
berge committed
             * @param   p_seqNumber             Sequence number of GeoUnicast packet
             * @param   p_hopLimit              Maximum number of hops 
             * @see     m_geoUnicastHeader
             */
berge's avatar
berge committed
            template (value) Header m_geoUnicastHeaderWithHopLimit(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) ShortPosVector p_destinationLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) UInt8 p_hopLimit
            ) modifies m_geoUnicastHeader := {
                geoUnicastHeader := {
                    commonHeader := {
                      hopLimit := p_hopLimit
                    }
                }
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoUnicast header
             * @param   p_senderLongPosVec          Long position vector of sender
             * @param   p_destinationShortPosVec    Long position vector of destination
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             */
            template Header mw_geoUnicastHeader(
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                geoUnicastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoUnicastHeaderType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
berge's avatar
berge committed
                    reserved := ?,
berge's avatar
berge committed
                       srcPosVector := ?,
                    dstPosVector := p_destinationShortPosVec
berge's avatar
berge committed
            }    
            
            /**
             * @desc    Receive template for GeoUnicast header with source long position vector
             * @param   p_senderLongPosVec          Long position vector of sender
             * @param   p_destinationShortPosVec    Long position vector of destination
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             * @param   p_srcLongPosVec             Long position vector of source
             * @see     mw_geoUnicastHeader
             */
            template Header mw_geoUnicastHeaderWithSourcePv(
berge's avatar
berge committed
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) LongPosVector p_srcLongPosVec
            ) modifies mw_geoUnicastHeader := {
                geoUnicastHeader := {
                    srcPosVector := p_srcLongPosVec
                }
            }
berge's avatar
berge committed
            
            /**
             * @desc    Receive template for GeoUnicast header with source long position vector
             * @param   p_senderLongPosVec          Long position vector of sender
             * @param   p_destinationShortPosVec    Long position vector of destination
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             * @param   p_hopLimit                  Maximum number of hops 
             * @see     mw_geoUnicastHeader
             */
            template Header mw_geoUnicastHeaderWithHopLimit(
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) UInt8 p_hopLimit
            ) modifies mw_geoUnicastHeader := {
                geoUnicastHeader := {
tepelmann's avatar
tepelmann committed
                    commonHeader := {
                        hopLimit := p_hopLimit
                    }
berge's avatar
berge committed
            } 
            
            /**
             * @desc    Receive template for GeoUnicast header with common header and lifetime
             * @param   p_senderLongPosVec          Long position vector of sender
             * @param   p_destinationShortPosVec    Long position vector of destination
             * @param   p_stationType               Station type of sender
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             * @param   p_commonHeader              Common header 
             * @param   p_lifetime                  lifetime of the packet
             */
            template Header mw_geoUnicastHeaderWithCommonHeaderWithLifetime(
berge's avatar
berge committed
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) ShortPosVector p_destinationLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) CommonHeader p_commonHeader,
                in template (present) Lifetime p_lifetime
            ) := {
                geoUnicastHeader := {
                    commonHeader := p_commonHeader,
                    seqNumber := p_seqNumber,
                    lifetime := p_lifetime,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    dstPosVector := p_destinationLongPosVec
                }
            } 
berge's avatar
berge committed
            
            /**
             * @desc    Send template for GeoUnicast header type
             */
            template (value) HeaderTST m_geoUnicastHeaderType := {
                geoUnicastHdr := {
berge's avatar
berge committed
                    headerType := e_geoUnicast,
fischer's avatar
fischer committed
                    headerSubType := c_uInt4Zero
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoUnicast header type
             */
            template HeaderTST mw_geoUnicastHeaderType := {
                geoUnicastHdr := {
berge's avatar
berge committed
                    headerType := e_geoUnicast,
fischer's avatar
fischer committed
                    headerSubType := c_uInt4Zero
berge's avatar
berge committed
            
        } // end geoUnicastHeaderTemplates
        group geoBroadcastHeaderTemplates {
            
berge's avatar
berge committed
            /**
             * @desc    Send template for GeoBroadcast header
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea     Destination GeoArea
             */
            template (value) Header m_geoBroadcastHeader(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoBroadcastArea p_broadcastArea
            ) := {
                geoBroadcastHeader := {
                    commonHeader := m_commonHeader(
berge's avatar
berge committed
                        e_btp,
                        m_geoBroadcastHeaderType(p_broadcastArea.geoBroadcastSubType),
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_defaultLifetime,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
berge's avatar
berge committed
                    geoAreaPosLatitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLongitude,
                    distanceA := p_broadcastArea.geoBroadcastArea.distanceA,
                    distanceB := p_broadcastArea.geoBroadcastArea.distanceB,
                    angle := p_broadcastArea.geoBroadcastArea.angle,
                    reserved2 := c_uInt24Zero
                }
            }  
            
berge's avatar
berge committed
            /**
             * @desc    Send template for GeoBroadcast header with hop limit
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_stationType       Station type of sender
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea     Destination GeoArea
             * @param   p_hopLimit          Maximum number of hops 
             * @see     m_geoBroadcastHeader
             */
berge's avatar
berge committed
            template (value) Header m_geoBroadcastHeaderWithHopLimit(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoBroadcastArea p_broadcastArea,
berge's avatar
berge committed
                in template (value) UInt8 p_hopLimit
            ) modifies m_geoBroadcastHeader := {
                geoBroadcastHeader := {
                    commonHeader := m_commonHeader(
                        e_btp,
berge's avatar
berge committed
                        m_geoBroadcastHeaderType(p_broadcastArea.geoBroadcastSubType),
berge's avatar
berge committed
                        m_trafficClass,
                        p_hopLimit,
                        p_senderLongPosVec
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoBroadcast header for any GeoArea
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
             */
            template Header mw_geoBroadcastHeader(
berge's avatar
berge committed
                in template (present) LongPosVector p_sourceLongPosVec,
berge's avatar
berge committed
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                geoBroadcastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
                        ?,
                        mw_geoBroadcastHeaderType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
                    reserved := c_uInt8Zero,
berge's avatar
berge committed
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := ?,
                    geoAreaPosLongitude := ?,
                    distanceA := ?,
                    distanceB := ?,
                    angle := ?,
                    reserved2 := c_uInt24Zero
                }
            } 
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoBroadcast header
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea     Destination GeoArea
             * @see     mw_geoBroadcastHeader
             */
berge's avatar
berge committed
            template Header mw_geoBroadcastHeaderWithArea (
                in template (present) LongPosVector p_sourceLongPosVec,
berge's avatar
berge committed
                in template (present) LongPosVector p_senderLongPosVec,
berge's avatar
berge committed
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoBroadcastArea p_broadcastArea
berge's avatar
berge committed
            ) modifies mw_geoBroadcastHeader := {
                geoBroadcastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoBroadcastHeaderTypeWithSubType(p_broadcastArea.geoBroadcastSubType)
berge's avatar
berge committed
                    ),
berge's avatar
berge committed
                    geoAreaPosLatitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLongitude,
                    distanceA := p_broadcastArea.geoBroadcastArea.distanceA,
                    distanceB := p_broadcastArea.geoBroadcastArea.distanceB,
                    angle := p_broadcastArea.geoBroadcastArea.angle
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoBroadcast header with Hop limit
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea     Destination GeoArea
             * @param   p_hopLimit          Maximum number of hops 
             * @see     mw_geoBroadcastHeaderWithArea
             */
berge's avatar
berge committed
            template Header mw_geoBroadcastHeaderWithAreaWithHopLimit(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) UInt16 p_seqNumber,   
                in template (present) GeoBroadcastArea p_broadcastArea,             
berge's avatar
berge committed
                in template (present) UInt8 p_hopLimit
            ) modifies mw_geoBroadcastHeaderWithArea := {
                geoBroadcastHeader := {
                    commonHeader := mw_commonHeaderWithHopLimit(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoBroadcastHeaderType,
                        p_hopLimit
                    )
                } 
            }
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoBroadcast header with common header and lifetime
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea     Destination GeoArea
             * @param   p_commonHeader      Common header
             * @param   p_lifetime          Lifetime of the GeoBroadcast packet
             */
            template Header mw_geoBroadcastHeaderWithAreaWithChWithLt(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoBroadcastArea p_broadcastArea,
                in template (present) CommonHeader p_commonHeader,
                in template (present) Lifetime p_lifetime
            ) := {
                geoBroadcastHeader := {
                    commonHeader := p_commonHeader,
                    seqNumber := p_seqNumber,
                    lifetime := p_lifetime,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLongitude,
                    distanceA := p_broadcastArea.geoBroadcastArea.distanceA,
                    distanceB := p_broadcastArea.geoBroadcastArea.distanceB,
                    angle := p_broadcastArea.geoBroadcastArea.angle,
                    reserved2 := c_uInt24Zero
                }
            } 
                       
berge's avatar
berge committed
            /**
             * @desc    Send template for GeoBroadcast header type
             * @param   p_headerSubType Packet's subtype
             */
            template (value) HeaderTST m_geoBroadcastHeaderType(
berge's avatar
berge committed
                in template (value) HeaderSubTypeGeoBroadcast p_headerSubType
            ) := {
                geoBroadcastHdr := {
berge's avatar
berge committed
                    headerType := e_geoBroadcast,
                    headerSubType := p_headerSubType
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoBroadcast header type 
             */
            template HeaderTST mw_geoBroadcastHeaderType := {
                geoBroadcastHdr := {
berge's avatar
berge committed
                    headerType := e_geoBroadcast,
                    headerSubType := ?
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoBroadcast header type with sub-type
             * @param   p_headerSubType Packet's subtype
             * @see     mw_geoBroadcastHeaderType
             */
            template HeaderTST mw_geoBroadcastHeaderTypeWithSubType(
berge's avatar
berge committed
                in template (present) HeaderSubTypeGeoBroadcast p_headerSubType
            ) modifies mw_geoBroadcastHeaderType := {
                geoBroadcastHdr := {
berge's avatar
berge committed
                    headerSubType := p_headerSubType
berge's avatar
berge committed
            /**
             * @desc    Default send template for Lifetime field
             */
            template (value) Lifetime m_defaultLifetime := {
berge's avatar
berge committed
                multiplier := c_defaultLifetime,
berge's avatar
berge committed
            /**
             * @desc    Receive template for lifetime 0
             */
            template (present) Lifetime mw_lifetime0 := {
                multiplier := 0,
                ltBase := ?
            }
                
        } // end geoBroadcastHeaderTemplates
berge's avatar
berge committed
        group geoAnycastHeaderTemplates {
            
berge's avatar
berge committed
           /**
             * @desc    Send template for GeoAnycast header
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender
berge's avatar
berge committed
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             * @param   p_anycastArea       Destination GeoArea
             */
berge's avatar
berge committed
            template (value) Header m_geoAnycastHeader(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoAnycastArea p_anycastArea
berge's avatar
berge committed
            ) := {
                geoAnycastHeader := {
                    commonHeader := m_commonHeader(
                        e_btp,
                        m_geoAnycastHeaderType(p_anycastArea.geoAnycastSubType),
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec
berge's avatar
berge committed
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_defaultLifetime,
berge's avatar
berge committed
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := p_anycastArea.geoAnycastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_anycastArea.geoAnycastArea.geoAreaPosLongitude,
                    distanceA := p_anycastArea.geoAnycastArea.distanceA,
                    distanceB := p_anycastArea.geoAnycastArea.distanceB,
                    angle := p_anycastArea.geoAnycastArea.angle,
                    reserved2 := c_uInt24Zero
                }
            }  
            
berge's avatar
berge committed
            /**
             * @desc    Send template for GeoAnycast header with hop limit
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             * @param   p_anycastArea       Destination GeoArea
             * @param   p_hopLimit          Maximum number of hops 
             * @see     m_geoAnycastHeader
             */
berge's avatar
berge committed
            template (value) Header m_geoAnycastHeaderWithHopLimit(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoAnycastArea p_anycastArea,
berge's avatar
berge committed
                in template (value) UInt8 p_hopLimit
            ) modifies m_geoAnycastHeader := {
                geoAnycastHeader := {
                    commonHeader := m_commonHeader(
                        e_btp,
                        m_geoAnycastHeaderType(p_anycastArea.geoAnycastSubType),
                        m_trafficClass,
                        p_hopLimit,
                        p_senderLongPosVec
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoAnycast header for any GeoArea
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             */
berge's avatar
berge committed
            template Header mw_geoAnycastHeader(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                geoAnycastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoAnycastHeaderType                    
berge's avatar
berge committed
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := ?,
                    geoAreaPosLongitude := ?,
                    distanceA := ?,
                    distanceB := ?,
                    angle := ?,
                    reserved2 := c_uInt24Zero
                }
            } 
                       
berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoAnycast header
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             * @param   p_anycastArea       Destination GeoArea
             * @see     mw_geoAnycastHeader 
             */
berge's avatar
berge committed
            template Header mw_geoAnycastHeaderWithArea (
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoAnycastArea p_anycastArea
berge's avatar
berge committed
            ) modifies mw_geoAnycastHeader := {
                geoAnycastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoAnycastHeaderTypeWithSubType(p_anycastArea.geoAnycastSubType) 
berge's avatar
berge committed
                    ),
                    geoAreaPosLatitude := p_anycastArea.geoAnycastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_anycastArea.geoAnycastArea.geoAreaPosLongitude,
                    distanceA := p_anycastArea.geoAnycastArea.distanceA,
                    distanceB := p_anycastArea.geoAnycastArea.distanceB,
                    angle := p_anycastArea.geoAnycastArea.angle
                }
            } 

berge's avatar
berge committed
            /**
             * @desc    Receive template for GeoAnycast header with Hop limit
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender
berge's avatar
berge committed
             * @param   p_seqNumber         Sequence number of GeoAnycast packet