Kannel: Open Source WAP and SMS gateway  svn-r5335
xmlrpc.h File Reference
#include "gwlib/gwlib.h"

Go to the source code of this file.

Macros

#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 struct xmlrpc_document XMLRPCDocument
 
typedef struct xmlrpc_value XMLRPCValue
 
typedef struct 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)
 

Macro Definition Documentation

◆ xmlrpc_add_call_scalar

#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.

◆ xmlrpc_add_call_value

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

Definition at line 181 of file xmlrpc.h.

◆ xmlrpc_add_param

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

Definition at line 292 of file xmlrpc.h.

◆ xmlrpc_add_response_scalar

#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.

◆ xmlrpc_add_response_value

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

Definition at line 236 of file xmlrpc.h.

◆ xmlrpc_add_scalar_param

#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.

◆ xmlrpc_create_call

#define xmlrpc_create_call (   method)    xmlrpc_doc_create_call(method)

Definition at line 157 of file xmlrpc.h.

◆ xmlrpc_create_faultresponse

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

Definition at line 212 of file xmlrpc.h.

◆ xmlrpc_create_response

#define xmlrpc_create_response ( )    xmlrpc_doc_create_response()

Definition at line 208 of file xmlrpc.h.

◆ xmlrpc_destroy_call

#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().

◆ xmlrpc_destroy_response

#define xmlrpc_destroy_response (   response)    xmlrpc_doc_destroy(response, xr_methodresponse)

Definition at line 220 of file xmlrpc.h.

◆ xmlrpc_get_base64_value

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

Definition at line 493 of file xmlrpc.h.

◆ xmlrpc_get_double_value

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

Definition at line 487 of file xmlrpc.h.

◆ xmlrpc_get_int_value

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

Definition at line 489 of file xmlrpc.h.

◆ xmlrpc_get_scalar_value_type

#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().

◆ xmlrpc_get_string_value

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

Definition at line 491 of file xmlrpc.h.

◆ xmlrpc_parse_call

#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().

◆ xmlrpc_parse_response

#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().

◆ xmlrpc_print_call

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

Definition at line 187 of file xmlrpc.h.

Referenced by main().

◆ xmlrpc_print_response

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

Definition at line 242 of file xmlrpc.h.

◆ xmlrpc_scalar_get_base64

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

Definition at line 461 of file xmlrpc.h.

◆ xmlrpc_scalar_get_bool

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

Definition at line 452 of file xmlrpc.h.

◆ xmlrpc_scalar_get_date

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

Definition at line 455 of file xmlrpc.h.

◆ xmlrpc_scalar_get_double

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

Definition at line 446 of file xmlrpc.h.

◆ xmlrpc_scalar_get_int

#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().

◆ xmlrpc_scalar_get_string

#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().

◆ xmlrpc_send_call

#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().

◆ xmlrpc_send_response

#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

◆ XMLRPCDocument

Definition at line 82 of file xmlrpc.h.

◆ XMLRPCScalar

typedef struct xmlrpc_scalar XMLRPCScalar

Definition at line 84 of file xmlrpc.h.

◆ XMLRPCValue

typedef struct xmlrpc_value XMLRPCValue

Definition at line 83 of file xmlrpc.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
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.

◆ anonymous enum

anonymous enum
Enumerator
XMLRPC_COMPILE_OK 
XMLRPC_XMLPARSE_FAILED 
XMLRPC_PARSING_FAILED 

Definition at line 95 of file xmlrpc.h.

Function Documentation

◆ xmlrpc_add_element()

int xmlrpc_add_element ( XMLRPCValue xrarray,
XMLRPCValue value 
)

Definition at line 1218 of file xmlrpc.c.

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

Referenced by xmlrpc_add_element_scalar().

1219 {
1220  if (xrarray == NULL || xrarray->v_type != xr_array || value == NULL)
1221  return -1;
1222 
1223  gwlist_produce(xrarray->v_array, value);
1224  return 1;
1225 }
void gwlist_produce(List *list, void *item)
Definition: list.c:411
List * v_array
Definition: xmlrpc.c:116
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_add_element_scalar()

int xmlrpc_add_element_scalar ( XMLRPCValue xrarray,
int  type,
void *  arg 
)

Definition at line 1227 of file xmlrpc.c.

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

1228 {
1230  int status;
1231 
1232  status = xmlrpc_add_element(xrarray, value);
1233  if (status < 0)
1234  xmlrpc_value_destroy(value);
1235 
1236  return status;
1237 }
int type
Definition: smsc_cimd2.c:215
XMLRPCValue * xmlrpc_create_scalar_value(int type, void *arg)
Definition: xmlrpc.c:1291
void xmlrpc_value_destroy(XMLRPCValue *val)
Definition: xmlrpc.c:741
int xmlrpc_add_element(XMLRPCValue *xrarray, XMLRPCValue *value)
Definition: xmlrpc.c:1218

◆ xmlrpc_add_member()

int xmlrpc_add_member ( XMLRPCValue xrstruct,
Octstr name,
XMLRPCValue value 
)

Definition at line 1121 of file xmlrpc.c.

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

Referenced by xmlrpc_add_member_scalar().

1122 {
1123  if (xrstruct == NULL || xrstruct->v_type != xr_struct
1124  || name == NULL || value == NULL)
1125  return -1;
1126 
1127  return dict_put_once(xrstruct->v_struct, name, value);
1128 }
char * name
Definition: smsc_cimd2.c:212
Dict * v_struct
Definition: xmlrpc.c:117
int dict_put_once(Dict *dict, Octstr *key, void *value)
Definition: dict.c:271
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_add_member_scalar()

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

Definition at line 1130 of file xmlrpc.c.

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

1131 {
1133  int status;
1134 
1135  status = xmlrpc_add_member(xrstruct, name, value);
1136  if (status < 0)
1137  xmlrpc_value_destroy(value);
1138 
1139  return status;
1140 }
int xmlrpc_add_member(XMLRPCValue *xrstruct, Octstr *name, XMLRPCValue *value)
Definition: xmlrpc.c:1121
int type
Definition: smsc_cimd2.c:215
XMLRPCValue * xmlrpc_create_scalar_value(int type, void *arg)
Definition: xmlrpc.c:1291
void xmlrpc_value_destroy(XMLRPCValue *val)
Definition: xmlrpc.c:741
char * name
Definition: smsc_cimd2.c:212

◆ xmlrpc_count_elements()

int xmlrpc_count_elements ( XMLRPCValue xrarray)

Definition at line 1210 of file xmlrpc.c.

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

