[Opendax-devel] Codebase Descriptions
Phil Birkelbach
phil at petrasoft.net
Tue May 19 16:56:42 CDT 2009
Codebase Description
The OpenDAX Codebase includes three main products. The first is the
OpenDAX server itself. The source code for the server is located in
the /dax directory of the distribution.
The second major piece of code is the library. The library is used by
module developers to communicate to the OpenDAX server. The source
for the library is in the /lib directory of the distribution.
The last piece of code is actually many different programs. They are
the modules and the soruce code for the modules is located in the /
modules directory of the distribution.
OpenDAX uses autoconf as a configuration tool. I am not very familiar
with how to use autoconf efficiently and I am sure that a seasoned
user would laugh at much of what I have done. For now it seems to
work. If you download the distribution tarball you should be able to
simply './configure & make & make install' to get it to work. If you
got the code from the SVN repository then you will probably have to
run ./bootstrap.sh which is a shell script that will bootstrap the
autoconf/automake/libtool files.
Now on to the codebase descriptions...
/config.h
This file is generated by ./configure and contains the architecture
dependent #defines that tell us things like what functions are
available and what header files we need to install. I'm actually
checking for quite a few functions that I don't really do anthing
about if they are missing. As incompatibilities come up these will
have to be dealt with.
/common.h
This header includes config.h as well as some other headers that are
popular. It also has some definitions and macros that will be used
throughout the system. This file should be included in just about
every source code file in the system.
/opendax.h
This is the header that describes the public interface to the OpenDAX
library. It contains declarations for all of the public library
functions as well as the precompiler definitions for the datatypes,
error codes, configuration flags etc. This file should be included by
all modules that will link to the library, and is included in most of
the source code files in the rest of the system too. This should be
the only header file from this distribution that would need to be
included in any module code. If there are others then we did
something wrong in the interface.
/dax
The dax directory contains the source for the OpenDAX server.
/dax/daxtypes.h
This contains the private type definitions that are used internally by
the server. These definitions should not be used by any module or the
library.
/dax/libcommon.h
This file contains type definitions that are common between the
library and the server. It should be included in the server and the
libary source.
/dax/func.c
Contains a few generic functions for common operations like memory
allocation and such.
/dax/module.c
Contains the code for the module handling system in the server.
Operations such as starting and stopping modules as well as module
registration and any other operation that involves modules should be
in this file. The module.h header contains the public interface
definitions for the functions in this file.
/dax/message.c
This file contains the functions that handle the module<->server
messaging. Very little actual work gets done here other than sending
and receiving data on the sockets and determining which functions in
other files should be called.
/dax/buffer.c
Contains buffering code for the messaging subsystem. The messaging
system writes the data from each socket into these buffers until it
figures out that it has an entire message from one of the modules then
it calls the function to deal with that message.
/dax/options.c
Contains the code for reading the configuraiton from the configuration
file and the command line.
/dax/opendax.c
Contains main() and the other functions necessary to start the server
and spawn the threads that do all the work. It all starts here.
/dax/tagbase.c
The storage and maipulation of all the real time tag information is
contained within this file. For now the custom datatype handling code
is also in here but this may get moved to it's own file.
/lib
The lib directory contains the source for the library. We use libtool
to sort out the compatability issues associated with the way different
systems handle shared libraries. If no shared libary system will work
then libtool makes this a static library.
/lib/libdax.h
This header file contains all of the private definitions, macros and
declarations that are needed throughout the library code but are not
needed in the server or the modules.
/lib/libfunc.c
Contains some generic functions that are useful throughout.
/lib/libmsg.c
This is all the messaging code for the library. There are functions
in this file for sending and retrieving messages and determining what
to do with them. The functions here closely resemble functions in /
dax/message.c and typically changes in one of thse files requires
changes in the other. Between the two of them they define the
communications protocol.
/lib/data.c
This file deals with library side of the tag data. It is probably not
named well and may change. The functions here resemble functions that
are in /dax/tagname.c
/lib/libconv.c
This file contains the functions for making sure that the data
formatting is the same as the server. The way that OpenDAX handles
different byte ordering and data formating between architectures over
the networkis that the server stores the data in whatever way the
server wants and the library is responsible for determining if the
data needs to be converted and how. This file contains the code for
that.
/lib/libcdt.c
OpenDAX allows the creation of custom datatypes. This file contains
the code to handle all of that.
/lib/libopt.c
Contains the functions for configuring the module. The entire
configuration system of OpenDAX uses Lua as the configuration
programming language. The modules can be configured by either the
main opendax.conf file, their own configuration file, the command line
or any combination of the above. There are also some configuration
options that are common between modules. This file contains the code
to handle all of that.
/modules
This directory contains the module code. We will not discuss the
module details here.
/etc
The sample configuration files are located here.
More information about the Opendax-devel
mailing list