Ejemplo n.º 1
0
        /// <summary>
        /// Creates the threadtype table based on IPv6/IPv4 support
        /// </summary>
        public MCtoUC(RegistrarServer registrar, TrafficType traffTypes)
        {
            this.registrar = registrar;

            if ((traffTypes & TrafficType.IPv4andIPv6) == TrafficType.IPv4andIPv6)
            {
                ThreadTypeData    = new TrafficType[4];
                ThreadTypeData[0] = TrafficType.IPv4RTP;
                ThreadTypeData[1] = TrafficType.IPv6RTP;
                ThreadTypeData[2] = TrafficType.IPv4RTCP;
                ThreadTypeData[3] = TrafficType.IPv6RTCP;
            }
            else if (((traffTypes & TrafficType.IPv4) == TrafficType.IPv4) ||
                     ((traffTypes & TrafficType.IPv6) == TrafficType.IPv6))
            {
                ThreadTypeData = new TrafficType[2];
                if ((traffTypes & TrafficType.IPv4) == TrafficType.IPv4)
                {
                    ThreadTypeData[0] = TrafficType.IPv4RTP;
                    ThreadTypeData[1] = TrafficType.IPv4RTCP;
                }
                else
                {
                    ThreadTypeData[0] = TrafficType.IPv6RTP;
                    ThreadTypeData[1] = TrafficType.IPv6RTCP;
                }
            }
            else
            {
                Debug.Assert(false);
                throw new Exception(Strings.EnableEitherIPv6OrIPv4);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the threadtype table based on IPv6/IPv4 support  
        /// </summary>
        public MCtoUC(RegistrarServer registrar, TrafficType traffTypes)
        {
            this.registrar = registrar;

            if ( (traffTypes & TrafficType.IPv4andIPv6) == TrafficType.IPv4andIPv6)
            {
                ThreadTypeData = new TrafficType[4];
                ThreadTypeData[0] = TrafficType.IPv4RTP;
                ThreadTypeData[1] = TrafficType.IPv6RTP;
                ThreadTypeData[2] = TrafficType.IPv4RTCP;
                ThreadTypeData[3] = TrafficType.IPv6RTCP;
            } 
            else if ( ((traffTypes & TrafficType.IPv4) == TrafficType.IPv4 ) || 
                ((traffTypes & TrafficType.IPv6) == TrafficType.IPv6 ) )
            {
                ThreadTypeData = new TrafficType[2];
                if ((traffTypes & TrafficType.IPv4) == TrafficType.IPv4)
                {
                    ThreadTypeData[0] = TrafficType.IPv4RTP;
                    ThreadTypeData[1] = TrafficType.IPv4RTCP;
                }
                else
                {
                    ThreadTypeData[0] = TrafficType.IPv6RTP;
                    ThreadTypeData[1] = TrafficType.IPv6RTCP;
                }
            } 
            else 
            {
                Debug.Assert(false);
                throw new Exception(Strings.EnableEitherIPv6OrIPv4);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initalizes a ThreadType(s) to keep the required initalization data for threads to start
        /// </summary>
        public UCtoUCMC(RegistrarServer registrar, TrafficType traffTypes)
        {
            this.registrar = registrar;

            // initialize multicast enabled flag...
            String setting = ConfigurationManager.AppSettings[AppConfig.SendMulticast];

            if (setting != null)
            {
                try
                {
                    SendMulticast = Boolean.Parse(setting);
                }
                catch (Exception)
                {
                    SendMulticast = true;
                }
            }

            if ((traffTypes & TrafficType.IPv4andIPv6) == TrafficType.IPv4andIPv6)
            {
                ThreadTypeData    = new TrafficType[4];
                ThreadTypeData[0] = TrafficType.IPv4RTP;
                ThreadTypeData[1] = TrafficType.IPv6RTP;
                ThreadTypeData[2] = TrafficType.IPv4RTCP;
                ThreadTypeData[3] = TrafficType.IPv6RTCP;
            }
            else if (((traffTypes & TrafficType.IPv4) == TrafficType.IPv4) ||
                     ((traffTypes & TrafficType.IPv6) == TrafficType.IPv6))
            {
                ThreadTypeData = new TrafficType[2];
                if ((traffTypes & TrafficType.IPv4) == TrafficType.IPv4)
                {
                    ThreadTypeData[0] = TrafficType.IPv4RTP;
                    ThreadTypeData[1] = TrafficType.IPv4RTCP;
                }
                else
                {
                    ThreadTypeData[0] = TrafficType.IPv6RTP;
                    ThreadTypeData[1] = TrafficType.IPv6RTCP;
                }
            }
            else
            {
                Debug.Assert(false);
                throw new Exception(Strings.EnableEitherIPv6OrIPv4);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initalizes a ThreadType(s) to keep the required initalization data for threads to start
        /// </summary>
        public UCtoUCMC(RegistrarServer registrar, TrafficType traffTypes)
        {
            this.registrar = registrar;

            // initialize multicast enabled flag...
            String setting = ConfigurationManager.AppSettings[AppConfig.SendMulticast];
            
            if (setting != null)
            {
                try
                {
                    SendMulticast = Boolean.Parse(setting);
                }
                catch (Exception)
                {
                    SendMulticast = true;
                }
            }

            if ( (traffTypes & TrafficType.IPv4andIPv6) == TrafficType.IPv4andIPv6)
            {
                ThreadTypeData = new TrafficType[4];
                ThreadTypeData[0] = TrafficType.IPv4RTP;
                ThreadTypeData[1] = TrafficType.IPv6RTP;
                ThreadTypeData[2] = TrafficType.IPv4RTCP;
                ThreadTypeData[3] = TrafficType.IPv6RTCP;
            } 
            else if ( ((traffTypes & TrafficType.IPv4) == TrafficType.IPv4 ) || 
                      ((traffTypes & TrafficType.IPv6) == TrafficType.IPv6 ) )
            {
                ThreadTypeData = new TrafficType[2];
                if ((traffTypes & TrafficType.IPv4) == TrafficType.IPv4)
                {
                    ThreadTypeData[0] = TrafficType.IPv4RTP;
                    ThreadTypeData[1] = TrafficType.IPv4RTCP;
                }
                else
                {
                    ThreadTypeData[0] = TrafficType.IPv6RTP;
                    ThreadTypeData[1] = TrafficType.IPv6RTCP;
                }
            } 
            else 
            {
                Debug.Assert(false);
                throw new Exception(Strings.EnableEitherIPv6OrIPv4);
            }
        }
Ejemplo n.º 5
0
        private void forceLeaveBtn_Click(object sender, System.EventArgs e)
        {
            ClientEntry entry = (ClientEntry)tableListBox.SelectedItem;

            // List is not empty
            if (entry != null)
            {
                if (RegistrarServer.ClientRegTable.ContainsKey(entry.ClientIP))
                {
                    RegistrarServer.ForceLeave(entry);
                    RefreshClientTable();
                }
                else
                {
                    MessageBox.Show(this, "The Client IP address does not exist. " +
                                    "Click the Refresh button to get the current list.", "ConferenceXP Reflector");
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This method start the .
        /// </summary>
        public void Start()
        {
            int         size = 0;
            TrafficType traffTypes;

            lock (ThreadTypeData)
            {
                if (idxThreadTypeData < ThreadTypeData.Length)
                {
                    traffTypes = ThreadTypeData[idxThreadTypeData];
                    Thread.CurrentThread.Name = "Reflector_MCtoUC_" + traffTypes.ToString();
                    idxThreadTypeData++;
                }
                else
                {
                    throw new Exception("Number of created threads exceed the number of thread types defined.");
                }
            }

            #region Assigning appropriate sockets to "(mc/uc)(Ref/Srv)Sock"
            // The Ref(erence) socket variables are assigned to the socket protocol that this thread is not listening on
            // but may use for inter-protocol communication. For example if mcSrvSock is an IPv4 socket, mcRefSock would be
            // an IPv6 socket and vice versa.
            IPEndPoint ipepTmpRef = null;
            IPEndPoint ipepTmpSrv = null;
            Socket     ucRefSock  = null;
            Socket     mcSrvSock  = null;
            Socket     ucSrvSock  = null;
            int        ucPort     = 0;


            switch (traffTypes)
            {
            case TrafficType.IPv4RTCP:
                ucPort     = ReflectorMgr.ReflectorUnicastRTPListenPort + 1;
                ipepTmpRef = new IPEndPoint(IPAddress.IPv6Any, 0);
                ipepTmpSrv = new IPEndPoint(IPAddress.Any, 0);
                ucRefSock  = ReflectorMgr.Sockets.SockUCv6RTCP;
                mcSrvSock  = ReflectorMgr.Sockets.SockMCv4RTCP;
                ucSrvSock  = ReflectorMgr.Sockets.SockUCv4RTCP;
                break;

            case TrafficType.IPv6RTCP:
                ucPort     = ReflectorMgr.ReflectorUnicastRTPListenPort + 1;
                ipepTmpSrv = new IPEndPoint(IPAddress.IPv6Any, 0);
                ipepTmpRef = new IPEndPoint(IPAddress.Any, 0);
                ucRefSock  = ReflectorMgr.Sockets.SockUCv4RTCP;
                mcSrvSock  = ReflectorMgr.Sockets.SockMCv6RTCP;
                ucSrvSock  = ReflectorMgr.Sockets.SockUCv6RTCP;
                break;

            case TrafficType.IPv4RTP:
                ucPort     = ReflectorMgr.ReflectorUnicastRTPListenPort;
                ipepTmpRef = new IPEndPoint(IPAddress.IPv6Any, 0);
                ipepTmpSrv = new IPEndPoint(IPAddress.Any, 0);
                ucRefSock  = ReflectorMgr.Sockets.SockUCv6RTP;
                mcSrvSock  = ReflectorMgr.Sockets.SockMCv4RTP;
                ucSrvSock  = ReflectorMgr.Sockets.SockUCv4RTP;
                break;

            case TrafficType.IPv6RTP:
                ucPort     = ReflectorMgr.ReflectorUnicastRTPListenPort;
                ipepTmpSrv = new IPEndPoint(IPAddress.IPv6Any, 0);
                ipepTmpRef = new IPEndPoint(IPAddress.Any, 0);
                ucRefSock  = ReflectorMgr.Sockets.SockUCv4RTP;
                mcSrvSock  = ReflectorMgr.Sockets.SockMCv6RTP;
                ucSrvSock  = ReflectorMgr.Sockets.SockUCv6RTP;
                break;

            default:
                Debug.Assert(false);
                throw new ArgumentException("Invalid traffic type combination");
            }
            #endregion

            ArrayList members = new ArrayList();

            byte[] buf = new byte[1500];

            while (true)
            {
                try
                {
                    EndPoint            sourceEP = new IPEndPoint(IPAddress.Any, 0);
                    IPPacketInformation ipPackInfo;
                    SocketFlags         flags = SocketFlags.None;

                    size = mcSrvSock.ReceiveMessageFrom(buf, 0, buf.Length, ref flags, ref sourceEP,
                                                        out ipPackInfo);

                    IPEndPoint sourceIpe = (IPEndPoint)sourceEP;

                    // If the packet's source address is the reflector's IP address then this packet
                    // was forwarded from Unicast to Multicast by the reflector. So, we shouldn't
                    // forward it to UC again. Also, "AND" this condition with source port
                    // equal to 7004/7005 to have the support running the reflector and CXPClient on the
                    // same machine.
                    if ((sourceIpe.Port != ucPort) || (!sourceIpe.Address.Equals(ReflectorMgr.MulticastInterfaceIP) &&
                                                       !sourceIpe.Address.Equals(ReflectorMgr.IPv6MulticastInterfaceIP)))
                    {
                        if ((traffTypes & TrafficType.RTP) == TrafficType.RTP)
                        {
                            ReflectorMgr.PC[ReflectorPC.ID.MulticastPacketsReceivedOther]++;
                        }

                        // Lookup the members of this multicast group.
                        RegistrarServer.MemberLookup(members, ipPackInfo.Address, 5004);
                        if (members.Count != 0)
                        {
                            // Send the data to each individual.
                            for (int j = 0; j < members.Count; j++)
                            {
                                if (((IPAddress)members[j]).AddressFamily == ucSrvSock.AddressFamily)
                                {
                                    ipepTmpSrv.Address = (IPAddress)members[j];
                                    ipepTmpSrv.Port    = ucPort;
                                    ucSrvSock.SendTo(buf, 0, size, SocketFlags.None, ipepTmpSrv);
                                }
                                else if ((ucRefSock != null) && (((IPAddress)members[j]).AddressFamily == ucRefSock.AddressFamily))
                                {
                                    ipepTmpRef.Address = (IPAddress)members[j];
                                    ipepTmpRef.Port    = ucPort;
                                    ucRefSock.SendTo(buf, 0, size, SocketFlags.None, ipepTmpRef);
                                }
                            }

                            if ((traffTypes & TrafficType.RTP) == TrafficType.RTP)
                            {
                                ReflectorMgr.PC[ReflectorPC.ID.MCtoUCPacketsSent] += members.Count;
                            }
                        }
                    }
                    else if ((traffTypes & TrafficType.RTP) == TrafficType.RTP)
                    {
                        ReflectorMgr.PC[ReflectorPC.ID.MulticastPacketsReceivedSelf]++;
                    }
                }
                // On stopping the service, avoid the AbortException written in the event viewer
                catch (ThreadAbortException) {}
                catch (Exception e) // Connection reset by peer! this happens occasionally when a UC client leaves.
                {
                    eventLog.WriteEntry("MCtoUC " + traffTypes + " Listener Exception - " + e.ToString(),
                                        EventLogEntryType.Warning, (int)ReflectorEventLog.ID.MCtoUCException);
                }
            }
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            // Override the system UICulture
            string cultureOverride = null;

            if ((cultureOverride = ConfigurationManager.AppSettings["MSR.LST.Reflector.UICulture"]) != null)
            {
                try {
                    CultureInfo ci = new CultureInfo(cultureOverride);
                    System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
                }
                catch { }
            }

            MSR.LST.UnhandledExceptionHandler.Register();

            refMgr    = ReflectorMgr.getInstance();
            registrar = refMgr.RegServer;

            StartService();
            while (true)
            {
                Console.Write(Strings.ReflectorConsole);
                string input = Console.ReadLine().ToLower(CultureInfo.CurrentCulture);
                switch (input)
                {
                case "p":
                    Console.WriteLine();
                    PrintTable();
                    Console.WriteLine();
                    break;

                case "q":
                    Console.WriteLine();
                    StopService();
                    Console.WriteLine();
                    return;

                case "h":
                    Console.WriteLine();
                    PrintHelp();
                    Console.WriteLine();
                    break;

                case "d":
                    //Console.WriteLine();
                    //DeleteClient();
                    //Console.WriteLine();
                    break;

                case "s":
                    Console.WriteLine();
                    StartService();
                    Console.WriteLine();
                    break;

                case "u":
                    Console.WriteLine();
                    ServiceStatus();
                    Console.WriteLine();
                    break;

                case "t":
                    Console.WriteLine();
                    StopService();
                    Console.WriteLine();
                    break;

                default:
                    Console.WriteLine();
                    Console.WriteLine("Invalid Command");
                    Console.WriteLine();
                    PrintHelp();
                    Console.WriteLine();
                    break;
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Forwards the traffic from unicast to unicast/multicast for the given trafficType
        /// </summary>
        public void Start()
        {
            int         size = 0;
            TrafficType traffTypes;

            lock (ThreadTypeData)
            {
                if (idxThreadTypeData < ThreadTypeData.Length)
                {
                    traffTypes = ThreadTypeData[idxThreadTypeData];
                    Thread.CurrentThread.Name = "Reflector_UCtoUCMC_" + traffTypes.ToString();
                    idxThreadTypeData++;
                }
                else
                {
                    throw new Exception("Number of created threads exceed the number of thread types defined.");
                }
            }


            #region Assigning appropriate sockets to "(mc/uc)(Ref/Srv)Sock"
            // The Ref(erence) socket variables are assigned to the socket protocol that this thread is not listening on
            // but may use for inter-protocol communication. For example if mcSrvSock is an IPv4 socket, mcRefSock would be
            // an IPv6 socket and vice versa.
            Socket   mcRefSock = null;
            Socket   ucRefSock = null;
            Socket   ucSrvSock = null;
            int      ucPort    = 0;
            EndPoint remoteEP  = null;

            switch (traffTypes)
            {
            case TrafficType.IPv4RTCP:
                ucPort    = ReflectorMgr.ReflectorUnicastRTPListenPort + 1;
                remoteEP  = new IPEndPoint(IPAddress.Any, 0);
                mcRefSock = ReflectorMgr.Sockets.SockMCv6RTCP;
                ucRefSock = ReflectorMgr.Sockets.SockUCv6RTCP;
                ucSrvSock = ReflectorMgr.Sockets.SockUCv4RTCP;
                break;

            case TrafficType.IPv6RTCP:
                ucPort    = ReflectorMgr.ReflectorUnicastRTPListenPort + 1;
                remoteEP  = new IPEndPoint(IPAddress.IPv6Any, 0);
                mcRefSock = ReflectorMgr.Sockets.SockMCv4RTCP;
                ucRefSock = ReflectorMgr.Sockets.SockUCv4RTCP;
                ucSrvSock = ReflectorMgr.Sockets.SockUCv6RTCP;
                break;

            case TrafficType.IPv4RTP:
                ucPort    = ReflectorMgr.ReflectorUnicastRTPListenPort;
                remoteEP  = new IPEndPoint(IPAddress.Any, 0);
                mcRefSock = ReflectorMgr.Sockets.SockMCv6RTP;
                ucRefSock = ReflectorMgr.Sockets.SockUCv6RTP;
                ucSrvSock = ReflectorMgr.Sockets.SockUCv4RTP;
                break;

            case TrafficType.IPv6RTP:
                ucPort    = ReflectorMgr.ReflectorUnicastRTPListenPort;
                remoteEP  = new IPEndPoint(IPAddress.IPv6Any, 0);
                mcRefSock = ReflectorMgr.Sockets.SockMCv4RTP;
                ucRefSock = ReflectorMgr.Sockets.SockUCv4RTP;
                ucSrvSock = ReflectorMgr.Sockets.SockUCv6RTP;
                break;

            default:
                Debug.Assert(false);
                throw new ArgumentException("Invalid traffic type combination");
            }

            #endregion

            IPAddress  remoteIP = null;
            IPEndPoint groupEP  = null;
            byte []    buf      = new byte[1500];
            ArrayList  members  = new ArrayList();

            while (true)
            {
                try
                {
                    size = ucSrvSock.ReceiveFrom(buf, ref remoteEP);

                    if ((traffTypes & TrafficType.RTP) == TrafficType.RTP)
                    {
                        ReflectorMgr.PC[ReflectorPC.ID.UnicastPacketsReceived]++;
                    }
                    else if ((traffTypes & TrafficType.RTCP) == TrafficType.RTCP)
                    {
                        // Update client's last RTCP property
                        ClientEntry entry = (ClientEntry)RegistrarServer.ClientRegTable[((IPEndPoint)remoteEP).Address];
                        entry.LastRTCP = DateTime.Now;
                    }

                    // lookup the (first) group which this client is a member of that group.
                    remoteIP = ((IPEndPoint)remoteEP).Address;
                    groupEP  = RegistrarServer.GroupLookup(remoteIP);
                    if (groupEP != null)
                    {
                        // Find the other members of the group
                        RegistrarServer.MemberLookup(members, groupEP.Address, groupEP.Port);

                        if ((traffTypes & TrafficType.RTCP) == TrafficType.RTCP)
                        {
                            groupEP = new IPEndPoint(groupEP.Address, groupEP.Port + 1);
                        }

                        // Send the data to the Multicast side
                        if (groupEP.AddressFamily == ucSrvSock.AddressFamily)
                        {
                            ucSrvSock.SendTo(buf, 0, size, SocketFlags.None, groupEP);
                        }
                        else if ((mcRefSock != null) && (groupEP.AddressFamily == ucRefSock.AddressFamily))
                        {
                            ucRefSock.SendTo(buf, 0, size, SocketFlags.None, groupEP);
                        }

                        // Send the data to all unicast client members except the sender.
                        for (int i = 0; i < members.Count; i++)
                        {
                            if (!remoteIP.Equals((IPAddress)members[i]))
                            {
                                if (((IPAddress)members[i]).AddressFamily == ucSrvSock.AddressFamily)
                                {
                                    ucSrvSock.SendTo(buf, 0, size, SocketFlags.None, new IPEndPoint((IPAddress)members[i], ucPort));
                                }
                                else if ((ucRefSock != null) && (((IPAddress)members[i]).AddressFamily == ucRefSock.AddressFamily))
                                {
                                    ucRefSock.SendTo(buf, 0, size, SocketFlags.None, new IPEndPoint((IPAddress)members[i], ucPort));
                                }
                            }
                        }

                        if ((traffTypes & TrafficType.RTP) == TrafficType.RTP)
                        {
                            ReflectorMgr.PC[ReflectorPC.ID.UCtoUCPacketsSent] += members.Count - 1;
                        }
                    }
                }
                // On stopping the service, avoid the AbortException written in the event viewer
                catch (ThreadAbortException) {}
                catch (Exception e) // Connection reset by peer! this happens occasionally when a UC client leaves.
                {
                    eventLog.WriteEntry("UCtoUCMC forwarder exception - TrafficType:" + traffTypes
                                        + " Packet received from: " + remoteEP
                                        + "\n" + e.ToString(), EventLogEntryType.Warning, (int)ReflectorEventLog.ID.UCtoUCMCException);
                }
            }
        }
Ejemplo n.º 9
0
        public AdminRemoting()
        {
            ReflectorMgr mgr = ReflectorMgr.getInstance();

            this.registrar = mgr.RegServer;
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            // Override the system UICulture
            string cultureOverride = null;
            if ((cultureOverride = ConfigurationManager.AppSettings["MSR.LST.Reflector.UICulture"]) != null) {
                try {
                    CultureInfo ci = new CultureInfo(cultureOverride);
                    System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
                }
                catch { }
            }

            MSR.LST.UnhandledExceptionHandler.Register();

            refMgr = ReflectorMgr.getInstance();
            registrar = refMgr.RegServer;

            StartService();
            while (true)
            {
                Console.Write(Strings.ReflectorConsole);
                string input = Console.ReadLine().ToLower(CultureInfo.CurrentCulture);
                switch (input)
                {
                    case "p":
                        Console.WriteLine();
                        PrintTable();
                        Console.WriteLine();
                        break;
                    case "q":
                        Console.WriteLine();
                        StopService();
                        Console.WriteLine();
                        return;
                    case "h":
                        Console.WriteLine();
                        PrintHelp();
                        Console.WriteLine();
                        break;
                    case "d":
                        //Console.WriteLine();
                        //DeleteClient();
                        //Console.WriteLine();
                        break;
                    case "s":
                        Console.WriteLine();
                        StartService();
                        Console.WriteLine();
                        break;
                    case "u":
                        Console.WriteLine();
                        ServiceStatus();
                        Console.WriteLine();
                        break;
                    case "t":
                        Console.WriteLine();
                        StopService();
                        Console.WriteLine();
                        break;
                    default:
                        Console.WriteLine();
                        Console.WriteLine("Invalid Command");
                        Console.WriteLine();
                        PrintHelp();
                        Console.WriteLine();
                        break;
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// The constructor which reads config setting and calls the constructor for the sockets and three servers.
        /// </summary>
        public ReflectorMgr()
        {
            string setting;

            if ( (setting = ConfigurationManager.AppSettings[AppConfig.JoinPort]) != null )
            {
                registrarServerPort = int.Parse(setting);
            }

            if ( (setting = ConfigurationManager.AppSettings[AppConfig.UnicastPort] ) != null )
            {
                reflectorUnicastRTPListenPort = int.Parse(setting);
            }

            TimeSpan timeoutPeriod = TimeSpan.Zero;
            if ( (setting = ConfigurationManager.AppSettings[AppConfig.TimeOutMinutes] ) != null )
            {
                // Minutes
                timeoutPeriod = new TimeSpan(0, int.Parse(setting), 0);
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.MultipleInterfaceSupport] ) != null)
            {
                multipleInterfaceSupport = bool.Parse(setting);
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.IPv4Support] ) != null)
            {
                if(bool.Parse(setting))
                {
                    enabledTrafficTypes |= TrafficType.IPv4;
                }
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.IPv6Support] ) != null)
            {
                if(bool.Parse(setting))
                {
                    if (Socket.OSSupportsIPv6)
                    {
                        enabledTrafficTypes |= TrafficType.IPv6;
                    }
                    else
                    {
                        eventLog.WriteEntry("IPv6 not enabled in OS.  Ignoring IPv6 from app.config.",
                            EventLogEntryType.Warning, ReflectorEventLog.ID.Error);
                    }
                }
            }

            // If the user has set both IPv6 support and IPv4 support to false, we go to default
            // config: IPv4Support only.
            if (enabledTrafficTypes < TrafficType.IPv4)
            {
                enabledTrafficTypes = TrafficType.IPv4;
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.MCLoopbackOff] ) != null)
            {
                mcLoopbackOff = bool.Parse(setting);
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.MulticastInterfaceRouteIndex] ) != null)
            {
                // Route print produces a hexadecimal number
                mcInterfaceRouteIndex = Convert.ToInt32(setting, 16);
            }

            if ((enabledTrafficTypes & TrafficType.IPv4) == TrafficType.IPv4)
            {

                if ( ((setting = ConfigurationManager.AppSettings[AppConfig.MulticastInterfaceIP] ) != null)
                    && multipleInterfaceSupport)
                {
                    multicastInterfaceIP = IPAddress.Parse(setting);
                }
                else
                {
                    //Workaround: Pass a generic IPv4 multicast IP.
                    multicastInterfaceIP = Utility.GetLocalRoutingInterface(IPAddress.Parse("233.4.5.6"));
                }

                if (((setting = ConfigurationManager.AppSettings[AppConfig.UnicastInterfaceIP] ) != null)
                    && multipleInterfaceSupport)
                {
                    unicastInterfaceIP = IPAddress.Parse(setting);
                }
                else
                {
                    // The interface which is routed toward the Root name servers
                    unicastInterfaceIP = Utility.GetLocalRoutingInterface(IPAddress.Parse("198.41.0.4"));
                }
            }

            if ((enabledTrafficTypes & TrafficType.IPv6) == TrafficType.IPv6)
            {

                if ( ((setting = ConfigurationManager.AppSettings[AppConfig.IPv6MulticastInterfaceIP] ) != null)
                    && multipleInterfaceSupport)
                {
                    IPv6multicastInterfaceIP = IPAddress.Parse(setting);
                }
                else
                {
                    //Workaround: Pass a generic IPv6 multicast IP.
                    IPv6multicastInterfaceIP = Utility.GetLocalRoutingInterface(IPAddress.Parse("ff1e::1"));
                }

                if (((setting = ConfigurationManager.AppSettings[AppConfig.IPv6UnicastInterfaceIP] ) != null)
                    && multipleInterfaceSupport)
                {
                    IPv6unicastInterfaceIP = IPAddress.Parse(setting);
                }
                else
                {
                    // The interface which is routed toward 6bone.net
                    IPv6unicastInterfaceIP = Utility.GetLocalRoutingInterface(IPAddress.Parse("2001:5c0:0:2::24"));
                }
            }

            try
            {
                sockets = new ReflectorSockets(enabledTrafficTypes);
            }
            catch(Exception e)
            {
                eventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, (int)ReflectorEventLog.ID.Error);
                throw;
            }

            regServer = new RegistrarServer(enabledTrafficTypes, timeoutPeriod);
            UMforwarder = new UCtoUCMC(enabledTrafficTypes);
            MUforwarder = new MCtoUC(enabledTrafficTypes);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// The constructor which reads config setting and calls the constructor for the sockets and three servers.
        /// </summary>
        public ReflectorMgr()
        {
            string setting;

            if ((setting = ConfigurationManager.AppSettings[AppConfig.JoinPort]) != null)
            {
                registrarServerPort = int.Parse(setting);
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.UnicastPort]) != null)
            {
                reflectorUnicastRTPListenPort = int.Parse(setting);
            }

            TimeSpan timeoutPeriod = TimeSpan.Zero;

            if ((setting = ConfigurationManager.AppSettings[AppConfig.TimeOutMinutes]) != null)
            {
                // Minutes
                timeoutPeriod = new TimeSpan(0, int.Parse(setting), 0);
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.MultipleInterfaceSupport]) != null)
            {
                multipleInterfaceSupport = bool.Parse(setting);
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.IPv4Support]) != null)
            {
                if (bool.Parse(setting))
                {
                    enabledTrafficTypes |= TrafficType.IPv4;
                }
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.IPv6Support]) != null)
            {
                if (bool.Parse(setting))
                {
                    if (Socket.OSSupportsIPv6)
                    {
                        enabledTrafficTypes |= TrafficType.IPv6;
                    }
                    else
                    {
                        eventLog.WriteEntry("IPv6 not enabled in OS.  Ignoring IPv6 from app.config.",
                                            EventLogEntryType.Warning, ReflectorEventLog.ID.Error);
                    }
                }
            }

            // If the user has set both IPv6 support and IPv4 support to false, we go to default
            // config: IPv4Support only.
            if (enabledTrafficTypes < TrafficType.IPv4)
            {
                enabledTrafficTypes = TrafficType.IPv4;
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.MCLoopbackOff]) != null)
            {
                mcLoopbackOff = bool.Parse(setting);
            }

            if ((setting = ConfigurationManager.AppSettings[AppConfig.MulticastInterfaceRouteIndex]) != null)
            {
                // Route print produces a hexadecimal number
                mcInterfaceRouteIndex = Convert.ToInt32(setting, 16);
            }

            if ((enabledTrafficTypes & TrafficType.IPv4) == TrafficType.IPv4)
            {
                if (((setting = ConfigurationManager.AppSettings[AppConfig.MulticastInterfaceIP]) != null) &&
                    multipleInterfaceSupport)
                {
                    multicastInterfaceIP = IPAddress.Parse(setting);
                }
                else
                {
                    //Workaround: Pass a generic IPv4 multicast IP.
                    multicastInterfaceIP = Utility.GetLocalRoutingInterface(IPAddress.Parse("233.4.5.6"));
                }


                if (((setting = ConfigurationManager.AppSettings[AppConfig.UnicastInterfaceIP]) != null) &&
                    multipleInterfaceSupport)
                {
                    unicastInterfaceIP = IPAddress.Parse(setting);
                }
                else
                {
                    // The interface which is routed toward the Root name servers
                    unicastInterfaceIP = Utility.GetLocalRoutingInterface(IPAddress.Parse("198.41.0.4"));
                }
            }

            if ((enabledTrafficTypes & TrafficType.IPv6) == TrafficType.IPv6)
            {
                if (((setting = ConfigurationManager.AppSettings[AppConfig.IPv6MulticastInterfaceIP]) != null) &&
                    multipleInterfaceSupport)
                {
                    IPv6multicastInterfaceIP = IPAddress.Parse(setting);
                }
                else
                {
                    //Workaround: Pass a generic IPv6 multicast IP.
                    IPv6multicastInterfaceIP = Utility.GetLocalRoutingInterface(IPAddress.Parse("ff1e::1"));
                }


                if (((setting = ConfigurationManager.AppSettings[AppConfig.IPv6UnicastInterfaceIP]) != null) &&
                    multipleInterfaceSupport)
                {
                    IPv6unicastInterfaceIP = IPAddress.Parse(setting);
                }
                else
                {
                    // The interface which is routed toward 6bone.net
                    IPv6unicastInterfaceIP = Utility.GetLocalRoutingInterface(IPAddress.Parse("2001:5c0:0:2::24"));
                }
            }

            try
            {
                sockets = new ReflectorSockets(enabledTrafficTypes);
            }
            catch (Exception e)
            {
                eventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, (int)ReflectorEventLog.ID.Error);
                throw;
            }

            regServer   = new RegistrarServer(enabledTrafficTypes, timeoutPeriod);
            UMforwarder = new UCtoUCMC(enabledTrafficTypes);
            MUforwarder = new MCtoUC(enabledTrafficTypes);
        }
Ejemplo n.º 13
0
 public AdminRemoting()
 {
     ReflectorMgr mgr = ReflectorMgr.getInstance();
     this.registrar = mgr.RegServer;
 }