Skip to content
LibItsGeoNetworking_Templates.ttcn 18.8 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;
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
        }
    
    } // geoNwPrimitivesTemplates
    
    group geoNwPduTemplates {
        
        template (value) GeoNetworkingPacket m_geoNwPdu(in template (value) Header p_header) := {
        	header := p_header,
        	secHeader := omit,
        	payload := omit           
        }
             
        template GeoNetworkingPacket mw_geoNwPdu(in template (present) Header p_header) := {
        	header := p_header,
        	secHeader := ?,
            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,
                longPosVec := p_longPosVec    
            }
            
            template CommonHeader mw_commonHeader (
            	in template (present) NextHeader p_nextHeader,
            	in template (present) HeaderTST p_headerTST,
            	in template (present) StationTypeIdentifier p_stationType
            ) := {
            	version := c_geoNwProtocolVersion,
                nextHeader := p_nextHeader,
    			headerTST := p_headerTST,
                reserved := c_uInt8Zero,
                flags := mw_flags(p_stationType),
                plLength := ?, 
                trafficClass := ?,
                hopLimit := ?,
                longPosVec := ?    
            }
            
            template CommonHeader mw_commonHeaderWithHopLimit (
            	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 (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
            }
            
	   	} // 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_lifetime,
                    reserved := c_uInt8Zero,
               		srcPosVector := p_sourceLongPosVec,
                	dstPosVector := p_destinationLongPosVec
                }
    	    }    
    	    
    	    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(
berge's avatar
berge committed
                    	e_ipv6,
                    	mw_geoUnicastHeaderType,
                    	p_stationType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
berge's avatar
berge committed
                    reserved := ?,
               		srcPosVector := ?,
                	dstPosVector := p_destinationShortPosVec
                }
    	    }    
    	    
    	    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 := {
                    commonHeader := mw_commonHeaderWithHopLimit(
berge's avatar
berge committed
                    	e_ipv6,
                    	mw_geoUnicastHeaderType,
                    	p_stationType,
                    	p_hopLimit
                    )
                }
    	    } 
    	    
    	    template (value) HeaderTST m_geoUnicastHeaderType := {
                geoUnicastHdr := {
                	headerType := e_geoUnicast,
                	reserved := c_uInt4Zero
                }
            }      
            
            template HeaderTST mw_geoUnicastHeaderType := {
                geoUnicastHdr := {
                	headerType := e_geoUnicast,
                	reserved := ?
                }
            }       
    	    
    	} // 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) HeaderSubTypeGeoBroadcast p_headerSubType,
            	in template (value) UInt32 p_geoAreaPosLatitude,
            	in template (value) UInt32 p_geoAreaPosLongitude,
            	in template (value) UInt16 p_distanceA,
            	in template (value) UInt16 p_distanceB,
            	in template (value) UInt8 p_angle
            ) := {
                geoBroadcastHeader := {
                    commonHeader := m_commonHeader(
                    	e_btp,
                    	m_geoBroadcastHeaderType(p_headerSubType),
                    	m_trafficClass,
                    	c_defaultHopLimit,
                    	p_senderLongPosVec,
    					p_stationType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := m_lifetime,
                    reserved := c_uInt8Zero,
                    srcPosVector := p_sourceLongPosVec,
                    geoAreaPosLatitude := p_geoAreaPosLatitude,
                    geoAreaPosLongitude := p_geoAreaPosLongitude,
                    distanceA := p_distanceA,
                    distanceB := p_distanceB,
                    angle := p_angle,
                    reserved2 := c_uInt24Zero
                }
            }  
            
            template Header mw_geoBroadcastHeader(
            	in template (present) LongPosVector p_senderLongPosVec,
    			in template (present) StationTypeIdentifier p_stationType,
            	in template (present) UInt16 p_seqNumber
            ) := {
                geoBroadcastHeader := {
                    commonHeader := mw_commonHeader(
                    	e_btp,
                    	mw_geoBroadcastHeaderType,
                    	p_stationType
                    ),
                    seqNumber := p_seqNumber,
                    lifetime := ?,
                    reserved := c_uInt8Zero,
                    srcPosVector := ?,
                    geoAreaPosLatitude := ?,
                    geoAreaPosLongitude := ?,
                    distanceA := ?,
                    distanceB := ?,
                    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_lifetime := {
                multiplier := 10,
                ltBase := e_1s
            }
                
        } // end geoBroadcastHeaderTemplates
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_lifetime,
                	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(
                    	e_any,
                    	mw_lsRequestHeaderType,
                    	p_stationType
                    ),    
                    seqNumber := p_seqNumber,
                	lifetime := ?,
                	reserved := ?,
                	srcPosVector := ?,
               		gnAddress := p_gnAddress
                }
            }
            
            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_lifetime,
                  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 := ?
                }
            }
            
            template Header mw_lsReplyHeader(
                template (present) StationTypeIdentifier p_stationType,
                template (present) UInt16 p_seqNumber, 
                template (present) LongPosVector p_sourceLongPosVec, 
                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,
    			in template (value) StationTypeIdentifier p_stationType
            ) := {
                beaconHeader := {
                	commonHeader := m_commonHeader(
                    	e_btp,
                    	m_beaconHeaderType,
                    	m_trafficClass,
                    	c_defaultHopLimit,
                    	p_senderLongPosVec,
    					p_stationType
                    )
                }
            }
            
            template Header mw_beaconHeader(
    			in template (value) StationTypeIdentifier p_stationType
            ) := {
                beaconHeader := {
                   	commonHeader := mw_commonHeader(
                    	e_any,
                    	mw_beaconHeaderType,
                    	p_stationType
                    )
                }
            }
            
            template (value) HeaderTST m_beaconHeaderType := {
                beaconHdr := {
                	headerType := e_beacon,
                	reserved := c_uInt4Zero
                }
            }      
            
            template HeaderTST mw_beaconHeaderType := {
                beaconHdr := {
                	headerType := e_beacon,
                	reserved := ?
                }
            }   
		    
		} // 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 (value) StationTypeIdentifier p_stationType
            ) := {
                shbHeader := {
                    commonHeader := mw_commonHeader(
                      e_any,
                      m_shbHeaderType,
                      p_stationType
                    )
                }
            }
            
            template (value) HeaderTST m_shbHeaderType := {
                tsbHdr := {
                  headerType := e_topologicallyScopedBroadcast,
                  headerSubType := e_singleHop
                }
            }      
            
        } // end shbHeaderTemplates
        
    } // end geoNwHeadersTemplates
berge's avatar
berge committed
    
} // end ItsGeoNetworking_Templates