next up previous contents
Next: Designing Up: How to write Previous: New commands

Command data types

All commands have one input parameter and one output parameter. In theory parameter types can be any C type i.e. simple types or composite types represented by a structure. All parameters are passed by pointer. This is to ensure efficiency and homogeneity. Parameters have a sense of direction. For input parameters the memory required is allocated by the calling function (the rpc routine in the case of a remote client). For output parameters the memory occupied by the parameter has to be allocated by the command itself. This should be done in static storage so that the space is not deallocated on exiting the command. See the example for the dev_status() command for the AGPowerSupplyClass above.

All data types supported by the device servers require conversion routines for serialising and deserialising data from local format to network format ( XDR format). For this reason in practice only a subset of data types are supported. The list of supported types can be found in xdr_typelist.h and in the related _xdr.h files.

All basic C types and also variable arrays thereof exist. Programmers should try as much as possible to restrict themselves to only these types. This reduces the number of data types which have to be supported and makes it easier to interface device servers to other software packages. These basic types are -

Normally it is possible to format all command parameters into one of the above types. In the special cases where a new type is required the device server programmer should develop the XDR conversion routine and add it to the library of XDR routines.

When using variable length data types don't forget that network transfers are restricted to 8 kbytes for UDP/IP protocol exchanges. If it is necessary to transfer more data then use TCP/IP. The switching between the two protocols occurs on the client side.

Presently all known data type conversion routines are linked with every device server. This is not at all efficient and wastes quite a lot of memory. In the future (summer 1993) a scheme will be introduced where only the basic types will be linked with each server and/or client and any additional types will require including an include file which contains the type definitions.



next up previous contents
Next: Designing Up: How to write Previous: New commands



Andy Goetz
Tue Jan 28 13:58:13 MET 1997