Skip to content
LibItsGeoNetworking_Templates.ttcn 76.8 KiB
Newer Older
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
            /**
             * @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 := ?
            /**
             * @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
            /**
             * @desc    Default send template for Lifetime field
berge's avatar
berge committed
             */
            template (value) Lifetime m_defaultLifetime := {
berge's avatar
berge committed
                multiplier := c_defaultLifetime,
                ltBase := e_100s
            /**
             * @desc    Receive template for lifetime 0
berge's avatar
berge committed
             */
            template (present) Lifetime mw_lifetime0 := {
                multiplier := 0,
                ltBase := ?
            }
                
        } // 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_senderLongPosVec  Long position vector of sender
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             * @param   p_anycastArea       Destination GeoArea
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) Header m_geoAnycastHeader(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoAnycastArea p_anycastArea
berge's avatar
berge committed
            ) := {
                geoAnycastHeader := {
                    commonHeader := m_commonHeader(
                        PX_GN_UPPER_LAYER,
berge's avatar
berge committed
                        m_geoAnycastHeaderType(p_anycastArea.geoAnycastSubType),
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec
berge's avatar
berge committed
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_defaultLifetime,
berge's avatar
berge committed
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := p_anycastArea.geoAnycastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_anycastArea.geoAnycastArea.geoAreaPosLongitude,
                    distanceA := p_anycastArea.geoAnycastArea.distanceA,
                    distanceB := p_anycastArea.geoAnycastArea.distanceB,
                    angle := p_anycastArea.geoAnycastArea.angle,
                    reserved2 := c_uInt24Zero
                }
            }  
            
berge's avatar
berge committed
             * @desc    Send template for GeoAnycast header with hop limit
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             * @param   p_anycastArea       Destination GeoArea
berge's avatar
berge committed
             * @param   p_hopLimit          Maximum number of hops 
             * @see     m_geoAnycastHeader
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) Header m_geoAnycastHeaderWithHopLimit(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoAnycastArea p_anycastArea,
berge's avatar
berge committed
                in template (value) UInt8 p_hopLimit
            ) modifies m_geoAnycastHeader := {
                geoAnycastHeader := {
                    commonHeader := m_commonHeader(
                        PX_GN_UPPER_LAYER,
berge's avatar
berge committed
                        m_geoAnycastHeaderType(p_anycastArea.geoAnycastSubType),
                        m_trafficClass,
                        p_hopLimit,
                        p_senderLongPosVec
            /**
             * @desc    Receive template for GeoAnycast header for any GeoArea
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template Header mw_geoAnycastHeader(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) UInt16 p_seqNumber
            ) := {
                geoAnycastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoAnycastHeaderType                    
berge's avatar
berge committed
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := ?,
                    geoAreaPosLongitude := ?,
                    distanceA := ?,
                    distanceB := ?,
                    angle := ?,
                    reserved2 := c_uInt24Zero
                }
            } 
                       
berge's avatar
berge committed
             * @desc    Receive template for GeoAnycast header
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
berge's avatar
berge committed
             * @param   p_anycastArea       Destination GeoArea
             * @see     mw_geoAnycastHeader 
             */
berge's avatar
berge committed
            template Header mw_geoAnycastHeaderWithArea (
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoAnycastArea p_anycastArea
berge's avatar
berge committed
            ) modifies mw_geoAnycastHeader := {
                geoAnycastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoAnycastHeaderTypeWithSubType(p_anycastArea.geoAnycastSubType) 
berge's avatar
berge committed
                    ),
                    geoAreaPosLatitude := p_anycastArea.geoAnycastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_anycastArea.geoAnycastArea.geoAreaPosLongitude,
                    distanceA := p_anycastArea.geoAnycastArea.distanceA,
                    distanceB := p_anycastArea.geoAnycastArea.distanceB,
                    angle := p_anycastArea.geoAnycastArea.angle
                }
            } 

berge's avatar
berge committed
             * @desc    Receive template for GeoAnycast header with Hop limit
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_senderLongPosVec  Long position vector of sender
berge's avatar
berge committed
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             * @param   p_anycastArea       Destination GeoArea
berge's avatar
berge committed
             * @param   p_hopLimit          Maximum number of hops 
             * @see     mw_geoAnycastHeaderWithArea
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template Header mw_geoAnycastHeaderWithAreaWithHopLimit(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) UInt16 p_seqNumber,   
                in template (present) GeoAnycastArea p_anycastArea,             
berge's avatar
berge committed
                in template (present) UInt8 p_hopLimit
            ) modifies mw_geoAnycastHeaderWithArea := {
                geoAnycastHeader := {
                    commonHeader := mw_commonHeaderWithHopLimit(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoAnycastHeaderType,
                        p_hopLimit
                    )
                } 
            }
berge's avatar
berge committed
            
berge's avatar
berge committed
             * @desc    Receive template for GeoAnycast header with common header and lifetime
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_seqNumber         Sequence number of GeoAnycast packet
             * @param   p_anycastArea       Destination GeoArea
             * @param   p_commonHeader      Common header
             * @param   p_lifetime          Lifetime of the GeoAnycast packet
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template Header mw_geoAnycastHeaderWithAreaWithChWithLt(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoAnycastArea p_anycastArea,
                in template (present) CommonHeader p_commonHeader,
                in template (present) Lifetime p_lifetime
            ) := {
                geoAnycastHeader := {
                    commonHeader := p_commonHeader,
                    seqNumber := p_seqNumber,
                    lifetime := p_lifetime,
                    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    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
                }
            }      
            
             * @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 := ?
                }
            }       
            
             * @desc    Receive template for GeoAnycast header type with sub-type
berge's avatar
berge committed
             * @param   p_headerSubType Packet's subtype
             * @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
                }
            }       
               
        } // 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_senderLongPosVec  Long position vector of sender
             * @param   p_seqNumber         Sequence number of LS Request packet
             * @param   p_gnAddress         Searched GN_Address
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template (value) Header m_lsRequestHeader(
berge's avatar
berge committed
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) GN_Address p_gnAddress      
berge's avatar
berge committed
            ) := {
                lsRequestHeader := {
berge's avatar
berge committed
                    commonHeader := m_commonHeader(
                        e_any,
berge's avatar
berge committed
                        m_lsRequestHeaderType,
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec
berge's avatar
berge committed
                    ),    
                    seqNumber := p_seqNumber,
berge's avatar
berge committed
                    lifetime := m_defaultLifetime,
                    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
             */
berge's avatar
berge committed
            template Header 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 := {
berge's avatar
berge committed
                    commonHeader := mw_commonHeader(
berge's avatar
berge committed
                        e_any,
                        mw_lsRequestHeaderType
berge's avatar
berge committed
                    ),    
                    seqNumber := p_seqNumber,
berge's avatar
berge committed
                    lifetime := ?,
                    reserved := ?,
                    srcPosVector := ?,
berge's avatar
berge committed
             * @desc    Receive template for LS Request header with hop limit
             * @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
             * @param   p_hopLimit      Maximum number of hops 
             * @see     mw_lsRequestHeader
berge's avatar
berge committed
             */
            template Header mw_lsRequestHeader_withHopLimit(
tepelmann's avatar
tepelmann committed
                in template (present) UInt16 p_seqNumber,
                in template (present) GN_Address.mid p_mid,
tepelmann's avatar
tepelmann committed
                in template (present) UInt8 p_hopLimit
            ) modifies mw_lsRequestHeader := {
                lsRequestHeader := {
tepelmann's avatar
tepelmann committed
                  commonHeader := {
                      hopLimit := p_hopLimit
                  }
            /**
             * @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
            /**
             * @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
        } // end lsRequestHeaderTemplates 
                    
        group lsReplyHeaderTemplates {
            
            /**
             * @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_senderLongPosVec      Long position vector of sender
             * @param   p_seqNumber             Sequence number of LS Reply packet
berge's avatar
berge committed
             */
            template (value) Header m_lsReplyHeader(
              in template (value) LongPosVector p_sourceLongPosVec,
              in template (value) ShortPosVector p_destinationLongPosVec,
              in template (value) LongPosVector p_senderLongPosVec,
              in template (value) UInt16 p_seqNumber
            ) := {
                lsReplyHeader := {
                  commonHeader := m_commonHeader(
                      e_any,
                      m_lsReplyHeaderType,
                      p_senderLongPosVec
                  lifetime := m_defaultLifetime,
                  reserved := c_uInt8Zero,
                  srcPosVector := p_sourceLongPosVec,
                  dstPosVector := p_destinationLongPosVec
                }
            }
            
            /**
             * @desc    Receive template for any LS Reply header 
             * @param   p_seqNumber     Sequence number of LS Reply packet
berge's avatar
berge committed
             */
            template Header mw_lsReplyHeaderAny(
            ) := {
                lsReplyHeader := {
                commonHeader := mw_commonHeader(
                    ?,
                    e_any,
                    m_lsReplyHeaderType
                lifetime := ?,
                reserved := ?,
                srcPosVector := ?,
                dstPosVector := ?
            /**
             * @desc    Receive template for LS Reply header 
             * @param   p_seqNumber             Sequence number of LS Reply packet
             * @param   p_sourceLongPosVec      Long position vector of source
             * @param   p_destinationLongPosVec Short position vector of destination
             * @see     mw_lsReplyHeaderAny  
berge's avatar
berge committed
             */
            template Header mw_lsReplyHeader(
                in template (present) LongPosVector p_sourceLongPosVec, 
                in template (present) ShortPosVector p_destinationLongPosVec)
            modifies mw_lsReplyHeaderAny := {
                lsReplyHeader := {
                    srcPosVector := p_sourceLongPosVec,
                    dstPosVector := p_destinationLongPosVec
                }
            /**
             * @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
                }
            }      
            
berge's avatar
berge committed
        } // end lsRequestHeaderTemplates 
                    
berge's avatar
berge committed
        group beaconHeaderTemplates {
            
            /**
             * @desc    Send template for Beacon header
             * @param   p_senderLongPosVec  Long position vector of sender 
berge's avatar
berge committed
             */
            template (value) Header m_beaconHeader(
                in template (value) LongPosVector p_senderLongPosVec
berge's avatar
berge committed
            ) := {
                beaconHeader := {
berge's avatar
berge committed
                    commonHeader := m_commonHeader(
berge's avatar
berge committed
                        m_beaconHeaderType,
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec
            /**
             * @desc    Receive template for Beacon header
             * @param   p_trafficClass      Packet's traffic class
             * @param   p_hopLimit          Maximum number of hops
             * @param   p_senderLongPosVec  Long position vector of sender 
berge's avatar
berge committed
             */
berge's avatar
berge committed
            template Header mw_beaconHeader(
fischer's avatar
fischer committed
            in template (present) TrafficClass p_trafficClass,
            in template (present) UInt8 p_hopLimit,
            in template (present) LongPosVector p_senderLongPosVec
berge's avatar
berge committed
            ) := {
                beaconHeader := {
berge's avatar
berge committed
                       commonHeader := mw_commonHeaderBeacon(
                        p_trafficClass,
                        p_hopLimit,
                        p_senderLongPosVec
            /**
             * @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
            /**
             * @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
            
        } // end beaconHeaderTemplates                    
berge's avatar
berge committed
             * @desc    Send template for SHB header
             * @param   p_senderLongPosVec  Long position vector of sender
berge's avatar
berge committed
             */
                in template (value) LongPosVector p_senderLongPosVec
            ) := {
                shbHeader := {
                    commonHeader := m_commonHeader(
                        PX_GN_UPPER_LAYER,
                        m_shbHeaderType,
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec
            /**
             * @desc    Receive template for SHB header
berge's avatar
berge committed
             */
            template Header mw_shbHeader := {
fischer's avatar
fischer committed
                    commonHeader := mw_commonHeaderWithHopLimit(
                        ?, // SE PV
                        ?, // NH
                        m_shbHeaderType, // HT + HST
                        1 // HL
            /**
             * @desc    Send template for SHB header type
berge's avatar
berge committed
             */
            template (value) HeaderTST m_shbHeaderType := {
                tsbHdr := {
                  headerType := e_topologicallyScopedBroadcast,
                  headerSubType := e_singleHop
                }
            }      
            
        } // end shbHeaderTemplates
        
tepelmann's avatar
tepelmann committed
        group tsbHeaderTemplates {
            
            /**
             * @desc    Send template for TSB header
             * @param   p_senderLongPosVec  Long position vector of sender 
             * @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 Header m_tsbHeader(
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) LongPosVector p_srcPosVector
            ) := {
                tsbHeader := {
                    commonHeader := m_commonHeader(
                        PX_GN_UPPER_LAYER, 
                        m_tsbHeaderType, 
tepelmann's avatar
tepelmann committed
                        m_trafficClass,
                        c_defaultHopLimit, 
                        p_senderLongPosVec
tepelmann's avatar
tepelmann committed
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_defaultLifetime,
tepelmann's avatar
tepelmann committed
                    reserved := c_uInt8Zero,
                    srcPosVector := p_srcPosVector
                }
            }
            
berge's avatar
berge committed
             * @desc    Send template for TSB header with hop limit
             * @param   p_senderLongPosVec  Long position vector of sender
berge's avatar
berge committed
             * @param   p_seqNumber         Sequence number of TSB packet
             * @param   p_srcPosVector      Long position vector of source
             * @param   p_hopLimit          Maximum number of hops
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template Header m_tsbHeaderWithHopLimit(
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) UInt16 p_seqNumber,
                in template (value) LongPosVector p_srcPosVector,
                in template (value) UInt8 p_hopLimit
            ) modifies m_tsbHeader := {
                tsbHeader := {
                    commonHeader := {
                        hopLimit := p_hopLimit
                    }
                }
            }
            
            /**
             * @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 Header mw_tsbHeader(
                in template (present) UInt16 p_seqNumber, 
fischer's avatar
fischer committed
                in template (present) LongPosVector p_sourceLongPosVec
tepelmann's avatar
tepelmann committed
            ) := {
                tsbHeader := {
                    commonHeader := mw_commonHeader(
berge's avatar
berge committed
                        ?,
                        m_tsbHeaderType
tepelmann's avatar
tepelmann committed
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
                    reserved := ?,
fischer's avatar
fischer committed
                    srcPosVector := p_sourceLongPosVec
                }
            }
            
            /**
             * @desc    Receive template for TSB header with sender position vector
             * @param   p_senderLongPosVec  Long position vector of sender
berge's avatar
berge committed
             * @param   p_seqNumber         Sequence number of TSB packet
             * @param   p_sourceLongPosVec  Long position vector of source
berge's avatar
berge committed
             */
fischer's avatar
fischer committed
            template Header mw_tsbHeaderWithSenderPv(
                in template (present) UInt16 p_seqNumber, 
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec
            ) modifies mw_tsbHeader := {
fischer's avatar
fischer committed
                tsbHeader := {
                    commonHeader := mw_commonHeader(
berge's avatar
berge committed
                        p_senderLongPosVec,
                        m_tsbHeaderType
berge's avatar
berge committed
             * @desc    Receive template for TSB header with hop limit
             * @param   p_seqNumber         Sequence number of TSB packet
             * @param   p_sourceLongPosVec  Long position vector of source
             * @param   p_hopLimit          Maximum number of hops
berge's avatar
berge committed
             */
tepelmann's avatar
tepelmann committed
            template Header mw_tsbHeaderWithHopLimit(
                in template (present) UInt16 p_seqNumber, 
berge's avatar
berge committed
                in template (present) LongPosVector p_sourceLongPosVec,
tepelmann's avatar
tepelmann committed
                in template (present) UInt8 p_hopLimit 
            ) modifies mw_tsbHeader := {
                tsbHeader := {
                    commonHeader := {
                      hopLimit := p_hopLimit
                    }
                }
            }
            
            /**
             * @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
                }
            }      
            
        } // end tsbHeaderTemplates
        
    } // end geoNwHeadersTemplates
berge's avatar
berge committed
    
berge's avatar
berge committed
    group geoPayloadTemplates {
        
        /**
         * @desc    Receive template for misc. payload
         * @param   p_payload   Payload
berge's avatar
berge committed
         */
        template Payload mw_otherPayload(
            in template (present) octetstring p_payload
        ) := {
berge's avatar
berge committed
            otherPayload := p_payload
        }
        
    } // end geoPayloadTemplates
    
berge's avatar
berge committed
    group geoMiscTemplates {

        /**
         * @desc    Receive template for GN_Address. Only M_ID field is discriminent 
berge's avatar
berge committed
         * @param   p_mid Expected GN Address MID
        template GN_Address mw_gnAddressMid(in template (present) GN_Address.mid p_mid) := {
            typeOfAddress := ?,
            stationType := ?,
            stationSubType := ?,
            stationCountryCode := ?,
berge's avatar
berge committed
        group geoDummyTemplates {
            
            /**
             * @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,
                stationType := {
                    vehicleStation := {
                        stationType := e_vehicleStation,
                        vsKind := e_car   
                    }
                },
                stationSubType := e_private,
                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,
                speed := c_uInt16Zero,
                heading := c_uInt16Zero,
                altitude := c_uInt16Zero,
                timeAccuracy := c_uInt4Zero,
                posAccuracy := c_uInt4Zero,
                speedAccuracy := c_uInt3Zero,
                headingAccuracy := c_uInt3Zero,
                altitudeAccuracy := c_uInt2Zero
            }
            
            /**
             * @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,
                angle := c_uInt16Zero    
            /**
             * @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_adaptPayload_m(in octetstring p_finalPayload) return template (value) Payload {
        	var template (value) Payload v_payload;
        	
        	if(PX_GN_UPPER_LAYER == e_any) {
        	   v_payload := { otherPayload := p_finalPayload};
        	   return v_payload;	
        	}
        	
        	if(PX_GN_UPPER_LAYER == e_ipv6) {
               v_payload := { ipv6Packet := m_ipv6Packet(c_unspecified, c_allNodesMca, c_noNextHdr, m_octetstringPayload(p_finalPayload))};
               return v_payload;    
            }
            
            if(PX_GN_UPPER_LAYER == e_btpA) {
               v_payload := { btpPacket := m_btpA(3751 /*FIXME*/, 3751/*FIXME*/, p_finalPayload)};
               return v_payload;    
            }
            
            if(PX_GN_UPPER_LAYER == e_btpB) {
               v_payload := { btpPacket := m_btpB(3751 /*FIXME*/, 0, p_finalPayload)};
               return v_payload;    
            }
            
            return v_payload;
        }	

        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 := { otherPayload := p_finalPayload};
               return v_payload;    
            }
            
            if(PX_GN_UPPER_LAYER == e_ipv6) {
               v_payload := { ipv6Packet := mw_ipv6Packet(?, ?, ?, mw_octetstringPayload(p_finalPayload))};
               return v_payload;    
            }
            
            if(PX_GN_UPPER_LAYER == e_btpA) {
               v_payload := { btpPacket := mw_btpA(?, ?, p_finalPayload)};
               return v_payload;    
            }
            
            if(PX_GN_UPPER_LAYER == e_btpB) {
               v_payload := { btpPacket := mw_btpB(?, ?, p_finalPayload)};
               return v_payload;    
            }
            
            return v_payload;
        }   
                
    } // end geoTemplateFunctions
    
berge's avatar
berge committed
} // end ItsGeoNetworking_Templates