{ 
processCibRequest(xmlNodePtr command){    // sanity check    if(command == NULL)    {	cl_log(LOG_INFO, "The (%s) received an empty message", "cib");	return NULL;    }    else if(strcmp(XML_REQ_TAG_CIB, command->name) != 0)    {	cl_log(LOG_INFO, "The (%s) received an invalid message of type (%s)", "cib", command->name);	return NULL;    }    const char *status    = "failed";    xmlNodePtr data       = NULL;    xmlNodePtr failed     = xmlNewNode(NULL, XML_TAG_FAILED);    const char *op        = xmlGetProp(command, XML_CIB_ATTR_OP);    const char *verbose   = xmlGetProp(command, XML_ATTR_VERBOSE);    const char *section   = xmlGetProp(command, XML_CIB_ATTR_SECTION);    const char *reference = xmlGetProp(command, XML_MSG_ATTR_REFERENCE);        gboolean update_the_cib = FALSE;    int cib_update_operation = CIB_OP_NONE;    if(strcmp("noop", op) == 0) ;    else if(strcmp("ping", op) == 0)    {	CRM_DEBUG("Handling a ping");	status = "ok";    }    else if(strcmp("query", op) == 0)    {	CRM_DEBUG2("Handling a query for section=%s of the cib", section);	if(section != NULL && strcmp("all", section) == 0)	{	    data = theCib();	}	else	    data = getCibSection(section);	if(data != NULL) status = "ok";    }    else if(strcmp("add", op) == 0)    {      update_the_cib = TRUE;      cib_update_operation = CIB_OP_ADD;    }    else if(strcmp("update", op) == 0)    {      update_the_cib = TRUE;      cib_update_operation = CIB_OP_MODIFY;    }    else if(strcmp("delete", op) == 0)    {      update_the_cib = TRUE;      cib_update_operation = CIB_OP_DELETE;    }    else if(strcmp("replace", op) == 0)    {	CRM_DEBUG2("Replacing section=%s of the cib", section);	if(strcmp("all", section) == 0)	{	    xmlNodePtr new_cib = findNode(command, XML_TAG_CIB);	    if(activateCibXml(new_cib) < 0)		status = "new activation failed";	    else		status = "ok";	}	else	{	    xmlNodePtr new_section = findNode(command, XML_TAG_CIB);	    new_section = findNode(new_section, section);	    if(new_section != NULL)	    {		// make changes to a temp copy then activate		xmlNodePtr tmpCib = xmlLinkedCopyNoSiblings(theCib(), 1);		xmlNodePtr old_section = findNode(tmpCib, section);		xmlReplaceNode(old_section, new_section);		status = "ok";		if(activateCibXml(tmpCib) < 0)		    status = "update activation failed";			    }	    else	    {		status = "section replacement failed";	    }	}    }    else	status = "not supported";    if(update_the_cib)    {	cl_log(LOG_DEBUG, "Updating section=%s of the cib (op=%s)", section, op);	if(strcmp("all", section) == 0)	{	    // should we be doing this?	    // do logging	    // make changes to a temp copy then activate	    xmlNodePtr tmpCib = xmlLinkedCopyNoSiblings(theCib(), 1);	    if(cib_update_operation == CIB_OP_ADD || cib_update_operation == CIB_OP_MODIFY)	    {		updateList(tmpCib, command, failed, cib_update_operation, "nodes");		updateList(tmpCib, command, failed, cib_update_operation, "resources");		updateList(tmpCib, command, failed, cib_update_operation, "constraints");		updateList(tmpCib, command, failed, cib_update_operation, "status");	    }	    else // delete	    {		updateList(tmpCib, command, failed, cib_update_operation, "status");		updateList(tmpCib, command, failed, cib_update_operation, "constraints");		updateList(tmpCib, command, failed, cib_update_operation, "resources");		updateList(tmpCib, command, failed, cib_update_operation, "nodes");	    }	}	else	{	    // make changes to a temp copy then activate	    xmlNodePtr tmpCib = xmlLinkedCopyNoSiblings(theCib(), 1);	    updateList(tmpCib, command, failed, cib_update_operation, section);	    if(activateCibXml(tmpCib) < 0)		status = "update activation failed";	    else if(failed->children != NULL)	    {		status = "some updates failed";		data = getCibSection(section);	    }	    else		status = "ok";	}    }//    if(data != NULL) status = "ok";    CRM_DEBUG("Checking for verbosity");    if(verbose != NULL && strcmp("true", verbose) == 0)    {	if(section != NULL || strcmp("all", section) == 0)	    data = theCib();	else	    data = getCibSection(section);    }        CRM_DEBUG("Creating CIB answer");    CRM_DEBUG2("Creating CIB answer for op=%s", op);    xmlNodePtr cib_answer = createCibAnswer(reference,					    op, section,					    status, verbose,					    data, failed);    return cib_answer;}
8182	/local/tlutelli/issta_data/temp/c/2005_temp/2005/8182/ea49e927cf7a87359e44d087341624427b4dacc8/cibmessages.c/clean/crm/cib/cibmessages.c