コード例 #1
0
 /// <summary>
 /// Forwards the specified port, optionally for the specified protocol only.
 /// </summary>
 /// <param name="port">The port to forward.</param>
 /// <param name="protocol">If specified, must be either ProcotolType.Tcp or
 /// ProtocolType.Udp to forward the port only for the TCP or the UDP protocol,
 /// respectively. If this is null, the port will be forwarded for both
 /// protocols.</param>
 /// <param name="description">A description of the port-forwarding rule that
 /// may be displayed in the UPnP-device's user interface to help the user
 /// better understand what the port-forwarding rule is for.</param>
 /// <exception cref="ArgumentOutOfRangeException">The port parameter is not
 /// between 0 and 65535.</exception>
 /// <exception cref="ArgumentException">The protocol parameter has a value
 /// other than ProtocolType.Tcp or ProtocolType.Udp.</exception>
 /// <exception cref="InvalidOperationException">Querying for UPnP-enabled
 /// devices failed, or an error occurred while trying to forward the
 /// specified port.</exception>
 public static void ForwardPort(int port,
                                ProtocolType?protocol = null, string description = null)
 {
     port.ThrowIfOutOfRange("port", 0, 65535);
     if (protocol.HasValue && protocol != ProtocolType.Tcp &&
         protocol != ProtocolType.Udp)
     {
         throw new ArgumentException("The argument parameter must be either " +
                                     "ProtocolType.Tcp or ProtocolType.Udp");
     }
     VerifyCache();
     foreach (UPnPDevice wanDevice in cachedDevices)
     {
         // Get local IP addresses of WAN device.
         if (!(wanDevice is IUPnPDeviceDocumentAccess))
         {
             continue;
         }
         var uPnPDoc = wanDevice as IUPnPDeviceDocumentAccess;
         IEnumerable <IPAddress> localIPs = uPnPDoc.GetLocalIpAddresses();
         // Check if any of the WAN device's addresses are in the same subnet
         // as any of the host's addresses.
         foreach (IPAddress local in localIPs)
         {
             var ips = Socks5Bytestreams.GetIpAddresses(local);
             // If so, perform port forwarding.
             foreach (var ip in ips)
             {
                 ForwardPort(wanDevice, ip, port, protocol, description);
             }
         }
     }
 }
コード例 #2
0
 internal FileTransferSettings(Socks5Bytestreams socks5, SIFileTransfer siFileTransfer)
 {
     socks5.ThrowIfNull <Socks5Bytestreams>("socks5");
     siFileTransfer.ThrowIfNull <SIFileTransfer>("siFileTransfer");
     this.socks5         = socks5;
     this.siFileTransfer = siFileTransfer;
 }
コード例 #3
0
ファイル: XmppClient.cs プロジェクト: lcmxiaoya/xmpp-source
 private void LoadExtensions()
 {
     this.version                = this.im.LoadExtension <SoftwareVersion>();
     this.sdisco                 = this.im.LoadExtension <ServiceDiscovery>();
     this.ecapa                  = this.im.LoadExtension <EntityCapabilities>();
     this.ping                   = this.im.LoadExtension <S22.Xmpp.Extensions.Ping>();
     this.attention              = this.im.LoadExtension <Attention>();
     this.time                   = this.im.LoadExtension <EntityTime>();
     this.block                  = this.im.LoadExtension <BlockingCommand>();
     this.pep                    = this.im.LoadExtension <Pep>();
     this.userTune               = this.im.LoadExtension <UserTune>();
     this.userAvatar             = this.im.LoadExtension <UserAvatar>();
     this.userMood               = this.im.LoadExtension <UserMood>();
     this.dataForms              = this.im.LoadExtension <DataForms>();
     this.featureNegotiation     = this.im.LoadExtension <FeatureNegotiation>();
     this.streamInitiation       = this.im.LoadExtension <StreamInitiation>();
     this.siFileTransfer         = this.im.LoadExtension <SIFileTransfer>();
     this.inBandBytestreams      = this.im.LoadExtension <InBandBytestreams>();
     this.userActivity           = this.im.LoadExtension <UserActivity>();
     this.socks5Bytestreams      = this.im.LoadExtension <Socks5Bytestreams>();
     this.FileTransferSettings   = new S22.Xmpp.Client.FileTransferSettings(this.socks5Bytestreams, this.siFileTransfer);
     this.serverIpCheck          = this.im.LoadExtension <ServerIpCheck>();
     this.inBandRegistration     = this.im.LoadExtension <InBandRegistration>();
     this.chatStateNotifications = this.im.LoadExtension <ChatStateNotifications>();
     this.bitsOfBinary           = this.im.LoadExtension <BitsOfBinary>();
 }
