mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 14:44:17 +00:00
FS-2746 --resolve large xmlrpc update thanks garmt
This commit is contained in:
1 parent
37ecad9903
commit
6b6c83a718
397 files changed
+41821
-33840
No files matched your search
@@ -286,6 +286,64 @@ static struct systemMethodReg const methodListMethods = {
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
system.methodExist
|
||||
==========================================================================*/
|
||||
|
||||
static void
|
||||
determineMethodExistence(xmlrpc_env * const envP,
|
||||
const char * const methodName,
|
||||
xmlrpc_registry * const registryP,
|
||||
xmlrpc_value ** const existsPP) {
|
||||
|
||||
xmlrpc_methodInfo * methodP;
|
||||
|
||||
xmlrpc_methodListLookupByName(registryP->methodListP, methodName,
|
||||
&methodP);
|
||||
|
||||
*existsPP = xmlrpc_bool_new(envP, !!methodP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static xmlrpc_value *
|
||||
system_methodExist(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const paramArrayP,
|
||||
void * const serverInfo,
|
||||
void * const callInfo ATTR_UNUSED) {
|
||||
|
||||
xmlrpc_registry * const registryP = serverInfo;
|
||||
|
||||
xmlrpc_value * retvalP;
|
||||
|
||||
const char * methodName;
|
||||
|
||||
XMLRPC_ASSERT_ENV_OK(envP);
|
||||
XMLRPC_ASSERT_VALUE_OK(paramArrayP);
|
||||
XMLRPC_ASSERT_PTR_OK(serverInfo);
|
||||
|
||||
xmlrpc_decompose_value(envP, paramArrayP, "(s)", &methodName);
|
||||
|
||||
if (!envP->fault_occurred) {
|
||||
determineMethodExistence(envP, methodName, registryP, &retvalP);
|
||||
|
||||
xmlrpc_strfree(methodName);
|
||||
}
|
||||
|
||||
return retvalP;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct systemMethodReg const methodMethodExist = {
|
||||
"system.methodExist",
|
||||
&system_methodExist,
|
||||
"s:b",
|
||||
"Tell whether a method by a specified name exists on this server",
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
system.methodHelp
|
||||
=========================================================================*/
|
||||
@@ -327,7 +385,7 @@ system_methodHelp(xmlrpc_env * const envP,
|
||||
XMLRPC_ASSERT_ENV_OK(envP);
|
||||
XMLRPC_ASSERT_VALUE_OK(paramArrayP);
|
||||
XMLRPC_ASSERT_PTR_OK(serverInfo);
|
||||
|
||||
|
||||
xmlrpc_decompose_value(envP, paramArrayP, "(s)", &methodName);
|
||||
|
||||
if (!envP->fault_occurred) {
|
||||
@@ -338,9 +396,9 @@ system_methodHelp(xmlrpc_env * const envP,
|
||||
"for security reasons");
|
||||
else
|
||||
getHelpString(envP, methodName, registryP, &retvalP);
|
||||
}
|
||||
|
||||
xmlrpc_strfree(methodName);
|
||||
xmlrpc_strfree(methodName);
|
||||
}
|
||||
|
||||
return retvalP;
|
||||
}
|
||||
@@ -409,8 +467,8 @@ buildSignatureValue(xmlrpc_env * const envP,
|
||||
|
||||
if (envP->fault_occurred)
|
||||
xmlrpc_DECREF(sigValueP);
|
||||
else
|
||||
*sigValuePP = sigValueP;
|
||||
|
||||
*sigValuePP = sigValueP;
|
||||
}
|
||||
|
||||
|
||||
@@ -471,6 +529,15 @@ getSignatureList(xmlrpc_env * const envP,
|
||||
|
||||
|
||||
|
||||
/* Microsoft Visual C in debug mode produces code that complains about
|
||||
returning an undefined value from system_methodSignature(). It's a bogus
|
||||
complaint, because this function is defined to return nothing meaningful
|
||||
those cases. So we disable the check.
|
||||
*/
|
||||
#pragma runtime_checks("u", off)
|
||||
|
||||
|
||||
|
||||
static xmlrpc_value *
|
||||
system_methodSignature(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const paramArrayP,
|
||||
@@ -487,8 +554,6 @@ system_methodSignature(xmlrpc_env * const envP,
|
||||
XMLRPC_ASSERT_VALUE_OK(paramArrayP);
|
||||
XMLRPC_ASSERT_PTR_OK(serverInfo);
|
||||
|
||||
retvalP = NULL; /* quiet compiler unset variable warning */
|
||||
|
||||
xmlrpc_env_init(&env);
|
||||
|
||||
/* Turn our arguments into something more useful. */
|
||||
@@ -522,10 +587,14 @@ system_methodSignature(xmlrpc_env * const envP,
|
||||
|
||||
|
||||
|
||||
#pragma runtime_checks("u", restore)
|
||||
|
||||
|
||||
|
||||
static struct systemMethodReg const methodMethodSignature = {
|
||||
"system.methodSignature",
|
||||
&system_methodSignature,
|
||||
"s:s",
|
||||
"A:s",
|
||||
"Given the name of a method, return an array of legal signatures. "
|
||||
"Each signature is an array of strings. The first item of each signature "
|
||||
"is the return type, and any others items are parameter types.",
|
||||
@@ -556,8 +625,6 @@ system_shutdown(xmlrpc_env * const envP,
|
||||
|
||||
xmlrpc_env_init(&env);
|
||||
|
||||
retvalP = NULL; /* quiet compiler warning */
|
||||
|
||||
/* Turn our arguments into something more useful. */
|
||||
xmlrpc_decompose_value(&env, paramArrayP, "(s)", &comment);
|
||||
if (env.fault_occurred)
|
||||
@@ -607,9 +674,9 @@ static struct systemMethodReg const methodShutdown = {
|
||||
=========================================================================*/
|
||||
|
||||
static void
|
||||
getCapabilities(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP ATTR_UNUSED,
|
||||
xmlrpc_value ** const capabilitiesPP) {
|
||||
constructCapabilities(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP ATTR_UNUSED,
|
||||
xmlrpc_value ** const capabilitiesPP) {
|
||||
|
||||
*capabilitiesPP =
|
||||
xmlrpc_build_value(
|
||||
@@ -648,12 +715,13 @@ system_capabilities(xmlrpc_env * const envP,
|
||||
envP, XMLRPC_INDEX_ERROR,
|
||||
"There are no parameters. You supplied %u", paramCount);
|
||||
else
|
||||
getCapabilities(envP, registryP, &retvalP);
|
||||
constructCapabilities(envP, registryP, &retvalP);
|
||||
|
||||
return retvalP;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct systemMethodReg const methodCapabilities = {
|
||||
"system.capabilities",
|
||||
&system_capabilities,
|
||||
@@ -664,6 +732,72 @@ static struct systemMethodReg const methodCapabilities = {
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
system.getCapabilities
|
||||
=========================================================================*/
|
||||
|
||||
/* This implements a standard.
|
||||
See http://tech.groups.yahoo.com/group/xml-rpc/message/2897 .
|
||||
*/
|
||||
|
||||
static void
|
||||
listCapabilities(xmlrpc_env * const envP,
|
||||
xmlrpc_registry * const registryP ATTR_UNUSED,
|
||||
xmlrpc_value ** const capabilitiesPP) {
|
||||
|
||||
*capabilitiesPP =
|
||||
xmlrpc_build_value(
|
||||
envP, "{s:{s:s,s:i}}",
|
||||
"introspect",
|
||||
"specUrl",
|
||||
"http://xmlrpc-c.sourceforge.net/xmlrpc-c/introspection.html",
|
||||
"specVersion",
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static xmlrpc_value *
|
||||
system_getCapabilities(xmlrpc_env * const envP,
|
||||
xmlrpc_value * const paramArrayP,
|
||||
void * const serverInfo,
|
||||
void * const callInfo ATTR_UNUSED) {
|
||||
|
||||
xmlrpc_registry * const registryP = serverInfo;
|
||||
|
||||
xmlrpc_value * retvalP;
|
||||
|
||||
unsigned int paramCount;
|
||||
|
||||
XMLRPC_ASSERT_ENV_OK(envP);
|
||||
XMLRPC_ASSERT_VALUE_OK(paramArrayP);
|
||||
XMLRPC_ASSERT_PTR_OK(serverInfo);
|
||||
|
||||
paramCount = xmlrpc_array_size(envP, paramArrayP);
|
||||
|
||||
if (paramCount > 0)
|
||||
xmlrpc_env_set_fault_formatted(
|
||||
envP, XMLRPC_INDEX_ERROR,
|
||||
"There are no parameters. You supplied %u", paramCount);
|
||||
else
|
||||
listCapabilities(envP, registryP, &retvalP);
|
||||
|
||||
return retvalP;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct systemMethodReg const methodGetCapabilities = {
|
||||
"system.getCapabilities",
|
||||
&system_getCapabilities,
|
||||
"S:",
|
||||
"Return the list of standard capabilities of XML-RPC server. "
|
||||
"See http://tech.groups.yahoo.com/group/xml-rpc/message/2897"
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*============================================================================
|
||||
Installer of system methods
|
||||
============================================================================*/
|
||||
@@ -699,12 +833,15 @@ xmlrpc_installSystemMethods(xmlrpc_env * const envP,
|
||||
if (!envP->fault_occurred)
|
||||
registerSystemMethod(envP, registryP, methodListMethods);
|
||||
|
||||
if (!envP->fault_occurred)
|
||||
registerSystemMethod(envP, registryP, methodMethodSignature);
|
||||
if (!envP->fault_occurred)
|
||||
registerSystemMethod(envP, registryP, methodMethodExist);
|
||||
|
||||
if (!envP->fault_occurred)
|
||||
registerSystemMethod(envP, registryP, methodMethodHelp);
|
||||
|
||||
if (!envP->fault_occurred)
|
||||
registerSystemMethod(envP, registryP, methodMethodSignature);
|
||||
|
||||
if (!envP->fault_occurred)
|
||||
registerSystemMethod(envP, registryP, methodMulticall);
|
||||
|
||||
@@ -713,6 +850,9 @@ xmlrpc_installSystemMethods(xmlrpc_env * const envP,
|
||||
|
||||
if (!envP->fault_occurred)
|
||||
registerSystemMethod(envP, registryP, methodCapabilities);
|
||||
|
||||
if (!envP->fault_occurred)
|
||||
registerSystemMethod(envP, registryP, methodGetCapabilities);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user