Skip to content
LibItsGeoNetworking_Templates.ttcn 45.5 KiB
Newer Older
berge's avatar
berge committed
/**
 *	@author 	ETSI / STF405
 *  @version 	$URL$
 *				$Id$
 *	@desc		GeoNetworking Templates
 *
 */
module LibItsGeoNetworking_Templates {
berge's avatar
berge committed
    
    // Libcommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
berge's avatar
berge committed
    
    // LibIts
    import from LibIts_Interface all;
    import from LibItsGeoNetworking_TypesAndValues all;
berge's avatar
berge committed
    
    group geoNwPrimitivesTemplates {
    
    	template (value) GeoNetworkingReq m_geoNwReq(
            template (value) GeoNetworkingPacket p_geoNwMsg
            ) := {
            msgOut := p_geoNwMsg
        }
        
        template GeoNetworkingInd mw_geoNwInd(
            template (present) GeoNetworkingPacket p_geoNwMsg
            ) := {
            msgIn := p_geoNwMsg
        }
    
        group taPrimitives {
            
            /**
             * @desc Testsystem will start beaconing for the given neighbor
             * @param p_beaconHeader The neighbor information
             */
            template (value) AcGNEvent m_startBeaconing(BeaconHeader p_beaconHeader) := {
                startBeaconing := {
                    beaconHeader := p_beaconHeader
                }
            }
            
            /**
             * @desc Testsystem will stop beaconing for the given neighbor
             * @param p_compName The neighbor
             */
            template AcGNEvent m_stopBeaconing := {
                stopBeaconing:= {
                }
            }
            
            /**
             * @desc Testsystem will pass received to the TTCN-3
             * @param p_beaconHeader The neighbor information
             */
            template AcGNEvent m_startPassBeaconing(BeaconHeader p_beaconHeader) := {
                startPassBeaconing := {
                    beaconHeader := p_beaconHeader
                }
            }
            
            /**
             * @desc Testsystem will stop passing beacon information to the TTCN-3
             */
                stopPassBeaconing := {
                }
            }
        
        } // end taPrimitives
            
    } // geoNwPrimitivesTemplates
    
    group geoNwPduTemplates {
        
        template (value) GeoNetworkingPacket m_geoNwPdu(in template (value) Header p_header) := {
        	header := p_header,
        	secHeader := omit,
        	payload := omit           
        }
        
        template (value) GeoNetworkingPacket m_geoNwPduWithPayload(in template (value) Header p_header, in template (value) Payload p_payload) := {
            header := p_header,
            secHeader := omit,
            payload := p_payload
        }
        
        template GeoNetworkingPacket mw_geoNwPdu(in template (present) Header p_header) := {
        	header := p_header,
        	secHeader := *,
            payload := *          
        template GeoNetworkingPacket mw_geoNwPduAnyPayload(in template (present) Header p_header) := {
fischer's avatar
fischer committed
        	header := p_header,
        	secHeader := *,
            payload := ?          
        }     
                
        template GeoNetworkingPacket mw_geoNwPduWithPayload(in template (present) Header p_header, in template (present) Payload p_payload) := {
            header := p_header,
            secHeader := *,
            payload := p_payload
        }     
                
    } // end geoNwPduTemplates
    
    group geoNwHeadersTemplates {
        
        group geoNwCommonHeaderTemplates {
        
            template (value) CommonHeader m_commonHeader (
            	in template (value) NextHeader p_nextHeader,
            	in template (value) HeaderTST p_headerTST,
            	in template (value) TrafficClass p_trafficClass,
            	in template (value) UInt8 p_hopLimit,
            	in template (value) LongPosVector p_longPosVec,
            	in template (value) StationTypeIdentifier p_stationType
            ) := {
            	version := c_geoNwProtocolVersion,
                nextHeader := p_nextHeader,
    			headerTST := p_headerTST,
                reserved := c_uInt8Zero,
                flags := m_flags(p_stationType),
                plLength := 0, // will be computed by Codec
                trafficClass := p_trafficClass,
                hopLimit := p_hopLimit,
                senderPosVector := p_longPosVec    
            }
            
            template CommonHeader mw_commonHeader (
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTST,
                in template (present) StationTypeIdentifier p_stationType
                version := c_geoNwProtocolVersion,
                nextHeader := p_nextHeader,
                reserved := c_uInt8Zero,
                flags := mw_flags(p_stationType),
                plLength := ?, 
                trafficClass := ?,
                hopLimit := ?,
                senderPosVector := p_senderLongPosVec    
fischer's avatar
fischer committed
            template CommonHeader mw_commonHeaderBeacon (
            	in template (present) StationTypeIdentifier p_stationType,
            	in template (present) TrafficClass p_trafficClass,
            	in template (present) UInt8 p_hopLimit,
                in template (present) LongPosVector p_senderLongPosVec
berge's avatar
berge committed
            ) := {
fischer's avatar
fischer committed
				version := c_geoNwProtocolVersion,
				nextHeader := e_any, // 0
				headerTST := {
					beaconHdr := {	headerType := e_beacon, // 0
					    			headerSubType := 0}
				},
				reserved := c_uInt8Zero,
				flags := mw_flags(p_stationType),
				plLength := 0,
				trafficClass := p_trafficClass,
				hopLimit := p_hopLimit,
				senderPosVector := p_senderLongPosVec
fischer's avatar
fischer committed
			}
            template CommonHeader mw_commonHeaderWithHopLimit (
                in template (present) LongPosVector p_senderLongPosVec,
            	in template (present) NextHeader p_nextHeader,
            	in template (present) HeaderTST p_headerTST,
            	in template (present) StationTypeIdentifier p_stationType,
            	in template (present) UInt8 p_hopLimit
            ) modifies mw_commonHeader := {
                hopLimit := p_hopLimit   
            }
            
            template CommonHeader mw_commonHeaderWithTrafficClass (
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) NextHeader p_nextHeader,
                in template (present) HeaderTST p_headerTST,
                in template (present) StationTypeIdentifier p_stationType,
                in template (present) TrafficClass p_trafficClass
            ) modifies mw_commonHeader := {
                trafficClass := p_trafficClass
            }
            
            template (value) Flags m_flags(
            	in template (value) StationTypeIdentifier p_stationType
            ) := {
                reserved := c_uInt6Zero,
                stationType := p_stationType,
                reserved2 := c_uInt1Zero            
            }
            
            template Flags mw_flags(
            	in template (present) StationTypeIdentifier p_stationType
            ) := {
                reserved := c_uInt6Zero,
                stationType := p_stationType,
                reserved2 := c_uInt1Zero            
            }
         
            template (value) TrafficClass m_trafficClass := {
                reserved := c_uInt1Zero,
                relevance := c_uInt3Zero,
                reliability := e_veryHigh,
                latency := e_veryLow
            }
            
berge's avatar
berge committed
            template TrafficClass mw_trafficClass(
                in template (present) Reliability p_reliability,
                in template (present) Latency p_latency
berge's avatar
berge committed
            ) := {
                reserved := c_uInt1Zero,
                relevance := c_uInt3Zero,
                reliability := p_reliability,
                latency := p_latency
            }
            
fischer's avatar
fischer committed
            template GN_Address mw_gnAddressAny := {
                typeOfAddress := ?,
                stationType := ?,
                stationSubType := ?,
                stationCountryCode := ?,
                mid := ?
            }
berge's avatar
berge committed

            template GN_Address mw_gnAddress(
                in template (present) StationType p_stationType,
                in template (present) StationSubType p_stationSubType,
                in template (present) UInt10 p_stationCountryCode
            ) := {
                typeOfAddress := ?,
                stationType := p_stationType,
                stationSubType := p_stationSubType,
                stationCountryCode := p_stationCountryCode,
                mid := ?
            }

fischer's avatar
fischer committed
            
            template LongPosVector mw_longPosVectorAny(
            	in template (present) GN_Address p_gnAddress
        	) := {
                    gnAddr := p_gnAddress,
                    timestamp := ?,
                    latitude := ?,
fischer's avatar
fischer committed
                    longitude := ?,
                    speed := ?,
                    heading := ?,
                    altitude := ?,
                    timeAccuracy := ?,
                    posAccuracy := ?,
                    speedAccuracy := ?,
                    headingAccuracy := ?,
                    altitudeAccuracy := ?
            }
         
	   	} // end geoNwCommonHeaderTemplates
    
    	group geoUnicastHeaderTemplates {
    	    
    	    template (value) Header m_geoUnicastHeader(
    	    	in template (value) LongPosVector p_sourceLongPosVec,
    	    	in template (value) ShortPosVector p_destinationLongPosVec,
    	    	in template (value) LongPosVector p_senderLongPosVec,
    	    	in template (value) StationTypeIdentifier p_stationType,
    	    	in template (value) UInt16 p_seqNumber
    	    ) := {
                geoUnicastHeader := {
                    commonHeader := m_commonHeader(
berge's avatar
berge committed
                    	e_ipv6,
                    	m_geoUnicastHeaderType,
                    	m_trafficClass,
                    	c_defaultHopLimit,
                    	p_senderLongPosVec,
    					p_stationType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_defaultLifetime,
                    reserved := c_uInt8Zero,
               		srcPosVector := p_sourceLongPosVec,
                	dstPosVector := p_destinationLongPosVec
                }
    	    }    
berge's avatar
berge committed
            template (value) Header m_geoUnicastHeaderWithHopLimit(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) ShortPosVector p_destinationLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) StationTypeIdentifier p_stationType,
                in template (value) UInt16 p_seqNumber,
                in template (value) UInt8 p_hopLimit
            ) modifies m_geoUnicastHeader := {
                geoUnicastHeader := {
                    commonHeader := {
                      hopLimit := p_hopLimit
                    }
                }
    	    template Header mw_geoUnicastHeader(
    	    	in template (present) LongPosVector p_senderLongPosVec,
    	    	in template (present) ShortPosVector p_destinationShortPosVec,
    			in template (present) StationTypeIdentifier p_stationType,
    	    	in template (present) UInt16 p_seqNumber
    	    ) := {
                geoUnicastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
                    	mw_geoUnicastHeaderType,
                    	p_stationType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
berge's avatar
berge committed
                    reserved := ?,
               		srcPosVector := ?,
                	dstPosVector := p_destinationShortPosVec
berge's avatar
berge committed
    	    template Header mw_geoUnicastHeaderWithSourcePv(
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) ShortPosVector p_destinationShortPosVec,
                in template (present) StationTypeIdentifier p_stationType,
                in template (present) UInt16 p_seqNumber,
                in template (present) LongPosVector p_srcLongPosVec
            ) modifies mw_geoUnicastHeader := {
                geoUnicastHeader := {
                    srcPosVector := p_srcLongPosVec
                }
            }
    	    
    	    template Header mw_geoUnicastHeaderWithHopLimit(
    	    	in template (present) LongPosVector p_senderLongPosVec,
    	    	in template (present) ShortPosVector p_destinationShortPosVec,
    			in template (present) StationTypeIdentifier p_stationType,
    	    	in template (present) UInt16 p_seqNumber,
    	    	in template (present) UInt8 p_hopLimit
    	    ) modifies mw_geoUnicastHeader := {
                geoUnicastHeader := {
tepelmann's avatar
tepelmann committed
                    commonHeader := {
                        hopLimit := p_hopLimit
                    }
berge's avatar
berge committed
    	    //TODO use a better name
            template Header mw_geoUnicastHeaderWithAreaWithChWithLt(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) ShortPosVector p_destinationLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) CommonHeader p_commonHeader,
                in template (present) Lifetime p_lifetime
            ) := {
                geoUnicastHeader := {
                    commonHeader := p_commonHeader,
                    seqNumber := p_seqNumber,
                    lifetime := p_lifetime,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    dstPosVector := p_destinationLongPosVec
                }
            } 
    	    
    	    template (value) HeaderTST m_geoUnicastHeaderType := {
                geoUnicastHdr := {
                	headerType := e_geoUnicast,
fischer's avatar
fischer committed
                    headerSubType := c_uInt4Zero
                }
            }      
            
            template HeaderTST mw_geoUnicastHeaderType := {
                geoUnicastHdr := {
                	headerType := e_geoUnicast,
fischer's avatar
fischer committed
                    headerSubType := c_uInt4Zero
                }
            }       
    	    
    	} // end geoUnicastHeaderTemplates
    
        group geoBroadcastHeaderTemplates {
            
    		template (value) Header m_geoBroadcastHeader(
            	in template (value) LongPosVector p_sourceLongPosVec,
            	in template (value) LongPosVector p_senderLongPosVec,
    			in template (value) StationTypeIdentifier p_stationType,
            	in template (value) UInt16 p_seqNumber,
            	in template (value) GeoBroadcastArea p_broadcastArea
            ) := {
                geoBroadcastHeader := {
                    commonHeader := m_commonHeader(
                    	e_btp,
berge's avatar
berge committed
                    	m_geoBroadcastHeaderType(p_broadcastArea.geoBroadcastSubType),
                    	m_trafficClass,
                    	c_defaultHopLimit,
                    	p_senderLongPosVec,
    					p_stationType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_defaultLifetime,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
berge's avatar
berge committed
                    geoAreaPosLatitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLongitude,
                    distanceA := p_broadcastArea.geoBroadcastArea.distanceA,
                    distanceB := p_broadcastArea.geoBroadcastArea.distanceB,
                    angle := p_broadcastArea.geoBroadcastArea.angle,
                    reserved2 := c_uInt24Zero
                }
            }  
            
berge's avatar
berge committed
            template (value) Header m_geoBroadcastHeaderWithHopLimit(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) StationTypeIdentifier p_stationType,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoBroadcastArea p_broadcastArea,
berge's avatar
berge committed
                in template (value) UInt8 p_hopLimit
            ) modifies m_geoBroadcastHeader := {
                geoBroadcastHeader := {
                    commonHeader := m_commonHeader(
                        e_btp,
berge's avatar
berge committed
                        m_geoBroadcastHeaderType(p_broadcastArea.geoBroadcastSubType),
berge's avatar
berge committed
                        m_trafficClass,
                        p_hopLimit,
                        p_senderLongPosVec,
                        p_stationType
                    )
                }
            }
            
            template Header mw_geoBroadcastHeader(
berge's avatar
berge committed
                in template (present) LongPosVector p_sourceLongPosVec,
berge's avatar
berge committed
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) StationTypeIdentifier p_stationType,
                in template (present) UInt16 p_seqNumber
            ) := {
                geoBroadcastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
                        ?,
                        mw_geoBroadcastHeaderType,
                        p_stationType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
                    reserved := c_uInt8Zero,
berge's avatar
berge committed
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := ?,
                    geoAreaPosLongitude := ?,
                    distanceA := ?,
                    distanceB := ?,
                    angle := ?,
                    reserved2 := c_uInt24Zero
                }
            } 
berge's avatar
berge committed
            template Header mw_geoBroadcastHeaderWithArea (
                in template (present) LongPosVector p_sourceLongPosVec,
berge's avatar
berge committed
                in template (present) LongPosVector p_senderLongPosVec,
berge's avatar
berge committed
                in template (present) StationTypeIdentifier p_stationType,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoBroadcastArea p_broadcastArea
berge's avatar
berge committed
            ) modifies mw_geoBroadcastHeader := {
                geoBroadcastHeader := {
                    commonHeader := mw_commonHeader(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
berge's avatar
berge committed
                        mw_geoBroadcastHeaderTypeWithSubType(p_broadcastArea.geoBroadcastSubType),
berge's avatar
berge committed
                    ),
berge's avatar
berge committed
                    geoAreaPosLatitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLongitude,
                    distanceA := p_broadcastArea.geoBroadcastArea.distanceA,
                    distanceB := p_broadcastArea.geoBroadcastArea.distanceB,
                    angle := p_broadcastArea.geoBroadcastArea.angle
berge's avatar
berge committed

            template Header mw_geoBroadcastHeaderWithAreaWithHopLimit(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) StationTypeIdentifier p_stationType,
                in template (present) UInt16 p_seqNumber,   
                in template (present) GeoBroadcastArea p_broadcastArea,             
berge's avatar
berge committed
                in template (present) UInt8 p_hopLimit
            ) modifies mw_geoBroadcastHeaderWithArea := {
                geoBroadcastHeader := {
                    commonHeader := mw_commonHeaderWithHopLimit(
                        p_senderLongPosVec,
berge's avatar
berge committed
                        ?,
                        mw_geoBroadcastHeaderType,
                        p_stationType, 
                        p_hopLimit
                    )
                } 
            }
            //TODO use a better name
            template Header mw_geoBroadcastHeaderWithAreaWithChWithLt(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) UInt16 p_seqNumber,
                in template (present) GeoBroadcastArea p_broadcastArea,
                in template (present) CommonHeader p_commonHeader,
                in template (present) Lifetime p_lifetime
            ) := {
                geoBroadcastHeader := {
                    commonHeader := p_commonHeader,
                    seqNumber := p_seqNumber,
                    lifetime := p_lifetime,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLatitude,
                    geoAreaPosLongitude := p_broadcastArea.geoBroadcastArea.geoAreaPosLongitude,
                    distanceA := p_broadcastArea.geoBroadcastArea.distanceA,
                    distanceB := p_broadcastArea.geoBroadcastArea.distanceB,
                    angle := p_broadcastArea.geoBroadcastArea.angle,
                    reserved2 := c_uInt24Zero
                }
            } 
                       
            template (value) HeaderTST m_geoBroadcastHeaderType(
            	in template (value) HeaderSubTypeGeoBroadcast p_headerSubType
            ) := {
                geoBroadcastHdr := {
                	headerType := e_geoBroadcast,
                	headerSubType := p_headerSubType
                }
            }      
            
            template HeaderTST mw_geoBroadcastHeaderType := {
                geoBroadcastHdr := {
                	headerType := e_geoBroadcast,
                	headerSubType := ?
                }
            }       
            
            template HeaderTST mw_geoBroadcastHeaderTypeWithSubType(
            	in template (present) HeaderSubTypeGeoBroadcast p_headerSubType
            ) modifies mw_geoBroadcastHeaderType := {
                geoBroadcastHdr := {
                	headerSubType := p_headerSubType
                }
            }       
                        
            template (value) Lifetime m_defaultLifetime := {
berge's avatar
berge committed
                multiplier := c_defaultLifetime,
            
            template (present) Lifetime mw_lifetime0 := {
                multiplier := 0,
                ltBase := ?
            }
                
        } // end geoBroadcastHeaderTemplates
berge's avatar
berge committed
        group geoAnycastHeaderTemplates {
            
            template (value) Header m_geoAnycastHeader(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) StationTypeIdentifier p_stationType,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoAnycastArea p_anycastArea
berge's avatar
berge committed
            ) := {
                geoAnycastHeader := {
                    commonHeader := m_commonHeader(
                        e_btp,
                        m_geoAnycastHeaderType(p_anycastArea.geoAnycastSubType),
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec,
                        p_stationType
                    ),
                    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
                }
            }  
            
            template (value) Header m_geoAnycastHeaderWithHopLimit(
                in template (value) LongPosVector p_sourceLongPosVec,
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) StationTypeIdentifier p_stationType,
                in template (value) UInt16 p_seqNumber,
                in template (value) GeoAnycastArea p_anycastArea,
berge's avatar
berge committed
                in template (value) UInt8 p_hopLimit
            ) modifies m_geoAnycastHeader := {
                geoAnycastHeader := {
                    commonHeader := m_commonHeader(
                        e_btp,
                        m_geoAnycastHeaderType(p_anycastArea.geoAnycastSubType),
                        m_trafficClass,
                        p_hopLimit,
                        p_senderLongPosVec,
                        p_stationType
                    )
                }
            }
            
            template Header mw_geoAnycastHeader(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) StationTypeIdentifier p_stationType,
                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
                }
            } 
                       
            template Header mw_geoAnycastHeaderWithArea (
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) StationTypeIdentifier p_stationType,
                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
                }
            } 

            template Header mw_geoAnycastHeaderWithAreaWithHopLimit(
                in template (present) LongPosVector p_sourceLongPosVec,
                in template (present) LongPosVector p_senderLongPosVec,
                in template (present) StationTypeIdentifier p_stationType,
                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_stationType, 
                        p_hopLimit
                    )
                } 
            }
