[Vala] Putting vala in samba4



I've been writing a VFS module for Samba4 for the last 9 months, and I'd like to start migrating the work to Vala, because I'd rather use Vala to write my work in.

Samba4 already has a strong framework which I would need to wrap as vapi, so I'll asking for some specific help on this.

I'm working on the v4-0-test tree:
http://gitweb.samba.org/?p=samba.git;a=tree;h=v4-0-test;hb=v4-0-test

First: Samba makes heavy use of unions, which Vala doesn't support. Dang:

See: interfaces.h line 1666, the smb_read union
http://gitweb.samba.org/?p=samba.git;a=blob;f=source/libcli/raw/interfaces.h;h=537041c13762833287f946748fe08ea8e0386247;hb=v4-0-test#l1666

As I will be incrementally porting to Vala (not wrapping all structs in one go) I still need to be able to access the struct and it's different union members from Vala.

How can I manage this?


The first struct I intend to wrap is struct ntvfs_ops, as that struct define my base object; see:
http://gitweb.samba.org/?p=samba.git;a=blob;f=source/ntvfs/ntvfs.h;h=5de8a8b6491cd7e0f81915907de5b4fbc8153a47;hb=v4-0-test#l43

It IS a virtual method table, which a particular module has to fill in with all the methods:
http://gitweb.samba.org/?p=samba.git;a=blob;f=source/ntvfs/cifs/vfs_cifs.c;h=844fa11cc5f584df597b0c791386b07354d08c98;hb=v4-0-test#l1089
but more complicatedly, along with a couple of attributes (ops.name, ops.type).
It is registered on line 1137

So I don't know where to start to wrap this, to be able to tell vala where to store the methods compatibly with samba.

Perhaps that was an abstract class, with subclass see ntvfs_module_context that has a member pointing to the ntvfs_ops but also a private_data member which will be "self" and holds subclass-instance specific data.
http://gitweb.samba.org/?p=samba.git;a=blob;f=source/ntvfs/ntvfs.h;h=5de8a8b6491cd7e0f81915907de5b4fbc8153a47;hb=v4-0-test#l165

So I'll want to declare my own specific non-abstract subclass with a filled-in method table and a working self pointer... (It's complicated by the fact that the abstract parent class has those 2 data slots name and type which are filled in by the child subclass)

I know this sounds a bit like do-my-homework but there's loads of it and I just need a starter. I also wonder if it is possible for vala to do this; i.e. have the storage of it's VMT controlled etc.

thanks

Sam




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]