ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/rpc/include/xml/rpc.h
Revision: 1.2
Committed: Sun Sep 16 18:54:44 2007 UTC (19 years, 1 month ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +9 -2 lines
Log Message:
#defines to enum

File Contents

# User Rev Content
1 pippijn 1.2 /**
2     * account.h: Data structures for account information.
3     *
4     * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
5     * Rights to this code are as documented in COPYING.
6     *
7     *
8     * Portions of this file were derived from sources bearing the following license:
9 pippijn 1.1 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
10     * Copyright © 2005 Atheme Development Group
11     * and Trystan Scott Lee <trystan@nomadirc.net>
12     *
13     * XMLRPC library header, hacked up for Atheme.
14     *
15 pippijn 1.2 * $Id: rpc.h,v 1.1 2007-07-19 08:24:56 pippijn Exp $
16 pippijn 1.1 */
17     #ifndef XMLRPC_H
18     #define XMLRPC_H
19    
20     #include "atheme.h"
21    
22     #define stricmp strcasecmp
23    
24     enum
25     {
26     XMLRPC_CONT = 0,
27     XMLRPC_STOP = 1
28     };
29    
30     enum xmlrpc_error
31     {
32     XMLRPC_ERR_OK = 0,
33     XMLRPC_ERR_MEMORY = 1,
34     XMLRPC_ERR_PARAMS = 2,
35     XMLRPC_ERR_EXISTS = 3,
36     XMLRPC_ERR_NOEXIST = 4,
37     XMLRPC_ERR_NOUSER = 5,
38     XMLRPC_ERR_NOLOAD = 6,
39     XMLRPC_ERR_NOUNLOAD = 7,
40     XMLRPC_ERR_SYNTAX = 8,
41     XMLRPC_ERR_NODELETE = 9,
42     XMLRPC_ERR_UNKNOWN = 10,
43     XMLRPC_ERR_FILE_IO = 11,
44     XMLRPC_ERR_NOSERVICE = 12
45     };
46    
47     /*
48     * Header that defines much of the xml/xmlrpc library
49     */
50    
51     #define XMLRPC_BUFSIZE 1024
52     #define XMLLIB_VERSION "1.0.0"
53     #define XMLLIB_AUTHOR "Trystan Scott Lee <trystan@nomadirc.net>"
54    
55     #define MAX_CMD_HASH 1024
56    
57     #define XMLRPC_ON "on"
58     #define XMLRPC_OFF "off"
59    
60     #define XMLRPC_I4 "i4"
61     #define XMLRPC_INT "integer"
62    
63     enum
64     {
65     XMLRPC_HTTP_HEADER = 1,
66     XMLRPC_ENCODE = 2,
67     XMLRPC_INTTAG = 3
68     };
69    
70     inline int
71     gen_cmd_hash (char const *arg)
72     {
73     return ((arg[0] & 31) << 5 | (arg[1] & 31)); /* Will gen a hash from a string :) */
74     }
75    
76     typedef int (*XMLRPCMethodFunc)(void *userdata, int ac, char **av);
77    
78     struct xmlrpc_cmd {
79     XMLRPCMethodFunc func;
80     char *name;
81     xmlrpc_cmd *next;
82     };
83    
84     struct xmlrpc_cmdhash {
85     char *name;
86     xmlrpc_cmd *xml;
87     xmlrpc_cmdhash *next;
88     };
89    
90     extern xmlrpc_cmdhash *xmlrpc_cmds[MAX_CMD_HASH];
91    
92     struct xmlrpc_set
93     {
94     char *(*setbuffer)(char *buffer, int len);
95     char *encode;
96     int httpheader;
97     char *inttagstart;
98     char *inttagend;
99     };
100    
101     E void xmlrpc_process(char *buffer, void *userdata);
102     E int xmlrpc_register_method(char const *name, XMLRPCMethodFunc func);
103     E int xmlrpc_unregister_method(char const *method);
104    
105     E char *xmlrpc_string(char *buf, char const *value);
106    
107     E void xmlrpc_set_buffer(char *(*func)(char *buffer, int len));
108     E void xmlrpc_generic_error(int code, char const *string);
109     E void xmlrpc_send(int argc, ...);
110     E void xmlrpc_char_encode(char *outbuffer, char const *s1);
111     E char *xmlrpc_decode_string(char *buf);
112    
113     #endif