HP-UX IPQoS A.01.00 Programmer's Guide (October 2005)

Using the HP-UX IPQoS API
Using Sessions
Chapter 222
Using Sessions
Every application that uses the HP-UX IPQoS API must use the context of a session. The
session-related functions that are part of the API include functions to initiate and set the type
of session, get the session type and terminate the session. Once in a session, the application
can: configure HP-UX IPQoS filters and policies, read the current HP-UX IPQoS
configuration, or obtain HP-UX IPQoS statistics.
Starting a Session
Every application that uses the HP-UX IPQoS API must start a session by calling the
function:
uint32_t IpqosInitSession(uint32_t version,char * configName,IpqosSessionType sessionType)
The arguments can be described as follows:
version: the version ID of the HP-UX IPQoS API (this is a #defined constant in the
HP-UX IPQoS header file, in this release it is IPQOS_API_VERSION_ID_1). The version ID
scheme allows for the detection of API-application mismatch.
configName: specify NULL (this argument is for future enhancements and is currently
unused).
sessionType: specify the type of session being started. Permitted session types are:
IPQOS_SESSION_CONFIG, IPQOS_SESSION_READ, IPQOS_SESSION_STATS.
A return value of IPQOS_S_SUCCESS indicates the session started successfully. Any other
return value signifies an error.
When any session type is started, the API first reads the current HP-UX IPQoS configuration
stored in the HP-UX IPQoS database. It forms a list of HP-UX IPQoS adapters, where each
adapter contains a list of attached HP-UX IPQoS policies, and where each HP-UX IPQoS
policy contains a list of attached HP-UX IPQoS filters. It also communicates with the HP-UX
IPQoS kernel module.
An application can only have one active session (of any type) at a given time. Thus, to start a
new session, the current session (if one exists) must first be terminated. The functions
available to terminate a session are discussed in a following section.
Session Types
There are three session types in the HP-UX IPQoS API: