mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
CPE requests for GetRPCMethods ACS after each successfule Inform
This commit is contained in:
parent
8e6bde511a
commit
f7c42eaba6
6 changed files with 82 additions and 26 deletions
6
cwmp.c
6
cwmp.c
|
|
@ -156,6 +156,10 @@ static int cwmp_schedule_rpc(struct cwmp *cwmp, struct session *session)
|
|||
while (1) {
|
||||
list_for_each (ilist, &(session->head_rpc_acs)) {
|
||||
rpc_acs = list_entry(ilist, struct rpc, list);
|
||||
if (rpc_acs_methods[rpc_acs->type].acs_support == RPC_ACS_NOT_SUPPORT) {
|
||||
CWMP_LOG(WARNING, "The RPC method %s is not included in the RPCs list supported by the ACS", rpc_acs_methods[rpc_acs->type].name);
|
||||
continue;
|
||||
}
|
||||
if (!rpc_acs->type || thread_end)
|
||||
goto retry;
|
||||
|
||||
|
|
@ -173,7 +177,7 @@ static int cwmp_schedule_rpc(struct cwmp *cwmp, struct session *session)
|
|||
CWMP_LOG(INFO, "Get the %sResponse message from the ACS", rpc_acs_methods[rpc_acs->type].name);
|
||||
/*
|
||||
* This condition is not always false.
|
||||
* while the value of idx can be changed to true in the exit of icwmp.
|
||||
* while the value of thread_end can be changed to true in the exit of icwmp.
|
||||
*/
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (rpc_acs_methods[rpc_acs->type].parse_response || thread_end)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ check_cwmp_status
|
|||
|
||||
[ -f funl-test-result.log ] && rm -f funl-test-result.log
|
||||
|
||||
sleep 10
|
||||
echo "## Running script verification of functionalities ##"
|
||||
echo > ./funl-test-result.log
|
||||
echo > ./funl-test-debug.log
|
||||
|
|
|
|||
|
|
@ -242,6 +242,12 @@ enum rpc_acs_methods_idx {
|
|||
__RPC_ACS_MAX
|
||||
};
|
||||
|
||||
enum acs_support_idx {
|
||||
NOT_KNOWN,
|
||||
RPC_ACS_SUPPORT,
|
||||
RPC_ACS_NOT_SUPPORT
|
||||
};
|
||||
|
||||
enum load_type { TYPE_DOWNLOAD = 0, TYPE_SCHEDULE_DOWNLOAD, TYPE_UPLOAD };
|
||||
|
||||
enum dustate_type { DU_INSTALL = 1, DU_UPDATE, DU_UNINSTALL };
|
||||
|
|
@ -329,6 +335,7 @@ struct rpc_acs_method {
|
|||
int (*prepare_message)(struct cwmp *cwmp, struct session *session, struct rpc *rpc);
|
||||
int (*parse_response)(struct cwmp *cwmp, struct session *session, struct rpc *rpc);
|
||||
int (*extra_clean)(struct session *session, struct rpc *rpc);
|
||||
int acs_support;
|
||||
};
|
||||
|
||||
typedef struct FAULT_CPE {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ extern char *boot_inform_parameters[MAX_NBRE_CUSTOM_INFORM];
|
|||
extern int nbre_custom_inform;
|
||||
extern int nbre_boot_inform;
|
||||
extern const struct rpc_cpe_method rpc_cpe_methods[__RPC_CPE_MAX];
|
||||
extern const struct rpc_acs_method rpc_acs_methods[__RPC_ACS_MAX];
|
||||
extern struct rpc_acs_method rpc_acs_methods[__RPC_ACS_MAX];
|
||||
|
||||
int cwmp_handle_rpc_cpe_get_rpc_methods(struct session *session, struct rpc *rpc);
|
||||
int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc *rpc);
|
||||
|
|
@ -47,6 +47,7 @@ int cwmp_handle_rpc_cpe_fault(struct session *session, struct rpc *rpc);
|
|||
|
||||
int cwmp_rpc_acs_prepare_message_inform(struct cwmp *cwmp, struct session *session, struct rpc *rpc);
|
||||
int cwmp_rpc_acs_parse_response_inform(struct cwmp *cwmp, struct session *session, struct rpc *rpc);
|
||||
int cwmp_rpc_acs_parse_response_get_rpc_methods(struct cwmp *cwmp, struct session *session, struct rpc *this);
|
||||
int cwmp_rpc_acs_prepare_get_rpc_methods(struct cwmp *cwmp, struct session *session, struct rpc *rpc);
|
||||
int cwmp_rpc_acs_prepare_transfer_complete(struct cwmp *cwmp, struct session *session, struct rpc *rpc);
|
||||
int cwmp_rpc_acs_prepare_du_state_change_complete(struct cwmp *cwmp, struct session *session, struct rpc *rpc);
|
||||
|
|
|
|||
74
rpc_soap.c
74
rpc_soap.c
|
|
@ -53,11 +53,10 @@ const struct rpc_cpe_method rpc_cpe_methods[] = { [RPC_CPE_GET_RPC_METHODS] = {
|
|||
[RPC_CPE_X_FACTORY_RESET_SOFT] = { "X_FactoryResetSoft", cwmp_handle_rpc_cpe_x_factory_reset_soft, AMD_1 },
|
||||
[RPC_CPE_FAULT] = { "Fault", cwmp_handle_rpc_cpe_fault, AMD_1 } };
|
||||
|
||||
const struct rpc_acs_method rpc_acs_methods[] = { [RPC_ACS_INFORM] = { "Inform", cwmp_rpc_acs_prepare_message_inform, cwmp_rpc_acs_parse_response_inform, cwmp_rpc_acs_destroy_data_inform },
|
||||
[RPC_ACS_GET_RPC_METHODS] = { "GetRPCMethods", cwmp_rpc_acs_prepare_get_rpc_methods, NULL, NULL },
|
||||
[RPC_ACS_TRANSFER_COMPLETE] = { "TransferComplete", cwmp_rpc_acs_prepare_transfer_complete, NULL, cwmp_rpc_acs_destroy_data_transfer_complete },
|
||||
[RPC_ACS_DU_STATE_CHANGE_COMPLETE] = { "DUStateChangeComplete", cwmp_rpc_acs_prepare_du_state_change_complete, NULL, cwmp_rpc_acs_destroy_data_du_state_change_complete }
|
||||
|
||||
struct rpc_acs_method rpc_acs_methods[] = { [RPC_ACS_INFORM] = { "Inform", cwmp_rpc_acs_prepare_message_inform, cwmp_rpc_acs_parse_response_inform, cwmp_rpc_acs_destroy_data_inform, NOT_KNOWN },
|
||||
[RPC_ACS_GET_RPC_METHODS] = { "GetRPCMethods", cwmp_rpc_acs_prepare_get_rpc_methods, cwmp_rpc_acs_parse_response_get_rpc_methods, NULL, NOT_KNOWN },
|
||||
[RPC_ACS_TRANSFER_COMPLETE] = { "TransferComplete", cwmp_rpc_acs_prepare_transfer_complete, NULL, cwmp_rpc_acs_destroy_data_transfer_complete, NOT_KNOWN },
|
||||
[RPC_ACS_DU_STATE_CHANGE_COMPLETE] = { "DUStateChangeComplete", cwmp_rpc_acs_prepare_du_state_change_complete, NULL, cwmp_rpc_acs_destroy_data_du_state_change_complete, NOT_KNOWN }
|
||||
};
|
||||
|
||||
char *custom_forced_inform_parameters[MAX_NBRE_CUSTOM_INFORM] = { 0 };
|
||||
|
|
@ -473,6 +472,52 @@ error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
int set_rpc_acs_to_supported(char *rpc_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=1; i < __RPC_ACS_MAX; i++) {
|
||||
if (strcmp(rpc_acs_methods[i].name, rpc_name) == 0) {
|
||||
rpc_acs_methods[i].acs_support = RPC_ACS_SUPPORT;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void set_not_known_acs_support()
|
||||
{
|
||||
int i;
|
||||
for (i=1; i < __RPC_ACS_MAX; i++) {
|
||||
if (rpc_acs_methods[i].acs_support == NOT_KNOWN)
|
||||
rpc_acs_methods[i].acs_support = RPC_ACS_NOT_SUPPORT;
|
||||
}
|
||||
}
|
||||
|
||||
int cwmp_rpc_acs_parse_response_get_rpc_methods(struct cwmp *cwmp __attribute__((unused)), struct session *session, struct rpc *this __attribute__((unused)))
|
||||
{
|
||||
mxml_node_t *tree, *b;
|
||||
tree = session->tree_in;
|
||||
b = mxmlFindElement(tree, tree, "cwmp:GetRPCMethodsResponse", NULL, NULL, MXML_DESCEND);
|
||||
if (!b)
|
||||
goto error;
|
||||
|
||||
while (b) {
|
||||
const char *node_opaque = mxmlGetOpaque(b);
|
||||
mxml_node_t *parent_node = mxmlGetParent(b);
|
||||
mxml_type_t node_type = mxmlGetType(b);
|
||||
|
||||
if (node_type == MXML_OPAQUE && mxmlGetType(parent_node) == MXML_ELEMENT && node_opaque && strcmp((char *) mxmlGetElement(parent_node), "string") == 0)
|
||||
set_rpc_acs_to_supported((char*)node_opaque);
|
||||
|
||||
b = mxmlWalkNext(b, session->body_in, MXML_DESCEND);
|
||||
}
|
||||
set_not_known_acs_support();
|
||||
return 0;
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cwmp_rpc_acs_destroy_data_inform(struct session *session __attribute__((unused)), struct rpc *rpc __attribute__((unused)))
|
||||
{
|
||||
//event_remove_all_event_container(session,RPC_SEND);
|
||||
|
|
@ -506,25 +551,6 @@ int cwmp_rpc_acs_prepare_get_rpc_methods(struct cwmp *cwmp, struct session *sess
|
|||
return 0;
|
||||
}
|
||||
|
||||
int cwmp_rpc_acs_parse_response_get_rpc_methods(struct session *session)
|
||||
{
|
||||
mxml_node_t *tree, *b;
|
||||
|
||||
tree = session->tree_in;
|
||||
if (!tree)
|
||||
goto error;
|
||||
b = mxmlFindElement(tree, tree, "MethodList", NULL, NULL, MXML_DESCEND);
|
||||
if (!b)
|
||||
goto error;
|
||||
b = mxmlWalkNext(b, tree, MXML_DESCEND_FIRST);
|
||||
if (!b || mxmlGetType(b) != MXML_OPAQUE || !mxmlGetOpaque(b))
|
||||
goto error;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* [RPC ACS]: TransferComplete
|
||||
*/
|
||||
|
|
|
|||
17
session.c
17
session.c
|
|
@ -105,6 +105,15 @@ struct session *cwmp_add_queue_session(struct cwmp *cwmp)
|
|||
INIT_LIST_HEAD(&(session->head_event_container));
|
||||
INIT_LIST_HEAD(&(session->head_rpc_acs));
|
||||
INIT_LIST_HEAD(&(session->head_rpc_cpe));
|
||||
|
||||
/*
|
||||
* Set Required methods as initial value of
|
||||
*/
|
||||
rpc_acs = cwmp_add_session_rpc_acs_head(session, RPC_ACS_GET_RPC_METHODS);
|
||||
if (rpc_acs == NULL) {
|
||||
FREE(session);
|
||||
return NULL;
|
||||
}
|
||||
rpc_acs = cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM);
|
||||
if (rpc_acs == NULL) {
|
||||
FREE(session);
|
||||
|
|
@ -164,12 +173,20 @@ int cwmp_move_session_to_session_queue(struct cwmp *cwmp, struct session *sessio
|
|||
if (session->head_rpc_acs.next != &(session->head_rpc_acs)) {
|
||||
rpc_acs = list_entry(session->head_rpc_acs.next, struct rpc, list);
|
||||
if (rpc_acs->type != RPC_ACS_INFORM) {
|
||||
if (cwmp_add_session_rpc_acs_head(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
|
||||
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
|
||||
return CWMP_MEM_ERR;
|
||||
}
|
||||
if (cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM) == NULL) {
|
||||
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
|
||||
return CWMP_MEM_ERR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cwmp_add_session_rpc_acs_head(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
|
||||
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
|
||||
return CWMP_MEM_ERR;
|
||||
}
|
||||
if (cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM) == NULL) {
|
||||
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
|
||||
return CWMP_MEM_ERR;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue