/** * account.h: Data structures for account information. * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. * * * Portions of this file were derived from sources bearing the following license: * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Copyright © 2005 Atheme Development Group * and Trystan Scott Lee * * XMLRPC library header, hacked up for Atheme. * * $Id: rpc.h,v 1.2 2007/09/16 18:54:44 pippijn Exp $ */ #ifndef XMLRPC_H #define XMLRPC_H #include "atheme.h" #define stricmp strcasecmp enum { XMLRPC_CONT = 0, XMLRPC_STOP = 1 }; enum xmlrpc_error { XMLRPC_ERR_OK = 0, XMLRPC_ERR_MEMORY = 1, XMLRPC_ERR_PARAMS = 2, XMLRPC_ERR_EXISTS = 3, XMLRPC_ERR_NOEXIST = 4, XMLRPC_ERR_NOUSER = 5, XMLRPC_ERR_NOLOAD = 6, XMLRPC_ERR_NOUNLOAD = 7, XMLRPC_ERR_SYNTAX = 8, XMLRPC_ERR_NODELETE = 9, XMLRPC_ERR_UNKNOWN = 10, XMLRPC_ERR_FILE_IO = 11, XMLRPC_ERR_NOSERVICE = 12 }; /* * Header that defines much of the xml/xmlrpc library */ #define XMLRPC_BUFSIZE 1024 #define XMLLIB_VERSION "1.0.0" #define XMLLIB_AUTHOR "Trystan Scott Lee " #define MAX_CMD_HASH 1024 #define XMLRPC_ON "on" #define XMLRPC_OFF "off" #define XMLRPC_I4 "i4" #define XMLRPC_INT "integer" enum { XMLRPC_HTTP_HEADER = 1, XMLRPC_ENCODE = 2, XMLRPC_INTTAG = 3 }; inline int gen_cmd_hash (char const *arg) { return ((arg[0] & 31) << 5 | (arg[1] & 31)); /* Will gen a hash from a string :) */ } typedef int (*XMLRPCMethodFunc)(void *userdata, int ac, char **av); struct xmlrpc_cmd { XMLRPCMethodFunc func; char *name; xmlrpc_cmd *next; }; struct xmlrpc_cmdhash { char *name; xmlrpc_cmd *xml; xmlrpc_cmdhash *next; }; extern xmlrpc_cmdhash *xmlrpc_cmds[MAX_CMD_HASH]; struct xmlrpc_set { char *(*setbuffer)(char *buffer, int len); char *encode; int httpheader; char *inttagstart; char *inttagend; }; E void xmlrpc_process(char *buffer, void *userdata); E int xmlrpc_register_method(char const *name, XMLRPCMethodFunc func); E int xmlrpc_unregister_method(char const *method); E char *xmlrpc_string(char *buf, char const *value); E void xmlrpc_set_buffer(char *(*func)(char *buffer, int len)); E void xmlrpc_generic_error(int code, char const *string); E void xmlrpc_send(int argc, ...); E void xmlrpc_char_encode(char *outbuffer, char const *s1); E char *xmlrpc_decode_string(char *buf); #endif