Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Internet Protocols Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

2.3 Architecture

This section describes the architecture that is common to the six packages in the Internet Protocols Module. For protocol-specific architectural information, see the chapters on the FTP, HTTP, MIME, POP3, and SMTP packages.

The FTP, HTTP, POP3, and SMTP packages are represented by their own agent and client classes. Each client class allows low-level access to and encapsulates the details of the protocol. Each agent class uses its respective client class to perform common protocol requests.

Figure 1: The protocol agent concept

2.3.1 Reference-counting and the Handle-Body Implementation

This software uses reference-counting and the handle-body (interface-implementation) idiom, which decouples the interface from its implementation. These techniques simplify memory management, allow efficient body object sharing, and provide automatic object life-cycle control.

The handle class is an interface to an internal object representation or body. The operations included in an internal representation are accessed by calling member functions supplied by the handle class. These functions forward control to the corresponding function in the body class instance. For example, an RWFtpAgent object is a handle to an RWFtpAgentImp instance that performs the protocol interaction.

Figure 2 shows the architecture of RWFtpAgent and its related class. RWPop3Agent and RWSmtpAgent use the same design.

Figure 2: The architecture of RWFtpAgent and its related class

Similarly, the RWFtpClient object is a handle to an RWFtpClientImp instance that performs the protocol interaction. Figure 3 shows the relationship between R-WFtpClient and its related class RWFtpClientImp. The other client classes—RWHttpClient, RWPop3Client, and RWSmtpClient—use the same design.

Figure 3: The relationship between RWFtpClient and its related class

Reference-counting allows multiple handles to refer to the same underlying body object. A handle instance is created by binding to a body instance, located on the heap. When a handle-body binding occurs, the reference counter is incremented. When a handle is detached from its body, the body's reference counter is decremented. When all the handles that refer to a particular body object have gone out of scope, the body object's destructor is invoked and the body object is deleted from the heap.

2.3.2 Protocol Command Sequence

Agent and client classes are based largely on the Internet service that they provide. Like most network protocols, only the expected command sequence is permitted. The agent and client classes enforce these command sequences by using internal finite state machines. If a protocol command method is used out of order, an exception is thrown.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.