Commit 102b21f4 authored by tepelmann's avatar tepelmann
Browse files

Added TC_IPv6GEO_MR_GVL_BV_01, helper functions.

Minor changes.
parent 5da2ee31
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -39,6 +39,12 @@ module LibItsGeoNetworking_Templates {
        	payload := 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) := {
        template GeoNetworkingPacket mw_geoNwPdu(in template (present) Header p_header) := {
        	header := p_header,
        	header := p_header,
        	secHeader := *,
        	secHeader := *,
+67 −16
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
    import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
    import from LibItsIpv6OverGeoNetworking_Templates all;
    
    
    group ipv6OverGeoConfigurationFunctions {
    group ipv6OverGeoConfigurationFunctions {
        
        
@@ -53,7 +54,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
            
            
        } // end f_cf01Down
        } // end f_cf01Down
        
        
    } // emd ipv6OverGeoConfigurationFunctions
    } // end group ipv6OverGeoConfigurationFunctions
    
    
    group testAdapter {
    group testAdapter {
        
        
@@ -63,7 +64,49 @@ module LibItsIpv6OverGeoNetworking_Functions {
            
            
        }
        }
        
        
    } // end testAdapter
    } // end group testAdapter
    
    group sendFunctions {
        
        function f_sendGeoBroadcastWithRA(
            in template (value) GvlTableEntry p_gvl,
            in template (value) LongPosVector p_position,
            in template (value) Ipv6Address p_sourceAddr,
            in template (value) Ipv6Address p_destinationAddr
        ) runs on ItsNt {
            f_sendGeoNetMessage(
                m_geoNwReq(
                    m_geoNwPduWithPayload(
                        m_geoBroadcastHeader(
                            p_position,
                            p_position,
                            e_vehicleStation,
                            vc_localSeqNumber,
                            f_getGeoBroadcastArea(p_gvl.area)
                        ),
                        m_ipv6Payload(
                            m_ipv6Packet(
                                p_sourceAddr,
                                p_destinationAddr,
                                c_noNextHdr,
                                m_rtAdvWithOptions(
                                    m_rtAdvOpt_prefixOpt(
                                        p_gvl.prefixLength,
                                        c_lFlag1,
                                        c_aFlag1,
                                        c_validLifetime30s,
                                        c_preferredLifetime30s,
                                        p_gvl.prefix
                                    )
                                )
                            )
                        )
                    )
                )
            );
        }
        
    } //end group sendFunctions
    
    
    group miscellaneous {
    group miscellaneous {
        
        
@@ -72,7 +115,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
         * @param p_areaIndex The index of the area
         * @param p_areaIndex The index of the area
         */
         */
        function f_getGVL(in integer p_areaIndex) runs on ItsNt return GvlTableEntry {
        function f_getGVL(in integer p_areaIndex) runs on ItsNt return GvlTableEntry {
            return vc_gvlTable[p_areaIndex];
            return valueof(vc_gvlTable[p_areaIndex]);
        } //end f_getGVL
        } //end f_getGVL
        
        
        /**
        /**
@@ -82,7 +125,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
         */    
         */    
        function f_gnAddr2MacAddr(in GN_Address p_gnAddr) return MacAddress {
        function f_gnAddr2MacAddr(in GN_Address p_gnAddr) return MacAddress {
            return p_gnAddr.mid;
            return p_gnAddr.mid;
        }
        } // end f_gnAddr2MacAddr
        
        
        /**
        /**
         * @desc    Retrieves the GN address from the MAC address.
         * @desc    Retrieves the GN address from the MAC address.
@@ -93,7 +136,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
            var GN_Address v_gnAddr := valueof(m_dummyGnAddr);
            var GN_Address v_gnAddr := valueof(m_dummyGnAddr);
            v_gnAddr.mid := p_macAddr;
            v_gnAddr.mid := p_macAddr;
            return v_gnAddr;
            return v_gnAddr;
        }
        } // end f_macAddr2GnAddr
        
        
        /**
        /**
         * @desc  Compute an Unique Interface ID based on a MAC Address
         * @desc  Compute an Unique Interface ID based on a MAC Address
@@ -124,7 +167,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
            v_leftPartMac := bit2oct(v_leftPartBits);
            v_leftPartMac := bit2oct(v_leftPartBits);
            //build InterfaceId
            //build InterfaceId
            return v_leftPartMac & 'FFFE'O & v_rightPartMac;
            return v_leftPartMac & 'FFFE'O & v_rightPartMac;
        }
        } // end f_createUniqueInterfaceId


        /**
        /**
         * @desc  Compute link-local, global, solicited-node multicast IPv6 addresses<br>
         * @desc  Compute link-local, global, solicited-node multicast IPv6 addresses<br>
@@ -142,10 +185,10 @@ module LibItsIpv6OverGeoNetworking_Functions {
            in MacAddress p_macAddr,
            in MacAddress p_macAddr,
            in Oct16 p_prefix, 
            in Oct16 p_prefix, 
            in UInt8 p_prefixLen,
            in UInt8 p_prefixLen,
            out Ipv6Address p_lla,
            inout Ipv6Address p_lla,
            out Ipv6Address p_gla,
            inout Ipv6Address p_gla,
            out Ipv6Address p_solNodeMca,
            inout Ipv6Address p_solNodeMca,
            out MacAddress p_macSolNodeMca
            inout MacAddress p_macSolNodeMca
        )
        )
        return FncRetCode {
        return FncRetCode {
            var UInt8 i;
            var UInt8 i;
@@ -175,10 +218,14 @@ module LibItsIpv6OverGeoNetworking_Functions {
            v_interfaceIdReady := f_createUniqueInterfaceId (p_macAddr);
            v_interfaceIdReady := f_createUniqueInterfaceId (p_macAddr);
            
            
            //LLA
            //LLA
            if (p_lla != null) {
                p_lla := 'FE80000000000000'O & v_interfaceIdReady;
                p_lla := 'FE80000000000000'O & v_interfaceIdReady;
            }
            
            
            //GLA
            //GLA
            if (p_gla != null) {
                p_gla := v_prefixReady & v_interfaceIdReady;
                p_gla := v_prefixReady & v_interfaceIdReady;
            }
            
            
            //get rightPart
            //get rightPart
            for (i:=3; i<lengthof(p_macAddr); i:=i+1) {
            for (i:=3; i<lengthof(p_macAddr); i:=i+1) {
@@ -186,13 +233,17 @@ module LibItsIpv6OverGeoNetworking_Functions {
            }
            }
            
            
            //SOL_NODE_MCA
            //SOL_NODE_MCA
            if (p_solNodeMca != null) {
                p_solNodeMca := 'FF0200000000000000000001FF'O & v_rightPartMac;
                p_solNodeMca := 'FF0200000000000000000001FF'O & v_rightPartMac;
            }
            
            
            //MAC_MCA
            //MAC_MCA
            if (p_macSolNodeMca != null) {
                p_macSolNodeMca := '3333FF'O & v_rightPartMac;
                p_macSolNodeMca := '3333FF'O & v_rightPartMac;
            }
            
            
            return e_success;
            return e_success;
        }//end function f_createIpAddresses
        }//end f_createIpAddresses


        /**
        /**
         * @desc    Derives the traffic class from the IPv6 TrafficClass field
         * @desc    Derives the traffic class from the IPv6 TrafficClass field
@@ -225,6 +276,6 @@ module LibItsIpv6OverGeoNetworking_Functions {
            return v_trafficClass;
            return v_trafficClass;
        } // end f_getTrafficClassFromPriority
        } // end f_getTrafficClassFromPriority
    
    
    } // end miscellaneous
    } // end group miscellaneous


} // end LibItsIpv6OverGeoNetworking_Functions
} // end LibItsIpv6OverGeoNetworking_Functions
 No newline at end of file
+15 −0
Original line number Original line Diff line number Diff line
/**
 *  @author   ETSI / STF405
 *  @version  $URL: svn+ssh://vcs.etsi.org/TTCN3/ATS/Its/trunk/ttcn/AtsIPv6OverGeoNetworking/ItsIpv6OverGeoNetworking_TestCases.ttcn $
 *            $Id: ItsIpv6OverGeoNetworking_TestCases.ttcn 176 2010-09-30 11:55:57Z berge $
 *  @desc     Module parameters for IPv6 over GeoNetworking Protocol
 *
 */
module LibItsIpv6OverGeoNetworking_ModuleParameters {
    
    /**
     * @desc Time for building the configuration and virtual interfaces dynamically.
     */
    modulepar float PX_T_BUILD_CONFIG := 5.0;
    
}
 No newline at end of file
+71 −3
Original line number Original line Diff line number Diff line
@@ -46,11 +46,15 @@ module LibItsIpv6OverGeoNetworking_Templates {
    
    
    group ipv6 {
    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) := {
        template Payload mw_ipv6Payload(in template (present) Ipv6Packet p_ipv6Packet) := {
            ipv6Packet := p_ipv6Packet
            ipv6Packet := p_ipv6Packet
        }
        }
        
        
        template Ipv6Packet m_ipv6Packet(
        template (value) Ipv6Packet m_ipv6Packet(
            in template (value) Ipv6Address p_srcAddr,
            in template (value) Ipv6Address p_srcAddr,
            in template (value) Ipv6Address p_dstAddr,
            in template (value) Ipv6Address p_dstAddr,
            in template (value) UInt8 p_nextHdr,
            in template (value) UInt8 p_nextHdr,
@@ -76,7 +80,9 @@ module LibItsIpv6OverGeoNetworking_Templates {
            destinationAddress := p_dstAddr
            destinationAddress := p_dstAddr
        }
        }
        
        
        template Ipv6Payload m_rtAdv := {
        template Ipv6Payload m_rtAdvWithOptions(
            in template (omit) RtAdvOptions p_rtAdvOptions
        ) := {
            routerAdvMsg := {
            routerAdvMsg := {
                icmpType := c_rtAdvMsg,
                icmpType := c_rtAdvMsg,
                icmpCode := 0,
                icmpCode := 0,
@@ -89,8 +95,70 @@ module LibItsIpv6OverGeoNetworking_Templates {
                routerLifetime := c_uInt16Max,
                routerLifetime := c_uInt16Max,
                reachableTime := 0,
                reachableTime := 0,
                retransTimer := 0,
                retransTimer := 0,
                rtAdvOptions := omit
                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 (
            UInt8 p_prefixLength,
            UInt1 p_lFlag,
            UInt1 p_aFlag,
            UInt32 p_validLifetime,
            UInt32 p_preferredLifetime,
            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 (
            UInt8 p_prefixLength,
            UInt1 p_lFlag,
            UInt1 p_aFlag,
            UInt32 p_validLifetime,
            UInt32 p_preferredLifetime,
            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 group ipv6
+90 −9
Original line number Original line Diff line number Diff line
@@ -16,8 +16,8 @@ module LibItsIpv6OverGeoNetworking_TypesAndValues {
    group ipv6OverGeoConfigurationTypes {
    group ipv6OverGeoConfigurationTypes {
        
        
        type record GvlTableEntry {
        type record GvlTableEntry {
            octetstring prefix,
            Oct16       prefix,
            integer prefixLength,
            UInt8       prefixLength,
            charstring  area,
            charstring  area,
            charstring  interface
            charstring  interface
        }
        }
@@ -88,10 +88,24 @@ module LibItsIpv6OverGeoNetworking_TypesAndValues {
         */
         */
        type Oct16 Ipv6Address;
        type Oct16 Ipv6Address;
        
        
        /**
        group rfc2461MessageTypes {
         * @desc RouterAdvertisement message type
          const UInt8   c_prefixInfo := 3 ;
         */
          const UInt8   c_rtAdvMsg := 134;
          const UInt8   c_rtAdvMsg := 134;
        } // end group rfc2461MessageTypes
        
        group ipv6Address {
            //Prefix
            const Oct2 c_llaMcaPrefix := 'FF02'O ;
            const Oct2 c_llaPrefix := 'FE80'O ;
            //Postfix
            const Oct2 c_allNodesMcaPostfix := '0001'O ;
            const Oct2 c_allRoutersMcaPostfix := '0002'O ;
            const Oct2 c_anycastPostfix := 'FFFF'O ;
            const Oct1 c_haAnycastPostfix := '7E'O ;
            //Wellknown Multicast Address
            const Ipv6Address c_allNodesMca := c_llaMcaPrefix & c_12ZeroBytes & c_allNodesMcaPostfix ;
            const Ipv6Address c_allRoutersMca := c_llaMcaPrefix & c_12ZeroBytes & c_allRoutersMcaPostfix ;
        }//end group ipv6Address
        
        
        /**
        /**
         * @desc PDU type derived from RFC2461 clause 4.2
         * @desc PDU type derived from RFC2461 clause 4.2
@@ -113,8 +127,75 @@ module LibItsIpv6OverGeoNetworking_TypesAndValues {
        
        
        /**
        /**
         * @desc RouterAdvertisement option list
         * @desc RouterAdvertisement option list
         *
         * @remark Any RtAdvOptions value should at least have 
         *         one of the first three options present!
        */
        type set RtAdvOptions {
            SrcLinkLayerAddress   srcLinkLayerAddr optional,
//            MtuOption             mtuOption optional,
            PrefixInfoList        prefixInfoList optional,
//            AdvertisementInterval advertisementInterval optional,
//            HomeAgentInfo         homeAgentInfo optional,
            octetstring           otherOption optional
        } 
        
        /**
         * @desc Derived from RFC2461 clause4.6.1 + MIPv6
         * @url http://www.ietf.org/rfc/rfc2461.txt
         */
         */
        type octetstring RtAdvOptions;
        type record SrcLinkLayerAddress {
            UInt8         icmpType(c_srcLinkLayerAddress),
            UInt8         optionLength,
            Oct6to15      linkLayerAddr
        }
        
        type set length (1..c_maxNrPrefixInfo) of PrefixInfo PrefixInfoList;
        
        /**
         * @desc Derived from RFC 2461 clause 4.6.2
         */
        type record PrefixInfo {
            UInt8   icmpType(c_prefixInfo),
            UInt8   optionLength,
            UInt8   prefixLength,
            UInt1   linkFlag,
            UInt1   autoConfigFlag,
            UInt1   rtAddrFlag,
            UInt5   reserved1,
            UInt32  validLifetime,
            UInt32  preferredLifetime,
            UInt32  reserved2,
            Prefix  prefix
        }
        
        type Ipv6Address Prefix ;
        
        group nd_constants {
            const UInt8 c_maxNrPrefixInfo := 10;
            const UInt1 c_rtAddrFlag0 := 0;
            
            const UInt1 c_aFlag0 := 0;
            const UInt1 c_aFlag1 := 1;
            const UInt1 c_rFlag0 := 0;
            const UInt1 c_rFlag1 := 1;
            const UInt1 c_sFlag0 := 0;
            const UInt1 c_sFlag1 := 1;
            const UInt1 c_oFlag0 := 0;
            const UInt1 c_oFlag1 := 1;
            const UInt1 c_mFlag0 := 0;
            const UInt1 c_mFlag1 := 1;
            const UInt1 c_lFlag0 := 0;
            const UInt1 c_lFlag1 := 1;
            
            const UInt16 c_zeroLifetime := 0 ;
            const UInt32 c_validLifetime30s := 30;
            const UInt32 c_preferredLifetime30s := 30;
            
        } // end group nd_constants
        
        const UInt8 c_srcLinkLayerAddress := 1;
        const UInt8 c_prefixInfoLen := 4;
        
        
    } // end group ipv6
    } // end group ipv6