Commit 4d4665e1 authored by tepelmann's avatar tepelmann
Browse files

Added DNS types.

parent 7156a533
Loading
Loading
Loading
Loading
+23 −34
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ module AtsDSLite_Functions {
    	    AFTRComponent, HostComponent, 
    	    DHCPv6Component, DNSComponent;
    };
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues all;
    
    group initialiseFunctions {
        
@@ -144,7 +145,7 @@ module AtsDSLite_Functions {
            var Ipv6Packet v_ipv6Pkt;
            var Ipv4Packet v_ipv4Pkt;
            var DHCPv6Msg v_dhcpMsg;
//            var DNSMsg v_dnsMsg;
            var DnsMsg v_dnsMsg;

            [] ipPort.receive(mw_ipPkt) -> value v_ipv6Pkt { // Await IPv6 packet
                if (ispresent(v_ipv6Pkt.ipv6Payload)) {
@@ -153,9 +154,11 @@ module AtsDSLite_Functions {
                        // Shall DHCP be handled?
                        if (
                                (vc_dhcpv6Component != null) and 
                                (v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dhcpv6ClientPort, 2)) and
                                (v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dhcpv6ServerPort, 2))) 
                        {
                                (
                                    (v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dhcpv6ServerPort, 2)) 
                                    or (v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dhcpv6ServerPort, 2))
                                )
                            ) {
                            // Process DHCPv6 packet
                            if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dhcpMsg)!=0) {
                                dhcpv6Port.send(v_dhcpMsg);
@@ -166,18 +169,22 @@ module AtsDSLite_Functions {
                            }
                        }
                        // Shall DNS be handled?
                        //TODO ports???
//                        if (vc_dnsComponent!=null and v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dnsClientPort, 2)
//                            and v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dnsServerPort, 2)) {
//                            if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dnsMsg)!=0) {
//                                dnsPort.send(v_dnsMsg);
//                                repeat;
//                            }
//                            else {
//                                log("*** " & __SCOPE__ & "ERROR: Could not successfully decode the DNS message ***");
//                                f_selfOrClientSyncAndVerdict("error", e_error);
//                            }
//                        }
                        if (
                                vc_dnsComponent!=null and 
                                (
                                    (v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dnsServerPort, 2))
                                    or (v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dnsServerPort, 2))
                                )
                            ) {
                            if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dnsMsg)!=0) {
                                dnsPort.send(v_dnsMsg);
                                repeat;
                            }
                            else {
                                log("*** " & __SCOPE__ & "ERROR: Could not successfully decode the DNS message ***");
                                f_selfOrClientSyncAndVerdict("error", e_error);
                            }
                        }
                    }
                    //TODO TCP???
                    
@@ -207,24 +214,6 @@ module AtsDSLite_Functions {
                ipPort.send(v_ipv6Pkt);
                repeat;
            }
// TODO To be removed
//            [] dhcpv6Port.receive(DHCPv6Msg:?) -> value v_dhcpMsg {
////                f_sendDhcpv6Msg(v_dhcpMsg, TODO src addr, TODO dst addr, c_dhcpv6ServerPort, c_dhcpv6ClientPort);
//                f_sendDhcpv6Msg(
//                                v_dhcpMsg,
//                                c_16ZeroBytes,
//                                c_all_DHCP_Servers,
//                                c_dhcpv6ServerPort,
//                                c_dhcpv6ClientPort
//                );                             
//                repeat;
//            }
//            [] dnsPort.receive(DnsMsg:?) -> value v_dnsMsg {
//                f_sendDnsMsg(v_dnsMsg, TODO src addr, TODO dst addr, c_dhcpv6ServerPort, c_dhcpv6ClientPort);
//                repeat;
//            }

// TODO Add support of ICMPv6
            [] ipPort.receive  { // Unsupported IPv6 messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "INFO: Received an unexpected IPv6 message, process it as an error ***");