Skip to content
LibItsGeoNetworking_Templates.ttcn 102 KiB
Newer Older
berge's avatar
berge committed
/**
tepelmann's avatar
tepelmann committed
 *  @author     ETSI / STF405 / STF449
berge's avatar
berge committed
 *  @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
    
garciay's avatar
garciay committed
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
garciay's avatar
garciay committed
    import from LibItsExternal_TypesAndValues all;
    
    // LibItsBtp
    import from LibItsBtp_Templates all;
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_Pixits all;
    
    // LibItsIpv6OverGeoNetworking
    import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
    import from LibItsIpv6OverGeoNetworking_Templates all;
    
    // AtsGeoNetworking
reinaortega's avatar
reinaortega committed
    import from LibItsGeoNetworking_TestSystem all;
tepelmann's avatar
tepelmann committed
    import from LibItsGeoNetworking_TypesAndValues all;
reinaortega's avatar
reinaortega committed
    import from LibItsGeoNetworking_Pixits all;
berge's avatar
berge committed
    
    group geoNwPrimitivesTemplates {
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
        /**
         * @desc    Send template for GeoNetworking packet (GeonetworkingPort Primitive)
         * @param   p_geoNwMsg GeoNetworking packet to be sent
tepelmann's avatar
tepelmann committed
         */
berge's avatar
berge committed
        template (value) GeoNetworkingReq m_geoNwReq_linkLayerBroadcast(
tepelmann's avatar
tepelmann committed
            template (value) GeoNetworkingPdu p_geoNwMsg
            macDestinationAddress := c_llBroadcast
        }
