dbus getting Originator ID in C

Richard tuxbox.guru at gmail.com
Sat Feb 16 05:13:41 PST 2013


On 15 February 2013 17:21, William Manley <william.manley at youview.com> wrote:
> On 11/02/13 20:46, Thiago Macieira wrote:
>>
>> On segunda-feira, 11 de fevereiro de 2013 20.29.04, Richard wrote:
>>>
>>> Hi All,
>>>
>>> Pardon the intrusion but I am on the quest for some information as I
>>> am stuck. I tried searching but I am at a loss what to search for, but
>>> here goes.
>>>
>>> I am implementing a dbus based client and server and would like to
>>> know how to get the common name of sender of the message.
>>
>>
>> You can only get the unique connection name.
>>
>>> Client                          Server
>>> dvb.ingres.client --->     dvb.settings.server
>>>
>>> I can receive all the messages at the server but would like to know
>>> WHO sent the message.   _get_sender() returns a chaging number,
>>> get_server_id returns a large number that I dont know where it comes
>>> from.
>>>
>>> Is there a way to get the human readable name of the message
>>> originator? (who the client is)
>>
>>
>> No, you can only get the unique connection name, which is probably the
>> "changing number" you mention.
>>
>> You can ask the bus for the unique connection name of the sender you
>> expect it
>> to be and then compare if they are the same. Use the GetNameOwner call.
>
>
> This is slightly racy as the name owner may have changed by the time
> DBus receives the GetNameOwner call.  The way we have implemented such a
> mapping is by keeping a cache of the owned names by listening for
> NameOwnerChanged events.  You can then find out who owned the name when
> the message was actually sent.
> This transmission contains information that may be confidential and contain
> personal views which are not necessarily those of YouView TV Ltd. YouView TV
> Ltd (Co No:7308805) is a limited liability company registered in England and
> Wales with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower
> Thames Street, London, EC3R 6YT. For details see our web site at
> http://www.youview.com
>
>
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus

Thanks all,

In the end I added an originator tag in the message payload, on the
receiver end it will just unpack it and use it for information
reasons. There are about 5 different DBUS processes talking to each
other within the system, some are using the same username so
identifying the user is not practical.

Regards,
Richard


More information about the dbus mailing list