LibItsIpv6OverGeoNetworking_Templates.ttcn 6.19 KB
Newer Older
/**
 *  @author   ETSI / STF405
 *  @version  $URL: svn+ssh://vcs.etsi.org/TTCN3/ATS/Its/trunk/ttcn/AtsIPv6OverGeoNetworking/ItsIpv6OverGeoNetworking_TestCases.ttcn $
 *            $Id: ItsIpv6OverGeoNetworking_TestCases.ttcn 169 2010-09-23 08:12:36Z berge $
 *  @desc     IPv6 over GeoNetworking Protocol Templates
 *
 */
module LibItsIpv6OverGeoNetworking_Templates {
    
    //LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    //LibIts
    import from LibIts_Interface all;
    import from LibItsGeoNetworking_TypesAndValues {type Payload;}
    import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
    
    group ipv6OverGeoNwPrimitivesTemplates {
    
        template (value) IPv6OverGeoNetworkingReq m_ipv6OverGeoNwReq(
            template (value) charstring p_interface,
            template (value) MacAddress p_srcMacAddr,
            template (value) MacAddress p_dstMacAddr,
            template (value) Ipv6Packet p_ipv6Packet
        ) := {
            interface := p_interface,
            macSourceAddress := p_srcMacAddr,
            macDestinationAddress := p_dstMacAddr,
            ipv6Packet := p_ipv6Packet
        }
        
        template IPv6OverGeoNetworkingInd mw_ipv6OverGeoNwInd(
            template (value) charstring p_interface,
            template (value) MacAddress p_srcMacAddr,
            template (value) MacAddress p_dstMacAddr,
            template (present) Ipv6Packet p_ipv6Packet
        ) := {
            interface := p_interface,
            macSourceAddress := p_srcMacAddr,
            macDestinationAddress := p_dstMacAddr,
            ipv6Packet := p_ipv6Packet
        }
    
    } // ipv6OverGeoNwPrimitivesTemplates
    
    group ipv6 {
        
        template Payload m_ipv6Payload(in template (value) Ipv6Packet p_ipv6Packet) := {
            ipv6Packet := p_ipv6Packet
        }
        
        template Payload mw_ipv6Payload(in template (present) Ipv6Packet p_ipv6Packet) := {
            ipv6Packet := p_ipv6Packet
        }
        
        template (value) Ipv6Packet m_ipv6Packet(
            in template (value) Ipv6Address p_srcAddr,
            in template (value) Ipv6Address p_dstAddr,
            in template (value) UInt8 p_nextHdr,
            in template (omit) Ipv6Payload p_payload
        ) := {
            ipv6Hdr := m_ipv6Header(p_srcAddr, p_dstAddr, p_nextHdr),
            extHdrList := omit,
            ipv6Payload := p_payload
        }
        
        template Ipv6Header m_ipv6Header(
            in template (value) Ipv6Address p_srcAddr,
            in template (value) Ipv6Address p_dstAddr,
            in template (value) UInt8 p_nextHdr
        ) := {
            version := 6,
            trafficClass := 0,
            flowLabel := 0, 
            payloadLength := 0, //indicates that the adaptation will fill the correct value
            nextHeader := p_nextHdr,
            hopLimit := 255,
            sourceAddress := p_srcAddr,
            destinationAddress := p_dstAddr
        }
        
        template Ipv6Payload m_rtAdvWithOptions(
            in template (omit) RtAdvOptions p_rtAdvOptions
        ) := {
            routerAdvMsg := {
                icmpType := c_rtAdvMsg,
                icmpCode := 0,
                checksum := c_2ZeroBytes, //indicates that the adaptation will fill the correct value
                curHopLimit := 255,
                managedConfigFlag := 0,
                otherConfigFlag := 0,
                homeAgentFlag := 0,
                reserved := 0,
                routerLifetime := c_uInt16Max,
                reachableTime := 0,
                retransTimer := 0,
                rtAdvOptions := p_rtAdvOptions
        /**
         *  @param  p_prefixLength Length of the prefix.
         *  @param  p_lFlag Value for link flag.
         *  @param  p_aFlag Value for autoconfiguration flag.
         *  @param  p_validLifetime Value for valid life time duration.
         *  @param  p_preferredLifetime Value for preffered life time duration.
         *  @param  p_prefix Address prefix to be used
         */
        template RtAdvOptions m_rtAdvOpt_prefixOpt (
berge's avatar
berge committed
            in template (value) UInt8 p_prefixLength,
            in template (value) UInt1 p_lFlag,
            in template (value) UInt1 p_aFlag,
            in template (value) UInt32 p_validLifetime,
            in template (value) UInt32 p_preferredLifetime,
            in template (value) Ipv6Address p_prefix
        ):={
            srcLinkLayerAddr := omit,
//            mtuOption:= omit,
            prefixInfoList := {
                m_prefixInfo(
                    p_prefixLength,
                    p_lFlag,
                    p_aFlag,
                    p_validLifetime,
                    p_preferredLifetime,
                    p_prefix
                )
            },
//            advertisementInterval := omit,
//            homeAgentInfo := omit,
            otherOption := omit
        }
    
        /**
         *  @param  p_prefixLength The length of the prefix
         *  @param  p_lFlag Value for link flag.
         *  @param  p_aFlag Value for autoconfiguration flag.
         *  @param  p_validLifetime Value for valid life time duration.
         *  @param  p_preferredLifetime Value for preffered life time duration.
         *  @param  p_prefix Address prefix to be used
         */
        template PrefixInfo m_prefixInfo (
berge's avatar
berge committed
            in template (value) UInt8 p_prefixLength,
            in template (value) UInt1 p_lFlag,
            in template (value) UInt1 p_aFlag,
            in template (value) UInt32 p_validLifetime,
            in template (value) UInt32 p_preferredLifetime,
            in template (value) Ipv6Address p_prefix
        ):= {
            icmpType:= c_prefixInfo,
            optionLength:= c_prefixInfoLen,
            prefixLength:= p_prefixLength,
            linkFlag:=p_lFlag,
            autoConfigFlag:=p_aFlag,
            rtAddrFlag := c_rtAddrFlag0,
            reserved1:=0,
            validLifetime:=p_validLifetime,
            preferredLifetime:=p_preferredLifetime,
            reserved2:=0,
            prefix:= p_prefix
        }
    
    } // end group ipv6
    
} // end LibItsIpv6OverGeoNetworking_TypesAndValues