Commit fdf730de authored by tepelmann's avatar tepelmann
Browse files

Prepared Ats464XLat interface, functions, etc.

Moved up some functions from AtsNat64 to AtsCommon.
parent 14d28c79
Loading
Loading
Loading
Loading
+832 −1

File changed.

Preview size limit exceeded, changes collapsed.

+129 −0
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
module Ats464XLat_Interfaces {
    
    // LibCommon
    import from LibCommon_Sync {type SelfSyncComp;}
    import from LibCommon_Time {modulepar PX_TAC, PX_TNOAC, PX_TWAIT;}
    
    // LibIPv6
    import from LibIpv6_Interface_TypesAndValues all;
@@ -21,14 +23,141 @@ module Ats464XLat_Interfaces {
            port DHCPv6Port dhcpv6Port;
            /** DHCPv6 component reference */
            var DHCPv6Component vc_dhcpv6Component := null;
            /** LSN component reference */
            var LSNComponents vc_lsnComponents;
            /** LSN FTP component reference */
            var LSNFTPComponents vc_lsnFtpComponents;
            /** LSN SIP component reference */
            var LSNSIPComponents vc_lsnSipComponents;
            /** LSN RTSP component reference */
            var LSNRTSPComponents vc_lsnRtspComponents;
            /** LSN PPTP component reference */
            var LSNPPTPComponents vc_lsnPptpComponents;
            /** Host component reference */
            var HostComponents vc_hostComponents;
            /** Host FTP component reference */
            var HostFTPComponents vc_hostFtpComponents;
            /** Host SIP component reference */
            var HostSIPComponents vc_hostSipComponents;
            /** Host RTSP component reference */
            var HostRTSPComponents vc_hostRtspComponents;
            /** Host PPTP component reference */
            var HostPPTPComponents vc_hostPptpComponents;
        } // End of component FourSixFourXLatComponent
        
        type record of LSNComponent LSNComponents;
        type record of LSNFTPComponent LSNFTPComponents;
        type record of LSNSIPComponent LSNSIPComponents;
        type record of LSNRTSPComponent LSNRTSPComponents;
        type record of LSNPPTPComponent LSNPPTPComponents;
        
        type record of HostComponent HostComponents;
        type record of HostFTPComponent HostFTPComponents;
        type record of HostSIPComponent HostSIPComponents;
        type record of HostRTSPComponent HostRTSPComponents;
        type record of HostPPTPComponent HostPPTPComponents;
        
    } // End of group mtcDesc
    
    group componentDesc {
        
        group componentPorts {
            
            type component HostComponent extends UtComponent, LibIpv6Node, SelfSyncComp {
            } // End of component HostComponent
            
            type component HostFTPComponent extends UtComponent, SelfSyncComp {
                /** FTP message port */
                port FtpPort ftpPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_wait:= PX_TWAIT;
            } // End of component HostFTPComponent
            
            type component HostSIPComponent extends UtComponent, SelfSyncComp {
                /** SIP message port */
                port SipPort sipPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_wait:= PX_TWAIT;
            } // End of component HostSIPComponent
            
            type component HostRTSPComponent extends UtComponent, SelfSyncComp {
                /** RTSP message port */
                port RtspPort rtspPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_wait:= PX_TWAIT;
            } // End of component HostRTSPComponent
            
            type component HostPPTPComponent extends UtComponent, SelfSyncComp {
                /** PPTP message port */
                port PptpPort pptpPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_wait:= PX_TWAIT;
            } // End of component HostPPTPComponent
            
            type component LSNComponent extends UtComponent, LibIpv6Node, SelfSyncComp {
                /** IPv6 message port shall not be used! */
            } // End of component LSNComponent
            
            type component LSNFTPComponent extends UtComponent, SelfSyncComp {
                /** FTP message port */
                port FtpPort ftpPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_wait:= PX_TWAIT;
            } // End of component LSNFTPComponent
            
            type component LSNSIPComponent extends UtComponent, SelfSyncComp {
                /** SIP message port */
                port SipPort sipPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_wait:= PX_TWAIT;
            } // End of component LSNSIPComponent
            
            type component LSNRTSPComponent extends UtComponent, SelfSyncComp {
                /** RTSP message port */
                port RtspPort rtspPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_wait:= PX_TWAIT;
            } // End of component LSNRTSPComponent
            
            type component LSNPPTPComponent extends UtComponent, SelfSyncComp {
                /** PPTP message port */
                port PptpPort pptpPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_wait:= PX_TWAIT;
            } // End of component LSNPPTPComponent
            
        } // End of group componentPorts
        
    } // End of group componentDesc