1211 {
1212  if (xrarray == NULL || xrarray->v_type != xr_array)
1213  return -1;
1214 
1215  return gwlist_len(xrarray->v_array);
1216 }
long gwlist_len(List *list)
Definition: list.c:166
List * v_array
Definition: xmlrpc.c:116
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_count_members()

long xmlrpc_count_members ( XMLRPCValue xrstruct)

Definition at line 1114 of file xmlrpc.c.

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

Referenced by parse_fault_element().

1115 {
1116  if (xrstruct == NULL || xrstruct->v_type != xr_struct)
1117  return -1;
1118  return dict_key_count(xrstruct->v_struct);
1119 }
long dict_key_count(Dict *dict)
Definition: dict.c:335
Dict * v_struct
Definition: xmlrpc.c:117
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_count_params()

int xmlrpc_count_params ( XMLRPCDocument xrdoc)

Definition at line 1064 of file xmlrpc.c.

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

1065 {
1066  if (xrdoc == NULL)
1067  return -1;
1068  if (xrdoc->d_type == xr_methodcall && xrdoc->methodcall != NULL)
1069  return gwlist_len(xrdoc->methodcall->params);
1070  else if (xrdoc->d_type == xr_methodresponse && xrdoc->methodresponse != NULL)
1071  return (xrdoc->methodresponse->param != NULL ? 1 : 0);
1072 
1073  return -1;
1074 }
XMLRPCValue * param
Definition: xmlrpc.c:96
long gwlist_len(List *list)
Definition: list.c:166
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
XMLRPCMethodCall * methodcall
Definition: xmlrpc.c:109
List * params
Definition: xmlrpc.c:92

◆ xmlrpc_create_array_value()

XMLRPCValue* xmlrpc_create_array_value ( void  )

Definition at line 1201 of file xmlrpc.c.

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

1202 {
1203  XMLRPCValue *value = xmlrpc_value_create();
1204  value->v_type = xr_array;
1205  value->v_array = gwlist_create();
1206 
1207  return value;
1208 }
XMLRPCValue * xmlrpc_value_create(void)
Definition: xmlrpc.c:729
List * v_array
Definition: xmlrpc.c:116
#define gwlist_create()
Definition: list.h:136
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_create_double_value()

XMLRPCValue* xmlrpc_create_double_value ( double  val)

Definition at line 1300 of file xmlrpc.c.

References xmlrpc_create_scalar_value(), and xr_double.

1301 {
1302  return xmlrpc_create_scalar_value(xr_double, &val);
1303 }
XMLRPCValue * xmlrpc_create_scalar_value(int type, void *arg)
Definition: xmlrpc.c:1291

◆ xmlrpc_create_int_value()

XMLRPCValue* xmlrpc_create_int_value ( long  val)

Definition at line 1305 of file xmlrpc.c.

References xmlrpc_create_scalar_value(), and xr_int.

1306 {
1307  return xmlrpc_create_scalar_value(xr_int, &val);
1308 }
XMLRPCValue * xmlrpc_create_scalar_value(int type, void *arg)
Definition: xmlrpc.c:1291
Definition: xmlrpc.h:88

◆ xmlrpc_create_scalar_value()

XMLRPCValue* xmlrpc_create_scalar_value ( int  type,
void *  arg 
)

Definition at line 1291 of file xmlrpc.c.

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

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().

1292 {
1293  XMLRPCValue *value = xmlrpc_value_create();
1294  value->v_type = xr_scalar;
1295  value->v_scalar = xmlrpc_scalar_create(type, arg);
1296 
1297  return value;
1298 }
XMLRPCValue * xmlrpc_value_create(void)
Definition: xmlrpc.c:729
int type
Definition: smsc_cimd2.c:215
XMLRPCScalar * v_scalar
Definition: xmlrpc.c:115
XMLRPCScalar * xmlrpc_scalar_create(int type, void *arg)
Definition: xmlrpc.c:880
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_create_string_value()

XMLRPCValue* xmlrpc_create_string_value ( Octstr val)

Definition at line 1310 of file xmlrpc.c.

References xmlrpc_create_scalar_value(), and xr_string.

1311 {
1313 }
XMLRPCValue * xmlrpc_create_scalar_value(int type, void *arg)
Definition: xmlrpc.c:1291

◆ xmlrpc_create_struct_value()

XMLRPCValue* xmlrpc_create_struct_value ( int  size)

Definition at line 1104 of file xmlrpc.c.

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

1105 {
1106  XMLRPCValue *value = xmlrpc_value_create();
1107  int len = (count_members > 0 ? count_members : OPTIMAL_STRUCT_SIZE);
1108  value->v_type = xr_struct;
1110 
1111  return value;
1112 }
Dict * dict_create(long size_hint, void(*destroy_value)(void *))
Definition: dict.c:192
XMLRPCValue * xmlrpc_value_create(void)
Definition: xmlrpc.c:729
void xmlrpc_value_destroy_item(void *val)
Definition: xmlrpc.c:761
#define OPTIMAL_STRUCT_SIZE
Definition: xmlrpc.c:79
Dict * v_struct
Definition: xmlrpc.c:117
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_doc_add_scalar()

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

Definition at line 639 of file xmlrpc.c.

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

640 {
641  XMLRPCValue *param;
642 
643  param = xmlrpc_create_scalar_value(type, arg);
644  if (xmlrpc_doc_add_value(xrdoc, d_type, param) < 0) {
645  xmlrpc_value_destroy(param);
646  return -1;
647  }
648  return 0;
649 }
int type
Definition: smsc_cimd2.c:215
XMLRPCValue * xmlrpc_create_scalar_value(int type, void *arg)
Definition: xmlrpc.c:1291
int xmlrpc_doc_add_value(XMLRPCDocument *xrdoc, int d_type, XMLRPCValue *value)
Definition: xmlrpc.c:612
void xmlrpc_value_destroy(XMLRPCValue *val)
Definition: xmlrpc.c:741

◆ xmlrpc_doc_add_value()

int xmlrpc_doc_add_value ( XMLRPCDocument xrdoc,
int  d_type,
XMLRPCValue value 
)

Definition at line 612 of file xmlrpc.c.

References xmlrpc_document::d_type, error(), xmlrpc_document::methodcall, xmlrpc_document::methodresponse, xmlrpc_call_add_param(), xmlrpc_response_add_param(), xr_methodcall, xr_methodresponse, and xr_undefined.

Referenced by xmlrpc_doc_add_scalar().

613 {
614  if (xrdoc == NULL)
615  return -1;
616 
617  if (xrdoc->d_type != d_type && d_type != xr_undefined) {
618  error(0, "Wrong xmlrpc document type. Param not added.");
619  return -1;
620  }
621  if (xrdoc->d_type == xr_methodresponse) {
622  if (xmlrpc_response_add_param(xrdoc->methodresponse, value) < 0)
623  return -1;
624  }
625  else if (xrdoc->d_type == xr_methodcall) {
626  if (xmlrpc_call_add_param(xrdoc->methodcall, value) < 0)
627  return -1;
628  }
629  else {
630  error(0, "Unknown xmlrpc document type. Param not added.");
631  return -1;
632  }
633  return 0;
634 }
void error(int err, const char *fmt,...)
Definition: log.c:648
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
XMLRPCMethodCall * methodcall
Definition: xmlrpc.c:109
static int xmlrpc_call_add_param(XMLRPCMethodCall *method, XMLRPCValue *value)
Definition: xmlrpc.c:295
static int xmlrpc_response_add_param(XMLRPCMethodResponse *response, XMLRPCValue *value)
Definition: xmlrpc.c:433

◆ xmlrpc_doc_create()

XMLRPCDocument* xmlrpc_doc_create ( void  )

Definition at line 513 of file xmlrpc.c.

References xmlrpc_document::d_type, xmlrpc_document::methodcall, xmlrpc_document::methodresponse, xmlrpc_document::parse_error, xmlrpc_document::parse_status, XMLRPC_COMPILE_OK, and xr_undefined.

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

514 {
515  XMLRPCDocument *xrdoc = gw_malloc(sizeof(XMLRPCDocument));
516 
517  xrdoc->d_type = xr_undefined;
519  xrdoc->parse_error = NULL;
520  xrdoc->methodcall = NULL;
521  xrdoc->methodresponse = NULL;
522 
523  return xrdoc;
524 }
int parse_status
Definition: xmlrpc.c:107
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
XMLRPCMethodCall * methodcall
Definition: xmlrpc.c:109
Octstr * parse_error
Definition: xmlrpc.c:108

◆ xmlrpc_doc_create_call()

XMLRPCDocument* xmlrpc_doc_create_call ( Octstr name)

Definition at line 526 of file xmlrpc.c.

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

527 {
528  XMLRPCDocument *xrdoc;
529 
530  xrdoc = xmlrpc_doc_create();
531  xrdoc->d_type = xr_methodcall;
533 
534  return xrdoc;
535 }
static XMLRPCMethodCall * xmlrpc_call_create(Octstr *name)
Definition: xmlrpc.c:269
XMLRPCMethodCall * methodcall
Definition: xmlrpc.c:109
XMLRPCDocument * xmlrpc_doc_create(void)
Definition: xmlrpc.c:513
char * name
Definition: smsc_cimd2.c:212

◆ xmlrpc_doc_create_faultresponse()

XMLRPCDocument* xmlrpc_doc_create_faultresponse ( long  faultcode,
Octstr faultstring 
)

Definition at line 548 of file xmlrpc.c.

References xmlrpc_document::methodresponse, response(), xmlrpc_doc_create_response(), and xmlrpc_fault_create().

549 {
550  XMLRPCDocument *xrdoc;
552 
553  xrdoc = xmlrpc_doc_create_response();
554 
555  response = xrdoc->methodresponse;
556  response->fault = xmlrpc_fault_create(faultcode, faultstring);
557 
558  return xrdoc;
559 }
XMLRPCDocument * xmlrpc_doc_create_response(void)
Definition: xmlrpc.c:537
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
static int response(List *push_headers, Octstr **username, Octstr **password)
static XMLRPCFault * xmlrpc_fault_create(long fcode, Octstr *fstring)
Definition: xmlrpc.c:346

◆ xmlrpc_doc_create_response()

XMLRPCDocument* xmlrpc_doc_create_response ( void  )

Definition at line 537 of file xmlrpc.c.

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

Referenced by xmlrpc_doc_create_faultresponse().

538 {
539  XMLRPCDocument *xrdoc;
540 
541  xrdoc = xmlrpc_doc_create();
542  xrdoc->d_type = xr_methodresponse;
544 
545  return xrdoc;
546 }
static XMLRPCMethodResponse * xmlrpc_response_create(void)
Definition: xmlrpc.c:412
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
XMLRPCDocument * xmlrpc_doc_create(void)
Definition: xmlrpc.c:513

◆ xmlrpc_doc_destroy()

void xmlrpc_doc_destroy ( XMLRPCDocument xrdoc,
int  d_type 
)

Definition at line 594 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(), and xmlrpc_response_destroy().

595 {
596  if (xrdoc == NULL)
597  return;
598 
599  if (xrdoc->d_type != d_type)
600  warning(0, "Destroying document with different type then given.");
601 
604  octstr_destroy(xrdoc->parse_error);
605 
606  gw_free(xrdoc);
607 }
static void xmlrpc_call_destroy(XMLRPCMethodCall *call)
Definition: xmlrpc.c:279
static void xmlrpc_response_destroy(XMLRPCMethodResponse *response)
Definition: xmlrpc.c:422
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
XMLRPCMethodCall * methodcall
Definition: xmlrpc.c:109
Octstr * parse_error
Definition: xmlrpc.c:108
void warning(int err, const char *fmt,...)
Definition: log.c:660
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324

◆ xmlrpc_doc_parse()

XMLRPCDocument* xmlrpc_doc_parse ( Octstr post_body,
int  d_type 
)

Definition at line 561 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 XMLRPC_XMLPARSE_FAILED.

562 {
564  xmlDocPtr pDoc;
565  size_t size;
566  char *body;
567 
568  if (post_body == NULL) {
570  xrdoc->parse_error = octstr_create("XMLRPC: (null) XML document given.");
571  return xrdoc;
572  }
573  xrdoc->d_type = d_type;
574 
575  octstr_strip_blanks(post_body);
576  octstr_shrink_blanks(post_body);
577  size = octstr_len(post_body);
578  body = octstr_get_cstr(post_body);
579 
580  /* parse XML document to a XML tree */
581  pDoc = xmlParseMemory(body, size);
582  if (!pDoc) {
584  xrdoc->parse_error = octstr_create("XMLRPC: not valid XML document given.");
585  return xrdoc;
586  }
587  parse_document(pDoc, xrdoc);
588  xmlFreeDoc(pDoc);
589 
590  return xrdoc;
591 }
int size
Definition: wsasm.c:84
static int parse_document(xmlDocPtr document, XMLRPCDocument *xrdoc)
Definition: xmlrpc.c:1369
int parse_status
Definition: xmlrpc.c:107
void octstr_strip_blanks(Octstr *text)
Definition: octstr.c:1346
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
Octstr * parse_error
Definition: xmlrpc.c:108
XMLRPCDocument * xmlrpc_doc_create(void)
Definition: xmlrpc.c:513
#define octstr_create(cstr)
Definition: octstr.h:125
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
void octstr_shrink_blanks(Octstr *text)
Definition: octstr.c:1433

