2006-04-20 04:08:12 +00:00
|
|
|
/*
|
|
|
|
* $Id: $
|
|
|
|
* Simple plug-in api for output, transcode, and scanning plug-ins
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Ron Pedde (ron@pedde.com)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PLUGIN_H_
|
|
|
|
#define _PLUGIN_H_
|
|
|
|
|
2006-04-20 06:52:21 +00:00
|
|
|
#include "webserver.h"
|
2006-04-23 04:42:18 +00:00
|
|
|
#include "xml-rpc.h"
|
2006-04-20 06:52:21 +00:00
|
|
|
|
2006-04-22 18:22:41 +00:00
|
|
|
extern int plugin_init(void);
|
2006-04-20 04:08:12 +00:00
|
|
|
extern int plugin_load(char **pe, char *path);
|
2006-04-22 18:22:41 +00:00
|
|
|
extern int plugin_deinit(void);
|
2006-04-20 04:08:12 +00:00
|
|
|
|
2006-04-20 06:52:21 +00:00
|
|
|
/* Interfaces for web */
|
|
|
|
extern int plugin_url_candispatch(WS_CONNINFO *pwsc);
|
|
|
|
extern void plugin_url_handle(WS_CONNINFO *pwsc);
|
2006-04-22 19:45:49 +00:00
|
|
|
extern int plugin_auth_handle(WS_CONNINFO *pwsc, char *username, char *pw);
|
2006-04-25 23:13:04 +00:00
|
|
|
extern int plugin_rend_register(char *name, int port, char *iface);
|
|
|
|
|
2006-04-20 06:52:21 +00:00
|
|
|
|
2006-04-20 04:08:12 +00:00
|
|
|
#define PLUGIN_E_SUCCESS 0
|
|
|
|
#define PLUGIN_E_NOLOAD 1
|
|
|
|
#define PLUGIN_E_BADFUNCS 2
|
|
|
|
|
2006-04-20 06:52:21 +00:00
|
|
|
#define PLUGIN_OUTPUT 0
|
|
|
|
#define PLUGIN_SCANNER 1
|
|
|
|
#define PLUGIN_DATABASE 2
|
|
|
|
#define PLUGIN_OTHER 3
|
|
|
|
|
|
|
|
#define PLUGIN_VERSION 1
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct tag_plugin_output_fn {
|
|
|
|
void(*handler)(WS_CONNINFO *pwsc);
|
2006-04-22 19:45:49 +00:00
|
|
|
int(*auth)(WS_CONNINFO *pwsc, char *username, char *pw);
|
2006-04-20 06:52:21 +00:00
|
|
|
} PLUGIN_OUTPUT_FN;
|
|
|
|
|
|
|
|
/* version 1 plugin info */
|
2006-04-25 23:13:04 +00:00
|
|
|
typedef struct tag_plugin_rend_info {
|
|
|
|
char *type;
|
|
|
|
char *txt;
|
|
|
|
} PLUGIN_REND_INFO;
|
|
|
|
|
2006-04-20 06:52:21 +00:00
|
|
|
typedef struct tag_plugin_info {
|
|
|
|
int version;
|
|
|
|
int type;
|
|
|
|
char *server;
|
|
|
|
char *url; /* for output plugins */
|
|
|
|
void *handler_functions;
|
2006-04-23 04:42:18 +00:00
|
|
|
void *pi; /* exported functions */
|
2006-04-25 23:13:04 +00:00
|
|
|
PLUGIN_REND_INFO **rend_info;
|
2006-04-20 06:52:21 +00:00
|
|
|
} PLUGIN_INFO;
|
|
|
|
|
2006-04-23 04:42:18 +00:00
|
|
|
/* version 1 plugin imports */
|
|
|
|
typedef struct tag_plugin_input_fn {
|
|
|
|
/* webserver helpers */
|
|
|
|
char* (*ws_uri)(WS_CONNINFO *);
|
|
|
|
void (*ws_close)(WS_CONNINFO *);
|
|
|
|
int (*ws_returnerror)(WS_CONNINFO *, int, char *);
|
|
|
|
char* (*ws_getvar)(WS_CONNINFO *, char *);
|
2006-04-25 10:02:43 +00:00
|
|
|
int (*ws_writefd)(WS_CONNINFO *, char *, ...);
|
|
|
|
int (*ws_addresponseheader)(WS_CONNINFO *, char *, char *, ...);
|
|
|
|
void (*ws_emitheaders)(WS_CONNINFO *);
|
|
|
|
int (*ws_fd)(WS_CONNINFO *);
|
|
|
|
char* (*ws_getrequestheader)(WS_CONNINFO *, char *);
|
2006-04-25 20:46:03 +00:00
|
|
|
int (*ws_writebinary)(WS_CONNINFO *, char *, int);
|
2006-04-23 04:42:18 +00:00
|
|
|
|
|
|
|
/* misc helpers */
|
|
|
|
char* (*server_ver)(void);
|
|
|
|
int (*server_name)(char *, int *);
|
|
|
|
void (*log)(int, char *, ...);
|
|
|
|
|
|
|
|
int (*db_count)(void);
|
|
|
|
int (*db_enum_start)(char **, DBQUERYINFO *);
|
|
|
|
int (*db_enum_fetch_row)(char **, char ***, DBQUERYINFO *);
|
|
|
|
int (*db_enum_end)(char **);
|
|
|
|
void (*stream)(WS_CONNINFO *, DBQUERYINFO *, char *);
|
|
|
|
|
|
|
|
PARSETREE (*sp_init)(void);
|
|
|
|
int (*sp_parse)(PARSETREE tree, char *term);
|
|
|
|
int (*sp_dispose)(PARSETREE tree);
|
|
|
|
char* (*sp_get_error)(PARSETREE tree);
|
|
|
|
} PLUGIN_INPUT_FN;
|
2006-04-20 04:08:12 +00:00
|
|
|
|
|
|
|
#endif /* _PLUGIN_H_ */
|