Lioubliou

API

/usr/include/Lioubliou-2.0/liblioubliou.h

/*
 * liblioubliou.h
 * Part of the Birds Lake project
 * STRASSER Michel <michelNOSPAM.strasserNOSPAM@freeNOSPAM.frNOSPAM>
 * 20040229_1726        Initial Release
 * */

#ifndef __LIB_LIOUBLIOU_H__
#define __LIB_LIOUBLIOU_H__

#include <Lioubliou/LiouComException.h>
#include <Lioubliou/LioubovnikFilterSession.h>
#include <Lioubliou/LiouServer.h>

#endif

/usr/include/Lioubliou-2.0/Lioubliou/LiouComException.h

/* Lioubliou - Communication sub system
 * STRASSER Michel - 20040228           init
 * */

#ifndef __LIOU_COM_EXCEPTION_H__
#define __LIOU_COM_EXCEPTION_H__

#include <glib.h>
#include <glib-object.h>

#define LIOU_TYPE_COM_EXCEPTION                 (LiouComException_getType ())
#define LIOU_COM_EXCEPTION(object)              (G_TYPE_CHECK_INSTANCE_CAST ((object), LIOU_TYPE_COM_EXCEPTION, LiouComException))
#define LIOU_COM_EXCEPTION_CLASS(object)                (G_TYPE_CHECK_CLASS_CAST ((object), LIOU_TYPE_COM_EXCEPTION, LiouComExceptionClass))
#define LIOU_IS_COM_EXCEPTION(object)           (G_TYPE_CHECK_INSTANCE_TYPE((object), \
                                                        LIOU_TYPE_COM_EXCEPTION))
#define LIOU_IS_COM_EXCEPTION_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE((klass), \
                                                        LIOU_TYPE_COM_EXCEPTION))
#define LIOU_COM_EXCEPTION_TYPE(object)           (G_TYPE_FROM_INSTANCE (object))
#define LIOU_COM_EXCEPTION_TYPE_NAME(object)      (g_type_name (LIOU_COM_EXCEPTION_TYPE (object)))

typedef struct _LiouComException        LiouComException;
typedef struct _LiouComExceptionClass   LiouComExceptionClass;

typedef enum {
        LIOU__COM_EXCEPTION__None=0,
        LIOU__COM_EXCEPTION__BadFilterName,
        LIOU__COM_EXCEPTION__BadLogin,
        LIOU__COM_EXCEPTION__FilterError,
        LIOU__COM_EXCEPTION__InvalidInterfacesStream,
        LIOU__COM_EXCEPTION__InvalidLsmStream,
        LIOU__COM_EXCEPTION__BadDocument,
        LIOU__COM_EXCEPTION__BadRessourcePath,
        LIOU__COM_EXCEPTION__BadSessionKey,
        LIOU__COM_EXCEPTION__SessionTimedOut,
        LIOU__COM_EXCEPTION__Last
} LiouComExceptionType;

struct _LiouComException
{
        GObject                 parent_instance;
        LiouComExceptionType    type;
        char*                   mesg;
};

struct _LiouComExceptionClass
{
        GObjectClass            parent_class;
};

G_BEGIN_DECLS

GType
LiouComException_getType                (void);

/* mesg is copied, so you can free it */
GObject*
LiouComException_new                    (LiouComExceptionType type,
                                         char* mesg);


/* allocated dynamically */
char*
LiouComException_toString               (LiouComException* self);

G_END_DECLS

#endif /* __LIOU_COM_EXCEPTION_H__ */

/usr/include/Lioubliou-2.0/Lioubliou/LiouServer.h

/* Lioubliou Server, a CORBA filter server for the birds lake
 * STRASSER Michel - 20040211           init
 * */

#ifndef __LIOU_SERVER_H__
#define __LIOU_SERVER_H__

#include <glib.h>
#include <glib-object.h>

#define LIOU_TYPE_SERVER                        (LiouServer_getType ())
#define LIOU_SERVER(object)             (G_TYPE_CHECK_INSTANCE_CAST ((object), LIOU_TYPE_SERVER, LiouServer))
#define LIOU_SERVER_CLASS(object)               (G_TYPE_CHECK_CLASS_CAST ((object), LIOU_TYPE_SERVER, LiouServerClass))
#define LIOU_IS_SERVER(object)          (G_TYPE_CHECK_INSTANCE_TYPE((object), \
                                                        LIOU_TYPE_SERVER))
#define LIOU_IS_SERVER_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE((klass), \
                                                        LIOU_TYPE_SERVER))
#define LIOU_SERVER_TYPE(object)                  (G_TYPE_FROM_INSTANCE (object))
#define LIOU_SERVER_TYPE_NAME(object)     (g_type_name (LIOU_SERVER_TYPE (object)))

typedef struct _LiouServer      LiouServer;
typedef struct _LiouServerClass LiouServerClass;