◆ xmlrpc_doc_print()

Octstr* xmlrpc_doc_print ( XMLRPCDocument xrdoc,
int  d_type,
int  level 
)

Definition at line 654 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(), xr_methodcall, and xr_methodresponse.

Referenced by xmlrpc_doc_send().

655 {
656  Octstr *body = NULL, *pref = NULL;
657 
658  if (xrdoc == NULL)
659  return NULL;
660 
661  if (xrdoc->d_type != d_type) {
662  error(0, "Wrong xmlrpc document type.");
663  return NULL;
664  }
665  if (xrdoc->d_type == xr_methodresponse) {
666  body = xmlrpc_response_print(xrdoc->methodresponse, level);
667  }
668  else if (xrdoc->d_type == xr_methodcall) {
669  body = xmlrpc_call_print(xrdoc->methodcall, level);
670  }
671  else {
672  error(0, "Unknown xmlrpc document type.");
673  }
674 
675  if (body != NULL) {
676  pref = octstr_format("%*s<?xml version=\"1.0\"?>\n", level, "");
677  octstr_insert(body, pref, 0);
678  octstr_destroy(pref);
679  }
680  return body;
681 }
void error(int err, const char *fmt,...)
Definition: log.c:648
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
XMLRPCMethodCall * methodcall
Definition: xmlrpc.c:109
void octstr_insert(Octstr *ostr1, const Octstr *ostr2, long pos)
Definition: octstr.c:1303
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
Definition: octstr.c:118
static Octstr * xmlrpc_response_print(XMLRPCMethodResponse *response, int level)
Definition: xmlrpc.c:480
static Octstr * xmlrpc_call_print(XMLRPCMethodCall *call, int level)
Definition: xmlrpc.c:304

◆ xmlrpc_doc_send()

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

Definition at line 686 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(), octstr_destroy(), url, and xmlrpc_doc_print().

688 {
689  Octstr *body;
690  if (http_ref == NULL || xrdoc == NULL)
691  return -1;
692 
693  if (xrdoc->d_type != d_type) {
694  error(0, "Wrong xmlrpc document type.");
695  return -1;
696  }
697 
698  if (headers == NULL)
699  headers = gwlist_create();
700 
701  http_header_remove_all(headers, "Content-Type");
702  http_header_add(headers, "Content-Type", "text/xml");
703 
704  /*
705  * XML-RPC specs say we at least need Host and User-Agent
706  * HTTP headers to be defined.
707  * These are set anyway within gwlib/http.c:build_request()
708  */
709  body = xmlrpc_doc_print(xrdoc, d_type, 0);
710 
712  url, headers, body, 0, ref, NULL);
713 
714  octstr_destroy(body);
715  /* XXX: should headers be destroyed here? */
716  /*http_destroy_headers(headers); */
717  return 0;
718 }
void error(int err, const char *fmt,...)
Definition: log.c:648
void http_header_add(List *headers, char *name, char *contents)
Definition: http.c:2886
Octstr * xmlrpc_doc_print(XMLRPCDocument *xrdoc, int d_type, int level)
Definition: xmlrpc.c:654
void http_start_request(HTTPCaller *caller, int method, Octstr *url, List *headers, Octstr *body, int follow, void *id, Octstr *certkeyfile)
Definition: http.c:1760
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
Definition: octstr.c:118
long http_header_remove_all(List *headers, char *name)
Definition: http.c:3135
#define gwlist_create()
Definition: list.h:136
static Octstr * url
Definition: test_xmlrpc.c:84

◆ xmlrpc_get_call_name()

Octstr* xmlrpc_get_call_name ( XMLRPCDocument call)

Definition at line 1056 of file xmlrpc.c.

References xmlrpc_document::methodcall, and xmlrpc_call_get_name().

Referenced by smsbox_xmlrpc_post().

1057 {
1058  if (call == NULL || call->methodcall == NULL)
1059  return NULL;
1060  return xmlrpc_call_get_name(call->methodcall);
1061 }
static Octstr * xmlrpc_call_get_name(XMLRPCMethodCall *call)
Definition: xmlrpc.c:290
XMLRPCMethodCall * methodcall
Definition: xmlrpc.c:109

◆ xmlrpc_get_content_param()

void* xmlrpc_get_content_param ( XMLRPCDocument xrdoc,
int  i 
)

Definition at line 1096 of file xmlrpc.c.

References xmlrpc_get_param(), and xmlrpc_value_get_content().

1097 {
1098  XMLRPCValue *param = xmlrpc_get_param(xrdoc, i);
1099 
1100  return xmlrpc_value_get_content(param);
1101 }
void * xmlrpc_value_get_content(XMLRPCValue *val)
Definition: xmlrpc.c:825
XMLRPCValue * xmlrpc_get_param(XMLRPCDocument *xrdoc, int i)
Definition: xmlrpc.c:1076

◆ xmlrpc_get_element()

XMLRPCValue* xmlrpc_get_element ( XMLRPCValue xrarray,
int  i 
)

Definition at line 1239 of file xmlrpc.c.

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

Referenced by xmlrpc_get_element_content(), and xmlrpc_get_element_type().

1240 {
1241  if (xrarray == NULL || xrarray->v_type != xr_array || i < 0)
1242  return NULL;
1243 
1244  return gwlist_get(xrarray->v_array, i);
1245 }
void * gwlist_get(List *list, long pos)
Definition: list.c:292
List * v_array
Definition: xmlrpc.c:116
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_get_element_content()

void* xmlrpc_get_element_content ( XMLRPCValue xrarray,
int  i 
)

Definition at line 1254 of file xmlrpc.c.

References xmlrpc_get_element(), and xmlrpc_value_get_content().

1255 {
1256  XMLRPCValue *value = xmlrpc_get_element(xrarray, i);
1257 
1258  return xmlrpc_value_get_content(value);
1259 }
XMLRPCValue * xmlrpc_get_element(XMLRPCValue *xrarray, int i)
Definition: xmlrpc.c:1239
void * xmlrpc_value_get_content(XMLRPCValue *val)
Definition: xmlrpc.c:825

◆ xmlrpc_get_element_type()

int xmlrpc_get_element_type ( XMLRPCValue xrarray,
int  i 
)

Definition at line 1247 of file xmlrpc.c.

References xmlrpc_get_element(), and xmlrpc_value_get_type().

1248 {
1249  XMLRPCValue *value = xmlrpc_get_element(xrarray, i);
1250 
1251  return xmlrpc_value_get_type(value);
1252 }
int xmlrpc_value_get_type(XMLRPCValue *val)
Definition: xmlrpc.c:808
XMLRPCValue * xmlrpc_get_element(XMLRPCValue *xrarray, int i)
Definition: xmlrpc.c:1239

◆ xmlrpc_get_faultcode()

long xmlrpc_get_faultcode ( XMLRPCDocument faultresponse)

Definition at line 1325 of file xmlrpc.c.

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

Referenced by receive_reply().

1326 {
1327  if (! xmlrpc_is_fault(faultresponse)) {
1328  error(0, "XMLRPC object is not fault response.");
1329  return -1;
1330  }
1331 
1332  return xmlrpc_response_get_faultcode(faultresponse->methodresponse);
1333 }
void error(int err, const char *fmt,...)
Definition: log.c:648
int xmlrpc_is_fault(XMLRPCDocument *response)
Definition: xmlrpc.c:1317
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
static long xmlrpc_response_get_faultcode(XMLRPCMethodResponse *faultresponse)
Definition: xmlrpc.c:459

◆ xmlrpc_get_faultstring()

Octstr* xmlrpc_get_faultstring ( XMLRPCDocument faultresponse)

Definition at line 1335 of file xmlrpc.c.

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

Referenced by receive_reply().

1336 {
1337  if (! xmlrpc_is_fault(faultresponse)) {
1338  error(0, "XMLRPC object is not fault response.");
1339  return NULL;
1340  }
1341 
1342  return xmlrpc_response_get_faultstring(faultresponse->methodresponse);
1343 }
void error(int err, const char *fmt,...)
Definition: log.c:648
int xmlrpc_is_fault(XMLRPCDocument *response)
Definition: xmlrpc.c:1317
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
static Octstr * xmlrpc_response_get_faultstring(XMLRPCMethodResponse *faultresponse)
Definition: xmlrpc.c:469

◆ xmlrpc_get_member()

XMLRPCValue* xmlrpc_get_member ( XMLRPCValue xrstruct,
Octstr name 
)

Definition at line 1142 of file xmlrpc.c.

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

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

1143 {
1144  if (xrstruct == NULL || xrstruct->v_type != xr_struct || name == NULL)
1145  return NULL;
1146 
1147  return dict_get(xrstruct->v_struct, name);
1148 }
void * dict_get(Dict *dict, Octstr *key)
Definition: dict.c:286
char * name
Definition: smsc_cimd2.c:212
Dict * v_struct
Definition: xmlrpc.c:117
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_get_member_content()

void* xmlrpc_get_member_content ( XMLRPCValue xrstruct,
Octstr name 
)

Definition at line 1157 of file xmlrpc.c.

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

1158 {
1159  XMLRPCValue *value = xmlrpc_get_member(xrstruct, name);
1160 
1161  return xmlrpc_value_get_content(value);
1162 }
char * name
Definition: smsc_cimd2.c:212
void * xmlrpc_value_get_content(XMLRPCValue *val)
Definition: xmlrpc.c:825
XMLRPCValue * xmlrpc_get_member(XMLRPCValue *xrstruct, Octstr *name)
Definition: xmlrpc.c:1142

◆ xmlrpc_get_member_type()

int xmlrpc_get_member_type ( XMLRPCValue xrstruct,
Octstr name 
)

Definition at line 1150 of file xmlrpc.c.

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

1151 {
1152  XMLRPCValue *value = xmlrpc_get_member(xrstruct, name);
1153 
1154  return xmlrpc_value_get_type(value);
1155 }
int xmlrpc_value_get_type(XMLRPCValue *val)
Definition: xmlrpc.c:808
char * name
Definition: smsc_cimd2.c:212
XMLRPCValue * xmlrpc_get_member(XMLRPCValue *xrstruct, Octstr *name)
Definition: xmlrpc.c:1142

◆ xmlrpc_get_param()

XMLRPCValue* xmlrpc_get_param ( XMLRPCDocument xrdoc,
int  i 
)

Definition at line 1076 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, xr_methodcall, and xr_methodresponse.

Referenced by xmlrpc_get_content_param(), and xmlrpc_get_type_param().

1077 {
1078  if (xrdoc == NULL)
1079  return NULL;
1080  if (xrdoc->d_type == xr_methodcall && xrdoc->methodcall != NULL)
1081  return gwlist_len(xrdoc->methodcall->params) > i ? gwlist_get(xrdoc->methodcall->params, i) : NULL;
1082  else if (xrdoc->d_type == xr_methodresponse && xrdoc->methodresponse != NULL
1083  && i == 0)
1084  return xrdoc->methodresponse->param;
1085 
1086  return NULL;
1087 }
XMLRPCValue * param
Definition: xmlrpc.c:96
long gwlist_len(List *list)
Definition: list.c:166
void * gwlist_get(List *list, long pos)
Definition: list.c:292
XMLRPCMethodResponse * methodresponse
Definition: xmlrpc.c:110
XMLRPCMethodCall * methodcall
Definition: xmlrpc.c:109
List * params
Definition: xmlrpc.c:92

◆ xmlrpc_get_type_param()

int xmlrpc_get_type_param ( XMLRPCDocument xrdoc,
int  i 
)

Definition at line 1089 of file xmlrpc.c.

References xmlrpc_get_param(), and xmlrpc_value_get_type().

1090 {
1091  XMLRPCValue *param = xmlrpc_get_param(xrdoc, i);
1092 
1093  return xmlrpc_value_get_type(param);
1094 }
int xmlrpc_value_get_type(XMLRPCValue *val)
Definition: xmlrpc.c:808
XMLRPCValue * xmlrpc_get_param(XMLRPCDocument *xrdoc, int i)
Definition: xmlrpc.c:1076

◆ xmlrpc_is_fault()

int xmlrpc_is_fault ( XMLRPCDocument response)

Definition at line 1317 of file xmlrpc.c.

References response(), xmlrpc_response_is_fault(), and xr_methodresponse.

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