tepelmann's avatar
tepelmann committed
        
        /**
         * @desc    Send template for GeoNetworking packet (GeonetworkingPort Primitive)
         * @param   p_geoNwMsg              GeoNetworking packet to be sent
         * @param   p_llDestinationAdress   Link-layer destination address
tepelmann's avatar
tepelmann committed
         */
        template (value) GeoNetworkingReq m_geoNwReq_withLinkLayerDestination(
tepelmann's avatar
tepelmann committed
            template (value) GeoNetworkingPdu p_geoNwMsg,
            template (value) MacAddress p_llDestinationAdress
berge's avatar
berge committed
        ) modifies m_geoNwReq_linkLayerBroadcast := {
            macDestinationAddress := p_llDestinationAdress
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
        /**
         * @desc    Receive template for GeoNetworking packet (GeonetworkingPort Primitive)
         * @param   p_geoNwMsg GeoNetworking packet to be received
tepelmann's avatar
tepelmann committed
         */
        template GeoNetworkingInd mw_geoNwInd(
tepelmann's avatar
tepelmann committed
            template (present) GeoNetworkingPdu p_geoNwMsg
tepelmann's avatar
tepelmann committed
            macDestinationAddress := ?
tepelmann's avatar
tepelmann committed
        
        /**
         * @desc    Receive template for GeoNetworking packet (GeonetworkingPort Primitive)
         * @param   p_geoNwMsg              GeoNetworking packet to be received
         * @param   p_llDestinationAdress   Link-layer destination address
tepelmann's avatar
tepelmann committed
         */
        template GeoNetworkingInd mw_geoNwInd_withLinkLayerDestination(
tepelmann's avatar
tepelmann committed
            template (present) GeoNetworkingPdu p_geoNwMsg,
            template (present) MacAddress p_llDestinationAdress
        ) modifies mw_geoNwInd := {
tepelmann's avatar
tepelmann committed
            macDestinationAddress := p_llDestinationAdress
tepelmann's avatar
tepelmann committed
        
        group utPrimitives {
            
tepelmann's avatar
tepelmann committed
             * @desc Initializes the GN IUT.
             */
            template (value) UtInitialize m_gnInitialize := {
garciay's avatar
garciay committed
                hashedId8 := '0000000000000000'O
            /**
             * @desc    Request IUT to send a GeoUnicast message to a specific destination
tepelmann's avatar
tepelmann committed
             * @param   p_destinationGnAddr Destination of the GeoUnicast message
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoUnicastMessage(GN_Address p_destinationGnAddr) := {
                geoUnicast := {
tepelmann's avatar
tepelmann committed
                    lifetime := c_lifetime,
                    trafficClass := m_trafficClass,
wattelet's avatar
wattelet committed
                    payload := { decodedPayload := omit, rawPayload := ''O} // do not use f_adaptPayload_m here
            /**
             * @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_trafficClass      TrafficClass of the GeoUnicast message
             * @see     m_generateGeoUnicastMessage
             */
            template (value) UtGnTrigger m_generateGeoUnicastMessageWithTrafficClass(
                GN_Address p_destinationGnAddr,
                TrafficClass p_trafficClass
            ) modifies m_generateGeoUnicastMessage := {
                geoUnicast := {
                    trafficClass := p_trafficClass
                }
            }
                        
            /**
             * @desc    Request IUT to send a GeoUnicast message to a specific destination with specific lifetime
             * @param   p_destinationGnAddr Destination of the GeoUnicast message
berge's avatar
berge committed
             * @param   p_lifetime          Lifetime of the GeoUnicast message
             * @see     m_generateGeoUnicastMessage
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoUnicastMessageWithLifetime(
                GN_Address p_destinationGnAddr,
tepelmann's avatar
tepelmann committed
                UInt16 p_lifetime
            ) modifies m_generateGeoUnicastMessage := {
            /**
             * @desc    Request IUT to send a GeoUnicast message to a specific destination with a payload
             * @param   p_destinationGnAddr Destination of the GeoUnicast message
berge's avatar
berge committed
             * @param   p_payload           Payload of the GeoUnicast message
             * @see     m_generateGeoUnicastMessage
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoUnicastMessageWithPayload(
                GN_Address p_destinationGnAddr,
berge's avatar
berge committed
                octetstring p_payload
            ) modifies m_generateGeoUnicastMessage := {
                geoUnicast := {
                    payload := { decodedPayload := omit, rawPayload := p_payload} // do not use f_adaptPayload_m here
                }
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Request IUT to send a GeoUnicast message to a specific destination with specific lifetime with specific payload
             * @param   p_destinationGnAddr Destination of the GeoUnicast message
             * @param   p_lifetime          Lifetime of the GeoUnicast message
             * @param   p_payload           Payload of the GeoUnicast message
             * @see     m_generateGeoUnicastMessage
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoUnicastMessageWithLifetimeWithPayload(
tepelmann's avatar
tepelmann committed
                GN_Address p_destinationGnAddr,
tepelmann's avatar
tepelmann committed
                UInt16 p_lifetime,
tepelmann's avatar
tepelmann committed
                octetstring p_payload
            ) modifies m_generateGeoUnicastMessageWithLifetime := {
                geoUnicast := {
                    payload := { decodedPayload := omit, rawPayload := p_payload} // do not use f_adaptPayload_m here
                }
tepelmann's avatar
tepelmann committed
            }
            /**
             * @desc    Request IUT to send a GeoBroadcast message to a specific area
             * @param   p_geoArea  Destination area of the message
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoBroadcastMessage(
garciay's avatar
garciay committed
                    shape := p_geoArea.shape,
tepelmann's avatar
tepelmann committed
                    lifetime := c_lifetime,
                    trafficClass := m_trafficClass,
                    reserved := c_uInt24Zero,
wattelet's avatar
wattelet committed
                    payload := { decodedPayload := omit, rawPayload := ''O} // do not use f_adaptPayload_m here

            /**
             * @desc    Request IUT to send a GeoBroadcast message to a specific area
             * @param   p_geoArea           Destination area of the message
             * @param   p_trafficClass      TrafficClass of the GeoUnicast message
             */
            template (value) UtGnTrigger m_generateGeoBroadcastMessageWithTrafficClass(
                GeoArea p_geoArea,
                TrafficClass p_trafficClass
            ) modifies m_generateGeoBroadcastMessage := {
                geoBroadcast := {
                    trafficClass := p_trafficClass
                }
            }
                        
berge's avatar
berge committed
            /**
             * @desc    Request IUT to send a GeoBroadcast message to a specific area
             * @param   p_geoArea   Destination area of the message
berge's avatar
berge committed
             * @param   p_lifetime  Packet's lifetime
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoBroadcastMessageWithLifetime(
tepelmann's avatar
tepelmann committed
                UInt16 p_lifetime
berge's avatar
berge committed
            ) modifies m_generateGeoBroadcastMessage := {
            /**
             * @desc    Request IUT to send a GeoBroadcast message to a specific area with a payload
             * @param   p_geoArea   Destination area of the message
berge's avatar
berge committed
             * @param   p_payload   Payload of the GeoBroadcast message
             * @see     m_generateGeoBroadcastMessage
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoBroadcastMessageWithPayload(
berge's avatar
berge committed
                octetstring p_payload
            ) modifies m_generateGeoBroadcastMessage := {
                geoBroadcast := {
                    payload := { decodedPayload := omit, rawPayload := p_payload} // do not use f_adaptPayload_m here
                }
            /**
             * @desc    Request IUT to send a GeoAnycast message to a specific area
             * @param   p_geoArea  Destination area of the message
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoAnycastMessage(
garciay's avatar
garciay committed
                    shape := p_geoArea.shape,
tepelmann's avatar
tepelmann committed
                    lifetime := c_lifetime,
                    trafficClass := m_trafficClass,
                    reserved := c_uInt24Zero,
wattelet's avatar
wattelet committed
                    payload := { decodedPayload := omit, rawPayload := ''O} // do not use f_adaptPayload_m here

            /**
             * @desc    Request IUT to send a GeoAnycast message to a specific area with a payload
             * @param   p_geoArea           Destination area of the message
             * @param   p_trafficClass      TrafficClass of the GeoUnicast message
             * @see     m_generateGeoAnycastMessage
             */
            template (value) UtGnTrigger m_generateGeoAnycastMessageWithTrafficClass(
                GeoArea p_geoArea,
                TrafficClass p_trafficClass
            ) modifies m_generateGeoAnycastMessage := {
                geoAnycast := {
                    trafficClass := p_trafficClass
                }
            }
                        
            /**
             * @desc    Request IUT to send a GeoAnycast message to a specific area with a payload
             * @param   p_geoArea   Destination area of the message
berge's avatar
berge committed
             * @param   p_payload   Payload of the GeoAnycast message
             * @see     m_generateGeoAnycastMessage
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateGeoAnycastMessageWithPayload(
berge's avatar
berge committed
                octetstring p_payload
            ) modifies m_generateGeoAnycastMessage := {
                geoAnycast := {
                    payload := { decodedPayload := omit, rawPayload := p_payload} // do not use f_adaptPayload_m here
                }
            /**
             * @desc    Request IUT to send a SHB message
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateShbMessage := {
                    trafficClass := m_trafficClass,
wattelet's avatar
wattelet committed
                    payload := { decodedPayload := omit, rawPayload := ''O} // do not use f_adaptPayload_m here
 
            /**
             * @desc    Request IUT to send a SHB message with a payload
             * @param   p_trafficClass      TrafficClass of the GeoUnicast message
             * @see     m_generateShbMessage
             */
            template (value) UtGnTrigger m_generateShbMessageWithTrafficClass(
                TrafficClass p_trafficClass
            ) modifies m_generateShbMessage := {
                shb := {
                    trafficClass := p_trafficClass
                }
            }
                        
            /**
             * @desc    Request IUT to send a SHB message with a payload
berge's avatar
berge committed
             * @param   p_payload   Payload of the SHB message
             * @see     m_generateShbMessage
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateShbMessageWithPayload(
berge's avatar
berge committed
                octetstring p_payload
            ) modifies m_generateShbMessage := {
                shb := {
                    payload := { decodedPayload := omit, rawPayload := p_payload} // do not use f_adaptPayload_m here
                }
berge's avatar
berge committed
            
            /**
             * @desc    Request IUT to send a TSB message
tepelmann's avatar
tepelmann committed
            template (value) UtGnTrigger m_generateTsbMessage := {
garciay's avatar
garciay committed
                    nbHops := 10,
                    lifetime := c_lifetime,
                    trafficClass := m_trafficClass,
wattelet's avatar
wattelet committed
                    payload := { decodedPayload := omit, rawPayload := ''O} // do not use f_adaptPayload_m here
            /**
             * @desc    Request IUT to send a TSB message
             * @param   p_lifetime  Packet's lifetime
             */
            template (value) UtGnTrigger m_generateTsbMessageWithLifetime(
                UInt16 p_lifetime
            ) modifies m_generateTsbMessage := {
                tsb := {
                    lifetime := p_lifetime
                }
            }
            
            /**
             * @desc    Request IUT to send a TSB message
             * @param   p_trafficClass      TrafficClass of the GeoUnicast message
             */
            template (value) UtGnTrigger m_generateTsbMessageWithTrafficClass(
                TrafficClass p_trafficClass
            ) modifies m_generateTsbMessage := {
                tsb := {
                    trafficClass := p_trafficClass
                }
            }
                        
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Request IUT to change its position
             */
            template (value) UtChangePosition m_changePosition := {
                latitude := 1000,
                longitude := 0,
                elevation := 0
tepelmann's avatar
tepelmann committed
            }
            
        } // 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) AcGnPrimitive m_startBeaconing(
berge's avatar
berge committed
                template (value) BeaconHeader p_beaconHeader
            ) := {
                startBeaconing := {
berge's avatar
berge committed
                    beaconPacket := m_geoNwPdu(m_geoNwBeaconPacket(p_beaconHeader.srcPosVector), -, c_hopLimit1)
berge's avatar
berge committed
            /**
             * @desc Testsystem will stop beaconing for the given neighbor
             * @param p_compName The neighbor
berge's avatar
berge committed
            template AcGnPrimitive m_stopBeaconing := {
                stopBeaconing:= {
                }
            }
            
            /**
             * @desc Testsystem will pass received to the TTCN-3
             * @param p_beaconHeader The neighbor information
             */
berge's avatar
berge committed
            template AcGnPrimitive m_startPassBeaconing(
berge's avatar
berge committed
                template (value) BeaconHeader p_beaconHeader
            ) := {
                startPassBeaconing := {
                    beaconHeader := p_beaconHeader
                }
            }
            
            /**
             * @desc Testsystem will stop passing beacon information to the TTCN-3
             */
berge's avatar
berge committed
            template AcGnPrimitive m_stopPassBeaconing := {
                stopPassBeaconing := {
                }
            }
             * @desc Testsystem will start beaconing for multiple neighbors
             * @param p_beaconHeader The neighbor information
             * @param p_numberOfNeighbour The number of ITS stations for which TS will send beacons
berge's avatar
berge committed
            template (value) AcGnPrimitive m_startBeaconingMultipleNeighbour(
                template (value) BeaconHeader p_beaconHeader,
                integer p_numberOfNeighbour
            ) := {
                startBeaconingMultipleNeighbour := {
berge's avatar
berge committed
                    beaconPacket := m_geoNwPdu(m_geoNwBeaconPacket(p_beaconHeader.srcPosVector), -, c_hopLimit1),
                    numberOfNeighbour := p_numberOfNeighbour
                }
            }
            
            /**
             * @desc Testsystem will stop beaconing for multiple neighbors
             * @param p_compName The neighbor
             */
berge's avatar
berge committed
            template AcGnPrimitive m_stopBeaconingMultipleNeighbour := {
                stopBeaconingMultipleNeighbour:= {
                }
tepelmann's avatar
tepelmann committed
             * @desc Testsystem will reply the LongPosVector including the requested GN address
             *       found in received beacon information to the TTCN-3
             * @param p_gnAddress The GN address included in the LongPosVector
berge's avatar
berge committed
            template AcGnPrimitive m_getLongPosVector(GN_Address p_gnAddress) := {
                getLongPosVector := {
                    gnAddress := p_gnAddress
                }
            }
            
            /**
             * @desc    Receive template adapter control result for long position vector with specific GN_Address
             * @param   p_gnAddress GN_Address to be contained in the long position vector
             */
berge's avatar
berge committed
            template AcGnResponse mw_getLongPosVectorAny(template (present) GN_Address p_gnAddress) := {
                getLongPosVector := mw_longPosVectorAny(p_gnAddress)
            }
        } // end taPrimitives
    } // geoNwPrimitivesTemplates
    
    group geoNwPduTemplates {
        
tepelmann's avatar
tepelmann committed
         * @desc    Send template for GeoNetworking PDU
         * @param   p_packet    GnNonSecuredPacket of GeoNetworking message
         * @param   p_lifeTime  Lifetime of GeoNetworking message (Default: m_defaultLifetime)
         * @param   p_hopLimit  Router Hop limit of GeoNetworking message (Default: c_defaultHopLimit)
         */
        template (value) GeoNetworkingPdu m_geoNwPdu(
            in template (value) GnNonSecuredPacket p_packet,
            in template (value) Lifetime p_lifeTime := m_defaultLifetime,
            in template (value) UInt8 p_hopLimit := c_defaultHopLimit
        ) := {
            basicHeader := m_basicHeader(p_lifeTime, p_hopLimit),
            gnPacket := {
                packet := p_packet,
                securedMsg := omit
tepelmann's avatar
tepelmann committed
            }
        }
        
        /**
         * @desc    Receive template for GeoNetworking PDU
         * @param   p_packet    GnNonSecuredPacket of GeoNetworking message
         * @param   p_lifeTime  Lifetime of GeoNetworking message (Default: ?)
         * @param   p_hopLimit  Router Hop limit of GeoNetworking message (Default: ?)
         */
        template (present) GeoNetworkingPdu mw_geoNwPdu(
            in template (present) GnNonSecuredPacket p_packet,
            in template (present) Lifetime p_lifeTime := ?,
            in template (present) UInt8 p_hopLimit := ?
        ) := {
            basicHeader := mw_basicHeader(p_lifeTime, p_hopLimit),
            gnPacket := {

        /**
         * @desc    Receive template for secured GeoNetworking PDU
         * @param   p_secMsg    Secured message
         * @param   p_packet    Clear-text version of the packet
         */
        template (present) GeoNetworkingPdu mw_geoNwSecPdu(
            in template (present) SecuredMessage p_secMsg,
            in template (present) GnNonSecuredPacket p_packet := ?
        ) := {
            basicHeader := mw_securedBasicHeader(),
            gnPacket := {
                packet := p_packet,
                securedMsg := p_secMsg
            }
        }
        
        /**
         * @desc    Send template for secured GeoNetworking PDU
         * @param   p_packet    Clear-text version of the packet
         * @param   p_secMsg    Secured message
         */
        template (value) GeoNetworkingPdu m_geoNwSecPdu(
            in template (value) GnNonSecuredPacket p_packet,
            in template (value) SecuredMessage p_secMsg
            basicHeader := m_securedBasicHeader(),
            gnPacket := {
                packet := p_packet,
                securedMsg := p_secMsg
            }
        }
                
tepelmann's avatar
tepelmann committed
    } // end geoNwPduTemplates
    
    group geoNwPacketTemplates {
        
        /**
         * @desc    Send template for GeoNetworking Packet
         * @param   p_basicHeader   Common header of GeoNetworking packet
         * @param   p_extHeader     Extended header of GeoNetworking packet
berge's avatar
berge committed
         */
tepelmann's avatar
tepelmann committed
        template (value) GeoNetworkingPacket m_geoNwPacket(
            in template (value) CommonHeader p_commonHeader,
            in template (value) ExtendedHeader p_extHeader
berge's avatar
berge committed
        ) := {
tepelmann's avatar
tepelmann committed
            packet := {
                commonHeader := p_commonHeader,
                extendedHeader := p_extHeader,
                payload := f_adaptPayload_m(char2oct("DEFAULT_PAYLOAD"))
garciay's avatar
garciay committed
            securedMsg := omit
tepelmann's avatar
tepelmann committed
         * @desc    Send template for GeoNetworking Packet with no payload
         * @param   p_basicHeader   Common header of GeoNetworking packet
         * @param   p_extHeader     Extended header of GeoNetworking packet
tepelmann's avatar
tepelmann committed
         *
tepelmann's avatar
tepelmann committed
         * @see m_geoNwPacket
tepelmann's avatar
tepelmann committed
        template (value) GeoNetworkingPacket m_geoNwPacketNoPayload(
            in template (value) CommonHeader p_commonHeader,
            in template (value) ExtendedHeader p_extHeader
        ) modifies m_geoNwPacket := {
            packet := {
                payload := omit
            }
tepelmann's avatar
tepelmann committed
         * @desc    Send template for GeoNetworking Packet with octetstring payload
         * @param   p_basicHeader   Common header of GeoNetworking packet
         * @param   p_extHeader     Extended header of GeoNetworking packet
         * @param   p_payload       Octetstring payload
tepelmann's avatar
tepelmann committed
         *
tepelmann's avatar
tepelmann committed
         * @see m_geoNwPacket
tepelmann's avatar
tepelmann committed
        template (value) GeoNetworkingPacket m_geoNwPacketWithOctetstringPayload(
            in template (value) CommonHeader p_commonHeader,
            in template (value) ExtendedHeader p_extHeader,
            in template (value) octetstring p_payload
tepelmann's avatar
tepelmann committed
        ) modifies m_geoNwPacket := {
            packet := {
                payload := f_adaptPayload_m(p_payload)
            }
tepelmann's avatar
tepelmann committed
         * @desc    Send template for GeoNetworking Packet with payload
         * @param   p_basicHeader   Common header of GeoNetworking packet
         * @param   p_extHeader     Extended header of GeoNetworking packet
         * @param   p_payload       Payload
tepelmann's avatar
tepelmann committed
         *
tepelmann's avatar
tepelmann committed
         * @see m_geoNwPacket
berge's avatar
berge committed
         */
tepelmann's avatar
tepelmann committed
        template (value) GeoNetworkingPacket m_geoNwPacketWithPayload(
            in template (value) CommonHeader p_commonHeader,
            in template (value) ExtendedHeader p_extHeader,
            in template (value) Payload p_payload
tepelmann's avatar
tepelmann committed
        ) modifies m_geoNwPacket := {
            packet := {
                payload := p_payload
            }
tepelmann's avatar
tepelmann committed
         * @desc    Receive template for GeoNetworking Packet
         * @param   p_basicHeader   Common header of GeoNetworking packet
         * @param   p_extHeader     Extended header of GeoNetworking packet
berge's avatar
berge committed
         */
tepelmann's avatar
tepelmann committed
        template (present) GeoNetworkingPacket mw_geoNwPacket(
            in template (present) CommonHeader p_commonHeader,
            in template (present) ExtendedHeader p_extHeader
berge's avatar
berge committed
        ) := {
tepelmann's avatar
tepelmann committed
            packet := {
                commonHeader := p_commonHeader,
                extendedHeader := p_extHeader,
                payload := *
tepelmann's avatar
tepelmann committed
         * @desc    Receive template for GeoNetworking Packet with any payload
         * @param   p_basicHeader   Common header of GeoNetworking packet
         * @param   p_extHeader     Extended header of GeoNetworking packet
tepelmann's avatar
tepelmann committed
         *
tepelmann's avatar
tepelmann committed
         * @see     mw_geoNwPacket
berge's avatar
berge committed
         */
        template GeoNetworkingPacket mw_geoNwPduAnyPayload(
tepelmann's avatar
tepelmann committed
            in template (present) CommonHeader p_commonHeader,
            in template (present) ExtendedHeader p_extHeader
tepelmann's avatar
tepelmann committed
        ) modifies mw_geoNwPacket := {
            packet := {
                payload := ?
            }
        }
        
         * @desc    Receive template for GeoNetworking PDU with octetstring payload
tepelmann's avatar
tepelmann committed
         * @param   p_basicHeader   Common header of GeoNetworking packet
         * @param   p_extHeader     Extended header of GeoNetworking packet
         * @param   p_payload       Octetstring payload
tepelmann's avatar
tepelmann committed
         *
tepelmann's avatar
tepelmann committed
         * @see     mw_geoNwPacket
berge's avatar
berge committed
         */
        template GeoNetworkingPacket mw_geoNwPduWithOctetstringPayload(
tepelmann's avatar
tepelmann committed
            in template (present) CommonHeader p_commonHeader,
            in template (present) ExtendedHeader p_extHeader,
berge's avatar
berge committed
            in template (present) octetstring p_payload
tepelmann's avatar
tepelmann committed
        ) modifies mw_geoNwPacket := {
            packet := {
                payload := f_adaptPayload_mw(p_payload)
            }
        }
        
        /**
         * @desc    Receive template for GeoNetworking PDU with payload
tepelmann's avatar
tepelmann committed
         * @param   p_basicHeader   Common header of GeoNetworking packet
         * @param   p_extHeader     Extended header of GeoNetworking packet
         * @param   p_payload       Payload
tepelmann's avatar
tepelmann committed
         *
tepelmann's avatar
tepelmann committed
         * @see     mw_geoNwPacket
         */
        template GeoNetworkingPacket mw_geoNwPduWithPayload(
tepelmann's avatar
tepelmann committed
            in template (present) CommonHeader p_commonHeader,
            in template (present) ExtendedHeader p_extHeader,
            in template (present) Payload p_payload
tepelmann's avatar
tepelmann committed
        ) modifies mw_geoNwPacket := {
            packet := {
                payload := p_payload
            }
        }
        
        group geoNwPacketTemplates_ {
berge's avatar
berge committed
            
            /**
             * @desc    Receive template for any GeoNetworking Packet
             */
            template (present) GnNonSecuredPacket mw_geoNwAnyPacket := {
                commonHeader := mw_commonHeader(
                    ?,
                    ?
                ),
                extendedHeader := *,
                payload := *
            }
            
            /**
             * @desc    Receive template for any GeoNetworking Packet with Payload
             * @param   payload  Expected GN payload 
             */
            template (present) GnNonSecuredPacket mw_geoNwAnyPacket_withPayload(
                template (present) Payload p_payload
            ) := {
                commonHeader := mw_commonHeader(
                    ?,
                    ?
                ),
                extendedHeader := *,
                payload := p_payload
            }
                        
        } // end group geoNwPacketTemplates_
berge's avatar
berge committed
        
tepelmann's avatar
tepelmann committed
        group geoNwPacketUnicastTemplates {
            
            /**
             * @desc    Send template for GeoNetworking Unicast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec          Long position vector of source
             * @param   p_destinationShortPosVec    Short position vector of destination
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             * @param   p_hopLimit                  Maximum number of hops (Default: c_defaultHopLimit)
             * @param   p_trafficClass              Traffic Class 
tepelmann's avatar
tepelmann committed
             */
            template (value) GnNonSecuredPacket m_geoNwUnicastPacket(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) ShortPosVector p_destinationShortPosVec,
                in template (value) UInt8 p_hopLimit := c_defaultHopLimit,
                in template (value) TrafficClass p_trafficClass := m_trafficClass
tepelmann's avatar
tepelmann committed
            ) := {
                commonHeader := m_commonHeader(
                    PX_GN_UPPER_LAYER,
                    m_geoUnicastHeaderType,
                    p_trafficClass,
tepelmann's avatar
tepelmann committed
                ),
                extendedHeader := m_geoUnicastHeader(
                    p_sourceLongPosVec,
                    p_destinationShortPosVec,
                    p_seqNumber
                ),
                payload := f_adaptPayload_m(char2oct("DEFAULT_PAYLOAD"))
            }
            
            /**
             * @desc    Receive template for GeoNetworking Unicast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_destinationShortPosVec    Short position vector of destination
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             */
            template (present) GnNonSecuredPacket mw_geoNwUnicastPacket(
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                commonHeader := mw_commonHeader(
                    PX_GN_UPPER_LAYER,
                    mw_geoUnicastHeaderType
                ),
                extendedHeader := mw_geoUnicastHeader(
                    p_destinationShortPosVec,
                    p_seqNumber
                ),
                payload := ?
            }
            
            /**
             * @desc    Receive template for GeoNetworking Unicast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_destinationShortPosVec    Short position vector of destination
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             * @param   p_hopLimit                  Maximum number of hops (Default: ?)
             * @see mw_geoNwUnicastPacket
             */
            template (present) GnNonSecuredPacket mw_geoNwUnicastPacketWithHl(
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) UInt8 p_hopLimit := ?
            ) modifies mw_geoNwUnicastPacket := {
                commonHeader := mw_commonHeaderWithHopLimit(
                    PX_GN_UPPER_LAYER,
                    mw_geoUnicastHeaderType,
                    p_hopLimit
                ),
                extendedHeader := mw_geoUnicastHeader(
                    p_destinationShortPosVec,
                    p_seqNumber
                ),
                payload := ?
            }
            
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Receive template for GeoNetworking Unicast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_destinationShortPosVec    Short position vector of destination
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             * @param   p_srcLongPosVec             Long position vector of source
             */
            template (present) GnNonSecuredPacket mw_geoNwUnicastPacketWithSourcePv(
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) LongPosVector p_srcLongPosVec
            ) modifies mw_geoNwUnicastPacket := {
                extendedHeader := mw_geoUnicastHeaderWithSourcePv(
                    p_destinationShortPosVec,
                    p_seqNumber,
                    p_srcLongPosVec
                )
            }
            
            /**
             * @desc    Receive template for GeoNetworking Unicast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_destinationShortPosVec    Short position vector of destination
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
             * @param   p_nextHeader                Id of next header
             */
            template (present) GnNonSecuredPacket mw_geoNwUnicastPacketWithNextHeader(
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) NextHeader p_nextHeader
            ) modifies mw_geoNwUnicastPacket := {
                commonHeader := {
                    nextHeader := p_nextHeader
                }
            }
            
        } // end group geoNwPacketUnicastTemplates
        
        group geoNwPacketAnycastTemplates {
            
            /**
             * @desc    Send template for GeoNetworking Anycast Packet
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_seqNumber             Sequence number of GeoAnycast packet
             * @param   p_anycastArea           Destination GeoArea
             * @param   p_hopLimit              Maximum number of hops (Default: c_defaultHopLimit)
             * @param   p_trafficClass          Traffic Class 
tepelmann's avatar
tepelmann committed
             */
            template (value) GnNonSecuredPacket m_geoNwAnycastPacket(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoAnycastArea p_anycastArea,
                in template (value) UInt8 p_hopLimit := c_defaultHopLimit,
                in template (value) TrafficClass p_trafficClass := m_trafficClass
tepelmann's avatar
tepelmann committed
            ) := {
                commonHeader := m_commonHeader(
                    PX_GN_UPPER_LAYER,
                    m_geoAnycastHeaderType(p_anycastArea.geoAnycastSubType),
                    p_trafficClass,
tepelmann's avatar
tepelmann committed
                ),
                extendedHeader := m_geoAnycastHeader(
                    p_sourceLongPosVec,
                    p_seqNumber,
                    p_anycastArea
                ),
                payload := f_adaptPayload_m(char2oct("DEFAULT_PAYLOAD"))
            }
            
            /**
             * @desc    Receive template for GeoNetworking Anycast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber             Sequence number of GeoAnycast packet
             */
            template (present) GnNonSecuredPacket mw_geoNwAnycastPacket(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                commonHeader := mw_commonHeader(
                    PX_GN_UPPER_LAYER,
                    mw_geoAnycastHeaderType
                ),
                extendedHeader := mw_geoAnycastHeader(
                    p_sourceLongPosVec,
                    p_seqNumber
                ),
                payload := ?
            }
            
            /**
             * @desc    Receive template for GeoNetworking Anycast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber             Sequence number of GeoAnycast packet
             * @param   p_anycastArea           Destination GeoArea
             */
            template (present) GnNonSecuredPacket mw_geoNwAnycastPacketWithArea(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoAnycastArea p_anycastArea
            ) := {
                commonHeader := mw_commonHeader(
                    PX_GN_UPPER_LAYER,
                    mw_geoAnycastHeaderTypeWithSubType(p_anycastArea.geoAnycastSubType)
                ),
                extendedHeader := mw_geoAnycastHeaderWithArea(
                    p_sourceLongPosVec,
                    p_seqNumber,
                    p_anycastArea
                ),
                payload := ?
            }
            
            /**
             * @desc    Receive template for GeoNetworking Anycast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_seqNumber             Sequence number of GeoAnycast packet
             * @param   p_anycastArea           Destination GeoArea
             * @param   p_maxHopLimit           Maximum number of hops (Default := ?)
             */
            template (present) GnNonSecuredPacket mw_geoNwAnycastPacketWithAreaAndHl(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoAnycastArea p_anycastArea,
                in template (present) UInt8 p_maxHopLimit := ?
            ) modifies mw_geoNwAnycastPacketWithArea := {
                commonHeader := mw_commonHeaderWithHopLimit(
                    PX_GN_UPPER_LAYER,
                    mw_geoAnycastHeaderTypeWithSubType(p_anycastArea.geoAnycastSubType),
                    p_maxHopLimit
                )
            }
            
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Receive template for GeoNetworking Anycast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber             Sequence number of GeoAnycast packet
             * @param   p_anycastArea           Destination GeoArea
             * @param   p_nextHeader            Id of next header
             */
            template (present) GnNonSecuredPacket mw_geoNwAnycastPacketWithAreaWithNextHeader(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoAnycastArea p_anycastArea,
                in template (present) NextHeader p_nextHeader
            ) modifies mw_geoNwAnycastPacketWithArea := {
                commonHeader := {
                    nextHeader := p_nextHeader
                }
            }
            
        } // end group geoNwPacketAnycastTemplates
        
        group geoNwPacketBroadcastTemplates {
            
            /**
             * @desc    Send template for GeoNetworking Broadcast Packet
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_seqNumber             Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea         Destination GeoArea
             * @param   p_hopLimit              Maximum number of hops (Default: c_defaultHopLimit)
             * @param   p_trafficClass          Traffic Class 
tepelmann's avatar
tepelmann committed
             */
            template (value) GnNonSecuredPacket m_geoNwBroadcastPacket(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoBroadcastArea p_broadcastArea,
                in template (value) UInt8 p_hopLimit := c_defaultHopLimit,
                in template (value) TrafficClass p_trafficClass := m_trafficClass
tepelmann's avatar
tepelmann committed
            ) := {
                commonHeader := m_commonHeader(
                    PX_GN_UPPER_LAYER,
                    m_geoBroadcastHeaderType(p_broadcastArea.geoBroadcastSubType),
                    p_trafficClass,
tepelmann's avatar
tepelmann committed
                ),
                extendedHeader := m_geoBroadcastHeader(
                    p_sourceLongPosVec,
                    p_seqNumber,
                    p_broadcastArea
                ),
                payload := f_adaptPayload_m(char2oct("DEFAULT_PAYLOAD"))
            }
            
            /**
             * @desc    Receive template for GeoNetworking Broadcast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber             Sequence number of GeoBroadcast packet
             */
            template (present) GnNonSecuredPacket mw_geoNwBroadcastPacket(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                commonHeader := mw_commonHeader(
                    PX_GN_UPPER_LAYER,
                    mw_geoBroadcastHeaderType
                ),
                extendedHeader := mw_geoBroadcastHeader(
                    p_sourceLongPosVec,
                    p_seqNumber
                ),
                payload := ?
            }
            
            /**
             * @desc    Receive template for GeoNetworking Broadcast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber             Sequence number of GeoBroadcast packet
             * @param   p_nextHeader            Id of next header
             */
            template (present) GnNonSecuredPacket mw_geoNwBroadcastPacketWithNextHeader(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) NextHeader p_nextHeader
            ) modifies mw_geoNwBroadcastPacket := {
                commonHeader := mw_commonHeader(
                    p_nextHeader,
                    mw_geoBroadcastHeaderType
                )
            }
            
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Receive template for GeoNetworking Broadcast Packet
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_seqNumber             Sequence number of GeoBroadcast packet
             * @param   p_nextHeader            Id of next header
             * @param   p_payload               payload
             */
            template (present) GnNonSecuredPacket mw_geoNwBroadcastPacketWithNextHeaderAndPayload(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) NextHeader p_nextHeader,
                in template (present) Payload p_payload
            ) modifies mw_geoNwBroadcastPacketWithNextHeader := {
                payload := p_payload
            }
            
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Receive template for GeoNetworking Broadcast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber             Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea         Destination GeoArea
             */
            template (present) GnNonSecuredPacket mw_geoNwBroadcastPacketWithArea(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoBroadcastArea p_broadcastArea
            ) modifies mw_geoNwBroadcastPacket := {
                commonHeader := mw_commonHeader(
                    PX_GN_UPPER_LAYER,
                    mw_geoBroadcastHeaderTypeWithSubType(p_broadcastArea.geoBroadcastSubType)
                ),
                extendedHeader := mw_geoBroadcastHeaderWithArea(
                    p_sourceLongPosVec,
                    p_seqNumber,
                    p_broadcastArea
                )
            }
            
            /**
             * @desc    Receive template for GeoNetworking Broadcast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_seqNumber             Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea         Destination GeoArea
             * @param   p_maxHopLimit           Maximum number of hops (Default := ?)
             */
            template (present) GnNonSecuredPacket mw_geoNwBroadcastPacketWithAreaAndHl(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoBroadcastArea p_broadcastArea,
                in template (present) UInt8 p_maxHopLimit := ?
            ) modifies mw_geoNwBroadcastPacketWithArea := {
                commonHeader := mw_commonHeaderWithHopLimit(
                    PX_GN_UPPER_LAYER,
                    mw_geoBroadcastHeaderTypeWithSubType(p_broadcastArea.geoBroadcastSubType),
                    p_maxHopLimit
                )
            }
            
            /**
             * @desc    Receive template for GeoNetworking Broadcast Packet
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_seqNumber             Sequence number of GeoBroadcast packet (Default: ?)
             * @param   p_hopLimit              Maximum number of hops (Default: ?)
             * @param   p_flags                 Flags in the common header (Default: ?)
             */
            template (present) GnNonSecuredPacket mw_geoNwBroadcastPacketWithHlAndFlags(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber := ?,
                in template (present) UInt8 p_hopLimit := ?,
                in template (present) Bit8 p_flags := ?
            ) modifies mw_geoNwBroadcastPacket := {
                commonHeader := mw_commonHeaderWithHopLimitAndFlags(
                    PX_GN_UPPER_LAYER,
                    mw_geoBroadcastHeaderType,
                    p_hopLimit,
                    p_flags
                )
            }
            
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Receive template for GeoNetworking Broadcast Packet
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_seqNumber             Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea         Destination GeoArea
             */
            template (present) GnNonSecuredPacket mw_geoNwBroadcastPacketWithAreaWithNextHeader(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoBroadcastArea p_broadcastArea,
                in template (present) NextHeader p_nextHeader
            ) modifies mw_geoNwBroadcastPacketWithArea := {
                commonHeader := {
                    nextHeader := p_nextHeader
                }
            }
            
        } // end group geoNwPacketBroadcastTemplates
        
        group geoNwPacketLsTemplates {
            
            /**
             * @desc    Send template for GeoNetworking LS Request Packet
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_seqNumber         Sequence number of LS Request packet
             * @param   p_gnAddress         Searched GN_Address
             */
            template (value) GnNonSecuredPacket m_geoNwLsRequestPacket(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GN_Address p_gnAddress
            ) := {
                commonHeader := m_commonHeader(
wattelet's avatar
wattelet committed
                    e_any,
tepelmann's avatar
tepelmann committed
                    m_lsRequestHeaderType,
                    m_trafficClass,
                    c_defaultHopLimit
                ),
                extendedHeader := m_lsRequestHeader(
                    p_sourceLongPosVec, p_seqNumber, p_gnAddress
                ),
                payload := omit
            }
            
            /**
             * @desc    Receive template for GeoNetworking LS Request Packet
             * @param   p_seqNumber     Sequence number of LS Request packet
             * @param   p_mid           Searched GN_Address MID
             */
            template (present) GnNonSecuredPacket mw_geoNwLsRequestPacket(
                in template (present) UInt16 p_seqNumber,
                in template (present) GN_Address.mid p_mid
            ) := {
                commonHeader := mw_commonHeader(
tepelmann's avatar
tepelmann committed
                    m_lsRequestHeaderType
                ),
                extendedHeader := mw_lsRequestHeader(
                    p_seqNumber,
                    p_mid
                ),
                payload := {
                    decodedPayload := omit,
                    rawPayload := ''O
                }
tepelmann's avatar
tepelmann committed
            }
            
            /**
             * @desc    Send template for GeoNetworking LS Reply Packet
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_destinationLongPosVec Long position vector of destination
             * @param   p_seqNumber             Sequence number of LS Reply packet
             */
            template (value) GnNonSecuredPacket m_geoNwLsReplyPacket(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) ShortPosVector p_destinationLongPosVec,
                in template (value) UInt16 p_seqNumber
            ) := {
                commonHeader := m_commonHeader(
tepelmann's avatar
tepelmann committed
                    m_lsReplyHeaderType,
                    m_trafficClass,
                    c_defaultHopLimit
                ),
                extendedHeader := m_lsReplyHeader(
                    p_sourceLongPosVec, p_destinationLongPosVec, p_seqNumber
                ),
                payload := omit
            }
            
            /**
             * @desc    Receive template for GeoNetworking LS Reply Packet
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_destinationLongPosVec Short position vector of destination
             */
            template (present) GnNonSecuredPacket mw_geoNwLsReplyPacket(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) ShortPosVector p_destinationLongPosVec
            ) := {
                commonHeader := mw_commonHeader(
tepelmann's avatar
tepelmann committed
                    m_lsReplyHeaderType
                ),
                extendedHeader := mw_lsReplyHeader(
                    p_sourceLongPosVec, p_destinationLongPosVec
                ),
                payload := {
                    decodedPayload := omit,
                    rawPayload := ''O
                }
tepelmann's avatar
tepelmann committed
            }
            
        } // end group geoNwPacketLsTemplates
        
        group geoNwPacketBeaconTemplates {
            
            /**
             * @desc    Send template for GeoNetworking Beacon Packet
             * @param   p_sourceLongPosVec  Long position vector of source
             */
            template (value) GnNonSecuredPacket m_geoNwBeaconPacket(
                in template (value) LongPosVector p_sourceLongPosVec
            ) := {
                commonHeader := m_commonHeader(
wattelet's avatar
wattelet committed
                    e_any,
tepelmann's avatar
tepelmann committed
                    m_beaconHeaderType,
                    m_trafficClass,
berge's avatar
berge committed
                    c_hopLimit1
tepelmann's avatar
tepelmann committed
                ),
                extendedHeader := m_beaconHeader(
                    p_sourceLongPosVec
                ),
                payload := omit
            }
            
            /**
             * @desc    Receive template for GeoNetworking Beacon Packet
tepelmann's avatar
tepelmann committed
             *
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec  Long position vector of source (Default: ?)
             * @param   p_nextHeader        Next header (Default: e_any)
tepelmann's avatar
tepelmann committed
             */
            template (present) GnNonSecuredPacket mw_geoNwBeaconPacket(
                in template (present) LongPosVector p_sourceLongPosVec := ?,
                in template (present) NextHeader p_nextHeader := e_any
tepelmann's avatar
tepelmann committed
            ) := {
                commonHeader := mw_commonHeader_noPayload(
                    p_nextHeader,
tepelmann's avatar
tepelmann committed
                    m_beaconHeaderType
                ),
                extendedHeader := mw_beaconHeader(p_sourceLongPosVec),
berge's avatar
berge committed
                payload := (
                    {
                        decodedPayload := omit,
                        rawPayload := ''O
                    },
                    { // Ethernet testing requires minimum packet size of 60 bytes
                        decodedPayload := *,
                        rawPayload := '00000000000000000000'O
                    }
                )
tepelmann's avatar
tepelmann committed
            }
            
        } // end group geoNwPacketBeaconTemplates
        
        group geoNwPacketShbTemplates {
            
            /**
             * @desc    Send template for GeoNetworking SHB Packet
             * @param   p_sourceLongPosVec  Long position vector of source
             */
            template (value) GnNonSecuredPacket m_geoNwShbPacket(
                in template (value) LongPosVector p_sourceLongPosVec
            ) := {
                commonHeader := m_commonHeader(
                    PX_GN_UPPER_LAYER,
                    m_shbHeaderType,
                    m_trafficClass,
                    c_defaultHopLimit
                ),
                extendedHeader := m_shbHeader(
                    p_sourceLongPosVec
                ),
                payload :=  f_adaptPayload_m(char2oct("DEFAULT_PAYLOAD"))
            }
            
            /**
             * @desc    Receive template for GeoNetworking SHB Packet
             * @param   p_sourceLongPosVec  Long position vector of source (Default: ?)
             * @param   p_hopLimit          Maximum number of hops (Default: ?)
tepelmann's avatar
tepelmann committed
             */
            template (present) GnNonSecuredPacket mw_geoNwShbPacket(
                in template (present) LongPosVector p_sourceLongPosVec := ?,
                in template (present) UInt8 p_hopLimit := ?
tepelmann's avatar
tepelmann committed
            ) := {
                commonHeader := mw_commonHeaderWithHopLimit(
tepelmann's avatar
tepelmann committed
                    PX_GN_UPPER_LAYER,
tepelmann's avatar
tepelmann committed
                ),
                extendedHeader := mw_shbHeader(p_sourceLongPosVec),
                payload := ?
            }
            
        } // end group geoNwPacketShbTemplates
        
        group geoNwPacketTsbTemplates {
            
            /**
             * @desc    Send template for GeoNetworking TSB Packet
             * @param   p_seqNumber         Sequence number of TSB packet
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_hopLimit          The maximum number of hops (Default: c_defaultHopLimit)
tepelmann's avatar
tepelmann committed
             */
            template (value) GnNonSecuredPacket m_geoNwTsbPacket(
                in template (value) UInt16 p_seqNumber,
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) UInt8 p_hopLimit := c_defaultHopLimit,
                in template (value) TrafficClass p_trafficClass := m_trafficClass
tepelmann's avatar
tepelmann committed
            ) := {
                commonHeader := m_commonHeader(
                    PX_GN_UPPER_LAYER,
                    m_tsbHeaderType,
                    p_trafficClass,
tepelmann's avatar
tepelmann committed
                ),
                extendedHeader := m_tsbHeader(
                    p_seqNumber,
                    p_sourceLongPosVec
                ),
                payload :=  f_adaptPayload_m(char2oct("DEFAULT_PAYLOAD"))
            }
            
            /**
             * @desc    Receive template for GeoNetworking TSB Packet
             * @param   p_seqNumber         Sequence number of TSB packet (Default: ?)
             * @param   p_sourceLongPosVec  Long position vector of source (Default: ?)
             */
            template (present) GnNonSecuredPacket mw_geoNwTsbPacket(
                in template (present) UInt16 p_seqNumber := ?,
                in template (present) LongPosVector p_sourceLongPosVec := ?
            ) := {
                commonHeader := mw_commonHeader(
                    PX_GN_UPPER_LAYER,
                    m_tsbHeaderType
                ),
                extendedHeader := mw_tsbHeader(p_seqNumber, p_sourceLongPosVec),
                payload := ?
            }
            
            /**
             * @desc    Receive template for GeoNetworking TSB Packet
             * @param   p_seqNumber         Sequence number of TSB packet (Default: ?)
             * @param   p_sourceLongPosVec  Long position vector of source (Default: ?)
             * @param   p_hopLimit          The maximum number of hops (Default: ?)
             */
            template (present) GnNonSecuredPacket mw_geoNwTsbPacketWithHl(
                in template (present) UInt16 p_seqNumber := ?,
                in template (present) LongPosVector p_sourceLongPosVec := ?,
                in template (present) UInt8 p_hopLimit := ?
            ) modifies mw_geoNwTsbPacket := {
                commonHeader := mw_commonHeaderWithHopLimit(
                    PX_GN_UPPER_LAYER,
                    m_tsbHeaderType,
                    p_hopLimit
                )
            }
            
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Receive template for GeoNetworking TSB Packet
             * @param   p_seqNumber         Sequence number of TSB packet (Default: ?)
             * @param   p_sourceLongPosVec  Long position vector of source (Default: ?)
             * @param   p_nextHeader        Id of next header
             */
            template (present) GnNonSecuredPacket mw_geoNwTsbPacketWithNextHeader(
                in template (present) UInt16 p_seqNumber := ?,
                in template (present) LongPosVector p_sourceLongPosVec := ?,
                in template (value) NextHeader p_nextHeader
            ) modifies mw_geoNwTsbPacket := {
                commonHeader := {
                    nextHeader := p_nextHeader
                }
            }
            
        } // end group geoNwPacketTsbTemplates
        
    } // end group geoNwPacketTemplates
    
    group geoNwHeadersTemplates {
        
tepelmann's avatar
tepelmann committed
        group geoNwBasicHeaderTemplates {
            
            /**
tepelmann's avatar
tepelmann committed
             * @desc    Send template for Basic header
             *
tepelmann's avatar
tepelmann committed
             * @param p_lifeTime    Lifetime of GeoNetworking message
             * @param p_hopLimit    Router Hop limit of GeoNetworking message
             */
            template (value) BasicHeader m_basicHeader(
                in template (value) Lifetime p_lifeTime := m_defaultLifetime,
                in template (value) UInt8 p_hopLimit := c_defaultHopLimit
            ) := {
tepelmann's avatar
tepelmann committed
                version := c_geoNwProtocolVersion,
                nextHeader := e_commonHeader,
tepelmann's avatar
tepelmann committed
                reserved := 0,
                lifeTime := p_lifeTime,
                routerHopLimit := p_hopLimit
            }
            
            /**
tepelmann's avatar
tepelmann committed
             * @desc    Receive template for Basic header
             *
tepelmann's avatar
tepelmann committed
             * @param p_lifeTime    Lifetime of GeoNetworking message
             * @param p_hopLimit    Router Hop limit of GeoNetworking message
             */
            template (present) BasicHeader mw_basicHeader(
                in template (present) Lifetime p_lifeTime := ?,
                in template (present) UInt8 p_hopLimit := ?
            ) := {
tepelmann's avatar
tepelmann committed
                version := c_geoNwProtocolVersion,
tepelmann's avatar
tepelmann committed
                nextHeader := ?,
                reserved := ?,
                lifeTime := p_lifeTime,
                routerHopLimit := p_hopLimit
            }
            
            /**
             * @desc    Send template for Secured Basic header
             *
             * @param p_lifeTime    Lifetime of GeoNetworking message
             * @param p_hopLimit    Router Hop limit of GeoNetworking message
             */
            template (value) BasicHeader m_securedBasicHeader(
                in template (value) Lifetime p_lifeTime := m_defaultLifetime,
                in template (value) UInt8 p_hopLimit := c_defaultHopLimit
            ) := {
                version := c_geoNwProtocolVersion,
                nextHeader := e_securedPacket,
                reserved := 0,
                lifeTime := p_lifeTime,
                routerHopLimit := p_hopLimit
            } // End of template m_securedBasicHeader
            
            /**
             * @desc    Receive template for Secured Basic header
             *
             * @param p_lifeTime    Lifetime of GeoNetworking message
             * @param p_hopLimit    Router Hop limit of GeoNetworking message
             */
            template (present) BasicHeader mw_securedBasicHeader(
                in template (present) Lifetime p_lifeTime := ?,
                in template (present) UInt8 p_hopLimit := ?
            ) := {
                version := c_geoNwProtocolVersion,
                nextHeader := e_securedPacket,
                reserved := ?,
                lifeTime := p_lifeTime,
                routerHopLimit := p_hopLimit
            } // End of template mw_securedBasicHeader
            
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Default send template for Lifetime field
             */
            template (value) Lifetime m_defaultLifetime := {
                multiplier := c_defaultLifetime,
                ltBase := e_100s
            }
            
            /**
             * @desc    Send template for Lifetime field (Base = 1s)
             */
            template (value) Lifetime m_lifetimeBase1s(
                in template (value) UInt6 p_multiplier
            ) := {
                multiplier := p_multiplier,
                ltBase := e_1s
            }
            
            /**
             * @desc    Receive template for lifetime 0
             */
            template (present) Lifetime mw_lifetime0 := {
                multiplier := 0,
                ltBase := ?
            }
            
        } //end group geoNwBasicHeaderTemplates
tepelmann's avatar
tepelmann committed
        group geoNwCommonHeaderTemplates {
            
tepelmann's avatar
tepelmann committed
             * @desc    Send template for Common header
             * @param   p_nextHeader    Id of next header
             * @param   p_trafficClass  Packet's traffic class
tepelmann's avatar
tepelmann committed
             * @param   p_headerTypeSubType     Header's type and sub-type
             * @param   p_hopLimit      Maximum number of hops
tepelmann's avatar
tepelmann committed
             * @remark  plLength field is set to 0 and has to be computed by codec
berge's avatar
berge committed
             */
            template (value) CommonHeader m_commonHeader (
berge's avatar
berge committed
                in template (value) NextHeader p_nextHeader,
                in template (value) HeaderTST p_headerTypeSubType,
berge's avatar
berge committed
                in template (value) TrafficClass p_trafficClass,
tepelmann's avatar
tepelmann committed
                in template (value) UInt8 p_hopLimit
            ) := {
                nextHeader := p_nextHeader,
                reserved := c_uInt8Zero,
tepelmann's avatar
tepelmann committed
                headerTST := p_headerTypeSubType,
                trafficClass := p_trafficClass,
                flags := c_8ZeroBits,
                plLength := 0, // will be computed by Codec
tepelmann's avatar
tepelmann committed
                maxHopLimit := p_hopLimit,
                reserved2 := 0
            /**
             * @desc    Receive template for Common header
             * @param   p_nextHeader        Id of next header
             * @param   p_headerTypeSubType         Header's type and sub-type
berge's avatar
berge committed
             */
            template CommonHeader mw_commonHeader (
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTypeSubType
            ) := {
                nextHeader := p_nextHeader,
                reserved := ?,
tepelmann's avatar
tepelmann committed
                headerTST := p_headerTypeSubType,
                trafficClass := ?,
berge's avatar
berge committed
                flags := ?,
tepelmann's avatar
tepelmann committed
                plLength := ?,
tepelmann's avatar
tepelmann committed
                maxHopLimit := ?,
                reserved2 := ?
            /**
             * @desc    Receive template for Common header with no payload
             * @param   p_nextHeader        Id of next header
             * @param   p_headerTypeSubType         Header's type and sub-type
             */
            template CommonHeader mw_commonHeader_noPayload (
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTypeSubType
            ) modifies mw_commonHeader := {
                plLength := 0
            }
            
            /**
             * @desc    Receive template for Common header with specific Hop limit
berge's avatar
berge committed
             * @param   p_nextHeader        Id of next header
tepelmann's avatar
tepelmann committed
             * @param   p_headerTypeSubType Header's type and sub-type
berge's avatar
berge committed
             * @param   p_hopLimit          Maximum number of hops
             * @see     mw_commonHeader
berge's avatar
berge committed
             */
            template CommonHeader mw_commonHeaderWithHopLimit (
berge's avatar
berge committed
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTypeSubType,
berge's avatar
berge committed
                in template (present) UInt8 p_hopLimit
            ) modifies mw_commonHeader := {
tepelmann's avatar
tepelmann committed
                maxHopLimit := p_hopLimit
            /**
             * @desc    Receive template for Common header with specific Hop limit
tepelmann's avatar
tepelmann committed
             * @param   p_senderLongPosVec  Long position vector of sender
             * @param   p_nextHeader        Id of next header
             * @param   p_headerTypeSubType Header's type and sub-type
             * @param   p_hopLimit          Maximum number of hops
             * @param   p_flags             Flags in the common header
             * @see     mw_commonHeaderWithHopLimit
             */
            template CommonHeader mw_commonHeaderWithHopLimitAndFlags (
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTypeSubType,
                in template (present) UInt8 p_hopLimit,
                in template (present) Bit8 p_flags
            ) modifies mw_commonHeaderWithHopLimit := {
                flags := p_flags
            }
            
             * @desc    Receive template for Common header with specific Traffic Class
tepelmann's avatar
tepelmann committed
             * @param   p_senderLongPosVec  Long position vector of sender
berge's avatar
berge committed
             * @param   p_nextHeader        Id of next header
             * @param   p_headerTypeSubType         Header's type and sub-type
             * @param   p_trafficClass      Packet's traffic class
berge's avatar
berge committed
             */
            template CommonHeader mw_commonHeaderWithTrafficClass (
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTypeSubType,
                in template (present) TrafficClass p_trafficClass
            ) modifies mw_commonHeader := {
                trafficClass := p_trafficClass
            }
            /**
             * @desc    Default send template for traffic class
berge's avatar
berge committed
             */
wattelet's avatar
wattelet committed
            template (value) TrafficClass m_trafficClass ( in SCF p_scf := e_scfEnable, in ChannelOffload p_ChOff := e_choffDisabled ) := {
                scf             := p_scf,
                channelOffload  := p_ChOff,
            /**
             * @desc    Receive template for traffic class
berge's avatar
berge committed
             */
wattelet's avatar
wattelet committed
            template TrafficClass mw_trafficClass ( in template SCF p_scf := ?, in template ChannelOffload p_ChOff := ? ) := {
                scf             := p_scf,
                channelOffload  := p_ChOff,
                tcId            := ?
            }
            /**
             * @desc    Receive template for any GN_Address
berge's avatar
berge committed
             */
fischer's avatar
fischer committed
            template GN_Address mw_gnAddressAny := {
                typeOfAddress := ?,
                stationType := ?,
                stationCountryCode := ?,
                mid := ?
            }
            /**
             * @desc    Receive template for GN_Address
             * @param   p_stationType           Station's type
             * @param   p_stationCountryCode    Station's country code
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template GN_Address mw_gnAddress(
                in template (present) StationType p_stationType,
                in template (present) UInt10 p_stationCountryCode
            ) := {
                typeOfAddress := ?,
                stationType := p_stationType,
                stationCountryCode := p_stationCountryCode,
                mid := ?
            }
fischer's avatar
fischer 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
berge's avatar
berge committed
             */
fischer's avatar
fischer committed
            template LongPosVector mw_longPosVectorAny(
berge's avatar
berge committed
                in template (present) GN_Address p_gnAddress
            ) := {
                gnAddr := p_gnAddress,
                timestamp := ?,
                latitude := ?,
                longitude := ?,
tepelmann's avatar
tepelmann committed
                pai := ?,
                speed := ?,
tepelmann's avatar
tepelmann committed
                heading := ?
fischer's avatar
fischer committed
            }
tepelmann's avatar
tepelmann committed
             * @desc    Receive template for long position vector with strict position check
             * @param   p_longPosVector The base long position vector
             */
            template LongPosVector mw_longPosVectorPosition(
                in template (value) LongPosVector p_longPosVector
                timestamp := ?,
                latitude := p_longPosVector.latitude,
                longitude := p_longPosVector.longitude,
tepelmann's avatar
tepelmann committed
                pai := ?,
                speed := p_longPosVector.speed,
tepelmann's avatar
tepelmann committed
                heading := p_longPosVector.heading
            /**
             * @desc    Receive template for long position vector with position check with delta
             * @param   p_longPosVector The base long position vector
             */
            template LongPosVector mw_longPosVectorPosition_withDelta(
                in template (value) LongPosVector p_longPosVector
            ) modifies mw_longPosVectorPosition := {
garciay's avatar
garciay committed
                    latitude := f_getDelta32(valueof(p_longPosVector.latitude), PX_POS_DELTA),
                    longitude := f_getDelta32(valueof(p_longPosVector.longitude), PX_POS_DELTA),
             * @desc    Receive template for short position vector with strict position check
             * @param   p_shortPosVector The base short position vector
             */
            template ShortPosVector mw_shortPosVectorPosition(
                in template (value) ShortPosVector p_shortPosVector
            ) := {
                    gnAddr := p_shortPosVector.gnAddr,
                    timestamp := ?,
                    latitude := p_shortPosVector.latitude,
                    longitude := p_shortPosVector.longitude
            }
            
            /**
             * @desc    Receive template for short position vector with position check with delta
             * @param   p_shortPosVector The base short position vector
             */
            template ShortPosVector mw_shortPosVectorPosition_withDelta(
                in template (value) ShortPosVector p_shortPosVector
            ) modifies mw_shortPosVectorPosition := {
garciay's avatar
garciay committed
                    latitude := f_getDelta32(valueof(p_shortPosVector.latitude), PX_POS_DELTA),
                    longitude := f_getDelta32(valueof(p_shortPosVector.longitude), PX_POS_DELTA)
tepelmann's avatar
tepelmann committed
             * @desc    Receive template for short position vector without position check
             * @param   p_shortPosVector The base short position vector
             */
            template ShortPosVector mw_shortPosVectorPosition_anyPos(
                in template (value) ShortPosVector p_shortPosVector
            ) modifies mw_shortPosVectorPosition := {
                    latitude := ?,
                    longitude := ?
            }
tepelmann's avatar
tepelmann committed
            function f_getDelta32(Int32 p_value, integer p_delta) return template (present) Int32 {
                if (p_value == c_int32Min) {
                    return (p_value .. p_value+p_delta);
                }
                if (p_value == c_int32Max) {
                    return (p_value-p_delta .. p_value);
                }
                return (p_value-p_delta .. p_value+p_delta);
            }
            
            function f_getDelta15(Int32 p_value, integer p_delta) return template (present) Int15 {
                if (p_value == c_int15Min) {
                    return (p_value .. p_value+p_delta);
                }
                if (p_value == c_int15Max) {
                    return (p_value-p_delta .. p_value);
                }
                return (p_value-p_delta .. p_value+p_delta);
            }
            
        } // end geoNwCommonHeaderTemplates
berge's avatar
berge committed
        group geoUnicastHeaderTemplates {
            
            /**
             * @desc    Send template for GeoUnicast header
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_destinationLongPosVec Long position vector of destination
             * @param   p_seqNumber             Sequence number of GeoUnicast packet
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) ExtendedHeader m_geoUnicastHeader(
berge's avatar
berge committed
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) ShortPosVector p_destinationLongPosVec,
                in template (value) UInt16 p_seqNumber
            ) := {
                geoUnicastHeader := {
                    seqNumber := p_seqNumber,
                    reserved := c_uInt8Zero,
garciay's avatar
garciay committed
                    srcPosVector := p_sourceLongPosVec,
berge's avatar
berge committed
                    dstPosVector := p_destinationLongPosVec
tepelmann's avatar
tepelmann 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
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_geoUnicastHeader(
berge's avatar
berge committed
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                geoUnicastHeader := {
                    seqNumber := p_seqNumber,
berge's avatar
berge committed
                    reserved := ?,
                    srcPosVector := ?,
berge's avatar
berge committed
                    dstPosVector := p_destinationShortPosVec
berge's avatar
berge committed
            }
tepelmann's avatar
tepelmann committed
             * @desc    Receive template for GeoUnicast header with source long position vector
berge's avatar
berge committed
             * @param   p_destinationShortPosVec    Long position vector of destination
             * @param   p_seqNumber                 Sequence number of GeoUnicast packet
tepelmann's avatar
tepelmann committed
             * @param   p_srcLongPosVec             Long position vector of source
             * @see     mw_geoUnicastHeader
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_geoUnicastHeaderWithSourcePv(
berge's avatar
berge committed
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) UInt16 p_seqNumber,
tepelmann's avatar
tepelmann committed
                in template (present) LongPosVector p_srcLongPosVec
berge's avatar
berge committed
            ) modifies mw_geoUnicastHeader := {
                geoUnicastHeader := {
tepelmann's avatar
tepelmann committed
                    srcPosVector := p_srcLongPosVec
berge's avatar
berge committed
                }
tepelmann's avatar
tepelmann committed
            }
            /**
             * @desc    Send template for GeoUnicast header type
berge's avatar
berge committed
             */
            template (value) HeaderTST m_geoUnicastHeaderType := {
                geoUnicastHdr := {
berge's avatar
berge committed
                    headerType := e_geoUnicast,
fischer's avatar
fischer committed
                    headerSubType := c_uInt4Zero
tepelmann's avatar
tepelmann committed
            }
            /**
             * @desc    Receive template for GeoUnicast header type
berge's avatar
berge committed
             */
            template HeaderTST mw_geoUnicastHeaderType := {
                geoUnicastHdr := {
berge's avatar
berge committed
                    headerType := e_geoUnicast,
fischer's avatar
fischer committed
                    headerSubType := c_uInt4Zero
tepelmann's avatar
tepelmann committed
            }
berge's avatar
berge committed
            
        } // end geoUnicastHeaderTemplates
        group geoBroadcastHeaderTemplates {
            
            /**
             * @desc    Send template for GeoBroadcast header
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
             * @param   p_broadcastArea     Destination GeoArea
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) ExtendedHeader m_geoBroadcastHeader(
berge's avatar
berge committed
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoBroadcastArea p_broadcastArea
            ) := {
                geoBroadcastHeader := {
                    seqNumber := p_seqNumber,
                    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
                }
tepelmann's avatar
tepelmann committed
            }
            /**
             * @desc    Receive template for GeoBroadcast header for any GeoArea
             * @param   p_sourceLongPosVec  Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_senderLongPosVec  Long position vector of sender
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_geoBroadcastHeader(
berge's avatar
berge committed
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                geoBroadcastHeader := {
                    seqNumber := p_seqNumber,
                    reserved := ?,
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := ?,
                    geoAreaPosLongitude := ?,
                    distanceA := ?,
                    distanceB := ?,
                    angle := ?,
                    reserved2 := ?
berge's avatar
berge committed
             * @desc    Receive template for GeoBroadcast header
             * @param   p_sourceLongPosVec  Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_senderLongPosVec  Long position vector of sender
             * @param   p_seqNumber         Sequence number of GeoBroadcast packet
berge's avatar
berge committed
             * @param   p_broadcastArea     Destination GeoArea
             * @see     mw_geoBroadcastHeader
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_geoBroadcastHeaderWithArea (
berge's avatar
berge committed
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoBroadcastArea p_broadcastArea
berge's avatar
berge committed
            ) modifies mw_geoBroadcastHeader := {
                geoBroadcastHeader := {
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
                }
berge's avatar
berge committed
            }
            /**
             * @desc    Send template for GeoBroadcast header type
             * @param   p_headerSubType Packet's subtype
berge's avatar
berge committed
             */
            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
tepelmann's avatar
tepelmann committed
            }
tepelmann's avatar
tepelmann committed
             * @desc    Receive template for GeoBroadcast header type
berge's avatar
berge committed
             */
            template HeaderTST mw_geoBroadcastHeaderType := {
                geoBroadcastHdr := {
berge's avatar
berge committed
                    headerType := e_geoBroadcast,
                    headerSubType := ?
tepelmann's avatar
tepelmann committed
            }
            /**
             * @desc    Receive template for GeoBroadcast header type with sub-type
berge's avatar
berge committed
             * @param   p_headerSubType Packet's subtype
             * @see     mw_geoBroadcastHeaderType
berge's avatar
berge committed
             */
            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
        } // end geoBroadcastHeaderTemplates
berge's avatar
berge committed
        group geoAnycastHeaderTemplates {
            
           /**
             * @desc    Send template for GeoAnycast header
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             * @param   p_anycastArea       Destination GeoArea
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) ExtendedHeader m_geoAnycastHeader(
berge's avatar
berge committed
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoAnycastArea p_anycastArea
berge's avatar
berge committed
            ) := {
                geoAnycastHeader := {
                    seqNumber := p_seqNumber,
                    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
                }
            }
            
            /**
             * @desc    Receive template for GeoAnycast header for any GeoArea
             * @param   p_sourceLongPosVec  Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_senderLongPosVec  Long position vector of sender
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_geoAnycastHeader(
berge's avatar
berge committed
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                geoAnycastHeader := {
                    seqNumber := p_seqNumber,
                    reserved := ?,
berge's avatar
berge committed
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := ?,
                    geoAreaPosLongitude := ?,
                    distanceA := ?,
                    distanceB := ?,
                    angle := ?,
                    reserved2 := ?
berge's avatar
berge committed
                }
berge's avatar
berge committed
             * @desc    Receive template for GeoAnycast header
             * @param   p_sourceLongPosVec  Long position vector of source
tepelmann's avatar
tepelmann committed
             * @param   p_senderLongPosVec  Long position vector of sender
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
berge's avatar
berge committed
             * @param   p_anycastArea       Destination GeoArea
tepelmann's avatar
tepelmann committed
             * @see     mw_geoAnycastHeader
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_geoAnycastHeaderWithArea (
berge's avatar
berge committed
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoAnycastArea p_anycastArea
berge's avatar
berge committed
            ) modifies mw_geoAnycastHeader := {
                geoAnycastHeader := {
                    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    Send template for GeoBroadcast header type with sub-type
             * @param   p_headerSubType Packet's subtype
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) HeaderTST m_geoAnycastHeaderType(
                in template (value) HeaderSubTypeGeoAnycast p_headerSubType
            ) := {
                geoAnycastHdr := {
                    headerType := e_geoAnycast,
                    headerSubType := p_headerSubType
                }
tepelmann's avatar
tepelmann committed
            }
             * @desc    Receive template for GeoAnycast header type with any sub-type
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template HeaderTST mw_geoAnycastHeaderType := {
                geoAnycastHdr := {
                    headerType := e_geoAnycast,
                    headerSubType := ?
                }
tepelmann's avatar
tepelmann committed
            }
             * @desc    Receive template for GeoAnycast header type with sub-type
berge's avatar
berge committed
             * @param   p_headerSubType Packet's subtype
tepelmann's avatar
tepelmann committed
             * @see     mw_geoAnycastHeaderType
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template HeaderTST mw_geoAnycastHeaderTypeWithSubType(
                in template (present) HeaderSubTypeGeoAnycast p_headerSubType
            ) modifies mw_geoAnycastHeaderType := {
                geoAnycastHdr := {
                    headerSubType := p_headerSubType
                }
berge's avatar
berge committed
        } // end geoAnycastHeaderTemplates
berge's avatar
berge committed
        group lsRequestHeaderTemplates {
            
            /**
             * @desc    Send template for LS Request header
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_seqNumber         Sequence number of LS Request packet
             * @param   p_gnAddress         Searched GN_Address
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) ExtendedHeader m_lsRequestHeader(
berge's avatar
berge committed
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) UInt16 p_seqNumber,
tepelmann's avatar
tepelmann committed
                in template (value) GN_Address p_gnAddress
berge's avatar
berge committed
            ) := {
                lsRequestHeader := {
tepelmann's avatar
tepelmann committed
                    seqNumber       := p_seqNumber,
                    reserved        := c_uInt8Zero,
                    srcPosVector    := p_sourceLongPosVec,
                    gnAddress       := p_gnAddress
            /**
             * @desc    Receive template for LS Request header
             * @param   p_seqNumber     Sequence number of LS Request packet
berge's avatar
berge committed
             * @param   p_mid           Searched GN_Address MID
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_lsRequestHeader(
berge's avatar
berge committed
                in template (present) UInt16 p_seqNumber,
berge's avatar
berge committed
                in template (present) GN_Address.mid p_mid
berge's avatar
berge committed
            ) := {
                lsRequestHeader := {
                    seqNumber := p_seqNumber,
berge's avatar
berge committed
                    reserved := ?,
                    srcPosVector := ?,
            /**
             * @desc    Send template for LS Request header type
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) HeaderTST m_lsRequestHeaderType := {
                lsHdr := {
berge's avatar
berge committed
                    headerType := e_locationService,
                    headerSubType := e_lsRequest
berge's avatar
berge committed
                }
tepelmann's avatar
tepelmann committed
            }
            /**
             * @desc    Receive template for LS Request header type
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template HeaderTST mw_lsRequestHeaderType := {
                lsHdr := {
berge's avatar
berge committed
                    headerType := e_locationService,
                    headerSubType := e_lsRequest
berge's avatar
berge committed
                }
tepelmann's avatar
tepelmann committed
            }
tepelmann's avatar
tepelmann committed
        } // end lsRequestHeaderTemplates
            /**
             * @desc    Send template for LS Reply header
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_destinationLongPosVec Long position vector of destination
             * @param   p_seqNumber             Sequence number of LS Reply packet
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) ExtendedHeader m_lsReplyHeader(
              in template (value) LongPosVector p_sourceLongPosVec,
              in template (value) ShortPosVector p_destinationLongPosVec,
              in template (value) UInt16 p_seqNumber
            ) := {
                lsReplyHeader := {
                  seqNumber := p_seqNumber,
                  reserved := c_uInt8Zero,
                  srcPosVector := p_sourceLongPosVec,
                  dstPosVector := p_destinationLongPosVec
                }
            }
            
tepelmann's avatar
tepelmann committed
             * @desc    Receive template for any LS Reply header
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_lsReplyHeaderAny := {
                reserved := ?,
                srcPosVector := ?,
                dstPosVector := ?
tepelmann's avatar
tepelmann committed
             * @desc    Receive template for LS Reply header
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_destinationLongPosVec Short position vector of destination
tepelmann's avatar
tepelmann committed
             * @see     mw_lsReplyHeaderAny
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_lsReplyHeader(
tepelmann's avatar
tepelmann committed
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) ShortPosVector p_destinationLongPosVec)
            modifies mw_lsReplyHeaderAny := {
                lsReplyHeader := {
                    srcPosVector := p_sourceLongPosVec,
                    dstPosVector := p_destinationLongPosVec
                }
berge's avatar
berge committed
            }
            /**
             * @desc    Send template for LS Reply header type
berge's avatar
berge committed
             */
            template (value) HeaderTST m_lsReplyHeaderType := {
                lsHdr := {
                  headerType := e_locationService,
                  headerSubType := e_lsReply
                }
tepelmann's avatar
tepelmann committed
            }
tepelmann's avatar
tepelmann committed
        } // end lsRequestHeaderTemplates
berge's avatar
berge committed
        group beaconHeaderTemplates {
            
            /**
             * @desc    Send template for Beacon header
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec  Long position vector of source
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) ExtendedHeader m_beaconHeader(
                in template (value) LongPosVector p_sourceLongPosVec
berge's avatar
berge committed
            ) := {
                beaconHeader := {
tepelmann's avatar
tepelmann committed
                    srcPosVector := p_sourceLongPosVec
            /**
             * @desc    Receive template for Beacon header
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec  Long position vector of source
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader mw_beaconHeader(
                in template (present) LongPosVector p_sourceLongPosVec
berge's avatar
berge committed
            ) := {
                beaconHeader := {
tepelmann's avatar
tepelmann committed
                    srcPosVector := p_sourceLongPosVec
            /**
             * @desc    Send template for Beacon header type
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) HeaderTST m_beaconHeaderType := {
                beaconHdr := {
berge's avatar
berge committed
                    headerType := e_beacon,
fischer's avatar
fischer committed
                    headerSubType := c_uInt4Zero
berge's avatar
berge committed
                }
tepelmann's avatar
tepelmann committed
            }
            /**
             * @desc    Receive template for Beacon header type
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template HeaderTST mw_beaconHeaderType := {
                beaconHdr := {
berge's avatar
berge committed
                    headerType := e_beacon,
fischer's avatar
fischer committed
                    headerSubType := ?
berge's avatar
berge committed
                }
tepelmann's avatar
tepelmann committed
            }
tepelmann's avatar
tepelmann committed
        } // end beaconHeaderTemplates
        
berge's avatar
berge committed
             * @desc    Send template for SHB header
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec  Long position vector of sender
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) ExtendedHeader m_shbHeader(
                in template (value) LongPosVector p_sourceLongPosVec
tepelmann's avatar
tepelmann committed
                    srcPosVector := p_sourceLongPosVec,
                    reserved := 0
            /**
             * @desc    Receive template for SHB header
tepelmann's avatar
tepelmann committed
             * @param   p_sourceLongPosVec  Long position vector of sender
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (present) ExtendedHeader mw_shbHeader(
                in template (present) LongPosVector p_sourceLongPosVec
            ) := {
tepelmann's avatar
tepelmann committed
                    srcPosVector:= p_sourceLongPosVec,
                    reserved := ?
            /**
             * @desc    Send template for SHB header type
berge's avatar
berge committed
             */
            template (value) HeaderTST m_shbHeaderType := {
                tsbHdr := {
                  headerType := e_topologicallyScopedBroadcast,
                  headerSubType := e_singleHop
                }
tepelmann's avatar
tepelmann committed
            }
tepelmann's avatar
tepelmann committed
        group tsbHeaderTemplates {
            
            /**
             * @desc    Send template for TSB header
             * @param   p_seqNumber         Sequence number of TSB packet
             * @param   p_srcPosVector      Long position vector of source
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template ExtendedHeader m_tsbHeader(
tepelmann's avatar
tepelmann committed
                in template (value) UInt16 p_seqNumber,
                in template (value) LongPosVector p_srcPosVector
            ) := {
                tsbHeader := {
                    seqNumber := p_seqNumber,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_srcPosVector
                }
            }
            
            /**
             * @desc    Receive template for TSB header
             * @param   p_seqNumber         Sequence number of TSB packet
             * @param   p_sourceLongPosVec  Long position vector of source
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (present) ExtendedHeader mw_tsbHeader(
tepelmann's avatar
tepelmann committed
                in template (present) UInt16 p_seqNumber,
fischer's avatar
fischer committed
                in template (present) LongPosVector p_sourceLongPosVec
tepelmann's avatar
tepelmann committed
            ) := {
                tsbHeader := {
                    seqNumber := p_seqNumber,
                    reserved := ?,
fischer's avatar
fischer committed
                    srcPosVector := p_sourceLongPosVec
                }
            }
            
tepelmann's avatar
tepelmann committed
             * @desc    Send template for TSB header type
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (value) HeaderTST m_tsbHeaderType := {
                tsbHdr := {
                  headerType := e_topologicallyScopedBroadcast,
                  headerSubType := e_multiHop
tepelmann's avatar
tepelmann committed
             * @desc    Receive template for TSB header type
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template (present) HeaderTST mw_tsbHeaderType := {
tepelmann's avatar
tepelmann committed
                tsbHdr := {
                  headerType := e_topologicallyScopedBroadcast,
                  headerSubType := e_multiHop
                }
tepelmann's avatar
tepelmann committed
            }
tepelmann's avatar
tepelmann committed
            
        } // end tsbHeaderTemplates
        
    } // end geoNwHeadersTemplates
berge's avatar
berge committed
    
berge's avatar
berge committed
    group geoMiscTemplates {
tepelmann's avatar
tepelmann committed
         * @desc    Receive template for GN_Address. Only M_ID field is discriminent
         * @param   p_mid Expected GN Address MID
        template GN_Address mw_gnAddressMid(in template (present) GN_Address.mid p_mid) := {
            typeOfAddress := ?,
            stationType := ?,
            stationCountryCode := ?,
            mid := p_mid
        }
berge's avatar
berge committed
        group geoDummyTemplates {
            
tepelmann's avatar
tepelmann committed
             * @desc    Dummy template for GN_Address
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) GN_Address m_dummyGnAddr := {
                typeOfAddress := e_manual,
tepelmann's avatar
tepelmann committed
                stationType := e_passengerCar,
                stationCountryCode := c_uInt10Zero,
            /**
             * @desc    Dummy template for long position vector
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) LongPosVector m_dummyLongPosVector := {
berge's avatar
berge committed
                gnAddr := m_dummyGnAddr,
                timestamp := c_uInt32Zero,
                latitude := c_uInt32Zero,
berge's avatar
berge committed
                longitude := c_uInt32Zero,
wattelet's avatar
wattelet committed
                pai := int2bit(1,1),
berge's avatar
berge committed
                speed := c_uInt16Zero,
tepelmann's avatar
tepelmann committed
                heading := c_uInt16Zero
            /**
             * @desc    Dummy template for Area
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) Area m_dummyArea := {
                geoAreaPosLatitude := c_uInt32Zero,
                geoAreaPosLongitude := c_uInt32Zero,
                distanceA := c_uInt16Zero,
                distanceB := c_uInt16Zero,
tepelmann's avatar
tepelmann committed
                angle := c_uInt16Zero
berge's avatar
berge committed
            }
            /**
             * @desc    Dummy template for GeoBroadcastArea
berge's avatar
berge committed
             */
            template (value) GeoBroadcastArea m_dummyGeoBroadcastArea := {
berge's avatar
berge committed
                geoBroadcastSubType := e_geoBroadcastRect,
                geoBroadcastArea := m_dummyArea
            }
            
berge's avatar
berge committed
        } // end geoDummyTemplates
        
    } // end geoMiscTemplates
    
berge's avatar
berge committed
    group geoTemplateFunctions {
        function f_adaptPayloadForUtInd_m(in template (value) Payload p_gnPayload) return octetstring {
            
            if(PX_BTP_IN_UT_IND == false) {
            	if(PX_GN_UPPER_LAYER == e_btpA or PX_GN_UPPER_LAYER == e_btpB) {
            		if( ispresent(p_gnPayload.decodedPayload) ){
				        return bit2oct(encvalue(p_gnPayload.decodedPayload.btpPacket.payload));
            		}
            		
            		return p_gnPayload.rawPayload;
            	}
            }
            
			return bit2oct(encvalue(p_gnPayload));
        }

garciay's avatar
garciay committed
        function f_adaptPayload_m(in template (value) octetstring p_finalPayload) return template (value) Payload {
tepelmann's avatar
tepelmann committed
            var template (value) Payload v_payload;
            
            if(PX_GN_UPPER_LAYER == e_any) {
                v_payload := { decodedPayload := omit, rawPayload := p_finalPayload};
                return v_payload;
tepelmann's avatar
tepelmann committed
            }
            
            if(PX_GN_UPPER_LAYER == e_ipv6) {
                v_payload := { decodedPayload := { ipv6Packet := m_ipv6Packet(c_unspecified, c_allNodesMca, c_noNextHdr, m_octetstringPayload(p_finalPayload))}, rawPayload := ''O};
                return v_payload;
berge's avatar
berge committed
            }
            
            if(PX_GN_UPPER_LAYER == e_btpA) {
                v_payload := { decodedPayload := { btpPacket := m_btpA({ decodedPayload := omit, rawPayload := p_finalPayload })}, rawPayload := ''O};
                return v_payload;
berge's avatar
berge committed
            }
            
            if(PX_GN_UPPER_LAYER == e_btpB) {
                v_payload := { decodedPayload := { btpPacket := m_btpB({ decodedPayload := omit, rawPayload := p_finalPayload })}, rawPayload := ''O};
                return v_payload;
berge's avatar
berge committed
            }
            
            return v_payload;
berge's avatar
berge committed
        function f_adaptPayload_mw(in template (present) octetstring p_finalPayload) return template (present) Payload {
            var template (present) Payload v_payload;
            
            if(PX_GN_UPPER_LAYER == e_any) {
               v_payload := { decodedPayload := *, rawPayload := p_finalPayload};
tepelmann's avatar
tepelmann committed
               return v_payload;
berge's avatar
berge committed
            }
            
            if(PX_GN_UPPER_LAYER == e_ipv6) {
wattelet's avatar
wattelet committed
               v_payload := { decodedPayload := { ipv6Packet := mw_ipv6Packet(?, ?, ?, mw_octetstringPayload(p_finalPayload))}, rawPayload := ?};
tepelmann's avatar
tepelmann committed
               return v_payload;
berge's avatar
berge committed
            }
            
            if(PX_GN_UPPER_LAYER == e_btpA) {
wattelet's avatar
wattelet committed
               v_payload := { decodedPayload := { btpPacket := mw_btpA(?, ?, { decodedPayload := *, rawPayload := p_finalPayload } )}, rawPayload := ?};
tepelmann's avatar
tepelmann committed
               return v_payload;
berge's avatar
berge committed
            }
            
            if(PX_GN_UPPER_LAYER == e_btpB) {
wattelet's avatar
wattelet committed
               v_payload := { decodedPayload := { btpPacket := mw_btpB(?, ?, { decodedPayload := *, rawPayload := p_finalPayload })}, rawPayload := ?};
tepelmann's avatar
tepelmann committed
               return v_payload;
berge's avatar
berge committed
            }
            
            return v_payload;
berge's avatar
berge committed
    } // end geoTemplateFunctions
    
berge's avatar
berge committed
} // end ItsGeoNetworking_Templates