简体   繁体   English

Linux DBus通信

[英]Linux DBus communication

In Linux D-Bus: 在Linux D-Bus中:

  1. What prevents a process A from directly talking to a process B ? 是什么阻止进程A直接与进程B对话? Why does a method call message have to go through the bus daemon process ? 为什么方法调用消息必须经过总线守护进程?

  2. Why does <policy> section in the daemon's config file have an option to allow / deny owning a bus name ? 为什么守护程序的配置文件中的<policy>部分具有允许/拒绝拥有总线名称的选项?

  3. If a process can use matching rules to potentially monitor any message passing through the bus daemon process, can two communicating processes express any restriction in any way such that no other process can observe their traffic ? 如果一个进程可以使用匹配规则来潜在地监视通过总线守护进程的任何消息,那么两个正在通信的进程是否可以以任何方式表达任何限制,使得其他进程无法观察到它们的流量?

  4. Why is it said in documentation that a given bus name will always refer the same application ? 为什么在文档中说给定的总线名称将始终引用同一应用程序? - Will this be true after machine reboots ? -机器重启后,这是否成立?

For 1: My current understanding is that for processes A and B to talk to each other, both must register a bus name with the bus daemon. 对于1:我目前的理解是,为了使进程A和B彼此通信,两者都必须在总线守护程序中注册一个总线名称。 So is the only thing preventing A from talking to B is that it may know B's bus name and not be able to locate it on the machine ? 那么,阻止A与B对话的唯一原因是它可能知道B的总线名称并且无法在机器上找到它吗?

1 - nothing. 1-什么都没有。 It's just much simpler to use bus ( both services and clients are tcp clients, not servers, easier to configure, manage names etc etc) 使用总线要简单得多(服务和客户端都是tcp客户端,而不是服务器,更易于配置,管理名称等)

2 - to make sure that service behind the name is one you trust. 2-确保名称背后的服务是您信任的服务。 Otherwise malicious code might request name and pretend to be that service. 否则,恶意代码可能会要求提供名称并假装是该服务。

3 - IMO yes ( though not exactly sure ) 3-IMO是(尽管不确定)

4 - name <-> connection. 4-名称<->连接。 One process can own multiple names. 一个进程可以拥有多个名称。 Automatic names are not re-assigned to new connections ( if you reconnect it's always new name ) After reboot you can see same names again, but between reboots you can assume no same name assigned to two different connections over time ( = race conditions ) 自动名称不会重新分配给新的连接(如果重新连接,它始终是新名称)重新启动后,您可以再次看到相同的名称,但是在重新启动之间,您可以假设一段时间内没有相同的名称分配给两个不同的连接(=竞争条件)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM