Imported existing code
This commit is contained in:
1
libraries/include/xmlrpc-epi/.cvsignore
Normal file
1
libraries/include/xmlrpc-epi/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
tags
|
||||
38
libraries/include/xmlrpc-epi/base64.h
Normal file
38
libraries/include/xmlrpc-epi/base64.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
Encode or decode file as MIME base64 (RFC 1341)
|
||||
|
||||
by John Walker
|
||||
http://www.fourmilab.ch/
|
||||
|
||||
This program is in the public domain.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
struct buffer_st {
|
||||
char *data;
|
||||
int length;
|
||||
char *ptr;
|
||||
int offset;
|
||||
};
|
||||
|
||||
void buffer_new(struct buffer_st *b);
|
||||
void buffer_add(struct buffer_st *b, char c);
|
||||
void buffer_delete(struct buffer_st *b);
|
||||
|
||||
void base64_encode(struct buffer_st *b, const char *source, int length);
|
||||
void base64_decode(struct buffer_st *b, const char *source, int length);
|
||||
|
||||
/*
|
||||
#define DEBUG_MALLOC
|
||||
*/
|
||||
|
||||
#ifdef DEBUG_MALLOC
|
||||
void *_malloc_real(size_t s, char *file, int line);
|
||||
void _free_real(void *p, char *file, int line);
|
||||
|
||||
#define malloc(s) _malloc_real(s,__FILE__,__LINE__)
|
||||
#define free(p) _free_real(p, __FILE__,__LINE__)
|
||||
#endif
|
||||
|
||||
46
libraries/include/xmlrpc-epi/encodings.h
Normal file
46
libraries/include/xmlrpc-epi/encodings.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
This file is part of libXMLRPC - a C library for xml-encoded function calls.
|
||||
|
||||
Author: Dan Libby (dan@libby.com)
|
||||
Epinions.com may be contacted at feedback@epinions-inc.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2000 Epinions, Inc.
|
||||
|
||||
Subject to the following 3 conditions, Epinions, Inc. permits you, free
|
||||
of charge, to (a) use, copy, distribute, modify, perform and display this
|
||||
software and associated documentation files (the "Software"), and (b)
|
||||
permit others to whom the Software is furnished to do so as well.
|
||||
|
||||
1) The above copyright notice and this permission notice shall be included
|
||||
without modification in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
|
||||
ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
|
||||
IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE OR NONINFRINGEMENT.
|
||||
|
||||
3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
|
||||
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ENCODINGS__H
|
||||
#define __ENCODINGS__H
|
||||
|
||||
/* these defines are for legacy purposes. */
|
||||
#define encoding_utf_8 "UTF-8"
|
||||
typedef const char* ENCODING_ID;
|
||||
#define utf8_get_encoding_id_string(desired_enc) ((const char*)desired_enc)
|
||||
#define utf8_get_encoding_id_from_string(id_string) ((ENCODING_ID)id_string)
|
||||
|
||||
char* utf8_encode(const char *s, int len, int *newlen, ENCODING_ID encoding);
|
||||
char* utf8_decode(const char *s, int len, int *newlen, ENCODING_ID encoding);
|
||||
|
||||
#endif /* __ENCODINGS__H */
|
||||
92
libraries/include/xmlrpc-epi/queue.h
Normal file
92
libraries/include/xmlrpc-epi/queue.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Date last modified: Jan 2001
|
||||
* Modifications by Dan Libby (dan@libby.com), including:
|
||||
* - various fixes, null checks, etc
|
||||
* - addition of Q_Iter funcs, macros
|
||||
*/
|
||||
|
||||
/*
|
||||
* File : q.h
|
||||
*
|
||||
* Peter Yard 02 Jan 1993.
|
||||
*
|
||||
* Disclaimer: This code is released to the public domain.
|
||||
*/
|
||||
|
||||
#ifndef Q__H
|
||||
#define Q__H
|
||||
|
||||
#ifndef False_
|
||||
#define False_ 0
|
||||
#endif
|
||||
|
||||
#ifndef True_
|
||||
#define True_ 1
|
||||
#endif
|
||||
|
||||
/* 2006-05-02 Inserted to enable compilation of rpcserver on linux. Phoenix */
|
||||
#define queue xmlrpc_queue
|
||||
|
||||
typedef struct nodeptr datanode;
|
||||
|
||||
typedef struct nodeptr {
|
||||
void *data ;
|
||||
datanode *prev, *next ;
|
||||
} node ;
|
||||
|
||||
/* For external use with Q_Iter* funcs */
|
||||
typedef struct nodeptr* q_iter;
|
||||
|
||||
typedef struct {
|
||||
node *head, *tail, *cursor;
|
||||
int size, sorted, item_deleted;
|
||||
} queue;
|
||||
|
||||
typedef struct {
|
||||
void *dataptr;
|
||||
node *loc ;
|
||||
} index_elt ;
|
||||
|
||||
|
||||
int Q_Init(queue *q);
|
||||
void Q_Destroy(queue *q);
|
||||
int Q_IsEmpty(queue *q);
|
||||
int Q_Size(queue *q);
|
||||
int Q_AtHead(queue *q);
|
||||
int Q_AtTail(queue *q);
|
||||
int Q_PushHead(queue *q, void *d);
|
||||
int Q_PushTail(queue *q, void *d);
|
||||
void *Q_Head(queue *q);
|
||||
void *Q_Tail(queue *q);
|
||||
void *Q_PopHead(queue *q);
|
||||
void *Q_PopTail(queue *q);
|
||||
void *Q_Next(queue *q);
|
||||
void *Q_Previous(queue *q);
|
||||
void *Q_DelCur(queue *q);
|
||||
void *Q_Get(queue *q);
|
||||
int Q_Put(queue *q, void *data);
|
||||
int Q_Sort(queue *q, int (*Comp)(const void *, const void *));
|
||||
int Q_Find(queue *q, void *data,
|
||||
int (*Comp)(const void *, const void *));
|
||||
void *Q_Seek(queue *q, void *data,
|
||||
int (*Comp)(const void *, const void *));
|
||||
int Q_Insert(queue *q, void *data,
|
||||
int (*Comp)(const void *, const void *));
|
||||
|
||||
/* read only funcs for iterating through queue. above funcs modify queue */
|
||||
q_iter Q_Iter_Head(queue *q);
|
||||
q_iter Q_Iter_Tail(queue *q);
|
||||
q_iter Q_Iter_Next(q_iter qi);
|
||||
q_iter Q_Iter_Prev(q_iter qi);
|
||||
void* Q_Iter_Get(q_iter qi);
|
||||
int Q_Iter_Put(q_iter qi, void* data); // not read only! here for completeness.
|
||||
void* Q_Iter_Del(queue *q, q_iter iter); // not read only! here for completeness.
|
||||
|
||||
/* Fast (macro'd) versions of above */
|
||||
#define Q_Iter_Head_F(q) (q ? (q_iter)((queue*)q)->head : NULL)
|
||||
#define Q_Iter_Tail_F(q) (q ? (q_iter)((queue*)q)->tail : NULL)
|
||||
#define Q_Iter_Next_F(qi) (qi ? (q_iter)((node*)qi)->next : NULL)
|
||||
#define Q_Iter_Prev_F(qi) (qi ? (q_iter)((node*)qi)->prev : NULL)
|
||||
#define Q_Iter_Get_F(qi) (qi ? ((node*)qi)->data : NULL)
|
||||
|
||||
#endif /* Q__H */
|
||||
76
libraries/include/xmlrpc-epi/simplestring.h
Normal file
76
libraries/include/xmlrpc-epi/simplestring.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
This file is part of libXMLRPC - a C library for xml-encoded function calls.
|
||||
|
||||
Author: Dan Libby (dan@libby.com)
|
||||
Epinions.com may be contacted at feedback@epinions-inc.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2000 Epinions, Inc.
|
||||
|
||||
Subject to the following 3 conditions, Epinions, Inc. permits you, free
|
||||
of charge, to (a) use, copy, distribute, modify, perform and display this
|
||||
software and associated documentation files (the "Software"), and (b)
|
||||
permit others to whom the Software is furnished to do so as well.
|
||||
|
||||
1) The above copyright notice and this permission notice shall be included
|
||||
without modification in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
|
||||
ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
|
||||
IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE OR NONINFRINGEMENT.
|
||||
|
||||
3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
|
||||
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __SIMPLESTRING_H__
|
||||
#define __SIMPLESTRING_H__
|
||||
|
||||
/*-********************************
|
||||
* begin simplestring header stuff *
|
||||
**********************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/****s* struct/simplestring
|
||||
* NAME
|
||||
* simplestring
|
||||
* NOTES
|
||||
* represents a string efficiently for fast appending, etc.
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _simplestring {
|
||||
char* str; /* string buf */
|
||||
int len; /* length of string/buf */
|
||||
int size; /* size of allocated buffer */
|
||||
} simplestring;
|
||||
/******/
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
void simplestring_init(simplestring* string);
|
||||
void simplestring_clear(simplestring* string);
|
||||
void simplestring_free(simplestring* string);
|
||||
void simplestring_add(simplestring* string, const char* add);
|
||||
void simplestring_addn(simplestring* string, const char* add, int add_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-******************************
|
||||
* end simplestring header stuff *
|
||||
********************************/
|
||||
|
||||
#endif /* __SIMPLESTRING_H__ */
|
||||
202
libraries/include/xmlrpc-epi/xml_element.h
Normal file
202
libraries/include/xmlrpc-epi/xml_element.h
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
This file is part of libXMLRPC - a C library for xml-encoded function calls.
|
||||
|
||||
Author: Dan Libby (dan@libby.com)
|
||||
Epinions.com may be contacted at feedback@epinions-inc.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2000 Epinions, Inc.
|
||||
|
||||
Subject to the following 3 conditions, Epinions, Inc. permits you, free
|
||||
of charge, to (a) use, copy, distribute, modify, perform and display this
|
||||
software and associated documentation files (the "Software"), and (b)
|
||||
permit others to whom the Software is furnished to do so as well.
|
||||
|
||||
1) The above copyright notice and this permission notice shall be included
|
||||
without modification in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
|
||||
ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
|
||||
IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE OR NONINFRINGEMENT.
|
||||
|
||||
3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
|
||||
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __XML_ELEMENT_H__
|
||||
#define __XML_ELEMENT_H__
|
||||
|
||||
/* includes */
|
||||
#include <stdio.h>
|
||||
#include "queue.h"
|
||||
#include "simplestring.h"
|
||||
#include "encodings.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/****d* enum/XML_ELEM_VERBOSITY
|
||||
* NAME
|
||||
* XML_ELEM_VERBOSITY
|
||||
* NOTES
|
||||
* verbosity/readability options for generated xml
|
||||
* SEE ALSO
|
||||
* XML_ELEM_OUTPUT_OPTIONS
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _xml_elem_verbosity {
|
||||
xml_elem_no_white_space, /* compact xml with no white space */
|
||||
xml_elem_newlines_only, /* add newlines for enhanced readability */
|
||||
xml_elem_pretty /* add newlines and indent accordint to depth */
|
||||
} XML_ELEM_VERBOSITY;
|
||||
/******/
|
||||
|
||||
|
||||
/****d* enum/XML_ELEM_ESCAPING
|
||||
* NAME
|
||||
* XML_ELEM_ESCAPING
|
||||
* NOTES
|
||||
* xml escaping options for generated xml
|
||||
* SEE ALSO
|
||||
* XML_ELEM_OUTPUT_OPTIONS
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _xml_elem_escaping {
|
||||
xml_elem_no_escaping = 0x000,
|
||||
xml_elem_markup_escaping = 0x002, /* entity escape xml special chars */
|
||||
xml_elem_non_ascii_escaping = 0x008, /* entity escape chars above 127 */
|
||||
xml_elem_non_print_escaping = 0x010, /* entity escape non print (illegal) chars */
|
||||
xml_elem_cdata_escaping = 0x020, /* wrap in cdata section */
|
||||
} XML_ELEM_ESCAPING;
|
||||
/******/
|
||||
|
||||
|
||||
/****s* struct/XML_ELEM_OUTPUT_OPTIONS
|
||||
* NAME
|
||||
* XML_ELEM_OUTPUT_OPTIONS
|
||||
* NOTES
|
||||
* defines various output options
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _xml_output_options {
|
||||
XML_ELEM_VERBOSITY verbosity; /* length/verbosity of xml */
|
||||
XML_ELEM_ESCAPING escaping; /* how to escape special chars */
|
||||
const char* encoding; /* <?xml encoding="<encoding>" ?> */
|
||||
} STRUCT_XML_ELEM_OUTPUT_OPTIONS, *XML_ELEM_OUTPUT_OPTIONS;
|
||||
/******/
|
||||
|
||||
/****s* struct/XML_ELEM_INPUT_OPTIONS
|
||||
* NAME
|
||||
* XML_ELEM_INPUT_OPTIONS
|
||||
* NOTES
|
||||
* defines various input options
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _xml_input_options {
|
||||
ENCODING_ID encoding; /* which encoding to use. */
|
||||
} STRUCT_XML_ELEM_INPUT_OPTIONS, *XML_ELEM_INPUT_OPTIONS;
|
||||
/******/
|
||||
|
||||
/****s* struct/XML_ELEM_ERROR
|
||||
* NAME
|
||||
* XML_ELEM_ERROR
|
||||
* NOTES
|
||||
* defines an xml parser error
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _xml_elem_error {
|
||||
int parser_code;
|
||||
const char* parser_error;
|
||||
long line;
|
||||
long column;
|
||||
long byte_index;
|
||||
} STRUCT_XML_ELEM_ERROR, *XML_ELEM_ERROR;
|
||||
/******/
|
||||
|
||||
|
||||
/*-************************
|
||||
* begin xml element stuff *
|
||||
**************************/
|
||||
|
||||
/****s* struct/xml_elem_attr
|
||||
* NAME
|
||||
* xml_elem_attr
|
||||
* NOTES
|
||||
* representation of an xml attribute, foo="bar"
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _xml_element_attr {
|
||||
char* key; /* attribute key */
|
||||
char* val; /* attribute value */
|
||||
} xml_element_attr;
|
||||
/******/
|
||||
|
||||
/****s* struct/xml_elem_attr
|
||||
* NAME
|
||||
* xml_elem_attr
|
||||
* NOTES
|
||||
* representation of an xml element, eg <candidate name="Harry Browne" party="Libertarian"/>
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _xml_element {
|
||||
const char* name; /* element identifier */
|
||||
simplestring text; /* text contained between element begin/end pairs */
|
||||
struct _xml_element* parent; /* element's parent */
|
||||
|
||||
queue attrs; /* attribute list */
|
||||
queue children; /* child element list */
|
||||
} xml_element;
|
||||
/******/
|
||||
|
||||
void xml_elem_free(xml_element* root);
|
||||
void xml_elem_free_non_recurse(xml_element* root);
|
||||
xml_element* xml_elem_new();
|
||||
char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len);
|
||||
void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options);
|
||||
xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error);
|
||||
|
||||
/*-**********************
|
||||
* end xml element stuff *
|
||||
************************/
|
||||
|
||||
/*-**********************
|
||||
* Begin xml_element API *
|
||||
************************/
|
||||
|
||||
/****d* VALUE/XMLRPC_MACROS
|
||||
* NAME
|
||||
* Some Helpful Macros
|
||||
* NOTES
|
||||
* Some macros for making life easier. Should be self-explanatory.
|
||||
* SEE ALSO
|
||||
* XMLRPC_AddValueToVector ()
|
||||
* XMLRPC_VectorGetValueWithID_Case ()
|
||||
* XMLRPC_VALUE
|
||||
* SOURCE
|
||||
*/
|
||||
#define xml_elem_next_element(el) ((el) ? (xml_element *)Q_Next(&el->children) : NULL)
|
||||
#define xml_elem_head_element(el) ((el) ? (xml_element *)Q_Head(&el->children) : NULL)
|
||||
#define xml_elem_next_attr(el) ((el) ? (xml_element_attr *)Q_Next(&el->attrs) : NULL)
|
||||
#define xml_elem_head_attr(el) ((el) ? (xml_element_attr *)Q_Head(&el->attrs) : NULL)
|
||||
#define xml_elem_get_name(el) (char *)((el) ? el->name : NULL)
|
||||
#define xml_elem_get_val(el) (char *)((el) ? el->text.str : NULL)
|
||||
/******/
|
||||
|
||||
|
||||
/*-********************
|
||||
* End xml_element API *
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_ELEMENT_H__ */
|
||||
45
libraries/include/xmlrpc-epi/xml_to_xmlrpc.h
Normal file
45
libraries/include/xmlrpc-epi/xml_to_xmlrpc.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
This file is part of libXMLRPC - a C library for xml-encoded function calls.
|
||||
|
||||
Author: Dan Libby (dan@libby.com)
|
||||
Epinions.com may be contacted at feedback@epinions-inc.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2000 Epinions, Inc.
|
||||
|
||||
Subject to the following 3 conditions, Epinions, Inc. permits you, free
|
||||
of charge, to (a) use, copy, distribute, modify, perform and display this
|
||||
software and associated documentation files (the "Software"), and (b)
|
||||
permit others to whom the Software is furnished to do so as well.
|
||||
|
||||
1) The above copyright notice and this permission notice shall be included
|
||||
without modification in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
|
||||
ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
|
||||
IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE OR NONINFRINGEMENT.
|
||||
|
||||
3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
|
||||
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XML_TO_XMLRPC_H
|
||||
#define XML_TO_XMLRPC_H
|
||||
|
||||
#include "time.h"
|
||||
#include "xmlrpc.h"
|
||||
|
||||
XMLRPC_VALUE xml_element_to_XMLRPC_VALUE(xml_element* el);
|
||||
XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST(XMLRPC_REQUEST request, xml_element* el);
|
||||
xml_element* XMLRPC_VALUE_to_xml_element(XMLRPC_VALUE node);
|
||||
xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request);
|
||||
|
||||
#endif /* XML_TO_XMLRPC_H */
|
||||
449
libraries/include/xmlrpc-epi/xmlrpc.h
Normal file
449
libraries/include/xmlrpc-epi/xmlrpc.h
Normal file
@@ -0,0 +1,449 @@
|
||||
/*
|
||||
This file is part of libXMLRPC - a C library for xml-encoded function calls.
|
||||
|
||||
Author: Dan Libby (dan@libby.com)
|
||||
Epinions.com may be contacted at feedback@epinions-inc.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2000 Epinions, Inc.
|
||||
|
||||
Subject to the following 3 conditions, Epinions, Inc. permits you, free
|
||||
of charge, to (a) use, copy, distribute, modify, perform and display this
|
||||
software and associated documentation files (the "Software"), and (b)
|
||||
permit others to whom the Software is furnished to do so as well.
|
||||
|
||||
1) The above copyright notice and this permission notice shall be included
|
||||
without modification in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
|
||||
ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
|
||||
IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE OR NONINFRINGEMENT.
|
||||
|
||||
3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
|
||||
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef XMLRPC_ALREADY_INCLUDED
|
||||
#define XMLRPC_ALREADY_INCLUDED 1
|
||||
|
||||
/* includes */
|
||||
#include "xml_element.h"
|
||||
#include <time.h> /* for time_t */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* this number, representing the date, must be increased each time the API changes */
|
||||
#define XMLRPC_API_NO 20020623
|
||||
|
||||
/* this string should be changed with each packaged release */
|
||||
#define XMLRPC_VERSION_STR "xmlrpc-epi v. " VERSION
|
||||
|
||||
/* where to find more info. shouldn't need to change much */
|
||||
#define XMLRPC_HOME_PAGE_STR "http://xmlprc-epi.sourceforge.net/"
|
||||
|
||||
|
||||
/****d* VALUE/XMLRPC_VALUE_TYPE
|
||||
* NAME
|
||||
* XMLRPC_VALUE_TYPE
|
||||
* NOTES
|
||||
* Defines data types for XMLRPC_VALUE
|
||||
* Deprecated for public use. See XMLRPC_VALUE_TYPE_EASY
|
||||
* SEE ALSO
|
||||
* XMLRPC_VECTOR_TYPE
|
||||
* XMLRPC_REQUEST_TYPE
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _XMLRPC_VALUE_TYPE {
|
||||
xmlrpc_none, /* not a value */
|
||||
xmlrpc_empty, /* empty value, eg NULL */
|
||||
xmlrpc_base64, /* base64 value, eg binary data */
|
||||
xmlrpc_boolean, /* boolean [0 | 1] */
|
||||
xmlrpc_datetime, /* datetime [ISO8601 | time_t] */
|
||||
xmlrpc_double, /* double / floating point */
|
||||
xmlrpc_int, /* integer */
|
||||
xmlrpc_string, /* string */
|
||||
xmlrpc_vector /* vector, aka list, array */
|
||||
} XMLRPC_VALUE_TYPE;
|
||||
/*******/
|
||||
|
||||
/****d* VALUE/XMLRPC_VECTOR_TYPE
|
||||
* NAME
|
||||
* XMLRPC_VECTOR_TYPE
|
||||
* NOTES
|
||||
* Defines data types for XMLRPC_VECTOR.
|
||||
* Deprecated for public use. See XMLRPC_VALUE_TYPE_EASY
|
||||
* SEE ALSO
|
||||
* XMLRPC_VALUE_TYPE
|
||||
* XMLRPC_REQUEST_TYPE
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _XMLRPC_VECTOR_TYPE {
|
||||
xmlrpc_vector_none, /* not an array */
|
||||
xmlrpc_vector_array, /* no values may have key names */
|
||||
xmlrpc_vector_mixed, /* some values may have key names */
|
||||
xmlrpc_vector_struct /* all values must have key names */
|
||||
} XMLRPC_VECTOR_TYPE;
|
||||
/*******/
|
||||
|
||||
/****d* VALUE/XMLRPC_VALUE_TYPE_EASY
|
||||
* NAME
|
||||
* XMLRPC_VALUE_TYPE_EASY
|
||||
* NOTES
|
||||
* Defines data types for XMLRPC_VALUE, including vector types.
|
||||
* SEE ALSO
|
||||
* XMLRPC_VECTOR_TYPE
|
||||
* XMLRPC_REQUEST_TYPE
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _XMLRPC_VALUE_TYPE_EASY {
|
||||
xmlrpc_type_none, /* not a value */
|
||||
xmlrpc_type_empty, /* empty value, eg NULL */
|
||||
xmlrpc_type_base64, /* base64 value, eg binary data */
|
||||
xmlrpc_type_boolean, /* boolean [0 | 1] */
|
||||
xmlrpc_type_datetime, /* datetime [ISO8601 | time_t] */
|
||||
xmlrpc_type_double, /* double / floating point */
|
||||
xmlrpc_type_int, /* integer */
|
||||
xmlrpc_type_string, /* string */
|
||||
/* -- IMPORTANT: identical to XMLRPC_VALUE_TYPE to this point. -- */
|
||||
xmlrpc_type_array, /* vector array */
|
||||
xmlrpc_type_mixed, /* vector mixed */
|
||||
xmlrpc_type_struct /* vector struct */
|
||||
} XMLRPC_VALUE_TYPE_EASY;
|
||||
/*******/
|
||||
|
||||
|
||||
/****d* VALUE/XMLRPC_REQUEST_TYPE
|
||||
* NAME
|
||||
* XMLRPC_REQUEST_TYPE
|
||||
* NOTES
|
||||
* Defines data types for XMLRPC_REQUEST
|
||||
* SEE ALSO
|
||||
* XMLRPC_VALUE_TYPE
|
||||
* XMLRPC_VECTOR_TYPE
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _xmlrpc_request_type {
|
||||
xmlrpc_request_none, /* not a valid request */
|
||||
xmlrpc_request_call, /* calling/invoking a method */
|
||||
xmlrpc_request_response, /* responding to a method call */
|
||||
} XMLRPC_REQUEST_TYPE;
|
||||
/*******/
|
||||
|
||||
/****d* VALUE/XMLRPC_ERROR_CODE
|
||||
* NAME
|
||||
* XMLRPC_ERROR_CODE
|
||||
* NOTES
|
||||
* All existing error codes
|
||||
* SEE ALSO
|
||||
* XMLRPC_REQUEST_ERROR
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _xmlrpc_error_code {
|
||||
xmlrpc_error_none = 0, /* not an error */
|
||||
xmlrpc_error_parse_xml_syntax = -32700,
|
||||
xmlrpc_error_parse_unknown_encoding = -32701,
|
||||
xmlrpc_error_parse_bad_encoding = -32702,
|
||||
xmlrpc_error_invalid_xmlrpc = -32600,
|
||||
xmlrpc_error_unknown_method = -32601,
|
||||
xmlrpc_error_invalid_params = -32602,
|
||||
xmlrpc_error_internal_server = -32603,
|
||||
xmlrpc_error_application = -32500,
|
||||
xmlrpc_error_system = -32400,
|
||||
xmlrpc_error_transport = -32300
|
||||
} XMLRPC_ERROR_CODE;
|
||||
/******/
|
||||
|
||||
#define xmlrpc_error_parse_xml_syntax_str "parse error. not well formed."
|
||||
#define xmlrpc_error_parse_unknown_encoding_str "parse error. unknown encoding"
|
||||
#define xmlrpc_error_parse_bad_encoding_str "parse error. invalid character for encoding"
|
||||
#define xmlrpc_error_invalid_xmlrpc_str "server error. xml-rpc not conforming to spec"
|
||||
#define xmlrpc_error_unknown_method_str "server error. method not found."
|
||||
#define xmlrpc_error_invalid_params_str "server error. invalid method parameters"
|
||||
#define xmlrpc_error_internal_server_str "server error. internal xmlrpc library error"
|
||||
#define xmlrpc_error_application_str "application error."
|
||||
#define xmlrpc_error_system_str "system error."
|
||||
#define xmlrpc_error_transport_str "transport error."
|
||||
|
||||
|
||||
|
||||
/****d* VALUE/XMLRPC_VERSION
|
||||
* NAME
|
||||
* XMLRPC_VERSION
|
||||
* NOTES
|
||||
* Defines xml vocabulary used for generated xml
|
||||
* SEE ALSO
|
||||
* XMLRPC_REQUEST_OUTPUT_OPTIONS
|
||||
* XMLRPC_REQUEST_To_XML ()
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _xmlrpc_version {
|
||||
xmlrpc_version_none = 0, /* not a recognized vocabulary */
|
||||
xmlrpc_version_1_0 = 1, /* xmlrpc 1.0 standard vocab */
|
||||
xmlrpc_version_simple = 2, /* alt more readable vocab */
|
||||
xmlrpc_version_danda = 2, /* same as simple. legacy */
|
||||
xmlrpc_version_soap_1_1 = 3 /* SOAP. version 1.1 */
|
||||
} XMLRPC_VERSION;
|
||||
/******/
|
||||
|
||||
/****s* VALUE/XMLRPC_REQUEST_OUTPUT_OPTIONS
|
||||
* NAME
|
||||
* XMLRPC_REQUEST_OUTPUT_OPTIONS
|
||||
* NOTES
|
||||
* Defines output options for generated xml
|
||||
* SEE ALSO
|
||||
* XMLRPC_VERSION
|
||||
* XML_ELEM_OUTPUT_OPTIONS
|
||||
* XMLRPC_REQUEST_To_XML ()
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _xmlrpc_request_output_options {
|
||||
STRUCT_XML_ELEM_OUTPUT_OPTIONS xml_elem_opts; /* xml_element specific output options */
|
||||
XMLRPC_VERSION version; /* xml vocabulary to use */
|
||||
} STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS, *XMLRPC_REQUEST_OUTPUT_OPTIONS;
|
||||
/******/
|
||||
|
||||
/****s* VALUE/XMLRPC_REQUEST_INPUT_OPTIONS
|
||||
* NAME
|
||||
* XMLRPC_REQUEST_INPUT_OPTIONS
|
||||
* NOTES
|
||||
* Defines options for reading in xml data
|
||||
* SEE ALSO
|
||||
* XMLRPC_VERSION
|
||||
* XML_ELEM_INPUT_OPTIONS
|
||||
* XMLRPC_REQUEST_From_XML ()
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _xmlrpc_request_input_options {
|
||||
STRUCT_XML_ELEM_INPUT_OPTIONS xml_elem_opts; /* xml_element specific output options */
|
||||
} STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS, *XMLRPC_REQUEST_INPUT_OPTIONS;
|
||||
/******/
|
||||
|
||||
/****s* VALUE/XMLRPC_ERROR
|
||||
* NAME
|
||||
* XMLRPC_ERROR
|
||||
* NOTES
|
||||
* For the reporting and handling of errors
|
||||
* SOURCE
|
||||
*/
|
||||
typedef struct _xmlrpc_error {
|
||||
XMLRPC_ERROR_CODE code;
|
||||
STRUCT_XML_ELEM_ERROR xml_elem_error; /* xml_element errors (parser errors) */
|
||||
} STRUCT_XMLRPC_ERROR, *XMLRPC_ERROR;
|
||||
/******/
|
||||
|
||||
|
||||
/****d* VALUE/XMLRPC_CASE_COMPARISON
|
||||
* NAME
|
||||
* XMLRPC_CASE_COMPARISON
|
||||
* NOTES
|
||||
* Defines case comparison options for XMLRPC_VALUE/VECTOR API's
|
||||
* SEE ALSO
|
||||
* XMLRPC_CASE
|
||||
* XMLRPC_VALUE
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _xmlrpc_case_comparison {
|
||||
xmlrpc_case_insensitive, /* use case-insensitive compare */
|
||||
xmlrpc_case_sensitive /* use case-sensitive compare */
|
||||
} XMLRPC_CASE_COMPARISON;
|
||||
/******/
|
||||
|
||||
/****d* VALUE/XMLRPC_CASE
|
||||
* NAME
|
||||
* XMLRPC_CASE
|
||||
* NOTES
|
||||
* Defines case behavior when setting IDs in XMLRPC_VALUE API's
|
||||
* SEE ALSO
|
||||
* XMLRPC_CASE_COMPARISON
|
||||
* XMLRPC_VALUE
|
||||
* SOURCE
|
||||
*/
|
||||
typedef enum _xmlrpc_case {
|
||||
xmlrpc_case_exact, /* leave case alone */
|
||||
xmlrpc_case_lower, /* lower-case id */
|
||||
xmlrpc_case_upper /* upper-case id */
|
||||
} XMLRPC_CASE;
|
||||
/******/
|
||||
|
||||
/* if you don't like these defaults, you can set them with XMLRPC_SetDefaultIdCase*() */
|
||||
#define XMLRPC_DEFAULT_ID_CASE XMLRPC_GetDefaultIdCase()
|
||||
#define XMLRPC_DEFAULT_ID_CASE_SENSITIVITY XMLRPC_GetDefaultIdCaseComparison()
|
||||
|
||||
/* opaque (non-public) types. defined locally in xmlrpc.c */
|
||||
typedef struct _xmlrpc_request* XMLRPC_REQUEST;
|
||||
typedef struct _xmlrpc_server* XMLRPC_SERVER;
|
||||
typedef struct _xmlrpc_value* XMLRPC_VALUE;
|
||||
|
||||
/****d* VALUE/XMLRPC_Callback
|
||||
* NAME
|
||||
* XMLRPC_Callback
|
||||
* NOTES
|
||||
* Function prototype for user defined method handlers (callbacks).
|
||||
* SEE ALSO
|
||||
* XMLRPC_ServerRegisterMethod ()
|
||||
* XMLRPC_ServerCallMethod ()
|
||||
* XMLRPC_REQUEST
|
||||
* XMLRPC_VALUE
|
||||
* SOURCE
|
||||
*/
|
||||
typedef XMLRPC_VALUE (*XMLRPC_Callback)(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
|
||||
/******/
|
||||
|
||||
/* ID Case Defaults */
|
||||
XMLRPC_CASE XMLRPC_GetDefaultIdCase();
|
||||
XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case);
|
||||
XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison();
|
||||
XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case);
|
||||
|
||||
/* Vector manipulation */
|
||||
int XMLRPC_VectorSize(XMLRPC_VALUE value);
|
||||
XMLRPC_VALUE XMLRPC_VectorRewind(XMLRPC_VALUE value);
|
||||
XMLRPC_VALUE XMLRPC_VectorNext(XMLRPC_VALUE value);
|
||||
int XMLRPC_SetIsVector(XMLRPC_VALUE value, XMLRPC_VECTOR_TYPE type);
|
||||
int XMLRPC_AddValueToVector(XMLRPC_VALUE target, XMLRPC_VALUE source);
|
||||
int XMLRPC_AddValuesToVector(XMLRPC_VALUE target, ...);
|
||||
int XMLRPC_VectorRemoveValue(XMLRPC_VALUE vector, XMLRPC_VALUE value);
|
||||
XMLRPC_VALUE XMLRPC_VectorGetValueWithID_Case(XMLRPC_VALUE vector, const char* id, XMLRPC_CASE_COMPARISON id_case);
|
||||
|
||||
|
||||
/* Create values */
|
||||
XMLRPC_VALUE XMLRPC_CreateValueBoolean(const char* id, int truth);
|
||||
XMLRPC_VALUE XMLRPC_CreateValueBase64(const char* id, const char* s, int len);
|
||||
XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time);
|
||||
XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s);
|
||||
XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double f);
|
||||
XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i);
|
||||
XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* s, int len);
|
||||
XMLRPC_VALUE XMLRPC_CreateValueEmpty();
|
||||
XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type);
|
||||
|
||||
/* Cleanup values */
|
||||
void XMLRPC_CleanupValue(XMLRPC_VALUE value);
|
||||
|
||||
/* Request error */
|
||||
XMLRPC_VALUE XMLRPC_RequestSetError (XMLRPC_REQUEST request, XMLRPC_VALUE error);
|
||||
XMLRPC_VALUE XMLRPC_RequestGetError (XMLRPC_REQUEST request);
|
||||
|
||||
/* Copy values */
|
||||
XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value);
|
||||
XMLRPC_VALUE XMLRPC_DupValueNew(XMLRPC_VALUE xSource);
|
||||
|
||||
/* Set Values */
|
||||
void XMLRPC_SetValueDateTime(XMLRPC_VALUE value, time_t time);
|
||||
void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s);
|
||||
void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val);
|
||||
void XMLRPC_SetValueInt(XMLRPC_VALUE value, int val);
|
||||
void XMLRPC_SetValueBoolean(XMLRPC_VALUE value, int val);
|
||||
const char *XMLRPC_SetValueString(XMLRPC_VALUE value, const char* s, int len);
|
||||
void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len);
|
||||
const char *XMLRPC_SetValueID_Case(XMLRPC_VALUE value, const char* id, int len, XMLRPC_CASE id_case);
|
||||
#define XMLRPC_SetValueID(value, id, len) XMLRPC_SetValueID_Case(value, id, len, XMLRPC_DEFAULT_ID_CASE)
|
||||
|
||||
/* Get Values */
|
||||
const char* XMLRPC_GetValueString(XMLRPC_VALUE value);
|
||||
int XMLRPC_GetValueStringLen(XMLRPC_VALUE value);
|
||||
int XMLRPC_GetValueInt(XMLRPC_VALUE value);
|
||||
int XMLRPC_GetValueBoolean(XMLRPC_VALUE value);
|
||||
double XMLRPC_GetValueDouble(XMLRPC_VALUE value);
|
||||
const char* XMLRPC_GetValueBase64(XMLRPC_VALUE value);
|
||||
time_t XMLRPC_GetValueDateTime(XMLRPC_VALUE value);
|
||||
const char* XMLRPC_GetValueDateTime_ISO8601(XMLRPC_VALUE value);
|
||||
const char* XMLRPC_GetValueID(XMLRPC_VALUE value);
|
||||
|
||||
/* Type introspection */
|
||||
XMLRPC_VALUE_TYPE XMLRPC_GetValueType(XMLRPC_VALUE v);
|
||||
XMLRPC_VALUE_TYPE_EASY XMLRPC_GetValueTypeEasy(XMLRPC_VALUE v);
|
||||
XMLRPC_VECTOR_TYPE XMLRPC_GetVectorType(XMLRPC_VALUE v);
|
||||
|
||||
/* Parsing and Creating XML */
|
||||
XMLRPC_REQUEST XMLRPC_REQUEST_FromXML(const char* in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options);
|
||||
XMLRPC_VALUE XMLRPC_VALUE_FromXML(const char* in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options);
|
||||
char* XMLRPC_REQUEST_ToXML(XMLRPC_REQUEST request, int *buf_len);
|
||||
char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val, int* buf_len);
|
||||
|
||||
/* Request manipulation funcs */
|
||||
const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName);
|
||||
const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request);
|
||||
XMLRPC_REQUEST XMLRPC_RequestNew();
|
||||
void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO);
|
||||
XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output);
|
||||
XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request);
|
||||
XMLRPC_VALUE XMLRPC_RequestSetData(XMLRPC_REQUEST request, XMLRPC_VALUE data);
|
||||
XMLRPC_VALUE XMLRPC_RequestGetData(XMLRPC_REQUEST request);
|
||||
XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType(XMLRPC_REQUEST request, XMLRPC_REQUEST_TYPE type);
|
||||
XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request);
|
||||
|
||||
/* Server Creation/Destruction; Method Registration and Invocation */
|
||||
XMLRPC_SERVER XMLRPC_ServerCreate();
|
||||
XMLRPC_SERVER XMLRPC_GetGlobalServer(); /* better to use XMLRPC_ServerCreate if you can */
|
||||
void XMLRPC_ServerDestroy(XMLRPC_SERVER server);
|
||||
int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb);
|
||||
XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName);
|
||||
XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData);
|
||||
|
||||
#include "xmlrpc_introspection.h"
|
||||
|
||||
/* Fault interrogation funcs */
|
||||
int XMLRPC_ValueIsFault (XMLRPC_VALUE value);
|
||||
int XMLRPC_ResponseIsFault(XMLRPC_REQUEST response);
|
||||
int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value);
|
||||
int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response);
|
||||
const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value);
|
||||
const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response);
|
||||
|
||||
|
||||
/* Public Utility funcs */
|
||||
XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string);
|
||||
void XMLRPC_Free(void* mem);
|
||||
const char* XMLRPC_GetVersionString();
|
||||
|
||||
/****d* VALUE/XMLRPC_MACROS
|
||||
* NAME
|
||||
* Some Helpful Macros
|
||||
* NOTES
|
||||
* Some macros for making life easier. Should be self-explanatory.
|
||||
* SEE ALSO
|
||||
* XMLRPC_AddValueToVector ()
|
||||
* XMLRPC_VectorGetValueWithID_Case ()
|
||||
* XMLRPC_VALUE
|
||||
* SOURCE
|
||||
*/
|
||||
|
||||
/* Append values to vector */
|
||||
#define XMLRPC_VectorAppendString(vector, id, s, len) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueString(id, s, len))
|
||||
#define XMLRPC_VectorAppendBase64(vector, id, s, len) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueBase64(id, s, len))
|
||||
#define XMLRPC_VectorAppendDateTime(vector, id, time) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDateTime(id, time))
|
||||
#define XMLRPC_VectorAppendDateTime_ISO8601(vector, id, s) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDateTime_ISO8601(id, s))
|
||||
#define XMLRPC_VectorAppendDouble(vector, id, f) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDouble(id, f))
|
||||
#define XMLRPC_VectorAppendInt(vector, id, i) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueInt(id, i))
|
||||
#define XMLRPC_VectorAppendBoolean(vector, id, i) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueBoolean(id, i))
|
||||
|
||||
/* Get named values from vector */
|
||||
#define XMLRPC_VectorGetValueWithID(vector, id) XMLRPC_VectorGetValueWithID_Case(vector, id, XMLRPC_DEFAULT_ID_CASE_SENSITIVITY)
|
||||
#define XMLRPC_VectorGetStringWithID(vector, id) XMLRPC_GetValueString(XMLRPC_VectorGetValueWithID(vector, id))
|
||||
#define XMLRPC_VectorGetBase64WithID(vector, id) XMLRPC_GetValueBase64(XMLRPC_VectorGetValueWithID(vector, id))
|
||||
#define XMLRPC_VectorGetDateTimeWithID(vector, id) XMLRPC_GetValueDateTime(XMLRPC_VectorGetValueWithID(vector, id))
|
||||
#define XMLRPC_VectorGetDoubleWithID(vector, id) XMLRPC_GetValueDouble(XMLRPC_VectorGetValueWithID(vector, id))
|
||||
#define XMLRPC_VectorGetIntWithID(vector, id) XMLRPC_GetValueInt(XMLRPC_VectorGetValueWithID(vector, id))
|
||||
#define XMLRPC_VectorGetBooleanWithID(vector, id) XMLRPC_GetValueBoolean(XMLRPC_VectorGetValueWithID(vector, id))
|
||||
|
||||
/******/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not XMLRPC_ALREADY_INCLUDED */
|
||||
|
||||
|
||||
|
||||
101
libraries/include/xmlrpc-epi/xmlrpc_introspection.h
Normal file
101
libraries/include/xmlrpc-epi/xmlrpc_introspection.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
This file is part of libXMLRPC - a C library for xml-encoded function calls.
|
||||
|
||||
Author: Dan Libby (dan@libby.com)
|
||||
Epinions.com may be contacted at feedback@epinions-inc.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2000 Epinions, Inc.
|
||||
|
||||
Subject to the following 3 conditions, Epinions, Inc. permits you, free
|
||||
of charge, to (a) use, copy, distribute, modify, perform and display this
|
||||
software and associated documentation files (the "Software"), and (b)
|
||||
permit others to whom the Software is furnished to do so as well.
|
||||
|
||||
1) The above copyright notice and this permission notice shall be included
|
||||
without modification in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
|
||||
ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
|
||||
IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE OR NONINFRINGEMENT.
|
||||
|
||||
3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
|
||||
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
*/
|
||||
|
||||
/* IMPORTANT!
|
||||
*
|
||||
* only public (official API) things should be in this file. Anything else
|
||||
* should go in <group>_private.h, or in the appropriate .c file.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XI_INTROSPECTION_H
|
||||
/*
|
||||
* Avoid include redundancy.
|
||||
*/
|
||||
#define __XI_INTROSPECTION_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* xmlrpc_introspection.h
|
||||
*
|
||||
* Purpose:
|
||||
* define public introspection API
|
||||
* Comments:
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Constants
|
||||
*/
|
||||
#define xi_token_params "params"
|
||||
#define xi_token_returns "returns"
|
||||
#define xi_token_related "related"
|
||||
#define xi_token_sub "sub"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Includes
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Structures
|
||||
*/
|
||||
|
||||
/****d* VALUE/XMLRPC_IntrospectionCallback
|
||||
* NAME
|
||||
* XMLRPC_IntrospectionCallback
|
||||
* NOTES
|
||||
* Function prototype for lazy documentation generation (not generated until requested).
|
||||
* SOURCE
|
||||
*/
|
||||
typedef void (*XMLRPC_IntrospectionCallback)(XMLRPC_SERVER server, void* userData);
|
||||
/******/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Globals
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR error);
|
||||
int XMLRPC_ServerAddIntrospectionData(XMLRPC_SERVER server, XMLRPC_VALUE desc);
|
||||
int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_IntrospectionCallback cb);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Macros
|
||||
*/
|
||||
|
||||
|
||||
#endif /* __XI_INTROSPECTION_H */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user