home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming with VisualAge for Java
/
IBMVJAVA.ISO
/
icswinnt
/
httpdw32.z
/
func.h
< prev
next >
Wrap
C/C++ Source or Header
|
1997-03-12
|
2KB
|
86 lines
/*
*
* Netscape Server API Compatibility Layer Header
*
*/
#ifndef NS_FUNC_H
#define NS_FUNC_H
/*
* Define types
*/
#include "base/pblock.h"
#include "frame/req.h"
#include "base/session.h"
typedef int Func(pblock *pb, Session *sn, Request *rq);
typedef Func *FuncPtr;
/* Netscape uses the "next" field. We couldn't care less */
struct FuncStruct {
char * name;
FuncPtr func;
struct FuncStruct * next;
};
/* We don't bother revealing the hash function, because you
* the user should not care about it.
*/
/*
* Function Prototypes
*/
/* NETSCAPE SAYS:
* "func_init reads the static FuncStruct arrays and creates the global
* function table from them.
* func_init will only read from the static arrays defined in func.c."
*
* Our version will just create a global hash table, if the first call
* to func_insert hasn't created it yet. Otherwise it's just an annoying
* stub kept around for compatibility.
*
*/
void func_init(void);
/* NETSCAPE SAYS:
* "func_find returns a pointer to the function named name, or NULL if none
* exists."
*/
FuncPtr func_find(char *name);
/* NETSCAPE SAYS:
* "func_exec will try to execute the function whose name is the "fn" entry
* in the given pblock. If name is not found, it will log a misconfig of
* missing fn parameter. If it can't find it, it will log that. In these
* cases it will return REQ_ABORTED. Otherwise, it will return what the
* function being executed returns."
*/
int func_exec(pblock *pb, Session *sn, Request *rq);
/* NETSCAPE SAYS:
* "func_insert dynamically inserts a named function into the server's
* table of functions. Returns the FuncStruct it keeps in internal
* databases, because on server restart you are responsible for freeing
* (or not) its contents."
*
* The app developer really doesn't need to know what's in the FuncStruct;
* as long the function makes it into the table, they're happy. WE should
* be responsible for freeing things, so we always return NULL.
*/
struct FuncStruct *func_insert(char *name, FuncPtr fn);
#endif /* NS_FUNC_H */