/*
 * servercommon.h
 * Interfaces to routines common to serel the serel server.
 *
 * Copyright (C) Leni Mayo 2002
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License, version 2, as
 *	published by the Free Software Foundation.
 *	
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *	
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#ifndef _SERVERCOMMON_H_
#define _SERVERCOMMON_H_

#include <stdio.h>
#include <glib.h>

typedef enum
{
	eXmlRdf   = 0,
	eXmlDc    = 1,
	eXmlGraph = 2,
	eXmlSerel = 3,
	eXmlNamespaceLast  = 4
} XmlNamespace;

typedef enum
{
	eRdfType,
	eGraphGraph,
	eGraphService,
	eGraphNodes,
	eGraphEdges,
	eGraphNode,
	eGraphEdge,
	eGraphFrom,              /* "sendmail depends on network" means an edge   */
	eGraphTo,                /* with props from: "network" and to: "sendmail" */
	eGraphWeight,
	eSerelMtime,
	eSerelSourceUri,         /* the origin of the service defintion (eg .rdf) */
	eSerelStartUri,          /* the uri thats being used to start the service */
	eSerelRootToLeafWeight,
	eSerelRankSlowest,
	eSerelOnSlowestPath,
	eSerelMarkDeleted,
	eSerelVisited,           /* used in traversals of graph */
	eSerelInventory,
	eSerelRuntime,
	eSerelLate,
	eSerelLast,
	eSerelParse,
	eRdfPropertyLast         /* Just an "end-of" marker */
} RdfProperty;

const char * rdfPropertyFragment(RdfProperty name);
const char * rdfPropertyNamespace(RdfProperty name);

const char *namespaceFromCode(XmlNamespace code);

const char *pszXmlVersionEncoding;

void print_rdf_header(FILE *fp);
void print_rdf_trailer(FILE *fp);

void stringsInListToFp(FILE *fp, GSList *pList);
char * newStringFromStringsInList(GSList *pList);

char * edgeFragmentFromPair(char buf[], int buflen, const char *pszFrom, const char *pszTo);

#endif /* _SERVERCOMMON_H_ */