berge's avatar
berge committed
            
            //TODO use a better name
            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
                }
            } 
berge's avatar
berge committed
                        
            template (value) HeaderTST m_geoAnycastHeaderType(
                in template (value) HeaderSubTypeGeoAnycast p_headerSubType
            ) := {
                geoAnycastHdr := {
                    headerType := e_geoAnycast,
                    headerSubType := p_headerSubType
                }
            }      
            
            template HeaderTST mw_geoAnycastHeaderType := {
                geoAnycastHdr := {
                    headerType := e_geoAnycast,
                    headerSubType := ?
                }
            }       
            
            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 {
            
            template (value) Header m_lsRequestHeader(
            	in template (value) LongPosVector p_sourceLongPosVec,
            	in template (value) LongPosVector p_senderLongPosVec,
    			in template (value) StationTypeIdentifier p_stationType,
    			in template (value) UInt16 p_seqNumber,
            	in template (value) GN_Address p_gnAddress      
            ) := {
                lsRequestHeader := {
                	commonHeader := m_commonHeader(
                    	e_btp,
                    	m_lsRequestHeaderType,
                    	m_trafficClass,
                    	c_defaultHopLimit,
                    	p_senderLongPosVec,
    					p_stationType
                    ),    
                    seqNumber := p_seqNumber,
                	lifetime := m_defaultLifetime,
berge's avatar
berge committed
                	reserved := c_uInt8Zero,
                	srcPosVector := p_sourceLongPosVec,
               		gnAddress := p_gnAddress
                }
            }
            
            template Header mw_lsRequestHeader(
     			in template (present) StationTypeIdentifier p_stationType,
    			in template (present) UInt16 p_seqNumber,
            	in template (present) GN_Address p_gnAddress      
            ) := {
                lsRequestHeader := {
                	commonHeader := mw_commonHeader(
berge's avatar
berge committed
                    	e_any,
                    	mw_lsRequestHeaderType,
                    	p_stationType
                    ),    
                    seqNumber := p_seqNumber,
                	lifetime := ?,
                	reserved := ?,
                	srcPosVector := ?,
               		gnAddress := p_gnAddress
                }
            }
            
            template Header mw_lsRequestHeader_withHopLimit(
tepelmann's avatar
tepelmann committed
                in template (present) StationTypeIdentifier p_stationType,
                in template (present) UInt16 p_seqNumber,
                in template (present) GN_Address p_gnAddress,
                in template (present) UInt8 p_hopLimit
            ) modifies mw_lsRequestHeader := {
                lsRequestHeader := {
tepelmann's avatar
tepelmann committed
                  commonHeader := {
                      hopLimit := p_hopLimit
                  }
berge's avatar
berge committed
            template (value) HeaderTST m_lsRequestHeaderType := {
                lsHdr := {
                	headerType := e_locationService,
                	headerSubType := e_lsRequest
                }
            }      
            
            template HeaderTST mw_lsRequestHeaderType := {
                lsHdr := {
                	headerType := e_locationService,
                	headerSubType := e_lsRequest
                }
            }       
            
        } // end lsRequestHeaderTemplates 
                    
        group lsReplyHeaderTemplates {
            
            template (value) Header m_lsReplyHeader(
              in template (value) LongPosVector p_sourceLongPosVec,
              in template (value) LongPosVector p_destinationLongPosVec,
              in template (value) LongPosVector p_senderLongPosVec,
              in template (value) StationTypeIdentifier p_stationType,
              in template (value) UInt16 p_seqNumber
            ) := {
                lsReplyHeader := {
                  commonHeader := m_commonHeader(
                      e_btp,
                      m_lsRequestHeaderType,
                      m_trafficClass,
                      c_defaultHopLimit,
                      p_senderLongPosVec,
                      p_stationType
                  ),    
                  seqNumber := p_seqNumber,
                  lifetime := m_defaultLifetime,
                  reserved := c_uInt8Zero,
                  srcPosVector := p_sourceLongPosVec,
                  dstPosVector := p_destinationLongPosVec
                }
            }
            
            template Header mw_lsReplyHeaderAny(
              in template (present) StationTypeIdentifier p_stationType,
              in template (present) UInt16 p_seqNumber
            ) := {
                lsReplyHeader := {
                commonHeader := mw_commonHeader(
                    ?,
                    e_any,
                    m_lsReplyHeaderType,
                    p_stationType
                ),    
                seqNumber := p_seqNumber,
                lifetime := ?,
                reserved := ?,
                srcPosVector := ?,
                dstPosVector := ?
                in template (present) StationTypeIdentifier p_stationType,
                in template (present) UInt16 p_seqNumber, 
                in template (present) LongPosVector p_sourceLongPosVec, 
                in template (present) LongPosVector p_destinationLongPosVec)
            modifies mw_lsReplyHeaderAny := {
                lsReplyHeader := {
                    srcPosVector := p_sourceLongPosVec,
                    dstPosVector := p_destinationLongPosVec
                }
            
            template (value) HeaderTST m_lsReplyHeaderType := {
                lsHdr := {
                  headerType := e_locationService,
                  headerSubType := e_lsReply
                }
            }      
            
berge's avatar
berge committed
        } // end lsRequestHeaderTemplates 
                    
		group beaconHeaderTemplates {
		    
		    template (value) Header m_beaconHeader(
            	in template (value) LongPosVector p_senderLongPosVec
berge's avatar
berge committed
            ) := {
                beaconHeader := {
                	commonHeader := m_commonHeader(
                    	e_btp,
                    	m_beaconHeaderType,
                    	m_trafficClass,
                    	c_defaultHopLimit,
                    	p_senderLongPosVec,
    					e_vehicleStation
berge's avatar
berge committed
                    )
                }
            }
            
            template Header mw_beaconHeader(
fischer's avatar
fischer committed
            in template (present) StationTypeIdentifier p_stationType,
            in template (present) TrafficClass p_trafficClass,
            in template (present) UInt8 p_hopLimit,
            in template (present) LongPosVector p_senderLongPosVec
berge's avatar
berge committed
            ) := {
                beaconHeader := {
fischer's avatar
fischer committed
                   	commonHeader := mw_commonHeaderBeacon(
                        p_stationType,
                        p_trafficClass,
                        p_hopLimit,
                        p_senderLongPosVec
berge's avatar
berge committed
                    )
                }
            }
            
            template (value) HeaderTST m_beaconHeaderType := {
                beaconHdr := {
                	headerType := e_beacon,
fischer's avatar
fischer committed
                    headerSubType := c_uInt4Zero
berge's avatar
berge committed
                }
            }      
            
            template HeaderTST mw_beaconHeaderType := {
                beaconHdr := {
                	headerType := e_beacon,
fischer's avatar
fischer committed
                    headerSubType := ?
berge's avatar
berge committed
                }
            }   
		    
		} // end beaconHeaderTemplates                    
        group shbHeaderTemplates {
            
            template (value) Header m_shbHeader(
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) StationTypeIdentifier p_stationType
            ) := {
                shbHeader := {
                    commonHeader := m_commonHeader(
                        e_any,
                        m_shbHeaderType,
                        m_trafficClass,
                        c_defaultHopLimit,
                        p_senderLongPosVec,
                        p_stationType
                    )
                }
            }
            
            template Header mw_shbHeader(
                in template (present) StationTypeIdentifier p_stationType
fischer's avatar
fischer committed
                    commonHeader := mw_commonHeaderWithHopLimit(
                        ?, // SE PV
                        ?, // NH
                        m_shbHeaderType, // HT + HST
                        p_stationType,
                        1 // HL
                    )
                }
            }
            
            template (value) HeaderTST m_shbHeaderType := {
                tsbHdr := {
                  headerType := e_topologicallyScopedBroadcast,
                  headerSubType := e_singleHop
                }
            }      
            
        } // end shbHeaderTemplates
        
tepelmann's avatar
tepelmann committed
        group tsbHeaderTemplates {
            
            template Header m_tsbHeader(
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) StationTypeIdentifier p_stationType,
                in template (value) UInt16 p_seqNumber,
                in template (value) LongPosVector p_srcPosVector
            ) := {
                tsbHeader := {
                    commonHeader := m_commonHeader(
                        e_any, 
                        m_shbHeaderType, 
                        m_trafficClass,
                        c_defaultHopLimit, 
                        p_senderLongPosVec,
                        p_stationType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_defaultLifetime,
tepelmann's avatar
tepelmann committed
                    reserved := c_uInt8Zero,
                    srcPosVector := p_srcPosVector
                }
            }
            
            template Header m_tsbHeaderWithHopLimit(
                in template (value) LongPosVector p_senderLongPosVec,
                in template (value) StationTypeIdentifier p_stationType,
                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
                    }
                }
            }
            
            template Header mw_tsbHeader(
                in template (present) StationTypeIdentifier p_stationType,
                in template (present) UInt16 p_seqNumber,