mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Added debug log
This commit is contained in:
parent
0d23ef70af
commit
468b6803cd
2 changed files with 44 additions and 23 deletions
|
|
@ -66,7 +66,8 @@ function print_tag_value()
|
||||||
{
|
{
|
||||||
rpc_method=$1
|
rpc_method=$1
|
||||||
tag=$2
|
tag=$2
|
||||||
xml_data=`awk -v start="<"$rpc_method">" -v end="</"$rpc_method">" '$0~start,$1~end' $icwmp_log_file`
|
output=$(sed -n "/<"$rpc_method">/,/<\/"$rpc_method">/p" $icwmp_log_file)
|
||||||
|
xml_data=$(echo $output | grep -o "<"$rpc_method">.*<\/"$rpc_method">")
|
||||||
tag_value=`grep -oPm1 "(?<=<$tag>)[^<]+" <<< "$xml_data"`
|
tag_value=`grep -oPm1 "(?<=<$tag>)[^<]+" <<< "$xml_data"`
|
||||||
echo $tag_value
|
echo $tag_value
|
||||||
}
|
}
|
||||||
|
|
|
||||||
64
xml.c
64
xml.c
|
|
@ -149,14 +149,14 @@ int xml_send_message(struct cwmp *cwmp, struct session *session, struct rpc *rpc
|
||||||
if (session->tree_out) {
|
if (session->tree_out) {
|
||||||
CWMP_LOG(INFO, "#### %s line: %d ####", __FUNCTION__, __LINE__);
|
CWMP_LOG(INFO, "#### %s line: %d ####", __FUNCTION__, __LINE__);
|
||||||
unsigned char *zmsg_out;
|
unsigned char *zmsg_out;
|
||||||
msg_out = mxmlSaveAllocString(session->tree_out, whitespace_cb);
|
msg_out = mxmlSaveAllocString(session->tree_out, MXML_NO_CALLBACK);
|
||||||
if (msg_out == NULL) {
|
if (msg_out == NULL) {
|
||||||
CWMP_LOG(ERROR, "Received tree_out is empty");
|
CWMP_LOG(ERROR, "Received tree_out is empty");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWMP_LOG(INFO, "#### %s line: %d ####", __FUNCTION__, __LINE__);
|
|
||||||
CWMP_LOG_XML_MSG(DEBUG, msg_out, XML_MSG_OUT);
|
CWMP_LOG_XML_MSG(DEBUG, msg_out, XML_MSG_OUT);
|
||||||
|
CWMP_LOG(INFO, "#### %s line: %d ####", __FUNCTION__, __LINE__);
|
||||||
if (compression != COMP_NONE) {
|
if (compression != COMP_NONE) {
|
||||||
CWMP_LOG(INFO, "#### %s line: %d ####", __FUNCTION__, __LINE__);
|
CWMP_LOG(INFO, "#### %s line: %d ####", __FUNCTION__, __LINE__);
|
||||||
if (zlib_compress(msg_out, &zmsg_out, &msg_out_len, compression)) {
|
if (zlib_compress(msg_out, &zmsg_out, &msg_out_len, compression)) {
|
||||||
|
|
@ -318,6 +318,7 @@ int xml_set_cwmp_id_rpc_cpe(struct session *session)
|
||||||
|
|
||||||
const char *get_node_tab_space(mxml_node_t *node)
|
const char *get_node_tab_space(mxml_node_t *node)
|
||||||
{
|
{
|
||||||
|
CWMP_LOG(INFO, "#### %s start %d ####", __FUNCTION__, __LINE__);
|
||||||
static char tab_space[10 * sizeof(CWMP_MXML_TAB_SPACE) + 1];
|
static char tab_space[10 * sizeof(CWMP_MXML_TAB_SPACE) + 1];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
|
@ -330,33 +331,52 @@ const char *get_node_tab_space(mxml_node_t *node)
|
||||||
snprintf(tab_space, sizeof(tab_space), "%*s", (int)(count * sizeof(CWMP_MXML_TAB_SPACE)), "");
|
snprintf(tab_space, sizeof(tab_space), "%*s", (int)(count * sizeof(CWMP_MXML_TAB_SPACE)), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d count %d ####", __FUNCTION__, __LINE__, count);
|
||||||
return tab_space;
|
return tab_space;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *whitespace_cb(mxml_node_t *node, int where __attribute__((unused)))
|
const char *whitespace_cb(mxml_node_t *node, int where)
|
||||||
{
|
{
|
||||||
if (mxmlGetType(node) != MXML_ELEMENT)
|
CWMP_LOG(INFO, "#### %s start ####", __FUNCTION__);
|
||||||
return NULL;
|
if (node == NULL) {
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
switch (where) {
|
|
||||||
case MXML_WS_BEFORE_CLOSE:
|
|
||||||
if (mxmlGetFirstChild(node) && mxmlGetType(mxmlGetFirstChild(node)) != MXML_ELEMENT)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return get_node_tab_space(node);
|
|
||||||
case MXML_WS_BEFORE_OPEN:
|
|
||||||
if (where == MXML_WS_BEFORE_CLOSE && mxmlGetFirstChild(node) && mxmlGetType(mxmlGetFirstChild(node)) != MXML_ELEMENT)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return get_node_tab_space(node);
|
|
||||||
case MXML_WS_AFTER_OPEN:
|
|
||||||
return ((mxmlGetFirstChild(node) == NULL || mxmlGetType(mxmlGetFirstChild(node)) == MXML_ELEMENT) ? "\n" : NULL);
|
|
||||||
case MXML_WS_AFTER_CLOSE:
|
|
||||||
return "\n";
|
|
||||||
default:
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mxmlGetType(node) != MXML_ELEMENT) {
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (where) {
|
||||||
|
case MXML_WS_BEFORE_CLOSE:
|
||||||
|
if (mxmlGetFirstChild(node) && mxmlGetType(mxmlGetFirstChild(node)) != MXML_ELEMENT) {
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
|
return get_node_tab_space(node);
|
||||||
|
case MXML_WS_BEFORE_OPEN:
|
||||||
|
if (where == MXML_WS_BEFORE_CLOSE && mxmlGetFirstChild(node) && mxmlGetType(mxmlGetFirstChild(node)) != MXML_ELEMENT) {
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
|
return get_node_tab_space(node);
|
||||||
|
case MXML_WS_AFTER_OPEN:
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
|
return ((mxmlGetFirstChild(node) == NULL || mxmlGetType(mxmlGetFirstChild(node)) == MXML_ELEMENT) ? "\n" : NULL);
|
||||||
|
case MXML_WS_AFTER_CLOSE:
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
|
return "\n";
|
||||||
|
default:
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CWMP_LOG(INFO, "#### %s exit %d ####", __FUNCTION__, __LINE__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue