xfer Documentation

current-ready-b1014-r28564

xfer Server C-API
Author:
R.Huhmann
Synopsis
Primary goal of this API is to enable applications to exchange objects via data streams, e.g. sockets. For that we have to serialize and deserialize generic objects to and from text-data. The API is written in C and consists of a header xfer.h and the library libxfer. To get an overview see the "modules" page.

Description
The API defines a instance-type to contain the object data (void *) and the object class description called reflection. The reflection consists mainly of a list of element-descriptions of the class members, in case of complex member types, arrays or vectors this is again a list.

The tool xgencode generates class-reflections by a description file coded in XML (it generates Java classes as well to enable transfer between Java and C).

The instances are serialized with xf_instance_write() For deserialization you have to create a deserializer. The constructor (xf_new()) gets the file descriptor and a list of reflections of classes you expect. Whenever input is available on the file (or socket) you call xf_parse(), which returns an instance if input is complete for one object. The so created instance is created on the stack and has to be freed if not used any more.

The parsing routines use expat, a push-up stream parser (there is no DOM-Tree generated in memory, but the instances are filled during parsing in hook-functions, this is the fastest way)


Generated on 4 Mar 2014 for xfer by  doxygen 1.4.7