typedef enum {
        LIOU_FILTER_TYPE__IMPORT,
        LIOU_FILTER_TYPE__EXPORT
} LiouFilterType;

typedef GObject* (*LioubovnikFilterSessionNewFunc)      (char* portsDir,
                                                         char* docDir,
                                                         LiouFilterType filterType,
                                                         char* filter,
                                                         GObject** exception // LioubliouException
                                                         );

struct _LiouServer
{
        GObject                         parent_instance;
        LioubovnikFilterSessionNewFunc  lioubovnikFilterSessionNewFunc;
        GHashTable*                     filterSessionHash;
        GList*                          filterSessionList;
        GMutex*                         mutex; // TODO
        GObject*                        com;    // LiouCom (LiouComCorba)
        GRand*                          rand;
        char*                           portsDir;
        char*                           appName;
        char*                           serversListBaseFile;
};

struct _LiouServerClass
{
        GObjectClass            parent_class;
};

G_BEGIN_DECLS

GType
LiouServer_getType              (void);

GObject*
LiouServer_new                  (LioubovnikFilterSessionNewFunc lioubovnikFilterSessionNewFunc,
                                 int argc,
                                 char** argv,
                                 char* portsDir,
                                 char* appName,
                                 GObject** exception);

void
LiouServer_run                  (LiouServer* self,
                                 GObject** exception);

char*
LiouServer_getRendezVous        (LiouServer* self,
                                 LiouFilterType in_type,
                                 char* in_name,
                                 char* in_user,
                                 char* in_password,
                                 GObject* in_lsmStream,
                                 GList** out_interfacesList,
                                 int* out_vortex,
                                 GObject** exception);

GObject*        // LiouStream
LiouServer_getRessource         (LiouServer* self,
                                 char* ressourcePath,
                                 GObject** exception);



GObject*        // LiouStream
LiouServer_applyFilter          (LiouServer* self,
                                 char* sessionKey,
                                 GObject* interfacesStream,
                                 GObject** exception);


G_END_DECLS

#endif /* __LIOU_SERVER_H__ */

/usr/include/Lioubliou-2.0/Lioubliou/LioubovnikFilterSession.h

/* LioubovnikFilterSession, an abstract class that has to be implemented by the lioubovnik
 * STRASSER Michel - 20040211           init
 * */

#ifndef __LIOUBOVNIK_FILTER_SESSION_H__
#define __LIOUBOVNIK_FILTER_SESSION_H__

#include <glib.h>
#include <glib-object.h>
#include <IG.h> // LibIGen http://m.strasser.libigen.free.fr

#define LIOUBOVNIK_TYPE_FILTER_SESSION                  (LioubovnikFilterSession_getType ())
#define LIOUBOVNIK_FILTER_SESSION(object)               (G_TYPE_CHECK_INSTANCE_CAST ((object), LIOUBOVNIK_TYPE_FILTER_SESSION, LioubovnikFilterSession))
#define LIOUBOVNIK_FILTER_SESSION_CLASS(object)         (G_TYPE_CHECK_CLASS_CAST ((object), LIOUBOVNIK_TYPE_FILTER_SESSION, LioubovnikFilterSessionClass))
#define LIOUBOVNIK_IS_FILTER_SESSION(object)            (G_TYPE_CHECK_INSTANCE_TYPE((object), \
                                                        LIOUBOVNIK_TYPE_FILTER_SESSION))
#define LIOUBOVNIK_IS_FILTER_SESSION_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), \
                                                        LIOUBOVNIK_TYPE_FILTER_SESSION))
#define LIOUBOVNIK_FILTER_SESSION_TYPE(object)            (G_TYPE_FROM_INSTANCE (object))
#define LIOUBOVNIK_FILTER_SESSION_TYPE_NAME(object)       (g_type_name (LIOUBOVNIK_FILTER_SESSION_TYPE (object)))

typedef struct _LioubovnikFilterSession LioubovnikFilterSession;
typedef struct _LioubovnikFilterSessionClass    LioubovnikFilterSessionClass;

struct _LioubovnikFilterSession
{
        GObject                         parent_instance;
};

struct _LioubovnikFilterSessionClass
{
        GObjectClass                    parent_class;
        GList*  (*getInterfacesList)    (LioubovnikFilterSession* self,
                                         GObject** exception);

        void    (*applyFilter)          (LioubovnikFilterSession* self,
                                         IG* filledInterfaces,
                                         GObject** exception);

};

G_BEGIN_DECLS

GType
LioubovnikFilterSession_getType                 (void);

GList*
LioubovnikFilterSession_getInterfacesList       (LioubovnikFilterSession* self,
                                                 GObject** exception);

void
LioubovnikFilterSession_applyFilter             (LioubovnikFilterSession* self,
                                                 IG* filledInterfaces,
                                                 GObject** exception);

G_END_DECLS

#endif /* __LIOUBOVNIK_FILTER_SESSION_H__ */