ant-http/plugins/plugin.h

57 lines
1.2 KiB
C
Raw Normal View History

2015-10-22 11:39:11 +02:00
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "dbhelper.h"
#include "dictionary.h"
#include "list.h"
#define IS_POST(method) (strcmp(method,"POST")== 0)
#define IS_GET(method) (strcmp(method,"GET")== 0)
2015-11-24 17:58:32 +01:00
#define R_STR(d,k) ((char*)dvalue(d,k))
#define R_INT(d,k) ((int)dvalue(d,k))
#define R_FLOAT(d,k) ((double)dvalue(d,k))
#define R_PTR(d,k) (dvalue(d,k))
2015-10-22 11:39:11 +02:00
#define __RESULT__ "{\"result\":%d,\"msg\":\"%s\"}"
typedef struct {
char *name;
char *dbpath;
char * htdocs;
char*pdir;
} plugin_header;
typedef void(*call)();
typedef sqlite3* sqldb;
extern plugin_header __plugin__;
extern call __init__;
2015-11-24 17:58:32 +01:00
int response(int, const char*);
2015-10-22 11:39:11 +02:00
void header_base(int);
void header(int,const char*);
void redirect(int,const char*);
void html(int);
void text(int);
void json(int);
void jpeg(int);
2015-11-24 17:58:32 +01:00
void octstream(int, char*);
void textstream(int);
int __ti(int,int);
int __t(int, const char*,...);
int __b(int, const unsigned char*, int);
int __f(int, const char*);
int __fb(int, const char*);
2015-10-22 11:39:11 +02:00
int upload(const char*, const char*);
char* route(const char*);
char* htdocs(const char*);
sqldb getdb();
void dbclose(sqldb);
void set_cookie(int,dictionary);
/*Default function for plugin*/
void execute(int, const char*,dictionary);