1318 {
1319  if (response == NULL || response->d_type != xr_methodresponse)
1320  return 0;
1321 
1322  return xmlrpc_response_is_fault(response->methodresponse);
1323 }
static int xmlrpc_response_is_fault(XMLRPCMethodResponse *response)
Definition: xmlrpc.c:451
static int response(List *push_headers, Octstr **username, Octstr **password)

◆ xmlrpc_parse_error()

Octstr* xmlrpc_parse_error ( XMLRPCDocument xrdoc)

Definition at line 1356 of file xmlrpc.c.

References octstr_duplicate, and xmlrpc_document::parse_error.

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

1357 {
1358  if (xrdoc == NULL)
1359  return NULL;
1360 
1361  return octstr_duplicate(xrdoc->parse_error);
1362 }
Octstr * parse_error
Definition: xmlrpc.c:108
#define octstr_duplicate(ostr)
Definition: octstr.h:187

◆ xmlrpc_parse_status()

int xmlrpc_parse_status ( XMLRPCDocument xrdoc)

Definition at line 1348 of file xmlrpc.c.

References xmlrpc_document::parse_status.

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

1349 {
1350  if (xrdoc == NULL)
1351  return -1;
1352 
1353  return xrdoc->parse_status;
1354 }
int parse_status
Definition: xmlrpc.c:107

◆ xmlrpc_print_array()

Octstr* xmlrpc_print_array ( List elements,
int  level 
)

Definition at line 1261 of file xmlrpc.c.

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

Referenced by xmlrpc_value_print().

1262 {
1263  Octstr *body, *os_element;
1264  XMLRPCValue *element = NULL;
1265  int i;
1266 
1267  if (v_array == NULL)
1268  return NULL;
1269 
1270  body = octstr_format("%*s<array>\n%*s<data>\n", level, "", level+2, "");
1271 
1272  for(i = 0; i < gwlist_len(v_array); i++) {
1273  element = gwlist_get(v_array, i);
1274  os_element = xmlrpc_value_print(element, level+4);
1275  if (os_element == NULL) {
1276  octstr_destroy(body);
1277  return NULL;
1278  }
1279 
1280  octstr_append(body, os_element);
1281  octstr_destroy(os_element);
1282  }
1283  octstr_format_append(body, "%*s</data>\n%*s</array>\n",
1284  level+2, "", level, "");
1285 
1286  return body;
1287 }
Octstr * xmlrpc_value_print(XMLRPCValue *val, int level)
Definition: xmlrpc.c:843
void octstr_append(Octstr *ostr1, const Octstr *ostr2)
Definition: octstr.c:1504
long gwlist_len(List *list)
Definition: list.c:166
void * gwlist_get(List *list, long pos)
Definition: list.c:292
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
Definition: octstr.c:118
void octstr_format_append(Octstr *os, const char *fmt,...)
Definition: octstr.c:2507

◆ xmlrpc_print_struct()

Octstr* xmlrpc_print_struct ( Dict members,
int  level 
)

Definition at line 1164 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(), and xmlrpc_value_print().

Referenced by xmlrpc_value_print().

1165 {
1166  Octstr *body, *os_val, *key;
1167  List *keys;
1168  XMLRPCValue *member_val;
1169 
1170  if (v_struct == NULL || dict_key_count(v_struct) == 0)
1171  return NULL;
1172 
1173  keys = dict_keys(v_struct);
1174  body = octstr_format("%*s<struct>\n", level, "");
1175 
1176  while ((key = gwlist_consume(keys)) != NULL) {
1177  member_val = dict_get(v_struct, key);
1178  os_val = xmlrpc_value_print(member_val, level+4);
1179  if (os_val == NULL) {
1181  octstr_destroy(key);
1182  octstr_destroy(body);
1183  return NULL;
1184  }
1185  octstr_format_append(body, "%*s<member>\n"
1186  "%*s<name>%S</name>\n%S"
1187  "%*s</member>\n",
1188  level+2, "", level+4, "",
1189  key, os_val,
1190  level+2, "");
1191  octstr_destroy(key);
1192  octstr_destroy(os_val);
1193  }
1195  octstr_format_append(body, "%*s</struct>\n", level, "");
1196 
1197  return body;
1198 }
Octstr * xmlrpc_value_print(XMLRPCValue *val, int level)
Definition: xmlrpc.c:843
void * dict_get(Dict *dict, Octstr *key)
Definition: dict.c:286
long dict_key_count(Dict *dict)
Definition: dict.c:335
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
void octstr_destroy_item(void *os)
Definition: octstr.c:336
Definition: octstr.c:118
void * gwlist_consume(List *list)
Definition: list.c:427
void octstr_format_append(Octstr *os, const char *fmt,...)
Definition: octstr.c:2507
List * dict_keys(Dict *dict)
Definition: dict.c:347
Definition: list.c:102
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)
Definition: list.c:145

◆ xmlrpc_scalar_create()

XMLRPCScalar* xmlrpc_scalar_create ( int  type,
void *  arg 
)

Definition at line 880 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, type, xmlrpc_scalar_destroy(), xr_base64, xr_bool, xr_date, xr_double, xr_int, and xr_string.

Referenced by parse_value_element(), and xmlrpc_create_scalar_value().

881 {
882  XMLRPCScalar *scalar = gw_malloc(sizeof(XMLRPCScalar));
883 
884  scalar->s_type = type;
885  scalar->s_int = 0;
886  scalar->s_bool = 0;
887  scalar->s_double = 0.0;
888  scalar->s_str = NULL;
889  scalar->s_date = NULL;
890  scalar->s_base64 = NULL;
891 
892  if (arg == NULL) {
893 #ifdef XR_ENABLE_EMPTY_STRING_VALUES
894  if (scalar->s_type != xr_string) {
895 #endif
896  error(0,"XML-RPC: scalar value may not be null!");
897  xmlrpc_scalar_destroy(scalar);
898  return NULL;
899 #ifdef XR_ENABLE_EMPTY_STRING_VALUES
900  }
901 #endif
902  }
903  switch (type) {
904  case xr_int:
905  if (arg != NULL)
906  scalar->s_int = *(long*)arg;
907  break;
908  case xr_bool:
909  if (arg != NULL)
910  scalar->s_bool = *(int*)arg;
911  break;
912  case xr_double:
913  if (arg != NULL)
914  scalar->s_double = *(double*)arg;
915  break;
916  case xr_string:
917  scalar->s_str = octstr_duplicate((Octstr *)arg);
918  break;
919  case xr_date:
920  scalar->s_date = octstr_duplicate((Octstr *)arg);
921  break;
922  case xr_base64:
923  scalar->s_base64 = octstr_duplicate((Octstr *)arg);
924  break;
925  default:
926  error(0,"XML-RPC: scalar type not supported!");
927  xmlrpc_scalar_destroy(scalar);
928  return NULL;
929  }
930  return scalar;
931 }
void error(int err, const char *fmt,...)
Definition: log.c:648
Definition: xmlrpc.h:88
int type
Definition: smsc_cimd2.c:215
Octstr * s_str
Definition: xmlrpc.c:127
void xmlrpc_scalar_destroy(XMLRPCScalar *scalar)
Definition: xmlrpc.c:935
double s_double
Definition: xmlrpc.c:130
Octstr * s_date
Definition: xmlrpc.c:131
int s_type
Definition: xmlrpc.c:126
#define octstr_duplicate(ostr)
Definition: octstr.h:187
int s_bool
Definition: xmlrpc.c:129
Octstr * s_base64
Definition: xmlrpc.c:132
Definition: octstr.c:118
long s_int
Definition: xmlrpc.c:128
Definition: xmlrpc.h:88
Definition: xmlrpc.h:88

◆ xmlrpc_scalar_destroy()

void xmlrpc_scalar_destroy ( XMLRPCScalar scalar)

Definition at line 935 of file xmlrpc.c.

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

Referenced by xmlrpc_scalar_create(), and xmlrpc_value_destroy().

936 {
937  if (scalar == NULL)
938  return;
939 
940  octstr_destroy(scalar->s_str);
941  octstr_destroy(scalar->s_date);
942  octstr_destroy(scalar->s_base64);
943 
944  gw_free(scalar);
945 }
Octstr * s_str
Definition: xmlrpc.c:127
Octstr * s_date
Definition: xmlrpc.c:131
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
Octstr * s_base64
Definition: xmlrpc.c:132

◆ xmlrpc_scalar_get_content()

void* xmlrpc_scalar_get_content ( XMLRPCScalar scalar,
int  s_type 
)

Definition at line 954 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, xr_base64, xr_bool, xr_date, xr_double, xr_int, and xr_string.

955 {
956  if (scalar == NULL)
957  return NULL;
958  if (scalar->s_type != s_type) {
959  error(0, "XMLRPC: Scalar content request with bogus type");
960  return NULL;
961  }
962  switch (scalar->s_type) {
963  case xr_int: return &(scalar->s_int);
964  case xr_bool: return &(scalar->s_bool);
965  case xr_double: return &(scalar->s_double);
966  case xr_string: return scalar->s_str;
967  case xr_date: return scalar->s_date;
968  case xr_base64: return scalar->s_base64;
969  default:
970  error(0,"XML-RPC: scalar type not supported!");
971  return NULL;
972  }
973 }
void error(int err, const char *fmt,...)
Definition: log.c:648
Definition: xmlrpc.h:88
Octstr * s_str
Definition: xmlrpc.c:127
double s_double
Definition: xmlrpc.c:130
Octstr * s_date
Definition: xmlrpc.c:131
int s_type
Definition: xmlrpc.c:126
int s_bool
Definition: xmlrpc.c:129
Octstr * s_base64
Definition: xmlrpc.c:132
long s_int
Definition: xmlrpc.c:128
Definition: xmlrpc.h:88
Definition: xmlrpc.h:88

◆ xmlrpc_scalar_get_type()

int xmlrpc_scalar_get_type ( XMLRPCScalar scalar)

Definition at line 947 of file xmlrpc.c.

References xmlrpc_scalar::s_type.

948 {
949  if (scalar == NULL)
950  return -1;
951  return scalar->s_type;
952 }
int s_type
Definition: xmlrpc.c:126

◆ xmlrpc_scalar_print()

Octstr* xmlrpc_scalar_print ( XMLRPCScalar scalar,
int  level 
)

Definition at line 975 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, xr_base64, xr_bool, xr_date, xr_double, xr_int, and xr_string.

Referenced by xmlrpc_value_print().

976 {
977  Octstr *os = NULL;
978 
979  if (scalar == NULL)
980  return NULL;
981 
982  switch (scalar->s_type) {
983  case xr_int:
984  os = octstr_format("%*s<int>%ld</int>\n",
985  level, "", scalar->s_int);
986  break;
987  case xr_bool:
988  os = octstr_format("%*s<bool>%d</bool>\n",
989  level, "", scalar->s_bool);
990  break;
991  case xr_double:
992  os = octstr_format("%*s<double>%d</double>\n",
993  level, "", scalar->s_double);
994  break;
995  case xr_string:
996  if (scalar->s_str == NULL) {
997 #ifdef XR_ENABLE_EMPTY_STRING_VALUES
998  os = octstr_format("%*s<string></string>\n",
999  level, "");
1000 #endif
1001  } else {
1002  Octstr *tmp = octstr_duplicate(scalar->s_str);
1004  os = octstr_format("%*s<string>%S</string>\n",
1005  level, "", tmp);
1006  octstr_destroy(tmp);
1007  }
1008  break;
1009  case xr_date:
1010  os = octstr_format("%*s<datetime.iso8601>%S</datetime.iso8601>\n",
1011  level, "", scalar->s_date);
1012  break;
1013  case xr_base64:
1014  os = octstr_format("%*s<base64>%S</base64>\n",
1015  level, "", scalar->s_base64);
1016  break;
1017  }
1018  return os;
1019 }
Definition: xmlrpc.h:88
Octstr * s_str
Definition: xmlrpc.c:127
void octstr_convert_to_html_entities(Octstr *input)
Definition: octstr.c:2738
double s_double
Definition: xmlrpc.c:130
Octstr * s_date
Definition: xmlrpc.c:131
int s_type
Definition: xmlrpc.c:126
#define octstr_duplicate(ostr)
Definition: octstr.h:187
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
int s_bool
Definition: xmlrpc.c:129
Octstr * s_base64
Definition: xmlrpc.c:132
Definition: octstr.c:118
long s_int
Definition: xmlrpc.c:128
Definition: xmlrpc.h:88
Definition: xmlrpc.h:88

◆ xmlrpc_value_create()

XMLRPCValue* xmlrpc_value_create ( void  )

Definition at line 729 of file xmlrpc.c.

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

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().

