static int
serveSnapShotXML (const void *cls,
	      		  const char *mime,
	      		  struct Session *session,
	      		  struct MHD_Connection *connection)
{
  int ret;
  //char *reply;
  struct MHD_Response *response;

/*  
  reply = malloc(MAXTEXTFILELENGTH);
  if (NULL == reply)
    return MHD_NO;  
  if ( !ReadTextFileIntoString(reply, "data/SnapShot.xml") )
    return MHD_NO;  
  // Just a trial to check something is changing on the page
  static int Count = 1;
  char *pString = malloc(MAXTEXTFILELENGTH);
  sprintf(pString, reply, Count++);
  free(reply);
  
  const char *pValue = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "Cmd");
  printf("Cmd = %s\n", pValue);
  */
  const char *pCmd = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "Cmd");
//  printf("Cmd = %s\n", pCmd);
  
  // The XML is filled up by the CommandDispatcher using a static string object.
  // Since this is a .c file, we cannot use class objects here, so we basically
  // extract a char point from it.
  const char *pString;   
// Dispatch the command
  CommandDispatcher(&pString, pCmd);
  //strcpy(pString, MASTER_NAME);
  //sprintf(pString, reply, String);
  //free(reply);
  
  //fprintf(stdout, "%s\n", pString);
    
  /* return static form */
  response = MHD_create_response_from_buffer (strlen (pString),
					      (void *) pString,
					      MHD_RESPMEM_PERSISTENT);				  
  if (NULL == response)
    return MHD_NO;
  add_session_cookie (session, response);
  MHD_add_response_header (response,
			   MHD_HTTP_HEADER_CONTENT_ENCODING,
			   mime);
  ret = MHD_queue_response (connection,
			    MHD_HTTP_OK,
			    response);
  MHD_destroy_response (response);
  return ret;
}
void PluginMain(PA_long32 selector, PA_PluginParameters params)
{
	try
	{
		CommandDispatcher(selector, params);
	}
	catch(...)
	{
		
	}
	
}
void PluginMain(PA_long32 selector, PA_PluginParameters params)
{
	try
	{
		PA_long32 pProcNum = selector;
		sLONG_PTR *pResult = (sLONG_PTR *)params->fResult;
		PackagePtr pParams = (PackagePtr)params->fParameters;

		CommandDispatcher(pProcNum, pResult, pParams); 
	}
	catch(...)
	{

	}
}
static int
serveMasterNameXML (const void *cls,
	      		  const char *mime,
	      		  struct Session *session,
	      		  struct MHD_Connection *connection)
{
  int ret;
  //char *reply;
  struct MHD_Response *response;
   
  const char *pCmd = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "Cmd");
  printf("Cmd = %s\n", pCmd);
  
  // The XML is filled up by the CommandDispatcher using a static string object.
  // Since this is a .c file, we cannot use class objects here, so we basically
  // extract a char point from it.
  const char *pString;   
  // Dispatch the command
  CommandDispatcher(&pString, pCmd);
  //strcpy(pString, MASTER_NAME);
  //sprintf(pString, reply, String);
  //free(reply);
  
  fprintf(stdout, "%s\n", pString);
  
  /* return static form */
  response = MHD_create_response_from_buffer (strlen (pString),
					      (void *) pString,
					      MHD_RESPMEM_PERSISTENT);				  
  if (NULL == response)
    return MHD_NO;
  add_session_cookie (session, response);
  MHD_add_response_header (response,
			   MHD_HTTP_HEADER_CONTENT_ENCODING,
			   mime);
  ret = MHD_queue_response (connection,
			    MHD_HTTP_OK,
			    response);
  MHD_destroy_response (response);
  return ret;
}