Example #1
0
 /// <summary>
 /// HTTP头部接收错误
 /// </summary>
 protected override void headerError()
 {
     form.Clear();
     pub.Dispose(ref SslStream);
     pub.Dispose(ref networkStream);
     if (Socket != null)
     {
         fastCSharp.threading.disposeTimer.Default.addSocketClose(Socket);
     }
     if (Ipv6.Ip == null)
     {
         if ((Socket = server.SocketEnd(Ipv4)) != null)
         {
             start();
             return;
         }
     }
     else
     {
         if ((Socket = server.SocketEnd(ref Ipv6)) != null)
         {
             start();
             return;
         }
         Ipv6.Null();
     }
     typePool <sslStream> .PushNotNull(this);
 }
Example #2
0
 /// <summary>
 /// WebSocket结束
 /// </summary>
 protected override void webSocketEnd()
 {
     Interlocked.Increment(ref identity);
     webSocket.socket webSocket = webSocketReceiver.WebSocket;
     webSocketReceiver.WebSocket = null;
     pub.Dispose(ref SslStream);
     pub.Dispose(ref networkStream);
     if (Socket != null)
     {
         fastCSharp.threading.disposeTimer.Default.addSocketClose(Socket);
     }
     webSocket.Close();
     if (Ipv6.Ip == null)
     {
         if ((Socket = server.SocketEnd(Ipv4)) != null)
         {
             start();
             return;
         }
     }
     else
     {
         if ((Socket = server.SocketEnd(ref Ipv6)) != null)
         {
             start();
             return;
         }
         Ipv6.Null();
     }
     typePool <sslStream> .PushNotNull(this);
 }
Example #3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ServiceName != null)
         {
             hashCode = hashCode * 59 + ServiceName.GetHashCode();
         }
         if (Ipv4 != null)
         {
             hashCode = hashCode * 59 + Ipv4.GetHashCode();
         }
         if (Ipv6 != null)
         {
             hashCode = hashCode * 59 + Ipv6.GetHashCode();
         }
         if (Port != null)
         {
             hashCode = hashCode * 59 + Port.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #4
0
        /// <summary>
        /// Returns true if Endpoint instances are equal
        /// </summary>
        /// <param name="other">Instance of Endpoint to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Endpoint other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ServiceName == other.ServiceName ||
                     ServiceName != null &&
                     ServiceName.Equals(other.ServiceName)
                     ) &&
                 (
                     Ipv4 == other.Ipv4 ||
                     Ipv4 != null &&
                     Ipv4.Equals(other.Ipv4)
                 ) &&
                 (
                     Ipv6 == other.Ipv6 ||
                     Ipv6 != null &&
                     Ipv6.Equals(other.Ipv6)
                 ) &&
                 (
                     Port == other.Port ||
                     Port != null &&
                     Port.Equals(other.Port)
                 ));
        }
Example #5
0
            /// <summary>
            /// TBD
            /// </summary>
            /// <param name="name">TBD</param>
            /// <param name="ipv4">TBD</param>
            /// <param name="ipv6">TBD</param>
            public Resolved(string name, IEnumerable <IPAddress> ipv4, IEnumerable <IPAddress> ipv6)
            {
                Name = name;
                Ipv4 = ipv4?.ToImmutableList() ?? ImmutableList <IPAddress> .Empty;
                Ipv6 = ipv6?.ToImmutableList() ?? ImmutableList <IPAddress> .Empty;

                _addr = Ipv4.FirstOrDefault() ?? Ipv6.FirstOrDefault();
            }
Example #6
0
        /// <summary>
        /// Se encarga de crear y mostrar una direccion ipv6 representada en sistema binario
        /// </summary>
        /// <param name="ipv6">Recibe un arreglo con la direccion en decimal</param>
        public static void addAdressIpv6(ushort [] ipv6)
        {
            Direction <Ipv6> directionsIpv6 = new Direction <Ipv6>(1); //Crea un objeto de la clase generica tipo clase ipv6

            directionsIpv6.Write(new Ipv6(ipv6));                      //Escribe una direccion ipv6 representada en binario
            Ipv6 d1 = directionsIpv6.GetItem(0);                       //Se crea un objeto de la clase ipv6 para poder mostrar su direccion representada en binario

            d1.getDirection();                                         //Se muestra la direccion
        }