コード例 #4
0
ファイル: XmppClient.cs プロジェクト: REPLDigital/Sharp.Xmpp
        /// <summary>
        /// Initializes the various XMPP extension modules.
        /// </summary>
        private void LoadExtensions()
        {
            version = im.LoadExtension<SoftwareVersion>();
            sdisco = im.LoadExtension<ServiceDiscovery>();
            ecapa = im.LoadExtension<EntityCapabilities>();
            ping = im.LoadExtension<Ping>();
            attention = im.LoadExtension<Attention>();
            time = im.LoadExtension<EntityTime>();
            block = im.LoadExtension<BlockingCommand>();
            pep = im.LoadExtension<Pep>();
            userTune = im.LoadExtension<UserTune>();
#if WINDOWSPLATFORM
            userAvatar = im.LoadExtension<UserAvatar>();
#endif
            userMood = im.LoadExtension<UserMood>();
            dataForms = im.LoadExtension<DataForms>();
            featureNegotiation = im.LoadExtension<FeatureNegotiation>();
            streamInitiation = im.LoadExtension<StreamInitiation>();
            siFileTransfer = im.LoadExtension<SIFileTransfer>();
            inBandBytestreams = im.LoadExtension<InBandBytestreams>();
            userActivity = im.LoadExtension<UserActivity>();
            socks5Bytestreams = im.LoadExtension<Socks5Bytestreams>();
            FileTransferSettings = new FileTransferSettings(socks5Bytestreams,
                siFileTransfer);
            serverIpCheck = im.LoadExtension<ServerIpCheck>();
            messageCarbons = im.LoadExtension<MessageCarbons>();
            inBandRegistration = im.LoadExtension<InBandRegistration>();
            chatStateNotifications = im.LoadExtension<ChatStateNotifications>();
            bitsOfBinary = im.LoadExtension<BitsOfBinary>();
            vcardAvatars = im.LoadExtension<VCardAvatars>();
            cusiqextension = im.LoadExtension<CustomIqExtension>();
            messageArchiving = im.LoadExtension<MessageArchiving>();
            messageArchiveManagement = im.LoadExtension<MessageArchiveManagement>();
            multiUserChat = im.LoadExtension<MultiUserChat>();
            serviceAdministration = im.LoadExtension<ServiceAdministration>();
            adHocCommands = im.LoadExtension<AdHocCommands>();
            directMucInvitations = im.LoadExtension<DirectMucInvitations>();
        }
コード例 #5
0
		/// <summary>
		/// Initializes a new instance of the FileTransferSettings class.
		/// </summary>
		/// <param name="socks5">A reference to the Socks5Bytestreams
		/// instance.</param>
		/// <param name="siFileTransfer">A reference to the SIFileTransfer
		/// instance.</param>
		/// <exception cref="ArgumentNullException">The socks5 parameter is
		/// null.</exception>
		internal FileTransferSettings(Socks5Bytestreams socks5,
			SIFileTransfer siFileTransfer) {
			socks5.ThrowIfNull("socks5");
			siFileTransfer.ThrowIfNull("siFileTransfer");
			this.socks5 = socks5;
			this.siFileTransfer = siFileTransfer;
		}
コード例 #6
0
ファイル: XmppClient.cs プロジェクト: BlueBasher/S22.Xmpp
		/// <summary>
		/// Initializes the various XMPP extension modules.
		/// </summary>
		void LoadExtensions() {
			version = im.LoadExtension<SoftwareVersion>();
			sdisco = im.LoadExtension<ServiceDiscovery>();
			ecapa = im.LoadExtension<EntityCapabilities>();
			ping = im.LoadExtension<Ping>();
			attention = im.LoadExtension<Attention>();
			time = im.LoadExtension<EntityTime>();
			block = im.LoadExtension<BlockingCommand>();
			pep = im.LoadExtension<Pep>();
			userTune = im.LoadExtension<UserTune>();
			userAvatar = im.LoadExtension<UserAvatar>();
			userMood = im.LoadExtension<UserMood>();
			dataForms = im.LoadExtension<DataForms>();
			featureNegotiation = im.LoadExtension<FeatureNegotiation>();
			streamInitiation = im.LoadExtension<StreamInitiation>();
			siFileTransfer = im.LoadExtension<SIFileTransfer>();
			inBandBytestreams = im.LoadExtension<InBandBytestreams>();
			userActivity = im.LoadExtension<UserActivity>();
			socks5Bytestreams = im.LoadExtension<Socks5Bytestreams>();
			FileTransferSettings = new FileTransferSettings(socks5Bytestreams,
				siFileTransfer);
			serverIpCheck = im.LoadExtension<ServerIpCheck>();
			inBandRegistration = im.LoadExtension<InBandRegistration>();
			chatStateNotifications = im.LoadExtension<ChatStateNotifications>();
			bitsOfBinary = im.LoadExtension<BitsOfBinary>();
		}