Re: Avahi Support on Linux

2014-01-29 Thread Siqi Liu
Hello,

The code using avahi_client_new is already in LibreOffice (I've pushed it
during last summer).

I've tried to make a separate version of that same code broadcasting a
_impressremote._tcp service alone. Even though the code compiles fine using
dlopen, it does get an error code that I've never encountered before... In
theory avahi.cxx will broadcast avahi service in a event loop thread, does
dlopen change anything with respect to that? Also, internally avahi is
based on dbus, not sure if that has anything to do with the issue.

For now, the problem is that the service can not get committed
using avahi_entry_group_commit().

I've attached the code if you have some time to check if I've used dlopen
correctly.


The command that I've used to compile it is as follow

g++ avahi.cxx -I/usr/include/dbus-1.0 \
   -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include \
   -I/usr/include/glib-2.0 \
   -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ \
   -ldbus-1 \
   -ldbus-glib-1 \
   -lavahi-glib -lavahi-common -lavahi-core -lavahi-client -ldl


Thanks!
Siqi


On Wed, Jan 29, 2014 at 12:09 PM, Caolán McNamara wrote:

> On Fri, 2014-01-24 at 22:51 +0100, Siqi Liu wrote:
> >
> > For example, I can dlsym this function and get the void * to it, but
> > how can I use it if I don't have access to the struct AvahiClient
> > (declaired in the shared object)?
> > AvahiClient* avahi_client_new
> > (
> > const AvahiPoll *
> > poll_api,
> >
> >
> > AvahiClientFlags
> > flags,
> >
> >
> > AvahiClientCallback
> > callback,
> >
> >
> > void *
> > userdata,
> >
> >
> > int *
> > error
> >
> >
>
> Well, it depends on usage if you can get away with including the
> headers. e.g. if you just need to manipulate the returned thing through
> a pointer to it and dlsymed functions then you can just shove e.g.
> typedef struct _AvahiClient AvahiClient;
> into your .cxx and that'll work.
>
> e.g. see vcl/unx/gtk/window/xid_fullscreen_on_all_monitors.c for an
> example
>
> Is the code using avahi_client_new that you want to make runtime
> optional already in LibreOffice or is it new code you want to add ?
>
> C.
>
>


-- 


Cordialement,
Siqi LIU

Étudiant Ingénieur, 1ère année
École Supérieur d'Électricité (Supélec)
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Avahi Support on Linux

2014-01-29 Thread Caolán McNamara
On Fri, 2014-01-24 at 22:51 +0100, Siqi Liu wrote:
> 
> For example, I can dlsym this function and get the void * to it, but
> how can I use it if I don't have access to the struct AvahiClient
> (declaired in the shared object)?
> AvahiClient* avahi_client_new
> (
> const AvahiPoll * 
> poll_api,
> 
> 
> AvahiClientFlags 
> flags,
> 
> 
> AvahiClientCallback 
> callback,
> 
> 
> void * 
> userdata,
> 
> 
> int * 
> error 
> 
> 

Well, it depends on usage if you can get away with including the
headers. e.g. if you just need to manipulate the returned thing through
a pointer to it and dlsymed functions then you can just shove e.g.
typedef struct _AvahiClient AvahiClient;
into your .cxx and that'll work.

e.g. see vcl/unx/gtk/window/xid_fullscreen_on_all_monitors.c for an
example

Is the code using avahi_client_new that you want to make runtime
optional already in LibreOffice or is it new code you want to add ?

C.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Avahi Support on Linux

2014-01-25 Thread Siqi Liu
Hello again,

It seems to me that I still need to include those avahi headers, but how
can we be sure that these headers are there? By copying them into our
codebase? Is that compatible with our license? (LGPL for Avahi)

Thanks for you answers and sorry for the spam, I'm totally new to these
dlopen solution ...

Siqi


On Fri, Jan 24, 2014 at 10:51 PM, Siqi Liu  wrote:

> Hello Caolan, Tor,
>
> I've done some research and I've more or less understood how it works now.
>
> Now, with Avahi, I am supposed to use dlsym to import several functions
> from libavahi-client.so.3 and libavahi-common.so.3 during the runtime.
> However, the dlsym should return a pointer to the function which, in order
> to be used, need to be casted with correct return type/argument types. The
> problem is, these types are declared in the shared object and I still don't
> have access to them.
>
> For example, I can dlsym this function and get the void * to it, but how
> can I use it if I don't have access to the struct AvahiClient (declaired in
> the shared object)?
> AvahiClient
> * 
> avahi_client_new
> (const AvahiPoll
>  * poll_api, 
> AvahiClientFlags
>   
> flags,AvahiClientCallback
>   callback,void * userdata, int * error  )
>
> Am I on the right track ? Any help or link to some tutorials would be
> appreciated!
>
> Thanks!
> Siqi
>
>
> On Thu, Jan 9, 2014 at 4:57 PM, Caolán McNamara wrote:
>
>> On Tue, 2014-01-07 at 15:31 +0100, Siqi Liu wrote:
>> > Tor pushed a quick fix for that and disabled avahi temporarily so that
>> > it doesn't get compiled unless specified. I'm thinking of fixing that
>> > but not sure how to load Avahi dynamically depending on the presence
>> > of Avahi library on the distribution.
>> >
>> > Any pointers on how to achieve that?
>>
>> We've done stuff like this plenty of times in the past. One current one
>> is sc/source/core/opencl/clcc.cxx see the dlopen, dlsym hackery.
>>
>> C.
>>
>>
>
>
> --
> 
>
> Cordialement,
> Siqi LIU
>
> Étudiant Ingénieur, 1ère année
> École Supérieur d'Électricité (Supélec)
>
>


-- 


Cordialement,
Siqi LIU

Étudiant Ingénieur, 1ère année
École Supérieur d'Électricité (Supélec)
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Avahi Support on Linux

2014-01-24 Thread Siqi Liu
Hello Caolan, Tor,

I've done some research and I've more or less understood how it works now.

Now, with Avahi, I am supposed to use dlsym to import several functions
from libavahi-client.so.3 and libavahi-common.so.3 during the runtime.
However, the dlsym should return a pointer to the function which, in order
to be used, need to be casted with correct return type/argument types. The
problem is, these types are declared in the shared object and I still don't
have access to them.

For example, I can dlsym this function and get the void * to it, but how
can I use it if I don't have access to the struct AvahiClient (declaired in
the shared object)?
AvahiClient
* 
avahi_client_new
(const AvahiPoll 
 * poll_api, 
AvahiClientFlags
  
flags,AvahiClientCallback
  callback,void * userdata, int * error  )