730 {
731  XMLRPCValue *val = gw_malloc(sizeof(XMLRPCValue));
732 
733  val->v_type = xr_undefined;
734  val->v_scalar = NULL;
735  val->v_array = NULL;
736  val->v_struct = NULL;
737  return val;
738 }
XMLRPCScalar * v_scalar
Definition: xmlrpc.c:115
List * v_array
Definition: xmlrpc.c:116
Dict * v_struct
Definition: xmlrpc.c:117
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_value_destroy()

void xmlrpc_value_destroy ( XMLRPCValue val)

Definition at line 741 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(), 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().

742 {
743  if (val == NULL)
744  return;
745 
746  switch(val->v_type) {
747  case xr_scalar:
749  break;
750  case xr_array:
752  break;
753  case xr_struct:
754  dict_destroy(val->v_struct);
755  break;
756  }
757  gw_free(val);
758 }
void xmlrpc_value_destroy_item(void *val)
Definition: xmlrpc.c:761
void xmlrpc_scalar_destroy(XMLRPCScalar *scalar)
Definition: xmlrpc.c:935
XMLRPCScalar * v_scalar
Definition: xmlrpc.c:115
List * v_array
Definition: xmlrpc.c:116
void dict_destroy(Dict *dict)
Definition: dict.c:215
Dict * v_struct
Definition: xmlrpc.c:117
int v_type
Definition: xmlrpc.c:114
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)
Definition: list.c:145

◆ xmlrpc_value_destroy_item()

void xmlrpc_value_destroy_item ( void *  val)

Definition at line 761 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().

762 {
764 }
void xmlrpc_value_destroy(XMLRPCValue *val)
Definition: xmlrpc.c:741

◆ xmlrpc_value_get_content()

void* xmlrpc_value_get_content ( XMLRPCValue val)

Definition at line 825 of file xmlrpc.c.

References error(), xmlrpc_value::v_array, xmlrpc_value::v_scalar, xmlrpc_value::v_struct, xmlrpc_value::v_type, 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().

826 {
827  if (val == NULL)
828  return NULL;
829 
830  switch(val->v_type) {
831  case xr_scalar:
832  return val->v_scalar;
833  case xr_array:
834  return val->v_array;
835  case xr_struct:
836  return val->v_struct;
837  default:
838  error(0, "XMLRPC: value type not supported.");
839  return NULL;
840  }
841 }
void error(int err, const char *fmt,...)
Definition: log.c:648
XMLRPCScalar * v_scalar
Definition: xmlrpc.c:115
List * v_array
Definition: xmlrpc.c:116
Dict * v_struct
Definition: xmlrpc.c:117
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_value_get_type()

int xmlrpc_value_get_type ( XMLRPCValue val)

Definition at line 808 of file xmlrpc.c.

References xmlrpc_value::v_type.

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

809 {
810  if (val == NULL)
811  return -1;
812 
813  return val->v_type;
814 }
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_value_get_type_smart()

int xmlrpc_value_get_type_smart ( XMLRPCValue val)

Definition at line 816 of file xmlrpc.c.

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

Referenced by parse_fault_element().

817 {
818  int type = xmlrpc_value_get_type(val);
819  if (type == xr_scalar)
820  return xmlrpc_get_scalar_value_type(val);
821 
822  return type;
823 }
int type
Definition: smsc_cimd2.c:215
int xmlrpc_value_get_type(XMLRPCValue *val)
Definition: xmlrpc.c:808
#define xmlrpc_get_scalar_value_type(value)
Definition: xmlrpc.h:483

◆ xmlrpc_value_print()

Octstr* xmlrpc_value_print ( XMLRPCValue val,
int  level 
)

Definition at line 843 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(), xr_array, xr_scalar, and xr_struct.

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

844 {
845  Octstr *body = NULL, *os = NULL;
846 
847  if (val == NULL)
848  return NULL;
849 
850  switch(val->v_type) {
851  case xr_scalar:
852  os = xmlrpc_scalar_print(val->v_scalar, level+2);
853  break;
854  case xr_struct:
855  os = xmlrpc_print_struct(val->v_struct, level+2);
856  break;
857  case xr_array:
858  os = xmlrpc_print_array(val->v_array, level+2);
859  break;
860  default:
861  return NULL;
862  }
863 
864  if (os != NULL) {
865  body = octstr_format("%*s<value>\n%S%*s</value>\n",
866  level, "", os, level, "");
867  octstr_destroy(os);
868  }
869 
870  return body;
871 }
Octstr * xmlrpc_scalar_print(XMLRPCScalar *scalar, int level)
Definition: xmlrpc.c:975
Octstr * xmlrpc_print_array(List *v_array, int level)
Definition: xmlrpc.c:1261
XMLRPCScalar * v_scalar
Definition: xmlrpc.c:115
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
List * v_array
Definition: xmlrpc.c:116
Octstr * xmlrpc_print_struct(Dict *v_struct, int level)
Definition: xmlrpc.c:1164
Definition: octstr.c:118
Dict * v_struct
Definition: xmlrpc.c:117
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_value_set_content()

int xmlrpc_value_set_content ( XMLRPCValue val,
void *  content 
)

Definition at line 785 of file xmlrpc.c.

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

786 {
787  if (val == NULL)
788  return -1;
789 
790  switch(val->v_type) {
791  case xr_scalar:
792  val->v_scalar = (XMLRPCScalar *)content;
793  break;
794  case xr_array:
795  val->v_array = (List *)content;
796  break;
797  case xr_struct:
798  val->v_struct = (Dict *)content;
799  break;
800  default:
801  error(0, "XMLRPC: value type not supported.");
802  return -1;
803  }
804 
805  return 0;
806 }
void error(int err, const char *fmt,...)
Definition: log.c:648
XMLRPCScalar * v_scalar
Definition: xmlrpc.c:115
Definition: dict.c:116
List * v_array
Definition: xmlrpc.c:116
Dict * v_struct
Definition: xmlrpc.c:117
Definition: list.c:102
int v_type
Definition: xmlrpc.c:114

◆ xmlrpc_value_set_type()

int xmlrpc_value_set_type ( XMLRPCValue val,
int  v_type 
)

Definition at line 766 of file xmlrpc.c.

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

767 {
768  if (val == NULL)
769  return -1;
770 
771  switch(v_type) {
772  case xr_scalar:
773  case xr_array:
774  case xr_struct:
775  val->v_type = v_type;
776  break;
777  default:
778  error(0, "XMLRPC: value type not supported.");
779  return -1;
780  }
781 
782  return 0;
783 }
void error(int err, const char *fmt,...)
Definition: log.c:648
int v_type
Definition: xmlrpc.c:114
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.