Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

kds.h File Reference

#include <koLib/rwshare.h>
#include <koLib/sets.h>
#include <sys/naming.h>
#include <koLib/list.h>
#include <sys/kdsdef.h>

Go to the source code of this file.


struct  kdsClient
 registered client structure More...

struct  kdsExchange
struct  kdsImplement
 interface implementation More...

struct  kdsInterface
 service interface More...

struct  kdsMessage
struct  kdsMethod
 record describing a method in an interface More...

struct  kdsModule
 loadable module descriptor More...

struct  kdsPolicy
 network policy More...

struct  kdsServer
 server description More...

struct  kdsService
 informations representing an "object network" More...


#define __VIRTUAL_SETS__
#define KDS_DEFER_LINK   ((void*) 0xffffffff)
#define _kds(x)   kdsLookup(NULL,x,NULL)
#define _kds_(x, y)   kdsLookup(_kds(x).set,y,NULL)


typedef kdsImplement kdsImplement
typedef kdsInterface kdsInterface
typedef kdsService kdsService
typedef kdsServer kdsServer
typedef kdsPolicy kdsPolicy
typedef kdsMethod kdsMethod
typedef kdsClient kdsClient
typedef kdsModule kdsModule
typedef kdsMessage kdsMessage
typedef int( kdsProcPtr )(void *sdata, void *msg)
 "method" type in KDS

typedef void( kdsActivityCallback )(kdsImplement *,...)
typedef enum kdsShare kdsShare
 defines actions that may be used on a shared object

typedef enum kdsIstatus kdsIstatus
 states for a service interface

typedef kdsImplement *( kdspSendMsg )(kdsInterface *itf, void *msg, void **tgt, void **next)
 policy used to choose the receiver of a "kdsSEnd" message

typedef koList *( kdspInsert )(koList *ilist, kdsImplement *item)
 policy used for implementation add

typedef koList *( kdspRemove )(koList *ilist, kdsImplement *item)
 policy used when implementation removed.

typedef kdsImplement *( kdspSelect )(kdsInterface *itf, kdsClient *client)
 policy used to gives a new client an interface

typedef enum kdsClientStatus kdsClientStatus
 client structure states

typedef enum kdsError kdsError
 error codes


enum  kdsShare {
 defines actions that may be used on a shared object More...

