static void setHandler(xmlrpc_env * const envP, TServer * const srvP, struct uriHandlerXmlrpc * const uriHandlerXmlrpcP, size_t const xmlProcessorMaxStackSize) { abyss_bool success; xmlrpc_abyss_handler_trace( getenv("XMLRPC_TRACE_ABYSS")); { size_t const stackSize = xmlrpc_abyss_handler_stacksize() + xmlProcessorMaxStackSize; struct ServerReqHandler3 const handlerDesc = { /* .term = */ &xmlrpc_termUriHandler, /* .handleReq = */ &xmlrpc_handleIfXmlrpcReq, /* .userdata = */ uriHandlerXmlrpcP, /* .handleReqStackSize = */ stackSize }; ServerAddHandler3(srvP, &handlerDesc, &success); } if (!success) xmlrpc_faultf(envP, "Abyss failed to register the Xmlrpc-c request " "handler. ServerAddHandler3() failed."); }
/************************************** * XmlRpcServer * Constructor **************************************/ XmlRpcServer::XmlRpcServer(int port) { char name[65]; //Iniciamos la fecha DateInit(); //Los mime tipes MIMETypeInit(); //Le pasamos como nombre un puntero a nosotros mismos sprintf(name,"%p",this); //Creamos el servidor ServerCreate(&srv,name, port, DEFAULT_DOCS, "http.log"); //Iniciamos el servidor ServerInit(&srv); //Set the handler abyss_bool ret; //Create abyss handler ServerReqHandler3 abbysHndlr; //Set abbysHndlr.userdata = (void*)this; abbysHndlr.handleReq = RequestHandler; abbysHndlr.term = NULL; abbysHndlr.handleReqStackSize = 0; //Add handler ServerAddHandler3(&srv,&abbysHndlr,&ret); }
void AbyssServer::addRequestHandler(ReqHandler * const handlerP) { ServerReqHandler3 cReqHandler; cReqHandler.handleReq = cHandleRequest; cReqHandler.userdata = handlerP; cReqHandler.handleReqStackSize = handlerP->handleReqStackSize(); cReqHandler.term = cTermHandler; abyss_bool success; ServerAddHandler3(&this->cServer, &cReqHandler, &success); if (!success) throwf("ServerAddHandler3() failed"); }