[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Vrs-development] Defining WebServices (NetServices???)
From: |
Peter Minten |
Subject: |
Re: [Vrs-development] Defining WebServices (NetServices???) |
Date: |
Wed, 04 Dec 2002 18:49:04 +0100 |
Chris Smith wrote:
> A couple of problems stop me, mainly that we've not defined the webservice
> interface.
Check the attached file for a start on the C API.
Greetings,
Peter
/* Webservice interface spec
DRAFT VERSION 1
Note that comments are written in C style so that it's
possible to use syntax highlighting on this file.
This version of the spec draft assumes XML-RPC is used
as RPC protocol. This will change to GNU-RPC when the
specs for that are available.
*/
/* Global error codes. */
enum ErrorCode {
NoError = 0, /* All OK */
SomeError = 1 /* An error occured, kind unknown */
};
/* --------------------------------------------------------------- */
/* Webservice stuff.
A webservice is a container for webservice methods. */
/* Webservice struct. */
typedef struct webservice {
char * name;
session_pool * pool;
/* Probably needs a lot more metadata. */
} ws;
/* Create a webservice without sessions. Needs an empty webservice
pointer, memory management will be done internally.
Advised use:
ws * s;
create_ws("FOOBAR", s); */
ErrorCode create_ws (char * name, ws * service);
/* Create a webservice with sessions. Needs an empty webservice
pointer and an empty pool pointer, memory management will be done
internally. */
ErrorCode create_ws (char * name, ws * service, session_pool * pool);
/* Free a webservice. */
ErrorCode free_ws(ws * service);
/* --------------------------------------------------------------- */
/* Session stuff. A session is a handle for users during a working
session on the webservice, it's also a container for data
associated with a working session. */
/* The main session structure. */
struct session {
int handle; /* Handle for the session, 4 gig of handles ought
to be enough.*/
void* user; /* Pointer to user information */
void* data; /* Pointer to session data. */
};
/* The session pool structure. Simple linked list, should be changed
for better performance. */
struct session_pool {
session * data; /* Pointer to a session. */
session_pool * next; /* The next session in the pool. */
};
/* Session lookup method. */
ErrorCode session_lookup(ws * service, int handle);
/* Session login method. Essentially creates a session and adds it to
the pool of the webservice. */
ErrorCode session_login(ws * service, int handle, void * user, void * data);
/* Session logout method. Removes a session from the pool of the
webservice. */
ErrorCode session_logout(ws * service);
/* --------------------------------------------------------------- */
/* Webservice method stuff. A webservice method is a method that can
be called over the web. */
/* All normal webservice methods should accept a session handle. */
/* The following method should be called to handle incoming session
based calls. It handles all the protocol translations and adds the
session handle to the front of the argument list of the real
call. */
ErrorCode webservice_call(char * data);