The information in this document is subject to change without notice.
Hewlett-Packard makes no warranty of any kind with regard to this manual, including, but
not limited to, the implied warranties of merchantability and fitness for a particular purpose.
Hewlett-Packard shall not be held liable for errors contained herein or direct, indirect,
special, incidental or consequential damages in connection with the furnishing, performance,
or use of this material.
Warranty
A copy of the specific warranty terms applicable to your Hewlett- Packard product and
replacement parts can be obtained from your local Sales and Service Office.
U.S. Government License
Proprietary computer software. Valid license from HP required for possession, use or copying.
Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software
Documentation, and Technical Data for Commercial Items are licensed to the U.S.
Government under vendor's standard commercial license.
This document describes how to use the HP-UX IPQoS API that is included with the HP-UX
IPQoS software.
The document printing date and part number indicate the document’s current edition. The
printing date will change when a new edition is printed. Minor changes may be made at
reprint without changing the printing date. The document part number will change when
extensive changes are made.
Document updates may be issued between editions to correct errors or document product
changes. To ensure that you receive the updated or new editions, subscribe to the appropriate
product support service. See your HP sales representative for details.
The latest version of this document can be found on line at:
http://www.docs.hp.com/en/netcom.html#IPQoS.
Intended Audience
This document is intended for system and network administrators and programmers
responsible for configuring, and managing HP-UX IPQoS using the HP-UX IPQoS API.
Administrators and programmers are expected to have knowledge of HP-UX and networking
concepts, commands and configuration, including knowledge of Transmission Control
Protocol/Internet Protocol (TCP/IP).
This document is not a tutorial.
New and Changed Documentation in This Edition
This is the first edition of this document.
5
Publishing History
Table 1Publishing History Details
Document
Manufacturing
Part Number
5991-0737HP-UX IPQoS A.01.00
Programmer’s Guide
Title
Operating Systems
Supported
HP-UX 11i v1
HP-UX 11i v2 (September
2004 or later)
Publication
Date
October 2005
What Is in This Document
HP-UX IPQoS A.01.00 Programmer’s Guide is divided into several chapters, and each
contains information about the HP-UX IPQoS API.
Chapter 1 Overview Use this chapter to obtain a summary and overview of HP-UX
IPQoS and the HP-UX IPQoS API.
Chapter 2 Using the HP-UX IPQoS API Use this chapter to learn about the
components involved in using the HP-UX IPQoS API.
Chapter 3 Troubleshooting Use this chapter to find some general tips for
troubleshooting the HP-UX IPQoS API.
Appendix A Functions Calls Use this appendix to find a summary reference list of all
functions included with the HP-UX IPQoS API.
Appendix B Return Codes Use this appendix to find a summary reference list of
HP-UX IPQoS API return codes.
Appendix C Code Example Use this appendix to find a code example that illustrates
how to create a simple configuration.
Typographic Conventions
This document uses the following conventions.
audit (5) An HP-UX manpage. In this example, audit is the name and 5 is the section
in the HP-UX Reference. On the web and on the Instant Information CD, it
may be a hot link to the manpage itself. From the HP-UX command line, you
can enter “man audit” or “man 5 audit” to view the manpage.
Book TitleThe title of a book. On the web and on the Instant Information CD, it may be
a hot link to the book itself.
6
KeyCap The name of a keyboard key. Note that Return and Enter both refer to the
same key.
EmphasisText that is emphasized.
Bold Text that is strongly emphasized.
Bold The defined use of an important word or phrase.
ComputerOut Text displayed by the computer.
UserInput Commands and other text that you type.
Command A command name or qualified command phrase.
VariableThe name of a variable that you may replace in a command or function or
information in a display that represents several possible values.
[] The contents are optional in formats and command descriptions. If the
contents are a list separated by |, you must choose one of the items.
{} The contents are required in formats and command descriptions. If the
contents are a list separated by |, you must choose one of the items.
... The preceding element may be repeated an arbitrary number of times.
| Separates items in a list of choices.
HP-UX Release Name and Release Identifier
Each HP-UX 11i release has an associated release name and release identifier. The uname (1)
command with the -r option returns the release identifier. This table shows the releases
available for HP-UX 11i.
Table 2HP-UX 11i Releases
Release
Identifier
B.11.23HP-UX 11i v2 (September 2004 or later)Intel Itanium and PA RISC
B.11.22HP-UX 11i v1.6Intel Itanium
B.11.11HP-UX 11i v1PA-RISC
Release Name
Supported Processor
Architecture
Related Documents
The following sections list references to related HP-UX IPQoS information.
7
HP Product Documentation
Information about HP-UX IPQoS can be found on docs.hp.com at:
http://www.docs.hp.com/en/netcom.html#IPQoS
Other relevant documents in this collection include:
HP-UX IPQoS A.01.00 Release Notes
HP-UX IPQoS A.01.00 Administrator’s Guide
HP-UX IPQoS White Paper
Manpages
The following is a list of manpages you can access by using the man manpage-name command
after installation:
•General Use:
ipqosadmin (1M): Information about ipqosadmin, the HP-UX IPQoS command-line
administration utility.
•Programmer’s Use (API):
— IpqosAPI (3c): General information about the HP-UX IPQoS API.
— IpqosSession (3c): Information about HP-UX IPQoS API sessions.
— IpqosAdapter (3c): Information about HP-UX IPQoS API adapters.
— IpqosPolicy (3c): Information about HP-UX IPQoS API policies.
— IpqosFilter (3c): Information about HP-UX IPQoS API filters.
— IpqosOverlapFilter (3c): Information about HP-UX IPQoS filter overlap conditions.
— IpqosStats (3c): Information about HP-UX IPQoS API statistics.
Related RFCs
The following table lists RFCs associated with HP-UX IPQoS. The Internet Engineering Task
Force (IETF) RFCs listed below can be located at: http://www.ietf.org/rfc.html
8
Table 3Relevant RFCs
RFCs Description
RFC 2474Definition of the Differentiated Services Field (DS Field) in
the IPv4 and IPv6 headers
RFC 2475An Architecture for Differentiated Services
RFC 2597Assured Forwarding PHB Group
RFC 2598An Expedited Forwarding PHB
9
HP Welcomes Your Comments
HP encourages your feedback about this document and is committed to providing
documentation that meets your needs.
Send comments to: netinfo_feedback@cup.hp.com
Include the document title, manufacturing part number, and any comment, error found, or
suggestion for improvement you have concerning this document. Also, please include what we
did right so we can incorporate it into other documents.
10
1Overview
This chapter provides an overview of the HP-UX IPQoS API. It provides an introduction to the
HP-UX IPQoS product, architecture and API. It also provides a usage overview which
includes programmatic requirements, a brief structural overview and functional overview of
the API, and also general information on man pages and return codes.
Chapter 111
Overview
Introduction
Introduction
This section briefly describes HP-UX IPQoS and its architecture. It also provides an
introduction to the HP-UX IPQoS API, including a structural and functional overview.
Introduction to HP-UX IPQoS (Background Information)
HP-UX IPQoS provides, for outgoing traffic on HP-UX hosts, traffic conditioning
(transmission prioritization for specified traffic classes) as well as DSCP (Differentiated
Services Code Point) marking and VLAN-priority marking. An HP-UX IPQoS configuration
can be loaded into the kernel either by using ipqosadmin to load a valid configuration file, or
through user-applications that utilize the HP-UX IPQoS API included with the product.
An HP-UX IPQoS configuration contains user-supplied definitions of traffic classes (filters)
and traffic-handling instructions (policies) that are assigned to configured adapters.
Note the following general properties about filters, policies and adapters:
•The purpose of a filter is to identify a certain class of traffic (based on characteristics such
as transport port number, destination IP address, etc.) on a network interface.
•The purpose of a policy is to define what action to perform on a class of traffic (such as
•Adapters represent LAN devices on the system on which HP-UX IPQoS policies can be
enforced.
•A filter can be attached to multiple policies, but can only be attached to one policy per
adapter.
•A filter is meaningful only when it is associated with a policy. Likewise, a policy is only
meaningful when it is associated with an adapter and has one or more filters associated
with it.
•An adapter may or may not have policies attached to it. For adapters that do not have any
associated policies, no HP-UX IPQoS controls are performed on their traffic.
For general (non-API specific) information on HP-UX IPQoS refer to the HP-UX IPQoS A.01.00 Administrator’s Guide, which can be found online at:
http://www.docs.hp.com/en/netcom.html#IPQoS
Chapter 112
HP-UX IPQoS Architecture
Figure 1-1, illustrates a high-level overview of the HP-UX IPQoS architecture.
Figure 1-1Architectural Overview
Overview
Introduction
As shown in Figure 1-1, HP-UX IPQoS operates in both user space and kernel space.
Also shown in Figure 1-1, HP-UX IPQoS inserts a module between the IP and the DLPI
layers, into the STREAMS plumbed by ifconfig.
HP-UX IPQoS supports as many network adapters (up to 128) as are configured on the
system.
Chapter 113
Overview
Introduction
Introducing the HP-UX IPQoS API
The HP-UX IPQoS API allows programmers to write applications that can perform the
following tasks:
•manipulate the HP-UX IPQoS configuration
•traverse the HP-UX IPQoS configuration
•obtain HP-UX IPQoS statistics
The benefits that the HP-UX IPQoS API offers include the following:
— Allows applications to be written that dynamically modify the current configuration. For
example, you can write applications to add to existing configurations. (The HP-UX IPQoS
command-line administration utility, ipqosadmin, does not offer additive loads. Using
ipqosadmin, the only way to change a configuration is to perform a -load operation,
which replaces the configuration.)
— Allows applications to be written that provide alternative output formats than to what the
command-line administration utility, ipqosadmin, provides. For example. you can write
an application that produces configuration information in html output format. Refer to
/opt/ipqos/examples/htmldump for a programmatic example.
— If you already have existing IPQoS applications, you can leverage them by modifying
them to work with the HP-UX IPQoS API.
As will be discussed in more detail in subsequent sections of this guide, note that:
— The tasks accomplished by HP-UX IPQoS API operations are performed in sessions.
Every HP-UX IPQoS API session begins with the API collecting information about the
current configuration since this is required for all three types of tasks the HP-UX IPQoS
API performs. Sessions are initiated and include session types that determine what
operations are permitted. Sessions are completed either by committing (saving) or by
aborting (not saving) the changes made during the session.
— HP-UX IPQoS configurations consist of objects made up of three classes: filter, policy and
adapter. The objects exist in a list structure. Objects are attached to lists, and then the
lists can be traversed to read and modify the objects in a configuration.
— HP-UX IPQoS also maintains statistics, in the HP-UX IPQoS kernel module, that are
available to programmers. Statistics are maintained on both filters and policies.
IMPORTANT The manpages associated with the HP-UX IPQoS API complement this guide
and are necessary references to successfully use the HP-UX IPQoS API.
Chapter 114
Overview
Introduction
These manpages are: IpqosAPI (3c), IpqosSession (3c), IpqosAdapter (3c),
IpqosPolicy (3c), IpqosFilter (3c), IpqosOverlapFilter (3c) and IpqosStats (3c).
See “Manpages” on page 18, for more information on these man pages.
Chapter 115
Overview
HP-UX IPQoS API Overview
HP-UX IPQoS API Overview
This section describes general overview information for using the HP-UX IPQoS API.
Subsequent chapters in this guide provide more detailed usage information.
Programmatic Requirements
To use the HP-UX IPQoS API, the application needs to:
•have super-user (root) privileges
•include the header file: #include <netinet/ipqos.h>
•link to the shared library libipqos.sl
IMPORTANT HP-UX IPQoS supplies only the 32-bit version of the shared library. Thus,
applications must be 32-bit.
IMPORTANT To use the HP-UX IPQoS API, HP-UX IPQoS must be in one of the ENABLED
states (refer to the HP-UX IPQoS A.01.00 Administrator’s Guide for more
information on HP-UX IPQoS states of operation).
Structural Overview (How to Use the HP-UX IPQoS API)
The HP-UX IPQoS API is based on the usage of objects, lists and sessions.
Objects: Objects are pointers to opaque structures. There are three object types: filters,
policies and adapters (IpqosFilter, IpqosPolicy, IpqosAdapter respectively). Filter objects
and policy objects can be constructed (created, destroyed, attached, deleted and copied) by the
programmer. The list of adapter objects is a fixed list that is built by the HP-UX IPQoS API
during session initialization. Thus, adapter objects cannot be constructed by the programmer.
All three types of objects have attributes that can be accessed (by using “get” type functions).
Filter objects and policy objects can also be modified (using “set” type functions).
Lists: When policy or filter objects are part of an active configuration, they exist in a list. Each
adapter object has an attached policy list and each policy object has an attached filter list.
Adapter, policy and filter lists can be traversed by the programmer.
Chapter 116
Overview
HP-UX IPQoS API Overview
Sessions: Every application that uses the HP-UX IPQoS API must start a session. The
function used to start a session is IpqosInitSession(). One of the arguments of this
function specifies a session type. There are three types of sessions: IPQOS_SESSION_CONFIG
(used for active “set” functions), IPQOS_SESSION_READ (used for passive ”get” functions) and
IPQOS_SESSION_STATS (used for functions related to obtaining and resetting statistics).
Sessions must be terminated. There are two ways of terminating a session: committing
(saving) or aborting (quitting without saving), using IpqosCommitSession() and
IpqosAbortSession(), respectively.
See the relevant sections of Chapter 2, “Using the HP-UX IPQoS API,” on page 21, for more
information on how the HP-UX IPQoS API uses objects, lists and sessions.
NOTEThe data structures used in HP-UX IPQoS are opaque and need not be an
explicit concern of programmers using the API.
Functional Overview (What You Can Do Using the HP-UX IPQoS API)
There are several types of tasks you can accomplish using the HP-UX IPQoS API functions.
There are also several possible ways to group these tasks. The list below groups the tasks in a
way that serves the purpose of describing the tasks from a high-level perspective. For
example, some common tasks that can be performed on filter and policy objects are discussed
together in this guide, to minimize redundancy.
NOTEThe HP-UX IPQoS API manpages group the functions slightly differently,
which is appropriate since the purpose of the manpages is to provide detailed
reference information. The groupings used in the manpages work best for
detailed syntactical descriptions where redundancy is not a concern.
The following list provides broad groups of functional tasks that can be accomplished using
the HP-UX IPQoS API. For each grouping, the text indicates where more information can be
found in this guide, as well as the relevant manpages to refer to for more information.
•Session Management: Initiating and Terminating Sessions.
- In this guide: See “Using Sessions” on page 22, for more information.
- Relevant manpage: IpqosSession (3c)
•Resource Management: Creating/Destroying/Copying (Filter and Policy) Objects
- In this guide: See “Using Objects” on page 25, for more information.
Attributes are: name, speed, link type, physical address.
- In this guide: See “Adapter Objects” on page 33, for more information.
- Relevant manpage: IpqosAdapter (3c)
•Obtaining/Resetting Policy and Filter Statistics
- In this guide: See “Statistics” on page 34, for more information.
- Relevant manpage: IpqosStats (3c)
•Checking for Overlapping Filters
- In this guide: See “Filter Objects” on page 30, for more information.
- Relevant manpage:IpqosOverlapFilter (3c)
Manpages
This guide only serves as an overview to the HP-UX IPQoS API. To write applications, you
will need to reference each of the following manpages, as needed, for detailed descriptions and
syntactical information. The manpages associated with the HP-UX IPQoS API are as follows:
Chapter 118
Overview
HP-UX IPQoS API Overview
•IpqosAPI (3c): Provides an overview of the HP-UX IPQoS API. It describes the types of
tasks programmers can perform with the API. It explains how sessions are used and
introduces the HP-UX IPQoS API object classes (IpqosFilter, IpqosPolicy, IpqosAdapter).
•IpqosSession (3c): Provides information on functions related to HP-UX IPQoS session
management. This includes details on: initiating sessions, committing sessions and
aborting sessions. It also discusses the three session types available.
•IpqosAdapter (3c): Provides information on functions related to HP-UX IPQOS adapters,
including: obtaining information about adapters, traversing the list of HP-UX IPQoS
adapters, and traversing the list of policies associated with adapters. It also includes
relevant session-related information.
•IpqosPolicy (3c): Provides information on functions related to HP-UX IPQoS policies,
including: creating policies, assigning and accessing values of policy attributes,
associating policies with adapters, and traversing the filter lists of the polices. It also
includes relevant session-related information.
•IpqosFilter (3c): Provides information on functions related to HP-UX IPQoS filters,
including: creating filters, assigning and accessing values of filter attributes, and
associating filters with policies. It also includes relevant session-related information.
•IpqosOverlapFilter (3c): Provides information on functions related to checking HP-UX
IPQoS filters for overlap conditions.
•IpqosStats (3c): Provides information on functions related to obtaining (and resetting)
statistics on the filters and policies of the HP-UX IPQoS configuration.
Return Codes
Most functions in the HP-UX IPQoS API return a uint32_t value that represents the return
code of the function call. When successful, the return code will be the symbolic constant
IPQOS_S_SUCCESS.
In some cases, other values will be returned, which may or may not indicate a failure. For
example, the list traversal routines may return the value IPQOS_S_LIST_EMPTY. You may
receive this value if you are trying to set the traversal to the head of the list, and the list is
empty. Or, you may receive this value if you are trying to traverse to the next item in the list
and there are no more items in the list.
In general, for “get” functions: A return of IPQOS_E_ATTRIBUTE_NOT_SET signifies that the
attribute is not set for the object. A return of IPQOS_S_SUCCESS signifies the attribute is set.
Any other return code is an error.
In general, for “set” functions: A return of any value other than IPQOS_S_SUCCESS signifies an
error.
Chapter 119
Overview
HP-UX IPQoS API Overview
All return codes have a corresponding native-language string representation. The string
representation can be obtained from the uint32_t return code by calling the function:
const char * IpqosStrerror(uint32_t errCode);
The string representation is suitable for use in error messages.
See Appendix B, “Return Codes,” on page 49, for a list of return codes and their corresponding
mnemonics and message strings.
For more information on IpqosStrerror(), refer to the IpqosSession (3c) manpage.
Restoring Configurations to the Kernel after Reboot
The HP-UX IPQoS API maintains a configuration database that is synchronized with the
HP-UX IPQoS configuration loaded in the kernel modules. This allows the HP-UX IPQoS
subsystem to restore the last installed configuration whenever it is restarted.
Sample Program
A sample program, “htmldump” is included with HP-UX IPQoS. This purpose of this program
is to provide configuration information in an HTML output format. The “htmldump” program
can be found under the directory /opt/ipqos/examples. Also, see Appendix C, “Code
Example,” on page 53, for a pseudo-code sample that illustrates how to create a simple
configuration.
Chapter 120
2Using the HP-UX IPQoS API
This chapter provides an overview of how to use the components that comprise the HP-UX
IPQoS API. It discusses the following usage areas: sessions, objects and lists; filter, policy,
and adapter objects; and statistics.
Chapter 221
Using the HP-UX IPQoS API
Using Sessions
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:
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:
Chapter 222
Using the HP-UX IPQoS API
Using Sessions
•Configuration sessions (IPQOS_SESSION_CONFIG): Use to traverse and to make changes to
the current HP-UX IPQoS configuration.
•Read sessions (IPQOS_SESSION_READ): Use to only traverse the current HP-UX IPQoS
configuration.
•Statistics sessions (IPQOS_SESSION_STATS): Use to traverse and obtain statistics
maintained on the current HP-UX IPQoS configuration.
At any point in time there can only be one IPQOS_SESSION_CONFIG or IPQOS_SESSION_STATS
type session running on the system. There can be simultaneous IPQOS_SESSION_READ type
sessions, even when an IPQOS_SESSION_CONFIG or IPQOS_SESSION_STATS is open.
Terminating a Session
There are two ways (functions available) to terminate a session:
•Committing (saving) the session (IpqosCommitSession): Use this function to commit
(save) all the configuration actions performed in the session to the HP-UX IPQoS kernel
module and update the HP-UX IPQoS database accordingly. (This function can only be
called from an IPQOS_SESSION_CONFIG type session.)
If there are no errors, it also closes the session. However, if the function does not return
IPQOS_S_SUCCESS, then none of the configuration actions performed in the session are
applied (saved) to the configuration in the kernel module or to the database. In this case,
programmers are recommended to not re-try the IpqosCommitSession(), but rather to
use IpqosAbortSession() to close the session.
•Aborting the session (IpqosAbortSession): Use this function to abort (quit without
saving) a session and close it. If the session is of type IPQOS_SESSION_CONFIG this
function will effectively ignore all the configuration actions and leave the configuration in
the HP-UX IPQoS kernel module and database unchanged.
NOTEExiting an application without explicitly calling IpqosCommitSession() or
IpqosAbortSession() is equivalent to having called IpqosAbortSession().
Object Status
To determine if a policy or filter object is currently configured, use the following functions:
IpqosGetFilterStatus(), IpqosGetPolicyStatus(). The possible status conditions, and
their implications, are:
•IPQOS_STATUS_ACTIVE: The filter (or policy) object is attached to a policy (or adapter)
object, and is currently active in the HP-UX IPQoS kernel module.
Chapter 223
Using the HP-UX IPQoS API
Using Sessions
•IPQOS_STATUS_INACTIVE: The filter (or policy) object was created in the current session
and is not currently attached to a policy (or adapter) object.
•IPQOS_STATUS_ACTIVE_UPON_COMMIT: The filter (or policy) object was created in the
current session, is attached to a policy (or adapter) object and will become active in the
HP-UX IPQoS kernel module after IpqosCommitSession() is successfully called.
•IPQOS_STATUS_INACTIVE_UPON_COMMIT: The filter (or policy) object is attached to a policy
(or adapter) and is active in the HP-UX IPQoS kernel module, but will be deleted after
IpqosCommitSession() is successfully called.
These functions are useful in IPQOS_SESSION_CONFIG sessions to distinguish between objects
attached or deleted in the current session (and thus pending a commit) versus objects that
were previously configured.
Based on object status, there are some restrictions as to allowable functions to call. For
example:
•If the object status of a filter or policy object is not IPQOS_STATUS_INACTIVE, you can not
successfully call: IpqosAttachFilter() or IpqosAttachPolicy(). The functions will
return the code IPQOS_E_ALREADY_ATTACHED.
•If the object status of a filter or policy object is IPQOS_STATUS_INACTIVE, you can not
successfully call: IpqosDeleteFilter() or IpqosDeletePolicy(). The functions will
return the code IPQOS_E_NOT_ATTACHED.
Chapter 224
Using the HP-UX IPQoS API
Using Objects
Using Objects
HP-UX IPQoS API “objects” are pointers to opaque structures. There are three types of
objects: filters, policies, and adapters. The following sections briefly describe some key
considerations about working with objects when using the HP-UX IPQoS API.
Creating, Copying and Destroying Objects
HP-UX IPQoS API resource management functions exist that create, copy and destroy filters
and policies. These functions are: IpqosCreateFilter(), IpqosCopyFilter(),
IpqosDestroyFilter(), IpqosCreatePolicy(), IpqosCopyPolicy() and
IpqosDestroyPolicy() respectively.
Both the IpqosDestroyFilter() and IpqosDestroyPolicy() functions take an argument
that is a pointer to the object. When an object is destroyed, the resources are freed up and its
pointer is set to NULL to prevent further use of that pointer.
Adapter objects cannot be created, copied or destroyed. They are managed by the HP-UX
IPQoS API based on the list of network adapters that have been configured on the system.
Object Attributes
HP-UX IPQoS API objects have attributes that can be read or modified.
All objects, (filter, policy and adapter) have a (required) name attribute that must be unique.
Filter and policy objects have a status attribute, which can be one of the following:
IPQOS_STATUS_ACTIVE, IPQOS_STATUS_INACTIVE, IPQOS_STATUS_ACTIVE_UPON_COMMIT,
IPQOS_STATUS_INACTIVE_UPON_COMMIT. These indicate the status, taking into account
whether or not the session has been or will be committed, after an action function has been
performed.
Filter and policy objects also have attributes that can be read (using “get” functions) or
modified (“set” functions). Adapter objects also have attributes, but these can only be read
(using “get” functions).
See following sections of this chapter for a complete listing of the attributes associated with
filter, policy, and adapter objects.
Chapter 225
Using the HP-UX IPQoS API
Using Lists
Using Lists
When a policy or filter object is part of an active configuration, it exists in a list. Each adapter
object may have a list of policy objects and each policy object may have a list of filter objects.
Figure 2-1 illustrates how lists are used in the HP-UX IPQoS API.
Figure 2-1Lists
Chapter 226
Using the HP-UX IPQoS API
Using Lists
Attaching Objects to Lists
When an object exists in a list it is said to be attached. When an object is created or copied it is
(initially) considered unattached, until it is explicitly attached. To attach a policy or filter to a
list, use the following functions: IpqosAttachPolicy(), IpqosAttachFilter().
Restrictions
There are two restrictions for attaching a filter object to a list:
•The filter must have its name attribute set. The name must be unique.
•If the filter’s destination physical address attribute is set, the length of the address must
be compatible with the adapter object to which the associated policy object is attached.
There are two restrictions for attaching a policy object to a list:
•The policy must have its name attribute set. The name must be unique.
•If the policy’s reservation bandwidth attribute is set, it must be a value such that the
aggregate reservation of all policy objects attached to an adapter object does not exceed
the line speed of the adapter, less 80 Kbps. The 80 Kbps is set aside for classes of traffic
that do not match any specified filters.
In the case of VLANs, the aggregate of the reservations of policies of VLANs that are
based on the same physical adapter, and the policies of the base adapter itself, cannot
exceed the speed of the physical adapter minus the 80Kbps reserved by the implicit
default flow.
There are two functions that remove objects from lists. An object can be detached from the list
by calling one of the delete functions. The object becomes detached when the session is
committed. The object’s memory and resources can be freed by calling one of the destroy
functions.
To delete an object its status must not be IPQOS_STATUS_INACTIVE, otherwise the function
will return IPQOS_E_NOT_ATTACHED.
To destroy an object its status must be IPQOS_STATUS_INACTIVE, otherwise the function will
return the error code IPQOS_E_ALREADY_ATTACHED.
Traversing Lists
As shown in Figure 2-1, the lists are singly-linked and can only be traversed one way.
To obtain the object at the head of an object list, use the following functions:
To obtain the next object in a list, use the following functions: IpqosGetAdapterListNext(),
IpqosGetPolicyListNext(), IpqosGetFilterListNext(). These functions return
IPQOS_LIST_EMPTY if the end of the list has been reached, that is, there is no such object.
Functions exist that count the number of items in a list. To obtain the count, use the following
functions: IpqosGetFilterListCount(), IpqosGetPolicyListCount() and
IpqosGetAdapterListCount().
Code Example: Traversing An Adapter List
The following code sample illustrates one way to traverse an adapter list. In this example, the
count value determines the loop.
The example uses a function QosError(), which terminates the program gracefully after
reporting the error. Note that this function is shown for illustrative purposes as part of the
example, it is not part of the HP-UX IPQoS API. If you want to use a similar function in your
programs, you will need to create one.
IpqosAdapter ipqosAdaptr;
...
result = IpqosGetAdapterListHead(&ipqosAdaptr);
while (true)
(
uint32_t pcount;
if (result == IPQOS_S_LIST_EMPTY)
break;
if (result != IPQOS_S_SUCCESS)
QosError(__FILE__, __LINE__, result);
result = IpqosGetPolicyListCount(ipqosAdaptr, &pcount);
if (result != IPQOS_S_SUCCESS)
QosError(__FILE__, __LINE__, result);
if (pcount > 0) //The adapter’s policy list is not empty
...<do something with the policy list here>...
}
result = IpqosGetAdapterListNext(&ipqosAdaptr);
if (result != IPQOS_S_SUCCESS &&
result != IPQOS_S_LIST_EMPTY)
QosError(__FILE__, __LINE__, result);
}
Chapter 228
Using the HP-UX IPQoS API
Using Lists
Deleting Policies and Filters (Detaching From a List)
To delete a policy or filter (and effectively detach it from the list) use the following functions:
IpqosDeletePolicy(), IpqosDeleteFilter().
If you want to delete all policies (and their associated filters) from an adapter there is a
function to accomplish this task called IpqosDeleteAll(). This function has one argument,
the adapter (IpqosAdapter). If you want to delete all policies (and their associated filters)
from all adapters, specify NULL as the IpqosAdapter argument. In this case, the entire
HP-UX IPQoS configuration is deleted, once the session is committed.
Chapter 229
Using the HP-UX IPQoS API
Filter Objects
Filter Objects
Filter objects define classes of traffic based on a combination of one or more attributes. IP
traffic that matches the class of traffic defined by a filter gets processed by the policy that the
filter is attached to. A filter can only be attached to multiple policies, but can only be attached
to one policy per adapter. A filter is effectively ignored if it is not attached to any policy.
Filter-related functions in the HP-UX IPQoS API allow programmers to create filters, assign
(“set”) and access (“get”) values of their attributes, and associate filters with policies.
Table 2-1 lists the attributes associated with filter objects.
Table 2-1Attributes Associated with Filter Objects
Object TypeAttributes
Filterunique name
source addresses
destination addresses
source port numbers
destination port numbers
network protocol number (0x800 or 0x86DD)
transport protocol number (tcp or udp)
destination physical address
DSCP(s)
priority
status
Filter Overlap
A filter is said to overlap another filter if:
— both filters are associated with the same adapter
— the priority attribute of the filter is of equal or greater priority than the other
— the filter defines a set of traffic that is a superset of the traffic defined by the other filter
(complete overlap), or has an intersection with the traffic defined by the other filter
(partial overlap)
Chapter 230
Using the HP-UX IPQoS API
Filter Objects
A completely overlapping (superset) filter prevents any traffic from matching the other filter
and effectively renders the other filter completely ineffective. A partial overlap (intersection)
renders the other function partially ineffective. An HP-UX IPQoS configuration with
overlapping filters is not recommended. Filters should be redefined to avoid having complete
or partial overlap conditions.
The HP-UX IPQoS API has a function IpqosCheckFilterOverlap() to assist with checking
for these cases. Refer to the IpqosOverlapFilter (3c) manpage for more detailed information on
how to check for overlapping filters.
Chapter 231
Using the HP-UX IPQoS API
Policy Objects
Policy Objects
Policy objects define actions to perform on classes of traffic attached to the policy. A policy
must have one or more unique filters attached to it. It is these filters which determine which
classes of traffic the policy will govern. A policy is effectively ignored if it is not attached to
any adapter.
Policy-related functions in the HP-UX IPQoS API allow programmers to create policies,
assign (“set”) and access (“get”) values of their attributes, associate them with adapters, and
traverse their filters’ lists.
Table 2-2 lists the attributes associated with policy objects.
Table 2-2Attributes Associated with Policy Objects
Object TypeAttributes
Policyunique name
reservation bandwidth
maximum bandwidth
DSCP
VLAN priority
status
Chapter 232
Using the HP-UX IPQoS API
Adapter Objects
Adapter Objects
Adapter objects are not constructed by the programmer. Instead, every session contains a
fixed list of adapter objects managed by the HP-UX IPQoS API based on the list of network
adapters that have been configured on the system.
Adapter-related functions in the HP-UX IPQoS API allow programmers to access (“get”)
values of its attributes, traverse the list of adapters, and traverse the list of policies of an
adapter.
Table 2-3 lists the attributes associated with adapter objects.
Table 2-3Attributes Associated with Adapter Objects
Object TypeAttributes
Adapterunique name (PPA name)
transmission speed
link type
physical address
NOTEIn this release, the link type will always be DL_ETHER.
Chapter 233
Using the HP-UX IPQoS API
Statistics
Statistics
The HP-UX IPQoS API offers functions to obtain and reset statistics on a policy and on one or
all of its associated filters. Functions related to statistics must be called from
IPQOS_SESSION_STATS type sessions.
A function IpqosGetPolicyStats() retrieves the counters for the statistics. Once it is called,
functions that get specific counter information can be called (for example,
IpqosGetPolicyStatsByteCount()).
From a high-level (pseudo-code) perspective the technique to obtain HP-UX IPQoS statistics
for all policies and filters is as follows:
—Start an IPQOS_SESSION_STATS session. This will read the current HP-UX IPQoS
configuration.
— Traverse the list of adapters and the policy list of each adapter in the configuration.
—Call IpqosGetPolicyStats() for the policy.
— Get the specific statistics counters for the policy using the appropriate functions.
— Traverse the list of filters for the policy.
— Get the statistics counters for the filters using the appropriate functions.
Repeat for all policies as needed.
Table 2-4 lists the counters maintained by the HP-UX IPQoS kernel module for every active
IpqosFilter (3c), IpqosOverlapFilter (3c) and IpqosStats (3c).
•For a list of function return codes and their meaning, refer to Appendix B, “Return
Codes,” on page 49. Identify the cause of the error, and fix the problem accordingly.
•If appropriate, you can use ipqosadmin, the user-interface command utility provided with
HP-UX IPQoS, to obtain information about the configuration. Refer to the ipqosadmin
(1m) manpage for information on how to use ipqosadmin.
•You can continue to use the same general HP-UX networking utilities you typically use to
get useful information on the network. There is nothing new or different about using
these utilities when running and troubleshooting the HP-UX IPQoS API.
Some of the general networking utilities available include: netstat, ifconfig, syslog,
nettl, traceroute, route, ping, and lanadmin. Refer to the respective online manpages
for more information on how to use these utilities and how to interpret output from them.
Public domain utilities such as tcpdump and MRTP (multi-router traffic grapher) can also
provide helpful information about the network. HP includes the tcpdump utility as part of
the HP-UX Internet Express bundle, available on HP Software Depot, at
http://www.hp.com/go/softwaredepot.
Chapter 336
Troubleshooting
Reporting Problems to HP
Reporting Problems to HP
When reporting problems to HP, include the following information:
•A complete description of the problem and any error messages. Include information about:
— the error code returned by the function being called
— what the code is trying to do
— log files (such as /var/adm/syslog/syslog.log)
Include a description of what works, as well as what does not work.
•You can look for messages logged by the HP-UX IPQoS API library in
/var/adm/syslog/syslog.log, under the name libipqos.
•HP-UX IPQoS database file(s):
/opt/ipqos/db/ipqosdb.db (and /opt/ipqos/db/ipqosdb.db.bak if it exists)
•If the problem is reproducible, and you suspect errors in API-kernel communications, set
the HP-UX IPQoS loglevel to debug (run, ipqosadmin -loglevel debug) to capture
HP-UX IPQoS kernel module debug messages. Save and include the log file (by default,
messages go to /var/adm/syslog/syslog.log).
Chapter 337
Troubleshooting
Reporting Problems to HP
Chapter 338
AFunction Calls
This appendix contains several tables, which together provide a complete list of functions
available with the HP-UX IPQos API. The functions have been grouped to correspond to the
grouping and discussion of these functions in the HP-UX IPQoS API manpages.
Appendix A39
Function Calls
Session-Related Function Calls
Session-Related Function Calls
The following table lists the HP-UX IPQoS API function calls related to session management.
Refer to the IpqosSession (3c) manpage for detailed information on these functions.
Table A-1Session-Related Functions
DescriptionFunction
initiate a sessionuint32_t IpqosInitSession (uint32_t version,
char * configName, IpqosSessionType sessionType)
get session typeIpqosSessionType IpqosGetSessionType()
commit sessionuint32_t IpqosCommitSession()
abort sessionuint32_t IpqosAbortSession()
get description of
return code
char * IpqosStrerror(uint32_t errCode)
Appendix A40
Function Calls
Adapter-Related Function Calls
Adapter-Related Function Calls
The following table lists the HP-UX IPQoS API function calls related to adapters. Refer to the
IpqosAdapter (3c) manpage for detailed information on these functions.
Table A-2Adapter-Related Functions
DescriptionFunction
get name of adapter uint32_t IpqosGetAdapterName(IpqosAdapter adapter,
char ** name)
get speed of adapteruint32_t IpqosGetAdapterSpeed(IpqosAdapter adapter,
uint64_t *speed)
get link type of adapteruint32_t IpqosGetAdapterLinkType(IpqosAdapter
The following table lists the HP-UX IPQoS API function calls related to policies. Refer to the
IpqosPolicy (3c) manpage for detailed information on these functions.
The following table lists the HP-UX IPQoS API function calls related to filters. Refer to the
IpqosFilter (3c) manpage for detailed information on these functions.
The following table lists the HP-UX IPQoS API function calls related to filter overlaps. Refer
to the IpqosOverlapFilter (3c) manpage for detailed information on these functions.
Table A-5Filter Overlap-Related Functions
DescriptionFunction
checks if filter1 overlaps
filter2
checks if source
addresses for filter1
overlap those of filter2
checks if destination
addresses for filter1
overlap those of filter2
checks if source port
numbers for filter1
overlap those of filter2
checks if destination
port numbers for filter1
overlap those for filter2
checks if network
protocol for filter1
overlaps that of filter2
checks if transport
protocol for filter1
overlaps that of filter2
The following table lists the HP-UX IPQoS API function calls related to statistics. Refer to the
IpqosStats (3c) manpage for detailed information on these functions.
Table A-6Statistics-Related Functions
DescriptionFunction
Get Statistics Counters
of policy (plus all its
filters)
This appendix contains a simple pseudo-code program that illustrates how to create a simple
HP-UX IPQoS configuration.
Appendix C53
Code Example
Configuration Code Example
Configuration Code Example
The following pseudo-code example shows how to use the HP-UX IPQoS API to reserve 50%
bandwidth on lan0 for traffic with destination port numbers in the range of 80-100.
##########
function checkResult(function, result){
if (result != IPQOS_S_SUCCESS){
main(){
/* start a session of type IPQOS_SESSION_CONFIG */
result = IpqosInitSession(IPQOS_API_VERSION_ID_1,NULL,
IPQOS_SESSION_CONFIG)
checkResult(“IpqosInitSession”,result);
/* look for lan0 in adapter list */
result = IpqosGetAdapterListHead(&ipqosAdapter);
while(result != IPQOS_S_LIST_EMPTY){
/* get the name of the adapter and compare with lan0 */
result = IpqosGetAdapterName(ipqosAdapter,&adapterName);
checkResult(“IpqosGetAdapterName”,result);
if (adapterName == “lan0”)
break; /* found it! */
/* continue search */
result = IpqosGetAdapterListNext(&ipqosAdapter);
}
/* did we find lan0 at all? */
if (result == IPQOS_S_LIST_EMPTY){
print “Error: could not find lan0 in API’s adapter list”
exit;
Appendix C54
}
/* Create an IpqosPolicy */
result = IpqosCreatePolicy(&ipqosPolicy);
checkResult(“IpqosCreatePolicy”,result);
/* API mandates name, so give it one */
result = IpqosSetPolicyName(ipqosPolicy,”testPolicy”);
checkResult(“IpqosSetPolicyName”,result);
/* Set the 50% reservation amount */
result = IpqosSetPolicyReservation(ipqosPolicy,50,
IPQOS_VALUE_MODE_RELATIVE);
checkResult(“IpqosSetPolicyReservation”,result);
/* Attach the policy to the adapter for lan0 */
result = IpqosAttachPolicy(ipqosPolicy,ipqosAdapter);
checkResult(“IpqosAttachPolicy”,result);
/* Create an IpqosFilter */
result = IpqosCreateFilter(&ipqosFilter);
checkResult(“IpqosCreateFilter”,result);
/* API mandates name, so give it one */
result = IpqosSetFilterName(ipqosFilter,”testFilter”);
checkResult(“IpqosSetFilterName”,result);
Code Example
Configuration Code Example
/* Set the dst port number range */
result = IpqosSetFilterDstPortNumbers(ipqosFilter,80,100);
checkResult(“IpqosSetFilterDstPortNumbers”,result);
/* Attach the filter to the policy */
result = IpqosAttachFilter(ipqosFilter,ipqosPolicy);
checkResult(“IpqosAttachFilter”,result);
/* commit the session! */
result = IpqosCommitSession();
checkResult(“IpqosCommitSession”,result);
}
#############
code example - traversing a list
copying a filter, 25
copying a policy object, 25
counters for statistics, 34
creating a filter object, 25
creating a policy object, 25
D
deleting a filter object
deleting a policy object, 29
destroying a filter object, 25
destroying a policy object, 25
documentation available on HP-UX IPQoS, 8
tasks performed by HP-UX IPQoS API
tasks performed by the HP-UX IPQoS API,
tcpdump, 36
terminating a session, 23
that, 25
traverse a configuration, 14
traversing a list - code example, 28
traversing lists, 27
troubleshooting, 36
V
/var/adm/syslog/syslog.log
, 12, 32
, 37
, 20
22
, 14
14
, 37
58
Index
59
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.