 states for a service interface More...

enum  kdsClientStatus {
 client structure states More...

enum  kdsError {
 error codes More...


kdsInterfacekdsInterfaceCtor (int nbMethods, kdsInterface *extends)
 Builds an empty interface.

void kdsInterfaceDtor (kdsInterface *me)
 destroys an interface.

int kdsGetMethod (kdsInterface *itf, char *method)
 returns the code (number) of a given method

int kdsAddMethod (kdsInterface *itf, char *method)
 adss a method to the interface

kStatus kdsAddImplement (kdsInterface *itf, kdsImplement *imp)
 Adds a new implementation for this interface.

kStatus kdsDelImplement (kdsInterface *itf, kdsImplement *imp)
 removes an implementation of an interface

kdsImplementkdsImplementCtor (kdsInterface *itf, int nb, kdefMethod mth[])
 Builds a new implementation.

void kdsImplementDtor (kdsImplement *me)
void kdsRegisterClient (kdsImplement *me, kdsClient *client)
 registers a client of the interface

void kdsUnregisterClient (kdsClient *me)
 removes a client

kdsClientkdsClientCtor (kdsDomain *, kdsInterface *itf, char *names[], kdsProcPtr *ptr[])
 Builds a reference structure for a client.

void kdsClientDtor (kdsDomain *, kdsClient *me)
 removes the client reference

kdsError kdsInvoque (kdsClient *me, int no, void *m)
 calls a method through a client reference structure

kStatus kdsClientRefresh (kdsClient *me)
 Refreshes the function pointers that the client uses.

kdsError kdsLock (kdsClient *me)
 lock the interface.

void kdsUnlock (kdsClient *me)
 unlocks the interface.

kdsServerkdsServerCtor (kdsDomain *, char *name, kdsModule *from, kStatus(*open)(), kStatus(*close)(), kStatus(*respawn)(), kdsActivityCallback *wk, kdsActivityCallback *slp)
 builds a "server" object

void kdsServerDtor (kdsDomain *, kdsServer *me)
 destroys the 'server' object

void kdsServerProvides (kdsServer *svr, kdsImplement *imp)
 Adds an implementation in the list of imps. provided.

kdsServicekdsSvcCtor (char *path, kdsPolicy *p)
 builds a new service

kStatus kdsAddInterface (kdsService *svc, char *name, kdsInterface *itf)
 Adds an interface to a service.

kdsInterfacekdsGetInterface (kdsService *svc, char *name, kdsShare mode)
 returns an interface object from its symbolic name.

kStatus kdsAddServer (kdsService *svc, kdsServer *me, kdefImplement implementations[], struct kQueue *msgqueue)
 Adds a server to a service.

void kdsRemoveServer (kdsService *me, char *server)
 removes a server.

kdsError kdsSend (kdsService *svc, char *code, void *msg)
 Send a server a message.

kdsClientkdsAddClient (kdsService *svc, char *interface, char **names, kdsProcPtr **tbl)
 Registers a "regular" client.

Define Documentation



#define __VIRTUAL_SETS__

#define _kds      kdsLookup(NULL,x,NULL)

#define _kds_ x,

#define KDS_DEFER_LINK   ((void*) 0xffffffff)

Typedef Documentation

typedef void( kdsActivityCallback)(kdsImplement*,...)

typedef struct kdsClient kdsClient

typedef enum kdsClientStatus kdsClientStatus

client structure states

typedef enum kdsError kdsError

error codes

typedef struct kdsImplement kdsImplement

typedef struct kdsInterface kdsInterface

typedef enum kdsIstatus kdsIstatus

states for a service interface

typedef struct kdsMessage kdsMessage

typedef struct kdsMethod kdsMethod

typedef struct kdsModule kdsModule

typedef koList*( kdspInsert)(koList *ilist, kdsImplement *item)

policy used for implementation add

typedef struct kdsPolicy kdsPolicy

typedef koList*( kdspRemove)(koList *ilist, kdsImplement *item)

policy used when implementation removed.

typedef int( kdsProcPtr)(void *sdata,void *msg)

"method" type in KDS

sdata:  pointer to the private structure of the called server
msg:  pointer to the transmitted message The message structure is supposed to be known from both client & server

typedef kdsImplement*( kdspSelect)(kdsInterface *itf, kdsClient *client)

policy used to gives a new client an interface

note that we might want the client pointer in order to apply special policies like device selection, etc.

typedef kdsImplement*( kdspSendMsg)(kdsInterface *itf, void *msg, void** tgt, void **next)

policy used to choose the receiver of a "kdsSEnd" message

next:  used for iteration. If the call returns a non-null value in next, then it should be called back for additionnal implmentations. a null next value as input means we want to start the list.

typedef struct kdsServer kdsServer

typedef struct kdsService kdsService

typedef enum kdsShare kdsShare

defines actions that may be used on a shared object

Enumeration Type Documentation

enum kdsClientStatus

client structure states

Enumeration values:
KDSC_BUILDING  the client has not yet registered
KDSC_OK  the client is ready
KDSC_UPDATE  the client should update its infos

this state is set by the policer when the client's current implementation is made unavailable (for instance, due to server removed) or simply changed by a new server incoming.

KDSC_SELF  special flag telling the server is in this module.
KDSC_DEFERRED  the link is deferred until the client sets prefs.

this state is set by the "clientRefresh" function which receives a special KDS_DEFER_LINK result from a if we were attempting to invoke the client, it's an error condition, but not if we were just building it :

enum kdsError

error codes

Enumeration values:
KDSE_OK  (0) no error
KDSE_METHODSCOUNT  30) the interface doesnt implement every fct
KDSE_BADMETHOD  31) one method is not present
KDSE_BUILD  32) unable to build a new interface
KDSE_SYNTAX  33) path syntax invalid
KDSE_NOENT  34) request for an inexistant object (interface;)
KDSE_NOMETHOD  35) invalid method name
KDSE_REJECTED  36) processing rejected, message error
KDSE_NOTREADY  37) attempt to use a non-ready client
KDSE_NOSERVER  38) no more server for a given client
KDSE_ACCESS  39) access denied.
KDSE_NOPATH  3a) invalid path
KDSE_SYMDUP  3b) symbol redefinition
KDSE_CONST  3c) attempt to modify a constant binding
KDSE_NOIMP  3d) no implementation available.
KDSE_BADTYPE  3e) trying to do an operation that this 'object' doesn't support.

enum kdsIstatus

states for a service interface

Enumeration values:
KDS_IEMPTY  no method (empty, just after building)
KDS_IBUILDING  under construction
KDS_IREADY  ready to be used
KDS_IMANAGE  currently under modification, do not use right now

enum kdsShare

defines actions that may be used on a shared object

Enumeration values:
KDSS_NONE  no sharing required
KDSS_GETREAD  get read acces
KDSS_RELEASEREAD  release read access
KDSS_GETWRITE  get write access
KDSS_RELEASEWRITE  release write access

Function Documentation

kStatus kdsAddImplement kdsInterface   itf,
kdsImplement   imp

Adds a new implementation for this interface.

once we get a write access to the interface, we call the service policy that should know what to do to insert the interface Note that the implementation is also added to every interfaces which "itf" is an extension of.

