Process Registry

Process registry defines a group of procedures that allow defined processes to record, access, and share information in a model-wide (or global) registry. There is only one process registry per simulation model. Any process can register itself in this global “process registry”; likewise, any process can obtain available information from the set of “registered” processes.

The functions available for using the process registry mechanism are listed below. Detailed descriptions of these functions are provided in a following section.

Table 21: Process Registry Functions

Entry functions Query functions
oms_pr_process_register () oms_pr_process_discover ()
oms_pr_attr_set () oms_pr_attr_get ()

Required Attributes

The process registry mechanism requires a process to specify certain vital attributes (or descriptors) at the time of the process registration. These are called the required attributes for a process registering itself in the process registry. Other attributes may be published for a process after it is registered in the process registry.

Table 22: Required Attributes for Process Registration

Descriptor Data type Description
node objid Objid Object identifier of the node surrounding the registering process
module objid Objid Object identifier of the module surrounding the registering process
process handle Prohandle Process handle to uniquely identify the registering process
process name char Name with which the registering process wants to register itself

Additional Attributes

The process registry mechanism allows registered processes to publish (i.e., add) or expect (i.e., query) attributes of the following types.

Table 23: Additional Attribute Types for Process Registration

Symbolic constant Data type Description
OMSC_PR_OBJID Objid Object identifier of an object
OMSC_PR_STRING char * Character string
OMSC_PR_NUMBER double Double
OMSC_PR_STRINGLIST List * String list
OMSC_PR_PROHANDLE Prohandle Process handle of a process
OMSC_PR_POINTER Vartype * Memory address (also available by the old name OMSC_PR_ADDRESS)
OMSC_PR_INT32 OpT_Int32 32-bit integer address
OMSC_PR_INT64 OpT_Int64 64-bit integer address
OMSC_PR_INVALID n/a Unknown type

Process Registration

An important feature of the process registry mechanism is that any number of defined processes can register themselves in a global (i.e., model-wide) process registry. The processes register themselves with the required attributes only once during simulation (typically upon creation); however, additional attributes/descriptors may be added, whenever required.

The registration process returns a special handle, called a process registry handle, for subsequent access (i.e., to publish or query) attributes for this process.

The following code fragment describes the declaration of the process registry attributes, and the process registry registration procedure, respectively:

Figure 17: Declaring and Registering Process Registry Attributes

声明与注册进程注册表属性

Attribute Publication

To register additional attributes/descriptors, a process requires the use of the process registry handle obtained when the process was initially registered. The format for publishing the attributes uses the following triplet:

<name> - <type> - <value>

where <name> denotes the name of the attribute to be published, <type> denotes the attribute type (see Additional Attributes), <value> denotes the assigned value for the attribute.

The attribute <name> is created if it does not already exist. If it does exist, it is modified to have the new <type>, <value>, or both.

The following code fragment describes the registration of two additional attributes using the process registry handle.

Figure 18: Registering Two Additional Code Attributes

使用进程注册表句柄注册两个附加属性

Process Discovery

When a process wants to query the process registry to obtain information on specific processes of interest, it first needs to obtain handles for the processes matching specified attribute values.

The process of obtaining the matching process registry record handle(s) from the model-wide process registry is called process discovery. A registered process is considered to match a query if and only if it has attributes that match all of the attributes specified in the query. In other words, these attributes must exist and have the same “name-type-value” triplet. A query returns a list of matching processes because many processes can have matching attributes.

Once a process’ process record handle is available from the process registry, all the registered information for the process can be obtained. The registered information contains the following:

  • required attributes (e.g., node objid, module objid, process handle, or process name)
  • additional attributes (e.g., node address, protocol name, handle to the routing table, etc.)

The following example attempts to discover processes within the same node with a specific protocol name.

Figure 19: Discovering Processes of the Same Protocol in the Same Node

在同一节点中发现相同协议的进程

The querying process is responsible for managing the memory used to store the returned process record list.

Attribute Querying

A process may require information published by another process to carry out its operations (e.g., obtain a handle to a routing table to do routing functions). A process querying the attribute may also set it using the procedure described in Attribute Publication.

The following example shows a scenario where a process obtains attribute values from an already discovered process registry process handle (type OmsT_Pr_Handle):

Figure 20: Getting Attribute Values from a Discovered Process Registry Handle

从已发现的进程注册表句柄获取属性值

Using Process Registry

As mentioned before, the process registry mechanism will be useful in any scenario involved in sharing information without carrying out any explicit communication between processes. Its usage can be found in almost all of the standard models (such as ATM, Ethernet, FDDI, Frame Relay, IP, and RIP).

For example, the IP address resolution process (ip2_arp) uses process registry to obtain a pointer to the IP interface table and a handle to the global IP address table from the IP layer. It also obtains the physical network address from the lower MAC layer.

Required Files

A process model using the process registry procedures should reference these two files using the steps outlined in Required Files.

Table 24: Process Registry Files

Name Description
oms_pr.h Contains data type definitions and symbolic constants used in the process registry mechanism.
oms_pr.ex.c Contains definitions for the process registry functions/ procedures.

Process Registry Functions

The functions that implement the process registry (oms_pr) operations are described in the following sections.

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com