Example #7
0
 internal Network(CiscoTelePresenceCodec codec, int indexer)
     : base(codec, indexer)
 {
     _cdp      = new Cdp(this, "CDP");
     _dns      = new Dns(this, "DNS");
     _ethernet = new Ethernet(this, "Ethernet");
     _ipv4     = new Ipv4(this, "IPV4");
     _ipv6     = new Ipv6(this, "IPV6");
     _vlan     = new Vlan(this, "VLAN");
 }
Example #8
0
 public VpnService(
     ILogger logger,
     IEnumerable <ServiceHostFactory> serviceHostsFactories,
     IVpnConnection vpnConnection,
     Ipv6 ipv6)
 {
     _ipv6                  = ipv6;
     _logger                = logger;
     _vpnConnection         = vpnConnection;
     _serviceHostsFactories = new List <ServiceHostFactory>(serviceHostsFactories);
     _hosts                 = new List <SafeServiceHost>();
     InitializeComponent();
 }
Example #9
0
        public override int GetHashCode()
        {
            int h = 1;

            h *= 1000003;
            h ^= (ServiceName == null) ? 0 : ServiceName.GetHashCode();
            h *= 1000003;
            h ^= (Ipv4 == null) ? 0 : Ipv4.GetHashCode();
            h *= 1000003;
            h ^= (Ipv6 == null) ? 0 : Ipv6.GetHashCode();
            h *= 1000003;
            h ^= Port.GetHashCode();
            return(h);
        }
Example #10
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            var ipAddr = obj as IpAddress;

            if (ipAddr == null)
            {
                return(false);
            }

            return(Ipv6.SequenceEqual(ipAddr.Ipv6));
        }
Example #11
0
        public Ipv6HandlingWrapper(
            IServiceSettings serviceSettings,
            IFirewall firewall,
            ObservableNetworkInterfaces networkInterfaces,
            Ipv6 ipv6,
            ITaskQueue taskQueue,
            IVpnConnection origin)
        {
            _serviceSettings = serviceSettings;
            _firewall        = firewall;
            _ipv6            = ipv6;
            _taskQueue       = taskQueue;
            _origin          = origin;

            _origin.StateChanged                     += Origin_StateChanged;
            _serviceSettings.SettingsChanged         += OnServiceSettingsChanged;
            networkInterfaces.NetworkInterfacesAdded += NetworkInterfaces_NetworkInterfacesAdded;
        }
Example #12
0
        public VpnService(
            ILogger logger,
            Common.Configuration.Config config,
            IOsProcesses osProcesses,
            IEnumerable <ServiceHostFactory> serviceHostsFactories,
            IVpnConnection vpnConnection,
            Ipv6 ipv6)
        {
            _logger                = logger;
            _config                = config;
            _osProcesses           = osProcesses;
            _serviceHostsFactories = new List <ServiceHostFactory>(serviceHostsFactories);
            _vpnConnection         = vpnConnection;
            _ipv6 = ipv6;

            _hosts = new List <SafeServiceHost>();
            InitializeComponent();
        }
Example #13
0
        public override bool Equals(object o)
        {
            if (o == this)
            {
                return(true);
            }

            if (!(o is ZipkinEndpoint))
            {
                return(false);
            }

            ZipkinEndpoint that = (ZipkinEndpoint)o;

            return(((ServiceName == null)
              ? (that.ServiceName == null) : ServiceName.Equals(that.ServiceName)) &&
                   ((Ipv4 == null) ? (that.Ipv4 == null) : Ipv4.Equals(that.Ipv4)) &&
                   ((Ipv6 == null) ? (that.Ipv6 == null) : Ipv6.Equals(that.Ipv6)) &&
                   Port.Equals(that.Port));
        }