Am I on the right track ? Any help or link to some tutorials would be
appreciated!

Thanks!
Siqi


On Thu, Jan 9, 2014 at 4:57 PM, Caolán McNamara  wrote:

> On Tue, 2014-01-07 at 15:31 +0100, Siqi Liu wrote:
> > Tor pushed a quick fix for that and disabled avahi temporarily so that
> > it doesn't get compiled unless specified. I'm thinking of fixing that
> > but not sure how to load Avahi dynamically depending on the presence
> > of Avahi library on the distribution.
> >
> > Any pointers on how to achieve that?
>
> We've done stuff like this plenty of times in the past. One current one
> is sc/source/core/opencl/clcc.cxx see the dlopen, dlsym hackery.
>
> C.
>
>


-- 


Cordialement,
Siqi LIU

Étudiant Ingénieur, 1ère année
École Supérieur d'Électricité (Supélec)
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Avahi Support on Linux

2014-01-09 Thread Caolán McNamara
On Tue, 2014-01-07 at 15:31 +0100, Siqi Liu wrote:
> Tor pushed a quick fix for that and disabled avahi temporarily so that
> it doesn't get compiled unless specified. I'm thinking of fixing that
> but not sure how to load Avahi dynamically depending on the presence
> of Avahi library on the distribution.
> 
> Any pointers on how to achieve that?

We've done stuff like this plenty of times in the past. One current one
is sc/source/core/opencl/clcc.cxx see the dlopen, dlsym hackery.

C.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Avahi Support on Linux

2014-01-07 Thread Siqi Liu
Hello all,

During this summer I've implemented Zeroconf service with Avahi on
Linux distro, though it worked on my Ubuntu box, it doesn't seem to be
supported on "all" distributions, and it has thus broken quite a lot
of tinderboxes at that time...

Tor pushed a quick fix for that and disabled avahi temporarily so that
it doesn't get compiled unless specified. I'm thinking of fixing that
but not sure how to load Avahi dynamically depending on the presence
of Avahi library on the distribution.

Any pointers on how to achieve that?


Thanks!
-- 


Cordialement,
Siqi LIU

Étudiant Ingénieur, 1ère année
École Supérieur d'Électricité (Supélec)
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice