Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

xmlrpc.h File Reference

#include "gwlib/gwlib.h"

Include dependency graph for xmlrpc.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define xmlrpc_create_call(method)   xmlrpc_doc_create_call(method)
#define xmlrpc_parse_call(post_body)   xmlrpc_doc_parse(post_body, xr_methodcall)
#define xmlrpc_destroy_call(call)   xmlrpc_doc_destroy(call, xr_methodcall)
#define xmlrpc_add_call_scalar(call, type, arg)   xmlrpc_doc_add_scalar(call, xr_methodcall, type, arg)
#define xmlrpc_add_call_value(call, value)   xmlrpc_doc_add_value(call, xr_methodcall, value)
#define xmlrpc_print_call(call)   xmlrpc_doc_print(call, xr_methodcall, 0)
#define xmlrpc_send_call(call, http_ref, url, headers, ref)   xmlrpc_doc_send(call, xr_methodcall, http_ref, url, headers, ref)
#define xmlrpc_create_response()   xmlrpc_doc_create_response()
#define xmlrpc_create_faultresponse(faultcode, faultstring)   xmlrpc_doc_create_faultresponse(faultcode, faultstring)
#define xmlrpc_parse_response(post_body)   xmlrpc_doc_parse(post_body, xr_methodresponse)
#define xmlrpc_destroy_response(response)   xmlrpc_doc_destroy(response, xr_methodresponse)
#define xmlrpc_add_response_scalar(response, type, arg)   xmlrpc_doc_add_scalar(response, xr_methodresponse, type, arg)
#define xmlrpc_add_response_value(response, value)   xmlrpc_doc_add_value(response, xr_methodresponse, value)
#define xmlrpc_print_response(response)   xmlrpc_doc_print(response, xr_methodresponse, 0)
#define xmlrpc_send_response(response, http_ref, url, headers, ref)   xmlrpc_doc_send(call, xr_methodresponse, http_ref, url, headers, ref)
#define xmlrpc_add_scalar_param(xrdoc, type, arg)   xmlrpc_doc_add_scalar(xrdoc, xr_undefined, type, arg)
#define xmlrpc_add_param(xrdoc, value)   xmlrpc_doc_add_value(xrdoc, xr_undefined, value)
#define xmlrpc_scalar_get_double(scalar)   *(double *)xmlrpc_scalar_get_content(scalar, xr_double)
#define xmlrpc_scalar_get_int(scalar)   *(long *)xmlrpc_scalar_get_content(scalar, xr_int)
#define xmlrpc_scalar_get_bool(scalar)   *(int *)xmlrpc_scalar_get_content(scalar, xr_bool)
#define xmlrpc_scalar_get_date(scalar)   octstr_duplicate((Octstr *)xmlrpc_scalar_get_content(scalar, xr_date))
#define xmlrpc_scalar_get_string(scalar)   octstr_duplicate((Octstr *)xmlrpc_scalar_get_content(scalar, xr_string))
#define xmlrpc_scalar_get_base64(scalar)   octstr_duplicate((Octstr *)xmlrpc_scalar_get_content(scalar, xr_base64))
#define xmlrpc_get_scalar_value_type(value)   xmlrpc_scalar_get_type(xmlrpc_value_get_content(value))
#define xmlrpc_get_double_value(value)   xmlrpc_scalar_get_double(xmlrpc_value_get_content(value))
#define xmlrpc_get_int_value(value)   xmlrpc_scalar_get_int(xmlrpc_value_get_content(value))
#define xmlrpc_get_string_value(value)   xmlrpc_scalar_get_string(xmlrpc_value_get_content(value))
#define xmlrpc_get_base64_value(value)   xmlrpc_scalar_get_base64(xmlrpc_value_get_content(value))

Typedefs

typedef xmlrpc_document XMLRPCDocument
typedef xmlrpc_value XMLRPCValue
typedef xmlrpc_scalar XMLRPCScalar

Enumerations

enum  {
  xr_undefined, xr_scalar, xr_array, xr_struct,
  xr_string, xr_int, xr_bool, xr_double,
  xr_date, xr_base64, xr_methodcall, xr_methodresponse
}
enum  { XMLRPC_COMPILE_OK, XMLRPC_XMLPARSE_FAILED, XMLRPC_PARSING_FAILED }

Functions

XMLRPCDocumentxmlrpc_doc_create (void)
XMLRPCDocumentxmlrpc_doc_create_call (Octstr *name)
XMLRPCDocumentxmlrpc_doc_create_response (void)
XMLRPCDocumentxmlrpc_doc_create_faultresponse (long faultcode, Octstr *faultstring)
XMLRPCDocumentxmlrpc_doc_parse (Octstr *post_body, int d_type)
void xmlrpc_doc_destroy (XMLRPCDocument *xrdoc, int d_type)
int xmlrpc_doc_add_scalar (XMLRPCDocument *xrdoc, int d_type, int type, void *arg)
int xmlrpc_doc_add_value (XMLRPCDocument *xrdoc, int d_type, XMLRPCValue *value)
Octstrxmlrpc_doc_print (XMLRPCDocument *xrdoc, int d_type, int level)
int xmlrpc_doc_send (XMLRPCDocument *xrdoc, int d_type, HTTPCaller *http_ref, Octstr *url, List *headers, void *ref)
Octstrxmlrpc_get_call_name (XMLRPCDocument *call)
int xmlrpc_count_params (XMLRPCDocument *xrdoc)
XMLRPCValuexmlrpc_get_param (XMLRPCDocument *xrdoc, int i)
int xmlrpc_get_type_param (XMLRPCDocument *xrdoc, int i)
void * xmlrpc_get_content_param (XMLRPCDocument *xrdoc, int i)
XMLRPCValuexmlrpc_value_create (void)
void xmlrpc_value_destroy (XMLRPCValue *val)
void xmlrpc_value_destroy_item (void *val)
int xmlrpc_value_set_type (XMLRPCValue *val, int v_type)
int xmlrpc_value_set_content (XMLRPCValue *val, void *content)
int xmlrpc_value_get_type (XMLRPCValue *val)
int xmlrpc_value_get_type_smart (XMLRPCValue *val)
void * xmlrpc_value_get_content (XMLRPCValue *val)
Octstrxmlrpc_value_print (XMLRPCValue *val, int level)
XMLRPCValuexmlrpc_create_struct_value (int size)
long xmlrpc_count_members (XMLRPCValue *xrstruct)
int xmlrpc_add_member (XMLRPCValue *xrstruct, Octstr *name, XMLRPCValue *value)
int xmlrpc_add_member_scalar (XMLRPCValue *xrstruct, Octstr *name, int type, void *arg)
XMLRPCValuexmlrpc_get_member (XMLRPCValue *xrstruct, Octstr *name)
int xmlrpc_get_member_type (XMLRPCValue *xrstruct, Octstr *name)
void * xmlrpc_get_member_content (XMLRPCValue *xrstruct, Octstr *name)
Octstrxmlrpc_print_struct (Dict *members, int level)
XMLRPCValuexmlrpc_create_array_value (void)
int xmlrpc_count_elements (XMLRPCValue *xrarray)
int xmlrpc_add_element (XMLRPCValue *xrarray, XMLRPCValue *value)
int xmlrpc_add_element_scalar (XMLRPCValue *xrarray, int type, void *arg)
XMLRPCValuexmlrpc_get_element (XMLRPCValue *xrarray, int i)
int xmlrpc_get_element_type (XMLRPCValue *xrarray, int i)
void * xmlrpc_get_element_content (XMLRPCValue *xrarray, int i)
Octstrxmlrpc_print_array (List *elements, int level)
XMLRPCScalarxmlrpc_scalar_create (int type, void *arg)
void xmlrpc_scalar_destroy (XMLRPCScalar *scalar)
int xmlrpc_scalar_get_type (XMLRPCScalar *scalar)
void * xmlrpc_scalar_get_content (XMLRPCScalar *scalar, int s_type)
Octstrxmlrpc_scalar_print (XMLRPCScalar *scalar, int level)
XMLRPCValuexmlrpc_create_scalar_value (int type, void *arg)
XMLRPCValuexmlrpc_create_double_value (double val)
XMLRPCValuexmlrpc_create_int_value (long val)
XMLRPCValuexmlrpc_create_string_value (Octstr *val)
int xmlrpc_is_fault (XMLRPCDocument *response)
long xmlrpc_get_faultcode (XMLRPCDocument *faultresponse)
Octstrxmlrpc_get_faultstring (XMLRPCDocument *faultresponse)
int xmlrpc_parse_status (XMLRPCDocument *xrdoc)
Octstrxmlrpc_parse_error (XMLRPCDocument *xrdoc)


Define Documentation

#define xmlrpc_add_call_scalar call,
type,
arg   )     xmlrpc_doc_add_scalar(call, xr_methodcall, type, arg)
 

Definition at line 174 of file xmlrpc.h.

#define xmlrpc_add_call_value call,
value   )     xmlrpc_doc_add_value(call, xr_methodcall, value)
 

Definition at line 181 of file xmlrpc.h.

#define xmlrpc_add_param xrdoc,
value   )     xmlrpc_doc_add_value(xrdoc, xr_undefined, value)
 

Definition at line 292 of file xmlrpc.h.

#define xmlrpc_add_response_scalar response,
type,
arg   )     xmlrpc_doc_add_scalar(response, xr_methodresponse, type, arg)
 

Definition at line 229 of file xmlrpc.h.

#define xmlrpc_add_response_value response,
value   )     xmlrpc_doc_add_value(response, xr_methodresponse, value)
 

Definition at line 236 of file xmlrpc.h.

#define xmlrpc_add_scalar_param xrdoc,
type,
arg   )     xmlrpc_doc_add_scalar(xrdoc, xr_undefined, type, arg)
 

Definition at line 285 of file xmlrpc.h.

#define xmlrpc_create_call method   )     xmlrpc_doc_create_call(method)
 

Definition at line 157 of file xmlrpc.h.

#define xmlrpc_create_faultresponse faultcode,
faultstring   )     xmlrpc_doc_create_faultresponse(faultcode, faultstring)
 

Definition at line 212 of file xmlrpc.h.

 
#define xmlrpc_create_response  )     xmlrpc_doc_create_response()
 

Definition at line 208 of file xmlrpc.h.

#define xmlrpc_destroy_call call   )     xmlrpc_doc_destroy(call, xr_methodcall)
 

Definition at line 165 of file xmlrpc.h.

Referenced by main(), and smsbox_xmlrpc_post().

#define xmlrpc_destroy_response response   )     xmlrpc_doc_destroy(response, xr_methodresponse)
 

Definition at line 220 of file xmlrpc.h.

#define xmlrpc_get_base64_value value   )     xmlrpc_scalar_get_base64(xmlrpc_value_get_content(value))
 

Definition at line 493 of file xmlrpc.h.

#define xmlrpc_get_double_value value   )     xmlrpc_scalar_get_double(xmlrpc_value_get_content(value))
 

Definition at line 487 of file xmlrpc.h.

#define xmlrpc_get_int_value value   )     xmlrpc_scalar_get_int(xmlrpc_value_get_content(value))
 

Definition at line 489 of file xmlrpc.h.

#define xmlrpc_get_scalar_value_type value   )     xmlrpc_scalar_get_type(xmlrpc_value_get_content(value))
 

Definition at line 483 of file xmlrpc.h.

Referenced by xmlrpc_value_get_type_smart().

#define xmlrpc_get_string_value value   )     xmlrpc_scalar_get_string(xmlrpc_value_get_content(value))
 

Definition at line 491 of file xmlrpc.h.

#define xmlrpc_parse_call post_body   )     xmlrpc_doc_parse(post_body, xr_methodcall)
 

Definition at line 161 of file xmlrpc.h.

Referenced by main(), and smsbox_xmlrpc_post().

#define xmlrpc_parse_response post_body   )     xmlrpc_doc_parse(post_body, xr_methodresponse)
 

Definition at line 216 of file xmlrpc.h.

Referenced by receive_reply().

#define xmlrpc_print_call call   )     xmlrpc_doc_print(call, xr_methodcall, 0)
 

Definition at line 187 of file xmlrpc.h.

Referenced by main().

#define xmlrpc_print_response response   )     xmlrpc_doc_print(response, xr_methodresponse, 0)
 

Definition at line 242 of file xmlrpc.h.

#define xmlrpc_scalar_get_base64 scalar   )     octstr_duplicate((Octstr *)xmlrpc_scalar_get_content(scalar, xr_base64))
 

Definition at line 461 of file xmlrpc.h.

#define xmlrpc_scalar_get_bool scalar   )     *(int *)xmlrpc_scalar_get_content(scalar, xr_bool)
 

Definition at line 452 of file xmlrpc.h.

#define xmlrpc_scalar_get_date scalar   )     octstr_duplicate((Octstr *)xmlrpc_scalar_get_content(scalar, xr_date))
 

Definition at line 455 of file xmlrpc.h.

#define xmlrpc_scalar_get_double scalar   )     *(double *)xmlrpc_scalar_get_content(scalar, xr_double)
 

Definition at line 446 of file xmlrpc.h.

#define xmlrpc_scalar_get_int scalar   )     *(long *)xmlrpc_scalar_get_content(scalar, xr_int)
 

Definition at line 449 of file xmlrpc.h.

Referenced by parse_fault_element().

#define xmlrpc_scalar_get_string scalar   )     octstr_duplicate((Octstr *)xmlrpc_scalar_get_content(scalar, xr_string))
 

Definition at line 458 of file xmlrpc.h.

Referenced by parse_fault_element().

#define xmlrpc_send_call call,
http_ref,
url,
headers,
ref   )     xmlrpc_doc_send(call, xr_methodcall, http_ref, url, headers, ref)
 

Definition at line 197 of file xmlrpc.h.

Referenced by start_request().

#define xmlrpc_send_response response,
http_ref,
url,
headers,
ref   )     xmlrpc_doc_send(call, xr_methodresponse, http_ref, url, headers, ref)
 

Definition at line 252 of file xmlrpc.h.


Typedef Documentation

typedef struct xmlrpc_document XMLRPCDocument
 

Definition at line 82 of file xmlrpc.h.

Referenced by parse_array(), parse_array_element(), parse_data(), parse_data_element(), parse_document(), parse_fault(), parse_fault_element(), parse_member(), parse_member_element(), parse_methodcall(), parse_methodcall_element(), parse_methodresponse(), parse_methodresponse_element(), parse_param(), parse_param_element(), parse_params(), parse_params_element(), parse_struct(), parse_struct_element(), parse_value(), parse_value_element(), receive_reply(), smsbox_xmlrpc_post(), xmlrpc_count_params(), xmlrpc_doc_add_scalar(), xmlrpc_doc_add_value(), xmlrpc_doc_create(), xmlrpc_doc_create_call(), xmlrpc_doc_create_faultresponse(), xmlrpc_doc_create_response(), xmlrpc_doc_destroy(), xmlrpc_doc_parse(), xmlrpc_doc_print(), xmlrpc_doc_send(), xmlrpc_get_call_name(), xmlrpc_get_content_param(), xmlrpc_get_faultcode(), xmlrpc_get_faultstring(), xmlrpc_get_param(), xmlrpc_get_type_param(), xmlrpc_is_fault(), xmlrpc_parse_error(), and xmlrpc_parse_status().

typedef struct xmlrpc_scalar XMLRPCScalar
 

Definition at line 84 of file xmlrpc.h.

Referenced by parse_fault_element(), xmlrpc_scalar_create(), xmlrpc_scalar_destroy(), xmlrpc_scalar_get_content(), xmlrpc_scalar_get_type(), xmlrpc_scalar_print(), and xmlrpc_value_set_content().

typedef struct xmlrpc_value XMLRPCValue
 

Definition at line 83 of file xmlrpc.h.

Referenced by parse_data_element(), parse_fault_element(), parse_param_element(), parse_value(), parse_value_element(), xmlrpc_add_element(), xmlrpc_add_element_scalar(), xmlrpc_add_member(), xmlrpc_add_member_scalar(), xmlrpc_call_add_param(), xmlrpc_call_print(), xmlrpc_count_elements(), xmlrpc_count_members(), xmlrpc_create_array_value(), xmlrpc_create_double_value(), xmlrpc_create_int_value(), xmlrpc_create_scalar_value(), xmlrpc_create_string_value(), xmlrpc_create_struct_value(), xmlrpc_doc_add_scalar(), xmlrpc_doc_add_value(), xmlrpc_get_content_param(), xmlrpc_get_element(), xmlrpc_get_element_content(), xmlrpc_get_element_type(), xmlrpc_get_member(), xmlrpc_get_member_content(), xmlrpc_get_member_type(), xmlrpc_get_param(), xmlrpc_get_type_param(), xmlrpc_print_array(), xmlrpc_print_struct(), xmlrpc_response_add_param(), xmlrpc_value_create(), xmlrpc_value_destroy(), xmlrpc_value_get_content(), xmlrpc_value_get_type(), xmlrpc_value_get_type_smart(), xmlrpc_value_print(), xmlrpc_value_set_content(), and xmlrpc_value_set_type().


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
xr_undefined 
xr_scalar 
xr_array 
xr_struct 
xr_string 
xr_int 
xr_bool 
xr_double 
xr_date 
xr_base64 
xr_methodcall 
xr_methodresponse 

Definition at line 86 of file xmlrpc.h.

00086      { 
00087     xr_undefined, xr_scalar, xr_array, xr_struct, 
00088     xr_string, xr_int, xr_bool, xr_double, xr_date, xr_base64, 
00089     xr_methodcall, xr_methodresponse 
00090 };

anonymous enum
 

Enumeration values:
XMLRPC_COMPILE_OK 
XMLRPC_XMLPARSE_FAILED 
XMLRPC_PARSING_FAILED 

Definition at line 95 of file xmlrpc.h.

00095      {
00096     XMLRPC_COMPILE_OK,
00097     XMLRPC_XMLPARSE_FAILED,
00098     XMLRPC_PARSING_FAILED
00099 };


Function Documentation

int xmlrpc_add_element XMLRPCValue xrarray,
XMLRPCValue value
 

Definition at line 1217 of file xmlrpc.c.

References gwlist_produce(), xmlrpc_value::v_array, xmlrpc_value::v_type, XMLRPCValue, and xr_array.

Referenced by xmlrpc_add_element_scalar().

01218 {
01219     if (xrarray == NULL || xrarray->v_type != xr_array || value == NULL)
01220         return -1;
01221     
01222     gwlist_produce(xrarray->v_array, value);
01223     return 1;
01224 }

Here is the call graph for this function:

int xmlrpc_add_element_scalar XMLRPCValue xrarray,
int  type,
void *  arg
 

Definition at line 1226 of file xmlrpc.c.

References type, xmlrpc_add_element(), xmlrpc_create_scalar_value(), xmlrpc_value_destroy(), and XMLRPCValue.

01227 {
01228     XMLRPCValue *value = xmlrpc_create_scalar_value(type, arg);
01229     int status;
01230     
01231     status = xmlrpc_add_element(xrarray, value);
01232     if (status < 0)
01233         xmlrpc_value_destroy(value);
01234         
01235     return status;
01236 }

Here is the call graph for this function:

int xmlrpc_add_member XMLRPCValue xrstruct,
Octstr name,
XMLRPCValue value
 

Definition at line 1120 of file xmlrpc.c.

References dict_put_once(), name, xmlrpc_value::v_struct, xmlrpc_value::v_type, XMLRPCValue, and xr_struct.

Referenced by xmlrpc_add_member_scalar().

01121 {
01122     if (xrstruct == NULL || xrstruct->v_type != xr_struct 
01123         || name == NULL || value == NULL)
01124         return -1;
01125     
01126     return dict_put_once(xrstruct->v_struct, name, value);
01127 }

Here is the call graph for this function:

int xmlrpc_add_member_scalar XMLRPCValue xrstruct,
Octstr name,
int  type,
void *  arg
 

Definition at line 1129 of file xmlrpc.c.

References name, type, xmlrpc_add_member(), xmlrpc_create_scalar_value(), xmlrpc_value_destroy(), and XMLRPCValue.

01130 {
01131     XMLRPCValue *value = xmlrpc_create_scalar_value(type, arg);
01132     int status;
01133     
01134     status = xmlrpc_add_member(xrstruct, name, value);
01135     if (status < 0)
01136         xmlrpc_value_destroy(value);
01137         
01138     return status;
01139 }

Here is the call graph for this function:

int xmlrpc_count_elements XMLRPCValue xrarray  ) 
 

Definition at line 1209 of file xmlrpc.c.

References gwlist_len(), xmlrpc_value::v_array, xmlrpc_value::v_type, and XMLRPCValue.

01210 {
01211     if (xrarray == NULL || xrarray->v_type != xr_array)
01212         return -1;
01213     
01214     return  gwlist_len(xrarray->v_array);
01215 }

Here is the call graph for this function:

long xmlrpc_count_members XMLRPCValue xrstruct  ) 
 

Definition at line 1113 of file xmlrpc.c.

References dict_key_count(), xmlrpc_value::v_struct, xmlrpc_value::v_type, and XMLRPCValue.

Referenced by parse_fault_element().

01114 {
01115     if (xrstruct == NULL || xrstruct->v_type != xr_struct)
01116         return -1;
01117     return dict_key_count(xrstruct->v_struct);
01118 }

Here is the call graph for this function:

int xmlrpc_count_params XMLRPCDocument xrdoc  ) 
 

Definition at line 1063 of file xmlrpc.c.

References xmlrpc_document::d_type, gwlist_len(), xmlrpc_document::methodcall, xmlrpc_document::methodresponse, xmlrpc_methodresponse::param, xmlrpc_methodcall::params, XMLRPCDocument, xr_methodcall, and xr_methodresponse.

01064 {
01065     if (xrdoc == NULL)
01066         return -1;
01067     if (xrdoc->d_type == xr_methodcall && xrdoc->methodcall != NULL)
01068         return gwlist_len(xrdoc->methodcall->params);
01069     else if (xrdoc->d_type == xr_methodresponse && xrdoc->methodresponse != NULL)
01070         return (xrdoc->methodresponse->param != NULL ? 1 : 0);
01071     
01072     return -1;
01073 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_create_array_value void   ) 
 

Definition at line 1200 of file xmlrpc.c.

References gwlist_create, xmlrpc_value::v_array, xmlrpc_value::v_type, xmlrpc_value_create(), and XMLRPCValue.

01201 {
01202     XMLRPCValue *value = xmlrpc_value_create();
01203     value->v_type = xr_array;
01204     value->v_array = gwlist_create();
01205 
01206     return value;
01207 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_create_double_value double  val  ) 
 

Definition at line 1299 of file xmlrpc.c.

References xmlrpc_create_scalar_value(), XMLRPCValue, and xr_double.

01300 {
01301     return xmlrpc_create_scalar_value(xr_double, &val);
01302 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_create_int_value long  val  ) 
 

Definition at line 1304 of file xmlrpc.c.

References xmlrpc_create_scalar_value(), XMLRPCValue, and xr_int.

01305 {
01306     return xmlrpc_create_scalar_value(xr_int, &val);
01307 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_create_scalar_value int  type,
void *  arg
 

Definition at line 1290 of file xmlrpc.c.

References type, xmlrpc_value::v_scalar, xmlrpc_value::v_type, xmlrpc_scalar_create(), xmlrpc_value_create(), and XMLRPCValue.

Referenced by xmlrpc_add_element_scalar(), xmlrpc_add_member_scalar(), xmlrpc_create_double_value(), xmlrpc_create_int_value(), xmlrpc_create_string_value(), and xmlrpc_doc_add_scalar().

01291 {
01292     XMLRPCValue *value = xmlrpc_value_create();
01293     value->v_type = xr_scalar;
01294     value->v_scalar = xmlrpc_scalar_create(type, arg);
01295 
01296     return value;
01297 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_create_string_value Octstr val  ) 
 

Definition at line 1309 of file xmlrpc.c.

References xmlrpc_create_scalar_value(), XMLRPCValue, and xr_string.

01310 {
01311     return xmlrpc_create_scalar_value(xr_string, val);
01312 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_create_struct_value int  size  ) 
 

Definition at line 1103 of file xmlrpc.c.

References dict_create(), xmlrpc_value::v_struct, xmlrpc_value::v_type, xmlrpc_value_create(), xmlrpc_value_destroy_item(), and XMLRPCValue.

01104 {
01105     XMLRPCValue *value = xmlrpc_value_create();
01106     int len = (count_members > 0 ? count_members : OPTIMAL_STRUCT_SIZE);
01107     value->v_type = xr_struct;
01108     value->v_struct = dict_create(len, xmlrpc_value_destroy_item);
01109 
01110     return value;
01111 }

Here is the call graph for this function:

int xmlrpc_doc_add_scalar XMLRPCDocument xrdoc,
int  d_type,
int  type,
void *  arg
 

Definition at line 638 of file xmlrpc.c.

References type, xmlrpc_create_scalar_value(), xmlrpc_doc_add_value(), xmlrpc_value_destroy(), XMLRPCDocument, and XMLRPCValue.

00639 {
00640     XMLRPCValue *param;
00641     
00642     param = xmlrpc_create_scalar_value(type, arg);
00643     if (xmlrpc_doc_add_value(xrdoc, d_type, param) < 0) {
00644         xmlrpc_value_destroy(param);
00645         return -1;
00646     }
00647     return 0;
00648 }

Here is the call graph for this function:

int xmlrpc_doc_add_value XMLRPCDocument xrdoc,
int  d_type,
XMLRPCValue value
 

Definition at line 611 of file xmlrpc.c.

References xmlrpc_document::d_type, error(), xmlrpc_document::methodcall, xmlrpc_document::methodresponse, xmlrpc_call_add_param(), xmlrpc_response_add_param(), XMLRPCDocument, and XMLRPCValue.

Referenced by xmlrpc_doc_add_scalar().

00612 {
00613     if (xrdoc == NULL) 
00614         return -1;
00615 
00616     if (xrdoc->d_type != d_type && d_type != xr_undefined) {
00617         error(0, "Wrong xmlrpc document type. Param not added.");
00618         return -1;
00619     }
00620     if (xrdoc->d_type == xr_methodresponse) {
00621         if (xmlrpc_response_add_param(xrdoc->methodresponse, value) < 0) 
00622             return -1;
00623     } 
00624     else if (xrdoc->d_type == xr_methodcall) {
00625         if (xmlrpc_call_add_param(xrdoc->methodcall, value) < 0) 
00626             return -1;
00627     }
00628     else {
00629         error(0, "Unknown xmlrpc document type. Param not added.");
00630         return -1;
00631     }
00632     return 0;
00633 }

Here is the call graph for this function:

XMLRPCDocument* xmlrpc_doc_create void   ) 
 

Definition at line 512 of file xmlrpc.c.

References xmlrpc_document::d_type, xmlrpc_document::methodcall, xmlrpc_document::methodresponse, xmlrpc_document::parse_error, xmlrpc_document::parse_status, and XMLRPCDocument.

Referenced by xmlrpc_doc_create_call(), xmlrpc_doc_create_response(), and xmlrpc_doc_parse().

00513 {
00514     XMLRPCDocument *xrdoc = gw_malloc(sizeof(XMLRPCDocument));
00515     
00516     xrdoc->d_type = xr_undefined;
00517     xrdoc->parse_status = XMLRPC_COMPILE_OK;
00518     xrdoc->parse_error = NULL;
00519     xrdoc->methodcall = NULL;
00520     xrdoc->methodresponse = NULL;
00521     
00522     return xrdoc;
00523 }

XMLRPCDocument* xmlrpc_doc_create_call Octstr name  ) 
 

Definition at line 525 of file xmlrpc.c.

References xmlrpc_document::d_type, xmlrpc_document::methodcall, name, xmlrpc_call_create(), xmlrpc_doc_create(), and XMLRPCDocument.

00526 {
00527     XMLRPCDocument *xrdoc;
00528     
00529     xrdoc = xmlrpc_doc_create();
00530     xrdoc->d_type = xr_methodcall;
00531     xrdoc->methodcall = xmlrpc_call_create(name);
00532     
00533     return xrdoc;
00534 }

Here is the call graph for this function:

XMLRPCDocument* xmlrpc_doc_create_faultresponse long  faultcode,
Octstr faultstring
 

Definition at line 547 of file xmlrpc.c.

References xmlrpc_methodresponse::fault, xmlrpc_document::methodresponse, response, xmlrpc_doc_create_response(), xmlrpc_fault_create(), XMLRPCDocument, and XMLRPCMethodResponse.

00548 {
00549     XMLRPCDocument *xrdoc;
00550     XMLRPCMethodResponse *response;
00551     
00552     xrdoc = xmlrpc_doc_create_response();
00553 
00554     response = xrdoc->methodresponse;
00555     response->fault = xmlrpc_fault_create(faultcode, faultstring);
00556 
00557     return xrdoc;
00558 }

Here is the call graph for this function:

XMLRPCDocument* xmlrpc_doc_create_response void   ) 
 

Definition at line 536 of file xmlrpc.c.

References xmlrpc_document::d_type, xmlrpc_document::methodresponse, xmlrpc_doc_create(), xmlrpc_response_create(), and XMLRPCDocument.

Referenced by xmlrpc_doc_create_faultresponse().

00537 {
00538     XMLRPCDocument *xrdoc;
00539     
00540     xrdoc = xmlrpc_doc_create();
00541     xrdoc->d_type = xr_methodresponse;
00542     xrdoc->methodresponse = xmlrpc_response_create();
00543     
00544     return xrdoc;
00545 }

Here is the call graph for this function:

void xmlrpc_doc_destroy XMLRPCDocument xrdoc,
int  d_type
 

Definition at line 593 of file xmlrpc.c.

References xmlrpc_document::d_type, xmlrpc_document::methodcall, xmlrpc_document::methodresponse, octstr_destroy(), xmlrpc_document::parse_error, warning(), xmlrpc_call_destroy(), xmlrpc_response_destroy(), and XMLRPCDocument.

00594 {
00595     if (xrdoc == NULL) 
00596         return;
00597     
00598     if (xrdoc->d_type != d_type)
00599         warning(0, "Destroying document with different type then given.");
00600     
00601     xmlrpc_call_destroy(xrdoc->methodcall);
00602     xmlrpc_response_destroy(xrdoc->methodresponse);
00603     octstr_destroy(xrdoc->parse_error);
00604     
00605     gw_free(xrdoc);
00606 }

Here is the call graph for this function:

XMLRPCDocument* xmlrpc_doc_parse Octstr post_body,
int  d_type
 

Definition at line 560 of file xmlrpc.c.

References xmlrpc_document::d_type, octstr_create, octstr_get_cstr, octstr_len(), octstr_shrink_blanks(), octstr_strip_blanks(), parse_document(), xmlrpc_document::parse_error, xmlrpc_document::parse_status, size, xmlrpc_doc_create(), and XMLRPCDocument.

00561 {
00562     XMLRPCDocument *xrdoc = xmlrpc_doc_create();
00563     xmlDocPtr pDoc;
00564     size_t size;
00565     char *body;
00566 
00567     if (post_body == NULL) {
00568         xrdoc->parse_status = XMLRPC_XMLPARSE_FAILED;
00569         xrdoc->parse_error = octstr_create("XMLRPC: (null) XML document given.");
00570         return xrdoc;
00571     }    
00572     xrdoc->d_type = d_type;
00573     
00574     octstr_strip_blanks(post_body);
00575     octstr_shrink_blanks(post_body);
00576     size = octstr_len(post_body);
00577     body = octstr_get_cstr(post_body);
00578 
00579     /* parse XML document to a XML tree */
00580     pDoc = xmlParseMemory(body, size);
00581     if (!pDoc) {
00582         xrdoc->parse_status = XMLRPC_XMLPARSE_FAILED;
00583         xrdoc->parse_error = octstr_create("XMLRPC: not valid XML document given.");
00584         return xrdoc;
00585     }
00586     parse_document(pDoc, xrdoc);
00587     xmlFreeDoc(pDoc);
00588     
00589     return xrdoc;
00590 }

Here is the call graph for this function:

Octstr* xmlrpc_doc_print XMLRPCDocument xrdoc,
int  d_type,
int  level
 

Definition at line 653 of file xmlrpc.c.

References xmlrpc_document::d_type, error(), xmlrpc_document::methodcall, xmlrpc_document::methodresponse, octstr_destroy(), octstr_format(), octstr_insert(), xmlrpc_call_print(), xmlrpc_response_print(), and XMLRPCDocument.

Referenced by xmlrpc_doc_send().

00654 {
00655     Octstr *body = NULL, *pref = NULL;
00656 
00657     if (xrdoc == NULL) 
00658         return NULL;
00659 
00660     if (xrdoc->d_type != d_type) {
00661         error(0, "Wrong xmlrpc document type.");
00662         return NULL;
00663     }
00664     if (xrdoc->d_type == xr_methodresponse) {
00665         body = xmlrpc_response_print(xrdoc->methodresponse, level);
00666     } 
00667     else if (xrdoc->d_type == xr_methodcall) {
00668         body = xmlrpc_call_print(xrdoc->methodcall, level);
00669     }
00670     else {
00671         error(0, "Unknown xmlrpc document type.");
00672     }
00673 
00674     if (body != NULL) {
00675         pref = octstr_format("%*s<?xml version=\"1.0\"?>\n", level, "");
00676         octstr_insert(body, pref, 0);
00677         octstr_destroy(pref);
00678     }
00679     return body;
00680 }

Here is the call graph for this function:

int xmlrpc_doc_send XMLRPCDocument xrdoc,
int  d_type,
HTTPCaller http_ref,
Octstr url,
List headers,
void *  ref
 

Definition at line 685 of file xmlrpc.c.

References xmlrpc_document::d_type, error(), gwlist_create, http_header_add(), http_header_remove_all(), HTTP_METHOD_POST, http_start_request(), HTTPCaller, octstr_destroy(), xmlrpc_doc_print(), and XMLRPCDocument.

00687 {
00688     Octstr *body;
00689     if (http_ref == NULL || xrdoc == NULL)
00690         return -1;
00691     
00692     if (xrdoc->d_type != d_type) {
00693         error(0, "Wrong xmlrpc document type.");
00694         return -1;
00695     }
00696     
00697     if (headers == NULL)
00698         headers = gwlist_create();
00699     
00700     http_header_remove_all(headers, "Content-Type");
00701     http_header_add(headers, "Content-Type", "text/xml");
00702 
00703     /* 
00704      * XML-RPC specs say we at least need Host and User-Agent 
00705      * HTTP headers to be defined.
00706      * These are set anyway within gwlib/http.c:build_request()
00707      */
00708     body = xmlrpc_doc_print(xrdoc, d_type, 0);
00709 
00710     http_start_request(http_ref, HTTP_METHOD_POST, 
00711                        url, headers, body, 0, ref, NULL);
00712     
00713     octstr_destroy(body);
00714     /* XXX: should headers be destroyed here? */
00715     /*http_destroy_headers(headers); */
00716     return 0;
00717 }

Here is the call graph for this function:

Octstr* xmlrpc_get_call_name XMLRPCDocument call  ) 
 

Definition at line 1055 of file xmlrpc.c.

References xmlrpc_document::methodcall, xmlrpc_call_get_name(), and XMLRPCDocument.

Referenced by smsbox_xmlrpc_post().

01056 {
01057     if (call == NULL || call->methodcall == NULL)
01058         return NULL;
01059     return xmlrpc_call_get_name(call->methodcall);
01060 }

Here is the call graph for this function:

void* xmlrpc_get_content_param XMLRPCDocument xrdoc,
int  i
 

Definition at line 1095 of file xmlrpc.c.

References xmlrpc_get_param(), xmlrpc_value_get_content(), XMLRPCDocument, and XMLRPCValue.

01096 {
01097     XMLRPCValue *param = xmlrpc_get_param(xrdoc, i);
01098     
01099     return xmlrpc_value_get_content(param);
01100 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_get_element XMLRPCValue xrarray,
int  i
 

Definition at line 1238 of file xmlrpc.c.

References gwlist_get(), xmlrpc_value::v_array, xmlrpc_value::v_type, XMLRPCValue, and xr_array.

Referenced by xmlrpc_get_element_content(), and xmlrpc_get_element_type().

01239 {
01240     if (xrarray == NULL || xrarray->v_type != xr_array || i < 0)
01241         return NULL;
01242     
01243     return gwlist_get(xrarray->v_array, i);
01244 }

Here is the call graph for this function:

void* xmlrpc_get_element_content XMLRPCValue xrarray,
int  i
 

Definition at line 1253 of file xmlrpc.c.

References xmlrpc_get_element(), xmlrpc_value_get_content(), and XMLRPCValue.

01254 {
01255     XMLRPCValue *value = xmlrpc_get_element(xrarray, i);
01256     
01257     return xmlrpc_value_get_content(value);
01258 }

Here is the call graph for this function:

int xmlrpc_get_element_type XMLRPCValue xrarray,
int  i
 

Definition at line 1246 of file xmlrpc.c.

References xmlrpc_get_element(), xmlrpc_value_get_type(), and XMLRPCValue.

01247 {
01248     XMLRPCValue *value = xmlrpc_get_element(xrarray, i);
01249     
01250     return xmlrpc_value_get_type(value);
01251 }

Here is the call graph for this function:

long xmlrpc_get_faultcode XMLRPCDocument faultresponse  ) 
 

Definition at line 1324 of file xmlrpc.c.

References error(), xmlrpc_document::methodresponse, xmlrpc_is_fault(), xmlrpc_response_get_faultcode(), and XMLRPCDocument.

Referenced by receive_reply().

01325 {
01326     if (! xmlrpc_is_fault(faultresponse)) {
01327         error(0, "XMLRPC object is not fault response.");
01328         return -1;
01329     }
01330     
01331     return xmlrpc_response_get_faultcode(faultresponse->methodresponse);
01332 }

Here is the call graph for this function:

Octstr* xmlrpc_get_faultstring XMLRPCDocument faultresponse  ) 
 

Definition at line 1334 of file xmlrpc.c.

References error(), xmlrpc_document::methodresponse, xmlrpc_is_fault(), xmlrpc_response_get_faultstring(), and XMLRPCDocument.

Referenced by receive_reply().

01335 {
01336     if (! xmlrpc_is_fault(faultresponse)) {
01337         error(0, "XMLRPC object is not fault response.");
01338         return NULL;
01339     }
01340     
01341     return xmlrpc_response_get_faultstring(faultresponse->methodresponse);
01342 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_get_member XMLRPCValue xrstruct,
Octstr name
 

Definition at line 1141 of file xmlrpc.c.

References dict_get(), name, xmlrpc_value::v_struct, xmlrpc_value::v_type, XMLRPCValue, and xr_struct.

Referenced by parse_fault_element(), xmlrpc_get_member_content(), and xmlrpc_get_member_type().

01142 {
01143     if (xrstruct == NULL || xrstruct->v_type != xr_struct || name == NULL)
01144         return NULL;
01145     
01146     return dict_get(xrstruct->v_struct, name);
01147 }

Here is the call graph for this function:

void* xmlrpc_get_member_content XMLRPCValue xrstruct,
Octstr name
 

Definition at line 1156 of file xmlrpc.c.

References name, xmlrpc_get_member(), xmlrpc_value_get_content(), and XMLRPCValue.

01157 {
01158     XMLRPCValue *value = xmlrpc_get_member(xrstruct, name);
01159     
01160     return xmlrpc_value_get_content(value);
01161 }

Here is the call graph for this function:

int xmlrpc_get_member_type XMLRPCValue xrstruct,
Octstr name
 

Definition at line 1149 of file xmlrpc.c.

References name, xmlrpc_get_member(), xmlrpc_value_get_type(), and XMLRPCValue.

01150 {
01151     XMLRPCValue *value = xmlrpc_get_member(xrstruct, name);
01152     
01153     return xmlrpc_value_get_type(value);
01154 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_get_param XMLRPCDocument xrdoc,
int  i
 

Definition at line 1075 of file xmlrpc.c.

References xmlrpc_document::d_type, gwlist_get(), gwlist_len(), xmlrpc_document::methodcall, xmlrpc_document::methodresponse, xmlrpc_methodresponse::param, xmlrpc_methodcall::params, XMLRPCDocument, XMLRPCValue, xr_methodcall, and xr_methodresponse.

Referenced by xmlrpc_get_content_param(), and xmlrpc_get_type_param().

01076 {
01077     if (xrdoc == NULL)
01078         return NULL;
01079     if (xrdoc->d_type == xr_methodcall && xrdoc->methodcall != NULL) 
01080         return gwlist_len(xrdoc->methodcall->params) > i ? gwlist_get(xrdoc->methodcall->params, i) : NULL;
01081     else if (xrdoc->d_type == xr_methodresponse && xrdoc->methodresponse != NULL
01082              && i == 0)
01083         return xrdoc->methodresponse->param;
01084     
01085     return NULL;
01086 }

Here is the call graph for this function:

int xmlrpc_get_type_param XMLRPCDocument xrdoc,
int  i
 

Definition at line 1088 of file xmlrpc.c.

References xmlrpc_get_param(), xmlrpc_value_get_type(), XMLRPCDocument, and XMLRPCValue.

01089 {
01090     XMLRPCValue *param = xmlrpc_get_param(xrdoc, i);
01091     
01092     return xmlrpc_value_get_type(param);
01093 }

Here is the call graph for this function:

int xmlrpc_is_fault XMLRPCDocument response  ) 
 

Definition at line 1316 of file xmlrpc.c.

References xmlrpc_document::d_type, xmlrpc_document::methodresponse, response, xmlrpc_response_is_fault(), and XMLRPCDocument.

Referenced by receive_reply(), xmlrpc_get_faultcode(), and xmlrpc_get_faultstring().

01317 {
01318     if (response == NULL || response->d_type != xr_methodresponse)
01319         return 0;
01320     
01321     return xmlrpc_response_is_fault(response->methodresponse);
01322 }

Here is the call graph for this function:

Octstr* xmlrpc_parse_error XMLRPCDocument xrdoc  ) 
 

Definition at line 1355 of file xmlrpc.c.

References octstr_duplicate, xmlrpc_document::parse_error, and XMLRPCDocument.

Referenced by main(), receive_reply(), and smsbox_xmlrpc_post().

01356 {
01357     if (xrdoc == NULL)
01358         return NULL;
01359     
01360     return octstr_duplicate(xrdoc->parse_error);
01361 }

int xmlrpc_parse_status XMLRPCDocument xrdoc  ) 
 

Definition at line 1347 of file xmlrpc.c.

References xmlrpc_document::parse_status, and XMLRPCDocument.

Referenced by main(), receive_reply(), and smsbox_xmlrpc_post().

01348 {
01349     if (xrdoc == NULL)
01350         return -1;
01351 
01352     return xrdoc->parse_status;
01353 }

Octstr* xmlrpc_print_array List elements,
int  level
 

Definition at line 1260 of file xmlrpc.c.

References gwlist_get(), gwlist_len(), octstr_append(), octstr_destroy(), octstr_format(), octstr_format_append(), xmlrpc_value_print(), and XMLRPCValue.

Referenced by xmlrpc_value_print().

01261 {
01262     Octstr *body, *os_element;
01263     XMLRPCValue *element = NULL;
01264     int i;
01265     
01266     if (v_array == NULL)
01267         return NULL;
01268     
01269     body = octstr_format("%*s<array>\n%*s<data>\n", level, "", level+2, "");
01270 
01271     for(i = 0; i < gwlist_len(v_array); i++) {
01272         element = gwlist_get(v_array, i);
01273         os_element = xmlrpc_value_print(element, level+4);
01274         if (os_element == NULL) {
01275             octstr_destroy(body);
01276             return NULL;
01277         }
01278         
01279         octstr_append(body, os_element);
01280         octstr_destroy(os_element);
01281     }
01282     octstr_format_append(body, "%*s</data>\n%*s</array>\n", 
01283                          level+2, "", level, "");
01284     
01285     return body;
01286 }

Here is the call graph for this function:

Octstr* xmlrpc_print_struct Dict members,
int  level
 

Definition at line 1163 of file xmlrpc.c.

References dict_get(), dict_key_count(), dict_keys(), gwlist_consume(), gwlist_destroy(), octstr_destroy(), octstr_destroy_item(), octstr_format(), octstr_format_append(), xmlrpc_value_print(), and XMLRPCValue.

Referenced by xmlrpc_value_print().

