# HG changeset patch # User LordOfWar # Date 2009-10-07 12:26:45 # Node ID 9a81eb0cca5d01e19cbd9400201305908dfab629 # Parent 486997cdeade42dbc9b5d7833b3bae1fe58c19b8 created function used to create the xml file that contains the information the slaves will use to process their job diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -36,6 +36,11 @@ #include #include +#include +#include +#include +#include + /* ******************* Structs ************************ */ // Gets config info from confs @@ -463,6 +468,39 @@ int distrend_config_free(struct distrend return 0; } +/* ************************** XML Functions ************************* */ +int makeSlaveDataXML(struct distrenjob *job, char *height, char *width) +{ + xmlTextWriterPtr writer; + char *path_to_xml; + + _distren_asprintf(&path_to_xml, "stor/job%d/job_info.xml", job->jobnum); + + // create xml document at the location path_to_xml with no compression + writer = xmlNewTextWriterFilename(path_to_xml, 0); + xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL); + + // write resolution element and add its attributes + xmlTextWriterStartElement(writer, (xmlChar*)"distrenjob"); + xmlTextWriterWriteAttribute(writer, (xmlChar*)"name", (xmlChar*)job->name); + xmlTextWriterWriteAttribute(writer, (xmlChar*)"submitter", (xmlChar*)job->submitter); + xmlTextWriterWriteAttribute(writer, (xmlChar*)"priority", (xmlChar*)job->priority); + + // write resolution element and add its attributes + xmlTextWriterStartElement(writer, (xmlChar*)"resolution"); + xmlTextWriterWriteAttribute(writer, (xmlChar*)"width", (xmlChar*)height); + xmlTextWriterWriteAttribute(writer, (xmlChar*)"height", (xmlChar*)width); + xmlTextWriterEndElement(writer); + + // end document + xmlTextWriterEndDocument(writer); + + // free writer and save xml file to disk + xmlFreeTextWriter(writer); + + return 1; +} + /* ************************** Test Functions ************************* */ void printFrameInfo(struct frameset *frame) {