This is the main file of XMLRPC SER module which contains all the functions related to XML-RPC processing, as well as the module interface.
More...
#include <strings.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <signal.h>
#include <libxml/xmlreader.h>
#include "../../str.h"
#include "../../sr_module.h"
#include "../../error.h"
#include "../../usr_avp.h"
#include "../../mem/mem.h"
#include "../../parser/parse_uri.h"
#include "../../parser/msg_parser.h"
#include "../../ut.h"
#include "../../dset.h"
#include "../../dprint.h"
#include "../../data_lump.h"
#include "../../data_lump_rpl.h"
#include "../../msg_translator.h"
#include "../../select.h"
#include "../../receive.h"
#include "../../modules/sl/sl.h"
#include "../../nonsip_hooks.h"
#include "../../action.h"
#include "../../script_cb.h"
#include "../../route.h"
#include "../../sip_msg_clone.h"
#include "http.h"
Go to the source code of this file.
Data Structures
Defines
-
#define FAULT_BODY
- The text of XML document indicating error that goes between reason code and reason phrase.
- #define FAULT_PREFIX
- The beginning of XML document indicating an error.
- #define FAULT_SUFFIX
- The end of XML document that indicates an error.
-
#define SUCCESS_PREFIX
- The beginning of XML-RPC reply sent to the client.
-
#define SUCCESS_SUFFIX
- The closing part of XML-RPC reply document sent to the client.
Typedefs
- typedef struct rpc_ctx rpc_ctx_t
- The context of the XML-RPC request being processed.
Functions
- static int add_garbage (int type, void *ptr, struct xmlrpc_reply *reply)
- Add a memory registion to the list of memory blocks that need to be re-claimed later.
- static int add_xmlrpc_reply (struct xmlrpc_reply *reply, str *text)
- Add arbitrary text to the XML-RPC reply being constructed, no escaping done.
- static int add_xmlrpc_reply_esc (struct xmlrpc_reply *reply, str *text)
- Adds arbitrary text to the XML-RPC reply being constructed, special characters < and & will be escaped.
- static int add_xmlrpc_reply_offset (struct xmlrpc_reply *reply, unsigned int offset, str *text)
- Adds arbitrary text to the XML-RPC reply being constructed, the text will be inserted at a specified offset within the XML-RPC reply.
- static int build_fault_reply (struct xmlrpc_reply *reply)
- Create XML-RPC reply that indicates an error to the caller.
- static void clean_xmlrpc_reply (struct xmlrpc_reply *reply)
- Free all memory used by the XML-RPC reply structure.
- static void clear_xmlrpc_reply (struct xmlrpc_reply *reply)
- Clear the XML-RPC reply code and sets it back to a success reply.
-
static void collect_garbage (void)
- Re-claims all memory allocated in the process of building XML-RPC reply.
- static int dispatch_rpc (sip_msg_t *msg, char *s1, char *s2)
- The main processing function of xmlrpc module.
-
static int em_receive_request (sip_msg_t *orig_msg, char *new_buf, unsigned int new_len)
- Emulate receive_msg for an XML-RPC request .
-
static int find_member (xmlNodePtr *value, xmlDocPtr doc, xmlNodePtr structure, struct xmlrpc_reply *reply, char *member_name)
- Find a structure member by name.
- static int get_double (double *val, struct xmlrpc_reply *reply, xmlDocPtr doc, xmlNodePtr value, int flags)
- Converts an XML-RPC encoded parameter into double if possible.
- static int get_int (int *val, struct xmlrpc_reply *reply, xmlDocPtr doc, xmlNodePtr value, int flags)
- Converts an XML-RPC encoded parameter into integer if possible.
- static unsigned int get_reply_len (struct xmlrpc_reply *reply)
- Returns the current length of the XML-RPC reply body.
- static int get_rpc_document (str *doc, sip_msg_t *msg)
- Extract XML-RPC query from a SIP/HTTP message.
- static int get_string (char **val, struct xmlrpc_reply *reply, xmlDocPtr doc, xmlNodePtr value, int flags)
- Convert a parameter encoded in XML-RPC to a zero terminated string.
- static char * http_xmlrpc2sip (sip_msg_t *msg, int *new_msg_len)
- Creates a SIP message (in "buffer" form) from a HTTP XML-RPC request).
- static int init_xmlrpc_reply (struct xmlrpc_reply *reply)
- Initialize XML-RPC reply data structure.
-
int mod_register (char *path, int *dlflags, void *p1, void *p2)
- advertise that sip workers handle rpc commands
- static struct rpc_struct * new_rpcstruct (xmlDocPtr doc, xmlNodePtr structure, struct xmlrpc_reply *reply)
- Create and initialize a new rpc_structure data structure.
-
static int open_doc (rpc_ctx_t *ctx, sip_msg_t *msg)
- Starts parsing XML-RPC document, get the name of the method to be called and position the cursor at the first parameter in the document.
- static int print_value (struct xmlrpc_reply *res, struct xmlrpc_reply *err_reply, char fmt, va_list *ap)
- Converts the variables provided in parameter ap according to formatting string provided in parameter fmt into parameters in XML-RPC format.
- static int process_xmlrpc (sip_msg_t *msg)
- The main handler that will be called when SER core receives a non-SIP request (i.e.
- static int rpc_add (rpc_ctx_t *ctx, char *fmt,...)
- Implementation of rpc_add function required by the management API in SER.
-
static rpc_capabilities_t rpc_capabilities (rpc_ctx_t *ctx)
- Returns the RPC capabilities supported by the xmlrpc driver.
- static void rpc_delayed_ctx_close (struct rpc_delayed_ctx *dctx)
- Closes a "delayed reply" context and sends the reply.
- static struct rpc_delayed_ctx * rpc_delayed_ctx_new (rpc_ctx_t *ctx)
- Returns a new "delayed reply" context.
- static void rpc_fault (rpc_ctx_t *ctx, int code, char *fmt,...)
- Implementation of rpc_fault function required by the management API in SER.
- static int rpc_printf (rpc_ctx_t *ctx, char *fmt,...)
- Implementation of rpc_printf function required by the management API in SER.
- static int rpc_scan (rpc_ctx_t *ctx, char *fmt,...)
- Implementation of rpc->scan function required by the management API in SER.
- static int rpc_send (rpc_ctx_t *ctx)
- Implementation of rpc_send function required by the management API in SER.
-
static int rpc_struct_add (struct rpc_struct *s, char *fmt,...)
- Adds a new member to structure.
-
static int rpc_struct_printf (struct rpc_struct *s, char *member_name, char *fmt,...)
- Create a new member from formatting string and add it to a structure.
-
static int select_method (str *res, struct select *s, sip_msg_t *msg)
- Implementation of @xmlrpc.method select that can be used in SER scripts to retrieve the method string from XML-RPC documents.
- static int send_reply (sip_msg_t *msg, str *body)
- Send a reply to the client with given body.
- static enum xmlrpc_val_type xml_get_type (xmlNodePtr value)
- Returns the XML-RPC value type.
-
static time_t xmlrpc2time (const char *str)
- Convert time in XML-RPC format to time_t.
-
static int xmlrpc_reply (sip_msg_t *msg, char *p1, char *p2)
- This function can be called from SER scripts to generate an XML-RPC reply.
Variables
- static rpc_ctx_t ctx
- The context of the XML-RPC request being processed.
-
static rpc_t func_param
- Pointers to the functions that implement the RPC interface of xmlrpc SER module.
- sl_api_t slb
- Reference to the sl (stateless replies) module of SER The sl module of SER is needed so that the xmlrpc SER module can send replies back to clients.
- static struct garbage * waste_bin
- Garbage collection data structure.
- static char * xmlrpc_route = 0
- Enable/disable additional introspection methods.
Detailed Description
Definition in file xmlrpc.c.