01164 {
01165     Octstr *body, *os_val, *key;
01166     List *keys;
01167     XMLRPCValue *member_val;
01168 
01169     if (v_struct == NULL || dict_key_count(v_struct) == 0)
01170         return NULL;
01171     
01172     keys = dict_keys(v_struct);
01173     body = octstr_format("%*s<struct>\n", level, "");
01174 
01175     while ((key = gwlist_consume(keys)) != NULL) {
01176         member_val = dict_get(v_struct, key);
01177         os_val = xmlrpc_value_print(member_val, level+4);
01178         if (os_val == NULL) {
01179             gwlist_destroy(keys, octstr_destroy_item);
01180             octstr_destroy(key);
01181             octstr_destroy(body);
01182             return NULL;
01183         }
01184         octstr_format_append(body, "%*s<member>\n"
01185                                      "%*s<name>%S</name>\n%S"
01186                                    "%*s</member>\n",
01187                                    level+2, "", level+4, "",
01188                                    key, os_val,
01189                                    level+2, "");
01190         octstr_destroy(key);
01191         octstr_destroy(os_val);
01192     }
01193     gwlist_destroy(keys, octstr_destroy_item);
01194     octstr_format_append(body, "%*s</struct>\n", level, "");
01195     
01196     return body;
01197 }

Here is the call graph for this function:

XMLRPCScalar* xmlrpc_scalar_create int  type,
void *  arg
 

Definition at line 879 of file xmlrpc.c.

References error(), octstr_duplicate, xmlrpc_scalar::s_base64, xmlrpc_scalar::s_bool, xmlrpc_scalar::s_date, xmlrpc_scalar::s_double, xmlrpc_scalar::s_int, xmlrpc_scalar::s_str, xmlrpc_scalar::s_type, xmlrpc_scalar_destroy(), XMLRPCScalar, xr_base64, xr_bool, xr_date, xr_double, xr_int, and xr_string.

Referenced by parse_value_element(), and xmlrpc_create_scalar_value().

00880 {
00881     XMLRPCScalar *scalar = gw_malloc(sizeof(XMLRPCScalar));
00882 
00883     scalar->s_type = type;
00884     scalar->s_int = 0;
00885     scalar->s_bool = 0;
00886     scalar->s_double = 0.0;
00887     scalar->s_str = NULL;
00888     scalar->s_date = NULL;
00889     scalar->s_base64 = NULL;
00890     
00891     if (arg == NULL) {
00892 #ifdef XR_ENABLE_EMPTY_STRING_VALUES
00893         if (scalar->s_type != xr_string) {
00894 #endif
00895             error(0,"XML-RPC: scalar value may not be null!");
00896             xmlrpc_scalar_destroy(scalar);
00897             return NULL;
00898 #ifdef XR_ENABLE_EMPTY_STRING_VALUES
00899         }
00900 #endif
00901     }
00902     switch (type) {
00903         case xr_int:
00904             if (arg != NULL) 
00905                 scalar->s_int = *(long*)arg;
00906             break;
00907         case xr_bool:
00908             if (arg != NULL) 
00909                 scalar->s_bool = *(int*)arg;
00910             break;
00911         case xr_double:
00912             if (arg != NULL) 
00913                 scalar->s_double = *(double*)arg;
00914             break;
00915         case xr_string:
00916             scalar->s_str = octstr_duplicate((Octstr *)arg);
00917             break;
00918         case xr_date:
00919             scalar->s_date = octstr_duplicate((Octstr *)arg);
00920             break;
00921         case xr_base64:
00922             scalar->s_base64 = octstr_duplicate((Octstr *)arg);
00923             break;
00924         default:
00925             error(0,"XML-RPC: scalar type not supported!");
00926             xmlrpc_scalar_destroy(scalar);
00927             return NULL;
00928     }
00929     return scalar;
00930 }

Here is the call graph for this function:

void xmlrpc_scalar_destroy XMLRPCScalar scalar  ) 
 

Definition at line 934 of file xmlrpc.c.

References octstr_destroy(), xmlrpc_scalar::s_base64, xmlrpc_scalar::s_date, xmlrpc_scalar::s_str, and XMLRPCScalar.

Referenced by xmlrpc_scalar_create(), and xmlrpc_value_destroy().

00935 {
00936     if (scalar == NULL)
00937         return;
00938 
00939     octstr_destroy(scalar->s_str);
00940     octstr_destroy(scalar->s_date);
00941     octstr_destroy(scalar->s_base64);
00942     
00943     gw_free(scalar);
00944 }

Here is the call graph for this function:

void* xmlrpc_scalar_get_content XMLRPCScalar scalar,
int  s_type
 

Definition at line 953 of file xmlrpc.c.

References error(), xmlrpc_scalar::s_base64, xmlrpc_scalar::s_bool, xmlrpc_scalar::s_date, xmlrpc_scalar::s_double, xmlrpc_scalar::s_int, xmlrpc_scalar::s_str, xmlrpc_scalar::s_type, XMLRPCScalar, xr_base64, xr_bool, xr_date, xr_double, xr_int, and xr_string.

00954 {
00955     if (scalar == NULL)
00956         return NULL;
00957     if (scalar->s_type != s_type) {
00958         error(0, "XMLRPC: Scalar content request with bogus type");
00959         return NULL;
00960     }
00961     switch (scalar->s_type) {
00962         case xr_int:     return &(scalar->s_int);
00963         case xr_bool:    return &(scalar->s_bool);
00964         case xr_double:  return &(scalar->s_double);
00965         case xr_string:  return scalar->s_str;
00966         case xr_date:    return scalar->s_date;
00967         case xr_base64:  return scalar->s_base64;
00968         default:
00969             error(0,"XML-RPC: scalar type not supported!");
00970             return NULL;
00971     }
00972 }

Here is the call graph for this function:

int xmlrpc_scalar_get_type XMLRPCScalar scalar  ) 
 

Definition at line 946 of file xmlrpc.c.

References xmlrpc_scalar::s_type, and XMLRPCScalar.

00947 {
00948     if (scalar == NULL)
00949         return -1;
00950     return scalar->s_type;
00951 }

Octstr* xmlrpc_scalar_print XMLRPCScalar scalar,
int  level
 

Definition at line 974 of file xmlrpc.c.

References octstr_convert_to_html_entities(), octstr_destroy(), octstr_duplicate, octstr_format(), xmlrpc_scalar::s_base64, xmlrpc_scalar::s_bool, xmlrpc_scalar::s_date, xmlrpc_scalar::s_double, xmlrpc_scalar::s_int, xmlrpc_scalar::s_str, xmlrpc_scalar::s_type, XMLRPCScalar, xr_base64, xr_bool, xr_date, xr_double, xr_int, and xr_string.

Referenced by xmlrpc_value_print().

00975 {
00976     Octstr *os = NULL;
00977     
00978     if (scalar == NULL)
00979         return NULL;
00980 
00981     switch (scalar->s_type) {
00982         case xr_int:
00983             os = octstr_format("%*s<int>%ld</int>\n", 
00984                                level, "", scalar->s_int);
00985             break;
00986         case xr_bool:
00987             os = octstr_format("%*s<bool>%d</bool>\n", 
00988                                level, "", scalar->s_bool);
00989             break;
00990         case xr_double:
00991             os = octstr_format("%*s<double>%d</double>\n", 
00992                                  level, "", scalar->s_double);
00993             break;
00994         case xr_string:
00995             if (scalar->s_str == NULL) {
00996 #ifdef XR_ENABLE_EMPTY_STRING_VALUES
00997                 os = octstr_format("%*s<string></string>\n", 
00998                                    level, "");
00999 #endif
01000             } else {
01001                 Octstr *tmp = octstr_duplicate(scalar->s_str);
01002                 octstr_convert_to_html_entities(tmp);
01003                 os = octstr_format("%*s<string>%S</string>\n", 
01004                                    level, "", tmp);
01005                 octstr_destroy(tmp);
01006             }
01007             break;
01008         case xr_date:
01009             os = octstr_format("%*s<datetime.iso8601>%S</datetime.iso8601>\n", 
01010                                level, "", scalar->s_date);
01011             break;
01012         case xr_base64:
01013             os = octstr_format("%*s<base64>%S</base64>\n", 
01014                                level, "", scalar->s_base64);
01015             break;
01016     }
01017     return os;    
01018 }

Here is the call graph for this function:

XMLRPCValue* xmlrpc_value_create void   ) 
 

Definition at line 728 of file xmlrpc.c.

References xmlrpc_value::v_array, xmlrpc_value::v_scalar, xmlrpc_value::v_struct, xmlrpc_value::v_type, and XMLRPCValue.

Referenced by parse_data_element(), parse_fault_element(), parse_member_element(), parse_param_element(), xmlrpc_create_array_value(), xmlrpc_create_scalar_value(), and xmlrpc_create_struct_value().

00729 {
00730     XMLRPCValue *val = gw_malloc(sizeof(XMLRPCValue));
00731 
00732     val->v_type = xr_undefined;
00733     val->v_scalar = NULL;
00734     val->v_array = NULL;
00735     val->v_struct = NULL;
00736     return val;
00737 }

void xmlrpc_value_destroy XMLRPCValue val  ) 
 

Definition at line 740 of file xmlrpc.c.

References dict_destroy(), gwlist_destroy(), xmlrpc_value::v_array, xmlrpc_value::v_scalar, xmlrpc_value::v_struct, xmlrpc_value::v_type, xmlrpc_scalar_destroy(), xmlrpc_value_destroy_item(), XMLRPCValue, xr_array, xr_scalar, and xr_struct.

Referenced by parse_data_element(), parse_fault_element(), parse_member_element(), parse_param_element(), xmlrpc_add_element_scalar(), xmlrpc_add_member_scalar(), xmlrpc_doc_add_scalar(), xmlrpc_member_destroy(), xmlrpc_response_destroy(), and xmlrpc_value_destroy_item().

00741 {
00742     if (val == NULL)
00743         return;
00744 
00745     switch(val->v_type) {
00746         case xr_scalar:
00747             xmlrpc_scalar_destroy(val->v_scalar);
00748             break;
00749         case xr_array:
00750             gwlist_destroy(val->v_array, xmlrpc_value_destroy_item);
00751             break;
00752         case xr_struct:
00753             dict_destroy(val->v_struct);
00754             break;
00755     }
00756     gw_free(val);
00757 }

Here is the call graph for this function:

void xmlrpc_value_destroy_item void *  val  ) 
 

Definition at line 760 of file xmlrpc.c.

References xmlrpc_value_destroy().

Referenced by parse_methodresponse_element(), parse_value_element(), xmlrpc_call_destroy(), xmlrpc_create_struct_value(), and xmlrpc_value_destroy().

00761 {
00762     xmlrpc_value_destroy(val);
00763 }

Here is the call graph for this function:

void* xmlrpc_value_get_content XMLRPCValue val  ) 
 

Definition at line 824 of file xmlrpc.c.

References error(), xmlrpc_value::v_array, xmlrpc_value::v_scalar, xmlrpc_value::v_struct, xmlrpc_value::v_type, XMLRPCValue, xr_array, xr_scalar, and xr_struct.

Referenced by parse_fault_element(), xmlrpc_get_content_param(), xmlrpc_get_element_content(), and xmlrpc_get_member_content().

00825 {
00826     if (val == NULL)
00827         return NULL;
00828         
00829     switch(val->v_type) {
00830         case xr_scalar:
00831             return val->v_scalar;
00832         case xr_array:
00833             return val->v_array;
00834         case xr_struct:
00835             return val->v_struct;
00836         default:
00837             error(0, "XMLRPC: value type not supported.");
00838             return NULL;
00839     }
00840 }

Here is the call graph for this function:

int xmlrpc_value_get_type XMLRPCValue val  ) 
 

Definition at line 807 of file xmlrpc.c.

References xmlrpc_value::v_type, and XMLRPCValue.

Referenced by parse_fault_element(), xmlrpc_get_element_type(), xmlrpc_get_member_type(), xmlrpc_get_type_param(), and xmlrpc_value_get_type_smart().

00808 {
00809     if (val == NULL)
00810         return -1;
00811         
00812     return val->v_type;
00813 }

int xmlrpc_value_get_type_smart XMLRPCValue val  ) 
 

Definition at line 815 of file xmlrpc.c.

References type, xmlrpc_get_scalar_value_type, xmlrpc_value_get_type(), and XMLRPCValue.

Referenced by parse_fault_element().

00816 {
00817     int type = xmlrpc_value_get_type(val);
00818     if (type == xr_scalar) 
00819         return xmlrpc_get_scalar_value_type(val);
00820 
00821     return type;
00822 }

Here is the call graph for this function:

Octstr* xmlrpc_value_print XMLRPCValue val,
int  level
 

Definition at line 842 of file xmlrpc.c.

References octstr_destroy(), octstr_format(), xmlrpc_value::v_array, xmlrpc_value::v_scalar, xmlrpc_value::v_struct, xmlrpc_value::v_type, xmlrpc_print_array(), xmlrpc_print_struct(), xmlrpc_scalar_print(), XMLRPCValue, xr_array, xr_scalar, and xr_struct.

Referenced by xmlrpc_call_print(), xmlrpc_print_array(), xmlrpc_print_struct(), and xmlrpc_response_print().

00843 {
00844     Octstr *body = NULL, *os = NULL;
00845 
00846     if (val == NULL)
00847         return NULL;
00848     
00849     switch(val->v_type) {
00850         case xr_scalar:
00851             os = xmlrpc_scalar_print(val->v_scalar, level+2);
00852            break;
00853         case xr_struct:
00854             os = xmlrpc_print_struct(val->v_struct, level+2);
00855             break;
00856         case xr_array:
00857             os = xmlrpc_print_array(val->v_array, level+2);
00858             break;
00859         default:
00860             return NULL;
00861     }
00862 
00863     if (os != NULL) {
00864         body = octstr_format("%*s<value>\n%S%*s</value>\n",
00865                              level, "", os, level, "");
00866         octstr_destroy(os);
00867     }
00868     
00869     return body;
00870 }

Here is the call graph for this function:

int xmlrpc_value_set_content XMLRPCValue val,
void *  content
 

Definition at line 784 of file xmlrpc.c.

References error(), xmlrpc_value::v_array, xmlrpc_value::v_scalar, xmlrpc_value::v_struct, xmlrpc_value::v_type, XMLRPCScalar, XMLRPCValue, xr_array, xr_scalar, and xr_struct.

00785 {
00786     if (val == NULL)
00787         return -1;
00788 
00789     switch(val->v_type) {
00790         case xr_scalar:
00791             val->v_scalar = (XMLRPCScalar *)content;
00792             break;
00793         case xr_array:
00794             val->v_array  = (List *)content;
00795             break;
00796         case xr_struct:
00797             val->v_struct = (Dict *)content;
00798             break;
00799         default:
00800             error(0, "XMLRPC: value type not supported.");
00801             return -1;
00802     }
00803     
00804     return 0;
00805 }

Here is the call graph for this function:

int xmlrpc_value_set_type XMLRPCValue val,
int  v_type
 

Definition at line 765 of file xmlrpc.c.

References error(), xmlrpc_value::v_type, XMLRPCValue, xr_array, xr_scalar, and xr_struct.

00766 {
00767     if (val == NULL)
00768         return -1;
00769 
00770     switch(v_type) {
00771         case xr_scalar:
00772         case xr_array:
00773         case xr_struct:
00774             val->v_type = v_type;
00775             break;
00776         default:
00777             error(0, "XMLRPC: value type not supported.");
00778             return -1;
00779     }
00780     
00781     return 0;
00782 }

Here is the call graph for this function:

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.