+32 −0
Original line number Diff line number Diff line
@@ -6,6 +6,38 @@
module Ats464XLat_Pixits {
    
    // LibCommon
    import from LibCommon_DataStrings all;
    import from LibCommon_BasicTypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_TypesAndValues all;
    
    /**
     * @desc Defines the NAT64 prefix.
     */
    modulepar Oct8 PX_464XLAT_PREFIX := '0064FF9B00000000'O;
    
    modulepar Ipv4IutInfo PX_IPV4_DESTINATION_INFORMATION := {
        iutAddress := '41d0e4df'O,
        iutPort    := 80,
        payload    := {
            rawPayload := 'CAFEDECA'O // TODO To be enhanced
        }
    }
    
    modulepar NatMappingTable_1_to_n PX_464XLAT_MAPPING_TABLE_1_TO_N := {
        ip4Address := '91fea0ed'O,
        dstPort    := 80,
        portInfos := {
            {
                ip6Address := '20010db8000000000000000000000001'O,
                srcPort    := 6000
            },
            {
                ip6Address := '20010db8000000000000000000000002'O,
                srcPort    := 6001
            }
        }
    }
    
} // End of module Ats464XLat_Pixits
 No newline at end of file
+23 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ module AtsCommon_Functions {
    // AtsCommon
    import from AtsCommon_Interfaces all;
    import from AtsCommon_Templates all;
    import from AtsCommon_Tcp_Rfc793_TypesAndValues all;
    
    group uninitialiseFunctions {
        
@@ -201,6 +202,28 @@ module AtsCommon_Functions {
            return e_success;
        }   // End of function f_finalyzeIpv4Packet
        
        function f_decTcpPacket(in octetstring p_raw, out TcpPacket p_tcpPacket) return FncRetCode {
            var FncRetCode v_result;
            var integer v_decRes;
            
            v_decRes := decvalue(oct2bit(p_raw), p_tcpPacket);
            select (v_decRes) {
                case (0) {
                    v_result := e_success;
                }
                case (1) {
                    log("*** Decoding failure ***");
                    v_result := e_error;
                }
                case (2) {
                    log("*** Decoding failure. Not enough bits. ***");
                    v_result := e_error;
                }
            }
            
            return v_result;
        }
        
    } // End of group auxiliary
    
} // End of module AtsCommon_Functions
+3 −26
Original line number Diff line number Diff line
@@ -14,10 +14,12 @@ module AtsNat64_Functions {
        const c_prDone, c_tbDone, c_poDone;
    }
    import from LibCommon_VerdictControl all;
    import from LibIpv6_CommonRfcs_TypesAndValues all;
    import from LibCommon_Time all;
    import from LibCommon_BasicTypesAndValues all;
    
    // LibIpv6
    import from LibIpv6_CommonRfcs_TypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_Tcp_Rfc793_TypesAndValues all;
    import from AtsCommon_Interfaces all;
@@ -922,29 +924,4 @@ module AtsNat64_Functions {
        
    } // End of group getFunctions
    
    group auxiliary {
        
        function f_decTcpPacket(in octetstring p_raw, out TcpPacket p_tcpPacket) return FncRetCode {
            var FncRetCode v_result;
            var integer v_decRes;
            
            v_decRes := decvalue(oct2bit(p_raw), p_tcpPacket);
            select (v_decRes) {
                case (0) {
                    v_result := e_success;
                }
                case (1) {
                    log("*** Decoding failure ***");
                    v_result := e_error;
                }
                case (2) {
                    log("*** Decoding failure. Not enough bits. ***");
                    v_result := e_error;
                }
            }
            
            return v_result;
        }
    } // End of group auxiliary
    
} // End of module AtsNat64_Functions
 No newline at end of file