コード例 #1
0
        protected Dispatcher(Connection conn, string channel_type, string [] property_keys)
        {
            this.conn = conn;
            ChannelType = channel_type;
            this.property_keys = property_keys;

            InitializeRequestsInterface ();
        }
コード例 #2
0
        public void AddConnection(Connection conn)
        {
            if (conns.Contains (conn))
                throw new Exception ("Cannot add connection");

            conns.Add (conn);
            conn.Register (Path, this);
            //((ExportObject)conn.RegisteredObjects[Path]).Registered = false;
        }
コード例 #3
0
        protected Channel(Connection conn)
        {
            if (conn == null) {
                throw new ArgumentNullException ("conn");
            }

            this.conn = conn;
            InitializeRequestsInterface ();
        }
        public ContactListChannel(Connection conn, string target_id)
            : base(conn)
        {
            if (target_id == null) {
                throw new ArgumentNullException ("target_id");
            }

            this.target_id = target_id;
            ChannelType = Constants.CHANNEL_TYPE_CONTACTLIST;
        }
コード例 #5
0
        protected Channel(Connection conn, uint target_handle, string channel_type)
            : this(conn)
        {
            if (target_handle == 0 || target_handle == conn.SelfHandle) {
                throw new ArgumentException ("Invalid TargetId", "target_id");
            }

            this.target_handle = target_handle;
            this.ChannelType = channel_type;
        }
コード例 #6
0
        public static ExportObject CreateExportObject(Connection conn, ObjectPath object_path, object obj)
        {
            Type type = obj.GetType ();

            #if DLR
            if (type.Name == "RubyObject" || type.FullName == "IronPython.Runtime.Types.OldInstance")
                return new DynamicExportObject (conn, object_path, obj);
            #endif

            return new ExportObject (conn, object_path, obj);
        }
コード例 #7
0
		public static void Init (Connection conn)
		{
			IOFunc dispatchHandler = delegate (IOChannel source, IOCondition condition, IntPtr data) {
				if ((condition & IOCondition.Hup) == IOCondition.Hup) {
					if (Protocol.Verbose)
						Console.Error.WriteLine ("Warning: Connection was probably hung up (" + condition + ")");

					//TODO: handle disconnection properly, consider memory management
					return false;
				}

				//this may not provide expected behaviour all the time, but works for now
				conn.Iterate ();
				return true;
			};

			Init (conn, dispatchHandler);
		}
コード例 #8
0
 public PendingCall(Connection conn)
 {
     this.conn = conn;
 }
コード例 #9
0
 public NameRequisition(Connection connection, bool allowReplacement)
 {
     this.Connection = connection;
     this.AllowReplacement = allowReplacement;
 }
コード例 #10
0
        public void RemoveConnection(Connection conn)
        {
            Console.Error.WriteLine ("RemoveConn");

            if (!conns.Remove (conn))
                throw new Exception ("Cannot remove connection");

            //conn.Unregister (Path);

            List<string> namesToDisown = new List<string> ();
            foreach (KeyValuePair<string, Connection> pair in Names) {
                if (pair.Value == conn)
                    namesToDisown.Add (pair.Key);
            }

            List<MatchRule> toRemove = new List<MatchRule> ();
            foreach (KeyValuePair<MatchRule, List<Connection>> pair in Rules) {
                //while (pair.Value.Remove (Caller)) { }
                while (pair.Value.Remove (conn)) { }
                //while (pair.Value.Remove (Caller)) { Console.WriteLine ("Remove!"); }
                //pair.Value.RemoveAll ( delegate (Connection conn) { conn == Caller; } )
                if (pair.Value.Count == 0)
                    toRemove.Add (pair.Key);
                //Rules.Remove (pair);
                //Rules.Remove<KeyValuePair<MatchRule,List<Connection>>> (pair);
                //((ICollection<System.Collections.Generic.KeyValuePair<MatchRule,List<Connection>>>)Rules).Remove<KeyValuePair<MatchRule,List<Connection>>> (pair);
                //((ICollection<System.Collections.Generic.KeyValuePair<MatchRule,List<Connection>>>)Rules).Remove (pair);
            }

            foreach (MatchRule r in toRemove)
                Rules.Remove (r);

            // TODO: Check the order of signals
            // TODO: Atomicity

            foreach (string name in namesToDisown)
                Names.Remove (name);

            foreach (string name in namesToDisown)
                NameOwnerChanged (name, ((ServerConnection)conn).UniqueName, String.Empty);

            // TODO: Unregister earlier?
            conn.Unregister (Path);
        }
コード例 #11
0
ファイル: BusObject.cs プロジェクト: 0x0mar/aircrack-ng
		public static object GetObject (Connection conn, string bus_name, ObjectPath object_path, Type declType)
		{
			Type proxyType = TypeImplementer.GetImplementation (declType);

			BusObject inst = (BusObject)Activator.CreateInstance (proxyType);
			inst.conn = conn;
			inst.bus_name = bus_name;
			inst.object_path = object_path;

			return inst;
		}
コード例 #12
0
		public ExportObject (Connection conn, string bus_name, ObjectPath object_path, object obj) : base (conn, bus_name, object_path)
		{
			this.obj = obj;
		}
コード例 #13
0
		static void Init (Connection conn, IOFunc dispatchHandler)
		{
			IOChannel channel = new IOChannel ((int)conn.Transport.SocketHandle);
			IO.AddWatch (channel, IOCondition.In | IOCondition.Hup, dispatchHandler);
		}
コード例 #14
0
ファイル: UsbDriveInfoLinux.cs プロジェクト: sillsdev/chack
 private static bool DeviceIsOnUsbBus(Connection conn, string halNameOnDbus, HalDevice device)
 {
     bool deviceIsOnUsbSubsystem;
     bool thereIsAPathToParent;
     do
     {
         string subsystem = TryGetDevicePropertyString(device, "info.subsystem");
         deviceIsOnUsbSubsystem = subsystem.Contains("usb");
         string pathToParent = TryGetDevicePropertyString(device, "info.parent");
         thereIsAPathToParent = String.IsNullOrEmpty(pathToParent);
         device = conn.GetObject<HalDevice>(halNameOnDbus, new ObjectPath(pathToParent));
     } while (!deviceIsOnUsbSubsystem && !thereIsAPathToParent);
     return deviceIsOnUsbSubsystem;
 }
コード例 #15
0
 public ExportObject(Connection conn, ObjectPath object_path, object obj)
     : base(conn, null, object_path)
 {
     this.obj = obj;
 }
コード例 #16
0
ファイル: BusObject.cs プロジェクト: 0x0mar/aircrack-ng
		public BusObject (Connection conn, string bus_name, ObjectPath object_path)
		{
			this.conn = conn;
			this.bus_name = bus_name;
			this.object_path = object_path;
		}
コード例 #17
0
ファイル: GPS.cs プロジェクト: cbuehler/opencachemanager
 public GPS()
 {
     DbusConnection = Bus.System;
     gps = DbusConnection.GetObject<Gpsd> ("org.gpsd", new ObjectPath ("/org/gpsd"));
     gps.fix += HandleGpsfix;
 }