A method is disclosed that allows the concise implementation of one protocol encoding / decoding device for
syntax conversion between an abstract data
syntax and a transfer
syntax presented in an open-ended variety of input / output / storage mediums, including, but not limited to random-access memory, disk files, communications sockets, buffer lists, and other static or dynamically-extensible storage structures. The
abstract syntax is described using the
Abstract Syntax Notation One standard and presented in a higher-level object-oriented
programming language such as C++. The transfer syntax is specified by standardized encoding rules and results in a
stream of octets (unsigned 8-bit characters) suitable for communication transport using the
Open Systems Interconnection (OSI) protocol model. The result of encoding (which is also the input for decoding) is called a
protocol data unit (PDU). For different applications, it may be useful to present the PDU using various input / output or storage mediums such as listed above. The disclosed method employs a template function parameterized on an octet output
iterator interface to provide an ASN.1 encoding mechanism, and a corresponding template function parameterized on an octet input
iterator interface to provide an ASN.1 decoding mechanism, both independent of the medium in which the PDU is presented.