kStatus kdsAddInterface kdsService   svc,
char *    name,
kdsInterface   itf

Adds an interface to a service.

Makes the binding between "name" and "itf" in the interfaces set of "svc". The interface is then tagged READY, which means we can't add new methods to the interface, but we can start implement it :)

int kdsAddMethod kdsInterface   itf,
char *    method

adss a method to the interface

Adding a method is only allowed if the interface has not been activated (i.e. not yet registered as an interface on a service)

kStatus kdsAddServer kdsService   svc,
kdsServer   me,
kdefImplement    implementations[],
struct kQueue   msgqueue

Adds a server to a service.

The server to be build is defined by the set of implementations it provides. Every symbols found in new interfaces descriptions are "intern()ed"

kdsClient* kdsClientCtor kdsDomain   dom,
kdsInterface   itf,
char *    names[],
kdsProcPtr   ptr[]

Builds a reference structure for a client.

The descriptor is not directly usable, while it still has no impl.

void kdsClientDtor kdsDomain  ,
kdsClient   me

removes the client reference

kStatus kdsClientRefresh kdsClient   me

Refreshes the function pointers that the client uses.

Assumes that the caller got a read-access to the interface. This function looks for an implementation that will meet the client's needs (using policy::select()) and builds the local method table for it the client also get registered at the new implementation. --- NOTE --- it is unclear of where the server's instance (a.k.a. method[0]) will be stored, especially in the case of a client ordered function table!

kStatus kdsDelImplement kdsInterface   itf,
kdsImplement   imp

removes an implementation of an interface

This operation calls the "remove" method of the service policy Note that the implementation will also be removed from every 'base' interfaces (but not derived ones). So it could be wise to call it from the same interface than the one that has been used in kdsAddImplement

kdsInterface* kdsGetInterface kdsService   svc,
char *    name,
kdsShare    mode

returns an interface object from its symbolic name.

if "name" does not correspond to any interface of "svc", return NULL. else "mode" defines the kind of lock we need (read/write access).

int kdsGetMethod kdsInterface   itf,
char *    method

returns the code (number) of a given method

if the 'itf' interface does not have a method corresponding to the given name, the query will be propagated to the parent interface, until we find a "root" interface (that has no parents)

kdsImplement* kdsImplementCtor kdsInterface   itf,
int    nb,
kdefMethod    mth[]

Builds a new implementation.

nb:  number of implemented methods
mth:  array describing those methods The server and its private datas will be defined when the implementation gets registered on the server

void kdsImplementDtor kdsImplement   me

kdsInterface* kdsInterfaceCtor int    nbMethods,
kdsInterface   extends

Builds an empty interface.

nbMethods  : minimum amount of methods expected (used to size the set)
extends  : base interface if we build a derivated interface Remark: we cannot extend an interface if its status is not "IREADY"

void kdsInterfaceDtor kdsInterface   me

destroys an interface.

WARNING: This destruction assumes no more implementation uses the interface ;) and that it won't be used when being deleted

kdsError kdsLock kdsClient   me

lock the interface.

void kdsRegisterClient kdsImplement   me,
kdsClient   client

registers a client of the interface

Registering make the client to be added in the implementation's list

void kdsRemoveServer kdsService   me,
char *    server

removes a server.

As side effect, every implementations the server provided are withdrawn the server object is also destroyed.

kdsServer* kdsServerCtor kdsDomain   dom,
char *    name,
kdsModule   from,
kStatus(*    opn)(),
kStatus(*    close)(),
kStatus(*    respawn)(),
kdsActivityCallback   wk,
kdsActivityCallback   slp

builds a "server" object

name  : unique name used for identification
from  : module that provides this server.
sdata:  private datas for this server
open:  initialisation function
close:  desinitialisation (resources returner) function
respawn:  error recovery function (optionnal)

void kdsServerDtor kdsDomain  ,
kdsServer   me

destroys the 'server' object

void kdsServerProvides kdsServer   svr,
kdsImplement   imp

Adds an implementation in the list of imps. provided.

kdsService* kdsSvcCtor char *    path,
kdsPolicy   p

builds a new service

path:  the path relative to "services.*" in KDS naming system. Each service "x" will be registered in "services.x".
p:  a service policy, Service policies are stored in "system.policy.*"

void kdsUnlock kdsClient   me

unlocks the interface.

void kdsUnregisterClient kdsClient   me

removes a client

Removing the clients requires a "read" access to the interface so that no implementation "disapears" while performing the operation "disparaisse" pendant le retrait. If the client is in the "UPDATE" moden there are no used implementation, so nothing special is needed

Generated on Mon Jul 14 17:00:30 2003 for Clicker32Kernel by doxygen1.2.18