WestSees, issue 5, July 2001:
A Generic Accounting Framework

Issue 5
July 2001
by Arthur de Jong

Arthur de Jong is a software engineer at West Consulting. He has a degree in computer science from Delft University of Technology.

Accounting is the act of collecting and transporting information on resource usage of electronic services. Accounting information is transported to an accounting server that processes the information for billing purposes.

There is an enormous growth in the use and availability of electronic services and in the demand that this places on processing of usage information. An increasing number of organisations are involved in the delivery of a single service to a customer. This places demands in terms of a common format in the exchange of accounting information.
Because agreeing on a common format for the exchange of all accounting information between different organisations for different classes of services is problematic, there is a need for a generic method for exchanging accounting information.



Accounting addresses the collecting of information on resource usage of supplied electronic services for the purpose of capacity and trend analysis, cost allocation, auditing and billing.
When offering a service it is important to know how the resources that are needed for the service are used on a per-user basis. This information is generally needed to prepare bills for customers but also necessary for planning purposes. If there is a need to track user access and to audit service usage it is also important to have good information. Accounting can also be used to internally distribute costs of a shared resource or facility. These different applications of accounting data put different requirements on the accounting process.

Services are provided by service elements. Examples of service elements are Network Access Servers (dail-in boxes), voice and fax gateways, but also web servers and routers provide services that produce usage data. The service elements produce service dependant information on the usage of the provided service. An accounting solution could be used for transport and processing of this data. Accounting information would generally contain some reference to the client who uses the service and a measure of the different resources that were used in providing the service.

Each service provided by a service element to a client constitutes a session, with the beginning of the session defined as the point where service is first provided and the end of the session defined as the point where service ended. An example of this would be the use of a dial-in connection where the session would begin when the user dials in and end when the user hangs up.

Accounting Server

Accounting data that is produced in service elements will need to be transported to an accounting server for storage and processing. The accounting server can generate billing information or forward the data to a specific billing solution.

The accounting data is transported in accounting messages using an accounting protocol. The accounting protocol defines the format and type of messages that can be sent back and forth between service element and accounting server.

Accounting Protocols

For the transport of accounting data a lot of protocols are available. Almost every basic service has its own protocol. For some common services several protocols are available. These protocols are rarely compatible with each other and are mostly only usable for one particular service.

Generic Accounting Framework

To be able to use the different available accounting protocols and to provide a solution where future protocols can be easily integrated, a generic accounting framework has been designed. The framework provides the application with the services of a generic accounting protocol. Different accounting protocols can be integrated into the framework and can be used concurrently.

Accounting protocols are generally divided in a transport protocol, a record format and a collection of messages. The transport protocol defines the way the messages are sent across the network. Examples of transport protocols are TCP, HTTP, SNMP, etc. The record format defines the way the messages are coded into bits. ASCII, ASN.1 with BER, MIME and XML are examples of record formats. Aside from the formatting and transport of the messages an accounting protocol defines which messages and in what order these messages are interchanged between the different network elements.

An accounting message consists of a message type and a collection of attributes. These attributes contain the actual accounting information that is transferred and the message type specifies the kind of message. Messages can be transfers of accounting information (accounting request), confirmation of received accounting information (accounting reply), requests to send accounting data (accounting poll) or indications that accounting data is ready to be sent (accounting indication).

The clear decomposition of an accounting protocol into a transport protocol, a record format and a collection of messages provides a way to combine different parts of different protocols so that a protocol solution can be chosen to meet specific requirements.

Not all existing accounting protocols support sending of all types of messages as described above and some protocols do not make a clear distinction between record format and transport protocol. If the protocol fits the above model, integration into the framework is straightforward. Otherwise the protocol may require more effort to integrate into the framework. If e.g. not all message types are supported by the protocol, the protocol can still be used, except for the functionality requiring those message types.

Framework Design

The design of the framework is based on the separation of transport, record format and exchange of messages. At the base of the design is the AAAUnit which combines transport protocol and record format into a generic structure for sending and receiving accounting messages.


Outgoing messages are encoded with a given record format and sent out with a transport protocol. If no explicit format or protocol is specified a default will be used. Record formats and transport protocols will have to be registered with the AAAUnit before they can be used.
Incoming connections with streams of messages or single messages received by a transport protocol will be decoded by the AAAUnit by finding the correct record format. After decoding the message will be passed to a registered message handler. All registered handlers will be tried in order until a message handler indicates the message was handled.

The AAAUnit provides a generic method of exchanging messages. To use the unit in an accounting environment structures for sending and handling of incoming messages need to be defined.
For this purpose an AccountingSender and an AccountingHandler are defined.

An AccountingSender receives accounting information from the calling application and translates this in necessary accounting messages. The messages sent (accounting request, accounting indication) depend upon the chosen model for sending. The AccountingHandler also handles incoming polling requests, incoming replies to previously transmitted accounting information; it also has a fail over mechanism with which other accounting servers can be reached.

The AccountingHandler handles incoming accounting messages and generates appropriate replies. The AccountingHandler can also poll a list of clients with a regular interval. Incoming accounting indication messages are handled by polling the sending host within a certain interval.

The AccountingSender in combination with the AAAUnit can be used on a service element to provide the accounting functionality needed to transport accounting information to an accounting server. The AccountingHandler in combination with the AAAUnit can be used to process incoming accounting information on an accounting server.


The described framework has been implemented in Java and tested in a simulated environment. A number of protocols have been implemented mainly for testing purposes.
With the design and implementation of the generic accounting framework it is possible to provide accounting functionality to service elements and accounting servers in an extensible way. Accounting protocols can be added dynamically without changing the framework and functionality can be easily modified and extended.

The AAAUnit of the framework can also be used in other message exchanging environments like authentication and authorisation.
The framework can also be used as a translating proxy between different accounting systems that use different accounting protocols.

The defined generic accounting framework provides an accounting solution that is independent of the underlying accounting protocol.


This project was part of the graduation project of Arthur de Jong at the Delft University of Technology carried out at West Consulting B.V.
More information on this project can be found at http://www.west.nl/project/aaa/ (primarily in Dutch).

Copyright © 2001 West Consulting BV. All rights reserved

Arthur <arthur@ch.twi.tudelft.nl> http://ch.twi.tudelft.nl/~arthur/